/* Capaxima site — the app's "Clay" theme, token for token.
   Source of truth for both: THEME_PRESETS.clay in packages/app/src/state/settings.ts.
   Page and panels are the app's plum panel colour; the hero band is the app's
   orange background, with the tokens re-pointed inside it so every component
   stays readable without its own rules. Change these and the preset together. */

:root {
  --bg: #211826;             /* clay.surface */
  --surface: #2b2031;        /* clay.surface, one step up */
  --surface-2: #17111c;      /* clay.surface, one step down (inputs, code) */
  --ink: #faeeda;            /* clay.surfaceText */
  --ink-2: #e6d3ba;
  --muted: #d9b79a;          /* clay.textMuted */
  --rule: #3b2d42;
  --rule-strong: #57475f;
  --accent: #7fe0d0;         /* clay.accent */
  --accent-ink: #14211f;
  --warm-a: #e68f5c;         /* clay.bgA */
  --warm-b: #b0542f;         /* clay.bgB */
  --note-bg: #3a2418;
  --note-rule: #8a4526;
  --note-ink: #ffb088;       /* clay.warning */
  --bad: #ffb088;            /* clay.warning */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "JetBrains Mono", "SFMono-Regular", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--surface-2); border: 1px solid var(--rule); border-radius: 4px; padding: 0.08em 0.35em; }
pre {
  background: var(--surface-2); border: 1px solid var(--rule); border-radius: 6px;
  padding: 12px 14px; overflow-x: auto; line-height: 1.5; margin: 12px 0 0;
}
pre code { background: none; border: 0; padding: 0; font-size: 13px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 700; }
h2 { font-size: clamp(22px, 3vw, 28px); font-weight: 700; }
h3 { font-size: 18px; font-weight: 650; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; }
li + li { margin-top: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--rule); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); margin-top: 16px; }
.table-wrap table { min-width: 560px; }
.table-wrap tr:last-child td { border-bottom: 0; }

.wrap { max-width: 940px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-head { border-bottom: 1px solid var(--rule); background: var(--bg); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: 0.01em; }
.brand svg { width: 22px; height: 22px; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: 15px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.head-right { display: flex; align-items: center; gap: 8px 22px; flex-wrap: wrap; }
.lang { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.lang a { color: var(--muted); text-decoration: none; padding: 3px 7px; border-radius: 4px; border: 1px solid transparent; }
.lang a:hover { color: var(--ink); }
.lang a[aria-current="true"] { color: var(--ink); border-color: var(--rule-strong); }

/* Hero */
.hero {
  padding: 56px 0 40px; border-bottom: 1px solid var(--rule);
  background: radial-gradient(ellipse at 18% 0%, var(--warm-a), var(--warm-b) 80%);
  --ink: #211826; --ink-2: #47271f; --muted: #6b3a28;
  --surface: #f5d6bf; --surface-2: #ecc4a6;
  --rule: rgba(33, 24, 38, 0.22); --rule-strong: rgba(33, 24, 38, 0.42);
  --accent: #211826; --accent-ink: #faeeda;
  --note-bg: #fbe6d6; --note-rule: #c7825a; --note-ink: #5a2f1c; --bad: #7a2318;
}
.hero + .hero { border-top: 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hero h1 { margin-top: 12px; max-width: 18ch; }
.hero .deck { margin-top: 18px; font-size: 19px; color: var(--ink-2); max-width: 58ch; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; align-items: center; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: 15px;
  text-decoration: none; border: 1px solid var(--accent); color: var(--accent); background: transparent; cursor: pointer;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.facts { margin-top: 22px; display: flex; gap: 6px 22px; flex-wrap: wrap; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.facts b { color: var(--ink); font-weight: 500; }

/* Sections */
.section { padding: 44px 0 0; }
.section .lead { margin-top: 10px; color: var(--ink-2); max-width: 66ch; font-size: 17px; }
.section .lead + * { margin-top: 22px; }
.section h2 + p { margin-top: 10px; }

.cols { display: grid; gap: 14px; margin-top: 22px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.card h3 { font-size: 17px; }
.card p { color: var(--ink-2); font-size: 15px; }
.card .q { font-style: italic; color: var(--muted); font-size: 14px; margin-top: auto; padding-top: 6px; }
.card .k { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }

.list-2 { display: grid; gap: 8px 28px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 18px; padding: 0; list-style: none; }
.list-2 li { padding-left: 18px; position: relative; color: var(--ink-2); font-size: 15px; margin: 0; }
.list-2 li::before { content: ""; position: absolute; left: 0; top: 0.68em; width: 8px; height: 2px; background: var(--accent); }
.list-2 li b { color: var(--ink); font-weight: 600; }

.not { margin-top: 18px; padding: 0; list-style: none; display: grid; gap: 8px 28px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.not li { padding-left: 18px; position: relative; color: var(--ink-2); font-size: 15px; margin: 0; }
.not li::before { content: "\00d7"; position: absolute; left: 0; top: -1px; color: var(--muted); font-weight: 600; }
.not li b { color: var(--ink); font-weight: 600; }

.note { margin-top: 20px; background: var(--note-bg); border: 1px solid var(--note-rule); color: var(--note-ink); border-radius: 6px; padding: 12px 16px; font-size: 14.5px; }
.note a { color: inherit; }

.callout { margin-top: 22px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 8px; padding: 18px 20px; }
.callout h3 { margin-bottom: 8px; }
.callout p { color: var(--ink-2); }
.callout p + p { margin-top: 8px; }

/* Prose pages */
.prose { max-width: 70ch; }
.prose h2 { margin-top: 40px; }
.prose h3 { margin-top: 26px; }
.prose p { margin-top: 12px; color: var(--ink-2); }
.prose ul, .prose ol { margin-top: 10px; color: var(--ink-2); }
.prose li { margin-top: 6px; }
.prose b, .prose strong { color: var(--ink); font-weight: 600; }
.prose pre { margin-top: 12px; }

/* Changelog */
.release { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--rule); }
.release:first-of-type { border-top: 0; padding-top: 0; }
.release .when { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-left: 12px; }
.release h3 { margin-top: 20px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.release ul { margin-top: 8px; color: var(--ink-2); }
.release li { margin-top: 8px; }
.release b { color: var(--ink); font-weight: 600; }

/* Other products */
.products { display: grid; gap: 16px; margin-top: 24px; }
.product { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 20px 20px 18px; }
.product .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.product h3 { font-size: 20px; }
.product .meta { font-family: var(--mono); font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.product .tagline { margin-top: 6px; color: var(--ink-2); font-size: 16px; }
.product .desc { margin-top: 12px; color: var(--ink-2); font-size: 15px; white-space: pre-line; }
.product .files { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.product .file {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; background: var(--surface-2);
}
.product .file .name { font-family: var(--mono); font-size: 13.5px; word-break: break-all; }
.product .file .size { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: 10px; }
.product .file .sha { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); word-break: break-all; margin-top: 4px; }
.product .file .btn { padding: 6px 14px; font-size: 14px; }
.product .links { margin-top: 12px; font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.product .notes { margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.empty { margin-top: 24px; border: 1px dashed var(--rule-strong); border-radius: 8px; padding: 28px 20px; text-align: center; color: var(--muted); }

/* Sign-in state in the header (filled by auth.js; empty without it) */
.auth-slot { display: inline-flex; align-items: center; gap: 12px; min-height: 28px; font-size: 14px; }
.auth-slot:empty { display: none; }
.auth-link { color: var(--ink-2); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.auth-link:hover { color: var(--ink); }
.auth-user { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 500; max-width: 200px; }
.auth-user img { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.auth-user, .auth-user > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-out { font: inherit; font-size: 13px; color: var(--muted); background: none; border: 1px solid var(--rule-strong); border-radius: 4px; padding: 3px 9px; cursor: pointer; }
.auth-out:hover { color: var(--ink); border-color: var(--ink-2); }
.auth-muted { font-size: 14px; color: var(--muted); }
.auth-error { margin-top: 12px; color: var(--bad); font-size: 14.5px; }

/* Beta page */
.beta-signin { margin-top: 26px; display: grid; gap: 10px; justify-items: start; }
.beta-signin .fine { font-size: 13.5px; color: var(--muted); max-width: 48ch; }
.beta-form { margin-top: 22px; display: grid; gap: 12px; max-width: 560px; }
.beta-form label { display: grid; gap: 6px; font-size: 14.5px; color: var(--ink-2); }
.beta-form input[type=email], .beta-form input[type=text] {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong);
  border-radius: 6px; padding: 9px 12px; min-width: 240px;
}
.beta-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.beta-signin.beta-form { max-width: 640px; }
.flash { margin-top: 18px; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface); font-size: 14.5px; max-width: 560px; }
.beta-form textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong);
  border-radius: 6px; padding: 10px 12px; min-height: 96px; resize: vertical;
}
.beta-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.beta-form .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.key-card { margin-top: 24px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 8px; padding: 20px 22px; display: grid; gap: 16px; }
.key-card .label { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.key-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.key { font-family: var(--mono); font-size: clamp(18px, 3vw, 24px); letter-spacing: 0.04em; color: var(--ink); user-select: all; }
.key-row .btn { padding: 6px 12px; font-size: 13.5px; }
.key-card .valid { color: var(--ink-2); font-size: 15px; }
.key-card .valid b { color: var(--ink); }
.download-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.download-meta { font-family: var(--mono); font-size: 12.5px; color: var(--muted); display: grid; gap: 2px; }
.download-meta .sha { word-break: break-all; }
.steps { margin-top: 22px; padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; max-width: 62ch; }
.steps li { position: relative; padding-left: 36px; color: var(--ink-2); font-size: 15px; margin: 0; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--rule-strong); font-family: var(--mono); font-size: 12px; color: var(--accent); display: grid; place-items: center; }
.steps li b { color: var(--ink); font-weight: 600; }
.status-line { margin-top: 10px; font-size: 15px; color: var(--ink-2); }
.status-line b { color: var(--ink); }

/* Footer */
.site-foot { margin-top: 64px; border-top: 1px solid var(--rule); padding: 22px 0 40px; font-size: 13.5px; color: var(--muted); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; }
.site-foot a { color: var(--muted); }
.site-foot .links { display: flex; gap: 16px; flex-wrap: wrap; }

@media (max-width: 600px) {
  .hero { padding: 40px 0 32px; }
  .section { padding-top: 36px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* FAQ (product page) */
.faq { margin-top: 20px; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-family: var(--mono); flex: none; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 0 0 16px; color: var(--ink-2); max-width: 70ch; }

/* Comparison page: six columns need room, the wrapper scrolls */
.table-wrap.compare table { min-width: 860px; }
.table-wrap.compare tbody th { font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--ink); }

/* Team page (team.html, team.js) */
[data-team] .card { margin: 16px 0; }
.team-members { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 6px; }
.team-members li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--ink-2); font-size: 15px; }
.team-form { display: flex; gap: 8px; flex-wrap: wrap; }
.team-form input { flex: 1 1 220px; min-width: 0; }
.team-danger { align-self: flex-start; }

/* Conference joke: /?s=<id> shows the visitor's own selfie behind the hero (selfie-bg.js).
   The top of the band is the clear photo, the text sits on a warm scrim below it. */
.hero.has-selfie { --selfie-h: min(52vh, 420px); position: relative; overflow: hidden; padding-top: var(--selfie-h); }
.hero.has-selfie > .wrap { position: relative; z-index: 1; }
.hero.has-selfie::before {
  content: ""; position: absolute; inset: 0; background: var(--selfie) center 20% / cover no-repeat;
  opacity: 0; transform: scale(1.1); transition: opacity 1.8s ease, transform 9s ease;
}
.hero.has-selfie.selfie-on::before { opacity: 1; transform: scale(1); }
.hero.has-selfie::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(230, 143, 92, 0) 0, rgba(230, 143, 92, 0) calc(var(--selfie-h) - 90px), rgba(214, 124, 80, 0.94) calc(var(--selfie-h) + 40px), rgba(176, 84, 47, 0.96) 100%);
}
.selfie-chip {
  position: absolute; z-index: 2; left: 50%; top: calc(min(52vh, 420px) - 52px); transform: translateX(-50%); margin: 0;
  padding: 8px 16px; border-radius: 999px; background: rgba(33, 24, 38, 0.85); color: #faeeda;
  font-weight: 600; font-size: 15px; white-space: nowrap; opacity: 0; animation: selfie-chip-in 0.6s 2.4s forwards;
}
@keyframes selfie-chip-in { to { opacity: 1; } }
@media (max-width: 520px) { .selfie-chip { white-space: normal; width: max-content; max-width: 88%; text-align: center; } }
@media (prefers-reduced-motion: reduce) {
  .hero.has-selfie::before { transition: none; transform: none; }
  .selfie-chip { animation: none; opacity: 1; }
}
