/* Self-contained: system fonts only, no network resources. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5b6370;
  --rule: #e3e0d8;
  --accent: #1f6f5c;
  --accent-soft: #e4f1ec;
  --badge-bg: #fff1d6;
  --badge-text: #7a4b00;
  --code-bg: #f3f1ec;
  --measure: 70ch;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1c1f23;
    --text: #e6e3dc;
    --muted: #a3a9b2;
    --rule: #33373d;
    --accent: #6fcfb2;
    --accent-soft: #1d332c;
    --badge-bg: #3d2f12;
    --badge-text: #f5cf86;
    --code-bg: #22262b;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

/* ---------- layout: mobile first ---------- */

.layout {
  display: block;
}

main {
  padding: 0 1.1rem 3rem;
  max-width: calc(var(--measure) + 2.2rem);
  margin: 0 auto;
  min-width: 0;
}

/* table of contents: on top for narrow screens */
.toc {
  border-bottom: 1px solid var(--rule);
  padding: 1rem 1.1rem 0.75rem;
  max-width: calc(var(--measure) + 2.2rem);
  margin: 0 auto;
  font-size: 0.95rem;
  line-height: 1.4;
}

.toc-title {
  margin: 0 0 0.4rem;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding-left: 1.9rem;
}

.toc li {
  margin: 0.28rem 0;
}

.toc li::marker {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.toc a {
  text-decoration: none;
  color: var(--text);
}
.toc a:hover,
.toc a:focus {
  color: var(--accent);
  text-decoration: underline;
}

.toc .toc-divider {
  list-style: none;
  margin: 0.8rem 0 0.3rem -1.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc .badge {
  font-size: 0.68rem;
}

@media (min-width: 1040px) {
  .layout {
    display: grid;
    grid-template-columns: 18rem minmax(0, 1fr);
    gap: 2.5rem;
    max-width: 78rem;
    margin: 0 auto;
    padding: 0 1.5rem;
  }

  .toc {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    border-bottom: 0;
    border-right: 1px solid var(--rule);
    padding: 2rem 1.25rem 2rem 0;
    margin: 0;
  }

  main {
    margin: 0;
    padding: 0 0 4rem;
  }
}

/* ---------- hero ---------- */

.hero {
  padding: 2.25rem 0 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.kicker {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero h1 {
  font-size: clamp(2rem, 7vw, 2.9rem);
  line-height: 1.12;
  margin: 0.35rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 1.2rem;
  line-height: 1.45;
  margin: 0 0 0.75rem;
}

.byline {
  color: var(--muted);
  margin: 0 0 1rem;
}

.lead {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--accent-soft);
  border-radius: 0.5rem;
}

.hero-links {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-links a {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  font-size: 0.92rem;
}

.hero-links a.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

/* ---------- sections ---------- */

.slide {
  padding: 2rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}

.hero {
  scroll-margin-top: 1rem;
}

.slide h2 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 1rem;
}

.slide h2 .num {
  display: inline-block;
  margin-right: 0.35em;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.slide h3 {
  font-size: 1.15rem;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

.slide ul,
.slide ol {
  padding-left: 1.4rem;
}

.slide li {
  margin: 0.3rem 0;
}

.badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
  white-space: nowrap;
}

.slide.proposed {
  border-left: 3px solid var(--badge-bg);
  padding-left: 0.9rem;
  margin-left: -0.9rem;
}

@media (max-width: 480px) {
  .slide.proposed {
    margin-left: -0.6rem;
    padding-left: 0.6rem;
  }
}

/* diagrams */
.pre-wrap {
  margin: 0 0 1rem;
}

pre {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  font-size: 0.86rem;
  line-height: 1.45;
  -webkit-overflow-scrolling: touch;
}

code,
pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono",
    monospace;
}

:not(pre) > code {
  background: var(--code-bg);
  padding: 0.05em 0.3em;
  border-radius: 0.25em;
  font-size: 0.92em;
}

/* tables */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 1rem;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.93rem;
  line-height: 1.45;
  background: var(--surface);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--rule);
}

thead th {
  background: var(--code-bg);
  font-weight: 600;
}

tbody th {
  font-weight: 600;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

/* speaker notes */
details.notes {
  margin: 0.5rem 0 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  background: var(--surface);
}

details.notes summary {
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  font-weight: 600;
  color: var(--accent);
  list-style-position: inside;
}

details.notes[open] summary {
  border-bottom: 1px solid var(--rule);
}

details.notes p {
  margin: 0.75rem 0.9rem;
  color: var(--text);
}

/* company layer divider */
.layer-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2.5rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.layer-divider::before,
.layer-divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--rule);
}

/* footer */
footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 1.1rem 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

footer p {
  margin: 0.25rem 0;
}

/* back to TOC on narrow screens */
.to-top {
  position: fixed;
  right: 0.9rem;
  bottom: 0.9rem;
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--rule);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
  text-decoration: none;
  font-size: 1.2rem;
}

@media (max-width: 480px) {
  pre {
    font-size: 0.78rem;
    padding: 0.75rem 0.8rem;
  }
}

@media (min-width: 1040px) {
  .to-top {
    display: none;
  }
}

@media print {
  .toc,
  .to-top {
    display: none;
  }
  details.notes {
    border: 0;
  }
}

/* the contents: collapsed on narrow screens, always open on wide ones */
.toc-details > summary.toc-title {
  cursor: pointer;
  list-style: none;
}
.toc-details > summary.toc-title::before {
  content: "▸ ";
}
.toc-details[open] > summary.toc-title::before {
  content: "▾ ";
}
@media (min-width: 1040px) {
  .toc-details > summary.toc-title {
    pointer-events: none;
  }
  .toc-details > summary.toc-title::before {
    content: "";
  }
}
.toc-details > summary.toc-title::-webkit-details-marker {
  display: none;
}
@media (min-width: 1040px) {
  .toc-details[open] > summary.toc-title::before {
    content: "";
  }
}
