/* ==========================================================================
   site.css: HOUOUIN KYOUMA
   Kinetic poster (+ an archive index for the gadgets). Signature: the lab
   coat slides off the page when the visitor pulls its collar.
   Colour comes only from the semantic tokens in tokens.css.
   Register styling lives here, keyed on [data-voice] and html[data-coat].
   ========================================================================== */

/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--nav-h);
  background: var(--c-coat);
}
:root.coat-live { transition: --coat var(--dur-snap) var(--ease-move); }
:root.coat-live.coat-dragging { transition: none; }
:root.coat-intro-run { --dur-snap: 950ms; transition-timing-function: var(--ease-out-quart); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--step-body)/var(--lh-body) var(--font-text);
  overflow-x: clip;
}
[data-ground] { background: var(--ground); color: var(--ink); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
[hidden] { display: none !important; }
::selection { background: var(--ink); color: var(--ground); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip {
  position: fixed; left: var(--margin); top: .5rem; z-index: 100;
  padding: .6rem 1rem; background: var(--c-ink); color: var(--c-coat);
  font-weight: 600; text-decoration: none; border-radius: 3px;
  translate: 0 -200%;
}
.skip:focus-visible { translate: none; outline-color: var(--c-coat); }

main:focus { outline: none; }

/* ---- the register system ---------------------------------------------------
   Both voices are always in the DOM and visible. The coat decides which one
   is loud (display) and which one is the small note.
     hk loud  = hououin with the coat on      ok loud  = okabe with the coat off
     hk quiet = hououin with the coat off     ok quiet = okabe with the coat on
   Roles set sizes with --hk-l / --ok-l (loud) and --q (quiet). */
[data-voice] {
  --q: 1rem;
  font-kerning: normal;
  font-synthesis: none;
}
:root:not([data-coat="off"]) [data-voice="hououin"] {          /* hk loud */
  font-family: var(--font-display);
  font-size: var(--hk-l, 2rem);
  font-weight: var(--hk-w, 188);
  font-stretch: var(--hk-s, 100%);
  line-height: var(--hk-lh, .88);
  letter-spacing: var(--hk-ls, 0);
  text-transform: var(--hk-case, uppercase);
  color: var(--ink);
}
:root[data-coat="off"] [data-voice="hououin"] {                /* hk quiet */
  font-family: var(--font-display);
  font-size: var(--hk-q, var(--q));
  font-weight: 110;
  font-stretch: 128%;
  line-height: 1.3;
  letter-spacing: .005em;
  text-transform: none;
  color: var(--ink-2);
}
:root[data-coat="off"] [data-voice="hououin"].v-display {       /* the static ink strike */
  text-decoration-line: line-through;
  text-decoration-thickness: .075em;
  text-decoration-color: var(--ink);
}
:root[data-coat="off"] [data-voice="okabe"] {                  /* ok loud */
  font-family: var(--font-display);
  font-size: var(--ok-l, 2rem);
  font-weight: var(--ok-w, 42);
  font-stretch: var(--ok-s, 180%);
  line-height: var(--ok-lh, 1.02);
  letter-spacing: var(--ok-ls, -.005em);
  text-transform: none;
  color: var(--ink);
}
:root:not([data-coat="off"]) [data-voice="okabe"] {            /* ok quiet */
  font-family: var(--font-text);
  font-size: var(--ok-q, var(--q));
  font-weight: 400;
  font-stretch: normal;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-2);
}

/* ---- nav ----------------------------------------------------------------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: var(--space-m);
  padding-inline: var(--margin);
  transition: background-color var(--dur-3) var(--ease-micro), color var(--dur-3) var(--ease-micro);
}
.nav::after {                    /* the topstitch under the nav: coat on only */
  content: ""; position: absolute; left: var(--margin); right: var(--margin); bottom: 5px; height: 3px;
  background: radial-gradient(circle, var(--stitch) 1px, transparent 1.4px) 0 50% / 7px 3px repeat-x;
  pointer-events: none;
}
:root[data-coat="off"] .nav::after { display: none; }

.nav__mark {
  justify-self: start;
  display: inline-flex; align-items: baseline; gap: .5rem;
  text-decoration: none; min-height: 44px; align-items: center;
}
.nav__word {
  font-family: var(--font-display);
  font-size: 1.1875rem;
  text-transform: uppercase;
  line-height: 1;
  letter-spacing: .01em;
  font-weight: calc(60 + 130 * var(--coat));
  font-stretch: calc(160% - 60% * var(--coat));
  white-space: nowrap;
}
.nav__no {
  font: 500 .8125rem/1 var(--font-text);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.nav__mark:hover .nav__no { color: var(--ink); }

.nav__links ul { display: flex; gap: clamp(1rem, 2.4vw, 2.25rem); }
.nav__links a,
.nav__menu a {
  display: inline-flex; align-items: center; min-height: 44px;
  font: 500 .9375rem/1 var(--font-text);
  text-decoration: none;
  color: var(--ink-2);
  transition: color var(--dur-2) var(--ease-micro);
}
.nav__links a:hover, .nav__menu a:hover { color: var(--ink); }
.nav__links a[aria-current="true"] { color: var(--ink); font-weight: 700; }

.nav__menu { display: none; justify-self: end; position: relative; }
.nav__menu > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: .45rem; min-height: 44px;
  font: 600 .9375rem/1 var(--font-text);
}
.nav__menu > summary::-webkit-details-marker { display: none; }
.nav__menu > summary::after {    /* a drawn chevron that flips, not an icon-pack glyph */
  content: ""; width: .5rem; height: .5rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  border-radius: 0 0 2px 0;
  rotate: 45deg; translate: 0 -.15rem;
  transition: rotate var(--dur-2) var(--ease-micro), translate var(--dur-2) var(--ease-micro);
}
.nav__menu[open] > summary::after { rotate: 225deg; translate: 0 .1rem; }
.nav__menu nav {
  position: absolute; right: -1rem; top: calc(100% + .35rem);
  min-width: 13rem; padding: .5rem 1rem;
  background: var(--ground); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 4px;
}
.nav__menu ul { display: grid; }
.nav__menu a { min-height: 48px; font-size: 1.0625rem; }

.nav__tools { display: contents; }
.pocket {                       /* the breast pocket, sewn onto the nav: it hangs below the bar */
  grid-column: 3; grid-row: 1;
  justify-self: end;
  align-self: start;
  z-index: 1;
  position: relative;
  width: 9.5rem; height: calc(var(--nav-h) + .75rem);
  color: var(--ink);
}
.pocket__art {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.pocket__art .pocket__edge { fill: var(--ground); transition: fill var(--dur-2) var(--ease-micro); }
.pocket__art .pocket__pen { fill: var(--ground); }
.pocket__art .pocket__stitch { stroke: var(--stitch); stroke-width: 2; stroke-dasharray: 0 6; }
:root[data-coat="off"] .pocket__art .pocket__stitch { display: none; }
.pocket:hover .pocket__edge { fill: var(--raise); }
.pocket__btn {
  position: absolute; left: 0; right: 0; top: 31%; bottom: 0;
  display: flex; align-items: center; justify-content: center; gap: .55rem;
  padding: 0 .75rem;
  background: none; border: 0; border-radius: 0 0 10px 10px;
  font: 600 .875rem/1 var(--font-text);
  touch-action: manipulation;
}
.pocket__btn:focus-visible { outline-offset: -4px; }

/* on / off: both words always visible; the current one is emphasised, the other struck */
.state { display: inline-flex; gap: .3rem; font-weight: 500; }
.state > span { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 1.5px; }
[aria-pressed="true"] .state__on,
[aria-pressed="false"] .state__off { color: var(--ink); font-weight: 700; text-decoration: none; }

.nav__sound {
  grid-column: 3; grid-row: 1;
  justify-self: end;
  margin-right: calc(9.5rem + var(--space-m));
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: 0; background: none; border: 0;
  font: 600 .875rem/1 var(--font-text);
}
.nav__sound:hover .nav__sound-label { color: var(--ink-2); }

@media (width < 60em) {
  .nav { grid-template-columns: 1fr auto auto auto; column-gap: var(--space-s); }
  .nav__links { display: none; }
  .nav__menu { display: block; grid-column: 2; grid-row: 1; }
  .nav__sound { grid-column: 3; margin-right: 0; }
  .pocket { grid-column: 4; width: 8.25rem; }
}
@media (width < 30em) {
  .nav { column-gap: .75rem; }
  .nav__no { display: none; }
  .nav__word {                   /* a stacked two-line logotype on phones */
    display: block; width: min-content; white-space: normal;
    font-size: .8125rem; line-height: .92;
    font-stretch: 100%;
  }
  .pocket { width: 7.25rem; }
  .pocket__btn { gap: .3rem; padding-inline: .35rem; font-size: .8125rem; }
  .nav__sound { min-width: 44px; justify-content: center; }
  .nav__sound .state { display: none; }
  .nav__sound-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .nav__meter { width: 1.1rem; height: 1.1rem; }
}

/* ---- sections, seams ------------------------------------------------------ */
main > section, .foot {
  position: relative;
  container-type: inline-size;
  padding-inline: var(--margin);
}
.seam {                          /* a stitched placket: the colour hand-off between sections */
  position: absolute; left: 0; right: 0; top: 0; height: 1.75rem;
  background:
    radial-gradient(circle, var(--stitch) 1.1px, transparent 1.5px) 0 .6rem / 8px 3px repeat-x,
    radial-gradient(circle, var(--stitch) 1.1px, transparent 1.5px) 4px 1.15rem / 8px 3px repeat-x,
    var(--raise);
  pointer-events: none;
}
:root[data-coat="off"] .seam { display: none; }

.sec-head {
  padding-top: calc(var(--space-l) + 1.75rem);
  padding-bottom: var(--space-m);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--space-s);
}
.sec-title { grid-column: 1 / -1; display: grid; row-gap: .6rem; }
.sec-title > [data-voice] { display: block; }
.sec-lede { grid-column: 1 / span 7; display: grid; row-gap: .75rem; max-width: 46rem; }

/* section heads: fitted to the column by their longest word */
.r-head {
  /* --fit-hk / --fit-ok: the em width of the widest word at the loud axes, measured in the
     browser (tmp/hououin-qa/fit_values.json) and written into the HTML. No word ever overflows. */
  --avail: calc(100cqi - 2 * var(--margin));
  --hk-l: min(9.25rem, calc(var(--avail) / var(--fit-hk, 8)));
  --ok-l: min(6.25rem, calc(var(--avail) / var(--fit-ok, 8)));
  --hk-lh: .86;
  --ok-lh: 1;
  --q: 1.125rem;
}
.r-lede {
  --hk-l: clamp(1.375rem, 1.1rem + 1.1vw, 2rem);
  --hk-w: 150; --hk-s: 106%; --hk-case: none; --hk-lh: 1.14; --hk-ls: 0;
  --ok-l: clamp(1.375rem, 1.1rem + 1.1vw, 2rem);
  --ok-w: 70; --ok-s: 150%; --ok-lh: 1.2;
  --q: 1.0625rem;
}

/* ---- hero ------------------------------------------------------------------ */
.hero {
  --W: min(56vw, 94svh);                        /* the coat's width */
  --cx: 50%;                                    /* the coat is centred */
  min-height: 100svh;
  overflow: clip;
  padding-top: var(--nav-h);
}
.hero__stage {
  position: absolute;
  width: var(--W);
  aspect-ratio: 1000 / 1400;
  left: calc(var(--cx) - var(--W) / 2);
  top: calc(var(--nav-h) + 1.25rem - .102 * var(--W));
  container-type: inline-size;
  perspective: calc(var(--W) * 2.4);
  perspective-origin: 50% 30%;
  --travel: 100vw;
  --coat-x: calc(var(--coat-dir) * var(--travel) * (.32 * var(--u) + .68 * var(--u) * var(--u) * var(--u)));
  --coat-shade: calc(var(--u) * .34);
  --coat-curl: 0;
}
:root.coat-live:not([data-coat="off"]) .hero__stage { --coat-curl: 1; }

.coat {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none;
  --coat-stroke: clamp(1.25px, .22cqw, 2.25px);
  --coat-fine: clamp(1px, .14cqw, 1.5px);
  --coat-stitch-w: clamp(1.25px, .18cqw, 1.75px);
}
.coat--back, .coat--front-r, .coat--front-l {
  transform-origin: 50% 8%;
  will-change: transform;
}
.coat--back {
  transform: translateX(var(--coat-x)) rotate(calc(var(--coat-dir) * var(--u) * 5deg));
  z-index: 1;
}
.coat--front-r {
  transform-origin: 74% 40%;
  transform: translateX(var(--coat-x)) rotate(calc(var(--coat-dir) * var(--u) * 5deg)) rotateY(calc(var(--u) * -68deg));
  z-index: 2;
}
.hero__name { z-index: 3; }
.coat--front-l {
  transform-origin: 26% 40%;
  transform: translateX(var(--coat-x)) rotate(calc(var(--coat-dir) * var(--u) * 5deg)) rotateY(calc(var(--u) * 68deg));
  z-index: 4;
}
.coat--phantom {
  z-index: 0;
  opacity: var(--u);
  --coat-line: var(--ink-3);
}

/* the name, tucked under the left front edge: a logotype, the h1 carries the words */
.hero__name {
  position: absolute;
  left: 43.7cqw;
  top: 44.5cqw;
  width: max-content;
  max-width: 64cqw;
  display: grid;
  row-gap: calc(1.6cqw + .25rem);
  pointer-events: none;
}
.hero__name .name {
  --hk-big: 18.2cqw;  --hk-small: max(1rem, 2.2cqw);
  --ok-big: 9.4cqw;   --ok-small: max(1rem, 2.4cqw);
  margin: 0;
  font-family: var(--font-display);
  text-wrap: wrap;
}
:root .hero__name .name--hk {
  font-size: calc(var(--hk-small) + (var(--hk-big) - var(--hk-small)) * var(--coat));
  font-weight: calc(80 + 108 * var(--coat));
  font-stretch: calc(130% - 30% * var(--coat));
  line-height: calc(1.2 - .34 * var(--coat));
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--ink);
}
:root .hero__name .name--ok {
  font-size: calc(var(--ok-small) + (var(--ok-big) - var(--ok-small)) * var(--u));
  font-weight: calc(120 - 82 * var(--u));
  font-stretch: calc(130% + 50% * var(--u));
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
:root:not([data-coat="off"]) .hero__name .name--ok { color: var(--ink-2); }
.hero__name .name--ok { margin-left: calc(11.2cqw * var(--coat)); }  /* the note clears the front edges */
.hero__name .name--hk { text-indent: .8cqw hanging; }               /* line 2 follows the diagonal of the lapel */
.hero__name .name__t { -webkit-box-decoration-break: clone; box-decoration-break: clone; }
/* knockout: a ground-coloured stroke painted under the fill, so the coat's lines stop short of
   the letters instead of running through them (the overlap stays, the letters stay clean) */
.hero__name .name, .nf .r-nf {
  --knock: 0em;                  /* at display size the heavy caps and the moved pen need none; phones do (below) */
  -webkit-text-stroke: var(--knock) var(--ground);
  paint-order: stroke fill;
}
.hero__name .name--ok { --knock: .16em; }
@media (width < 64em) {
  .hero__name .name, .nf .r-nf { --knock: .16em; }
  .hero__name .name--ok { --knock: .22em; }
}
:root[data-coat="off"] :is(.hero__name .name--hk, .nf .r-nf[data-voice="hououin"]) { --knock: 0; }  /* keep the strike whole */
:root[data-coat="off"] .hero__name .name--hk { text-decoration: none; color: var(--ink-2); }
:root[data-coat="off"] .hero__name .name--hk .name__t {  /* caps strike at cap-height centre (Sprat: asc 1.02, cap .70) */
  background: linear-gradient(var(--ink), var(--ink)) 0 .635em / 100% .075em no-repeat;
}

.grip {
  position: absolute; z-index: 6;
  left: 34cqw; top: 6.5cqw; width: 32cqw; height: 18cqw;
  min-width: 44px; min-height: 44px;
  padding: 0; background: none; border: 0; border-radius: 40% 40% 12% 12%;
  touch-action: pan-y;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}
:root.coat-dragging .grip { cursor: grabbing; }
.grip:focus-visible { outline-offset: 2px; }
.grip__label {
  position: absolute; right: calc(100% + .25rem); top: 3.2cqw;
  display: inline-flex; align-items: center; gap: .5rem;
  font: 600 .875rem/1 var(--font-text); white-space: nowrap;
  color: var(--ink);
  padding: .5rem 0;
}
.grip__arrow { flex: none; width: 2.25rem; max-width: none; height: .75rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.grip:hover .grip__label { color: var(--ink-2); }

.collar-pin {                     /* on the left lapel, just below the notch and clear of the name */
  position: absolute; z-index: 5;
  left: 36.1cqw; top: 37.4cqw; width: 6.4cqw; min-width: 28px; aspect-ratio: 1;
  transform: translateX(var(--coat-x)) rotate(-6deg);
}
.collar-pin > :not(.collar-pin__no) { width: 100%; height: 100%; }

.hero__copy {
  position: absolute;
  left: var(--margin); bottom: var(--margin);
  width: min(21rem, calc(var(--cx) - var(--W) * .38 - var(--margin) * 2));
  display: grid; row-gap: .7rem;
  z-index: 7;
}
.hero__title {
  font: 700 1rem/1.3 var(--font-text);
  letter-spacing: 0;
  color: var(--ink);
  max-width: 17rem;
}
.r-role {
  --hk-l: clamp(1.125rem, .95rem + .55vw, 1.4375rem);
  --hk-w: 150; --hk-s: 104%; --hk-case: none; --hk-lh: 1.16;
  --ok-l: clamp(1.125rem, .95rem + .55vw, 1.4375rem);
  --ok-w: 80; --ok-s: 140%; --ok-lh: 1.22;
  --q: .9375rem;
}
.hero__status {
  position: absolute; right: var(--margin); bottom: var(--margin);
  z-index: 7;
  width: min(15rem, calc(100% - var(--cx) - var(--W) * .4 - var(--margin)));
  font: 500 .875rem/1.4 var(--font-text);
  color: var(--ink-2);
  text-align: right;
}
.hero__status time { font-variant-numeric: tabular-nums; color: var(--ink); }

@media (width < 64em) {
  /* the name starts at the lapel (0.437W) and HOUOUIN is 4.54em: 14.8cqw keeps it inside 320-1023px */
  .hero { --W: min(84vw, 34rem, 60svh); --cx: 43%; display: flex; flex-direction: column; min-height: 100svh; padding-bottom: var(--space-l); }
  .hero__stage { position: relative; left: auto; top: auto; margin-left: calc(var(--cx) - var(--W) / 2 - var(--margin)); margin-top: calc(1.5rem - .08 * var(--W)); }
  .hero__name { max-width: 58cqw; }
  .hero__name .name { --hk-big: 14.8cqw; --ok-big: 8.2cqw; --hk-small: max(.9375rem, 2.2cqw); --ok-small: max(.9375rem, 2.4cqw); }
  .hero__copy, .hero__status { position: static; width: auto; max-width: 34rem; }
  .hero__copy { margin-top: max(var(--space-m), auto); margin-top: auto; padding-top: var(--space-m); }
  .hero__status { text-align: left; margin-top: var(--space-s); }
  .grip__label { right: auto; left: calc(100% + .25rem); top: 4cqw; }
}

/* ---- gadgets: the archive index as an instrument ------------------------------------
   Compact rows (number, grand name on one line, one honest line, stamp). At 64em and up,
   with JS, one sticky plate shows the current row's blueprint (plate.js); otherwise every
   row carries its own small figure. */
.gadgets__body { padding-bottom: var(--space-l); }
.gadget-list { container-type: inline-size; }
.gadget {
  position: relative;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto 10rem;
  grid-template-areas: "no name name art" "no line stamp art";
  grid-template-rows: auto 1fr;  /* a tall drawing's extra height goes under the line, not the name */
  column-gap: var(--gutter);
  row-gap: .45rem;
  align-items: start;
  padding-block: 1.05rem;
}
.gadget::before {                /* 2px round-capped rule */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; border-radius: 1px;
  background: var(--rule);
}
.gadget__no {
  grid-area: no;
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: .8;
  font-weight: 188; font-stretch: 100%;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  padding-top: .1rem;
  transition: color var(--dur-2) var(--ease-micro);
}
:root[data-coat="off"] .gadget__no { font-weight: 40; font-stretch: 170%; font-size: 2rem; }
.gadget.is-current .gadget__no { color: var(--ink); }
.gadget__name { grid-area: name; display: block; }
.r-gname {
  /* one line: the name's measured width (--fit-line, em) into the space beside the number */
  --name-avail: calc(100cqi - 3.5rem - var(--gutter) - var(--art-w, 10rem) - var(--gutter));
  --hk-l: min(2.25rem, calc(var(--name-avail) / var(--fit-line, 12)));
  --hk-lh: .9;
  --q: 1.0625rem;
  display: block;
  white-space: nowrap;
}
:root[data-coat="off"] .r-gname { white-space: normal; }
.gadget__stamp { grid-area: stamp; display: flex; justify-content: flex-end; padding-top: .15rem; }
.gadget__stamp > span {
  display: inline-block;
  padding: .28rem .55rem .26rem;
  border: 2px solid var(--ink-3);
  border-radius: 3px;
  font: 700 .75rem/1.1 var(--font-text);
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  rotate: -2.5deg;
}
:root[data-coat="off"] .gadget__stamp > span { rotate: 0deg; letter-spacing: .02em; text-transform: none; font-weight: 600; font-size: .8125rem; }
.r-gline {
  grid-area: line;
  --ok-l: clamp(1.1875rem, 1rem + .6vw, 1.5rem);
  --ok-w: 70; --ok-s: 146%; --ok-lh: 1.2;
  --q: 1rem;
  max-width: 40rem;
}
.gadget__art {
  grid-area: art;
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  margin: 0;
  align-self: center;
}
.gadget__notes { position: absolute; inset: 0; pointer-events: none; }
.plate { display: none; }

@media (width >= 64em) {
  /* the instrument: list on the left, one sticky plate on the right */
  :root.plate-live .gadgets__body {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gutter);
    align-items: start;
  }
  :root.plate-live .gadget-list { grid-column: 1 / span 7; }
  :root.plate-live .gadget { --art-w: 0rem; grid-template-columns: 3.5rem minmax(0, 1fr) auto; grid-template-areas: "no name name" "no line stamp"; }
  :root.plate-live .gadget__art { display: none; }
  :root.plate-live .plate {
    display: block;
    grid-column: 8 / -1;
    position: sticky; top: calc(var(--nav-h) + var(--space-m));
    margin-top: 1.05rem;
    color: var(--ink);
  }
  .gadget__link { cursor: pointer; }
  .gadget { transition: background-color var(--dur-2) var(--ease-micro); }
}
.plate__art { aspect-ratio: 4 / 3; }
.plate__art :is(svg, img) { display: block; width: 100%; height: auto; }
.plate svg .bp-dim, .plate svg .bp-ctr, .plate svg .bp-hid, .plate svg .bp-ph { color: var(--ink-3); }
.plate svg .bp-title { color: var(--ink-2); }

@media (width < 64em) {
  /* phones and tablets: the name over the row, the line and stamp beside a modest blueprint */
  .gadget {
    --art-w: 0rem;
    grid-template-columns: 2.25rem minmax(0, 1fr) minmax(0, 40%);
    grid-template-areas: "no name name" "line line art" "stamp stamp art";
    row-gap: .6rem;
    padding-block: 1rem;
  }
  .gadget__no { font-size: 1.75rem; padding-top: .2rem; }
  :root[data-coat="off"] .gadget__no { font-size: 1.125rem; font-stretch: 150%; padding-top: .25rem; }
  .r-gname {
    /* at most two lines: two widths of the name area into the measured one-line width */
    --name-avail: calc(100cqi - 2.25rem - var(--gutter));
    --hk-l: min(1.75rem, calc(var(--name-avail) * 1.76 / var(--fit-line, 12)));
    white-space: normal;
  }
  .gadget__stamp { justify-content: flex-start; align-self: start; }
  .gadget__art { max-height: 13.75rem; align-self: start; }
  .gadget__art :is(img, svg) { max-height: 13.75rem; }
  .sec-lede { grid-column: 1 / -1; }
}

/* ---- transmissions ----------------------------------------------------------- */
.sec-head--calls .sec-title { grid-column: 1 / span 8; }
.sec-head--calls .sec-lede { grid-column: 1 / span 7; }
.sec-head--calls .r-head { --avail: calc((100cqi - 2 * var(--margin)) * 8 / 12 - var(--gutter)); }
.phone {
  grid-column: 9 / -1; grid-row: 1 / span 2;
  align-self: end;
  aspect-ratio: 4 / 3;
  margin: 0;
}
.log { padding-bottom: var(--space-l); }
.calls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-l);
}
.call {
  position: relative;
  display: grid;
  align-content: start;
  row-gap: .6rem;
  padding-block: var(--space-s) 1.35rem;
}
.call::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; border-radius: 1px;
  background: var(--rule);
}
.call__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem;
  font: 600 .875rem/1.3 var(--font-text);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.call__meta time, .call__meta .call__when { margin-right: auto; }
.call__dur { color: var(--ink); }
.r-lines > li { text-wrap: pretty; }
.r-lines {
  --hk-l: clamp(1.0625rem, .92rem + .5vw, 1.3125rem);
  --hk-w: 132; --hk-s: 108%; --hk-case: none; --hk-lh: 1.22;
  --q: .9375rem;
  display: grid; row-gap: .1rem;
}
.r-note {
  --ok-l: clamp(1.0625rem, .92rem + .5vw, 1.3125rem);
  --ok-w: 70; --ok-s: 146%; --ok-lh: 1.22;
  --q: .9375rem;
  max-width: 40rem;
}
.call__play {
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: 36px; padding: 0 .8rem;
  background: none; color: var(--ink);
  border: 2px solid var(--ink-3); border-radius: 7px 7px 14px 14px / 7px 7px 11px 11px;   /* a keypad key */
  font: 600 .8125rem/1 var(--font-text);
  transition: background-color var(--dur-2) var(--ease-micro), color var(--dur-2) var(--ease-micro), border-color var(--dur-2) var(--ease-micro);
}
.call__play:hover { background: var(--ink); color: var(--ground); border-color: var(--ink); }

.gate { margin-top: var(--space-s); }
.gate__summary {
  list-style: none;
  display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; align-items: center;
  padding: .95rem 1.25rem; min-height: 60px;
  border: 2px solid var(--ink-3); border-radius: 6px;
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-micro), border-color var(--dur-2) var(--ease-micro);
}
.gate__summary::-webkit-details-marker { display: none; }
.gate__summary:hover { background: var(--raise); border-color: var(--ink); }
.gate__mark { width: 1.25rem; height: 1.25rem; position: relative; }
.gate__mark::before, .gate__mark::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(50% - 1px); height: 2px; border-radius: 1px; background: currentColor;
  transition: rotate var(--dur-3) var(--ease-enter);
}
.gate__mark::after { rotate: 90deg; }
.gate[open] .gate__mark::after { rotate: 0deg; }
.gate__text { display: grid; row-gap: .3rem; }
.r-gate {
  --hk-l: clamp(1.25rem, 1rem + 1vw, 1.875rem);
  --ok-l: clamp(1.125rem, .95rem + .6vw, 1.5rem);
  --q: 1rem;
  display: block;
}
.gate__body { padding-top: var(--space-s); }
.gate__intro { display: grid; row-gap: .6rem; padding-bottom: var(--space-s); max-width: 48rem; }
.gate__link a {
  font: 700 1rem/1.4 var(--font-text);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em;
}
.gate__link a:hover { text-decoration-color: var(--ink-3); }

@media (width < 64em) {
  .sec-head--calls .sec-title, .sec-head--calls .sec-lede { grid-column: 1 / -1; }
  .sec-head--calls .r-head { --avail: calc(100cqi - 2 * var(--margin)); }
  .phone { grid-column: 1 / -1; grid-row: auto; width: min(15rem, 62vw); align-self: start; margin-top: .25rem; }
  .calls { grid-template-columns: minmax(0, 1fr); }
}

/* ---- the lab -------------------------------------------------------------------- */
.lab__body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--space-l);
  padding-bottom: var(--space-l);
}
.roster { grid-column: 1 / span 7; }
.apply { grid-column: 9 / -1; align-self: start; display: grid; row-gap: .9rem; }
.roster__title, .apply__title { display: grid; row-gap: .45rem; margin-bottom: var(--space-s); }
.r-sub {
  --hk-l: clamp(1.75rem, 1.2rem + 2.2vw, 3.25rem);
  --ok-l: clamp(1.5rem, 1.15rem + 1.4vw, 2.5rem);
  --q: 1rem;
  display: block;
}
.roster__list { display: grid; column-gap: var(--space-m); }
@media (width >= 64em) {
  .roster__list { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(4, auto); }
}
.member {
  position: relative;
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  column-gap: var(--gutter);
  row-gap: .3rem;
  padding-block: .8rem;
  align-items: baseline;
  align-content: start;
}
.member::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; border-radius: 1px; background: var(--rule);
}
.member__no {
  grid-row: 1 / span 2;
  font: 600 .9375rem/1 var(--font-text);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  padding-top: .3rem;
}
.r-code { --hk-l: clamp(1.375rem, 1.15rem + .7vw, 1.75rem); --hk-lh: .95; --q: 1rem; display: block; }
.r-mline { --ok-l: clamp(1.0625rem, .95rem + .45vw, 1.3125rem); --ok-w: 70; --ok-s: 146%; --ok-lh: 1.22; --q: .9375rem; display: block; }
.r-body {
  --hk-l: 1.1875rem; --hk-w: 140; --hk-s: 104%; --hk-case: none; --hk-lh: 1.2;
  --ok-l: 1.1875rem; --ok-w: 80; --ok-s: 140%; --ok-lh: 1.25;
  --q: 1rem;
}
.badge-form__set { border: 0; margin: 0; padding: 0; display: grid; row-gap: .5rem; min-width: 0; }
.badge-form__set[disabled] { opacity: .55; }
.badge-form__label { font: 700 .9375rem/1.2 var(--font-text); }
.badge-form__row { display: flex; flex-wrap: wrap; gap: .5rem; }
.badge-form__input {
  flex: 1 1 11rem; min-width: 0; min-height: 48px;
  padding: .5rem .8rem;
  background: var(--ground); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 4px;
  font-size: 1.0625rem;
}
.badge-form__input:focus-visible { outline-offset: 2px; }
.badge-form__submit {
  min-height: 48px; padding: 0 1.1rem;
  background: var(--ink); color: var(--ground);
  border: 2px solid var(--ink); border-radius: 4px;
  font-weight: 700;
  transition: background-color var(--dur-2) var(--ease-micro), color var(--dur-2) var(--ease-micro);
}
.badge-form__submit:hover { background: var(--ground); color: var(--ink); }
.apply__note { font-size: .9375rem; color: var(--ink-2); }
.badge-out:empty { display: none; }

@media (width < 60em) {
  .roster, .apply { grid-column: 1 / -1; }
}

/* ---- footer ----------------------------------------------------------------------- */
.foot {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  padding-top: calc(var(--space-xl) + 1rem);
  overflow: clip;
}
.foot__hook { grid-column: 1 / span 5; display: grid; grid-template-columns: 11rem 1fr; column-gap: var(--gutter); align-items: start; }
.hook {                          /* the coat's other home: a phantom while he wears it, the coat once it is off */
  position: relative; width: 11rem; aspect-ratio: 176 / 266; margin: 0;
}
.hook__art {
  position: absolute; left: calc(50% - 3rem); top: 0; width: 6rem; height: auto; overflow: visible; z-index: 2;
  fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.hook__art .hook__plate { fill: var(--ground); }
.hook__screw { fill: var(--ink); stroke: none; }
.hook__coat {
  position: absolute; left: 0; top: 1.15rem; width: 100%; height: auto; overflow: visible;
  --coat-stroke: 1.25px; --coat-fine: 1px; --coat-stitch-w: 1px;
  transform-origin: 50% 13%;
  rotate: -2deg;
}
.hook__coat--phantom { opacity: var(--coat); --coat-line: var(--ink-3); }
.hook__coat--real { opacity: var(--u); }
.foot__caption { display: grid; row-gap: .4rem; padding-top: .6rem; }
.r-cap {
  --hk-l: 1.25rem; --hk-lh: 1; --q: .9375rem;
  --ok-l: 1.1875rem; --ok-w: 80; --ok-s: 140%; --ok-lh: 1.25;
}
.foot__info { grid-column: 6 / -1; display: grid; row-gap: var(--space-s); align-content: start; }
.foot__links { display: flex; flex-wrap: wrap; gap: .25rem 2rem; }
.foot__links a {
  display: inline-flex; min-height: 44px; align-items: center;
  font: 700 1rem/1.3 var(--font-text);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .22em;
  text-decoration-color: var(--ink-3);
  transition: text-decoration-color var(--dur-2) var(--ease-micro);
}
.foot__links a:hover { text-decoration-color: var(--ink); }
.foot__legal { font-size: .875rem; line-height: 1.5; color: var(--ink-2); max-width: 44rem; }
.foot__sign {
  grid-column: 1 / -1;
  margin-top: var(--space-xl);
  display: grid; row-gap: .75rem;
}
.r-sign {
  --longest: 8;
  --avail: calc(100cqi - 2 * var(--margin));
  --hk-l: min(15rem, calc(var(--avail) / 8.6));     /* "EL PSY KONGROO." measures 8.47em */
  --hk-lh: .78;
  --ok-l: clamp(1.75rem, 1.2rem + 2.8vw, 4rem);
  --ok-lh: 1.05;
  --q: 1.0625rem;
  display: block;
}
:root:not([data-coat="off"]) .foot__sign [data-voice="hououin"] {
  order: 2;
  margin-bottom: -.025em;        /* lh .78 puts the baseline .045em up the line box, so the baseline sits
                                    .02em above the page edge: only the empty band below it bleeds, and the
                                    round letters (S O G overshoot .015em, measured) stay whole */
  white-space: nowrap;
}
:root:not([data-coat="off"]) .foot__sign [data-voice="okabe"] { order: 1; }
:root[data-coat="off"] .foot__sign { padding-bottom: var(--space-l); }

@media (width < 60em) {
  .foot__hook, .foot__info { grid-column: 1 / -1; }
  .foot__hook { grid-template-columns: 8.5rem 1fr; }
  .hook { width: 8.5rem; }
  .hook__art { width: 4.6rem; left: calc(50% - 2.3rem); }
  .hook__coat { top: .9rem; }
  .foot__info { margin-top: var(--space-m); }
}

/* ---- module hooks (Builder B's modules set these; see README contract) ---------------- */

/* blueprints: inlined <svg class="art-svg"> or the <img> fallback; strokes use currentColor */
.gadget__art { color: var(--ink); }
.gadget__art :is(img, svg) { display: block; width: 100%; height: auto; }
.gadget__art svg .bp-dim,
.gadget__art svg .bp-ctr,
.gadget__art svg .bp-hid,
.gadget__art svg .bp-ph { color: var(--ink-3); }
.gadget__art svg .bp-title { color: var(--ink-2); }
.gadget[data-quiet] .gadget__art { color: var(--ink-2); }
.gadget__link { text-decoration: none; display: block; }
.gadget__link:hover [data-voice] { color: var(--ink-2); }
.gadget__link:focus-visible { outline-offset: 6px; }

.phone { color: var(--ink); }
.phone :is(img, svg) { display: block; width: 100%; height: auto; }
.phone svg .bp-dim, .phone svg .bp-ctr, .phone svg .bp-hid, .phone svg .bp-ph { color: var(--ink-3); }

/* a call playing: every line stays visible and in place; tone marks where he is */
.call[data-playing] .call__lines > li { color: var(--ink-2); }
.call[data-playing] .call__lines > li.is-said { color: var(--ink-2); }
.call[data-playing] .call__lines > li:is(.is-current, [aria-current="true"]) {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .22em;
  text-decoration-color: var(--ink-3);
}
.call__play-mark {                /* a drawn play triangle that becomes a stop square */
  width: .7rem; height: .7rem; background: currentColor;
  clip-path: polygon(8% 0, 100% 50%, 8% 100%);
  transition: clip-path var(--dur-2) var(--ease-micro);
}
.call__play[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.call__play[aria-pressed="true"] .call__play-mark { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }

/* the badge */
.badge-out { display: grid; row-gap: .75rem; padding-top: var(--space-s); color: var(--ink); }
.badge-out__card { margin: 0; width: min(16rem, 100%); color: var(--ink); }
.badge-out__card .badge-svg { display: block; width: 100%; height: auto; }
.badge-out__line {
  --hk-l: 1.375rem; --hk-w: 150; --hk-s: 104%; --hk-case: none; --hk-lh: 1.2;
  --ok-l: 1.25rem; --ok-w: 80; --ok-s: 140%; --ok-lh: 1.25;
  --q: .9375rem;
}
.badge-out__download {
  justify-self: start;
  display: inline-flex; align-items: center; min-height: 44px;
  font-weight: 700;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .22em;
  text-decoration-color: var(--ink-3);
}
.badge-out__download:hover { text-decoration-color: var(--ink); }
.badge-form__input[aria-invalid="true"] { border-style: dashed; border-width: 3px; }

/* the visitor's pin on the collar (return visits) */
.collar-pin {
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--coat-fill);
  box-shadow: inset 0 0 0 2px var(--coat-line), inset 0 0 0 5px var(--coat-fill), inset 0 0 0 6.5px var(--coat-line);
  color: var(--coat-line);
}
.collar-pin__no {
  display: block; text-align: center;
  font: 700 max(.625rem, 1.5cqw)/1 var(--font-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

/* sound: his bar phone. The ring marks show when sound is on and shake only while it plays */
.nav__meter { width: 1.05rem; height: auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.nav__sound[aria-pressed="false"] .nav__ring { opacity: 0; }
.nav__sound[aria-pressed="false"] .nav__meter { stroke: var(--ink-2); }
@media (prefers-reduced-motion: no-preference) {
  :root[data-motion="full"] .nav__sound[data-audible] .nav__phone { animation: ring .09s steps(2, end) infinite alternate; transform-origin: 50% 90%; }
}
@keyframes ring { from { rotate: -6deg; } to { rotate: 6deg; } }

/* split text wrappers from the skid (reverted after 0.8s) */
.skid-w { display: inline-block; white-space: nowrap; }
.skid-c { display: inline-block; }

/* ---- 404 ------------------------------------------------------------------------------ */
.hero--nf { --W: min(44vw, 92svh); --cxv: 30vw; --cx: var(--cxv); }
.nf {
  position: absolute; z-index: 3;
  left: 43.7cqw; top: 46cqw;
  /* between the lapel and the right margin; "THE ORGANIZATION" measures 9.40em (the longer line) */
  --nf-avail: calc(100vw - var(--margin) - (var(--cxv) - var(--W) * .063));
  width: var(--nf-avail);
  display: grid; row-gap: 1.25rem;
}
.nf__title { display: grid; row-gap: .8rem; }
.r-nf {
  --hk-l: min(7rem, calc(var(--nf-avail) / 9.8));
  --hk-lh: .9;
  --ok-l: min(3.5rem, calc(var(--nf-avail) / 15));
  --ok-lh: 1.05;
  --q: 1.125rem;
  display: block;
  max-width: 100%;
}
/* the note and the way home sit on clean ground, right of the coat (its sleeve ends at .87W) */
.nf .r-nf[data-voice="okabe"], .nf__home { padding-left: calc(44.4cqw * var(--coat)); }
.nf__home a {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px;
  font: 700 1.125rem/1 var(--font-text);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .25em;
  text-decoration-color: var(--ink-3);
}
.nf__home a:hover { text-decoration-color: var(--ink); }
.nf__arrow { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.foot--nf { padding-bottom: var(--space-l); }
.foot--nf .foot__info { grid-column: 1 / -1; }

@media (width < 64em) {
  .hero--nf { --W: min(70vw, 22rem); --cx: 43%; padding-bottom: 15rem; }
  .nf {                          /* below the coat, full width. The stage sits at 43% of the content box - W/2 */
    top: calc(100% + var(--space-m));
    left: calc(var(--margin) - .43 * (100vw - 2 * var(--margin)) + var(--W) / 2);
    width: calc(100vw - 2 * var(--margin));
    --nf-avail: calc(100vw - 2 * var(--margin));
  }
  .nf .r-nf[data-voice="okabe"], .nf__home { padding-left: 0; }
}

@media (width < 22em) {           /* 320px phones: "coat on off" in the pocket; "Lab" stays for screen readers */
  .pocket { width: 5.9rem; }
  .pocket__lab { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .nav { column-gap: .5rem; }
  .nav__menu > summary { gap: .25rem; font-size: .875rem; }
  .nav__sound { min-width: 32px; }
}

/* ---- phones: a shorter scroll (coordinator QA: <= ~8 viewports at 390) ---------------- */
@media (width < 48em) {
  .sec-head { padding-top: calc(var(--space-l) + .75rem); padding-bottom: var(--space-s); }
  .r-head { --hk-l: min(4.75rem, calc(var(--avail) / var(--fit-hk, 8))); --ok-l: min(3rem, calc(var(--avail) / var(--fit-ok, 8))); }
  .gadget { padding-block: .8rem; }
  .gadgets__body, .log, .lab__body { padding-bottom: var(--space-m); }
  .phone { width: min(12rem, 50vw); }
  .call { padding-block: .9rem 1rem; row-gap: .5rem; }
  .member { padding-block: .65rem; }
  .lab__body { row-gap: var(--space-m); }
  .foot { padding-top: calc(var(--space-l) + 1rem); }
  .foot__hook { grid-template-columns: 6.75rem 1fr; }
  .hook { width: 6.75rem; }
  .hook__art { width: 3.8rem; left: calc(50% - 1.9rem); }
  .hook__coat { top: .72rem; }
  .foot__info { margin-top: var(--space-s); }
  .foot__links { gap: 0 1.5rem; }
  .foot__sign { margin-top: var(--space-m); }
  /* Okabe's loud lines use a narrower width on phones so they wrap less */
  .r-gline, .r-note, .r-mline, .r-lede, .r-role, .r-body, .r-cap { --ok-s: 124%; --ok-w: 80; }
  .r-gline, .r-note, .r-mline { --ok-l: 1.0625rem; }
  .r-lede, .r-role { --ok-l: 1.25rem; }
}
