/* graphersal-memory draft site. Colours follow the Graphersal playground tokens
   (playground/css: accent #2f6fde, orange #e0791f, green #2f9e6f). No web fonts: system stacks. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #d9dde3;
  --text: #1c2330;
  --text-muted: #4f5868;
  --accent: #2f6fde;
  --accent-hover: #2459b8;
  --accent-soft: #e4edfc;
  --accent-contrast: #ffffff;
  --orange: #c4620f;
  --green: #23854f;
  --green-soft: #e3f4ea;
  --warn: #8a5800;
  --warn-soft: #fdf3dc;
  --code-bg: #10151c;
  --code-text: #dde3ec;
  --code-dim: #8d98aa;
  --code-accent: #7fb0ff;
  --code-ok: #6fd68a;
  --series-file: #d0701a;
  --series-graph: #2f6fde;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .08);
  --radius: 12px;
  --maxw: 1080px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151b;
    --surface: #181d25;
    --surface-2: #1f2530;
    --border: #2c3442;
    --text: #e3e7ee;
    --text-muted: #a8b1c0;
    --accent: #6c9eff;
    --accent-hover: #8fb5ff;
    --accent-soft: #1d2b46;
    --accent-contrast: #0b1220;
    --orange: #f0a35e;
    --green: #56d364;
    --green-soft: #15301f;
    --warn: #e3b341;
    --warn-soft: #33290f;
    --code-bg: #0b0f14;
    --series-file: #cc7a33;
    --series-graph: #5b8ef0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: break-word;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
:not(pre) > code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
img, svg { max-width: 100%; height: auto; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 16px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.site-header nav { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; font-size: .93rem; }
.site-header nav a { color: var(--text-muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }
@media (max-width: 720px) { .site-header nav { display: none; } }

/* Sections */
section { padding: 72px 0; }
section + section { border-top: 1px solid var(--border); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h3 { font-size: 1.15rem; }
.lead { font-size: 1.2rem; color: var(--text-muted); max-width: 46em; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--accent); margin: 0 0 .6em; }
.muted { color: var(--text-muted); }
.small { font-size: .9rem; }

/* Hero */
.hero { padding: 80px 0 64px; }
.hero h1 span { color: var(--accent); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.badge { font-size: .82rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; }
.btn { display: inline-block; padding: 12px 20px; border-radius: 10px; font-weight: 600; text-decoration: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn.primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); color: var(--accent-contrast); }
.btn[aria-disabled="true"] { opacity: .65; cursor: not-allowed; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } }

/* Chat illustration */
.chat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; font-size: .95rem; }
.chat .who { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.chat .msg { margin: 0 0 14px; }
.chat .tool { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; background: var(--accent-soft); color: var(--text); border-radius: 8px; padding: 8px 10px; margin: 0 0 14px; }
.chat figcaption { font-size: .8rem; color: var(--text-muted); margin-top: 6px; }

/* Cards */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 28px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card h3 { display: flex; gap: 10px; align-items: center; }
.card p { margin: 0; color: var(--text-muted); }
.card .icon { width: 28px; height: 28px; flex: none; color: var(--accent); }

/* Steps (how it works, plain) */
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 28px 0; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 20px 20px 64px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 20px; top: 18px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); font-weight: 700; display: grid; place-items: center; }
.steps strong { display: block; }

.diagram { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 8px 0 0; }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram figcaption { color: var(--text-muted); font-size: .9rem; margin-top: 8px; }
.d-box { fill: var(--surface-2); stroke: var(--border); }
.d-agent { fill: var(--accent-soft); stroke: var(--accent); }
.d-daemon { fill: var(--accent); }
.d-store { fill: var(--green-soft); stroke: var(--green); }
.d-machine { fill: none; stroke: var(--text-muted); stroke-dasharray: 6 5; }
.d-text { fill: var(--text); font: 600 14px system-ui, sans-serif; }
.d-sub { fill: var(--text-muted); font: 12px system-ui, sans-serif; }
.d-inv { fill: var(--accent-contrast); font: 600 14px system-ui, sans-serif; }
.d-line { stroke: var(--text-muted); stroke-width: 1.6; fill: none; }
.d-arrow { fill: var(--text-muted); }
.d-cloud { fill: none; stroke: var(--orange); stroke-dasharray: 3 4; }
.d-cloud-t { fill: var(--orange); font: 12px system-ui, sans-serif; }

details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 20px; margin: 16px 0; }
details > summary { cursor: pointer; padding: 14px 0; font-weight: 600; }
details[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }
details > :last-child { margin-bottom: 16px; }

/* Terminal */
.terminal { background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 24px 0 0; border: 1px solid #000; }
.terminal .bar { display: flex; gap: 6px; padding: 10px 14px; background: #1b222c; align-items: center; }
.terminal .bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a4452; display: block; }
.terminal .bar span { margin-left: 8px; font-size: .78rem; color: var(--code-dim); font-family: ui-monospace, Menlo, monospace; }
.terminal pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: .8rem; line-height: 1.5; white-space: pre; }
.terminal .t-title { color: #fff; font-weight: 700; }
.terminal .t-dim { color: var(--code-dim); }
.terminal .t-def { color: var(--code-ok); }
.terminal .t-acc { color: var(--code-accent); }
.terminal .t-in { color: #ffd479; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
@media (max-width: 880px) { .two { grid-template-columns: 1fr; } }
.checklist { list-style: none; padding: 0; margin: 16px 0; }
.checklist li { padding-left: 28px; position: relative; margin: 10px 0; }
.checklist li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 14px; height: 8px; border-left: 2.5px solid var(--green); border-bottom: 2.5px solid var(--green); transform: rotate(-45deg); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-weight: 600; background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.status { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.status.ok { background: var(--green-soft); color: var(--green); }
.status.preview { background: var(--warn-soft); color: var(--warn); }
.status.later { background: var(--surface-2); color: var(--text-muted); }

/* Bar chart (evidence) */
.chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 14px; padding: 0; list-style: none; font-size: .9rem; color: var(--text-muted); }
.legend li::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.bars { display: grid; gap: 14px; }
.bar-group h3 { font-size: .95rem; margin: 0 0 6px; }
.bar-row { display: grid; grid-template-columns: 7.5em 1fr 3em; gap: 8px; align-items: center; font-size: .85rem; color: var(--text-muted); margin: 3px 0; }
.bar-track { height: 14px; position: relative; border-left: 1px solid var(--border); }
.bar-fill { height: 100%; width: calc(var(--v) / 5 * 100%); background: var(--c); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row:hover .bar-fill { filter: brightness(1.12); }
.bar-val { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.bar-row.total { font-weight: 700; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 20px 0 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-muted); font-size: .88rem; }

.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 14px 18px; border-radius: 0 var(--radius) var(--radius) 0; margin: 20px 0; }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }

/* FAQ */
.faq details { margin: 10px 0; }

/* Footer */
footer { border-top: 1px solid var(--border); padding: 36px 0 48px; color: var(--text-muted); font-size: .9rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; }
footer p { margin: 0; }

/* Diagram: wide on desktop, tall on phones */
.dia-tall { display: none !important; max-width: 420px; margin: 0 auto; }
@media (max-width: 640px) {
  .dia-wide { display: none !important; }
  .dia-tall { display: block !important; }
}

.two > *, .hero-grid > * { min-width: 0; }

/* v2 */
.diagram { margin-top: 32px; }
.terminal pre b { color: #fff; }
.chat .day { margin: 0 0 6px; font-size: .75rem; font-weight: 600; color: var(--accent); }
.chat .day ~ .day { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
