body { background: #000; }

  /* ============================================================
     The media stage, video and photographs living behind the copy.
     Plain compositing only: opacity fades, static CSS filter.
     No blend modes, no backdrop-filter, no WebGL. It must run on
     a three-year-old phone without warming it.
     ============================================================ */
  #media {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #000;
    overflow: hidden;
  }
  #media .layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.4s ease;
  }
  #media .layer.on { opacity: 1; }
  #media .layer video,
  #media .layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* documentary grade */
    filter: grayscale(0.32) brightness(0.5) contrast(1.07) sepia(0.06);
  }
  /* slow push-in on stills while they're live */
  @media (prefers-reduced-motion: no-preference) {
    #media .layer img {
      transform: scale(1.04);
      transition: transform 14s linear;
    }
    #media .layer.on img { transform: scale(1.13); }
  }

  /* legibility scrims, static gradients, cheap */
  .veil {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
      radial-gradient(120% 90% at 50% 42%, transparent 30%, rgba(0, 0, 0, 0.62) 100%),
      linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.12) 18%, rgba(0, 0, 0, 0.12) 72%, rgba(0, 0, 0, 0.66) 100%);
  }
  /* static grain, normal blending, barely-there */
  .grain-static {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  }

  /* the rolling film credit for whatever is on screen */
  #media-credit {
    position: fixed;
    right: clamp(0.9rem, 3vw, 1.6rem);
    bottom: 0.8rem;
    z-index: 20;
    max-width: 17rem;
    text-align: right;
    font-family: var(--sans);
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    line-height: 1.5;
    color: rgba(232, 228, 220, 0.42);
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
  }
  #media-credit.on { opacity: 1; }

  .topscrim {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 110px;
    z-index: 25;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0) 100%);
  }
  .topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 30;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem clamp(1rem, 4vw, 2.2rem);
  }
  .topnav .wordmark { font-size: 1.05rem; text-shadow: 0 1px 16px rgba(0, 0, 0, 0.92), 0 0 3px rgba(0, 0, 0, 0.75); }
  .topnav .links {
    display: flex;
    align-items: baseline;
    white-space: nowrap;
    column-gap: clamp(0.7rem, 2.2vw, 1.5rem);
  }
  .topnav .links a, .topnav #sound-toggle {
    font-family: var(--sans);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--white);
    text-shadow: 0 1px 16px rgba(0, 0, 0, 0.92), 0 0 3px rgba(0, 0, 0, 0.75);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
  }
  .topnav .links a:hover, .topnav #sound-toggle:hover { opacity: 0.6; }
  /* sound: a small icon, not a label, minimal presence */
  .topnav #sound-toggle {
    display: inline-flex;
    align-items: center;
    align-self: center;
    color: var(--grey);
    transition: color 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
  }
  .topnav #sound-toggle:hover { color: var(--white); opacity: 1; }
  .topnav #sound-toggle svg { display: block; }
  .topnav #sound-toggle .ic-on { display: none; }
  .topnav #sound-toggle[aria-pressed='true'] { color: var(--blood-bright); }
  .topnav #sound-toggle[aria-pressed='true'] .ic-on { display: block; }
  .topnav #sound-toggle[aria-pressed='true'] .ic-muted { display: none; }
  @media (max-width: 600px) {
    .topnav {
      align-items: center;
      gap: 0.5rem;
      padding: 0.85rem 1rem;
    }
    .topnav .links { column-gap: 0.85rem; flex-wrap: wrap; row-gap: 0.45rem; white-space: normal; }
    .topnav .links a, .topnav #sound-toggle { font-size: 0.58rem; letter-spacing: 0.1em; }
  }

  main { position: relative; z-index: 10; }

  /* ---- flying wordmark ----
     At the top of the page there is no logo in the nav; the big hero
     mark IS the logo. As you scroll it flies up into the nav's
     top-left slot and docks there. The nav wordmark and the hero
     mark stay in the document as invisible sizers / fallbacks. */
  #fly-logo {
    display: none;
    position: fixed;
    left: 0; top: 0;
    z-index: 31;
    font-family: var(--serif);
    font-size: clamp(2.6rem, 11vw, 5.2rem);
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--white);
    white-space: nowrap;
    text-shadow: 0 2px 30px rgba(0, 0, 0, 0.9);
    transform-origin: 0 0;
    will-change: transform;
    pointer-events: none;
    cursor: default;
  }
  /* only a link once it has docked into the nav, we're already on the homepage */
  #fly-logo.docked { pointer-events: auto; cursor: pointer; }
  #fly-logo.docked:hover { opacity: 0.85; }
  .logofly #fly-logo { display: block; }
  .logofly .topnav .wordmark { visibility: hidden; }
  .logofly .hero .mark { visibility: hidden; }

  /* ---- hero ---- */
  .hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem var(--gutter);
  }
  .hero .mark {
    font-family: var(--serif);
    font-size: clamp(2.6rem, 11vw, 5.2rem);
    letter-spacing: -0.02em;
    color: var(--white);
    line-height: 1;
    text-shadow: 0 2px 30px rgba(0, 0, 0, 0.9);
  }
  .hero .mark .dot { color: var(--blood-bright); }
  /* the dot beats like a heart, lub-dub, then rest */
  @media (prefers-reduced-motion: no-preference) {
    .hero .mark .dot, #fly-logo .dot {
      display: inline-block;
      transform-origin: 50% 60%;
      animation: heartbeat 1.25s ease-in-out infinite;
    }
  }
  @keyframes heartbeat {
    0%, 48%, 100% { transform: scale(1); }
    10% { transform: scale(1.22); }
    22% { transform: scale(1); }
    32% { transform: scale(1.14); }
  }
  .hero .hero-line {
    margin-top: 2rem;
    font-family: var(--serif);
    font-size: clamp(1.1rem, 2.8vw, 1.5rem);
    line-height: 1.5;
    color: var(--bone);
    max-width: 34rem;
    text-wrap: balance;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  }
  .hero .hero-scroll {
    margin-top: 3rem;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--grey);
  }
  .hero .hero-arrow { display: block; margin-top: 0.7rem; font-size: 1rem; }
  @media (prefers-reduced-motion: no-preference) {
    .hero .hero-arrow { animation: bob 2.4s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
  }
  @keyframes bob {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(8px); opacity: 1; }
  }

  /* ---- beats ---- */
  .beat {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 14vh var(--gutter);
    position: relative;
  }
  .beat.tall { min-height: 160vh; }
  .beat .panel { max-width: 40rem; width: 100%; }
  .beat .kicker { margin-bottom: 1.1rem; }
  .beat .panel :where(h2, p, .kicker, .cite, .counter, .counter-label) {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 2px 28px rgba(0, 0, 0, 0.75);
  }
  .beat .kicker.blood { color: var(--blood-bright); }
  .beat h2 {
    font-size: clamp(2.1rem, 6vw, 4rem);
    line-height: 1.03;
    margin-bottom: 1.2rem;
    text-wrap: balance;
  }
  .beat p {
    font-size: clamp(1.05rem, 2.1vw, 1.3rem);
    line-height: 1.58;
    color: var(--bone);
    margin-bottom: 1rem;
    text-wrap: pretty;
  }
  .beat p strong { color: var(--white); font-weight: 600; }
  .beat .small {
    font-size: 0.98rem;
    color: #b6b2aa;
    line-height: 1.65;
  }

  .beat .mega {
    margin-top: 2rem;
    border-top: 2px solid var(--blood-bright);
    padding-top: 1.2rem;
    font-family: var(--serif);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    line-height: 1.42;
    color: var(--white);
  }
  .beat .mega strong { color: var(--blood-bright); font-weight: 600; }

  .cite {
    display: block;
    margin-top: 1.6rem;
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.9;
    text-transform: uppercase;
    color: rgba(232, 228, 220, 0.6);
  }
  .cite::before {
    content: 'Source: ';
    font-weight: 700;
    letter-spacing: 0.2em;
    color: rgba(232, 228, 220, 0.78);
  }
  .cite em { font-style: normal; }
  .cite a {
    display: inline-block;
    margin-right: 0.9em;
    color: rgba(232, 228, 220, 0.72);
    text-decoration: underline;
    text-decoration-color: rgba(232, 228, 220, 0.25);
    text-underline-offset: 3px;
  }
  .cite a:hover { color: var(--bone); }
  .cite a.blood-link { color: var(--blood-bright); text-decoration-color: rgba(197, 22, 10, 0.4); }

  .counter {
    font-family: var(--serif);
    font-size: clamp(2.8rem, 11vw, 6.5rem);
    font-weight: 600;
    color: var(--white);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
  }
  .counter-label {
    display: inline-block;
    margin-top: 1.1rem;
    padding-top: 0.9rem;
    border-top: 2px solid var(--blood-bright);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--blood-bright);
  }

  /* ---- the toll, annual global kill count per species ---- */
  .toll { margin-top: 2rem; }
  .toll .toll-num {
    display: block;
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(1.7rem, 4.6vw, 2.6rem);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--white);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 2px 28px rgba(0, 0, 0, 0.75);
  }
  .toll .toll-label {
    display: inline-block;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 2px solid var(--blood-bright);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--blood-bright);
  }

  /* ---- the chamber reconstruction ----
     A sticky schematic, scrubbed by scroll: the gondola descends into
     the CO2 pit, holds, then comes back up. Plain SVG lines and shapes. */
  .chamber { position: relative; height: 220vh; }
  .chamber-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
  .ch-left {
    position: absolute;
    left: var(--gutter);
    top: 50%;
    transform: translateY(-50%);
    max-width: 21rem;
    z-index: 5;
  }
  .ch-left .kicker { margin-bottom: 1.4rem; color: var(--blood-bright); }
  .ch-caps { display: grid; min-height: 11rem; align-items: start; }
  .ch-cap {
    grid-area: 1 / 1;
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.62;
    color: var(--bone);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 2px 28px rgba(0, 0, 0, 0.75);
    text-wrap: pretty;
    opacity: 0;
    transition: opacity 0.5s ease;
  }
  .ch-cap.on { opacity: 1; }
  .ch-cap strong { color: var(--white); font-weight: 600; }
  .ch-note {
    margin-top: 1.6rem;
    font-family: var(--sans);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--grey-dim);
    line-height: 1.9;
  }
  .ch-note a { color: var(--grey); text-decoration: underline; text-underline-offset: 3px; }
  .ch-note a:hover { color: var(--bone); }
  .chamber svg {
    position: absolute;
    left: 60%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 84vh;
    width: auto;
  }
  .chamber svg .wall { stroke: rgba(232, 228, 220, 0.45); stroke-width: 1.5; }
  .chamber svg .hatch { stroke: rgba(232, 228, 220, 0.22); stroke-width: 1; }
  .chamber svg .bar { stroke: rgba(232, 228, 220, 0.3); stroke-width: 1; }
  .chamber svg .cage { fill: rgba(0, 0, 0, 0.35); stroke: rgba(232, 228, 220, 0.65); stroke-width: 1.5; }
  .chamber svg .cable { stroke: rgba(232, 228, 220, 0.5); stroke-width: 1; }
  .chamber svg .gasline { stroke: rgba(197, 22, 10, 0.55); stroke-width: 1; stroke-dasharray: 6 6; }
  .chamber svg .ch-label {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    fill: var(--grey);
  }
  .chamber svg .ch-label--blood { fill: var(--blood-bright); }
  .chamber svg .wisp {
    fill: none;
    stroke: rgba(197, 22, 10, 0.4);
    stroke-width: 1.4;
    stroke-linecap: round;
    opacity: 0;
  }
  .chamber svg.agitated .wisp { stroke: rgba(197, 22, 10, 0.75); }
  #animals use, #animals-still use { fill: rgba(232, 228, 220, 0.82); transform-box: fill-box; transform-origin: center; }
  #animals { transition: opacity 0.5s ease; }
  #animals.gone { opacity: 0; }
  #animals-still { opacity: 0; transition: opacity 1.1s ease 0.25s; }
  #animals-still.show { opacity: 1; }
  #ch-timer { transition: opacity 0.4s ease; }
  .gas-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transition: opacity 1s ease;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(197, 22, 10, 0.32) 100%);
  }
  @media (prefers-reduced-motion: no-preference) {
    #animals.gasping use { animation: ch-thrash 0.34s linear infinite; }
    #animals.gasping g:nth-of-type(2) use { animation-duration: 0.27s; animation-direction: reverse; }
    #animals.gasping g:nth-of-type(3) use { animation-name: ch-climb; animation-duration: 0.5s; }
    #animals.gasping g:nth-of-type(4) use { animation-duration: 0.23s; animation-direction: reverse; }
    #animals.gasping g:nth-of-type(5) use { animation-name: ch-climb; animation-duration: 0.42s; animation-delay: 0.1s; }
    .chamber svg.agitated .gasline { animation: ch-gasflow 0.5s linear infinite; }
    .chamber svg .wisp { animation: ch-wisp 3.6s linear infinite; }
    .chamber svg .wisp:nth-of-type(2) { animation-delay: -1.1s; animation-duration: 3.1s; }
    .chamber svg .wisp:nth-of-type(3) { animation-delay: -2.3s; }
    .chamber svg .wisp:nth-of-type(4) { animation-delay: -0.6s; animation-duration: 4s; }
    .chamber svg .wisp:nth-of-type(5) { animation-delay: -1.8s; animation-duration: 3.3s; }
    .chamber svg .wisp:nth-of-type(6) { animation-delay: -2.9s; animation-duration: 4.2s; }
    .chamber svg .wisp:nth-of-type(7) { animation-delay: -1.4s; animation-duration: 3.8s; }
  }
  @keyframes ch-thrash {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(2.2px, -2.4px) rotate(-6deg); }
    45% { transform: translate(-2px, 0.8px) rotate(5deg); }
    70% { transform: translate(1.5px, -3px) rotate(-4deg); }
    85% { transform: translate(-1px, 1.4px) rotate(6deg); }
  }
  @keyframes ch-climb {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    35% { transform: translate(1.5px, -7px) rotate(-16deg); }
    60% { transform: translate(-1.5px, -3px) rotate(8deg); }
    80% { transform: translate(0.5px, -5.5px) rotate(-10deg); }
  }
  @keyframes ch-gasflow {
    to { stroke-dashoffset: -12; }
  }
  @keyframes ch-wisp {
    0% { opacity: 0; transform: translateY(0); }
    22% { opacity: 1; }
    78% { opacity: 0.55; }
    100% { opacity: 0; transform: translateY(-72px); }
  }
  @media (max-width: 760px) {
    .chamber svg {
      left: 50%;
      top: 7vh;
      transform: translateX(-50%);
      height: 52vh;
    }
    .ch-left {
      left: var(--gutter);
      right: var(--gutter);
      top: auto;
      bottom: 5vh;
      transform: none;
      max-width: none;
    }
    .ch-caps { min-height: 10rem; }
    .ch-cap { font-size: 0.95rem; }
  }

  /* ---- ash layer, every speck one animal, real rate ---- */
  #ash-canvas {
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.4s ease;
  }
  #ash-canvas.on { opacity: 1; }
  .ash-cap {
    margin-top: 1.4rem;
    font-family: var(--sans);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--grey);
  }

  @media (prefers-reduced-motion: no-preference) {
    .js .reveal {
      opacity: 0;
      transform: translateY(26px);
      transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
    }
    .js .reveal.in { opacity: 1; transform: none; }
  }

  /* ---- the four doors ---- */
  .doors {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
    margin-top: 2.6rem;
  }
  @media (min-width: 560px) { .doors { grid-template-columns: 1fr 1fr; } }
  .door {
    position: relative;
    display: block;
    border: 1px solid rgba(232, 228, 220, 0.18);
    padding: 1.7rem 1.5rem 1.4rem;
    background: rgba(5, 5, 5, 0.78);
    transition: border-color 0.4s var(--ease-out), transform 0.4s var(--ease-out);
    cursor: pointer;
  }
  .door:hover { border-color: var(--bone); transform: translateY(-3px); }
  .door .dno {
    position: absolute;
    top: 0;
    left: 1.2rem;
    transform: translateY(-50%);
    background: #050505;
    padding-inline: 0.6rem;
    font-family: var(--sans);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--grey-dim);
  }
  .door--witness { border-color: rgba(122, 18, 8, 0.85); }
  .door--witness:hover { border-color: var(--blood-bright); }
  .door--witness .dno { color: var(--blood-bright); }
  .door--solution {
    grid-column: 1 / -1;
    border-color: rgba(47, 191, 143, 0.6);
    background: linear-gradient(180deg, rgba(8, 22, 17, 0.72), rgba(5, 5, 5, 0.78));
  }
  .door--solution:hover { border-color: #2fbf8f; }
  .door--solution .dno { color: #2fbf8f; }
  .door--solution h3 { font-size: 1.7rem; }
  .door--solution .go { color: #2fbf8f; }
  .door h3 { font-size: 1.35rem; margin-bottom: 0.5rem; }
  .door p {
    font-size: 0.9rem !important;
    line-height: 1.55;
    color: var(--grey);
    margin: 0;
    text-shadow: none;
  }
  .door .go {
    margin-top: 1.1rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--blood-bright);
  }

  .share-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
  .share-row button {
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bone);
    background: transparent;
    border: 1px solid rgba(232, 228, 220, 0.2);
    border-radius: 2px;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
  }
  .share-row button:hover { background: var(--bone); color: var(--near-black); }

  .end-foot {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 0 var(--gutter) 4rem;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--grey-dim);
  }

  /* ---- species rail, white animal icons, jump to each beat ---- */
  .species-rail {
    position: fixed;
    right: clamp(0.5rem, 1.6vw, 1.2rem);
    top: 50%;
    transform: translateY(-50%);
    z-index: 28;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }
  .species-rail button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 34px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--white);
    opacity: 0.85;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.9));
    transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  }
  .species-rail button:hover { opacity: 1; transform: translateX(-3px); }
  .species-rail button.current { color: var(--blood-bright); opacity: 1; }
  .species-rail button svg { width: 32px; height: 22px; display: block; }
  @media (max-width: 700px), (max-height: 560px) {
    .species-rail { display: none; }
  }
