/* 83_hires.css - "Higher resolution": the button at the top of a machine record and the close-up view (83_hires.js).
   Tokens only (01_tokens.css, and the 3D view's --kp3d-bg). The loading card, its bar, its buttons and the square
   view buttons are the 3D view's own classes (70_3d.css: .kp3d-card, .kp3d-prog, .kp3d-bar, .kp3d-btn, .kp3d-nb);
   the top bar uses the house-bar tokens, so the close-up reads as the same app in light and dark. */

/* ---- entry: first thing under the record's heading ---- */
.hr-entry { margin: 0 0 var(--sp-4); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line); }
.hr-entry[hidden] { display: none; }
.hr-entry-btn { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); width: 100%; min-height: 48px; padding: 0 var(--sp-4); font-size: 16px; font-weight: 600; color: var(--navy); touch-action: manipulation; }
[data-theme="dark"] .hr-entry-btn { color: var(--ink); }
.hr-entry-btn svg { flex: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hr-entry-note { margin: var(--sp-2) 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }

/* ---- the close-up: a full-screen dialog (top layer), bar on top, the stage below ---- */
.hr-view { position: fixed; inset: 0; box-sizing: border-box; width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; background: var(--kp3d-bg); color: var(--ink); font-family: var(--font); font-size: 14px; }
.hr-view[open] { display: flex; flex-direction: column; }
.hr-view::backdrop { background: var(--kp3d-bg); }
.hr-view [hidden] { display: none !important; }

.hr-bar { position: relative; z-index: 2; flex: none; display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; box-sizing: border-box; padding: 6px max(var(--sp-4), env(safe-area-inset-right)) 6px max(var(--sp-3), env(safe-area-inset-left)); padding-top: max(6px, env(safe-area-inset-top)); background: var(--kp-bar); color: var(--kp-bar-ink); box-shadow: var(--kp-bar-shadow); }
.hr-back { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 14px 0 8px; border: 1px solid var(--kp-bar-line); border-radius: var(--r-sm); background: transparent; color: var(--kp-bar-ink); font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.hr-back:hover { background: var(--kp-bar-tint); }
.hr-back:focus-visible { outline: 2px solid var(--kp-bar-ring); outline-offset: 2px; }
.hr-back svg { flex: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hr-back-short { display: none; }
.hr-titles { flex: 1 1 auto; min-width: 0; }
.hr-name { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.25; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-sub { display: flex; align-items: baseline; gap: var(--sp-2); margin: 1px 0 0; font-size: 13px; line-height: 1.3; color: var(--kp-bar-ink-2); white-space: nowrap; overflow: hidden; }
.hr-sub-id { flex: none; font-variant-numeric: tabular-nums; }
.hr-sub-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hr-sub-what::before { content: "- "; }

.hr-stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: var(--kp3d-bg); }
.hr-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; opacity: 0; outline: none; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.hr-canvas:active { cursor: grabbing; }
.hr-view.is-ready .hr-canvas { opacity: 1; }
.hr-canvas:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.hr-nav { position: absolute; z-index: 3; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.hr-hint { position: absolute; z-index: 3; left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom)); box-sizing: border-box; max-width: calc(100% - 96px); margin: 0; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-soft); font-size: 14px; line-height: 1.35; box-shadow: var(--shadow); pointer-events: none; }
.hr-hint.is-off { opacity: 0; }
.hr-view:not(.is-ready) .hr-nav, .hr-view:not(.is-ready) .hr-hint { visibility: hidden; }

@media (prefers-reduced-motion: no-preference) {
  .hr-canvas { transition: opacity var(--dur-slow) var(--ease-out); }
  .hr-hint { transition: opacity var(--dur-slow) var(--ease); }
}

/* phone: a short Back label, and the title keeps the room */
@media screen and (max-width: 560px) {
  .hr-bar { gap: var(--sp-2); }
  .hr-back { padding: 0 12px 0 6px; }
  .hr-back-long { display: none; }
  .hr-back-short { display: inline; }
  .hr-name { font-size: 16px; }
}
@media print { .hr-view { display: none !important; } }
