/* ==========================================================================
   lkutils.uk
   "Under the lens" — the site is paper on a desk, and the visitor holds the lens.
   Palette and ink are taken from the Paper Lens design system so the site and the
   product read as one family. Brand indigo is #3D50C6 exactly.
   No webfonts, no frameworks, no trackers. One stylesheet, one small script.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

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

body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

input, button, textarea, select { font: inherit; color: inherit; }

p, h1, h2, h3, h4 { overflow-wrap: break-word; }

:where(ul, ol)[class] { list-style: none; padding: 0; }

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Surfaces — the desk, the paper, the page */
  --desk:        #F0EEE9;
  --paper:       #FAF9F7;
  --raised:      #FFFEFC;
  --sunken:      #EFECE6;

  /* Ink */
  --ink:         #1C1B19;
  --ink-2:       #55524D;
  --ink-3:       #7A766F;

  /* Brand */
  --accent:      #3D50C6;
  --accent-ink:  #3D50C6;      /* accent used as text on paper — 6.6:1 */
  --on-accent:   #FFFFFF;
  --accent-soft: #E3DFFF;
  --on-soft:     #001550;

  /* Lines */
  --line:        #E2DED7;
  --line-strong: #CFCAC1;

  /* The viewfinder — identical in every theme, like the app's documentSurface */
  --shot-bg:     #100F0E;
  --mint:        #00E0A4;

  /* Depth */
  --lift-1: 0 1px 2px rgb(28 27 25 / .05), 0 2px 6px rgb(28 27 25 / .05);
  --lift-2: 0 2px 4px rgb(28 27 25 / .05), 0 12px 32px rgb(28 27 25 / .09);
  --lift-3: 0 30px 70px rgb(16 15 14 / .28);

  /* Type */
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono",
          "Roboto Mono", Menlo, Consolas, monospace;

  --t-display: clamp(2.6rem, 1.4rem + 5.6vw, 5.5rem);
  --t-h2:      clamp(1.75rem, 1.25rem + 2.1vw, 2.75rem);
  --t-h3:      clamp(1.15rem, 1.02rem + 0.55vw, 1.45rem);
  --t-lead:    clamp(1.06rem, 0.98rem + 0.4vw, 1.3rem);
  --t-body:    1.0625rem;
  --t-small:   0.9375rem;
  --t-micro:   0.8125rem;

  /* Rhythm */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.5rem;   --s-6: 2rem;     --s-7: 3rem;     --s-8: 4.5rem;
  --s-9: clamp(4rem, 2rem + 9vw, 8rem);

  --r-sm: 8px;  --r: 14px;  --r-lg: 22px;  --r-pill: 999px;

  --ease: cubic-bezier(.2, .7, .3, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --desk:        #0E0D0C;
  --paper:       #141311;
  --raised:      #1D1C1A;
  --sunken:      #0A0A09;
  --ink:         #ECEAE6;
  --ink-2:       #A7A29B;
  --ink-3:       #857F78;
  --accent:      #C6BFFF;
  --accent-ink:  #C6BFFF;
  --on-accent:   #00277F;
  --accent-soft: #123BAC;
  --on-soft:     #E3DFFF;
  --line:        #2E2C29;
  --line-strong: #403D39;
  --lift-1: 0 1px 2px rgb(0 0 0 / .5);
  --lift-2: 0 2px 4px rgb(0 0 0 / .4), 0 12px 32px rgb(0 0 0 / .45);
  --lift-3: 0 30px 70px rgb(0 0 0 / .6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --desk:        #0E0D0C;
    --paper:       #141311;
    --raised:      #1D1C1A;
    --sunken:      #0A0A09;
    --ink:         #ECEAE6;
    --ink-2:       #A7A29B;
    --ink-3:       #857F78;
    --accent:      #C6BFFF;
    --accent-ink:  #C6BFFF;
    --on-accent:   #00277F;
    --accent-soft: #123BAC;
    --on-soft:     #E3DFFF;
    --line:        #2E2C29;
    --line-strong: #403D39;
    --lift-1: 0 1px 2px rgb(0 0 0 / .5);
    --lift-2: 0 2px 4px rgb(0 0 0 / .4), 0 12px 32px rgb(0 0 0 / .45);
    --lift-3: 0 30px 70px rgb(0 0 0 / .6);
  }
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */

body {
  font-family: var(--sans);
  font-size: var(--t-body);
  color: var(--ink);
  background-color: var(--desk);
  /* Engineering paper: a 32px rule, barely there. */
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--ink) 4%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--ink) 4%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
}

h1, h2, h3 { font-weight: 620; line-height: 1.08; letter-spacing: -0.022em; }
h1 { font-size: var(--t-display); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); line-height: 1.25; letter-spacing: -0.012em; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

::selection { background: var(--accent); color: var(--on-accent); }

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

.mono {
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.04em;
}

.skip {
  position: absolute;
  left: var(--s-4);
  top: var(--s-4);
  z-index: 100;
  padding: var(--s-3) var(--s-4);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: var(--t-micro);
  transform: translateY(-200%);
}
.skip:focus-visible { transform: none; }

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */

.wrap { width: min(100% - 2.5rem, 1120px); margin-inline: auto; }
.wrap-narrow { width: min(100% - 2.5rem, 720px); margin-inline: auto; }

.section { padding-block: var(--s-9); }
.section + .section { padding-top: 0; }

/* The notebook margin: a sticky section number beside its content. */
.section-grid {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: var(--s-6);
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: var(--s-5);
}

.section-aside {
  position: sticky;
  top: 6rem;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-num { color: var(--accent-ink); font-weight: 600; }
.section-kicker { color: var(--ink-3); }

@media (max-width: 51.25em) {
  .section-grid { grid-template-columns: 1fr; gap: var(--s-4); }
  .section-aside { position: static; flex-direction: row; gap: var(--s-3); }
}

/* --------------------------------------------------------------------------
   5. Scan line + header
   -------------------------------------------------------------------------- */

.scanline {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 60;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--mint));
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .scanline {
      animation: scanline-fill linear both;
      animation-timeline: scroll(root block);
    }
  }
}
@keyframes scanline-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--desk) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--desk) 94%, transparent);
}

.header-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  /* Wraps rather than overflows: at large text sizes the nav drops to its own line. */
  flex-wrap: wrap;
  min-height: 66px;
  padding-block: var(--s-2);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 620;
  letter-spacing: -0.02em;
  font-size: 1.0625rem;
  padding: var(--s-2) 0;
}
.wordmark .glyph { width: 26px; height: 26px; border-radius: 7px; flex: none; }
.wordmark .bracket { color: var(--accent-ink); font-family: var(--mono); opacity: .75; }
.wordmark:hover .bracket { opacity: 1; }

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-1);
}
.site-nav a {
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.02em;
  color: var(--ink-2);
  text-decoration: none;
  padding: var(--s-3) var(--s-3);
  border-radius: var(--r-sm);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.site-nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.site-nav a[aria-current="page"] { color: var(--accent-ink); }

.theme-toggle {
  margin-left: var(--s-2);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink-2);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
}

/* In em, so a reader who has raised their default text size drops these too. */
@media (max-width: 39em) {
  .site-nav a.nav-optional { display: none; }
}

/* --------------------------------------------------------------------------
   6. Buttons, chips, links
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 48px;
  padding: 0 1.15rem;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s var(--ease), background-color .18s var(--ease),
              border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn .arrow { transition: transform .18s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--lift-1); }
.btn-primary:hover { box-shadow: var(--lift-2); }

.btn-ghost { background: var(--raised); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--paper); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.7rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--raised);
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip-accent {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--on-soft);
}
.chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: none;
}
.chip-live .dot { background: #006D3F; }
[data-theme="dark"] .chip-live .dot { background: #73DB9F; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip-live .dot { background: #73DB9F; }
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  /* Standalone call to action, so it carries its own 28px target. */
  min-height: 28px;
  font-family: var(--mono);
  font-size: var(--t-micro);
  text-decoration: none;
  color: var(--accent-ink);
}
.link-arrow::after { content: "→"; transition: transform .18s var(--ease); }
.link-arrow:hover::after { transform: translateX(3px); }
.link-arrow:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */

.hero { padding-block: clamp(2.5rem, 1rem + 6vw, 5.5rem) var(--s-8); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: clamp(2rem, 1rem + 4vw, 4.5rem);
  align-items: center;
}
@media (max-width: 58.75em) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-7); }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s-5);
}
.eyebrow::before {
  content: "";
  width: 28px; height: 1px;
  background: var(--line-strong);
}

.hero h1 { margin-bottom: var(--s-5); }
.hero h1 .soft { color: var(--ink-3); }

.hero-lead {
  font-size: var(--t-lead);
  color: var(--ink-2);
  max-width: 34em;
  margin-bottom: var(--s-6);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* Facts strip */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.625rem, 1fr));
  gap: 1px;
  margin-top: var(--s-8);
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.fact { background: var(--paper); padding: var(--s-5); }
.fact dt {
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s-2);
}
.fact dd {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 620;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.fact dd small {
  display: block;
  font-size: var(--t-small);
  font-weight: 400;
  color: var(--ink-2);
  letter-spacing: 0;
  margin-top: var(--s-2);
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   8. The lens — the stage, two shots, and the glass
   -------------------------------------------------------------------------- */

.scanner { margin: 0; }

.stage {
  --px: 50%;
  --py: 46%;
  --lens-r: 96px;
  position: relative;
  aspect-ratio: 5 / 4;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--shot-bg);
  box-shadow: var(--lift-3), 0 0 0 1px rgb(255 255 255 / .06) inset;
  touch-action: pan-y;
}
.stage.is-lens { cursor: crosshair; }

.shot {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 50% -10%, #23211E 0%, #100F0E 62%, #0A0A09 100%);
}
/* The page and the detected quad share one cell, so they stack. */
.shot > * { grid-area: 1 / 1; }

/* The page prop — same box in both shots, so the lens reveals one change only. */
.page {
  width: 54%;
  aspect-ratio: 1 / 1.32;
  border-radius: 3px;
  padding: 9% 8.5%;
  display: flex;
  flex-direction: column;
  gap: 4.2%;
  background: var(--page-tone);
}
.page .ln { height: 2.4%; border-radius: 1px; background: var(--line-tone); }
.page .ln-title { height: 5.4%; width: 62%; border-radius: 2px; background: var(--title-tone); margin-bottom: 3%; }
.page .ln-gap { height: 5%; }
.w-95 { width: 95%; } .w-88 { width: 88%; } .w-82 { width: 82%; }
.w-74 { width: 74%; } .w-58 { width: 58%; } .w-40 { width: 40%; }

/* Shot A — the photograph: warm, tilted, softened. */
.shot-raw { filter: saturate(1.06) contrast(.95); }
.shot-raw .page {
  --page-tone: #EBE4D6;
  --line-tone: #B4AC9C;
  --title-tone: #9C947F;
  transform: perspective(760px) rotateX(7deg) rotateZ(-4.6deg) scale(.955) translateY(1.5%);
  box-shadow: 0 26px 50px rgb(0 0 0 / .55);
  filter: blur(.4px);
}
.shot-raw::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 55% at 32% 18%, rgb(255 214 150 / .16), transparent 70%),
    radial-gradient(120% 100% at 50% 50%, transparent 42%, rgb(0 0 0 / .55) 100%);
  pointer-events: none;
}

/* Shot B — the scan: flat, cool, crisp, with the detected quad. */
.shot-scan { clip-path: inset(0 0 0 50%); }
.stage.is-lens .shot-scan {
  clip-path: none;
  -webkit-mask-image: radial-gradient(circle var(--lens-r) at var(--px) var(--py),
                       #000 98%, transparent 100%);
          mask-image: radial-gradient(circle var(--lens-r) at var(--px) var(--py),
                       #000 98%, transparent 100%);
}
.shot-scan .page {
  --page-tone: #FFFFFF;
  --line-tone: #3A3833;
  --title-tone: #1C1B19;
  box-shadow: 0 0 0 1px rgb(0 224 164 / .25), 0 22px 46px rgb(0 0 0 / .5),
              0 0 46px rgb(0 224 164 / .1);
}
.shot-scan .page .ln:nth-child(3) { background: var(--accent); opacity: .9; }

/* The detected quad — the app's own corner brackets. */
.quad {
  width: 60%;
  aspect-ratio: 1 / 1.24;
  --b: 2px;
  --l: 22px;
  --c: var(--mint);
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / var(--l) var(--b) no-repeat,
    linear-gradient(var(--c), var(--c)) 0 0 / var(--b) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / var(--l) var(--b) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / var(--b) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / var(--l) var(--b) no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / var(--b) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / var(--l) var(--b) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / var(--b) var(--l) no-repeat;
}

.stage-pill {
  position: absolute;
  top: 5%;
  left: 75%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-pill);
  background: rgb(6 35 27 / .82);
  border: 1px solid rgb(0 224 164 / .35);
  color: var(--mint);
  font-family: var(--mono);
  font-size: 0.75rem;
  white-space: nowrap;
}
.stage-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.stage.is-lens .stage-pill { left: 50%; }

/* Split-view fallback: no JS, coarse pointer, or before the script runs. */
.split-line {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 1px;
  background: rgb(255 255 255 / .38);
  box-shadow: 0 0 14px rgb(0 0 0 / .5);
  pointer-events: none;
}
.split-line::before,
.split-line::after {
  position: absolute;
  bottom: 14px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: rgb(255 255 255 / .72);
  white-space: nowrap;
}
.split-line::before { content: "PHOTO"; right: calc(100% + 12px); }
.split-line::after  { content: "CORRECTED"; left: calc(100% + 12px); color: var(--mint); }

.stage.is-lens .split-line { display: none; }

/* The glass. */
.lens-ring {
  position: absolute;
  top: 0; left: 0;
  width: calc(var(--lens-r) * 2);
  height: calc(var(--lens-r) * 2);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  /* Transform rather than inset, so the glass rides on the compositor. */
  transform: translate3d(calc(var(--px) - var(--lens-r)),
                         calc(var(--py) - var(--lens-r)), 0);
  box-shadow:
    0 0 0 1px rgb(255 255 255 / .6),
    0 0 0 6px rgb(255 255 255 / .07),
    0 0 0 7px rgb(0 224 164 / .3),
    0 18px 44px rgb(0 0 0 / .5);
}
.stage.is-lens .lens-ring { opacity: 1; transition: opacity .3s var(--ease); }

.stage-hint {
  position: absolute;
  right: 14px;
  bottom: 12px;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: rgb(255 255 255 / .5);
  opacity: 0;
  transition: opacity .4s var(--ease);
  pointer-events: none;
}
.stage.is-lens .stage-hint { opacity: 1; }
.stage.is-lens.is-touched .stage-hint { opacity: 0; }

.scanner figcaption {
  margin-top: var(--s-4);
  font-size: var(--t-small);
  color: var(--ink-2);
  max-width: 44ch;
}
.scanner figcaption strong { color: var(--ink); font-weight: 560; }

/* --------------------------------------------------------------------------
   9. Cards
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s-5);
  transition: border-color .25s var(--ease), transform .25s var(--ease),
              box-shadow .25s var(--ease);
}
.card::after {
  content: "";
  position: absolute;
  inset: -7px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .28s var(--ease);
  --b: 2px; --l: 16px; --c: var(--accent);
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / var(--l) var(--b) no-repeat,
    linear-gradient(var(--c), var(--c)) 0 0 / var(--b) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / var(--l) var(--b) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / var(--b) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / var(--l) var(--b) no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / var(--b) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / var(--l) var(--b) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / var(--b) var(--l) no-repeat;
}
.card:hover, .card:focus-within {
  border-color: var(--line-strong);
  box-shadow: var(--lift-2);
}
.card:hover::after, .card:focus-within::after { opacity: 1; }

/* Whole-card link: the anchor covers the card, the text stays selectable. */
.card-link::before { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.card-link:focus-visible { outline: none; }

/* Featured work card */
.work-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--s-5);
  padding: var(--s-6);
  align-items: start;
}
@media (max-width: 38.75em) {
  .work-card { grid-template-columns: 1fr; gap: var(--s-4); padding: var(--s-5); }
}
.work-icon {
  width: 96px; height: 96px;
  border-radius: 22px;
  box-shadow: var(--lift-1);
}
.work-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.work-head h3 { margin: 0; }
.work-head h3 a { color: var(--ink); text-decoration: none; }
.card:hover .work-head h3 a,
.card:focus-within .work-head h3 a { color: var(--accent-ink); }
.work-card p { color: var(--ink-2); margin-bottom: var(--s-4); max-width: 60ch; }
.tag-row { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-5); }
.tag {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--ink-3);
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

/* An empty sheet, for the work that is not here yet. */
.card-empty {
  border-style: dashed;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-6);
}
.card-empty::after { display: none; }
.card-empty:hover { box-shadow: none; }
.card-empty h3 { color: var(--ink-2); }
.card-empty p { color: var(--ink-3); max-width: 58ch; }

/* Small shared pieces */
.label-mono {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: var(--s-3);
}
.card-empty .label-mono { margin-bottom: 0; }
.muted { color: var(--ink-2); }

.list { display: grid; gap: var(--s-2); margin-top: var(--s-4); }
.list li {
  position: relative;
  padding-left: 1.15rem;
  font-size: var(--t-small);
  color: var(--ink-2);
}
.list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px; height: 6px;
  border-radius: 2px;
  background: var(--accent);
  opacity: .7;
}

.copy-status {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--ink-2);
  margin-top: var(--s-3);
  min-height: 1.4em;
}

.section-body > h2 { margin-bottom: var(--s-4); }
/* Direct children only — inside a grid this margin would eat the row's stretch. */
.section-body > .card + .card { margin-top: var(--s-4); }
.section-body p + p { margin-top: var(--s-4); }

/* Principle grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
  gap: var(--s-4);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--s-4);
}
.principle h3 { margin-bottom: var(--s-3); }
.principle p { color: var(--ink-2); font-size: var(--t-small); }
.principle .n {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--accent-ink);
  margin-bottom: var(--s-3);
}

/* --------------------------------------------------------------------------
   10. Contact
   -------------------------------------------------------------------------- */

.contact-box {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.5rem, 1rem + 2.5vw, 3rem);
}
.contact-box h2 { margin-bottom: var(--s-4); }
.contact-box p { color: var(--ink-2); max-width: 52ch; margin-bottom: var(--s-4); }

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--s-7);
  align-items: start;
}
@media (max-width: 51.25em) {
  .contact-grid { grid-template-columns: 1fr; gap: var(--s-5); }
}
.contact-side .field { max-width: none; }
.contact-note { font-size: var(--t-small); color: var(--ink-3); margin-bottom: 0; }
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}

.field {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--paper);
  max-width: 30rem;
}
.field .value {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 var(--s-4);
  font-family: var(--mono);
  font-size: var(--t-small);
  color: var(--ink);
  text-decoration: none;
  min-height: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field .value:hover { background: var(--sunken); }
.copy-btn {
  border: 0;
  border-left: 1px solid var(--line-strong);
  background: var(--raised);
  color: var(--ink-2);
  padding: 0 var(--s-4);
  min-height: 52px;
  min-width: 52px;
  font-family: var(--mono);
  font-size: var(--t-micro);
  cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.copy-btn:hover { background: var(--sunken); color: var(--ink); }
.copy-btn.is-done { color: var(--on-soft); background: var(--accent-soft); }

/* --------------------------------------------------------------------------
   11. Product page
   -------------------------------------------------------------------------- */

.breadcrumb {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--ink-3);
  padding-top: var(--s-6);
}
.breadcrumb a { color: var(--ink-3); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-ink); text-decoration: underline; }

.product-hero {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: var(--s-6);
  align-items: start;
  padding-block: var(--s-6) var(--s-8);
}
@media (max-width: 38.75em) {
  .product-hero { grid-template-columns: 1fr; gap: var(--s-5); }
}
.product-hero .app-icon {
  width: 120px; height: 120px;
  border-radius: 27px;
  box-shadow: var(--lift-2);
}
.product-hero h1 { font-size: clamp(2.2rem, 1.4rem + 3.4vw, 3.6rem); margin-bottom: var(--s-4); }

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--raised);
  border-radius: var(--r);
  padding: var(--s-5);
}
.notice h2, .notice h3 { font-size: var(--t-h3); line-height: 1.25; margin-bottom: var(--s-3); }
.notice p { color: var(--ink-2); max-width: 62ch; }
.notice p + p { margin-top: var(--s-3); }

.steps { counter-reset: step; display: grid; gap: var(--s-4); }
.step {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: var(--s-4);
  padding: var(--s-5) 0;
  border-top: 1px solid var(--line);
}
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--accent-ink);
  padding-top: 0.35rem;
}
.step h3 { margin-bottom: var(--s-2); }
.step p { color: var(--ink-2); max-width: 64ch; }

.feature-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(16.25rem, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.feature { background: var(--paper); padding: var(--s-5); }
.feature h3 { font-size: 1.02rem; margin-bottom: var(--s-2); }
.feature p { font-size: var(--t-small); color: var(--ink-2); }

/* Build log */
.log { display: grid; gap: 0; }
.log-entry {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: var(--s-5);
  padding: var(--s-5) 0;
  border-top: 1px solid var(--line);
  position: relative;
}
.log-entry .when {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.log-entry h3 { font-size: 1.05rem; margin-bottom: var(--s-2); }
.log-entry p { color: var(--ink-2); font-size: var(--t-small); max-width: 66ch; }
@media (max-width: 43.75em) {
  .log-entry { grid-template-columns: 1fr; gap: var(--s-2); }
}

/* --------------------------------------------------------------------------
   12. Prose — policy, terms, support
   -------------------------------------------------------------------------- */

.prose { padding-block: var(--s-6) var(--s-9); }
.prose h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); margin-bottom: var(--s-4); }
.prose .updated {
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--ink-3);
  margin-bottom: var(--s-7);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
}
.prose h2 {
  font-size: 1.4rem;
  margin-top: var(--s-7);
  margin-bottom: var(--s-4);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}
.prose h2:first-of-type { border-top: 0; padding-top: 0; }
.prose h3 { margin-top: var(--s-5); margin-bottom: var(--s-3); }
.prose p, .prose li { color: var(--ink-2); }
.prose p { margin-bottom: var(--s-4); max-width: 68ch; }
.prose ul, .prose ol { margin: 0 0 var(--s-4); padding-left: 1.35rem; max-width: 68ch; }
.prose li { margin-bottom: var(--s-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.36em;
  color: var(--ink);
}
.prose ol { counter-reset: none; }
.prose .list { padding-left: 0; }
.prose .lead { font-size: var(--t-lead); color: var(--ink); max-width: 60ch; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--s-5);
  font-size: var(--t-small);
}
.prose th, .prose td {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose th { font-family: var(--mono); font-size: var(--t-micro); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3); font-weight: 500; }
.prose td { color: var(--ink-2); }
.table-scroll { overflow-x: auto; margin-bottom: var(--s-5); }

.callout {
  background: var(--accent-soft);
  color: var(--on-soft);
  border-radius: var(--r);
  padding: var(--s-5);
  margin-bottom: var(--s-6);
}
.callout p, .callout li { color: inherit; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout strong { color: inherit; }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  padding: var(--s-4) 2rem var(--s-4) 0;
  font-weight: 560;
  color: var(--ink);
  list-style: none;
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0.25rem;
  font-family: var(--mono);
  color: var(--accent-ink);
  font-size: 1.2rem;
}
.faq details[open] summary::after { content: "–"; }
.faq summary:hover { color: var(--accent-ink); }
.faq .answer { padding: 0 0 var(--s-5); }
.faq .answer p:last-child, .faq .answer ul:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding-block: var(--s-7);
  margin-top: var(--s-8);
}
/* rem, not px — the columns collapse when the reader's text grows, not only the window. */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--s-6);
}

.footer-about p {
  color: var(--ink-3);
  font-size: var(--t-small);
  max-width: 34ch;
  margin-top: var(--s-3);
}
.footer-col h2 {
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s-3);
}
.footer-col ul { display: grid; gap: var(--s-1); }
.footer-col a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--t-small);
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}
.footer-col a:hover { color: var(--accent-ink); text-decoration: underline; }

.footer-base {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: var(--t-micro);
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   14. Reveal
   -------------------------------------------------------------------------- */

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   15. 404
   -------------------------------------------------------------------------- */

.notfound {
  min-height: 58vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: var(--s-8);
}
.notfound .frame {
  width: min(260px, 60vw);
  aspect-ratio: 4 / 3;
  margin: 0 auto var(--s-6);
  position: relative;
  border-radius: var(--r);
  background: var(--shot-bg);
  display: grid;
  place-items: center;
}
.notfound .frame > * { grid-area: 1 / 1; }
.notfound .frame .quad { width: 66%; aspect-ratio: 4/3; opacity: .5; }
.notfound .frame span {
  align-self: center;
  justify-self: center;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: rgb(255 255 255 / .55);
}
.notfound h1 { font-size: clamp(3rem, 2rem + 5vw, 5rem); }
.notfound p { color: var(--ink-2); max-width: 42ch; margin: var(--s-4) auto var(--s-6); }
.notfound-actions { justify-content: center; }

@media print {
  .site-header, .site-footer, .scanline, .stage { display: none; }
  body { background: #fff; color: #000; }
}
