/* =========================================================
   RED-BLUE — article-specific styles for /etc/which-button
   Layered on top of foundation.css + feed.css. Everything here is
   article-only: pictograms, sweep charts, tweet/poll cards, aphorism
   blocks, math sidenotes, the inline button glyphs.
   ========================================================= */

/* Red variant of the aphorism card for the empirics-finding line. The
   lavender variant cheers; the red variant warns. Same chrome,
   brick-coloured emphasis. */
.aphorism.aphorism-red strong {
  color: var(--brick);
}

/* Generous breathing room between the end of the piece and the start
   of the footnotes block. */
.prose > .footnotes {
  margin-top: 7em;
}

/* Tiny inline button used in prose to show what red/blue look like at
   reading scale. Used sparingly — punctuation, not refrain. */
.btn-inline {
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  vertical-align: -0.12em;
  margin: 0 0.05em;
  box-shadow:
    inset 0 -1px 0 rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.btn-inline.red {
  background: var(--brick);
}
.btn-inline.blue {
  background: var(--lavender);
}

/* Sidenote for the math-curious. The plain-English claim sits in the
   main paragraph; the formula sits here in case anyone wants to verify
   the algebra. */
.math-aside {
  font-size: 0.92em;
  color: var(--ink-mute);
  border-left: 2px solid var(--ink-mute);
  padding: 4px 0 4px 14px;
  margin: 8px 0 16px 0;
  font-style: normal;
}

/* Tim Urban's actual poll. Width-matched bars in red and blue, echoing
   the screenshot from x.com. Styled to match .figure / .tweet-card so
   it reads as a peer card, not a thin webform. */
.poll-result {
  margin: 0;
  background: var(--cream);
  border: var(--border-thin);
  box-shadow: var(--shadow-md);
  padding: 22px 26px;
  max-width: 56ch;
}
.poll-result-title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 0.875rem 0;
  color: var(--ink);
}
.poll-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}
.poll-bar-track {
  flex: 1;
  height: 40px;
  position: relative;
  background: transparent;
}
.poll-bar {
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 14px;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 2px solid var(--ink);
  box-sizing: border-box;
}
.poll-bar-red {
  background: var(--brick);
}
.poll-bar-blue {
  background: var(--lavender);
  color: #fff;
}
.poll-pct {
  width: 68px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}
.poll-meta {
  margin: 14px 0 0 0;
  font-size: 14px;
  color: var(--ink-mute);
}

/* Extra breathing room after raised/card elements before the next
   paragraph kicks in. The default .prose rhythm of 1.4em is too tight
   against the heavy borders+shadows. */
.prose > .tweet-card + *,
.prose > .figure + *,
.prose > .poll-result + *,
.prose > .sweep + *,
.prose > .aphorism + * {
  margin-top: 2.4em;
}
.prose > * + .sweep,
.prose > * + .poll-result {
  margin-top: 2.4em;
}

/* Same idea around the math-aside: the sidenote needs a clear beat
   above and below so it doesn't bleed into normal prose. */
.prose > * + .math-aside,
.prose > .math-aside + * {
  margin-top: 2em;
}

/* Intro paragraph between the tweet-card and the first h2 sits with
   too much air below (h2 default 3.3em) and not enough above
   (tweet-card rule 2.4em). Even it out so the paragraph doesn't look
   stranded against the heading. */
.prose > .tweet-card + p {
  margin-top: 2.85em;
}
.prose > .tweet-card + p + h2 {
  margin-top: 2.85em;
}

/* Match the breathing room above the tweet-card to the room below so
   the intro line, the tweet, and the next paragraph all sit in the
   same rhythm. */
.prose > * + .tweet-card {
  margin-top: 2.85em;
}

/* Lightweight phase-plane sweep that sits just before the country
   pictogram and shows where the six countries land relative to the
   phase boundary, the trap zone, and the blue-winning region.
   Chrome (cream paper, ink border, cartoon shadow) comes from the
   tile primitive in foundation.css. */
.sweep {
  --tile-shadow: var(--shadow-sm);
  padding: 22px 22px 16px 22px;
  margin: 0;
}
.sweep-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.625rem 0;
  color: var(--ink);
}
.sweep-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
}
.sweep-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-mute);
}
.sweep-legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  vertical-align: -2px;
  margin-right: 4px;
  border: 1px solid var(--ink);
}

/* Figures live in flow inside the prose. Inline SVG; never their own
   scrollbars. Chrome comes from the tile primitive in foundation.css. */
.figure {
  padding: 22px;
}
.figure-title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  letter-spacing: -0.01em;
  margin: 0 0 0.875rem;
  color: var(--ink);
  line-height: 1.2;
}
.figure-note {
  margin: 14px 0 0;
  color: var(--ink-mute);
  font-size: 13px;
  line-height: 1.6;
}
.figure-note code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--ink);
  color: var(--cream);
  padding: 1px 5px;
}

/* Single sentence pull-out used as a section refrain. Chrome
   (cream-deep paper, ink border, cartoon shadow) comes from the
   tile primitive in foundation.css. */
.aphorism {
  --tile-bg: var(--cream-deep);
  --tile-shadow: var(--shadow-sm);
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-align: center;
  padding: var(--s-4);
}
.aphorism strong {
  font-weight: inherit;
  color: var(--lavender);
}
.aphorism u {
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

/* Tweet card — Tim Urban's prompt sits at the very top of the article
   in a styled blockquote. */
.tweet-card {
  margin: 0;
  background: var(--cream);
  border: var(--border-thin);
  box-shadow: var(--shadow-md);
  padding: 22px 26px;
  position: relative;
  max-width: 56ch;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}
.tweet-card > * + * {
  margin-top: 14px;
}
.tweet-card p {
  margin: 0;
}
.tweet-card::before {
  content: '';
  position: absolute;
  top: 14px;
  right: 18px;
  width: 18px;
  height: 18px;
  background: var(--ink);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z'/></svg>")
    no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z'/></svg>")
    no-repeat center / contain;
}
.tweet-card .tweet-handle {
  display: block;
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 12px;
  font-weight: 700;
}
.tweet-card .tweet-handle .at {
  font-weight: 400;
}
.tweet-card .tweet-foot {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-mute);
}
.tweet-card .tweet-foot a {
  color: var(--lavender);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Button pictogram. Each unit is a small button (red or blue) shown as
   a circle with subtle 3D depth. Color shows what was pressed. Faded
   buttons died (blue lost in that scenario); full-saturation buttons
   survived. */
.pictogram-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
.pictogram-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
}
@media (max-width: 740px) {
  .pictogram-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 460px) {
  .pictogram-pair,
  .pictogram-grid-3 {
    grid-template-columns: 1fr;
  }
}
/* Chrome comes from the tile primitive in foundation.css. */
.pictogram-card {
  --tile-shadow: var(--shadow-sm);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pictogram-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: -0.01em;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.pictogram-card-title .flag {
  font-size: 18px;
  line-height: 1;
  position: relative;
  top: 1px;
}
.pictogram-card-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  margin: 0;
  letter-spacing: 0.04em;
}
.pictogram-readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  margin: 0;
  flex-wrap: wrap;
}
.pictogram-readout .num {
  font-size: var(--fs-h3);
  letter-spacing: -0.01em;
}
.pictogram-readout .num.alive {
  color: var(--sage);
}
.pictogram-readout .num.dead {
  color: var(--brick);
}
.pictogram-readout .label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-mute);
}

/* The button grid itself. Buttons size to fit the card width. */
.btn-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  margin: 2px 0;
}

/* Drop card chrome from in-flow figures and aphorisms — they sit in
   the column like content, no fuss, no "look at this artifact" frame.
   The tweet-card and poll-result keep their chrome since they
   represent external UI artifacts. */
.figure,
.aphorism {
  --tile-bg: transparent;
  --tile-border: none;
  --tile-shadow: none;
}
.figure,
.country-strip {
  padding: 0;
}
.aphorism {
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--ink);
  text-align: left;
  font-size: 1.5rem;
}
.aphorism strong {
  /* keep the brick emphasis for the .aphorism-red variant */
  font-weight: inherit;
}

/* Fill-in-the-blank inline. Reader gets a Mad-Libs gap to fill with
   whatever they thought the obvious answer was. */
.blank {
  display: inline-block;
  min-width: 5em;
  border-bottom: 1.5px solid var(--ink);
  margin: 0 2px;
  vertical-align: -2px;
  height: 1em;
}
.blank-wide {
  min-width: 7em;
}

/* Left-to-right hint under the country strip — Nicky Case directional
   cue. Mono, muted, centered, sits between the chart and the note. */
.strip-axis {
  margin: 10px 0 4px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}

/* Compact figure variant — caps width so a small diagram (the payoff
   matrix) doesn't stretch to the full reading column. */
.figure-compact {
  max-width: 28rem;
  margin-left: 0;
  margin-right: auto;
}
.figure-compact svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Figure widths: a cap on wide screens, full width within the column on
   phones so the matrix, memes, and charts use every pixel they can. These
   replace per-figure inline max-width (which stayed proportional and went
   tiny on mobile). */
.fig-narrow {
  max-width: 44%;
  margin-left: 0;
  margin-right: auto;
}
.fig-mid {
  max-width: 62%;
}
.fig-wide {
  max-width: 80%;
  margin-right: auto;
}
@media (max-width: 640px) {
  .fig-narrow,
  .fig-mid,
  .fig-wide {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}

/* Unified country strip: six countries in a single figure card. Each
   column gets a flag, trust readout, mini pictogram, and death count.
   No nested card chrome (the figure card holds them all). */
.country-strip {
  padding: 24px 18px 18px;
  max-width: none;
}
.country-strip-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 0;
}
.country-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  position: relative;
}
.country-col .country-head {
  font-size: var(--fs-body);
}
.country-col .btn-grid-mini {
  margin-left: 3rem;
  max-width: min(100%, 16rem);
}
.country-head {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.country-head .flag {
  font-size: 16px;
  margin-right: 4px;
  vertical-align: -2px;
}
.country-head .trust {
  color: var(--ink-mute);
}
.country-head .num.dead {
  color: var(--brick);
}
.btn-grid-mini {
  gap: 3px;
}
.country-strip-row.world-row {
  grid-template-columns: 1fr;
}
.world-row .country-col .btn-grid-mini {
  max-width: min(100%, 17rem);
}
@media (max-width: 640px) {
  .country-strip-row {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .country-col .btn-grid-mini {
    margin-left: 2rem;
  }
}

/* The button pictogram. Subtle button-affordance: top highlight,
   bottom shadow, thin ink border. Color tells you what was pressed.
   Faded buttons are dead (blue lost in their world). */
.btn-pict {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  position: relative;
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.32),
    1px 1px 0 rgba(26, 26, 26, 0.35);
  transition: transform 100ms ease;
}
.btn-pict.red {
  background: var(--brick);
}
.btn-pict.blue {
  background: var(--lavender);
}
.btn-pict.dead {
  opacity: 0.32;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  border-color: var(--ink-mute);
}

/* --- isometric country strip (delete this block to revert) - */
/* Whole grid is skewed into an isometric plane. Red buttons are
   flat pucks with thickness; blue graves stand upright, solid,
   with shadows cast on the ground. */
.btn-grid-mini {
  transform: rotateX(55deg) rotateZ(-30deg);
  transform-style: preserve-3d;
  perspective: 1200px;
  overflow: visible;
  margin: 1.5em 0;
  gap: 6px;
  position: relative;
}
.btn-grid-mini .btn-pict {
  transform-style: preserve-3d;
  position: relative;
}
.btn-grid-mini .btn-pict.red {
  border-radius: 50%;
  transform: translateZ(3px);
}
.btn-grid-mini .btn-pict.red::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brick) 70%, black);
  border: 1.5px solid var(--ink);
  transform: translateZ(-3px);
  z-index: -1;
}
.btn-grid-mini .btn-pict.blue.dead {
  border-radius: 30% 30% 2px 2px;
  opacity: 1;
  background: var(--lavender);
  border-color: var(--ink);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.32);
  transform: rotateX(-90deg) translateY(-2px);
  transform-origin: bottom center;
  transform-style: preserve-3d;
}
.btn-grid-mini .btn-pict.blue.dead::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -15%;
  width: 100%;
  height: 160%;
  background: rgba(31, 28, 25, 0.25);
  transform-origin: bottom center;
  transform: rotateX(90deg);
  border-radius: 2px;
}
/* --- end isometric ----------------------------------------- */
.btn-pict:hover {
  transform: translate(-0.5px, -0.5px);
}
