/* TexIDE landing page. Tokens are the app's Clean light / Clean dark themes
   (frontend/src/theme/themes.js); fonts are the app's system stacks. */

:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --border: #dde2ea;
  --border-strong: #858fa0;
  --text: #1d2433;
  --muted: #576173;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-text: #ffffff;
  --accent-soft: #ebf0fd;
  --error: #c4352b;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.06), 0 8px 24px rgb(16 24 40 / 0.08);
  --shadow-card: 0 1px 2px rgb(16 24 40 / 0.05), 0 2px 8px rgb(16 24 40 / 0.05);
  --shadow-window: 0 2px 4px rgb(16 24 40 / 0.06), 0 24px 56px -12px rgb(16 24 40 / 0.22);
  --btn-shadow: 0 1px 2px rgb(16 24 40 / 0.2), 0 8px 20px -4px rgb(37 99 235 / 0.4);
  --zip-shadow: 0 18px 32px -8px rgb(37 99 235 / 0.28);
  --num-hero: #dfe7fa;
  --num: #dce1e9;

  /* Named sans faces before system-ui: on some Linux desktops system-ui resolves to a monospace UI font. */
  --font-ui: -apple-system, 'Segoe UI', 'Noto Sans', Cantarell, Ubuntu, Roboto, 'Helvetica Neue', Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'JetBrains Mono', 'DejaVu Sans Mono', Menlo, Consolas, monospace;

  --gutter: 0px;
  --pad: 20px;
  --header-h: 64px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #14171d;
    --surface: #1e222a;
    --surface-2: #272c36;
    --border: #323844;
    --border-strong: #6e7789;
    --text: #e6e8ee;
    --muted: #a3abba;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-text: #0b1220;
    --accent-soft: #1f3152;
    --error: #ff8278;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
    --shadow-card: 0 1px 2px rgb(0 0 0 / 0.25), 0 2px 8px rgb(0 0 0 / 0.2);
    --shadow-window: 0 2px 4px rgb(0 0 0 / 0.3), 0 28px 64px -12px rgb(0 0 0 / 0.6);
    --btn-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 20px -6px rgb(0 0 0 / 0.5);
    --zip-shadow: 0 18px 32px -8px rgb(0 0 0 / 0.55);
    --num-hero: #1c2740;
    --num: #232832;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #14171d;
  --surface: #1e222a;
  --surface-2: #272c36;
  --border: #323844;
  --border-strong: #6e7789;
  --text: #e6e8ee;
  --muted: #a3abba;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-text: #0b1220;
  --accent-soft: #1f3152;
  --error: #ff8278;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  --shadow-card: 0 1px 2px rgb(0 0 0 / 0.25), 0 2px 8px rgb(0 0 0 / 0.2);
  --shadow-window: 0 2px 4px rgb(0 0 0 / 0.3), 0 28px 64px -12px rgb(0 0 0 / 0.6);
  --btn-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 20px -6px rgb(0 0 0 / 0.5);
  --zip-shadow: 0 18px 32px -8px rgb(0 0 0 / 0.55);
  --num-hero: #1c2740;
  --num: #232832;
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--border-strong) var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

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

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

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

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

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.08em 0.32em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

h1, h2, h3 { text-wrap: balance; color: var(--text); }
p { text-wrap: pretty; }

[hidden] { display: none !important; }

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

.skip {
  position: absolute;
  left: 12px; top: -64px;
  z-index: 50;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 12px; }

.i {
  width: 20px; height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  padding: 0 var(--pad);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img { width: 28px; height: 28px; border-radius: 7px; }

.top-nav { display: flex; align-items: center; gap: 4px; }
.top-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.top-nav a:hover { color: var(--text); background: var(--surface-2); }
.top-nav a[href='#night'] { display: none; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  margin-left: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle .i-sun { display: none; }
:root[data-theme='dark'] .theme-toggle .i-sun { display: block; }
:root[data-theme='dark'] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme='light']) .theme-toggle .i-moon { display: none; }
}

/* ---------- Timeline (mobile first: a rail down the left) ---------- */

.night { position: relative; }

.step, .local {
  --rail: 84px;
  --t-lh: 29px;
  position: relative;
  margin-left: var(--rail);
  padding: 52px 16px 8px 20px;
  border-left: 1px solid var(--border);
}
.step-hero { --t-lh: calc(clamp(2.25rem, 10vw, 2.625rem) * 0.98); }
.local { --t-lh: 37px; }

/* The time sits left of the rail, its dot on the rail, level with the heading's first line. */
.t {
  position: absolute;
  left: calc(-1 * var(--rail) + 4px);
  top: 52px;
  width: calc(var(--rail) - 22px);
  margin: 0;
  text-align: right;
  font: 600 0.625rem/var(--t-lh) var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.t time { position: relative; display: inline-block; }
.t time::before {
  content: '';
  position: absolute;
  right: -23.5px; top: calc((var(--t-lh) - 11px) / 2);
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
}
.step.is-active .t, .step-hero .t { color: var(--accent); }
.step.is-active .t time::before, .step-hero .t time::before { background: var(--accent); border-color: var(--accent); }

.step-copy { position: relative; isolation: isolate; }

.num {
  position: absolute;
  z-index: -1;
  right: -8px; top: -52px;
  font: 800 7.5rem/0.8 var(--font-ui);
  letter-spacing: -0.06em;
  color: var(--num);
  user-select: none;
  pointer-events: none;
}
.step-hero .num { color: var(--num-hero); }

h1 {
  font-size: clamp(2.25rem, 10vw, 2.625rem);
  line-height: 0.98;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 20px;
}
h1 .accent { color: var(--accent); }

.step h2 {
  font-size: 1.625rem;
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -0.022em;
  margin-bottom: 14px;
  max-width: 18ch;
}

.step-copy > p { color: var(--muted); max-width: 34rem; }
.step-copy > p + p { margin-top: 12px; }
.step-copy strong { color: var(--text); font-weight: 650; }

.lead {
  font-size: 1.1875rem;
  line-height: 1.5;
  margin-bottom: 28px;
}

.aside { font-size: 0.9375rem; }

.step-note {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
}

/* ---------- Calls to action ---------- */

.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 13px 26px 13px 22px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.0625rem;
  font-weight: 650;
  text-decoration: none;
  box-shadow: var(--btn-shadow);
  transition: background-color 0.15s, transform 0.15s var(--ease-out), box-shadow 0.15s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline-offset: 3px; border-radius: 10px; }
.btn.is-disabled {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
  cursor: not-allowed;
}
.btn.is-disabled .i { display: none; }
.btn.is-disabled:active { transform: none; }

.lnk { font-weight: 550; }

.cta-meta {
  margin-top: 12px;
  font: 0.8125rem/1.5 var(--font-mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.step-copy > .cta-meta { font-size: 0.8125rem; }

/* ---------- The TexIDE window ---------- */

.stage { padding: 104px 16px 0; }

.win-wrap { position: relative; }

.win {
  position: relative;
  z-index: 2;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-window);
}

.win-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}
.win-bar img { width: 14px; height: 14px; border-radius: 3px; }
.win-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-ctl {
  width: 60px; height: 12px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.3;
  stroke-linecap: round;
}

.win-screen {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #eef1f6; /* the screenshots are Clean light */
}

.layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  filter: blur(6px);
  transform: scale(1.012);
  transition:
    opacity 0.45s var(--ease-out),
    filter 0.55s var(--ease-out),
    transform 0.7s var(--ease-out),
    visibility 0s linear 0.55s;
}
.layer img, .layer video, .layer picture {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.win-wrap[data-state='drop'] [data-layer='drop'],
.win-wrap[data-state='demo'] [data-layer='demo'],
.win-wrap[data-state='pdf'] [data-layer='pdf'],
.win-wrap[data-state='errors'] [data-layer='errors'],
.win-wrap[data-state='ai'] [data-layer='ai'],
.win-wrap[data-state='writing'] [data-layer='writing'] {
  opacity: 1;
  visibility: visible;
  filter: none;
  transform: none;
  transition-delay: 0s;
}

/* The spotlight: what is new at this time of night. */
.ring {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--w) * 1%);
  height: calc(var(--h) * 1%);
  border-radius: 8px;
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  box-shadow: 0 6px 18px -6px rgb(37 99 235 / 0.35);
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.5s var(--ease-out) 0.2s, transform 0.6s var(--ease-out) 0.2s;
}
.win-wrap[data-state='pdf'] [data-layer='pdf'] .ring,
.win-wrap[data-state='errors'] [data-layer='errors'] .ring,
.win-wrap[data-state='ai'] [data-layer='ai'] .ring,
.win-wrap[data-state='writing'] [data-layer='writing'] .ring {
  opacity: 1;
  transform: none;
}

.zip-card {
  position: absolute;
  z-index: 4;
  left: 16%;
  top: -46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px 11px 13px;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow), var(--zip-shadow);
  transform: rotate(-5deg);
  transition: opacity 0.35s var(--ease-out), transform 0.5s var(--ease-out);
  animation: zip-in 1.1s var(--ease-out) 0.2s backwards;
}
.zip-card b { display: block; font: 650 0.9375rem/1.3 var(--font-mono); color: var(--text); }
.zip-card small { display: block; font-size: 0.75rem; color: var(--muted); }
.zip-ico { width: 30px; height: 38px; flex: none; }
.zip-ico .zf { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.zip-ico .zl { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.zip-ico .zz { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }

.win-wrap:not([data-state='drop']) .zip-card {
  opacity: 0;
  transform: translate(28px, 70px) rotate(0deg) scale(0.6);
}

.serif {
  position: absolute;
  z-index: 3;
  right: 6%;
  top: -86px;
  width: 104px;
}
.serif img { width: 100%; height: auto; }

.win-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font: 0.8125rem/1.4 var(--font-mono);
  color: var(--muted);
}
.win-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.win-wrap[data-state='errors'] .win-status .dot { background: var(--error); }

@keyframes zip-in {
  from { transform: translate(-70px, -90px) rotate(-18deg); }
  to { transform: rotate(-5deg); }
}

/* Mobile: the window is the hero picture; each step carries its own shot. */
.layer:not([data-layer='drop']) { display: none; }
.win-status { display: none; }
.loupes { display: none; }

.step-shot {
  margin-top: 24px;
  overflow: hidden;
}
.step-shot img { width: 100%; height: auto; }
/* Full bleed on narrow screens, so the crops read as large as the phone allows. */
.step .step-shot { margin-left: calc(-1 * var(--rail) - 5px); width: calc(100% + var(--rail) + 5px); }
.local .t { top: 96px; }
.step-shot video { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.step-shot figcaption {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}

.shot-frame {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* ---------- Your files stay on your computer ---------- */

.local { padding-top: 96px; padding-bottom: 24px; }
.local h2 {
  font-size: 2.25rem;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.032em;
  margin-bottom: 20px;
  max-width: 13ch;
}
.local-copy p { color: var(--muted); max-width: 36rem; font-size: 1.125rem; }
.local-side {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  max-width: 30rem;
}
.local-side h3 { font-size: 1.0625rem; font-weight: 650; margin-bottom: 6px; }
.local-side p { color: var(--muted); }

/* ---------- Download ---------- */

.download {
  margin: 88px var(--pad) 0;
  padding: 36px 0 24px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 24px;
}
.download h2 {
  font-size: clamp(1.875rem, 7vw, 2.75rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.download-head > p:not(.cta-meta) { color: var(--muted); margin-bottom: 24px; }

.installers-wrap { margin-top: 40px; }

.installers {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.installers thead { display: none; }
.installers tr {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.installers tbody tr:first-child { border-top: 1px solid var(--border); }
.installers th[scope='row'] { text-align: left; font-weight: 650; }
.installers th[scope='row'] span { font-weight: 400; color: var(--muted); }
.installers td { color: var(--muted); font-variant-numeric: tabular-nums; }
.installers:not(.has-data) td,
.installers:not(.has-data) thead th:not(:first-child) { display: none; }
.installers td[data-size] { text-align: right; grid-row: 1; grid-column: 2; }
.installers td[data-file], .installers td[data-sha] { grid-column: 1 / -1; min-width: 0; }
.installers td[data-file] a { font-family: var(--font-mono); font-size: 0.875rem; word-break: break-all; }

.sha {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sha code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  color: var(--muted);
}
.copy {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: 500 0.8125rem var(--font-ui);
  cursor: pointer;
}
.copy:hover { border-color: var(--border-strong); }
.copy .i { width: 15px; height: 15px; }
.copy[data-copied] { color: var(--accent); border-color: var(--accent); }

.installers-note, .verify { margin-top: 16px; font-size: 0.9375rem; color: var(--muted); }
.verify code { font-size: 0.8125rem; }

/* ---------- Footer ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 96px;
  padding: 28px var(--pad) 40px;
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
  color: var(--muted);
}
.foot-brand { display: inline-flex; align-items: center; gap: 10px; }
.foot-brand img { border-radius: 5px; }
.foot ul { display: flex; flex-wrap: wrap; gap: 8px 24px; list-style: none; padding: 0; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }

/* ---------- Wide screens: the gutter of times, the pinned window ---------- */

@media (min-width: 640px) {
  h1 { font-size: 3.5rem; }
  .step-hero { --t-lh: 55px; }
  .step h2 { font-size: 2rem; }
  .step { --t-lh: 36px; }
  .local h2 { font-size: 3rem; }
  .local { --t-lh: 49px; }
  :root { --pad: 32px; }
  .installers thead { display: table-header-group; }
  .installers tr { display: table-row; padding: 0; }
  .installers th, .installers td { padding: 14px 16px 14px 0; vertical-align: middle; }
  .installers thead th {
    padding-top: 0; padding-bottom: 10px;
    text-align: left;
    font: 600 0.75rem var(--font-mono);
    letter-spacing: 0.04em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
  }
  .installers tbody tr:first-child { border-top: 0; }
  .installers td[data-size] { text-align: left; white-space: nowrap; }
  .installers td[data-file] a { word-break: normal; white-space: nowrap; }
  .installers th[scope='row'] span { white-space: nowrap; }
  .installers td[data-sha] { width: 40%; max-width: 0; }
}

@media (min-width: 1080px) {
  :root {
    --gutter: 112px;
    --pad: 40px;
    --header-h: 72px;
    --copy-pad: clamp(32px, 3.4vw, 52px);
  }

  .home {
    background:
      linear-gradient(to right,
        var(--surface-2) 0 var(--gutter),
        var(--border) var(--gutter) calc(var(--gutter) + 1px),
        var(--bg) calc(var(--gutter) + 1px)) fixed;
  }

  .home .top { padding: 0 var(--pad) 0 0; }
  .home .brand { width: var(--gutter); justify-content: center; flex-direction: column; gap: 4px; font-size: 0.9375rem; }
  .top-nav a[href='#night'] { display: inline-block; }

  .night {
    display: grid;
    grid-template-columns: var(--gutter) minmax(0, 30rem) minmax(0, 1fr);
    align-items: start;
  }

  .night > section:nth-of-type(1) { grid-row: 1; }
  .night > section:nth-of-type(2) { grid-row: 2; }
  .night > section:nth-of-type(3) { grid-row: 3; }
  .night > section:nth-of-type(4) { grid-row: 4; }
  .night > section:nth-of-type(5) { grid-row: 5; }
  .night > section:nth-of-type(6) { grid-row: 6; }
  .night > section:nth-of-type(7) { grid-row: 7; }
  .night > section:nth-of-type(8) { grid-row: 8; }

  .step, .local {
    grid-column: 1 / 3;
    display: grid;
    grid-template-columns: subgrid;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .step { min-height: 92svh; }
  .step-hero { min-height: calc(100svh - var(--header-h) - 132px); }

  .t {
    position: relative;
    left: auto; top: auto; width: auto;
    line-height: 1.4;
    grid-column: 1;
    margin: 0;
    padding: 40px 30px 0 0;
    text-align: right;
    font-size: 0.875rem;
  }
  .t time::before { left: auto; right: -36px; top: 4px; }
  .step, .local { margin-left: 0; }

  .step-copy { grid-column: 2; padding: 32px 24px 64px var(--copy-pad); }
  .step-hero .t { padding-top: clamp(56px, 10svh, 104px); }
  .step-hero .step-copy { padding-top: calc(clamp(56px, 10svh, 104px) - 8px); padding-bottom: 40px; }

  .num {
    right: auto;
    left: calc(var(--copy-pad) - 0.07em);
    top: -10px;
    font-size: clamp(11rem, 15vw, 15rem);
  }
  .step-hero .num { top: calc(clamp(56px, 10svh, 104px) - 70px); font-size: clamp(15rem, 21vw, 19rem); }

  h1 { font-size: clamp(3.5rem, 4.7vw, 4.5rem); }
  .step h2 { font-size: clamp(1.75rem, 2.3vw, 2.25rem); }

  /* Steps after the first: shots live in the pinned window. The figures stay, visually hidden,
     so screen readers still reach each step's alt text and caption (main.js never loads them here). */
  .step-shot {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .stage {
    container-type: inline-size;
    margin: 0;
    border: 0;
    grid-column: 3;
    grid-row: 1 / 7;
    align-self: stretch;
    padding: calc(clamp(56px, 10svh, 104px) + 64px) 28px 0 8px;
  }
  /* The pinned stage (Serif and status line above, the window, loupes inside it) always fits the
     viewport: the window is as wide as the column allows and no taller than the viewport minus
     the 100px above it and 20px margins, then centred vertically. */
  .win-wrap {
    --win-w: min(calc(100cqw - 36px), calc((100svh - 172px) * 1.6));
    position: sticky;
    width: var(--win-w);
    margin: 0 auto 30svh;
    top: max(104px, calc((100svh - var(--win-w) * 0.625 - 132px) / 2 + 100px));
  }
  .layer:not([data-layer='drop']) { display: block; }
  .win-status {
    display: flex;
    position: absolute;
    left: 2px; bottom: calc(100% + 10px);
    margin: 0;
    max-width: calc(100% - 150px);
    transition: opacity 0.3s var(--ease-out);
  }
  .win-wrap[data-state='drop'] .win-status { opacity: 0; }

  /* A 1:1 loupe of the ringed region, so the error, the diff and the suggestion read at
     their real size. The crops are 2x captures shown at half their pixels. */
  .loupes { display: block; }
  .loupe {
    position: absolute;
    z-index: 5;
    overflow: hidden;
    border: 2px solid #2563eb;
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow-window);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.4s var(--ease-out), transform 0.5s var(--ease-out), visibility 0s linear 0.5s;
  }
  .loupe img { display: block; width: 100%; height: auto; }
  /* Loupes sit inside the window, clear of the ring they magnify. */
  [data-loupe='errors'] { width: min(400px, 62%); right: 12px; top: calc(32px + var(--win-w) * 0.075); }
  [data-loupe='writing'] { width: min(530px, 72%); right: 12px; bottom: 12px; }
  [data-loupe='ai'] { width: min(380px, 48%, calc((var(--win-w) * 0.625 - 40px) * 1.29)); right: 12px; bottom: 12px; }
  .win-wrap[data-state='errors'] [data-loupe='errors'],
  .win-wrap[data-state='ai'] [data-loupe='ai'],
  .win-wrap[data-state='writing'] [data-loupe='writing'] {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0.35s, 0.35s, 0s;
  }
  .serif { width: 120px; top: -100px; }

  .local { grid-column: 1 / -1; }
  .local .t { padding-top: 176px; top: auto; }
  .local-copy {
    grid-column: 2 / 4;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 0 72px;
    padding: 160px var(--pad) 0 var(--copy-pad);
  }
  .local-copy h2 { grid-column: 1 / -1; font-size: clamp(3.25rem, 5vw, 4.75rem); max-width: 17ch; margin-bottom: 28px; }
  .local-side { margin: 0; align-self: start; padding-top: 0; border-top: 0; padding-left: 24px; border-left: 1px solid var(--border); }

  .download {
    grid-column: 2 / 4;
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr);
    gap: 56px;
    margin: 120px var(--pad) 0 var(--copy-pad);
    padding-top: 48px;
  }
  .installers-wrap { margin-top: 6px; }

  .foot { margin-left: var(--gutter); padding-left: var(--copy-pad); padding-right: var(--pad); }
}

@media (min-width: 1440px) {
  :root { --gutter: 132px; }
  .night { grid-template-columns: var(--gutter) minmax(0, 31rem) minmax(0, 1fr); }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  .layer { filter: none; transform: none; }
}

/* ---------- Notices page ---------- */

.doc {
  max-width: 50rem;
  margin: 0 auto;
  padding: 24px var(--pad) 80px;
}
.doc h1 { font-size: clamp(2rem, 6vw, 2.75rem); margin: 24px 0 20px; }
.doc h2 { font-size: 1.5rem; margin: 40px 0 12px; letter-spacing: -0.015em; }
.doc p, .doc li { color: var(--text); }
.doc p + p, .doc ul { margin-top: 12px; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 0.9375rem; }
.doc th, .doc td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc th { font-weight: 650; }
.doc a { word-break: break-word; }
.doc-back { display: inline-block; margin-top: 8px; }
