:root {
  color-scheme: light;
  --ink: #17262d;
  --navy: #061725;
  --paper: #f8f5ee;
  --white: #fffdfa;
  --teal: #076568;
  --muted: #4d5d61;
  --line: #d5d9d3;
  --reader: min(100% - 2.5rem, 53rem);
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1.5rem; }
body.swarm-page { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.65 system-ui, sans-serif; }
.swarm-page a { color: var(--teal); text-underline-offset: .19em; }
.swarm-page a:hover { text-decoration-thickness: 2px; }
.swarm-page :focus-visible { outline: 3px solid #c07b16; outline-offset: 4px; }
.swarm-skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; color: var(--ink); background: white; padding: .6rem 1rem; }
.swarm-skip:focus { top: .75rem; }
.swarm-nav { background: var(--white); border-bottom: 1px solid var(--line); }
.swarm-nav nav { width: min(100% - 2.5rem, 78rem); margin: auto; padding: .76rem 0; display: flex; justify-content: space-between; align-items: center; gap: .4rem 1.3rem; flex-wrap: wrap; }
.swarm-nav a { color: var(--ink); text-decoration: none; }
.swarm-nav a:last-child { color: var(--teal); font-size: .92rem; }
.swarm-nav a:hover { text-decoration: underline; }
.swarm-main:focus { outline: none; }
.swarm-hero { color: var(--white); background: var(--navy); position: relative; display: grid; align-items: center; isolation: isolate; min-height: clamp(30rem, 54vw, 44rem); overflow: hidden; }
.swarm-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 59%; z-index: -2; }
.swarm-hero::after { position: absolute; inset: 0; content: ""; background: linear-gradient(90deg, #041522 1%, #041522e8 22%, #041522a0 48%, transparent 77%); z-index: -1; }
.hero-copy { width: min(100% - 3rem, 78rem); margin: auto; padding: 4rem 0; }
.hero-copy .topic { margin: 0 0 1.05rem; font-size: .76rem; letter-spacing: .1em; font-weight: 700; text-transform: uppercase; color: #91d8d4; }
.hero-copy h1 { max-width: 12.3ch; margin: 0; color: inherit; font: 700 clamp(3rem, 6.6vw, 6.35rem)/.98 Georgia, serif; letter-spacing: -.05em; }
.hero-copy .dek { max-width: 38ch; font-size: clamp(1rem, 1.65vw, 1.3rem); line-height: 1.5; margin: 1.4rem 0 1.1rem; }
.hero-copy .byline { font-size: .88rem; color: #deebee; margin: .35rem 0; }
.hero-copy .byline a { color: #deebee; }
.hero-copy .author-role { display: inline-block; margin-right: 1rem; white-space: nowrap; }
.hero-copy .paper-download { display: inline-block; border: 1px solid #bddcdb; border-radius: .35rem; padding: .45rem .75rem; margin-top: 1.1rem; color: white; }
.swarm-prose { width: var(--reader); margin: auto; padding: clamp(2.5rem, 6vw, 4.5rem) 0 4.5rem; }
.swarm-prose p, .swarm-prose li { margin: 0 0 .94rem; }
.swarm-prose > p:first-child { font: 1.48rem/1.49 Georgia, serif; }
.swarm-prose section { margin-top: 2.4rem; }
.swarm-prose h2, .swarm-prose h3 { font-family: Georgia, serif; color: #13242a; font-weight: 700; line-height: 1.1; letter-spacing: -.027em; }
.swarm-prose h2 { font-size: clamp(1.85rem, 4vw, 2.55rem); margin: 2.7rem 0 1rem; }
.swarm-prose h3 { font-size: clamp(1.35rem, 3vw, 1.7rem); margin: 1.8rem 0 .8rem; }
.swarm-prose .citation { font: 700 .71em/1 system-ui, sans-serif; vertical-align: super; text-decoration: none; margin: 0 .05em; white-space: nowrap; }
.swarm-prose .citation:hover { text-decoration: underline; }
.jump-links { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .35rem 1.15rem; padding: .75rem 0; margin: 2rem 0; font-size: .88rem; }
.motion-bar { display: flex; justify-content: flex-start; margin: 0 0 .8rem; }
.motion-bar[hidden] { display: none; }
.motion-toggle { color: var(--teal); background: var(--white); border: 1px solid var(--teal); padding: .5rem .85rem; border-radius: .3rem; min-height: 44px; font: inherit; font-size: .85rem; cursor: pointer; }
.swarm-prose .scene { margin: 0 0 2.6rem; padding: 1.5rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.swarm-prose .scene h3 { margin: 0 0 .8rem; font: 700 clamp(2rem, 5vw, 3.45rem)/.95 Georgia, serif; }
.scene .pattern-label { margin-bottom: .38rem; color: var(--teal); font-size: .86rem; font-weight: 700; }
.scene-copy { position: relative; z-index: 1; }
.scene figure { margin: 1.05rem 0 .95rem; }
.scene-stage { min-height: 14rem; overflow: clip; isolation: isolate; position: relative; display: grid; align-items: end; padding: 1rem; border: 1px solid #bccdc6; border-radius: .6rem; background: radial-gradient(ellipse at 55% 14%, #fffdfa, #eef0e6 82%); }
.scene-stage::before { position: absolute; inset: 0 0 2.8rem; z-index: -1; content: ""; background-image: linear-gradient(90deg, #597a6920 1px, transparent 1px), linear-gradient(#597a6920 1px, transparent 1px); background-size: 2rem 2rem; mask-image: linear-gradient(transparent, black); }
.scene-stage::after { position: absolute; inset: auto 7% 3.6rem; border-bottom: 2px solid #437d7466; content: ""; z-index: -1; }
.scene-sprites { position: absolute; inset: .15rem 2.5% 3.8rem; pointer-events: none; }
.sprite { position: absolute; top: 20%; left: var(--left); width: clamp(2.4rem, 11vw, 6rem); aspect-ratio: 1; background: url("origami-sprites.webp") no-repeat; background-size: 300% 100%; opacity: var(--opacity, .88); transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(var(--angle, 0deg)) scale(var(--scale, 1)); }
.sprite:nth-child(1) { --left: 9%; top: 14%; }
.sprite:nth-child(2) { --left: 22%; top: 34%; --opacity: .92; }
.sprite:nth-child(3) { --left: 36%; top: 6%; --opacity: .8; }
.sprite:nth-child(4) { --left: 51%; top: 24%; --opacity: .86; }
.sprite:nth-child(5) { --left: 67%; top: 8%; --opacity: .75; }
.sprite:nth-child(6) { --left: 81%; top: 26%; --opacity: .82; }
.scene[data-pattern="army-ant"] .sprite { background-position: left center; }
.scene[data-pattern="locust"] .sprite { background-position: center center; }
.scene[data-pattern="starling"] .sprite { background-position: right center; }
.stage-labels { display: grid; grid-template-columns: repeat(3, 1fr); align-items: stretch; gap: .45rem; font-size: .79rem; line-height: 1.33; font-weight: 700; }
.stage-labels span { border: 1px solid #9caba4; border-radius: .35rem; background: #fffefaeb; padding: .5rem .35rem; text-align: center; color: #233b40; }
.scene[data-pressure="high"] .stage-labels span { border-color: #835e34; }
.scene[data-response="on"] .stage-labels span { border-color: #08706a; background-color: #e4f1e7; }
.scene figcaption { margin-top: .48rem; color: var(--muted); font-size: .84rem; }
.scene details { border-left: 4px solid var(--teal); padding: .48rem .85rem; background: var(--white); }
.scene summary { color: var(--teal); font-weight: 700; cursor: pointer; padding: .3rem 0; }
.scene details p { margin: .4rem 0 .6rem; }
.actions { padding-left: 1.5rem; }
.actions li { padding-left: .35rem; }
.actions li::marker { color: var(--teal); font-weight: 800; }
.field-note { border-left: 4px solid var(--teal); background: var(--white); margin: 1.55rem 0; padding: .9rem 1rem .04rem; }
.related-links { border-top: 1px solid var(--line); margin: 2.4rem 0; padding-top: .1rem; }
.related-links a { display: inline-block; margin-right: 1.3rem; }
.bibliography { font-size: .89rem; overflow-wrap: anywhere; padding-left: 1.4rem; }
.bibliography li { padding-left: .3rem; }
.swarm-footer { border-top: 1px solid var(--line); background: var(--white); padding: 1.1rem 1.25rem; color: var(--muted); text-align: center; font-size: .82rem; }
.table-wrap { overflow: auto; margin: 1.5rem 0; }
.swarm-page table { width: 100%; border-collapse: collapse; font-size: .89rem; text-align: left; background: var(--white); }
.swarm-page th, .swarm-page td { border-bottom: 1px solid var(--line); padding: .62rem .56rem; vertical-align: top; }
.swarm-page thead th { color: white; background: #14595e; }
.swarm-page caption { text-align: left; font-weight: 650; margin: 0 0 .5rem; color: var(--muted); }
@media (max-width: 44rem) {
  .swarm-hero { min-height: 34rem; align-items: end; }
  .swarm-hero > img { object-position: 66% 47%; }
  .swarm-hero::after { background: linear-gradient(0deg, #041522 10%, #041522dc 53%, #04152242 87%); }
  .hero-copy { width: min(100% - 2.5rem, 78rem); padding: 3rem 0; }
  .hero-copy h1 { font-size: clamp(2.7rem, 10vw, 4rem); }
  .swarm-prose table { min-width: 36rem; }
}
@media (prefers-reduced-motion: reduce) {
  .swarm-page *, .swarm-page *::before, .swarm-page *::after { scroll-behavior: auto !important; }
  .sprite { transform: none !important; }
}
@page { size: A4; margin: 16mm 18mm 17mm; }
@page cover { margin: 0; }
@media print {
  body.swarm-page { font: 10.7pt/1.42 Georgia, serif; color: #1a2830; background: white; }
  .swarm-nav, .swarm-skip, .swarm-footer, .jump-links, .paper-download, .motion-bar { display: none !important; }
  .swarm-hero { print-color-adjust: exact; page: cover; height: 297mm; min-height: 0; display: grid; align-items: end; break-after: page; }
  .swarm-hero > img { object-position: 63% center; }
  .swarm-hero::after { background: linear-gradient(0deg, #041522 6%, #041522ed 27%, #04152291 48%, #04152215 72%); }
  .hero-copy { width: auto; margin: 0 18mm 21mm; padding: 0; }
  .hero-copy h1 { font-size: 37pt; max-width: 15ch; }
  .hero-copy .dek { font-size: 13pt; }
  .hero-copy .byline { font-size: 10pt; }
  .swarm-prose { width: 100%; max-width: none; padding: 0; }
  .swarm-prose section { margin-top: .6rem; }
  .swarm-prose h2 { font-size: 19pt; margin: 1.15rem 0 .55rem; break-after: avoid; }
  .swarm-prose h3 { font-size: 13pt; margin: .8rem 0 .4rem; break-after: avoid; }
  .swarm-prose p { orphans: 3; widows: 3; }
  .swarm-prose table { min-width: 0; font-size: 8.8pt; }
  .swarm-prose table thead { print-color-adjust: exact; }
  .swarm-prose table tr { break-inside: avoid; }
  .swarm-prose .bibliography { font-size: 9pt; }
  .paper-pattern { break-inside: avoid; }
  .related-links { display: none; }
}
