/* Shared theme for the landing and diagram pages. Matches the simulator's palette. */
:root {
  --bg: #EDF0F2;
  --surface: #FFFFFF;
  --surface-2: #F4F6F8;
  --ink: #14232B;
  --muted: #586A73;
  --line: #D4DBE0;
  --accent: #2F46C8;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3E8FB;
  --warn: #8F5A00;
  --warn-soft: #F7EAD0;
  --font-ui: 'Schibsted Grotesk', 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E171C;
    --surface: #16222A;
    --surface-2: #1B2A33;
    --ink: #E5ECEF;
    --muted: #92A3AC;
    --line: #2A3A44;
    --accent: #8E9EFF;
    --accent-ink: #0E171C;
    --accent-soft: #222C57;
    --warn: #F0B84F;
    --warn-soft: #3E3013;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E171C;
  --surface: #16222A;
  --surface-2: #1B2A33;
  --ink: #E5ECEF;
  --muted: #92A3AC;
  --line: #2A3A44;
  --accent: #8E9EFF;
  --accent-ink: #0E171C;
  --accent-soft: #222C57;
  --warn: #F0B84F;
  --warn-soft: #3E3013;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  padding-inline: 16px;
  padding-block: 24px 40px;
}
.wrap { max-width: 1100px; margin-inline: auto; display: flex; flex-direction: column; gap: 20px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.muted { color: var(--muted); }
.lead { max-width: 62ch; color: var(--muted); margin-top: 6px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.back { display: inline-block; margin-bottom: 8px; font-size: 13px; text-decoration: none; }
.back:hover { text-decoration: underline; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.panel > h2 { margin-bottom: 10px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card:hover { border-color: var(--accent); }
.card b { font-size: 16px; }
.card span { color: var(--muted); }
.card .go { margin-top: 6px; color: var(--accent); font-weight: 600; }

.steps { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.steps li::marker { font-family: var(--font-mono); color: var(--muted); }

.scroll { overflow-x: auto; }
#diagram { display: flex; justify-content: center; min-height: 120px; }
#diagram svg { max-width: 100%; height: auto; }

.legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; margin-top: 8px; }
.legend div { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.chip { font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; font-weight: 500; }
.facts { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

details.panel summary { cursor: pointer; font-weight: 600; }
details.panel pre { margin: 12px 0 0; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; font-family: var(--font-mono); font-size: 12px; line-height: 1.5; }
.btn { margin-top: 10px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; cursor: pointer; font: inherit; font-weight: 500; }
.btn:hover { background: var(--surface-2); }

@media (max-width: 880px) { h1 { font-size: 24px; } }
