/* MyXterm website. Plain CSS, no build step, no external fonts.
   Colours follow the app's theme roles (apps/desktop/src/theme.rs):
   graphite dark is the default identity, warm-paper light follows prefers-color-scheme. */

:root {
  color-scheme: dark light;
  /* dark (theme.rs dark roles) */
  --page: #0E0F12;        /* TERMINAL: page background */
  --app: #131418;         /* APP: header, footer */
  --surface: #17191D;     /* SURFACE: cards */
  --raised: #1E2026;      /* RAISED: code, hover */
  --separator: #24262D;
  --border: #31343C;
  --control-border: #747985;
  --text: #ECEDF0;
  --text-2: #B0B4BD;
  --text-3: #8D919C;
  --accent: #8FA6FF;      /* links, focus ring */
  --accent-fill: #4A63E0; /* primary button */
  --on-accent: #FFFFFF;
  --selected: #232B45;
  --ok: #4CC38A;
  --warn: #F0B658;
  --error: #F2777A;
  --prod: #FF7377;        /* PROD_TEXT */
  --prod-mark: #E5484E;
  --stg: #E9A23B;
  --lab: #35BFAA;
  --local: #6E727C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, "Cascadia Mono", Consolas, "DejaVu Sans Mono", "Noto Sans Mono", monospace;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --gutter: 16px;
  --max: 72rem;
}

@media (prefers-color-scheme: light) {
  :root {
    /* light (theme.rs Light roles) */
    --page: #FCFCFA;
    --app: #EDECE8;
    --surface: #F5F4F1;
    --raised: #FFFFFF;
    --separator: #E3E1DB;
    --border: #D6D3CC;
    --control-border: #7D7A73;
    --text: #1B1A18;
    --text-2: #4E4B46;
    --text-3: #66635D;
    --accent: #3451C7;
    --accent-fill: #3B5BDB;
    --on-accent: #FFFFFF;
    --selected: #DFE5FA;
    --ok: #146C36;
    --warn: #815400;
    --error: #B3261E;
    --prod: #B3271E;
    --prod-mark: #D9363C;
    --stg: #855800;
    --lab: #0A6B5F;
    --local: #77746D;
    --shadow: 0 1px 2px rgba(27, 26, 24, .08), 0 1px 1px rgba(27, 26, 24, .04);
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.55 var(--font-ui);
  overflow-wrap: break-word;
}

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

img { max-width: 100%; height: auto; display: block; }

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

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

code, kbd, pre, .mono { font-family: var(--font-mono); font-size: .9em; font-variant-ligatures: none; }
code {
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--r-sm);
  padding: 0 .3em;
}
pre {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  overflow-x: auto;
  line-height: 1.5;
  max-width: 100%;
}
pre code { background: none; border: 0; padding: 0; font-size: 1em; }
kbd {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0 .35em;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 1.6em 0 .5em; font-weight: 650; }
h1 { font-size: 1.9rem; margin-top: .4em; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: 1rem; }
p, ul, ol, dl, table, pre { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }
li { margin: .2em 0; }
li > ul { margin: .2em 0 .3em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ---------- skip link ---------- */
.skip {
  position: absolute;
  left: 8px;
  top: -100px;
  background: var(--accent-fill);
  color: var(--on-accent);
  padding: 8px 12px;
  border-radius: var(--r-md);
  z-index: 10;
  text-decoration: none;
  font-weight: 600;
}
.skip:focus { top: 8px; }

/* ---------- layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.site-header {
  background: var(--app);
  border-bottom: 1px solid var(--separator);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  min-height: 52px;
  padding-top: 6px;
  padding-bottom: 6px;
}
.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.01em;
}
.wordmark:hover { color: var(--text); }
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav li { margin: 0; }
.site-nav a {
  display: inline-block;
  padding: 6px 10px;
  border-radius: var(--r-md);
  color: var(--text-2);
  text-decoration: none;
  font-size: .94rem;
}
.site-nav a:hover { background: var(--raised); color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--selected); }

main { display: block; padding: 8px 0 48px; }
main:focus { outline: none; }

.site-footer {
  background: var(--app);
  border-top: 1px solid var(--separator);
  color: var(--text-2);
  font-size: .9rem;
  padding: 20px 0 28px;
}
.site-footer p { margin: .3em 0; }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--text); }

/* ---------- identity-strip style status line ---------- */
.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--control-border);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--text-2);
  margin: 0 0 1.2em;
}
.strip strong { color: var(--text); font-weight: 600; }

.plate {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  border: 1px solid currentColor;
  letter-spacing: .02em;
  white-space: nowrap;
  vertical-align: .08em;
}
.plate-warn { color: var(--warn); }
.plate-prod { color: var(--prod); }
.plate-stg { color: var(--stg); }
.plate-lab { color: var(--lab); }
.plate-ok { color: var(--ok); }
.plate-muted { color: var(--text-2); }

/* ---------- hero ---------- */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 2.1rem; margin: 0 0 .35em; max-width: 52rem; letter-spacing: -.015em; }
.lede { font-size: 1.12rem; color: var(--text-2); max-width: 46rem; margin-bottom: 1.2em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 1.4em; }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  line-height: 1.3;
}
.btn:hover { background: var(--raised); text-decoration: none; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-fill); filter: brightness(1.08); }

.shot {
  margin: 0 0 1.5em;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.shot img { width: 100%; }
figure { margin: 0; }
figcaption { padding: 8px 12px; font-size: .88rem; color: var(--text-2); border-top: 1px solid var(--separator); }

/* ---------- grids and cards ---------- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); margin: 0 0 1.2em; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); margin: 0 0 1.2em; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}
.card h3 { margin: 0 0 .35em; font-size: 1rem; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card-band { border-left: 3px solid var(--accent-fill); }

.muted { color: var(--text-2); }
.small { font-size: .88rem; }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 2.2em 0 .6em; }
.section-head h2 { margin: 0; }

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-fill);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin: 0 0 1.2em;
}
.callout > :last-child { margin-bottom: 0; }
.callout-info { border-left-color: var(--accent-fill); }

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin: 0 0 1.2em;
}
table { border-collapse: collapse; width: 100%; font-size: .92rem; margin: 0; }
th, td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--separator); }
th { background: var(--app); font-weight: 600; color: var(--text); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.id { font-family: var(--font-mono); font-size: .85rem; white-space: nowrap; }
caption { text-align: left; padding: 8px 10px; color: var(--text-2); font-size: .88rem; }

.st { font-family: var(--font-mono); font-size: .8rem; white-space: nowrap; }
.st-partial { color: var(--warn); }
.st-in_progress { color: var(--accent); }
.st-planned { color: var(--text-2); }
.st-implemented, .st-verified { color: var(--ok); }
.st-blocked { color: var(--error); }
.st-deferred { color: var(--text-3); }

/* ---------- docs layout ---------- */
.doc { max-width: 52rem; }
.doc-meta { color: var(--text-2); font-size: .9rem; border-bottom: 1px solid var(--separator); padding-bottom: .8em; margin-bottom: 1.4em; }
.breadcrumbs { font-size: .88rem; color: var(--text-2); margin: 18px 0 0; }
.breadcrumbs a { color: var(--text-2); }
.toc { list-style: none; padding: 0; }
.toc li { margin: 0 0 8px; }
.doc-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.doc-list li { margin: 0; }
.doc-list a { font-weight: 600; }
.changelog h2 { border-bottom: 1px solid var(--separator); padding-bottom: .25em; }
.changelog li { margin: .45em 0; }

/* ---------- releases ---------- */
.release { margin: 0 0 14px; }
.release h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.release-body {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: .85rem;
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--r-md);
  padding: 10px 12px;
  max-height: 24rem;
  overflow: auto;
  margin: .6em 0;
}
.asset-list { list-style: none; padding: 0; margin: .4em 0 0; }
.asset-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; border-top: 1px solid var(--separator); padding: 6px 0; }
.asset-list .mono { font-size: .82rem; color: var(--text-2); overflow-wrap: anywhere; min-width: 0; }
.asset-list a { overflow-wrap: anywhere; min-width: 0; }
[hidden] { display: none !important; }

/* ---------- small screens ---------- */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .hero h1 { font-size: 1.45rem; }
  h1 { font-size: 1.6rem; }
  .site-nav a { padding: 6px 8px; }
}

@media (forced-colors: active) {
  .plate, .card, .callout, .strip { border: 1px solid CanvasText; }
  .btn-primary { border: 1px solid ButtonText; }
}

/* ---------- additions: hero subtitle, short Q&A, FAQ ---------- */
.h1-sub { display: block; font-size: 1.05rem; font-weight: 500; color: var(--text-2); margin-top: .35em; letter-spacing: 0; }
.qa { display: grid; grid-template-columns: minmax(0, 16rem) minmax(0, 1fr); gap: 6px 16px; margin: 0 0 1em; }
.qa dt { font-weight: 600; }
.qa dd { margin: 0; color: var(--text-2); }
@media (max-width: 600px) { .qa { grid-template-columns: minmax(0, 1fr); } .qa dd { margin-bottom: 8px; } }
.faq { border-top: 1px solid var(--separator); padding-top: .2em; }
.faq h2 { font-size: 1.12rem; margin: 1.1em 0 .4em; }
.id { font-family: var(--font-mono); font-size: .78rem; color: var(--text-2); }

/* ---------- download buttons ---------- */
.platforms { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); margin: 0 0 1em; }
.platform h2 { font-size: 1.15rem; margin: 0 0 .2em; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.platform.is-yours { border-color: var(--accent-fill); box-shadow: 0 0 0 1px var(--accent-fill); }
.yours { font-size: .75rem; font-weight: 600; color: var(--accent); border: 1px solid currentColor; border-radius: var(--r-sm); padding: 1px 6px; }
.dl-list { list-style: none; padding: 0; margin: .6em 0 0; }
.dl-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; border-top: 1px solid var(--separator); padding: 8px 0; margin: 0; }
.dl-label { flex: 1 1 12rem; font-weight: 600; }
.dl-action { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.dl-meta { flex-basis: 100%; font-size: .78rem; color: var(--text-2); overflow-wrap: anywhere; }

/* ---------- development log ---------- */
.devlog-day { border-top: 1px solid var(--separator); margin-top: 1.6em; }
.devlog-day > h2 { font-family: var(--font-mono); font-size: 1.05rem; }
.devlog-day h3 { font-size: .95rem; margin: 1em 0 .3em; color: var(--text-2); }
.devlog-list { padding-left: 1.1em; }
.devlog-list li { margin: .3em 0; }
.devlog-scope { font-size: .8rem; color: var(--text-2); }
.devlog-sha { font-size: .78rem; color: var(--text-2); }
.devlog-more { margin: .6em 0; }
.devlog-more summary { cursor: pointer; color: var(--text-2); font-weight: 600; font-size: .95rem; }
.milestone { margin: .8em 0; }
.milestone h3 { margin: 0 0 .3em; color: var(--text); font-size: 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.milestone p { margin: 0 0 .3em; }

/* ---------- comparison table: stacked rows on narrow screens ---------- */
tbody th { white-space: normal; background: transparent; }
table.stack tbody th { width: 11rem; }
@media (max-width: 640px) {
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.stack, table.stack tbody, table.stack tr, table.stack th, table.stack td { display: block; width: auto; }
  table.stack tr { border-bottom: 1px solid var(--separator); padding: 6px 0; }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack th, table.stack td { border: 0; padding: 3px 10px; }
  table.stack tbody th { font-size: 1rem; }
  table.stack td::before { content: attr(data-label) ": "; font-weight: 600; color: var(--text); }
}

/* ---------- round 2 (WEBSITE_R1) ---------- */
.site-footer .footer-cols { display: flex; flex-wrap: wrap; gap: 8px 48px; margin: 12px 0; }
.site-footer .footer-h { font-size: .85rem; margin: 0 0 4px; color: var(--text); font-weight: 600; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0 4px; }
.site-footer li { margin: 0; }
.site-footer li a { display: inline-block; padding: 4px 8px 4px 0; min-height: 24px; }
.site-footer p a { display: inline-block; min-height: 24px; padding: 2px 0; }

.docs-nav { margin: 2.5em 0 0; border-top: 1px solid var(--separator); padding-top: 12px; }
.docs-nav ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.docs-nav li { margin: 0; }
.docs-nav a { display: inline-block; padding: 4px 10px; border-radius: var(--r-md); color: var(--text-2); text-decoration: none; }
.docs-nav a:hover { background: var(--raised); color: var(--text); }
.docs-nav a[aria-current="page"] { background: var(--selected); color: var(--text); }

.dl-none { color: var(--text-2); }
.all-files { margin: 8px 0 0; border-top: 1px solid var(--separator); padding-top: 8px; }
.devlog-summary { max-width: 52rem; }
.devlog-more summary { margin: .4em 0; }
details.area { border-top: 1px solid var(--separator); }
details.area summary { cursor: pointer; padding: 4px 0; }
details.area summary h3 { display: inline; font-size: 1rem; margin: 0; }
details.area[open] summary { margin-bottom: 6px; }
a.src { font-size: .8rem; white-space: nowrap; }

@media (max-width: 600px) {
  .site-header .wrap { flex-wrap: nowrap; gap: 8px; min-height: 48px; padding-top: 4px; padding-bottom: 4px; }
  .site-nav { flex: 1 1 auto; min-width: 0; }
  .site-nav ul { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .site-nav ul::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; padding: 6px 8px; }
  .hero { padding-top: 16px; }
  .lede { font-size: 1rem; }
  .strip { font-size: .78rem; padding: 6px 10px; gap: 2px 10px; }
  .actions { gap: 8px; margin-bottom: 1em; }
  .actions .btn { padding: 7px 12px; }
}

/* ---------- round 3 (GEO): dated pages, fact list ---------- */
.updated { font-size: .82rem; color: var(--text-2); margin: -.2em 0 .9em; }
.facts { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr); gap: 0; margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.facts dt, .facts dd { margin: 0; padding: 6px 12px; border-top: 1px solid var(--separator); }
.facts dt:first-of-type, .facts dt:first-of-type + dd { border-top: 0; }
.facts dt { font-weight: 600; }
.facts dd { color: var(--text-2); }
@media (max-width: 600px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts dd { border-top: 0; padding-top: 0; }
}
