/* Shared look of the portfolio's 3D work scenes: the same dark studio as the reactor viewer.
   One full-bleed canvas; title on top; the story panel docks at the bottom (or down the right side on
   short landscape screens); part cards float above. */
:root {
  color-scheme: dark;
  --bg: #050506;
  --panel: rgba(16, 17, 22, 0.8);
  --line: rgba(255, 255, 255, 0.10);
  --fg: #eef0f4;
  --muted: #9aa0ad;
  --dim: #c4c8d2;
  --violet: #b59cff;
  --orange: #ff7a2f;
  --gold: #ffc35a;
  --accent: var(--orange);
  --display: "Inter Tight", "SF Pro Display", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --body: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --bottom: max(14px, env(safe-area-inset-bottom, 0px));
  --tap: 36px;
  --side-w: clamp(260px, 38vw, 360px);
}
@media (pointer: coarse) { :root { --tap: 40px; } }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
.app { position: relative; height: 100vh; height: 100dvh; overflow: hidden; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fade { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
.fade.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .fade { transition: none; } }

/* ---------- top bar ---------- */
.top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
       padding: max(16px, env(safe-area-inset-top, 0px)) var(--gutter-r) 0 var(--gutter); pointer-events: none; isolation: isolate; }
.top::before { content: ""; position: absolute; inset: 0 0 -28px 0; z-index: -1; pointer-events: none; opacity: .85;
               background: linear-gradient(rgba(5, 5, 6, 0.88), rgba(5, 5, 6, 0.6) 60%, rgba(5, 5, 6, 0)); }
.head { min-width: 0; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--violet); }
h1 { margin: 8px 0 6px; font-family: var(--display); font-weight: 700; font-size: clamp(20px, 3vw, 34px); line-height: 1.05; letter-spacing: -0.03em; text-wrap: balance; }
.credits { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; color: rgba(154, 160, 173, 0.6); font-size: 12.5px; }
.credit { pointer-events: auto; display: inline-block; padding: 3px 0; margin-bottom: 4px; font-size: 12.5px; color: var(--muted); text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, 0.16); line-height: 1.2; }
.credit:hover, .credit:focus-visible { color: var(--fg); border-bottom-color: var(--violet); outline: none; }
.hint { font-size: 13px; color: var(--muted); }

/* ---------- labels on the model ---------- */
.tag { position: absolute; left: 0; top: 0; width: 0; height: 0; padding: 0; margin: 0; border: 0; background: none; color: var(--fg); font: 500 12.5px/1 var(--body); letter-spacing: 0.01em; white-space: nowrap; pointer-events: none; cursor: pointer; will-change: transform; }
.tag .lbl { position: absolute; left: 0; top: 0; padding: 6px 9px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: auto; transition: background-color .2s, color .2s; }
.tag .dot { position: absolute; left: -6px; top: -6px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--tag, var(--orange)); box-shadow: 0 0 0 2px rgba(255, 122, 47, 0.18); pointer-events: auto; }
.tag .lead { position: absolute; left: 0; top: 0; height: 1px; width: 0; background: var(--tag, rgba(255, 122, 47, 0.6)); opacity: .75; transform-origin: 0 50%; }
.tag.static, .tag.static .lbl, .tag.static .dot { pointer-events: none; cursor: default; }
.tag.active .lbl { background: var(--orange); border-color: var(--orange); color: #140a04; }
.tag:focus-visible .lbl { outline: 2px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- story panel ---------- */
.panel { position: absolute; left: 50%; bottom: var(--bottom); transform: translateX(-50%); width: min(820px, calc(100% - var(--gutter) - var(--gutter-r)));
         pointer-events: auto; padding: 12px 12px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.tour { display: flex; align-items: stretch; gap: 10px; width: 100%; }
.tour-body { flex: 1; min-width: 0; }
.meta { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.meta .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.tour h2 { margin: 5px 0 4px; font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -0.015em; line-height: 1.2; }
.tour p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--dim); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; padding: 0; list-style: none; }
.facts li { font-size: 12.5px; color: var(--muted); }
.facts b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 4px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.nav { flex: none; width: var(--tap); border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--fg); font-size: 20px; cursor: pointer; }
.nav:hover { border-color: rgba(255, 255, 255, 0.28); }
.nav:disabled { opacity: .3; cursor: default; }
.dots { display: flex; gap: 0; margin-right: auto; }
.dots button { width: 24px; height: var(--tap); border: 0; background: none; cursor: pointer; padding: 0; }
.dots button::before { content: ""; display: block; width: 8px; height: 8px; margin: auto; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
.dots button[aria-current="step"]::before { background: var(--accent); }
.chip { font: 500 13px/1 var(--body); color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 0 13px; min-height: var(--tap); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; text-decoration: none; }
.chip[aria-pressed="true"] { color: var(--fg); border-color: rgba(181, 156, 255, 0.55); background: rgba(181, 156, 255, 0.12); }
.chip:hover { border-color: rgba(255, 255, 255, 0.28); }
.chip.go { color: var(--fg); border-color: rgba(255, 122, 47, 0.55); background: rgba(255, 122, 47, 0.12); }
.chip:focus-visible, .nav:focus-visible, .dots button:focus-visible, .x:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* part card */
.info { position: absolute; right: var(--gutter-r); top: 76px; width: min(340px, calc(100% - 32px)); padding: 16px 18px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); pointer-events: auto; overflow-y: auto; }
.info .k { font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--orange); }
.info h2 { margin: 8px 30px 8px 0; font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -0.015em; line-height: 1.2; }
.info p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--dim); }
.info .x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; }

.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; letter-spacing: 0.08em; }
body.ready .loading { display: none; }
.nojs { position: absolute; left: var(--gutter); right: var(--gutter-r); bottom: 24px; color: var(--dim); font-size: 14px; }

@media (max-width: 820px) and (orientation: portrait) {
  .info { top: auto; bottom: calc(var(--dock-h, 180px) + var(--bottom) + 10px); left: var(--gutter); right: var(--gutter-r); width: auto; max-height: 40vh; }
}
@media (max-width: 640px) {
  .top::before { opacity: 1; }
  .top { padding-top: max(12px, env(safe-area-inset-top, 0px)); }
  h1 { margin: 6px 0 4px; font-size: 21px; }
  .hint { display: none; }
  .credit { margin-bottom: 0; }
  .panel { padding: 10px 10px; border-radius: 14px; }
  .tour { gap: 6px; }
  .tour h2 { font-size: 17px; } .tour p { font-size: 13px; }
  .facts { gap: 4px 12px; margin-top: 6px; } .facts li { font-size: 12px; }
  .chip { padding: 0 11px; font-size: 12.5px; }
  .dots button { width: 24px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  :root { --tap: 34px; }
  .top::before { opacity: 1; inset: 0 0 -16px 0; }
  .top { right: calc(var(--side-w) + var(--gutter-r) + 8px); padding-top: max(10px, env(safe-area-inset-top, 0px)); }
  .eyebrow { font-size: 10px; }
  h1 { font-size: 18px; margin: 4px 0 0; }
  .hint { display: none; }
  .panel { left: auto; right: var(--gutter-r); top: max(8px, env(safe-area-inset-top, 0px)); bottom: max(8px, env(safe-area-inset-bottom, 0px)); transform: none;
           width: var(--side-w); overflow-y: auto; overscroll-behavior: contain; padding: 10px 10px; border-radius: 14px; }
  .tour { gap: 6px; } .nav { width: 30px; }
  .tour h2 { font-size: 16px; } .tour p { font-size: 12.5px; }
  .facts li { font-size: 11.5px; }
  .chip { padding: 0 10px; font-size: 12px; }
  .tag { font-size: 11.5px; } .tag .lbl { padding: 5px 8px; }
  .info { top: auto; bottom: max(10px, env(safe-area-inset-bottom, 0px)); left: var(--gutter); right: auto; width: min(320px, calc(100% - var(--side-w) - 56px)); max-height: calc(100% - 110px); padding: 12px 14px; }
  .info h2 { font-size: 16px; margin: 6px 30px 6px 0; } .info p { font-size: 13px; }
}
