/* Eli's Plek */

@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("../fonts/inter-tight-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("../fonts/inter-tight-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("../fonts/inter-tight-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --paper: #f4f0e7;
  --paper-edge: #e6e0d2;
  --ink: #17171a;
  --ink-soft: #5d5a55;
  --accent: #e2412a;
  --ui-bg: rgba(250, 248, 243, 0.82);
  --ui-solid: rgba(250, 248, 243, 0.95);
  --ui-fg: #17171a;
  --ui-soft: #5d5a55;
  --ui-line: rgba(23, 23, 26, 0.14);
  --ui-shadow: 0 10px 40px rgba(20, 18, 14, 0.18);
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
}
body[data-mode="night"] {
  --ui-bg: rgba(24, 24, 28, 0.78);
  --ui-solid: rgba(24, 24, 28, 0.94);
  --ui-fg: #f3f0ea;
  --ui-soft: #aaa69f;
  --ui-line: rgba(255, 255, 255, 0.16);
  --ui-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ---------- Gallery mode (3D running) ---------- */

.has-3d, .has-3d body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.has-3d body { background: #0b0b0d; position: fixed; inset: 0; touch-action: manipulation; }

#scene { display: none; }
.has-3d #scene {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.has-3d #scene.is-dragging { cursor: grabbing; }
.has-3d #scene.is-pointing { cursor: pointer; }

/* Until the 3D check has run, keep the page blank so the guide does not flash. */
.js:not(.has-3d):not(.no-3d) body > * { visibility: hidden; }

/* Everything below the canvas chrome is hidden when 3D is unavailable. */
html:not(.has-3d) .bar,
html:not(.has-3d) .intro,
html:not(.has-3d) .plaque,
html:not(.has-3d) .stepper,
html:not(.has-3d) .pins,
html:not(.has-3d) .hint,
html:not(.has-3d) .viewer { display: none !important; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), background-color 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #c93520; }
.btn-primary:disabled { background: rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.75); }
.btn-ghost { border: 1px solid var(--ui-line); color: var(--ui-fg); }
.btn-ghost:hover { border-color: currentColor; }
.btn-round { width: 48px; padding: 0; }
.btn-small { min-height: 42px; padding: 0 18px; font-size: 15px; }
.btn-small.btn-round { width: 42px; padding: 0; }

/* ---------- Top bar ---------- */

.bar {
  position: fixed;
  z-index: 20;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + var(--sat)) calc(14px + var(--sar)) 12px calc(14px + var(--sal));
  pointer-events: none;
  transition: opacity 0.5s, transform 0.5s var(--ease);
}
.bar > * { pointer-events: auto; }
.wordmark {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  color: var(--ui-fg);
  min-height: 44px;
  padding: 0 16px 2px;
  border-radius: 999px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-line);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  transition: background-color 0.3s, color 0.3s;
}
.bar-actions { display: flex; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
  padding: 0 16px 0 13px;
  border-radius: 999px;
  background: var(--ui-bg);
  color: var(--ui-fg);
  border: 1px solid var(--ui-line);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s, color 0.3s, border-color 0.2s;
}
.chip:hover { border-color: currentColor; }
.chip.is-on { background: var(--accent); color: #fff; border-color: transparent; }

.i-moon, .l-night { display: none; }
body[data-mode="night"] .i-sun, body[data-mode="night"] .l-day { display: none; }
body[data-mode="night"] .i-moon { display: block; }
body[data-mode="night"] .l-night { display: inline; }
/* The toggle shows where you can go, so by day it offers the moon. */
#btn-light .i-sun, #btn-intro-light .i-sun { display: none; }
#btn-light .i-moon, #btn-intro-light .i-moon { display: block; }
body[data-mode="night"] #btn-light .i-sun, body[data-mode="night"] #btn-intro-light .i-sun { display: block; }
body[data-mode="night"] #btn-light .i-moon, body[data-mode="night"] #btn-intro-light .i-moon { display: none; }

body[data-state="loading"] .bar,
body[data-state="intro"] .bar { opacity: 0; transform: translateY(-12px); pointer-events: none; }
body[data-state="loading"] .bar > *,
body[data-state="intro"] .bar > * { pointer-events: none; }

@media (max-width: 640px) {
  .chip { padding: 0; width: 44px; }
  .chip span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .wordmark { font-size: 24px; }
}

/* ---------- Front door ---------- */

.intro {
  position: fixed;
  z-index: 15;
  inset: 0;
  display: flex;
  align-items: flex-end;
  color: #fff;
  background: linear-gradient(to top, rgba(8, 8, 10, 0.86) 0%, rgba(8, 8, 10, 0.5) 34%, rgba(8, 8, 10, 0.08) 62%, rgba(8, 8, 10, 0) 100%);
  transition: opacity 0.8s ease, visibility 0s linear 0.8s;
  pointer-events: none;
}
.intro-inner {
  width: 100%;
  padding: 0 calc(clamp(22px, 6vw, 84px) + var(--sar)) calc(clamp(28px, 7vh, 72px) + var(--sab)) calc(clamp(22px, 6vw, 84px) + var(--sal));
  pointer-events: auto;
}
.intro .eyebrow { color: rgba(255, 255, 255, 0.78); }
.intro h1 {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(76px, 15vw, 212px);
  line-height: 0.86;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.intro h1 em, .guide h2 em { font-style: italic; color: var(--accent); }
.intro-sub {
  margin: 18px 0 0;
  font-size: clamp(17px, 1.5vw, 21px);
  color: rgba(255, 255, 255, 0.86);
}
.intro-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.intro .btn-ghost { border-color: rgba(255, 255, 255, 0.38); color: #fff; }
.intro .btn-ghost:hover { border-color: #fff; }
.intro .btn-primary { min-width: 210px; max-width: 100%; white-space: normal; text-align: center; padding-top: 8px; padding-bottom: 8px; }

body:not([data-state="loading"]):not([data-state="intro"]) .intro { opacity: 0; visibility: hidden; }
body:not([data-state="loading"]):not([data-state="intro"]) .intro-inner { pointer-events: none; }

.intro-inner > * { animation: rise 0.9s var(--ease) both; }
.intro-inner > :nth-child(2) { animation-delay: 0.08s; }
.intro-inner > :nth-child(3) { animation-delay: 0.16s; }
.intro-inner > :nth-child(4) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

/* ---------- Plaque ---------- */

.plaque {
  position: fixed;
  z-index: 18;
  right: calc(20px + var(--sar));
  top: 50%;
  width: min(360px, 34vw);
  max-height: calc(100% - 180px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 26px 26px 22px;
  background: var(--ui-solid);
  color: var(--ui-fg);
  border: 1px solid var(--ui-line);
  border-radius: 6px;
  box-shadow: var(--ui-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  transform: translateY(-50%);
  animation: plaque-in 0.5s var(--ease) both;
}
@keyframes plaque-in { from { opacity: 0; transform: translateY(-50%) translateX(24px); } to { opacity: 1; transform: translateY(-50%); } }
.plaque-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ui-soft);
}
.plaque-close:hover { color: var(--ui-fg); }
.plaque-no { margin: 0; display: flex; align-items: baseline; gap: 8px; font-weight: 600; font-size: 13px; letter-spacing: 0.14em; color: var(--accent); }
.plaque-of { color: var(--ui-soft); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; }
.plaque h2 {
  margin: 8px 30px 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 38px;
  line-height: 1.02;
  letter-spacing: -0.01em;
}
.plaque-meta { margin: 8px 0 0; font-size: 13.5px; color: var(--ui-soft); }
.plaque > * { flex: none; }
.plaque-note { margin: 16px 0 0; font-size: 15.5px; line-height: 1.55; flex: 0 1 auto; min-height: 3.2em; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.plaque-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }
.plaque-step { display: none; gap: 8px; }

@media (max-width: 819px) {
  .plaque {
    left: 0; right: 0; top: auto; bottom: 0;
    width: auto;
    max-height: 46%;
    padding: 18px calc(20px + var(--sar)) calc(16px + var(--sab)) calc(20px + var(--sal));
    border-radius: 18px 18px 0 0;
    border-width: 1px 0 0;
    transform: none;
    animation-name: sheet-in;
  }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
  .plaque h2 { font-size: 30px; margin-right: 40px; }
  .plaque-note { margin-top: 10px; font-size: 15px; line-height: 1.5; }
  .plaque-actions { margin-top: 14px; }
  .plaque-step { display: inline-flex; }
}
/* Phones on their side: the plaque becomes a side panel under the top bar. */
@media (orientation: landscape) and (max-height: 520px) {
  .plaque {
    left: auto; right: 0; bottom: 0;
    top: calc(64px + var(--sat));
    width: min(44%, 400px);
    max-height: none;
    padding: 16px calc(20px + var(--sar)) calc(14px + var(--sab)) 20px;
    border-radius: 18px 0 0 0;
    border-width: 1px 0 0 1px;
    transform: none;
    animation-name: side-in;
  }
  @keyframes side-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
  .plaque h2 { font-size: 28px; margin-right: 40px; }
  .plaque-note { margin-top: 8px; font-size: 14.5px; line-height: 1.45; }
  .plaque-actions { margin-top: 12px; }
  .plaque-step { display: inline-flex; }
  body[data-focus="1"] .stepper { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(20px); }
  .hint { bottom: calc(76px + var(--sab)); }
  .intro h1 { font-size: clamp(56px, 20vh, 110px); }
  .intro-sub { margin-top: 10px; }
  .intro-actions { margin-top: 14px; }
}

/* ---------- Stepper ---------- */

.stepper {
  position: fixed;
  z-index: 17;
  left: 50%;
  bottom: calc(18px + var(--sab));
  display: flex;
  align-items: center;
  max-width: calc(100% - 28px);
  background: var(--ui-bg);
  color: var(--ui-fg);
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  box-shadow: var(--ui-shadow);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  transform: translateX(-50%);
  transition: opacity 0.4s, transform 0.5s var(--ease), background-color 0.3s, color 0.3s;
}
.stepper button { min-width: 48px; height: 48px; display: grid; place-items: center; border-radius: 999px; }
.stepper button:hover { color: var(--accent); }
.stepper-label {
  padding: 0 10px;
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block !important;
  min-width: 132px !important;
  text-align: center;
}
.stepper-label b { color: var(--accent); font-weight: 600; letter-spacing: 0.06em; margin-right: 6px; }
body[data-state="loading"] .stepper,
body[data-state="intro"] .stepper { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(20px); }
@media (max-width: 819px) {
  body[data-focus="1"] .stepper { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(20px); }
}

/* ---------- Hint ---------- */

.hint {
  position: fixed;
  z-index: 16;
  left: 50%;
  bottom: calc(84px + var(--sab));
  margin: 0;
  max-width: calc(100% - 32px);
  padding: 9px 16px;
  border-radius: 20px;
  text-wrap: balance;
  background: rgba(16, 16, 18, 0.78);
  color: #fff;
  font-size: 13.5px;
  text-align: center;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s, transform 0.5s var(--ease);
}
.hint.is-on { opacity: 1; transform: translateX(-50%); }

/* ---------- Pins on the overhead view ---------- */

.pins { position: fixed; z-index: 14; inset: 0; pointer-events: none; }
.pin {
  position: absolute;
  left: 0; top: 0;
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
  will-change: transform;
}
.pins.is-on .pin { opacity: 1; pointer-events: auto; }
.pin i {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s var(--ease);
}
.pin:hover i, .pin:focus-visible i { transform: scale(1.18); }
.pin span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  padding: 5px 10px;
  border-radius: 4px;
  background: rgba(16, 16, 18, 0.9);
  color: #fff;
  font-size: 12.5px;
  white-space: nowrap;
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
@media (hover: hover) { .pin:hover span, .pin:focus-visible span { opacity: 1; transform: translateX(-50%); } }

/* ---------- Guide ---------- */

.guide { background: var(--paper); color: var(--ink); }
.guide-sheet {
  position: relative;
  max-width: 1060px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 68px) clamp(20px, 5vw, 64px) 40px;
  outline: none;
}
.guide-close { display: none; }
.guide-head { display: grid; gap: 28px 48px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.guide .eyebrow { color: var(--accent); }
.guide h2 {
  margin: 8px 0 18px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 104px);
  line-height: 0.9;
  letter-spacing: -0.02em;
}
.guide-head p { margin: 0 0 12px; max-width: 52ch; }
.guide-lede { font-family: var(--serif); font-size: clamp(21px, 2.4vw, 26px); line-height: 1.25; }
.guide-lede strong { font-weight: 400; }
.handle { white-space: nowrap; }
.guide-how { font-size: 14px; color: var(--ink-soft); }
.guide-fallback { display: none; font-size: 14px; color: var(--ink-soft); }
html:not(.has-3d) .guide-how { display: none; }
.no-3d .guide-fallback { display: block; }

.plan { margin: 0; }
.plan:empty { display: none; }
.plan svg { display: block; width: 100%; height: auto; stroke: none; fill: none; overflow: visible; }
.plan .p-wall { fill: #fbf9f4; stroke: var(--ink); stroke-width: 0.22; }
.plan .p-part { fill: var(--ink); }
.plan .p-bench { fill: none; stroke: var(--ink-soft); stroke-width: 0.06; }
.plan .p-art { stroke: var(--ink); stroke-width: 0.16; stroke-linecap: butt; }
.plan .p-door { stroke: #fbf9f4; stroke-width: 0.3; }
.plan .p-dot { fill: var(--accent); transition: r 0.2s; }
.plan .p-num { fill: #fff; font: 600 0.5px var(--sans); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.plan .p-note { fill: var(--ink-soft); font: 500 0.42px var(--sans); letter-spacing: 0.08em; text-anchor: middle; }
.plan a { cursor: pointer; outline: none; }
.plan a:hover .p-dot, .plan a:focus-visible .p-dot { r: 0.62px; }
.plan figcaption { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }

.works {
  list-style: none;
  margin: clamp(28px, 5vw, 52px) 0 0;
  padding: clamp(24px, 4vw, 40px) 0 0;
  border-top: 1.5px solid var(--ink);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px 48px;
}
.work { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: start; }
.work-thumb {
  display: block;
  padding: 7px;
  background: #fff;
  border: 1px solid var(--paper-edge);
  box-shadow: 0 2px 8px rgba(40, 30, 10, 0.1);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.work-thumb:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 10px 22px rgba(40, 30, 10, 0.18); }
.work-thumb img { display: block; width: 100%; height: auto; }
.work-no { margin: 0; font-size: 12.5px; font-weight: 600; letter-spacing: 0.14em; color: var(--accent); }
.work h3 { margin: 2px 0 0; font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.05; }
.work-meta { margin: 5px 0 0; font-size: 13px; color: var(--ink-soft); }
.work-note { margin: 10px 0 0; font-size: 15px; line-height: 1.55; }
.work-go {
  margin-top: 10px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1.5px solid var(--accent);
  border-radius: 0;
  padding: 14px 0 5px;
}
.work-go:hover { color: var(--accent); }
html:not(.has-3d) .work-go, .work.is-unhung .work-go { display: none; }

.guide-foot {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--paper-edge);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.guide-foot p { margin: 0; max-width: 62ch; }
.guide-foot a { color: inherit; }

@media (max-width: 760px) {
  .guide-head { grid-template-columns: 1fr; }
  .works { grid-template-columns: 1fr; gap: 28px; }
  .work { grid-template-columns: 92px minmax(0, 1fr); gap: 14px; }
  .work h3 { font-size: 27px; }
}

/* Guide as an overlay you pick up inside the gallery */
.has-3d .guide {
  position: fixed;
  z-index: 40;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: clamp(0px, 4vh, 44px) clamp(0px, 3vw, 40px);
  background: rgba(10, 10, 12, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.has-3d .guide.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.has-3d .guide-sheet {
  background:
    linear-gradient(90deg, rgba(60, 40, 10, 0.05), rgba(60, 40, 10, 0) 3%, rgba(60, 40, 10, 0) 97%, rgba(60, 40, 10, 0.05)),
    var(--paper);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 2px 0 rgba(255, 255, 255, 0.6) inset;
  border-radius: 3px;
  transform: translateY(46px) rotate(1.4deg) scale(0.97);
  transform-origin: 50% 0;
  transition: transform 0.6s var(--ease);
}
.has-3d .guide.is-open .guide-sheet { transform: none; }
.has-3d .guide-close {
  display: grid;
  place-items: center;
  position: sticky;
  z-index: 2;
  top: calc(10px + var(--sat));
  margin: -18px -12px -30px auto;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
@media (max-width: 760px) {
  .has-3d .guide { padding: 0; }
  .has-3d .guide-sheet { min-height: 100%; border-radius: 0; padding-top: calc(28px + var(--sat)); padding-bottom: calc(40px + var(--sab)); }
  .has-3d .guide-close { margin: -6px -4px -42px auto; }
}

/* ---------- Close-up viewer ---------- */

.viewer {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: #0c0c0e;
  color: #fff;
  animation: fade 0.3s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.viewer-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
  -webkit-user-select: none;
  user-select: none;
}
.viewer-stage.is-zoomed { cursor: grab; }
.viewer-stage img {
  /* Centred with inset + auto margins: Safari mis-sizes a grid row around an
     image whose max-height is a percentage, which pushed the picture down. */
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 132px);
  width: auto;
  height: auto;
  transform-origin: 50% 50%;
  will-change: transform;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.viewer-cap {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(18px + var(--sab));
  margin: 0;
  padding: 0 20px;
  text-align: center;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.72);
  pointer-events: none;
  text-shadow: 0 1px 8px #000;
}
.viewer-tools {
  position: absolute;
  top: calc(12px + var(--sat));
  right: calc(12px + var(--sar));
  display: flex;
  gap: 8px;
}
.viewer .btn-ghost { background: rgba(12, 12, 14, 0.6); border-color: rgba(255, 255, 255, 0.3); color: #fff; }

/* Phones on their side: give the picture the whole height. */
@media (orientation: landscape) and (max-height: 520px) {
  .viewer-stage img { max-height: calc(100% - 20px); }
  .viewer-cap { display: none; }
}

/* ---------- Music ---------- */

.music { position: relative; }
.chip-icon { width: 44px; padding: 0; }
.eq { display: none; align-items: flex-end; gap: 2.5px; height: 16px; }
.eq b { width: 3px; height: 100%; border-radius: 1px; background: currentColor; transform-origin: 50% 100%; animation: eq 0.9s ease-in-out infinite alternate; }
.eq b:nth-child(2) { animation-duration: 0.62s; animation-delay: -0.3s; }
.eq b:nth-child(3) { animation-duration: 0.78s; animation-delay: -0.5s; }
@keyframes eq { from { transform: scaleY(0.25); } to { transform: scaleY(1); } }
body[data-music="on"] #btn-music .i-note { display: none; }
body[data-music="on"] #btn-music .eq { display: inline-flex; }
body[data-music="on"] #btn-music { color: var(--accent); }

.music-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(300px, calc(100vw - 28px));
  max-height: calc(100vh - 84px);
  max-height: calc(100dvh - 84px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 8px 8px;
  background: var(--ui-solid);
  color: var(--ui-fg);
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  box-shadow: var(--ui-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  animation: pop 0.25s var(--ease) both;
  transform-origin: 100% 0;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: none; } }
.music-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 8px 10px; }
.music-head .eyebrow { color: var(--ui-soft); }
.i-pause, .i-sound-on { display: none; }
body[data-music="on"] .i-play, body[data-music="on"] .i-sound-off { display: none; }
body[data-music="on"] .i-pause, body[data-music="on"] .i-sound-on { display: block; }
.i-play { fill: currentColor; }
.tracks { list-style: none; margin: 0; padding: 0; }
.tracks button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 6px 10px;
  border-radius: 9px;
  text-align: left;
  font-size: 15px;
  line-height: 1.25;
  transition: background-color 0.15s;
}
.tracks button:hover { background: var(--ui-line); }
.t-no, .t-len { font-size: 12.5px; color: var(--ui-soft); font-variant-numeric: tabular-nums; }
.tracks button[aria-current="true"] { font-weight: 600; }
.tracks button[aria-current="true"] .t-no { color: var(--accent); font-weight: 600; }
.tracks button.is-broken { opacity: 0.45; text-decoration: line-through; }
.music-vol { display: flex; align-items: center; gap: 12px; padding: 10px 10px 6px; margin-top: 4px; border-top: 1px solid var(--ui-line); font-size: 12.5px; color: var(--ui-soft); }
.music-vol input { flex: 1; min-width: 0; accent-color: var(--accent); }
.music-vol-note { margin: 4px 0 0; padding: 10px 10px 6px; border-top: 1px solid var(--ui-line); font-size: 12.5px; line-height: 1.4; color: var(--ui-soft); }

@media (max-width: 359px) {
  .wordmark { font-size: 21px; padding: 0 11px 2px; }
  .bar-actions { gap: 5px; }
  .bar { padding-left: calc(8px + var(--sal)); padding-right: calc(8px + var(--sar)); }
}

/* ---------- Hidden chrome stays out of the tab order ---------- */

body[data-state="loading"] .bar, body[data-state="intro"] .bar {
  visibility: hidden;
  transition: opacity 0.5s, transform 0.5s var(--ease), visibility 0s linear 0.5s;
}
body[data-state="loading"] .stepper, body[data-state="intro"] .stepper {
  visibility: hidden;
  transition: opacity 0.4s, transform 0.5s var(--ease), visibility 0s linear 0.5s;
}
@media (max-width: 819px) {
  body[data-focus="1"] .stepper { visibility: hidden; transition: opacity 0.4s, transform 0.5s var(--ease), visibility 0s linear 0.5s; }
}
@media (orientation: landscape) and (max-height: 520px) {
  body[data-focus="1"] .stepper { visibility: hidden; transition: opacity 0.4s, transform 0.5s var(--ease), visibility 0s linear 0.5s; }
}
.pin { visibility: hidden; transition: opacity 0.35s, visibility 0s linear 0.35s; }
.pins.is-on .pin { visibility: visible; transition: opacity 0.35s; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
