/* Beep Boop. Paper, black line, one orange. Values are the panel's own (App/Sources/Panel/Tokens.swift). */
:root {
  --paper: #F3F0EA;      /* Tokens.bodyTop */
  --paper-low: #ECE8E1;  /* Tokens.bodyBottom */
  --ink: #2A2926;        /* Tokens.ink */
  --silk: #6F6A62;       /* Tokens.silk, darkened to pass 4.5:1 on paper (4.7:1) */
  --hair: #B7B1A7;       /* Tokens.tick */
  --accent: #FF6A1F;     /* Tokens.accent: the one colour, for marks and never for words */
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: clamp(20px, 5vw, 64px);
  --measure: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; font: 400 17px/1.5 var(--sans); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 20; padding: 10px 14px; background: var(--ink); color: var(--paper); font: 600 13px var(--mono); }
.skip:focus { top: 12px; }

.silk, .fig {
  font: 500 11px/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silk);
}
.title {
  margin: 6px 0 0;
  font: 500 clamp(18px, 2.4vw, 26px)/1.2 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
}
.title::before {
  content: ""; display: inline-block; width: 0.38em; height: 0.38em; margin-right: 0.6em;
  border-radius: 50%; background: var(--accent); vertical-align: 0.18em;
}

/* The masthead: a name and the one action, on a clean band of paper. */
.mast {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 16px) var(--gutter) 16px;
  background: var(--paper);
}
.name { font: 600 13px/1 var(--mono); letter-spacing: 0.18em; text-decoration: none; }
.name i { display: inline-block; width: 7px; height: 7px; margin-right: 10px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.key-link {
  display: inline-flex; align-items: center; min-height: 40px;
  font: 600 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
  padding: 0 14px; border: 1px solid var(--ink); border-radius: 8px;
}
.key-link:hover { background: var(--ink); color: var(--paper); }

/* A drawing stage: pinned while the page scrolls under it. The drawing is masked out of the
   masthead's band and out of the caption's band (--clear-bottom, set by each drawing), so words
   never sit on linework. */
.trace { position: relative; height: 900vh; }
.explode { position: relative; height: 420vh; }
.detail { position: relative; height: 220vh; }
.stage {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  overflow: hidden;
}
.stage > svg {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent calc(env(safe-area-inset-top) + 70px), #000 calc(env(safe-area-inset-top) + 96px), #000 calc(100% - var(--clear-bottom, 170px) - 20px), transparent calc(100% - var(--clear-bottom, 170px)));
  mask-image: linear-gradient(to bottom, transparent 0, transparent calc(env(safe-area-inset-top) + 70px), #000 calc(env(safe-area-inset-top) + 96px), #000 calc(100% - var(--clear-bottom, 170px) - 20px), transparent calc(100% - var(--clear-bottom, 170px)));
}
.stage .ln { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.stage .ln.fine { stroke-width: 0.6; stroke: var(--silk); }
.stage .ln.hot { stroke: var(--accent); }
.stage .fill-hot { fill: var(--accent); }
.stage text { font-family: var(--mono); letter-spacing: 0.14em; fill: var(--silk); }

/* A caption owns a fixed band at the foot of its stage, so the drawing above it never moves when
   the words change. */
.caption {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: calc(env(safe-area-inset-bottom) + 28px);
  height: 84px;
  display: flex; justify-content: space-between; align-items: end; gap: 24px; pointer-events: none;
  transition: opacity 0.3s linear;
}
.caption p { margin: 0; max-width: 34ch; font-size: 15px; color: var(--silk); text-align: right; }

.opening-words {
  position: absolute; left: var(--gutter); top: calc(env(safe-area-inset-top) + 96px);
  max-width: 34ch; pointer-events: none;
}
.opening-words h1 { margin: 0; font: 500 clamp(26px, 4.2vw, 48px)/1.12 var(--sans); letter-spacing: -0.01em; }
.opening-words p { margin: 14px 0 0; color: var(--silk); }

/* The trace draws at the app's own scale; --u is one screen pixel in drawing units, so a line
   stays a hairline however close the camera comes. */
#trace-svg { --u: 1px; }
#trace-svg .ln { stroke-width: calc(var(--u) * 1.3); }
#trace-svg .ln.fine { stroke-width: calc(var(--u) * 0.8); }
#trace-svg .dimline { stroke: var(--silk); stroke-width: calc(var(--u) * 0.8); }
#trace-svg .tick { r: calc(var(--u) * 2); fill: var(--silk); }
#trace-svg .dim-text { font-size: calc(var(--u) * 11); fill: var(--ink); dominant-baseline: middle; }
#trace-svg .dim { transition: opacity 0.2s linear; }

#explode-svg .side { fill: var(--paper-low); }
#explode-svg .top { fill: var(--paper); }
#explode-svg .plate-glass .side, #explode-svg .plate-glass .top { fill: none; stroke: var(--silk); }
#explode-svg .plate-engine .top { fill: var(--ink); }
#explode-svg .plate-engine .ln:not(.top):not(.side) { stroke: var(--hair); }
#explode-svg .die { fill: #121212; stroke: var(--hair); }
#explode-svg .ln { stroke-width: 1; }
#explode-svg .ln.fine { stroke-width: 0.7; }
#explode-svg .ring { fill: var(--paper); stroke: var(--ink); }
#explode-svg .num { font-size: 11px; fill: var(--ink); letter-spacing: 0; }
#explode-svg .note { font-size: 11px; fill: var(--ink); }
#explode-svg .callout { transition: opacity 0.2s linear; }

#detail-svg .ln { stroke-width: 1; }
#detail-svg .ln.fine { stroke-width: 0.8; stroke: var(--hair); }
#detail-svg .ln.mid { stroke: var(--silk); stroke-width: 0.8; }
#detail-svg text { font-size: 11px; }
#detail-svg .dark { fill: var(--ink); }

/* The sheets below the drawings: ordinary pages, set like the back of a manual. */
.sheet {
  max-width: var(--measure); margin: 0 auto; padding: 120px var(--gutter) 40px;
}
.sheet-head { margin-bottom: 40px; }

.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.index li { border-bottom: 1px solid var(--hair); }
.index a {
  display: grid; grid-template-columns: 3.5em 11em 1fr; align-items: baseline; gap: 16px;
  min-height: 56px; padding: 16px 0; text-decoration: none;
}
.index .no { font: 500 11px var(--mono); letter-spacing: 0.14em; color: var(--silk); }
.index .what { font: 600 14px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.index .note { color: var(--silk); }
.index a:hover .what { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 5px; text-decoration-thickness: 2px; }
.price { margin: 24px 0 0; color: var(--silk); }

.device { margin: 0 auto; max-width: 340px; }
.device video {
  display: block; width: 100%; height: auto; aspect-ratio: 590 / 1280;
  background: var(--paper-low); border: 1px solid var(--ink); border-radius: 44px; padding: 10px;
}
figcaption { margin-top: 16px; font-size: 15px; color: var(--silk); text-align: center; }

.parts { margin: 0 auto; max-width: 620px; }
.parts svg { display: block; width: 100%; height: auto; }
.parts .datum { stroke: var(--ink); stroke-opacity: 0.42; stroke-width: 3; stroke-dasharray: 72 15 6 15; fill: none; }
.parts .leader line { stroke: var(--ink); stroke-width: 3; }
.parts .leader .dot { fill: var(--ink); }
.parts .leader .ring { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
.parts .leader text { font: 600 33px var(--mono); fill: var(--ink); }
.parts .leader .word { font-size: 41px; letter-spacing: 0.16em; }
.parts .key { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; list-style: none; margin: 20px 0 0; padding: 0; }
.parts .key li { font: 600 11px var(--mono); letter-spacing: 0.14em; color: var(--ink); }
.parts .key b { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 8px; border: 1px solid var(--ink); border-radius: 50%; font-weight: 500; font-size: 10px; letter-spacing: 0; }

.facts { margin: 72px 0 0; border-top: 1px solid var(--ink); }
.facts div { display: grid; grid-template-columns: 11em 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--hair); }
.facts dt { font: 600 12px/1.9 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.facts dd { margin: 0; }

h3.silk { margin: 64px 0 12px; }
.files { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.files li { border-bottom: 1px solid var(--hair); }
.files a { display: flex; justify-content: space-between; gap: 16px; min-height: 48px; align-items: center; padding: 10px 0; text-decoration: none; }
.files a span:last-child { font: 500 12px var(--mono); color: var(--silk); white-space: nowrap; }
.files a:hover span:first-child { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }

.foot {
  max-width: var(--measure); margin: 80px auto 0; padding: 28px var(--gutter) calc(env(safe-area-inset-bottom) + 40px);
  display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center;
  border-top: 1px solid var(--hair); color: var(--silk); font-size: 15px;
}
.foot .name { color: var(--ink); margin-right: auto; }

/* Words for screen readers that the drawing says with lines. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 700px) {
  .caption { flex-direction: column; align-items: start; justify-content: end; gap: 8px; height: 148px; }
  .caption p { text-align: left; }
  .index a { grid-template-columns: 2.6em 1fr; row-gap: 2px; }
  .index .note { grid-column: 2; }
  .facts div { grid-template-columns: 1fr; gap: 2px; }
  .files a { flex-direction: column; align-items: start; gap: 2px; }
  .parts .leader .word { display: none; }
}
@media (min-width: 701px) { .parts .key { display: none; } }

/* Reduced motion: each drawing still and finished, and the page an ordinary page. */
@media (prefers-reduced-motion: reduce) {
  .trace, .explode, .detail { height: auto; }
  .stage { position: relative; height: 100svh; }
  .caption, #trace-svg .dim { transition: none; }
}
