/* Shared reading styles. Load after each case study's local layout styles. */
:root {
  --muted: #596574;
  --monitor: #8a580f;
  --reading-width: 65ch;
  --header-offset: 76px;
}

body {
  font-size: 18px;
  line-height: 1.7;
}

p {
  max-width: var(--reading-width);
  margin: 0 0 20px;
}

p:last-child { margin-bottom: 0; }
section, #top { scroll-margin-top: var(--header-offset); }
.shead { margin-bottom: 18px; }
.snum { flex-shrink: 0; }
h2 { line-height: 1.25; }
h3 { margin: 0 0 10px; line-height: 1.35; }
.q { line-height: 1.55; }

/* Supporting information should read comfortably alongside the main prose. */
.small, .disclose p, .qgrid div, .flist li, .callout p,
.card p, .caps p, .lims li, .aside dd, .moves li, .deep p,
.tl p, .msg, .dest, .pipe .lb, .dirtable, .nametable {
  font-size: 16px;
  line-height: 1.65;
}

.card p { margin-bottom: 16px; }
.card .ev { font-size: 16px; line-height: 1.65; }
.dirtable td:last-child { font-size: 16px; white-space: normal; }
.dest { min-height: 34px; height: auto; padding-block: 5px; }
.flist, .findings, .lims { max-width: var(--reading-width); }

/* Keep monospace for short labels; use sans-serif for explanatory captions. */
.eyebrow, .tag, .disclose .k, .snum, .qgrid div span, .callout .k,
.pipe .st, .stats .l, .card .k, .aside dt, .pair .lab,
.findings li::before, .nametable th, .moves li span, .toolgrid span,
.deep .k, .note, .tl .d, .st {
  font-size: 13px;
  letter-spacing: .04em;
}

.cap, .suite figcaption, .pair figcaption, .solo figcaption,
.diagram figcaption, .fnote {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: normal;
}

.fl, .back { font-size: 13px; }
.hero-badge { font-size: 13px; }
.fnote { color: #b4c2cf; }

/* Grids may shrink below their preferred card widths on small screens. */
.hero .wrap > *, .about > *, .annot > *, .deep > *, .trio > * {
  min-width: 0;
}

.qgrid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 228px), 1fr)); }
.cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 272px), 1fr)); }
.cards.four { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.caps { grid-template-columns: repeat(auto-fit, minmax(min(100%, 292px), 1fr)); }
.stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.toolgrid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.deep, .card, .callout, .aside, footer { overflow-wrap: anywhere; }
video { display: block; max-width: 100%; height: auto; }

/* A single Contents disclosure keeps the sticky header quiet at every width. */
.topbar .brandgroup { flex: 1; }
.contents { position: relative; flex-shrink: 0; }
.contents summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: var(--navy);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}
.contents summary::-webkit-details-marker { display: none; }
.contents summary svg { width: 14px; height: 14px; }
.contents[open] summary svg { transform: rotate(180deg); }
.contents summary:hover { background: var(--bg-alt); }

.contents .navlinks {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 280px;
  max-width: calc(100vw - 2 * var(--pad));
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(18, 40, 63, .14);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
}
.contents .navlinks a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
}
.contents .navlinks a:hover { background: var(--bg-alt); }
.contents .navlinks a[aria-current="location"] {
  background: var(--bg-alt);
  color: var(--navy);
  font-weight: 600;
}

.back { min-width: 44px; min-height: 44px; }
.brand { display: flex; align-items: center; min-height: 44px; }

a:focus-visible, button:focus-visible, summary:focus-visible, img[tabindex]:focus-visible {
  outline: 2px solid var(--navy-mid);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Inset rings stay visible inside the disclosure's scroll container. */
.contents .navlinks a:focus-visible { outline-offset: -2px; }
#lb button {
  min-width: 44px;
  min-height: 44px;
  font-size: 14px;
}
#lb button:focus-visible { outline-color: #fff; }
#lb { padding-top: 76px; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .shead { gap: 12px; margin-bottom: 16px; }
  .card, .callout { padding: 20px; }
  .pipe div { padding: 18px; }
  .caps div { padding-right: 0; }
  .brandgroup { gap: 12px; }
  .topbar .brand { display: none; }
  .back { padding-right: 0; border-right: 0; }
}
