/* Landing page styles. Colour, spacing, type, radius and control sizes come from Primer Primitives
   tokens (assets/primer-tokens.css); components follow Primer patterns (Box, Button, Flash, Label,
   FormControl, SegmentedControl). One accent of our own (teal), defined for both colour schemes. */

@layer base, layout, components;

/* Headings: Source Sans 3 (SIL OFL), the face our PDFs are set in; self-hosted latin subset. Body: system stack. */
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-display: swap; src: url("assets/fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 700; font-display: swap; src: url("assets/fonts/source-sans-3-latin-700-normal.woff2") format("woff2"); }

@layer base {
  :root {
    color-scheme: light dark;
    /* Primer's system stack without Mona Sans (founder rule: no GitHub brand fonts). */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    --font-display: "Source Sans 3", var(--font-sans);
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --accent-fg: light-dark(#0a6560, #4cc2b8);
    --accent-bg: light-dark(#0a6560, #17716b);
    --accent-bg-hover: light-dark(#08524e, #1b7f78);
    --accent-on: #ffffff;
    --accent-muted: light-dark(#e3f2f0, #10302d);
    --container: 1012px;
    --gutter: var(--base-size-16);
    --h2-size: calc(var(--text-title-size-medium) * 1.5);
    /* Reduction pass (founder 27.10.2026): body 18 px, nothing a visitor reads below 15 px. */
    --text-min: 0.9375rem;
  }

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

  html { scroll-padding-top: var(--base-size-80); -webkit-text-size-adjust: 100%; }
  @media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

  body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: calc(var(--text-body-size-large) * 1.125); /* 18 px */
    line-height: 1.6;
    color: var(--fgColor-default);
    background: var(--bgColor-default);
  }

  h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; font-weight: var(--base-text-weight-semibold); margin: 0; text-wrap: balance; }
  p { margin: 0; text-wrap: pretty; }
  a { color: var(--accent-fg); text-underline-offset: 0.18em; }
  a:hover { text-decoration-thickness: 2px; }
  code { font-family: var(--font-mono); font-size: 0.875em; padding: 0.1em 0.35em; border-radius: var(--borderRadius-medium); background: var(--bgColor-neutral-muted); }
  img { max-width: 100%; height: auto; display: block; }

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

  /* <details>: smooth open/close where the browser supports animating to auto sizes (::details-content,
     interpolate-size); elsewhere, and with reduced motion, it simply toggles. The marker is our own chevron. */
  :root { interpolate-size: allow-keywords; }
  details::details-content {
    block-size: 0; overflow: clip;
    transition: block-size 220ms ease-out, content-visibility 220ms ease-out allow-discrete;
  }
  details[open]::details-content { block-size: auto; }
  summary { display: flex; align-items: center; gap: var(--base-size-12); cursor: pointer; list-style: none; }
  summary::-webkit-details-marker { display: none; }
  summary::after {
    content: ""; flex: none; inline-size: 0.5em; block-size: 0.5em; margin-inline-start: auto;
    border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor;
    rotate: 45deg; translate: 0 -0.15em; transition: rotate 220ms ease-out, translate 220ms ease-out; opacity: 0.7;
  }
  details[open] > summary::after { rotate: 225deg; translate: 0 0.15em; }
  summary:focus-visible { outline-offset: -2px; border-radius: var(--borderRadius-medium); }
  @media (prefers-reduced-motion: reduce) { details::details-content, summary::after { transition: none; } }

  .muted { color: var(--fgColor-muted); font-weight: normal; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  /* Text the founder must fill before publishing. */
  .placeholder { background: var(--bgColor-attention-muted); color: var(--fgColor-default); outline: 1px dashed var(--borderColor-attention-emphasis); padding: 0 var(--base-size-4); border-radius: var(--borderRadius-small); }
}

@layer layout {
  .container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
  @media (min-width: 768px) { :root { --gutter: var(--base-size-24); } }
  /* Narrow sections (founder decision 27.10.2026): a section whose content is narrower than the container is one
     centred column: heading, lede and the block (cards, form, FAQ) centred together. Wide sections stay left-aligned. */
  .narrow > * { max-width: 640px; }
  .col-center > * { margin-inline: auto; }
  .col-center > h1, .col-center > h2, .col-center > .section-intro { text-align: center; }
  .prose.col-center > h1 { text-align: start; }

  .skip-link { position: absolute; inset-inline-start: var(--base-size-8); top: calc(-1 * var(--base-size-48)); z-index: 10; padding: var(--base-size-8) var(--base-size-12); background: var(--bgColor-default); border: var(--borderWidth-thin) solid var(--borderColor-default); border-radius: var(--borderRadius-medium); }
  .skip-link:focus { top: var(--base-size-8); }

  .site-header {
    position: sticky; top: 0; z-index: 5;
    background: var(--bgColor-default);
    border-block-end: var(--borderWidth-thin) solid var(--borderColor-default);
  }
  .header-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--base-size-12); }
  @media (min-width: 560px) { .header-row { column-gap: var(--base-size-16); } }
  .wordmark { font-family: var(--font-display); font-size: var(--text-subtitle-size); color: var(--fgColor-default); font-weight: 700; text-decoration: none; white-space: nowrap; margin-inline-end: auto; padding-block: var(--base-size-16); }

  /* Section links: a second row under the header on narrow screens, inline from 900 px. */
  .section-nav { order: 3; flex-basis: 100%; border-block-start: var(--borderWidth-thin) solid var(--borderColor-muted); }
  .section-nav ul { display: flex; gap: var(--base-size-16); list-style: none; margin: 0; padding: var(--base-size-8) 0; font-size: var(--text-min); overflow-x: auto; }
  .section-nav a { color: var(--fgColor-default); text-decoration: none; white-space: nowrap; }
  .section-nav a:hover { color: var(--accent-fg); }
  @media (min-width: 900px) {
    .section-nav { order: 0; flex-basis: auto; border: 0; }
    .section-nav ul { gap: var(--base-size-20); padding: 0; }
  }

  .hero { padding-block: var(--base-size-48) var(--base-size-40); }
  @media (min-width: 768px) { .hero { padding-block: var(--base-size-64) var(--base-size-48); } }
  .eyebrow { color: var(--fgColor-muted); font-size: var(--text-min); margin-block-end: var(--base-size-8); }
  .hero h1 { font-size: clamp(2.25rem, 1.3rem + 3vw, 3.5rem); font-weight: 700; letter-spacing: -0.015em; max-width: 20ch; }
  .lede { font-size: var(--text-body-size-large); color: var(--fgColor-muted); max-width: 62ch; margin-block: var(--base-size-16) var(--base-size-24); }
  @media (min-width: 768px) { .lede { font-size: var(--text-subtitle-size); } }
  .hero-actions { display: flex; flex-wrap: wrap; gap: var(--base-size-12); margin-block: var(--base-size-24) var(--base-size-12); }
  /* Status under the main button: visible, calm, not a coloured box. */
  .status { display: flex; gap: var(--base-size-8); align-items: flex-start; max-width: 62ch; margin-block-start: var(--base-size-4); font-size: var(--text-min); color: var(--fgColor-muted); }
  .status .icon { flex: none; margin-block-start: 0.2em; fill: currentColor; }
  .icon { fill: currentColor; }

  /* Demo video: its own block right after the headline block, as wide as the page allows (up to 1200 px). */
  .hero.hero { padding-block-end: var(--base-size-24); }
  .hero-video { max-width: 1200px; margin: var(--base-size-8) auto var(--base-size-40); }

  .section { padding-block: var(--base-size-40); border-block-start: var(--borderWidth-thin) solid var(--borderColor-muted); }
  .section h2 { font-size: var(--h2-size); margin-block-end: var(--base-size-12); }
  .section-intro { color: var(--fgColor-muted); max-width: 68ch; margin-block-end: var(--base-size-24); }
  /* Input -> output: the web page and the PDF page side by side. */
  .pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--base-size-16); align-items: center; }
  @media (min-width: 768px) { .pair { grid-template-columns: minmax(0, 1.6fr) auto minmax(0, 0.6fr); gap: var(--base-size-24); } }
  .pair figure { margin: 0; min-width: 0; }
  .pair-arrow { justify-self: center; fill: var(--fgColor-muted); }
  @media (max-width: 767px) { .pair-arrow { rotate: 90deg; } }
  .browser { border: var(--borderWidth-thin) solid var(--borderColor-default); border-radius: var(--borderRadius-medium); overflow: hidden; background: #fff; }
  .browser-bar { display: block; padding: var(--base-size-6) var(--base-size-12); background: var(--bgColor-muted); border-block-end: var(--borderWidth-thin) solid var(--borderColor-default); font-size: var(--text-min); color: var(--fgColor-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .browser img, .pair-pdf img { display: block; width: 100%; height: auto; }
  .browser img { aspect-ratio: 720 / 400; object-fit: cover; object-position: top; }
  .pair-pdf a { display: block; max-width: 260px; margin-inline: auto; border: var(--borderWidth-thin) solid var(--borderColor-default); border-radius: var(--borderRadius-small); overflow: hidden; background: #fff; box-shadow: var(--shadow-resting-medium, none); }

}

@layer layout {
  .site-footer { margin-block-start: var(--base-size-24); border-block-start: var(--borderWidth-thin) solid var(--borderColor-default); padding-block: var(--base-size-24) var(--base-size-32); }
  .site-footer .container > * { max-width: 640px; margin-inline: auto; }
  .site-footer p { margin: 0; text-align: center; font-size: var(--text-body-size-medium); line-height: 1.5; color: var(--fgColor-muted); }
  .site-footer p + p { margin-block-start: var(--base-size-4); }
}

@layer components {
  /* Button */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--base-size-6);
    min-height: var(--control-large-size); padding: 0 var(--base-size-16);
    font: inherit; font-size: var(--text-min); font-weight: var(--base-text-weight-medium); line-height: 1.25;
    color: var(--button-default-fgColor-rest, var(--fgColor-default));
    background: var(--button-default-bgColor-rest, var(--bgColor-muted));
    border: var(--borderWidth-thin) solid var(--button-default-borderColor-rest, var(--borderColor-default));
    border-radius: var(--borderRadius-medium);
    box-shadow: var(--shadow-resting-small, none);
    text-decoration: none; white-space: nowrap; cursor: pointer;
  }
  .btn:hover { background: var(--button-default-bgColor-hover, var(--bgColor-neutral-muted)); text-decoration: none; }
  .btn-primary { color: var(--accent-on); background: var(--accent-bg); border-color: transparent; }
  .btn-primary:hover { background: var(--accent-bg-hover); }
  .btn-sm { min-height: var(--control-small-size); padding: 0 var(--base-size-12); font-size: var(--text-min); }
  .btn-block { width: 100%; }
  .btn .muted { color: inherit; opacity: 0.75; }
  /* The hero repeats this call to action, so the header copy gives way to the theme switch on narrow screens. */
  .header-cta { display: none; }
  @media (min-width: 560px) { .header-cta { display: inline-flex; } }

  /* Theme toggle: Primer IconButton pattern (invisible variant). 32 px on desktop, 44 px target on touch and narrow screens. */
  .theme-toggle {
    display: inline-grid; place-items: center; flex: none;
    width: var(--control-medium-size); height: var(--control-medium-size); padding: 0;
    color: var(--fgColor-muted); background: transparent;
    border: var(--borderWidth-thin) solid var(--borderColor-default); border-radius: var(--borderRadius-medium);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .theme-toggle:hover { color: var(--fgColor-default); background: var(--control-transparent-bgColor-hover, var(--bgColor-neutral-muted)); }
  .theme-toggle:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
  .theme-toggle[hidden] { display: none; }
  .theme-toggle svg { fill: currentColor; }
  @media (max-width: 559px), (pointer: coarse) {
    .theme-toggle { width: var(--control-minTarget-coarse); height: var(--control-minTarget-coarse); }
  }
  /* Sun in dark mode (click for light), moon in light mode (click for dark). */
  .theme-toggle .icon-sun { display: none; }
  :root[data-theme-effective="dark"] .theme-toggle .icon-sun { display: block; }
  :root[data-theme-effective="dark"] .theme-toggle .icon-moon { display: none; }

  /* Box */
  .box {
    background: var(--bgColor-default);
    border: var(--borderWidth-thin) solid var(--borderColor-default);
    border-radius: var(--borderRadius-medium);
    padding: var(--base-size-20);
  }

  /* Demo video player: Primer IconButton pattern on a dark translucent bar; 44 px targets on touch screens. */
  .video-frame { position: relative; border: var(--borderWidth-thin) solid var(--borderColor-default); border-radius: var(--borderRadius-medium); overflow: hidden; background: #fff; box-shadow: var(--shadow-resting-medium, none); }
  .video-frame video { display: block; width: 100%; height: auto; cursor: pointer; }
  .video-big-play { position: absolute; inset: 0; margin: auto; width: 72px; height: 72px; fill: #fff; background: rgba(31, 35, 40, .72); border-radius: 50%; padding: var(--base-size-12); pointer-events: none; opacity: 0; transition: opacity .2s; }
  .video-frame[data-state="paused"] .video-big-play { opacity: 1; }
  .video-controls { position: absolute; inset-inline-end: var(--base-size-8); inset-block-end: var(--base-size-8); display: flex; gap: var(--base-size-6); }
  .video-controls[hidden] { display: none; }
  .video-btn {
    display: inline-grid; place-items: center; width: var(--control-medium-size); height: var(--control-medium-size); padding: 0;
    color: #fff; background: rgba(31, 35, 40, .72); border: 0; border-radius: var(--borderRadius-medium); cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .video-btn:hover { background: rgba(31, 35, 40, .9); }
  .video-btn:focus-visible { outline: 2px solid #fff; outline-offset: 0; box-shadow: 0 0 0 4px var(--accent-fg); }
  .video-btn svg { fill: currentColor; }
  @media (max-width: 559px), (pointer: coarse) { .video-btn { width: var(--control-minTarget-coarse); height: var(--control-minTarget-coarse); } }
  .video-frame[data-state="playing"] .icon-play, .video-frame[data-state="paused"] .icon-pause,
  .video-frame:not([data-state]) .icon-pause,
  .video-frame[data-sound="on"] .icon-muted, .video-frame[data-sound="off"] .icon-sound, .video-frame:not([data-sound]) .icon-sound { display: none; }
  .demo-text { margin-block-start: var(--base-size-4); }
  .demo-text summary { display: inline-flex; color: var(--accent-fg); padding-block: var(--base-size-4); }
  .demo-text summary::after { margin-inline-start: var(--base-size-4); }
  .demo-text ol { margin: var(--base-size-8) 0 0; padding-inline-start: var(--base-size-20); display: grid; gap: var(--base-size-4); }

  /* Lists */
  .checklist { margin: 0; padding: 0; list-style: none; display: grid; }
  .checklist li { position: relative; padding-inline-start: var(--base-size-24); }
  .checklist li::before {
    content: ""; position: absolute; inset-inline-start: var(--base-size-2); top: 0.45em; width: var(--base-size-12); height: 7px;
    border-inline-start: 2px solid var(--fgColor-muted); border-block-end: 2px solid var(--fgColor-muted); transform: rotate(-45deg);
  }
  .checklist { gap: var(--base-size-12); text-align: start; font-size: var(--text-subtitle-size); }
  .checklist li::before { top: 0.5em; }
  .not-yet { margin-block-start: var(--base-size-24); color: var(--fgColor-muted); text-align: center; }

  /* Four labels under the web -> PDF pair. */
  .labels { list-style: none; margin: var(--base-size-24) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--base-size-8) var(--base-size-12); justify-content: center; }
  .labels li { padding: var(--base-size-4) var(--base-size-12); border: var(--borderWidth-thin) solid var(--borderColor-default); border-radius: var(--borderRadius-full); background: var(--bgColor-muted); font-size: var(--text-min); }

  /* Form */
  .form { display: grid; gap: var(--base-size-20); padding: var(--base-size-24); }
  .form-group { display: grid; gap: var(--base-size-6); margin: 0; padding: 0; border: 0; min-width: 0; }
  .form-group > label:not(.radio), legend { font-weight: var(--base-text-weight-semibold); font-size: var(--text-min); padding: 0; }
  legend { margin-block-end: var(--base-size-6); }
  .optional { font-weight: normal; color: var(--fgColor-muted); }
  .form-control {
    width: 100%; min-height: var(--control-large-size); padding: var(--base-size-8) var(--base-size-12);
    font: inherit; font-size: var(--text-body-size-large); color: var(--control-fgColor-rest, var(--fgColor-default));
    background: var(--control-bgColor-rest, var(--bgColor-default));
    border: var(--borderWidth-thin) solid var(--control-borderColor-rest, var(--borderColor-default));
    border-radius: var(--borderRadius-medium);
  }
  .form-control::placeholder { color: var(--control-fgColor-placeholder, var(--fgColor-muted)); }
  .form-control:focus-visible { outline-offset: -1px; border-color: var(--accent-fg); }
  .hint { font-size: var(--text-min); color: var(--fgColor-muted); }
  .radio { display: flex; align-items: center; gap: var(--base-size-8); min-height: var(--control-small-size); font-size: var(--text-min); cursor: pointer; }
  .radio input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-bg); }

  /* FAQ */
  .faq { border: var(--borderWidth-thin) solid var(--borderColor-default); border-radius: var(--borderRadius-medium); }
  .faq details + details { border-block-start: var(--borderWidth-thin) solid var(--borderColor-default); }
  .faq summary { padding: var(--base-size-16); font-weight: var(--base-text-weight-semibold); }
  .faq summary:hover { background: var(--bgColor-muted); }
  .faq details:first-child summary { border-start-start-radius: var(--borderRadius-medium); border-start-end-radius: var(--borderRadius-medium); }
  .faq p { padding: 0 var(--base-size-16) var(--base-size-16); color: var(--fgColor-muted); }
}

/* Secondary pages (privacy, thanks) */
@layer layout {
  .page h1 { font-size: var(--h2-size); margin-block-end: var(--base-size-16); }
  .facts { margin: 0; display: grid; gap: var(--base-size-4) 0; }
  .facts dt { font-weight: var(--base-text-weight-semibold); margin-block-start: var(--base-size-12); }
  .facts dd { margin: 0; color: var(--fgColor-muted); }
  .prose p + p { margin-block-start: var(--base-size-12); }
}
