/* ISRD design system: tokens first, then base, then components. Light by default, dark follows the system or the toggle. */
:root {
  --bg: #fafaf7; --surface: #ffffff; --ink: #16221f; --muted: #5a6b66; --line: #dfe5e1;
  --brand: #0f6b5c; --brand-ink: #ffffff; --accent: #b4761a; --soft: #e8f1ee;
  --live: #0f6b5c; --soon: #8a6d1f;
  --radius: 14px; --max: 1080px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0e1513; --surface: #141d1a; --ink: #e8efec; --muted: #9db0aa; --line: #263430;
  --brand: #4cc2ac; --brand-ink: #06231d; --accent: #e0a24a; --soft: #182522;
  --live: #4cc2ac; --soon: #e0a24a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1513; --surface: #141d1a; --ink: #e8efec; --muted: #9db0aa; --line: #263430;
    --brand: #4cc2ac; --brand-ink: #06231d; --accent: #e0a24a; --soft: #182522;
    --live: #4cc2ac; --soon: #e0a24a;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1.05rem/1.65 var(--sans); -webkit-text-size-adjust: 100%; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 600; color: var(--accent); margin: 0 0 .8em; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 40rem; }
.muted { color: var(--muted); }

/* header */
.site { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.brand span { color: var(--brand); }
.site nav { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.site nav a { color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.site nav a:hover { background: var(--soft); }
@media (max-width: 699px) {
  .site .wrap { flex-wrap: wrap; padding-bottom: 6px; }
  .site nav { order: 3; width: 100%; margin-left: 0; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .site nav::-webkit-scrollbar { display: none; }
  .site nav a { white-space: nowrap; }
  .site .icon-btn { margin-left: auto; order: 2; }
}
.icon-btn { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 999px; min-width: 40px; min-height: 40px; cursor: pointer; font: inherit; }

/* hero */
.hero { padding: clamp(48px, 10vw, 112px) 0 clamp(36px, 7vw, 72px); background:
  radial-gradient(1200px 400px at 85% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%); }
.hero h1 { max-width: 14em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.6em; }
.btn { display: inline-block; padding: 12px 20px; border-radius: 999px; font-weight: 600; text-decoration: none; border: 1px solid var(--brand); min-height: 44px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { color: var(--brand); }

/* sections */
section { padding: clamp(40px, 7vw, 80px) 0; }
section.alt { background: var(--soft); }
.two { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .two { grid-template-columns: 1fr 1fr; align-items: start; } }

/* division cards */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); margin-top: 28px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; }
a.card:hover { border-color: var(--brand); transform: translateY(-2px); }
.card { transition: transform .15s ease, border-color .15s ease; }
.card h3 { margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: .98rem; }
.card .go { margin-top: auto; padding-top: 8px; color: var(--brand); font-weight: 600; font-size: .95rem; }
.tag { align-self: flex-start; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid currentColor; }
.tag.live { color: var(--live); } .tag.soon { color: var(--soon); }

/* principles + lists */
.principles { display: grid; gap: 20px; margin: 28px 0 0; padding: 0; list-style: none; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.principles li { border-top: 3px solid var(--brand); padding-top: 12px; }
.principles strong { display: block; font-family: var(--serif); font-size: 1.15rem; margin-bottom: 4px; }
.principles span { color: var(--muted); font-size: .98rem; }
blockquote.mission { font-family: var(--serif); font-size: clamp(1.25rem, 3vw, 1.7rem); line-height: 1.4; margin: 0; padding-left: 20px; border-left: 4px solid var(--accent); }

footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: .92rem; }
footer .wrap { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
footer a { color: var(--muted); }

/* style-guide page */
.swatches { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.sw { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: .85rem; }
.sw i { display: block; height: 56px; }
.sw b { display: block; padding: 6px 10px 0; } .sw code { display: block; padding: 0 10px 8px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* content pages */
.pagehead { padding: clamp(36px, 7vw, 72px) 0 clamp(20px, 4vw, 36px); border-bottom: 1px solid var(--line); background: radial-gradient(900px 300px at 90% -20%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 70%); }
.pagehead h1 { font-size: clamp(1.8rem, 5vw, 2.9rem); max-width: 22em; }
.byline { margin: .4em 0 0; font-size: .92rem; }
.crumbs { font-size: .9rem; margin-bottom: 1em; color: var(--muted); }
.crumbs a { color: var(--muted); }
.prose { max-width: 44rem; margin: 0 auto; padding: 8px 0 40px; font-size: 1.08rem; line-height: 1.75; overflow-wrap: anywhere; }
.two .prose { margin: 0; max-width: none; }
.prose h2 { margin-top: 1.8em; } .prose h3 { margin-top: 1.5em; } .prose h4 { margin: 1.2em 0 .3em; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }
.prose blockquote { margin: 1.2em 0; padding: .1em 0 .1em 18px; border-left: 4px solid var(--accent); color: var(--muted); }
.prose code { background: var(--soft); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.prose pre { background: var(--soft); padding: 14px; border-radius: 10px; overflow-x: auto; font-size: .88rem; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; margin: 1.2em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--soft); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose pre.mermaid { background: none; text-align: center; }
.meta { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.chip { display: inline-block; font-size: .78rem; padding: 2px 10px; margin: 4px 6px 0 0; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.rows a { text-decoration: none; }
aside .card { margin-bottom: 16px; } aside ul { margin: 0; padding-left: 1.1em; }
figure.art { margin: 24px auto 0; max-width: 52rem; }
figure.art img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }
figure.art figcaption { color: var(--muted); font-size: .9rem; margin-top: 8px; }
.site nav a[aria-current="page"] { background: var(--soft); font-weight: 600; }

/* simulations */
.simstage { background: #040e14; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.simstage canvas { display: block; width: 100%; height: auto; touch-action: none; }
.simstats { display: flex; flex-wrap: wrap; gap: 4px 0; min-height: 34px; margin-bottom: 10px; }
.simbar { display: flex; gap: 10px; margin: 14px 0; }
.simparams { display: grid; gap: 14px 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.simparams label { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: .92rem; }
.simparams input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--brand); min-height: 32px; }
.simparams output { color: var(--muted); font-variant-numeric: tabular-nums; }
.simnote { max-width: 44rem; }
