/* SRE Leader's Field Guide — clean documentation theme.
   Light by default; dark via prefers-color-scheme (unless the reader chose light) or [data-theme="dark"].
   One accent colour. Three callout styles: key, example, watch. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,600;1,400&family=IBM+Plex+Mono:wght@400&display=swap");

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f2f3f1;
  --ink: #1c1f23;
  --ink-2: #555e66;
  --line: #e2e5e7;
  --line-strong: #8a949c;
  --accent: #0a6b5e;
  --accent-ink: #ffffff;
  --accent-soft: #e8f3f0;
  --key-bg: #eef6f3;    --key-bar: #0a6b5e;
  --ex-bg: #f0f4fa;     --ex-bar: #2f63a8;
  --watch-bg: #fcf5e6;  --watch-bar: #9a5f00;
  --radius: 8px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111416; --surface: #171b1e; --surface-2: #1e2327; --ink: #e6e8ea; --ink-2: #a9b1b8; --line: #2b3237; --line-strong: #6f7a83;
    --accent: #52cdb5; --accent-ink: #062019; --accent-soft: #15302b;
    --key-bg: #142a26; --key-bar: #52cdb5; --ex-bg: #172338; --ex-bar: #86adf0; --watch-bg: #2f2612; --watch-bar: #e9b44c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111416; --surface: #171b1e; --surface-2: #1e2327; --ink: #e6e8ea; --ink-2: #a9b1b8; --line: #2b3237; --line-strong: #6f7a83;
  --accent: #52cdb5; --accent-ink: #062019; --accent-soft: #15302b;
  --key-bg: #142a26; --key-bar: #52cdb5; --ex-bg: #172338; --ex-bar: #86adf0; --watch-bg: #2f2612; --watch-bar: #e9b44c;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--font); }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
code, kbd { font: 0.88em var(--mono); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
mark { background: #ffe58a; color: #1c1f23; border-radius: 2px; padding: 0 1px; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; z-index: 100; border-radius: 6px; }
.skip-link:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 17px; white-space: nowrap; min-width: 0; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; }
.header-spacer { flex: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 264px minmax(0, 1fr) 220px; max-width: 1400px; margin: 0 auto; }
.sidebar { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 20px 12px 48px 16px; border-right: 1px solid var(--line); }
.content { padding: 32px 48px 72px; min-width: 0; }
.toc { position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 32px 16px; font-size: 14px; }
.toc h2 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; }
.toc a { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--line); color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--ink); border-left-color: var(--line-strong); }

/* Sidebar */
.nav-section { padding: 14px 0 12px; border-top: 1px solid var(--line); }
.nav-section.nav-home { border-top: 0; padding-top: 0; }
.nav-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.nav-icon { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.nav-section.is-current .nav-title, .nav-section.is-current .nav-icon { color: var(--accent); }
.nav-section ul { list-style: none; margin: 0 0 0 19px; padding: 0 0 0 8px; border-left: 1px solid var(--line); }
.nav-section.nav-home ul { margin-left: 0; padding-left: 0; border-left: 0; }
.nav-section.is-current ul { border-left-color: var(--accent); }
.nav-section a { display: flex; align-items: center; min-height: 34px; padding: 4px 10px; color: var(--ink); text-decoration: none; font-size: 15px; border-radius: 6px; line-height: 1.3; }
.nav-section a:hover { background: var(--surface-2); }
.nav-section a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- Page header ---------- */
.crumbs { font-size: 14px; color: var(--ink-2); margin: 0 0 8px; }
.prose .crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs li + li::before { content: "/"; margin-right: 4px; color: var(--line-strong); }
.crumbs a { color: var(--ink-2); }
.prose { max-width: 760px; }
.prose h1 { font-size: 34px; line-height: 1.2; font-weight: 600; margin: 0 0 10px; letter-spacing: -0.01em; }
.summary { font-size: 19px; color: var(--ink-2); margin: 0 0 28px; max-width: 68ch; }
.prose h2 { font-size: 24px; line-height: 1.3; font-weight: 600; margin: 48px 0 12px; padding-top: 4px; }
.prose h3 { font-size: 19px; line-height: 1.35; font-weight: 600; margin: 28px 0 8px; }
.prose p, .prose li { max-width: 72ch; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 6px 0; }
.anchor { margin-left: 8px; color: var(--line-strong); text-decoration: none; font-weight: 400; opacity: 0; }
h2:hover > .anchor, h3:hover > .anchor, .anchor:focus { opacity: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* ---------- Callouts (three styles only) ---------- */
.callout { border-left: 4px solid var(--key-bar); background: var(--key-bg); border-radius: 0 var(--radius) var(--radius) 0; padding: 14px 18px; margin: 20px 0; }
.callout.example { border-left-color: var(--ex-bar); background: var(--ex-bg); }
.callout.watch { border-left-color: var(--watch-bar); background: var(--watch-bg); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 600; margin: 0 0 6px; }
.callout dl { margin: 0; }
.callout dt { font-weight: 600; margin-top: 12px; }
.callout dt:first-child { margin-top: 0; }
.callout dd { margin: 2px 0 0; }

/* ---------- Home ---------- */
.search { margin: 8px 0 36px; }
.search label { display: block; font-weight: 600; margin-bottom: 6px; }
.search-row { position: relative; }
.search input { width: 100%; font: 17px/1.4 var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 48px 12px 14px; }
.search input:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.search-row kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-2); }
.search-hint { font-size: 14px; color: var(--ink-2); margin: 6px 0 0; }
.results h3 { font-size: 16px; margin: 22px 0 4px; }
.results .empty { padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-2); margin-top: 16px; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 12px 0 8px; list-style: none; padding: 0 !important; }
.section-grid li { margin: 0; max-width: none; }
.section-link { display: block; height: 100%; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
.section-link:hover { border-color: var(--line-strong); }
.section-link strong { display: block; color: var(--accent); margin-bottom: 4px; }
.section-link span { font-size: 15px; color: var(--ink-2); }

/* ---------- Question lists ---------- */
.qsit-intro { color: var(--ink-2); margin: 0 0 14px; }
.prose .qlist { list-style: none; counter-reset: q; padding: 0; margin: 0 0 8px; }
.prose .qitem { counter-increment: q; position: relative; padding: 16px 0 16px 42px; border-top: 1px solid var(--line); max-width: none; margin: 0; }
.prose .qitem:last-child { border-bottom: 1px solid var(--line); }
.qitem::before { content: counter(q); position: absolute; left: 0; top: 17px; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 14px; font-weight: 600; display: grid; place-items: center; }
.q-text { font-size: 18px; font-weight: 600; line-height: 1.45; margin: 0; }
.q-who { font-weight: 400; font-style: italic; color: var(--ink-2); }
.q-next { margin: 8px 0 0; font-size: 16px; }
.q-notes { margin-top: 8px; font-size: 15px; }
.q-notes summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 28px; display: inline-flex; align-items: center; }
.q-notes dl { margin: 6px 0 0; padding: 10px 14px; background: var(--surface-2); border-radius: var(--radius); }
.q-notes dt { font-weight: 600; margin-top: 10px; }
.q-notes dt:first-child { margin-top: 0; }
.q-notes dd { margin: 2px 0 0; }
.q-where { font-size: 14px; color: var(--ink-2); margin: 6px 0 0; }

/* ---------- Concepts ---------- */
.one-liner { font-size: 19px; margin: 0 0 16px; }
.concept-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.concept-grid h3 { margin-top: 12px; }
.where { font-size: 15px; background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; }
.prose .done-list { list-style: none; padding-left: 0; }
.done-list li { padding-left: 26px; position: relative; }
.done-list li::before { content: "✓"; position: absolute; left: 2px; color: var(--accent); font-weight: 600; }
.go-deeper { font-size: 15px; color: var(--ink-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.agenda td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); }
.agenda td strong { display: block; }

/* ---------- Copyable blocks ---------- */
.code-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 16px 0; overflow: hidden; }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; background: var(--surface-2); font-size: 14px; font-weight: 600; }
.code-card pre { margin: 0; padding: 14px; white-space: pre-wrap; font: 14px/1.6 var(--mono); }
.copy-btn { font: 600 14px var(--font); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 6px; min-height: 32px; padding: 4px 12px; cursor: pointer; }
.copy-btn:hover { border-color: var(--accent); }

/* ---------- Pager, footer, toast ---------- */
.pager { display: flex; justify-content: space-between; gap: 12px; max-width: 760px; margin-top: 56px; }
.pager a { flex: 1; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; text-decoration: none; color: var(--ink); background: var(--surface); }
.pager a:hover { border-color: var(--line-strong); }
.pager small { display: block; color: var(--ink-2); font-size: 13px; }
.pager .next { text-align: right; }
.site-footer { border-top: 1px solid var(--line); padding: 24px 20px; text-align: center; font-size: 14px; color: var(--ink-2); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 200; font-size: 15px; }
.toast.show { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .layout { grid-template-columns: 248px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 880px) {
  .layout { display: block; }
  .menu-btn { display: inline-grid; }
  .sidebar { position: fixed; top: 60px; left: 0; width: min(320px, 88vw); height: calc(100vh - 60px); background: var(--surface); z-index: 40; transform: translateX(-100%); transition: transform .2s; visibility: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  .nav-section a { min-height: 44px; }
  .content { padding: 20px 16px 56px; }
  .site-header { padding: 0 12px; }
  .prose h1 { font-size: 28px; }
  .summary { font-size: 17px; }
  .concept-grid { grid-template-columns: 1fr; }
  .prose .qitem { padding-left: 38px; }
}
@media print {
  .site-header, .sidebar, .toc, .pager, .site-footer, .copy-btn, .search, .skip-link { display: none !important; }
  .layout { display: block; } .content { padding: 0; } body { background: #fff; color: #000; font-size: 12pt; }
  .callout, .qitem, tr { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

/* ---------- Utilities ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.link-btn { background: none; border: 0; padding: 4px 2px; min-height: 28px; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.go-deeper-box { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 8px; font-size: 15px; }
.brand-short { display: none; }
@media (max-width: 420px) { .brand-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .brand-short { display: inline; } }
