@font-face {
  font-family: Manrope;
  src: url("/media/manrope.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --charcoal: #1a1513;
  --charcoal-raised: #2d2320;
  --cream: #f4e9dc;
  --white: #fff4e8;
  --clay: #983727;
  --coral: #f6ae88;
  --muted-dark: #d5bfb1;
  --sand: #372824;
  --blush: #4b2b23;
  --paper: var(--charcoal);
  --ink: var(--cream);
  --accent: var(--coral);
  --glass: rgb(33 27 24 / 74%);
  --glass-fallback: #26201d;
  --row-tint: rgb(244 233 220 / 5%);
  --measure: 70ch;
  --page-width: 76rem;
  --page-gutter: clamp(1.125rem, 4vw, 3rem);
  --nav-row-height: 2.75rem;
  --nav-height: var(--nav-row-height);
  --nav-gap: 0.85rem;
  --contents-height: 0px;
  font-family: Manrope, "Segoe UI", sans-serif;
  color: var(--ink);
  color-scheme: dark;
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; line-height: 1.65; }
a { color: var(--accent); text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 0.14em; }
button, input { font: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { color: var(--ink); background: var(--coral); }
#guide, .reader [id] { scroll-margin-top: calc(var(--nav-height) + var(--contents-height) + var(--nav-gap)); }
.shell { width: min(100%, var(--page-width)); margin-inline: auto; padding-inline: var(--page-gutter); }
.skip { position: fixed; z-index: 10; top: 0.45rem; left: 1rem; transform: translateY(-160%); padding: 0.6rem 1rem; background: var(--charcoal-raised); }
.skip:focus { transform: none; }

.masthead, footer {
  --accent: var(--coral);
  background: var(--charcoal);
  color: var(--cream);
}
.roles-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--glass-fallback);
}
.masthead-inner {
  display: flex;
  align-items: center;
  min-height: var(--nav-row-height);
}
.footer-inner {
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
footer a { display: inline-flex; min-height: var(--nav-row-height); align-items: center; color: inherit; text-decoration: none; font-size: 0.875rem; font-weight: 700; }
footer a:hover { color: var(--coral); text-decoration: underline; }
.wordmark { display: flex; align-items: center; gap: 0.55rem; margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.04em; white-space: nowrap; }
.wordmark-number { color: var(--coral); }

main {
  background:
    radial-gradient(ellipse 38rem 29rem at 90% 8rem, rgb(143 58 30 / 46%), transparent 100%),
    radial-gradient(ellipse 44rem 27rem at 6% 28rem, rgb(107 43 34 / 34%), transparent 100%),
    radial-gradient(ellipse 36rem 26rem at 91% 48rem, rgb(114 50 28 / 25%), transparent 100%),
    var(--paper);
}
.sidebar-inner, .guide-panel {
  background: var(--glass-fallback);
}
@supports (backdrop-filter: blur(1px)) {
  .roles-bar, .sidebar-inner, .guide-panel {
    background: var(--glass);
    backdrop-filter: blur(16px);
  }
}
.guide-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.guide-tabs a {
  display: grid;
  place-items: center;
  min-height: var(--nav-row-height);
  padding: 0.25rem 0.35rem;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  line-height: 1.2;
  font-size: 0.9rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.guide-tabs a:hover { background: var(--sand); }
.guide-tabs a[aria-selected="true"] { background: var(--clay); color: var(--white); }
.guide-tabs a:focus-visible { outline-offset: -3px; }
.guide-panel { padding: clamp(1rem, 3vw, 2.25rem); }
.guide-panel + .guide-panel { margin-top: 1rem; }
.guide-panel[role="tabpanel"] { margin-top: 0; }
.reader {
  display: grid;
  grid-template-columns: minmax(13.5rem, 17rem) minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 2.5rem);
  align-items: start;
  padding-block: var(--nav-gap) 4rem;
}
.sidebar { position: sticky; top: calc(var(--nav-height) + var(--nav-gap)); min-width: 0; }
.sidebar-inner { max-height: calc(100dvh - var(--nav-height) - 2 * var(--nav-gap)); overflow-y: auto; padding: 0.5rem; scrollbar-color: var(--blush) transparent; }
.contents > summary { font-size: 1.22rem; line-height: 1.4; font-weight: 800; list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding-inline: 0.55rem; }
.contents summary::-webkit-details-marker { display: none; }
.contents > summary::after, .chapter-group > summary::after {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  flex: none;
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
  margin-right: 0.55rem;
}
.contents[open] > summary::after, .chapter-group[open] > summary::after { transform: rotate(225deg); }
.lookup { margin: 0.4rem 0.4rem 0.65rem; }
.lookup label { display: block; margin-bottom: 0.3rem; color: var(--muted-dark); font-size: 0.875rem; font-weight: 700; }
.lookup input {
  width: 100%;
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  background: var(--charcoal);
  border: 0;
  border-radius: 0;
  color: var(--ink);
  caret-color: var(--accent);
}
.lookup input::placeholder { color: var(--muted-dark); opacity: 1; }
#results { background: var(--charcoal); margin-top: 0.45rem; }
#search-status { margin: 0; padding: 0.65rem; font-size: 0.875rem; color: var(--muted-dark); }
#matches, .chapter-index, .chapter-subtopics { list-style: none; padding: 0; margin: 0; }
#matches a { display: grid; align-content: center; min-height: 44px; padding: 0.45rem 0.65rem; font-size: 0.875rem; font-weight: 700; overflow-wrap: anywhere; }
#matches small { color: var(--muted-dark); font-weight: 600; }
.chapter-index { margin-top: 0.45rem; }
.chapter-index a, .chapter-group > summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.3rem 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 700;
}
.chapter-group > summary { list-style: none; cursor: pointer; }
.chapter-group > summary::after { margin-inline-start: auto; }
.chapter-subtopics a { padding-inline-start: 2.45rem; }
.chapter-index span, .chapter-heading > span { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 800; }
.chapter-index a:hover, .chapter-group > summary:hover, #matches a:hover { background: var(--sand); }
.chapter-index a[aria-current], .chapter-group[data-active] > summary { color: var(--accent); background: var(--blush); }

.articles { min-width: 0; }
.chapter:not([hidden]) + .chapter:not([hidden]) { margin-top: clamp(3.5rem, 8vw, 6rem); }
.chapter:focus-visible { outline: none; }
.chapter:focus-visible .chapter-heading h3 { color: var(--accent); }
.chapter-heading { display: flex; align-items: baseline; gap: clamp(0.65rem, 2vw, 1.15rem); }
.chapter-heading > span { font-size: 1rem; }
.chapter-heading :is(h2, h3) { font-size: clamp(1.55rem, 3.3vw, 2.55rem); line-height: 1.13; letter-spacing: -0.037em; margin: 0; text-wrap: balance; }
.chapter h4 { margin: 1.6rem 0 0.5rem; font-size: 1.05rem; line-height: 1.35; }
.chapter .chapter-heading h3 { font-size: clamp(1.4rem, 2.8vw, 2rem); }
.chapter p { margin: 0.7rem 0 1rem; }
.chapter .lead { color: var(--muted-dark); margin-block: 0.9rem 1.3rem; font-size: 1.075rem; }
.chapter p, .chapter > ul, .chapter > ol, .chapter blockquote { max-width: var(--measure); }
.chapter ul, .chapter ol { margin: 0.5rem 0 1rem; padding-inline-start: 1.3rem; }
.chapter li + li { margin-top: 0.5rem; }
.chapter li::marker { color: var(--accent); }
.chapter blockquote { margin: 1.45rem 0; padding: 1rem 1.15rem; background: var(--blush); font-weight: 750; }
.chapter .mistake { margin-top: 0.95rem; padding: 0.65rem .8rem; background: var(--blush); }
.mistake strong { color: var(--accent); }
.playbook-table { width: 100%; table-layout: fixed; border-collapse: collapse; margin-block: 1rem; }
.situation-col { width: 35%; }
.playbook-table :is(td, th) { overflow-wrap: anywhere; padding: 0.7rem 0.85rem; text-align: left; vertical-align: top; }
.playbook-table thead { background: var(--clay); color: var(--white); }
.playbook-table tbody tr:nth-child(odd) { background: var(--row-tint); }
.playbook-table tbody th { font-weight: 750; }
.playbook-table td strong { color: var(--accent); }
.playbook-table td span { display: block; }
.playbook-table td span + span { margin-top: 0.25rem; }
.purchase-tip { margin-top: 0.55rem; color: var(--muted-dark); }
.chapter .purchase-tip ul { margin: 0.1rem 0 0; padding-inline-start: 1.15rem; }
.chapter .purchase-tip li + li { margin-top: 0.2rem; }
.decision-step { margin-top: 1.65rem; }
.decision-step h4 { margin: 0 0 0.55rem; }
.decision-step p { margin: 0 0 0.6rem; color: var(--muted-dark); }
.decision-step .decision-fallback { margin: 0.6rem 0 0; }
.decision-step .playbook-table { margin-block: 0; }
footer { padding-block: 0.55rem; }
.footer-inner > span { color: var(--muted-dark); font-size: 0.875rem; }

@media (min-width: 80rem) {
  :root { --page-width: 88rem; }
  .playbook-table td > span, .playbook-table .purchase-tip { max-width: var(--measure); }
}

@media (max-width: 54rem) {
  .reader { grid-template-columns: minmax(0, 1fr); gap: 0.8rem; }
  .sidebar { position: static; }
  .sidebar-inner { max-height: none; overflow: visible; }
  .guide-ready { --contents-height: var(--nav-row-height); }
  .guide-ready .sidebar { position: sticky; top: var(--nav-height); z-index: 4; height: var(--contents-height); }
  .guide-ready .sidebar-inner {
    position: absolute;
    inset: 0 0 auto;
    max-height: min(75dvh, calc(100dvh - var(--nav-height)));
    overflow-y: auto;
    padding: 0;
  }
  .guide-ready .contents > summary {
    position: sticky;
    top: 0;
    z-index: 1;
    min-height: var(--contents-height);
    padding-inline: 0.85rem;
    background: var(--glass-fallback);
    font-size: 1rem;
  }
}

@media (max-width: 47rem) {
  .guide-tabs {
    grid-template-columns: repeat(3, minmax(max-content, 1fr)) repeat(2, minmax(0, 1.18fr));
  }
  .guide-tabs a { font-size: 0.8rem; padding-inline: 0.2rem; }
  .guide-tabs a:nth-child(-n + 3) { white-space: nowrap; }
}

@media (max-width: 38rem) {
  .playbook-table { font-size: 0.9rem; line-height: 1.5; }
  .playbook-table :is(td, th) { padding: 0.6rem 0.45rem; }
}

@media (max-width: 27rem) {
  .playbook-table,
  .playbook-table tbody,
  .playbook-table tbody tr,
  .playbook-table tbody :is(th, td) { display: block; }
  .playbook-table colgroup { display: none; }
  .playbook-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .playbook-table tbody th { padding: 0.7rem 0.7rem 0.2rem; }
  .playbook-table tbody td { padding: 0.15rem 0.7rem 0.7rem; }
}
