:root{color-scheme:dark light;--cw-font-ui:'SF Pro Text', system-ui, -apple-system, sans-serif;--cw-font-mono:Menlo, Monaco, 'Courier New', monospace;--cw-hairline:1px;--cw-radius-sm:3px;--cw-radius:5px;--cw-radius-lg:7px;--cw-accent:#61afef;--cw-accent-hover:#7dbdf3;--cw-agent-aider:#7ee2a8;--cw-agent-amp:#ffb86b;--cw-agent-antigravity:#7aa2ff;--cw-agent-claude:#d97757;--cw-agent-codex:#d7dae0;--cw-agent-copilot:#c49bff;--cw-agent-cursor:#abb2bf;--cw-agent-gemini:#8ab4f8;--cw-agent-opencode:#c3c8d0;--cw-agent-qwen:#7c8cff;--cw-blocked:#ff7580;--cw-border:#37393d;--cw-border-hover:#4e5666;--cw-border-strong:#3e4452;--cw-conflict:#de73ff;--cw-cursor:#528bff;--cw-danger-hover:#ff7a85;--cw-needs-you:#f0a45d;--cw-ready:#a5e075;--cw-scrim:#0000004d;--cw-scrollbar:#4e5666;--cw-scrollbar-hover:#5a6375;--cw-selection:#67769660;--cw-shadow:#00000080;--cw-surface:#16191d;--cw-surface-active:#323842;--cw-surface-badge:#23272e;--cw-surface-control:#404754;--cw-surface-control-hover:#4b5363;--cw-surface-hover:#2c313a;--cw-surface-input:#1d1f23;--cw-surface-overlay:#21252b;--cw-surface-sidebar:#1e2126;--cw-text:#abb2bf;--cw-text-bright:#d7dae0;--cw-text-dim:#9da5b4;--cw-working:#4dc4ff}
@media (prefers-color-scheme: light){:root{--cw-accent:#0b5fc4;--cw-accent-hover:#0a53ac;--cw-agent-aider:#1d7f50;--cw-agent-amp:#a85a08;--cw-agent-antigravity:#3a5bd0;--cw-agent-claude:#c15f3c;--cw-agent-codex:#383a42;--cw-agent-copilot:#7447c9;--cw-agent-cursor:#383a42;--cw-agent-gemini:#2f63cf;--cw-agent-opencode:#5b5e68;--cw-agent-qwen:#4450cc;--cw-blocked:#bd2336;--cw-border:#d6d6d9;--cw-border-hover:#a0a1a7;--cw-border-strong:#c4c4c8;--cw-conflict:#8f25a8;--cw-cursor:#526fff;--cw-danger-hover:#a61c2d;--cw-needs-you:#8a4f00;--cw-ready:#28600f;--cw-scrim:#00000026;--cw-scrollbar:#c4c4c8;--cw-scrollbar-hover:#a0a1a7;--cw-selection:#bcd0f760;--cw-shadow:#00000033;--cw-surface:#fafafa;--cw-surface-active:#e0e0e2;--cw-surface-badge:#f0f0f1;--cw-surface-control:#e4e4e6;--cw-surface-control-hover:#d8d8db;--cw-surface-hover:#ececed;--cw-surface-input:#ffffff;--cw-surface-overlay:#ffffff;--cw-surface-sidebar:#f1f1f2;--cw-text:#383a42;--cw-text-bright:#1f2126;--cw-text-dim:#5b5e68;--cw-working:#055a8f}}
/* Colours, fonts and radii come from theme.ts (the cockpit's own tokens). Sizes are rem, so the page follows the reader's text size. */
:root {
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2.5rem;
  --s-7: 4rem;
  --measure: 72rem;
  --prose: 46rem;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--cw-surface);
  color: var(--cw-text);
  font: 1rem/1.6 var(--cw-font-ui);
}

h1, h2, h3 { color: var(--cw-text-bright); line-height: 1.2; margin: 0 0 var(--s-3); }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.125rem; }
p { margin: 0 0 var(--s-4); }
a { color: var(--cw-accent); text-underline-offset: 0.2em; }
a:hover { color: var(--cw-accent-hover); }
img { max-width: 100%; height: auto; display: block; }
code, pre, .cmd { font-family: var(--cw-font-mono); }
code { font-size: 0.9em; }

:focus-visible { outline: 0.125rem solid var(--cw-accent); outline-offset: 0.125rem; }

.skip {
  position: absolute;
  left: var(--s-3);
  top: -4rem;
  padding: var(--s-2) var(--s-3);
  background: var(--cw-surface-overlay);
  color: var(--cw-text-bright);
  border: var(--cw-hairline) solid var(--cw-border-strong);
  border-radius: var(--cw-radius);
  z-index: 30;
}
.skip:focus { top: var(--s-3); }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--s-4); }

/* ---- header and footer ---- */
/* The header stays with you as the page scrolls; the progress bar is its bottom edge. Opaque by default, and a frosted pane where the browser can blur what passes under it. */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--cw-surface); border-bottom: var(--cw-hairline) solid var(--cw-border); }
@supports (backdrop-filter: blur(1rem)) and (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: color-mix(in srgb, var(--cw-surface) 80%, transparent); backdrop-filter: saturate(1.4) blur(0.875rem); }
}
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); min-height: 4rem; }
.brand { display: flex; align-items: center; gap: var(--s-2); color: var(--cw-text-bright); font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
.brand img { width: 1.75rem; height: 1.75rem; }
.site-header .brand { margin-right: auto; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); }
.nav a, .lang { padding: var(--s-2) var(--s-3); border-radius: var(--cw-radius-lg); color: var(--cw-text); font-size: 0.95rem; font-weight: 500; text-decoration: none; }
.nav a:hover, .lang:hover { background: var(--cw-surface-control); color: var(--cw-text-bright); }
.nav a[aria-current="page"] { background: var(--cw-surface-overlay); color: var(--cw-text-bright); }
.header__actions { display: flex; align-items: center; gap: var(--s-2); }
.lang { border: var(--cw-hairline) solid var(--cw-border); color: var(--cw-text-dim); }

.site-footer { margin-top: var(--s-7); background: var(--cw-surface-sidebar); color: var(--cw-text-dim); border-top: var(--cw-hairline) solid var(--cw-border); }
.site-footer .wrap { display: grid; gap: var(--s-6); padding-top: var(--s-7); padding-bottom: var(--s-5); }
.footer__top { display: grid; gap: var(--s-6); }
.footer__brand { display: grid; gap: var(--s-3); align-content: start; max-width: 22rem; }
.footer__tagline { color: var(--cw-text-dim); text-wrap: balance; }
.footer__groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: var(--s-5) var(--s-6); }
.footer__group ul { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.footer__title { margin: 0 0 var(--s-3); color: var(--cw-text-bright); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.site-footer a { color: var(--cw-text-dim); text-decoration: none; }
.site-footer a:hover { color: var(--cw-text-bright); }
.site-footer .brand { color: var(--cw-text-bright); }
.site-footer p { margin: 0; }
.footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-5); padding-top: var(--s-4); border-top: var(--cw-hairline) solid var(--cw-border); font-size: 0.875rem; }

/* ---- buttons and the install line ---- */
.btn {
  display: inline-block;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--cw-radius-lg);
  border: var(--cw-hairline) solid var(--cw-border-strong);
  background: var(--cw-surface-control);
  color: var(--cw-text-bright);
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { background: var(--cw-surface-control-hover); color: var(--cw-text-bright); }
.btn--sm { padding: var(--s-2) var(--s-4); font-size: 0.95rem; }
.btn--primary { background: var(--cw-accent); border-color: var(--cw-accent); color: var(--cw-surface); }
.btn--primary:hover { background: var(--cw-accent-hover); border-color: var(--cw-accent-hover); color: var(--cw-surface); }

.cmd {
  display: block;
  margin: 0;
  padding: var(--s-3) var(--s-4);
  background: var(--cw-surface-input);
  color: var(--cw-text-bright);
  border: var(--cw-hairline) solid var(--cw-border);
  border-radius: var(--cw-radius-lg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ---- the home page ---- */
.hero { text-align: center; padding: var(--s-7) 0 var(--s-6); }
.hero__sub { max-width: 40rem; margin: 0 auto var(--s-5); color: var(--cw-text-dim); font-size: 1.125rem; }
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-3); margin-bottom: var(--s-5); }
.hero__install { max-width: 56rem; margin: 0 auto var(--s-3); text-align: left; }
.hero__meta { color: var(--cw-text-dim); font-size: 0.9rem; margin-bottom: var(--s-6); }
.hero__media { max-width: 100%; margin: 0 auto; overflow: hidden; border: var(--cw-hairline) solid var(--cw-border-strong); border-radius: var(--cw-radius-lg); box-shadow: 0 1.5rem 4rem var(--cw-shadow); }
.hero__media { position: relative; }
.hero__media video { display: block; width: 100%; height: auto; background: var(--cw-surface); }
.video__toggle { position: absolute; right: var(--s-3); bottom: var(--s-3); min-height: 2.75rem; padding: 0 var(--s-4); border: var(--cw-hairline) solid var(--cw-border-strong); border-radius: var(--cw-radius-lg); background: var(--cw-surface-control); color: var(--cw-text-bright); font: inherit; font-weight: 600; cursor: pointer; }
.video__toggle:hover { background: var(--cw-surface-control-hover); }
.video__toggle[hidden] { display: none; }
.hero__note { max-width: 44rem; margin: var(--s-3) auto 0; color: var(--cw-text-dim); font-size: 0.875rem; }
.transcript { max-width: 44rem; margin: var(--s-3) auto 0; text-align: left; color: var(--cw-text-dim); font-size: 0.9rem; }
.transcript summary { cursor: pointer; text-align: center; color: var(--cw-text); }
.transcript ol { margin: var(--s-3) 0 0; padding-left: 1.4rem; }

.section { padding: var(--s-6) 0; }
.section__title { text-align: center; margin-bottom: var(--s-3); }
.section__intro { max-width: 40rem; margin: 0 auto var(--s-6); text-align: center; color: var(--cw-text-dim); }

.grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-5);
  background: var(--cw-surface-overlay);
  border: var(--cw-hairline) solid var(--cw-border);
  border-radius: var(--cw-radius-lg);
  color: var(--cw-text);
}
.card h3, .card h4 { margin: 0; font-size: 1.1rem; }
.card p { margin: 0; font-size: 0.95rem; }
.card .card__q { color: var(--cw-text-dim); font-size: 0.875rem; }
.badge {
  padding: 0 var(--s-2);
  border: var(--cw-hairline) solid var(--cw-needs-you);
  border-radius: var(--cw-radius);
  color: var(--cw-needs-you);
  background: var(--cw-surface-overlay);
  font-size: 0.8rem;
  font-weight: 600;
}

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); padding: 0; margin: 0 0 var(--s-4); list-style: none; }
.chips li { padding: var(--s-1) var(--s-3); background: var(--cw-surface-overlay); border: var(--cw-hairline) solid var(--cw-border); border-radius: var(--cw-radius-lg); color: var(--cw-text-bright); }
.agents-note { max-width: 40rem; margin: 0 auto; text-align: center; color: var(--cw-text-dim); }


.table-wrap { overflow-x: auto; }
.compare { width: 100%; border-collapse: collapse; background: var(--cw-surface-overlay); border: var(--cw-hairline) solid var(--cw-border); }
.compare caption { text-align: left; color: var(--cw-text-dim); padding: 0 0 var(--s-2); caption-side: top; }
.compare th, .compare td { padding: var(--s-3) var(--s-4); text-align: left; vertical-align: top; border-top: var(--cw-hairline) solid var(--cw-border); color: var(--cw-text); }
.compare thead th { color: var(--cw-text-bright); border-top: 0; }
.compare tbody th { color: var(--cw-text-bright); font-weight: 600; }
.compare__foot { color: var(--cw-text-dim); font-size: 0.9rem; margin-top: var(--s-3); }


.faq { max-width: var(--prose); margin: 0 auto; }
.faq details { background: var(--cw-surface-overlay); border: var(--cw-hairline) solid var(--cw-border); border-radius: var(--cw-radius-lg); margin-bottom: var(--s-2); padding: 0 var(--s-4); }
.faq summary { cursor: pointer; padding: var(--s-3) 0; color: var(--cw-text-bright); font-weight: 600; }
.faq details[open] summary { border-bottom: var(--cw-hairline) solid var(--cw-border); margin-bottom: var(--s-3); }
.faq p { color: var(--cw-text); }

.cta { text-align: center; padding: var(--s-6) 0; }
.cta p { color: var(--cw-text-dim); }

/* ---- the announcement pill, the install line, the story ---- */
.sr-only { position: absolute; width: 0.0625rem; height: 0.0625rem; padding: 0; margin: -0.0625rem; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.hero__pill { margin: 0 0 var(--s-5); }
.pill { display: inline-block; padding: var(--s-1) var(--s-4); border: var(--cw-hairline) solid var(--cw-accent); border-radius: 62rem; background: var(--cw-surface-overlay); color: var(--cw-accent); font-size: 0.9rem; text-decoration: none; }
.pill:hover { border-color: var(--cw-accent-hover); color: var(--cw-accent-hover); }

.install__label { margin: 0 0 var(--s-1); color: var(--cw-text-dim); font-size: 0.85rem; }
.install { display: flex; gap: var(--s-2); align-items: stretch; }
.install .cmd { flex: 1; min-width: 0; }
.copy { flex: none; min-height: 2.75rem; padding: 0 var(--s-4); border: var(--cw-hairline) solid var(--cw-border-strong); border-radius: var(--cw-radius-lg); background: var(--cw-surface-control); color: var(--cw-text-bright); font: inherit; font-weight: 600; cursor: pointer; }
.copy:hover { background: var(--cw-surface-control-hover); }
.copy[hidden] { display: none; }
.hero__meta a { color: var(--cw-accent); }

.diagram-wrap { max-width: 46rem; margin: 0 auto var(--s-6); }
.diagram { display: block; width: 100%; height: auto; }
.diagram .dg-label { font-size: 0.8125rem; font-weight: 600; }
.diagram .dg-verdict { font-size: 1rem; font-weight: 700; }
.diagram path { fill: none; stroke-width: 2; stroke-linecap: round; }
.diagram path.dg-main { stroke: var(--cw-text-dim); }
.diagram path.dg-a { stroke: var(--cw-agent-claude); }
.diagram path.dg-b { stroke: var(--cw-agent-gemini); }
.diagram path.dg-c { stroke: var(--cw-agent-copilot); }
.diagram path.dg-try { stroke: var(--cw-text-dim); stroke-width: 1.5; stroke-dasharray: 4 4; }
.diagram path.dg-land { stroke: var(--cw-ready); stroke-width: 2.5; }
.diagram path.dg-diamond { fill: var(--cw-surface-overlay); stroke: var(--cw-text); }
.diagram circle { stroke: none; }
.diagram circle.dg-main { fill: var(--cw-text-dim); }
.diagram circle.dg-a { fill: var(--cw-agent-claude); }
.diagram circle.dg-b { fill: var(--cw-agent-gemini); }
.diagram circle.dg-c { fill: var(--cw-agent-copilot); }
.diagram text.dg-main { fill: var(--cw-text-dim); }
.diagram text.dg-a { fill: var(--cw-agent-claude); }
.diagram text.dg-b { fill: var(--cw-agent-gemini); }
.diagram text.dg-c { fill: var(--cw-agent-copilot); }
.diagram text.dg-ok { fill: var(--cw-ready); }
.diagram text.dg-conflict { fill: var(--cw-blocked); }

.steps { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); padding: 0; margin: 0; list-style: none; }
.step { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-5); background: var(--cw-surface-overlay); border: var(--cw-hairline) solid var(--cw-border); border-radius: var(--cw-radius-lg); }
.step h3 { margin: 0; }
.step p { margin: 0; font-size: 0.95rem; }
.step__n { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--cw-accent); color: var(--cw-surface); font-weight: 700; }
.step__cmd { display: block; padding: var(--s-2) var(--s-3); background: var(--cw-surface-input); color: var(--cw-text-bright); border: var(--cw-hairline) solid var(--cw-border); border-radius: var(--cw-radius); overflow-wrap: anywhere; }
.step img { margin-top: auto; border: var(--cw-hairline) solid var(--cw-border); border-radius: var(--cw-radius); }

.group { margin-bottom: var(--s-6); }
.group > h3 { margin: 0 0 var(--s-4); font-size: 1.25rem; }
.limits { margin-top: auto; padding-top: var(--s-2); }
.limits summary { width: fit-content; color: var(--cw-accent); font-size: 0.9rem; cursor: pointer; }
.limits[open] summary { margin-bottom: var(--s-2); }
.limits p { font-size: 0.9rem; }
.limits p + p { margin-top: var(--s-2); }

.fit { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.fit__col { padding: var(--s-5); background: var(--cw-surface-overlay); border: var(--cw-hairline) solid var(--cw-border); border-radius: var(--cw-radius-lg); }
.fit__col h3 { margin: 0 0 var(--s-3); }
.fit__col ul { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.fit__col li { position: relative; padding-left: 1.5rem; }
.fit__col li::before { position: absolute; left: 0; font-weight: 700; }
.fit__col--for li::before { content: "✓"; color: var(--cw-ready); }
.fit__col--not li::before { content: "✗"; color: var(--cw-blocked); }

.releases { display: grid; gap: var(--s-3); max-width: var(--prose); margin: 0 auto; padding: 0; list-style: none; }
.releases li { padding: var(--s-3) var(--s-4); background: var(--cw-surface-overlay); border: var(--cw-hairline) solid var(--cw-border); border-radius: var(--cw-radius-lg); }
.releases a { color: var(--cw-text-bright); text-decoration: none; }
.releases a:hover { text-decoration: underline; }
.releases time { margin-left: var(--s-2); color: var(--cw-text-dim); font-weight: 400; }
.releases p { margin: var(--s-1) 0 0; font-size: 0.95rem; }
.releases__dev { border-color: var(--cw-needs-you); }
.releases__all { margin: var(--s-4) 0 0; text-align: center; }

/* ---- download ---- */
.page { padding: var(--s-6) 0; }
.page > .wrap > h1 { text-align: left; }
.stack { display: grid; gap: var(--s-5); max-width: var(--prose); }
.stack h2 { margin-top: 0; }
.stack p { margin: 0 0 var(--s-3); }
.note { padding: var(--s-4) var(--s-5); background: var(--cw-surface-overlay); border: var(--cw-hairline) solid var(--cw-needs-you); border-radius: var(--cw-radius-lg); color: var(--cw-text); }
.note h2 { font-size: 1.25rem; color: var(--cw-text-bright); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* ---- docs and changelog ---- */
.docs { display: grid; gap: var(--s-5); }
.docs__nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
.docs__nav a { color: var(--cw-text); text-decoration: none; }
.docs__nav a[aria-current="page"] { color: var(--cw-text-bright); font-weight: 600; text-decoration: underline; }
.prose { max-width: var(--prose); min-width: 0; }
.prose h2 { margin-top: var(--s-6); }
.prose h3 { margin-top: var(--s-5); }
.prose pre { background: var(--cw-surface-input); color: var(--cw-text-bright); border: var(--cw-hairline) solid var(--cw-border); border-radius: var(--cw-radius-lg); padding: var(--s-3) var(--s-4); overflow-x: auto; }
.prose code { background: var(--cw-surface-input); color: var(--cw-text-bright); padding: 0 var(--s-1); border-radius: var(--cw-radius-sm); }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: var(--cw-hairline) solid var(--cw-border); padding: var(--s-2) var(--s-3); text-align: left; }
.prose th { color: var(--cw-text-bright); }
.prose .is-right { text-align: right; }
.prose .is-center { text-align: center; }
.prose blockquote { margin: 0 0 var(--s-4); padding-left: var(--s-4); border-left: 0.25rem solid var(--cw-border-strong); color: var(--cw-text-dim); }
.prose img { border: var(--cw-hairline) solid var(--cw-border); border-radius: var(--cw-radius-lg); margin: var(--s-4) 0; }
.release { border-top: var(--cw-hairline) solid var(--cw-border); padding-top: var(--s-5); margin-top: var(--s-6); }
.release h2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: 0; }
.release time { color: var(--cw-text-dim); font-size: 0.9rem; font-weight: 400; }

@media (max-width: 47.99rem) {
  html { scroll-padding-top: 7rem; }
  .nav a, .site-footer a { display: inline-flex; align-items: center; min-height: 2.75rem; }
  .nav__github { display: none; }
  .nav a.nav__github { display: none; }
  .footer__group ul { gap: 0; }
  .site-header .wrap { gap: 0 var(--s-3); padding-top: var(--s-2); padding-bottom: var(--s-1); min-height: 0; }
  .nav { order: 3; flex: 1 1 100%; gap: 0 var(--s-1); margin-left: calc(var(--s-3) * -1); }
  .header__actions a { display: inline-flex; align-items: center; min-height: 2.75rem; }
}

@media (min-width: 48rem) {
  .footer__top { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .docs { grid-template-columns: 12rem minmax(0, 1fr); }
  .docs__nav ul { flex-direction: column; }
}

.prose h1, .page > .wrap > h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.docs__notice { padding: var(--s-2) var(--s-3); background: var(--cw-surface-overlay); border: var(--cw-hairline) solid var(--cw-border-strong); border-radius: var(--cw-radius); color: var(--cw-text); font-size: 0.9rem; }

/* ---- Motion ----
 * After the portfolio's: one expo-out curve for everything, so the page moves as one piece. Everything that moves is opt-in via
 * `no-preference`. Content is visible by default; it is hidden only once reveal.js has armed itself (`html[data-reveal-ready]`), so a
 * script that fails, or is switched off, never leaves the page blank. Only opacity, translate, transform, filter and clip-path move. */

:root { --ease-out: cubic-bezier(0.16, 1, 0.3, 1); }

/* Headline words sit in a mask so they can slide up from below it; the padding keeps descenders and tall Vietnamese diacritics from being cut. */
.word-mask { display: inline-block; overflow: hidden; vertical-align: top; padding-block: 0.16em; margin-block: -0.16em; }
.word { display: inline-block; }

/* Hidden by default: it shows only where the browser can drive an animation from the scroll position and motion is welcome. */
.scroll-progress { display: none; }

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

  /* A page change cross-fades instead of blinking (same-origin navigation, where the browser supports it). */
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.35s; animation-timing-function: var(--ease-out); }

  @keyframes rise {
    from { opacity: 0; translate: 0 1.75rem; filter: blur(0.375rem); }
    to { opacity: 1; translate: 0 0; filter: blur(0); }
  }
  @keyframes word-up {
    from { translate: 0 110%; }
    to { translate: 0 0; }
  }
  @keyframes uncover {
    from { clip-path: inset(0 0 100% 0); }
    to { clip-path: inset(0 0 0 0); }
  }
  @keyframes settle {
    from { transform: scale(1.14); }
  }

  @keyframes header-in {
    from { translate: 0 -100%; opacity: 0; }
    to { translate: 0 0; opacity: 1; }
  }
  .site-header { animation: header-in 0.7s var(--ease-out) both; view-transition-name: site-header; }

  /* The hero plays once on load, with no script: the words, then the lines under them, then the picture. */
  .hero .word { animation: word-up 1.1s var(--ease-out) both; animation-delay: calc(0.1s + var(--w, 0) * 70ms); }
  .hero__pill, .hero__sub, .hero__actions, .hero__install, .hero__meta { animation: rise 1s var(--ease-out) both; }
  .hero__pill { animation-delay: 0.05s; }
  .hero__sub { animation-delay: 0.5s; }
  .hero__actions { animation-delay: 0.62s; }
  .hero__install { animation-delay: 0.74s; }
  .hero__meta { animation-delay: 0.84s; }
  .hero__media { animation: uncover 1.2s var(--ease-out) 0.9s both; }
  .hero__media video { animation: settle 1.6s var(--ease-out) 0.9s backwards; }

  .word-mask:nth-child(1) { --w: 0; }
  .word-mask:nth-child(2) { --w: 1; }
  .word-mask:nth-child(3) { --w: 2; }
  .word-mask:nth-child(4) { --w: 3; }
  .word-mask:nth-child(5) { --w: 4; }
  .word-mask:nth-child(6) { --w: 5; }
  .word-mask:nth-child(7) { --w: 6; }
  .word-mask:nth-child(8) { --w: 7; }
  .word-mask:nth-child(9) { --w: 8; }
  .word-mask:nth-child(10) { --w: 9; }
  .word-mask:nth-child(11) { --w: 10; }
  .word-mask:nth-child(12) { --w: 11; }
  .word-mask:nth-child(13) { --w: 12; }
  .word-mask:nth-child(14) { --w: 13; }
  .word-mask:nth-child(15) { --w: 14; }
  .word-mask:nth-child(16) { --w: 15; }

  /* Scroll reveals: a block, or the items of a group, settle into place as they enter the viewport. The slow transitions are on
   * opacity and translate only; hover moves `transform`, which is quick, so the two never fight. */
  [data-reveal], .reveal-item {
    --d: 0s;
    transition:
      opacity 0.9s var(--ease-out) var(--d),
      translate 0.9s var(--ease-out) var(--d),
      transform 0.25s var(--ease-out),
      border-color 0.25s ease,
      box-shadow 0.25s ease;
  }

  html[data-reveal-ready] [data-reveal]:not([data-reveal="group"]):not(.is-visible) { opacity: 0; translate: 0 2.25rem; }
  html[data-reveal-ready] [data-reveal="group"]:not(.is-visible) .reveal-item { opacity: 0; translate: 0 1.75rem; }
  /* Something inside is focused (a keyboard user tabbing into a block that is still waiting): show it now, not after its delay. */
  html[data-reveal-ready] [data-reveal]:not([data-reveal="group"]):not(.is-visible):focus-within { opacity: 1; translate: 0 0; transition-delay: 0s; }

  /* Items of a group arrive one after another; cards in a row of three arrive left to right. */
  .reveal-item:nth-child(2) { --d: 0.1s; }
  .reveal-item:nth-child(3) { --d: 0.2s; }
  .reveal-item:nth-child(4) { --d: 0.3s; }
  .reveal-item:nth-child(5) { --d: 0.4s; }
  .reveal-item:nth-child(6) { --d: 0.5s; }
  .reveal-item:nth-child(7) { --d: 0.6s; }
  .reveal-item:nth-child(8) { --d: 0.7s; }
  .reveal-item:nth-child(9) { --d: 0.8s; }
  .reveal-item:nth-child(10) { --d: 0.9s; }
  .reveal-item:nth-child(11) { --d: 1s; }
  .reveal-item:nth-child(12) { --d: 1.1s; }
  .grid > .card:nth-child(3n + 2) { --d: 0.08s; }
  .grid > .card:nth-child(3n + 3) { --d: 0.16s; }

  .btn { transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease-out); }
  .btn:hover { transform: translateY(-0.0625rem); }
  .btn:active { transform: translateY(0); }
  .nav a, .lang, .site-footer a { transition: color 0.2s ease, background-color 0.2s ease; }

  @media (hover: hover) {
    .card:hover { transform: translateY(-0.25rem); border-color: var(--cw-border-hover); box-shadow: 0 1rem 2rem var(--cw-shadow); }
  }

  /* An answer opens and closes smoothly where the browser can animate the content of <details>. */
  @supports selector(::details-content) {
    details::details-content {
      height: 0;
      overflow: clip;
      opacity: 0;
      transition: height 0.45s var(--ease-out), opacity 0.35s ease, content-visibility 0.45s allow-discrete;
    }
    details[open]::details-content { height: auto; opacity: 1; }
  }

  @supports (animation-timeline: scroll()) {
    @keyframes scroll-grow {
      from { transform: scaleX(0); }
      to { transform: scaleX(1); }
    }
    .scroll-progress {
      display: block;
      position: absolute;
      inset: auto 0 calc(var(--cw-hairline) * -1) 0;
      height: 0.1875rem;
      background: var(--cw-accent);
      transform-origin: 0 50%;
      animation: scroll-grow linear both;
      animation-timeline: scroll(root);
    }
  }
}

/* Reduced motion: nothing animates, transitions, slides or smooth-scrolls, and nothing waits to be revealed. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  [data-reveal], .reveal-item { opacity: 1 !important; translate: none !important; }
  .scroll-progress { display: none; }
}
