/*
 * The public pages. System fonts only, and nothing fetched from anyone else:
 * src/deploy/thePublicSiteFetchesNothingFromElsewhere.test.ts holds that.
 *
 * One accent colour. The scales below are the only sizes the pages use, so a
 * new section composes from them rather than inventing a twelfth grey.
 */
:root {
  /* colour */
  --bg: #ffffff; --bg-alt: #f4f6f9; --fg: #0f1b2d; --muted: #46536a; --line: #dbe1e9;
  --accent: #1d4ed8; --accent-strong: #1e3a8a; --accent-fg: #ffffff; --accent-soft: #eaf0fe;
  --card: #ffffff; --alert: #b45309; --grid: rgba(29, 78, 216, 0.06);
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.06), 0 8px 24px rgba(15, 27, 45, 0.08);
  --shot-shadow: 0 2px 6px rgba(15, 27, 45, 0.10), 0 24px 48px -12px rgba(15, 27, 45, 0.30);

  /* type: 14 · 16 · 18 · 20 · 24 · 32 · 40 */
  --t-sm: 0.875rem; --t-base: 1rem; --t-md: 1.125rem; --t-lg: 1.25rem;
  --t-xl: 1.5rem; --t-2xl: 2rem; --t-3xl: clamp(1.9rem, 1.2rem + 2.6vw, 2.5rem);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* space: 4 · 8 · 12 · 16 · 24 · 32 · 48 · 64 · 96 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --s7: 48px; --s8: 64px; --s9: 96px;

  /* containers */
  --w-text: 46rem; --w-page: 72rem; --gutter: 16px;
  --radius: 8px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --bg-alt: #111a2b; --fg: #e6ebf2; --muted: #a6b1c4; --line: #26334b;
    --accent: #8fb4ff; --accent-strong: #c3d5ff; --accent-fg: #0b1220; --accent-soft: #16233d;
    --card: #0f1828; --alert: #fbbf24; --grid: rgba(143, 180, 255, 0.07);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shot-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 24px 48px -12px rgba(0, 0, 0, 0.7);
  }
}

/* ── base ──────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: var(--t-base)/1.6 var(--font);
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px;
}
code { font: 0.95em var(--mono); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: var(--t-3xl); margin: 0 0 var(--s4); }
h2 { font-size: var(--t-xl); margin: var(--s7) 0 var(--s3); }
h3 { font-size: var(--t-md); margin: var(--s5) 0 var(--s2); }
p, ul, ol { margin: 0 0 var(--s4); }
.lead { font-size: var(--t-md); color: var(--muted); max-width: var(--w-text); }
.small { font-size: var(--t-sm); }

.wrap { max-width: calc(var(--w-text) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-wide { max-width: calc(var(--w-page) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--s4); top: var(--s2); background: var(--bg); padding: var(--s1) var(--s2); z-index: 10; }

/* ── buttons ───────────────────────────────────────────────────────────── */
.button, button {
  display: inline-block; padding: 10px 18px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg) !important;
  font: 600 var(--t-base)/1.3 var(--font); text-decoration: none; cursor: pointer;
}
.button:hover, button:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button.secondary { background: transparent; color: var(--accent) !important; }
.button.secondary:hover { background: var(--accent-soft); }
.button.small { padding: 6px 12px; font-size: var(--t-sm); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin: var(--s5) 0 0; }

/* ── header ────────────────────────────────────────────────────────────── */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.header-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5);
  padding-top: var(--s3); padding-bottom: var(--s3);
}
.brand { display: inline-flex; align-items: center; color: var(--fg); text-decoration: none; }
.brand svg { display: block; height: 28px; width: auto; }
.header-row nav { flex: 1 1 auto; min-width: 0; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: var(--s1) var(--s5); }
.nav a { color: var(--fg); text-decoration: none; font-size: 0.95rem; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; }
.header-actions { display: flex; align-items: center; gap: var(--s4); margin-left: auto; }
.header-actions a:not(.button) { color: var(--fg); text-decoration: none; font-size: 0.95rem; }
.header-actions a:not(.button):hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 860px) {
  /* The links scroll inside a row of their own rather than wrap into three;
     Sign in and Request access stay beside the name. */
  .header-row nav { order: 3; flex-basis: 100%; overflow-x: auto; padding: var(--s1) 0; }
  .nav { gap: var(--s4); }
}

/* ── footer ────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line); background: var(--bg-alt); color: var(--muted);
  font-size: 0.95rem; padding: var(--s7) 0 var(--s6);
}
.footer-grid { display: grid; gap: var(--s5); grid-template-columns: 2fr repeat(3, 1fr); }
.footer-grid h2 { font-size: var(--t-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg); margin: 0 0 var(--s2); }
.footer-grid .brand svg { height: 24px; margin-bottom: var(--s3); }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin: 0 0 var(--s1); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.footer-base { border-top: 1px solid var(--line); margin-top: var(--s6); padding-top: var(--s4); }
.footer-base p { margin: 0 0 var(--s2); }
.footer-base .small { font-size: var(--t-sm); }
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}

/* ── an ordinary page ──────────────────────────────────────────────────── */
main { display: block; }
.page { padding-top: var(--s7); padding-bottom: var(--s8); }
.steps { padding-left: 1.25rem; }
.steps h2 { font-size: var(--t-md); margin-top: var(--s5); }

/* ── bands on the wider pages ──────────────────────────────────────────── */
.band { padding: var(--s8) 0; }
.band.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band + .band:not(.alt) { padding-top: 0; }
.band h2 { margin-top: 0; }
.eyebrow { font-size: var(--t-sm); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--s2); }
.section-head { max-width: var(--w-text); margin-bottom: var(--s6); }
.section-head p { color: var(--muted); }

/* ── hero ──────────────────────────────────────────────────────────────── */
.hero {
  padding: var(--s8) 0;
  background-color: var(--bg-alt);
  /* a drawing-sheet grid, drawn here, fetched from nowhere */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero-grid { display: grid; gap: var(--s7); grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; }
.hero .lead { font-size: var(--t-lg); }
.hero .note { font-size: var(--t-sm); color: var(--muted); margin: var(--s4) 0 0; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; } }
.hero.slim { padding: var(--s7) 0; }
.hero.slim .lead { margin-bottom: 0; }

/* ── the codes strip ───────────────────────────────────────────────────── */
.codes { border-bottom: 1px solid var(--line); padding: var(--s5) 0; }
.codes-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s7); }
.codes-row > p { margin: 0; font-size: var(--t-sm); color: var(--muted); max-width: 14rem; }
.code-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s4) var(--s7); }
.code-list li { font-weight: 700; font-size: var(--t-md); line-height: 1.3; }
.code-list span { display: block; font-weight: 400; font-size: var(--t-sm); color: var(--muted); }

/* ── cards ─────────────────────────────────────────────────────────────── */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4);
         grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); }
.card h3 { margin: 0 0 var(--s2); font-size: var(--t-md); }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ── the calculation flow ──────────────────────────────────────────────── */
.flow-figure { margin: 0 0 var(--s6); }
.flow-figure img { width: 100%; }
.flow-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s5);
              grid-template-columns: repeat(4, minmax(0, 1fr)); counter-reset: step; }
.flow-steps li { counter-increment: step; }
.flow-steps h3 { margin: 0 0 var(--s1); font-size: var(--t-base); }
.flow-steps h3::before { content: counter(step) ". "; color: var(--accent); }
.flow-steps p { margin: 0; color: var(--muted); font-size: 0.95rem; }
@media (max-width: 860px) { .flow-steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .flow-steps { grid-template-columns: 1fr; } }

/* ── text beside a picture ─────────────────────────────────────────────── */
.split { display: grid; gap: var(--s7); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.split + .split { margin-top: var(--s8); }
.split.wide-pic { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
@media (max-width: 860px) { .split, .split.wide-pic { grid-template-columns: 1fr; gap: var(--s5); } }

/* ── figures ───────────────────────────────────────────────────────────── */
figure { margin: 0; }
figcaption { font-size: var(--t-sm); color: var(--muted); margin-top: var(--s3); }
.drawing { background: #ffffff; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); }
.drawing img { width: 100%; }
.drawings { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); margin: var(--s4) 0; }
.shot-flat { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.shot-flat img { width: 100%; }

/*
 * A screenshot in perspective. Presentation only: the image inside is the
 * capture as it was taken, never cropped or retouched, and it links to its
 * flat full-size version. The angles stay small so the text in it reads.
 *
 * The transform lives only inside the min-width query, so below 700 px it does
 * not exist and the picture is flat and full width; a test parses this file to
 * hold that. Nothing moves, so there is nothing for reduced motion to stop.
 */
.tilt { display: block; border-radius: var(--radius); }
.tilt img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shot-shadow); }
@media (min-width: 700.02px) {
  .tilt { perspective: 1800px; }
  .tilt img { transform: rotateY(-12deg) rotateX(4deg); }
  .tilt.mirror img { transform: rotateY(12deg) rotateX(4deg); }
}

/* ── three columns of cards ───────────────────────────────────────────── */
.three-col { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.three-col .card h2 { font-size: var(--t-lg); margin: 0 0 var(--s3); }
.three-col .card ul { padding-left: 1.1rem; color: var(--muted); }
.three-col .card p { margin-bottom: 0; }
.cards li.card { color: var(--fg); }
.after-cards { margin-top: var(--s5); color: var(--muted); max-width: var(--w-text); }
.band h3 { margin-top: var(--s6); }

/* ── status ────────────────────────────────────────────────────────────── */
.status-box { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--card);
              border-radius: var(--radius); padding: var(--s5) var(--s5) var(--s2); }
.status-box h2 { margin-top: 0; font-size: var(--t-lg); }
.two-col { display: grid; gap: var(--s6); grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* ── forms ─────────────────────────────────────────────────────────────── */
label { display: block; font-weight: 600; }
.hint { font-weight: 400; color: var(--muted); }
input, textarea {
  width: 100%; padding: 10px; font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--muted); border-radius: 6px;
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { border-left: 4px solid var(--alert); padding-left: var(--s3); }
