/*
 * The standalone viewer, set in the site's own hand: the studio's Nunito, the
 * silver paper the pages are drawn on, hairlines rather than boxes, the pill
 * the site repeats for every control, and burgundy spent only where a reader
 * is acting. It opens in its own tab, so it has to be recognisably the same
 * place without any of the site's code under it.
 */
@font-face { font-family: "Nobel Nunito"; src: url("/fonts/nunito-sans-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }

:root {
  --paper: #efede7;
  --paper-deep: #e2e0d9;
  --panel: #f5f4f0;
  --ink: #11110f;
  --ink-soft: #6a675f;
  --ink-faint: #8d8981;
  --hair: rgb(17 17 15 / 14%);
  --hair-strong: rgb(17 17 15 / 26%);
  --burgundy: #702c3d;
  --brass: #96723e;
  --font: "Nobel Nunito", "Nunito Sans", Arial, sans-serif;
  --gutter: clamp(20px, 2.5vw, 40px);
  --head: 76px;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; background: linear-gradient(168deg, var(--paper) 0%, var(--paper-deep) 100%); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid rgb(112 44 61 / 55%); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── Controls ──────────────────────────────────────────────────────────── */

/* The site's one control shape: a hairline capsule, small uppercase, forty-two
   pixels tall. Pressed is filled with ink; a hand on it is burgundy. */
.pill, .views button {
  display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 20px;
  border: 1px solid var(--hair-strong); border-radius: 24px; background: transparent;
  font-size: 11px; letter-spacing: 0.12em; line-height: 1; text-transform: uppercase; white-space: nowrap; cursor: pointer;
  transition: background 240ms ease, border-color 240ms ease, color 240ms ease;
}
.pill:hover, .views button:hover { border-color: var(--burgundy); background: var(--burgundy); color: #fff; }
.pill[aria-pressed="true"], .views button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.pill:disabled { opacity: 0.38; cursor: default; }
.pill:disabled:hover { border-color: var(--hair-strong); background: transparent; color: inherit; }
.pill.wide { width: 100%; }

input[type="range"] { width: 100%; min-height: 24px; margin: 6px 0 4px; accent-color: var(--burgundy); cursor: pointer; }
select { width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--hair-strong); border-radius: 0; background: transparent; font-size: 13px; cursor: pointer; }

.eyebrow { margin: 0 0 14px; color: var(--ink-soft); font-size: 13px; }
.micro { margin: 12px 0 0; color: var(--ink-faint); font-size: 12px; line-height: 1.5; }

/* ── Header ────────────────────────────────────────────────────────────── */

header { position: relative; z-index: 2; display: flex; align-items: center; gap: clamp(20px, 3vw, 48px); height: var(--head); padding: 0 var(--gutter); border-bottom: 1px solid var(--hair); background: var(--paper); }
.mark { display: block; flex: none; line-height: 0; }
.mark img { width: auto; height: 34px; }
.crumbs { display: flex; min-width: 0; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.crumbs a { text-decoration: none; transition: color 200ms ease; }
.crumbs a:hover { color: var(--burgundy); }
.crumbs [aria-current] { color: var(--ink); }
.crumbs > span[aria-hidden] { color: var(--ink-faint); }
.head-actions { display: flex; align-items: center; gap: 24px; margin-left: auto; }
.back { color: var(--ink-soft); font-size: 13px; text-decoration: none; transition: color 200ms ease; }
.back::before { content: "← "; }
.back:hover { color: var(--burgundy); }

/* ── The stage ─────────────────────────────────────────────────────────── */

main { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 24vw, 380px); height: calc(100dvh - var(--head)); min-height: 680px; }
.stage { position: relative; min-width: 0; overflow: hidden; background: #e7e5df; }
#canvas { position: absolute; inset: 0; }
canvas { display: block; touch-action: none; }

.title { position: absolute; top: var(--gutter); left: var(--gutter); max-width: 520px; pointer-events: none; }
.title h1 { margin: 0; font-size: clamp(40px, 4.6vw, 84px); font-weight: 400; letter-spacing: -0.05em; line-height: 0.98; }
.title .lede { margin: 16px 0 0; color: var(--ink-soft); font-size: clamp(14px, 1vw, 17px); }

.views { position: absolute; bottom: 58px; left: var(--gutter); display: flex; flex-wrap: wrap; gap: 8px; }
.views button { background: rgb(239 237 231 / 82%); backdrop-filter: blur(6px); }
.views .quiet { border-color: transparent; background: transparent; backdrop-filter: none; color: var(--ink-soft); }

.help { position: absolute; bottom: 22px; left: var(--gutter); display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 0; color: var(--ink-soft); font-size: 12px; pointer-events: none; }
.help span + span::before { content: "·"; margin-right: 10px; color: var(--ink-faint); }

#tag { position: absolute; top: var(--gutter); right: var(--gutter); max-width: 240px; border-left: 1px solid var(--burgundy); padding: 10px 14px; background: rgb(245 244 240 / 90%); font-size: 13px; line-height: 1.35; }
#section-note { position: absolute; bottom: 124px; left: var(--gutter); display: flex; max-width: 420px; flex-direction: column; gap: 6px; border-left: 1px solid var(--burgundy); padding: 14px 18px; background: rgb(245 244 240 / 92%); }
#section-note strong { font-size: 14px; font-weight: 500; }
#section-note span { font-size: 13px; }
#section-note small { color: var(--ink-faint); font-size: 12px; }

#loading { position: absolute; inset: 0; display: grid; place-items: center; background: #e7e5df; color: var(--ink-soft); font-size: 14px; }

/* ── The panel ─────────────────────────────────────────────────────────── */

aside { overflow: auto; border-left: 1px solid var(--hair); padding: 32px clamp(20px, 1.8vw, 30px) 28px; background: var(--panel); }
aside h2 { margin: 0 0 14px; font-size: clamp(28px, 2.2vw, 38px); font-weight: 400; letter-spacing: -0.04em; line-height: 1.02; }
.intro { margin: 0 0 8px; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }

/* Each thing the reader can do is its own numbered step, in the order the
   piece is best taken apart: the light, the cut, the layers, then one part. */
.step { border-top: 1px solid var(--hair); margin-top: 22px; padding-top: 18px; }
.step h3 { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; font-size: 17px; font-weight: 400; letter-spacing: -0.02em; }
.step h3 span { color: var(--burgundy); font-size: 11px; letter-spacing: 0.14em; font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.row .pill { min-width: 72px; }
.slider-label { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14px; }
.slider-label output { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 16px; margin-top: 10px; color: var(--ink-soft); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.brass { background: var(--brass); }
.wood { background: #ba9060; }
.led { background: #f3b654; }

.selected { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.02em; }
.details #part-description { min-height: 64px; margin: 0 0 14px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.details .pill { margin-top: 10px; }
.note { border-top: 1px solid var(--hair); margin-top: 24px; padding-top: 16px; }

/* ── Photographs ───────────────────────────────────────────────────────── */

.references { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 3vw, 48px); max-width: 1600px; margin: 0 auto; padding: clamp(64px, 8vw, 140px) var(--gutter); }
.references-head { align-self: center; }
.references h2 { margin: 0 0 20px; font-size: clamp(36px, 4vw, 72px); font-weight: 400; letter-spacing: -0.05em; line-height: 1; }
.references-head > p:last-child { max-width: 38ch; margin: 0; color: var(--ink-soft); font-size: clamp(14px, 1vw, 17px); line-height: 1.6; }
.references figure { margin: 0; }
.references img { display: block; width: 100%; height: auto; }
.references figure:first-of-type img { max-height: 680px; object-fit: cover; }
.references figcaption { margin-top: 12px; color: var(--ink-soft); font-size: 13px; }
.wide { grid-column: 1 / -1; }

.foot { display: flex; align-items: center; gap: 28px; border-top: 1px solid var(--hair); padding: 28px var(--gutter); color: var(--ink-faint); font-size: 13px; }
.foot img { width: auto; height: 22px; opacity: 0.8; }
.foot a { margin-left: auto; color: var(--ink-soft); text-decoration: none; }
.foot a:hover { color: var(--burgundy); }

/* ── Narrow screens ────────────────────────────────────────────────────── */

@media (max-width: 1000px) { .crumbs { display: none; } }
@media (max-width: 800px) {
  :root { --head: 62px; }
  .mark img { height: 28px; }
  .back { display: none; }
  main { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .stage { height: 68dvh; min-height: 460px; }
  .views { bottom: 60px; gap: 6px; }
  .views button { height: 36px; padding: 0 13px; font-size: 10px; }
  .help { right: var(--gutter); bottom: 18px; gap: 2px 14px; font-size: 11px; }
  .help span + span::before { display: none; }
  #tag { top: auto; bottom: 110px; font-size: 12px; }
  #section-note { right: var(--gutter); bottom: 110px; padding: 10px 12px; }
  aside { overflow: visible; border-top: 1px solid var(--hair); border-left: 0; padding: 28px var(--gutter); }
  .references { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { .pill, .views button, .crumbs a, .back { transition: none; } }
