@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ── Rose Pine palette ── */
:root {
  --base: #191724;
  --surface: #1f1d2e;
  --overlay: #26233a;
  --muted: #6e6a86;
  --subtle: #908caa;
  --text: #e0def4;
  --love: #eb6f92;
  --gold: #f6c177;
  --rose: #ebbcba;
  --pine: #31748f;
  --foam: #9ccfd8;
  --iris: #c4a7e7;
  --hl-low: #21202e;
  --hl-med: #403d52;
  --hl-high: #524f67;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Page ── */
html {
  background: var(--base);
}

body {
  font: 18px/1.8 'JetBrains Mono', monospace;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Content area ── */
.content {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

/* ── Header ── */
h1 {
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--gold);
  text-align: center;
  margin-bottom: 0.2em;
  letter-spacing: -0.01em;
}

.subtitle {
  text-align: center;
  color: var(--subtle);
  font-size: 1.1rem;
  font-weight: 300;
  margin-bottom: 2.5em;
  font-style: italic;
}

/* ── Table of contents ── */
.toc {
  border-top: 1px solid var(--hl-med);
  border-bottom: 1px solid var(--hl-med);
  padding: 1.2em 0;
  margin-bottom: 2.5em;
}

.toc-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 0.8em;
}

.toc-phase {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--iris);
  margin: 0.8em 0 0.3em;
}

.toc-phase:first-of-type {
  margin-top: 0;
}

.toc ol {
  list-style: none;
}

.toc li {
  break-inside: avoid;
  padding: 0.2em 0;
}

.toc a {
  color: var(--subtle);
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.15s;
}

.toc a:hover {
  color: var(--foam);
}

.toc .num {
  display: inline-block;
  width: 2em;
  text-align: right;
  margin-right: 0.6em;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── Phase headings ── */
.phase {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--iris);
  text-align: center;
  margin: 3.5em 0 2em;
  padding-bottom: 0.6em;
  border-bottom: 1px solid var(--hl-med);
  position: relative;
}

.back-to-top {
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  text-decoration: none;
  position: absolute;
  right: 0;
  bottom: 0.6em;
  transition: color 0.15s;
}

.back-to-top:hover {
  color: var(--foam);
}

/* ── Entries ── */
.entry {
  margin-bottom: 2.5em;
  scroll-margin-top: 1em;
}

.entry-head {
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--rose);
  margin-bottom: 0.3em;
}

.entry-num {
  color: var(--muted);
  font-weight: 400;
  font-size: 1.1rem;
  margin-right: 0.3em;
}

.entry p {
  margin: 0.6em 0 0;
  color: var(--text);
  font-weight: 300;
}

/* ── Term highlights ── */
.term {
  color: var(--gold);
  font-weight: 500;
}

.it {
  font-style: italic;
  color: var(--subtle);
}

/* ── Example blocks ── */
.ex {
  background: var(--overlay);
  border-left: 2px solid var(--pine);
  padding: 1em 1.4em;
  margin: 1em 0;
  font-size: 1rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--foam);
  border-radius: 0 4px 4px 0;
}

/* ── Definition lists ── */
.defs {
  margin: 1.2em 0;
  display: grid;
  grid-template-columns: 9em 1fr;
  border-top: 1px solid var(--hl-med);
  border-bottom: 1px solid var(--hl-med);
  font-size: 1rem;
}

.defs dt {
  font-weight: 500;
  color: var(--gold);
  padding: 0.6em 0.8em 0.6em 0;
  border-bottom: 1px solid var(--hl-low);
}

.defs dd {
  margin: 0;
  padding: 0.6em 0 0.6em 0.8em;
  border-bottom: 1px solid var(--hl-low);
  font-weight: 300;
}

.defs dt:nth-of-type(even),
.defs dd:nth-of-type(even) {
  background: var(--hl-low);
}

.defs dt:last-of-type,
.defs dd:last-of-type {
  border-bottom: none;
}

/* ── Illustrations ── */
.ill {
  display: block;
  margin: 2em auto 1.5em;
  width: 80%;
  max-width: 420px;
  height: auto;
}

/* ── Scenario legend ── */
.scenario-legend {
  margin: 1.5em 0 0;
  padding: 1em 1.2em;
  background: var(--overlay);
  border-radius: 4px;
  font-size: 0.9em;
}

.legend-item {
  padding: 0.3em 0;
  font-weight: 300;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4em;
  vertical-align: middle;
}

/* ── Scenario tabs ── */
.scenarios {
  margin: 1.5em 0 0;
}

.tab-bar {
  display: flex;
  gap: 0.5em;
  margin-bottom: 0;
}

.tab {
  padding: 0.4em 1em;
  background: none;
  border: 1px solid var(--hl-med);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.8em;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
  border-color: var(--hl-high);
}

.tab.active {
  background: var(--overlay);
  border-color: var(--hl-high);
  font-weight: 500;
}

.tab.active[data-scenario="llm"] { color: var(--foam); }
.tab.active[data-scenario="dora"] { color: var(--gold); }
.tab.active[data-scenario="carbon"] { color: var(--iris); }
.tab.active[data-scenario="queues"] { color: var(--love); }

.scenario {
  display: none;
  padding: 1.2em 1.4em;
  background: var(--overlay);
  border: 1px solid var(--hl-high);
  border-radius: 0 6px 6px 6px;
}

.scenario.active {
  display: block;
}

.scenario p {
  margin: 0.5em 0;
  font-weight: 300;
}

.scenario .ex {
  margin: 0.6em 0;
}

.scenario .defs {
  margin: 0.8em 0;
}

/* ── Notes ── */
.note {
  font-style: italic;
  color: var(--subtle);
  font-size: 1rem;
  margin: 0.5em 0;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--hl-med);
  margin-top: 3em;
  padding-top: 1em;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

footer a {
  color: var(--subtle);
  text-decoration: none;
}

footer a:hover {
  color: var(--foam);
}

/* ── Mode switcher ── */
.mode-switcher {
  display: flex;
  justify-content: center;
  gap: 0.5em;
  margin-bottom: 2em;
}

.mode-tab {
  padding: 0.5em 1.5em;
  background: none;
  border: 1px solid var(--hl-med);
  border-radius: 4px;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.mode-tab:hover {
  color: var(--text);
  border-color: var(--hl-high);
}

.mode-tab.active {
  background: var(--overlay);
  border-color: var(--foam);
  color: var(--foam);
  font-weight: 500;
}

.mode-content {
  display: none;
}

.mode-content.active {
  display: block;
}

/* ── Responsive ── */
@media (min-width: 1200px) {
  body { font-size: 20px; }
  h1 { font-size: 3rem; }
  .content { padding: 4rem 3rem 5rem; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .content { padding: 2rem 1.2rem 3rem; }
  h1 { font-size: 1.8rem; }
  .subtitle { font-size: 1rem; }
  .toc ol { columns: 1; }
  .defs {
    grid-template-columns: 1fr;
  }
  .defs dt {
    border-bottom: none;
    padding-bottom: 0.2em;
  }
  .defs dd {
    padding-left: 0;
  }
  .ex {
    font-size: 0.9rem;
    padding: 0.8em 1em;
  }
  .tab {
    font-size: 0.7em;
    padding: 0.35em 0.6em;
  }
  .scenario {
    padding: 0.8em 1em;
  }
  .tab-bar {
    gap: 0.3em;
  }
  .mode-tab {
    font-size: 0.8rem;
    padding: 0.4em 1em;
  }
}
