/* ==========================================================================
   YAOBING LIU - PLATE ARCHIVE
   An industrial-design portfolio presented as a technical specimen archive.
   Design system: paper/ink duality, hairline rules, mono annotation, wide plates.
   ========================================================================== */

/* ---------- 1. Fonts ---------------------------------------------------- */
/* @font-face rules live in fonts.css (self-hosted, vendored by tools/fonts.mjs).
   Latin comes from Archivo + IBM Plex Mono; Chinese uses the device's own CJK
   face - every Chinese phone and desktop already ships one, so shipping a
   9 MB webfont would be pure waste. */

/* ---------- 2. Tokens --------------------------------------------------- */
:root {
  --font-display: "Archivo", "Helvetica Neue", "Microsoft YaHei", "DengXian", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --font-cjk: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC",
    "Microsoft YaHei", "DengXian", sans-serif;

  /* DAY - warm paper stock */
  --paper: #f2f1ec;
  --ink: #14140f;
  --muted: rgba(20, 20, 15, 0.62);      /* secondary text - passes AA on paper */
  --faint: rgba(20, 20, 15, 0.32);      /* decorative marks only, never text */
  --rule: rgba(20, 20, 15, 0.15);
  --rule-strong: rgba(20, 20, 15, 0.34);
  --plate-edge: rgba(20, 20, 15, 0.1);
  --grain-blend: multiply;
  --grain-opacity: 0.05;

  /* rhythm */
  --gutter: clamp(1.1rem, 4.2vw, 5.5rem);
  --max: 1720px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --theme-dur: 480ms;
}

[data-theme="night"] {
  /* NIGHT - ink black */
  --paper: #08080a;
  --ink: #ecebe3;
  --muted: rgba(236, 235, 227, 0.62);
  --faint: rgba(236, 235, 227, 0.28);
  --rule: rgba(236, 235, 227, 0.13);
  --rule-strong: rgba(236, 235, 227, 0.3);
  --plate-edge: rgba(236, 235, 227, 0.09);
  --grain-blend: soft-light;
  --grain-opacity: 0.16;
}

/* ---------- 3. Reset ---------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition:
    background-color var(--theme-dur) var(--ease-io),
    color var(--theme-dur) var(--ease-io);
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

::selection { background: var(--ink); color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* ---------- 4. Grain / atmosphere --------------------------------------- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 9998;
  pointer-events: none;
  background-image: url("../img/noise.png");
  background-repeat: repeat;
  background-size: 160px 160px;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  transition: opacity var(--theme-dur) var(--ease-io);
}

/* vignette to seat the page */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 9997;
  pointer-events: none;
  background: radial-gradient(130% 100% at 50% 0%, transparent 55%, rgba(0, 0, 0, 0.05) 100%);
}
[data-theme="night"] .vignette {
  background: radial-gradient(130% 100% at 50% 0%, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
}

/* ---------- 5. Shared type primitives ----------------------------------- */
.mono {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: clamp(0.68rem, 0.78vw, 0.8rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-feature-settings: "tnum" 1;
}
.cjk {
  font-family: var(--font-cjk);
  font-weight: 300;
  letter-spacing: 0.14em;
}
.muted { color: var(--muted); }

/* Bilingual label: latin + hanzi sitting on one baseline */
.bi {
  display: inline-flex;
  align-items: baseline;
  gap: 0.7em;
}
.bi .cjk { letter-spacing: 0.22em; font-size: 0.94em; }

/* ---------- 6. Fixed chrome: top bar ------------------------------------ */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(0.85rem, 1.5vw, 1.4rem) var(--gutter);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 600ms var(--ease),
    transform 600ms var(--ease),
    color var(--theme-dur) var(--ease-io);
}
.topbar.is-visible { opacity: 1; transform: none; }
.topbar > * { pointer-events: auto; }

/* wordmark */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 0.78vw, 0.8rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 1.85em;
  height: 1.85em;
  border: 1px solid var(--rule-strong);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82em;
  letter-spacing: 0;
  transition: background-color 320ms var(--ease), color 320ms var(--ease);
}
.brand:hover .brand__mark { background: var(--ink); color: var(--paper); }
.brand__name { color: var(--muted); }
.brand__sep { width: 22px; height: 1px; background: var(--rule-strong); }

.topbar__right {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.9rem);
}

/* live plate counter */
.counter {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 0.78vw, 0.8rem);
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.counter__now { color: var(--ink); font-weight: 500; }

/* theme switch - a mono DAY/NIGHT rail with a sliding ink block */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 7.7rem;
  border: 1px solid var(--rule-strong);
  height: 1.95rem;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  overflow: hidden;
}
.switch__thumb {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 50%;
  background: var(--ink);
  transition: transform 420ms var(--ease);
}
[data-theme="night"] .switch__thumb { transform: translateX(100%); }
.switch__opt {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: 1 1 0;
  height: 100%;
  padding: 0 0.4rem;
  color: var(--ink);
  transition: color 300ms var(--ease);
}
.switch__opt[data-active="true"] { color: var(--paper); }
.switch:hover { border-color: var(--ink); }

/* ---------- 7. Scroll progress ------------------------------------------ */
.progress {
  position: fixed;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 100%;
  z-index: 500;
  background: var(--rule);
  pointer-events: none;
}
.progress__bar {
  height: 100%;
  width: 0;
  background: var(--ink);
  transform-origin: 0 50%;
}

/* ---------- 8. MASTHEAD (plate 00) -------------------------------------- */
.masthead {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(4.5rem, 9vh, 7rem) var(--gutter) clamp(1.2rem, 3vh, 2.2rem);
  overflow: hidden;
}

/* rotated edge label */
.masthead__spine {
  position: absolute;
  left: clamp(0.5rem, 1.1vw, 1.1rem);
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.masthead__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  padding-bottom: clamp(1.5rem, 4vh, 3rem);
  border-bottom: 1px solid var(--rule);
  opacity: 0;
  animation: rise 900ms var(--ease) 120ms forwards;
}
.masthead__kicker { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.masthead__kicker b {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(0.72rem, 0.85vw, 0.82rem);
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

/* the name - the loudest thing on the site */
.masthead__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  /* measured: "YAOBING" sets at 4.52em, so the filled size would be ~22vw.
     We take 18.6vw, which keeps ~7% headroom so the glyphs never clip
     against the reveal mask - including when the web font is unavailable.
     The 30vh cap keeps short laptop viewports on a single screen. */
  font-size: clamp(2.6rem, min(18.6vw, 30vh), 30rem);
  line-height: 0.845;
  letter-spacing: -0.048em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  padding: clamp(1.4rem, 4vh, 3rem) 0 0;
}
.masthead__name span {
  display: block;
  overflow: hidden;
}
.masthead__name i {
  display: block;
  font-style: normal;
  opacity: 0;
  transform: translateY(105%);
  animation: nameUp 1180ms var(--ease) forwards;
}
.masthead__name span:nth-child(1) i { animation-delay: 200ms; }
.masthead__name span:nth-child(2) i { animation-delay: 330ms; }

/* second line pushed right - diagonal tension */
.masthead__name span:nth-child(2) {
  text-align: right;
  padding-right: 0.06em;
}
.masthead__name .dot { color: var(--muted); }

@keyframes nameUp {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes rise {
  to { opacity: 1; transform: none; }
}

/* masthead footer row */
.masthead__foot {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding-top: clamp(1.6rem, 4vh, 2.6rem);
  border-top: 1px solid var(--rule);
  opacity: 0;
  animation: rise 900ms var(--ease) 620ms forwards;
}
.masthead__identity {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.masthead__identity .latin {
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 0.9vw, 0.84rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
}
.masthead__identity .han {
  font-family: var(--font-cjk);
  font-weight: 300;
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  letter-spacing: 0.34em;
  color: var(--muted);
}

.masthead__stats {
  display: flex;
  gap: clamp(1.4rem, 3.4vw, 3.4rem);
  text-align: right;
}
.masthead__stats div {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.masthead__stats .v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 1.7vw, 1.55rem);
  letter-spacing: -0.03em;
  line-height: 1;
}
.masthead__stats .k {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* scroll cue */
.cue {
  position: absolute;
  left: 50%;
  bottom: clamp(5.2rem, 11vh, 7.5rem);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  opacity: 0;
  animation: rise 900ms var(--ease) 900ms forwards;
}
.cue__line {
  width: 1px;
  height: 46px;
  background: var(--rule-strong);
  position: relative;
  overflow: hidden;
}
.cue__line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  animation: cueDrop 2.1s var(--ease-io) infinite;
}
@keyframes cueDrop {
  0% { transform: translateY(-100%); }
  55%, 100% { transform: translateY(100%); }
}

/* ---------- 9. PLATES --------------------------------------------------- */
.plates {
  position: relative;
  padding: 0 var(--gutter);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: clamp(3rem, 9vh, 7rem) 0 clamp(1.2rem, 3vh, 2rem);
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(2.4rem, 8vh, 6rem);
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 1.9vw, 1.6rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* one plate = one wide spread from the printed portfolio */
.plate {
  margin: 0 0 clamp(3rem, 11vh, 8.5rem);
  max-width: var(--max);
  margin-inline: auto;
}

.plate__media {
  position: relative;
  display: block;
  width: 100%;
  background: var(--rule);
  overflow: hidden;
  /* hairline so light plates read as mounted, not bleeding */
  box-shadow: inset 0 0 0 1px var(--plate-edge);
}
.plate__media img {
  width: 100%;
  height: auto;
  display: block;
}

/* reveal: an ink curtain lifts off the plate */
html.js .plate__media {
  clip-path: inset(0 0 101% 0);
  transition: clip-path 1150ms var(--ease);
}
html.js .plate__media img {
  transform: scale(1.045);
  transition: transform 1400ms var(--ease);
  will-change: transform;
}
html.js .plate.is-in .plate__media { clip-path: inset(0 0 0 0); }
html.js .plate.is-in .plate__media img { transform: scale(1); }

/* caption as a drawing annotation */
.plate__cap {
  display: flex;
  align-items: center;
  gap: clamp(0.7rem, 1.6vw, 1.4rem);
  padding-top: 0.85rem;
  font-family: var(--font-mono);
  font-size: clamp(0.66rem, 0.76vw, 0.78rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  transform: translateY(7px);
  transition: opacity 800ms var(--ease) 340ms, transform 800ms var(--ease) 340ms;
}
.plate.is-in .plate__cap { opacity: 1; transform: none; }

.plate__cap .n { color: var(--ink); font-weight: 500; white-space: nowrap; }
.plate__cap .n em { font-style: normal; color: var(--muted); font-weight: 400; }
.plate__cap .rule {
  flex: 1;
  height: 1px;
  background: var(--rule);
  min-width: 12px;
}
.plate__cap .dim { white-space: nowrap; }
.plate__cap .han {
  font-family: var(--font-cjk);
  letter-spacing: 0.2em;
  color: var(--muted);
}

/* ---------- 10. CONTACT ------------------------------------------------- */
.contact {
  position: relative;
  padding: clamp(4rem, 12vh, 9rem) var(--gutter) clamp(1.6rem, 4vh, 2.6rem);
  max-width: var(--max);
  margin-inline: auto;
}
.contact__head {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding-bottom: clamp(1.8rem, 5vh, 3rem);
  border-bottom: 1px solid var(--rule-strong);
}
.contact__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 8vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.contact__head .sub {
  font-family: var(--font-cjk);
  font-weight: 300;
  font-size: clamp(0.85rem, 1.15vw, 1.02rem);
  letter-spacing: 0.36em;
  color: var(--muted);
}

.links { display: flex; flex-direction: column; }

.link {
  position: relative;
  display: grid;
  grid-template-columns: minmax(6.5rem, 12rem) 1fr auto;
  align-items: center;
  gap: clamp(0.8rem, 3vw, 3rem);
  padding: clamp(1.15rem, 2.7vh, 1.9rem) 0.2rem;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
  isolation: isolate;
}
.link::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 520ms var(--ease);
}
.link:hover::before,
.link:focus-visible::before { transform: scaleY(1); }
.link:hover, .link:focus-visible { color: var(--paper); }

.link__platform {
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 0.82vw, 0.8rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.link__platform .idx {
  font-size: 0.82em;
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}
.link__handle {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(0.95rem, 2.2vw, 1.75rem);
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: transform 520ms var(--ease);
}
.link:hover .link__handle { transform: translateX(0.5rem); }

.link__arrow {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  transition: transform 520ms var(--ease), background-color 380ms var(--ease), color 380ms var(--ease);
}
.link:hover .link__arrow {
  transform: rotate(45deg);
  background: var(--paper);
  color: var(--ink);
}
.link__arrow svg { width: 13px; height: 13px; }

/* colophon */
.colophon {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-top: clamp(1.8rem, 5vh, 3rem);
  color: var(--muted);
}
.colophon .set {
  display: flex;
  gap: 1.4rem;
  flex-wrap: wrap;
}

/* ---------- 11. FILMSTRIP index ---------------------------------------- */
.strip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem var(--gutter) 0.62rem;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-top: 1px solid var(--rule);
  transform: translateY(101%);
  transition: transform 640ms var(--ease), background-color var(--theme-dur) var(--ease-io);
}
.strip.is-visible { transform: none; }

.strip__label {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-right: 0.4rem;
  border-right: 1px solid var(--rule);
  align-self: stretch;
  justify-content: center;
}
.strip__label b { color: var(--ink); font-weight: 500; }

.strip__track {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scroll-behavior: smooth;
  padding: 2px 0;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent);
}
.strip__track::-webkit-scrollbar { display: none; }

.strip__item {
  position: relative;
  flex: 0 0 auto;
  width: 54px;
  height: 19px;
  background: var(--rule);
  opacity: 0.42;
  transition: opacity 260ms var(--ease), outline-color 260ms var(--ease);
  outline: 1px solid transparent;
  outline-offset: 1px;
}
.strip__item img { width: 100%; height: 100%; object-fit: cover; }
.strip__item:hover { opacity: 0.85; }
.strip__item.is-active {
  opacity: 1;
  outline-color: var(--ink);
}
.strip__item:focus-visible { opacity: 1; outline: 2px solid var(--ink); }

/* ---------- 12. LIGHTBOX ----------------------------------------------- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--paper);
  opacity: 0;
  visibility: hidden;
  transition: opacity 380ms var(--ease), visibility 380ms;
}
.lb.is-open { opacity: 1; visibility: visible; }

.lb__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(0.8rem, 2vh, 1.3rem) var(--gutter);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.lb__bar b { color: var(--ink); font-weight: 500; }
.lb__close {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  letter-spacing: 0.18em;
  transition: opacity 220ms;
}
.lb__close:hover { opacity: 0.55; }

.lb__stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: clamp(0.6rem, 2vw, 2rem);
  cursor: zoom-in;
}
.lb__stage.is-zoom { cursor: zoom-out; }
.lb__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 520ms var(--ease), opacity 300ms var(--ease);
  transform-origin: center center;
}
.lb__stage.is-zoom .lb__img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
}

.lb__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(0.8rem, 2vh, 1.3rem) var(--gutter);
  border-top: 1px solid var(--rule);
}
.lb__nav { display: flex; gap: 0.5rem; }
.lb__btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--rule-strong);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: background-color 220ms, color 220ms, border-color 220ms;
}
.lb__btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lb__btn:disabled { opacity: 0.28; pointer-events: none; }
.lb__btn svg { width: 11px; height: 11px; }

/* ---------- 13. Custom cursor ------------------------------------------ */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--ink);
  pointer-events: none;
  mix-blend-mode: difference;
  opacity: 0;
  transition: width 240ms var(--ease), height 240ms var(--ease), opacity 240ms, margin 240ms var(--ease);
}
.cursor.is-on { opacity: 1; }
.cursor.is-grow {
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  background: #fff;
  mix-blend-mode: difference;
}
@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor { display: none !important; }
}

/* ---------- 14. Responsive --------------------------------------------- */
@media (min-width: 901px) {
  body.strip-on .contact { padding-bottom: 6rem; }
}

/* short landscape viewports (laptops, projectors) - keep the hero on one screen */
@media (max-height: 730px) and (min-width: 641px) {
  .masthead { padding-top: 4.2rem; padding-bottom: 1rem; }
  .cue { display: none; }
  .masthead__name { padding-top: 0.8rem; }
}

@media (max-width: 900px) {
  .strip { display: none; }
  .masthead__spine { display: none; }
  .masthead__stats { gap: 1.4rem; }
  .link { grid-template-columns: 1fr auto; }
  .link__handle { grid-column: 1 / 2; }
  .link__platform { grid-column: 1 / 2; grid-row: 2; }
  .link__arrow { grid-row: 1 / 3; grid-column: 2; }
}

@media (max-width: 640px) {
  :root { --gutter: 1.05rem; }
  .masthead { min-height: 92svh; }
  .switch { width: 6.9rem; font-size: 0.62rem; }
  .masthead__stats { width: 100%; justify-content: space-between; text-align: left; }
  .masthead__foot { grid-template-columns: 1fr; }
  .cue { display: none; }
  .topbar { padding-top: 0.9rem; }
  .brand__name, .brand__sep { display: none; }
  /* wide plates go edge to edge on phones - more image, less frame */
  .plates { padding: 0; }
  .section-head { padding-inline: var(--gutter); }
  .plate__cap { padding-inline: var(--gutter); }
  .plate { margin-bottom: clamp(2.2rem, 7vh, 3.4rem); }
  .plate__cap .dim.hide-sm { display: none; }
}

/* ---------- 15. Phones held sideways ----------------------------------- */
/* 844x390, 932x430, 667x375 - a very short, very wide viewport. That is
   exactly the shape of a 2.86:1 spread, so the plates take the whole width
   and the masthead stops reserving a full screen it cannot fill gracefully.
   Must come after the max-width:900 / max-height:730 rules to win the cascade. */
@media (orientation: landscape) and (max-height: 520px) {
  .masthead {
    min-height: auto;
    padding-top: 3.2rem;
    padding-bottom: 1.1rem;
  }
  .masthead__top { padding-bottom: 0.9rem; }
  .masthead__name {
    font-size: clamp(2rem, min(18.6vw, 25vh), 30rem);
    padding-top: 0.6rem;
  }
  .masthead__foot {
    padding-top: 1rem;
    gap: 1.2rem;
    grid-template-columns: 1fr auto;
  }
  .masthead__stats { width: auto; text-align: right; justify-content: flex-end; }
  .masthead__spine, .cue { display: none; }

  /* plates edge to edge - on a small screen the artwork is the point */
  .plates { padding: 0; }
  .section-head {
    padding-inline: var(--gutter);
    padding-top: 2rem;
    padding-bottom: 0.8rem;
    margin-bottom: 1.6rem;
  }
  .plate__cap { padding-inline: var(--gutter); }
  .plate { margin-bottom: 2.2rem; }

  /* chrome gets out of the way of a 390px-tall canvas */
  .topbar { padding-block: 0.45rem; }
  .topbar__right { gap: 0.9rem; }
  .strip { display: none; }

  /* the viewer only has ~300px of stage height here */
  .lb__bar { padding-block: 0.5rem; }
  .lb__foot { padding-block: 0.5rem; }
  .lb__foot > .mono { display: none; }
  .lb__stage { padding: 0.4rem; }
  .lb__btn { padding: 0.4rem 0.7rem; }
}

/* Notched phones rotate the cutout to the left/right edge - keep text clear of it.
   On every other device env() resolves to 0, so this is a no-op. */
@supports (padding: max(0px)) {
  .masthead,
  .contact,
  .topbar {
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
  }
  .strip {
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
  }
}

/* ---------- 16. Motion preferences ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html.js .plate__media { clip-path: none; }
  html.js .plate__media img { transform: none; }
  .plate__cap { opacity: 1; transform: none; }
  .masthead__name i { opacity: 1; transform: none; }
}

/* ---------- 17. Print --------------------------------------------------- */
@media print {
  .topbar, .strip, .progress, .grain, .vignette, .cursor, .cue, .lb { display: none !important; }
  .masthead { min-height: auto; page-break-after: always; }
  .plate { page-break-inside: avoid; margin-bottom: 1cm; }
  html.js .plate__media { clip-path: none; }
  html.js .plate__media img { transform: none; }
  .plate__cap { opacity: 1; transform: none; }
}
