/* A report's card deck: full-screen cards to swipe through. Each card kind has
   its own layout. Colors and type come from the report's own theme (set inline
   as --stage, --paper, --ink, --accent, --on-accent, --highlight and the
   --display-face, --text-face and --ui-face font stacks). Text scales with --fs (the reader's size setting) through em. Swiping
   is native scroll-snap, so the deck works before any script runs. */
:root {
  --stage: #111111;
  --paper: #f5f3ee;
  --ink: #141414;
  --accent: #cc0000;
  --on-accent: #ffffff;
  --fs: 1;
  /* headings grow with the reader's size setting, but less than body text */
  --hsr: calc((1 + (var(--fs) - 1) * 0.4) / var(--fs));
  --bar: 52px;
  --nav: 68px;
  --gx: clamp(20px, 6vw, 44px);
  --highlight: #ffcc00;
  --display-face: Impact, "Arial Narrow Bold", sans-serif;
  --text-face: Georgia, serif;
  --ui-face: system-ui, -apple-system, "Segoe UI", sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  background: var(--stage);
  color: #fff;
  overscroll-behavior: none;
}
body {
  font-family: var(--text-face);
  -webkit-text-size-adjust: 100%;
}
a {
  color: inherit;
}
.deck-bar {
  position: fixed;
  z-index: 5;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: calc(var(--bar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0
    max(12px, env(safe-area-inset-left));
  font: 600 13px/1 var(--ui-face);
  color: #fff;
  background: linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.deck-bar > * {
  pointer-events: auto;
}
.deck-close {
  padding: 9px 12px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}
.deck-count {
  margin-inline: auto;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}
.deck-size {
  display: flex;
  gap: 6px;
}
.deck-size button,
.deck-nav button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  font: 700 15px/1 var(--ui-face);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.deck-size button:disabled,
.deck-nav button:disabled {
  opacity: 0.35;
  cursor: default;
}
.deck-size button:focus-visible,
.deck-nav button:focus-visible,
.deck-close:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 2px;
}
.deck-progress {
  position: fixed;
  z-index: 5;
  inset: calc(env(safe-area-inset-top) + 0px) 0 auto 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
}
.deck-progress i {
  display: block;
  height: 100%;
  background: var(--highlight);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.deck-nav {
  position: fixed;
  z-index: 5;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 max(14px, env(safe-area-inset-right))
    calc(12px + env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  pointer-events: none;
}
.deck-nav button {
  pointer-events: auto;
  font-size: 22px;
}
.deck-nav[hidden] {
  display: none;
}
.deck-hint {
  position: fixed;
  z-index: 4;
  inset: auto 0 calc(22px + env(safe-area-inset-bottom)) 0;
  text-align: center;
  font: 600 12px/1 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
  transition: opacity 0.3s;
}
.deck-hint.is-gone {
  opacity: 0;
}
.deck {
  position: fixed;
  inset: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  font-size: calc(17px * var(--fs));
}
.deck::-webkit-scrollbar {
  display: none;
}
.deck:focus {
  outline: none;
}
.card {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: var(--paper);
  color: var(--ink);
}
.card--dark {
  background: var(--stage);
  color: #fff;
}
.card--accent {
  background: var(--accent);
  color: var(--on-accent);
}
.card__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.card__media img,
.card__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(0, 0, 0, 0.3),
    rgba(0, 0, 0, 0.55) 50%,
    rgba(0, 0, 0, 0.86)
  );
}
.card__in {
  position: relative;
  margin: auto;
  width: 100%;
  max-width: 34em;
  padding: calc(var(--bar) + env(safe-area-inset-top) + 18px) var(--gx)
    calc(var(--nav) + env(safe-area-inset-bottom) + 34px);
}
.card__foot {
  position: sticky;
  bottom: 0;
  flex: none;
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 28px 12px calc(var(--nav) + env(safe-area-inset-bottom) - 6px);
  background: linear-gradient(transparent, var(--foot-bg, var(--paper)) 42%);
  font: 600 0.72em/1.2 var(--ui-face);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}
.card__foot a {
  padding: 8px 4px;
  pointer-events: auto;
  opacity: 0.85;
}
.card--dark {
  --foot-bg: var(--stage);
}
.card--accent {
  --foot-bg: var(--accent);
}
.card__in:has(+ .card__foot) {
  padding-bottom: 8px;
}
.kick {
  margin: 0 0 0.9em;
  font: 700 0.72em/1.2 var(--ui-face);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.card--dark .kick,
.card--accent .kick {
  color: var(--highlight);
}
.display {
  font-family: var(--display-face);
  font-weight: 400;
  line-height: 0.98;
  font-weight: 800;
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* cover */
.card--cover .card__in {
  text-align: left;
}
.card--cover .display {
  text-transform: uppercase;
  font-weight: 900;
  margin: 0 0 0.35em;
  font-size: calc(clamp(2em, 9.2vw, 3.6em) * var(--hsr));
}
.card--cover .byline {
  margin: 0;
  font: 600 0.8em/1.4 var(--ui-face);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.9;
}

/* chapter */
.card--chapter .num {
  margin: 0 0 0.1em;
  font: 900 clamp(4.5em, 30vw, 9em) / 0.9 var(--display-face);
  color: var(--highlight);
  opacity: 0.95;
}
.card--chapter .display {
  margin: 0 0 0.5em;
  font-size: calc(clamp(2.2em, 11vw, 3.8em) * var(--hsr));
}
.card--chapter p.lede {
  margin: 0;
  font-size: 1.12em;
  line-height: 1.5;
  opacity: 0.94;
}

/* text */
.card--text h2 {
  margin: 0 0 0.7em;
  font: 700 0.78em/1.25 var(--ui-face);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.card--text .body p {
  margin: 0 0 1em;
  font-size: 1.16em;
  line-height: 1.55;
}
.card--text .body p:first-child::first-letter {
  float: left;
  margin: 0.06em 0.09em 0 0;
  font: 900 3.5em/0.8 var(--display-face);
  color: var(--accent);
}

/* stat */
.card--stat .value {
  margin: 0 0 0.12em;
  color: var(--highlight);
  font-family: var(--display-face);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0.005em;
  /* as big as the card's width allows, however large the reader's text size */
  font-size: min(
    calc(150px * var(--fs)),
    calc((100vw - 2 * var(--gx)) / (var(--len, 6) * 0.68 + 0.3))
  );
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.card--stat .label {
  margin: 0 0 1em;
  font: 700 1.28em/1.3 var(--ui-face);
  text-wrap: balance;
}
.card--stat .sentence {
  margin: 0;
  padding-top: 1em;
  border-top: 2px solid currentColor;
  font-size: 1.02em;
  line-height: 1.5;
  opacity: 0.94;
}
.card--stat mark {
  padding: 0 0.12em;
  background: rgba(255, 255, 255, 0.28);
  color: inherit;
  border-radius: 2px;
}

/* bars */
.card--bars h2 {
  margin: 0 0 0.25em;
  font-size: calc(clamp(1.7em, 8vw, 2.5em) * var(--hsr));
}
.card--bars .caption {
  margin: 0 0 1.3em;
  font-size: 0.98em;
  line-height: 1.45;
  opacity: 0.8;
}
.bars {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1em;
}
.bars li {
  display: grid;
  gap: 0.3em;
}
.bars .l {
  font: 600 0.9em/1.3 var(--ui-face);
}
.bars .t {
  display: flex;
  align-items: center;
  gap: 0.7em;
}
.bars .b {
  flex: 1;
  height: 1.05em;
  background: rgba(0, 0, 0, 0.09);
  border-radius: 2px;
  overflow: hidden;
}
.bars .b i {
  display: block;
  height: 100%;
  width: calc(var(--w) * 100%);
  background: var(--accent);
  transform-origin: left;
}
.js .card--bars:not(.is-active) .b i {
  transform: scaleX(0);
}
.js .card--bars .b i {
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bars .d {
  min-width: 4.4em;
  font: 700 0.95em/1.1 var(--ui-face);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.card--bars .src {
  margin: 1.4em 0 0;
  font: 0.8em/1.4 var(--ui-face);
  opacity: 0.65;
}

/* quote */
.card--quote .mark {
  margin: 0 0 -0.25em;
  font: 900 6.5em/0.7 var(--display-face);
  color: var(--highlight);
}
.card--quote blockquote {
  margin: 0 0 1.2em;
  font-family: var(--display-face);
  font-weight: 800;
  line-height: 1.28;
  text-wrap: pretty;
  font-size: clamp(1.35em, 6.6vw, 2.1em);
}
.card--quote.is-long blockquote {
  font-family: var(--text-face);
  font-weight: 500;
  font-size: clamp(1.1em, 5vw, 1.5em);
  line-height: 1.4;
}
.card--quote .who {
  margin: 0;
  font: 700 0.86em/1.4 var(--ui-face);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--highlight);
}
.card--quote .ctx {
  display: block;
  margin-top: 0.3em;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #fff;
  opacity: 0.8;
}

/* figure */
.card--figure figure {
  margin: 0;
}
.card--figure img {
  display: block;
  width: 100%;
  max-height: 56dvh;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.06);
}
.card--figure figcaption {
  margin-top: 1em;
  font-size: 1.02em;
  line-height: 1.45;
}
.card--figure .credit {
  display: block;
  margin-top: 0.5em;
  font: 0.8em/1.4 var(--ui-face);
  opacity: 0.65;
}

/* list */
.card--list h2 {
  margin: 0 0 0.8em;
  font-size: calc(clamp(1.7em, 8vw, 2.5em) * var(--hsr));
}
.items {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.9em;
}
.items li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.9em;
  align-items: center;
  padding-bottom: 0.9em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.14);
}
.items li:not(:has(img)) {
  grid-template-columns: 1fr;
}
.items img {
  width: 3.6em;
  height: 3.6em;
  border-radius: 50%;
  object-fit: cover;
}
.items b {
  display: block;
  font: 700 1em/1.3 var(--ui-face);
}
.items span {
  display: block;
  margin-top: 0.15em;
  font-size: 0.92em;
  line-height: 1.4;
  opacity: 0.85;
}

/* the last card */
.card--end h2 {
  margin: 0 0 0.6em;
  font-size: calc(clamp(2em, 10vw, 3.2em) * var(--hsr));
}
.end-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.7em;
}
.end-links a {
  display: block;
  padding: 0.95em 1.1em;
  font: 700 0.98em/1.3 var(--ui-face);
  text-decoration: none;
  border: 2px solid currentColor;
  border-radius: 6px;
}
.end-links a:first-child {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* wide screens: the card stays a card */
@media (min-width: 900px) {
  .card__in {
    max-width: 40em;
  }
  .deck-hint {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .deck-progress i,
  .js .card--bars .b i {
    transition: none;
  }
}

/* tablets: larger type and a wider column, since the card is bigger than a phone's */
@media (min-width: 600px) {
  .deck {
    font-size: calc(21px * var(--fs));
  }
  .card__in {
    max-width: 36em;
  }
  .card--cover .card__in {
    max-width: 40em;
  }
  .card--cover .display {
    overflow-wrap: normal;
  }
}
