@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/ibm-plex-sans-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
}

:root {
  --display: 'Space Grotesk', Arial, sans-serif;
  --text: 'IBM Plex Sans', Arial, sans-serif;
  --chrome-title: Georgia, 'Times New Roman', serif;
  --chrome-text: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.ky-top, .ky-foot, .ky-page {
  --ky-serif: var(--chrome-title);
  --ky-sans: var(--chrome-text);
}

.story-page {
  --ink: #2a2927;
  --muted: #59574f;
  --olive: #424835;
  --accent: #454c30;
  --paper: #fffefb;
  --wash: #ededdf;
  --soft: #f3f2ef;
  --inverse: #fffdf8;
  --line: #8b8d79;
  --pale: #c9cbb7;
  --rule: var(--line);
  --edge: #77716c;
  --gradient: linear-gradient(135deg, var(--ink), var(--olive));
  --radius: .2rem;
  --sans: var(--text);
  --s1: .25rem;
  --s2: .5rem;
  --s3: .75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;
  --xs: var(--s1);
  --sm: var(--s2);
  --md: var(--s3);
  --gap: var(--s4);
  --lg: var(--s5);
  --xl: var(--s6);
  --xxl: var(--s7);
  --utility: 1rem;
  --target: 2.75rem;
  --gutter: clamp(var(--s4), 4vw, var(--s6));
  --reading: 68ch;
  --body: clamp(1.0625rem, 1.03rem + .16vw, 1.1875rem);
  --title: clamp(2rem, 1.35rem + 2.55vw, 3.375rem);
  --section: clamp(1.625rem, 1.42rem + .85vw, 2.125rem);
  --subhead: clamp(1.1875rem, 1.1rem + .35vw, 1.375rem);
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 400 var(--body)/1.68 var(--text);
}

.story-page *, .story-page *::before, .story-page *::after { box-sizing: border-box; }
.story-page :where(a, main, [tabindex]):focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.story-page .skip-link {
  position: absolute;
  z-index: 2;
  inset-block-start: 0;
  inset-inline-start: var(--gutter);
  transform: translateY(-120%);
  min-block-size: var(--target);
  padding: var(--md) var(--gap);
  background: var(--paper);
  color: var(--accent);
  font-size: var(--utility);
}
.story-page .skip-link:focus { transform: none; outline-offset: -3px; }

.story {
  inline-size: min(100% - 2 * var(--gutter), var(--reading));
  container-type: inline-size;
  margin-inline: auto;
  padding-block: clamp(var(--s5), 5vw, var(--s8)) var(--s8);
  overflow-wrap: break-word;
}
.story :where(h1, h2, h3, p, figure, ul, ol, dl, dd) { margin: 0; }
.story :where(h1, h2, h3) { font-family: var(--display); font-weight: 700; }
.story h1 { font-size: var(--title); line-height: 1.07; letter-spacing: -.034em; }
.story h2 { font-size: var(--section); line-height: 1.16; letter-spacing: -.023em; margin-block: var(--s7) var(--s3); }
.story h3 { font-size: var(--subhead); line-height: 1.25; margin-block: var(--s5) var(--s2); }
.story p + p { margin-block-start: var(--s4); }
.story a { color: var(--accent); font-weight: 600; text-underline-offset: .18em; }
.story a:is(:hover, :active) { color: var(--ink); text-decoration-thickness: 2px; }

.story .section-link { margin-block-end: var(--s2); }
.story :where(.section-link, .byline a, .author-name a) {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target);
  min-inline-size: var(--target);
}
.story :where(.byline, .section-link, .author-name) { font-size: var(--utility); }
.story .byline { margin-block: var(--s2) var(--s4); color: var(--muted); }
.story .byline time { white-space: nowrap; }
.story :where(.intro, .pre-photo, .lede, .answer) { margin-block-start: var(--s4); }
.story .intro .lede { margin-block-start: 0; }
.story .answer { border-block-start: 2px solid var(--accent); padding-block-start: var(--s3); }
.story .answer h2 { margin-block: 0 var(--s2); font-size: var(--utility); color: var(--accent); }
.story :where(.lead-photo, .post-figure, .vis, .graphic) { margin-block: var(--s5); }
.story :where(.lead-photo, .post-figure) img { display: block; width: 100%; height: auto; }
.story .post-figure figcaption { margin-block-start: var(--s3); color: var(--muted); font-size: var(--utility); }
.story .faq-item { border-block-start: 1px solid var(--pale); padding-block: var(--s4); }
.story .faq-item h3 { margin-block: 0 var(--s2); color: var(--accent); }
.story .author-card {
  display: grid;
  grid-template-columns: minmax(0, 5rem) minmax(0, 1fr);
  gap: var(--s4);
  align-items: start;
  margin-block-start: var(--s7);
  padding: var(--s4);
  background: var(--soft);
  border-block-start: 2px solid var(--accent);
}
.story .author-card img { display: block; width: 100%; height: auto; }
.story .author-name { margin-block: 0 var(--s2); }
.story .closing { margin-block-start: var(--s7); border-block-start: 1px solid var(--pale); padding-block-start: var(--s4); }
.story .closing-label { font-weight: 600; }

.story-page .story :is(.data-scroll, .vis-table) {
  overflow-x: auto;
  border-inline: 0;
  border-radius: 0;
}
.story-page .story :is(.data-scroll, .vis-table) table {
  inline-size: 100%;
  min-inline-size: 30rem;
  table-layout: fixed;
}
.story-page .story :is(.table-wide, .vis-table-wide) table { min-inline-size: 40rem; }
.story-page .story :is(.data-scroll, .vis-table) :is(th, td) {
  overflow-wrap: break-word;
  padding-inline: var(--s2);
}
.story-page .story :is(.data-scroll, .vis-table) tr > :first-child {
  position: sticky;
  inset-inline-start: 0;
  inline-size: 6.5rem;
  background: var(--paper);
  color: var(--ink);
  border-inline-end: 1px solid var(--line);
}
.story-page .story :is(.data-scroll, .vis-table) tbody tr:nth-child(even) > :first-child { background: var(--wash); }
.story-page .story :is(.data-scroll, .vis-table) thead tr > :first-child { background: var(--olive); color: var(--inverse); }
.story-page .story .table-hint { display: none; }
.story-page .story :is(.data-scroll, .vis-table)::before {
  position: sticky;
  inset-inline-start: 0;
  inline-size: 100%;
  text-align: center;
  color: var(--accent);
  background: var(--wash);
  font-weight: 600;
}

@container (max-width: 39.999rem) {
  .story-page .story :is(.table-wide, .vis-table-wide)::before { content: '↔'; display: block; }
  .story-page .story .table-hint { display: block; }
  .story-page .story .table-hint + .vis-table::before { content: none; }
}

@container (max-width: 29.999rem) {
  .story-page .story :is(.data-scroll, .vis-table)::before { content: '↔'; display: block; }
}
