:root {
  color-scheme: dark;
  --back: #160f12;
  --paper: #fff4e9;
  --dim: #e3cbc0;
  --rule: #ffdcc35c;
  --display: "Instrument Serif", Georgia, serif;
  --body: "Instrument Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--back); scroll-behavior: smooth; }
body { margin: 0; color: var(--paper); background: var(--back); font: 16px/1.5 var(--body); }
[hidden] { display: none !important; }
a { color: inherit; }
button { color: inherit; font: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid #ffe0bc; outline-offset: 5px; }
.skip { position: absolute; top: 12px; left: 12px; padding: 10px; transform: translateY(-200%); background: var(--paper); color: var(--back); z-index: 8; }
.skip:focus { transform: none; }
.masthead { position: fixed; z-index: 4; inset: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: clamp(8px, 2.25vw, 35px) clamp(14px, 5vw, 78px); background: linear-gradient(#10080cc9, transparent); }
.wordmark { display: flex; gap: 10px; align-items: center; text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: .21em; }
.mark { width: 20px; height: 10px; border-block: 1px solid currentColor; position: relative; }
.mark::before { content: ""; position: absolute; inset: 3px 0 auto; border-top: 1px solid currentColor; }
.masthead-controls, .language { display: flex; align-items: center; gap: 5px; }
.masthead-controls { gap: clamp(5px, 1.8vw, 24px); }
.motion, .language button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 38px; cursor: pointer; padding: 5px 8px; border: 1px solid transparent; background: transparent; font-size: 12px; white-space: nowrap; }
.motion { gap: 6px; }
.motion svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.motion .play-icon, .motion[aria-pressed=true] .pause-icon { display: none; }
.motion[aria-pressed=true] .play-icon { display: block; }
.language button[aria-pressed=true] { border-color: var(--rule); }
.journey { position: relative; isolation: isolate; }
.stage { display: none; }
.chapter { min-height: 99svh; position: relative; display: grid; align-items: end; padding: clamp(86px, 12vh, 150px) clamp(19px, 8vw, 135px) clamp(50px, 11vh, 135px); }
.chapter-opening::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(0deg,#150b11ee 3%,transparent 74%),url("media/flag-macro-natural.webp") center / cover;
}
.chapter-inner { max-width: 990px; }
.overline { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; font: 650 12px/1.4 var(--body); letter-spacing: .18em; text-transform: uppercase; }
.overline span:first-child { display: inline-block; width: 23px; border-top: 1px solid currentColor; }
.chapter h1, .chapter h2, .details h2 { font: 400 clamp(72px, 13vw, 190px)/.82 var(--display); letter-spacing: -.035em; margin: 0; }
.chapter h1 {
  font-size: clamp(130px, min(25vw, 46svh), 350px);
  /* The display face's long j descender needs room inside the title line. */
  line-height: 1.04;
}
.intro-copy { margin: clamp(16px, 2.2svh, 25px) 0 0; color: var(--dim); font-size: clamp(17px, 2.1vw, 28px); }
.chapter-copy { margin: 19px 0 0; color: var(--dim); max-width: 37ch; font-size: clamp(16px, 1.8vw, 22px); }
.next { display: inline-flex; align-items: center; min-height: 46px; gap: 11px; text-decoration: none; font-size: 13px; border-bottom: 1px solid var(--rule); margin-top: clamp(19px, 4vh, 44px); padding: 1px 4px 1px 0; }
.next svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.is-cinematic .stage { display: block; position: sticky; top: 0; height: 100svh; margin-bottom: -100svh; overflow: hidden; z-index: -1; background: #171622; }
.is-cinematic .chapter { min-height: 100svh; }
.is-cinematic .chapter-riga { min-height: 117svh; }
.is-cinematic .chapter::before { content: none; }
.is-cinematic .chapter:not(:first-of-type) .chapter-inner { transform: translateY(var(--text-y, 0)); opacity: var(--text-opacity, 1); }
.shot {
  position: absolute; top: 0; left: 0;
  width: var(--shot-width, 100%); height: var(--shot-height, 100%);
  transform: translate3d(var(--shot-x, 0), var(--shot-y, 0), 0) scale(var(--shot-scale, 1));
  transform-origin: 0 0;
}
.shot img, .shot video {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
.shot video { opacity: 0; transition: opacity .3s ease; }
.shot video.is-playing { opacity: 1; }
.stage-shade {
  position: absolute; inset: 0;
  background: linear-gradient(0deg,#120a10f2 0%,#120a1090 22%,#120a101e 47%,transparent 68%),
    linear-gradient(180deg,#120a10ae,transparent 22%),linear-gradient(90deg,#150b104c,transparent 57%);
}
body:not(.is-cinematic) .chapter:not(.chapter-opening) { min-height: 0; padding-block: 54px; border-top: 1px solid var(--rule); }
body:not(.is-cinematic) .chapter:not(.chapter-opening) h2 { font-size: clamp(55px, 10vw, 116px); }
.stage-rule { position: absolute; inset: auto clamp(19px,5vw,76px) 19px; border-top: 1px solid var(--rule); }
.stage-rule i { position: absolute; top: -1px; left: 0; height: 1px; width: var(--journey-progress,0%); background: #ffdbb3; }
.details { padding: clamp(74px, 11vw, 154px) clamp(19px, 8vw, 135px); background: #ede4d7; color: #2a171b; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(32px, 8vw, 110px); }
.details .overline { color: #8a344b; }
.details h2 { font-size: clamp(62px,10vw,145px); }
.details-copy { margin: 20px 0 0; max-width: 34ch; }
.flag-diagram { width: 100%; max-width: 620px; height: auto; display: block; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 14px 0 0; }
.specs div { border-top: 1px solid #a58d8d; padding-top: 10px; }
.specs dt { font-size: 13px; }
.specs dd { margin: 0; font: 400 clamp(34px, 6vw, 65px)/1 var(--display); }
.source { display: inline-block; margin-top: 28px; text-underline-offset: 5px; font-size: 13px; }
.details a:focus-visible { outline-color: #8a344b; }
footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px 18px; padding: 22px clamp(19px, 8vw, 135px); font-size: 12px; letter-spacing: .08em; }
footer a { text-underline-offset: 5px; }
footer .credits { color: var(--dim); }
@media(max-width: 680px) {
  .chapter { min-height: 95svh; padding-bottom: 67px; }
  .chapter h1 { font-size: clamp(125px, 35vw, 235px); }
  .chapter h2 { font-size: clamp(64px, 15vw, 110px); }
  .details-grid { grid-template-columns: 1fr; }
}
@media(max-height: 500px) and (orientation: landscape) {
  .chapter { min-height: 430px; }
  .chapter h1 { font-size: 117px; }
  .chapter h2 { font-size: 76px; }
}
@media(prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .shot video { transition: none; }
}

@media(max-width: 359px) {
  .masthead { padding-inline: 10px; }
  .wordmark { gap: 5px; letter-spacing: .14em; }
  .motion, .language button { padding-inline: 5px; }
  .chapter h1 { font-size: clamp(106px, 32vw, 125px); }
  .chapter h2 { font-size: clamp(53px, 14vw, 64px); }
}

@media(max-aspect-ratio: 4/5) {
  .is-cinematic .stage { background: linear-gradient(#16131e 27%,#1a151e 63%,#140d12); }
  .shot {
    mask-image: linear-gradient(180deg, transparent, #000 6%, #000 91%, transparent);
  }
  .stage-shade { background: linear-gradient(0deg,#120a10 0%,#120a10ba 19%,transparent 49%); }
  .chapter-opening::before { background-size: cover, auto 83%; background-repeat: no-repeat; }
}

.stage-layer, .map-deck { position: absolute; inset: 0; overflow: hidden; }
.stage-layer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate3d(0, var(--layer-rise, 0), 0) scale(var(--layer-scale, 1));
  transform-origin: 50% 46%;
}
.fabric-shot { background: #300b16; }
.fabric-shot img { object-position: 50% 48%; }
.aerial-shot, .map-deck, .earth-shot { opacity: 0; }
.aerial-shot img { object-position: 46% 50%; }
.map-deck img {
  position: absolute;
  top: 45%;
  left: 50%;
  width: var(--map-width, 100%);
  height: auto;
  max-width: none;
  transform: translate3d(-50%,-50%,0) scale(var(--map-scale,1));
  transform-origin: center;
}
.map-deck { background: #171622; }
.earth-shot { background: #060608; }
.earth-shot img { object-fit: contain; object-position: center 41%; }
.is-cinematic .chapter-aerial,.is-cinematic .chapter-city,.is-cinematic .chapter-country { min-height: 113svh; }
.is-cinematic .chapter-earth { min-height: 176svh; }
.is-cinematic .chapter-earth .chapter-inner { align-self: start; margin-top: 61svh; }
body:not(.is-cinematic) .chapter-opening::before {
  background-image: linear-gradient(0deg,#150b11ee 3%,transparent 74%),url("media/flag-macro-natural.webp");
}
body:not(.is-cinematic) .chapter-aerial::before,
body:not(.is-cinematic) .chapter-city::before,
body:not(.is-cinematic) .chapter-country::before,
body:not(.is-cinematic) .chapter-earth::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-position: center; background-size: cover;
}
body:not(.is-cinematic) .chapter-aerial::before { background-image: linear-gradient(0deg,#171019eb,transparent),url("media/riga-dambis.webp"); }
body:not(.is-cinematic) .chapter-city::before { background-image: linear-gradient(0deg,#171019eb,transparent),url("media/orbit-metro.webp"); }
body:not(.is-cinematic) .chapter-country::before { background-image: linear-gradient(0deg,#171019eb,transparent),url("media/orbit-latvia-wide.webp"); }
body:not(.is-cinematic) .chapter-earth::before { background-image: linear-gradient(0deg,#171019eb,transparent),url("media/orbit-earth.webp"); }
@media(max-aspect-ratio:4/5) {
  body:not(.is-cinematic) .chapter-opening::before { background-size: cover; }
  .map-deck img { mask-image: linear-gradient(0deg,transparent,#000 7%,#000 93%,transparent); }
}

/* Editorial chapters and optional paths through the story */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.chapter-nav { display: flex; gap: clamp(14px,3vw,42px); }
.chapter-nav a { display: flex; align-items: center; min-height: 44px; font-size: 13px; text-decoration: none; }
.chapter-nav a:hover, .chapter-nav a:focus-visible { text-decoration: underline; text-underline-offset: 5px; }
.intro-copy { max-width: 30ch; }
.skip-story { display: inline-flex; align-items: center; min-height: 46px; margin-inline-start: 21px; font-size: 13px; text-underline-offset: 5px; }
.history, .river-story, .details { scroll-margin-top: 66px; }
.history, .river-story {
  padding: clamp(64px,9vw,137px) clamp(19px,8vw,135px);
  color: #2b191d;
  background: #eee5d9;
}
.history-intro { max-width: 940px; margin-bottom: clamp(32px,6vw,75px); }
.history .overline, .river-story .overline { color: #8a344b; }
.history h2, .river-story h2 {
  margin: 14px 0 0; font: 400 clamp(68px,11vw,152px)/.82 var(--display);
  letter-spacing: -.045em;
}
.history-intro > p:last-child, .river-copy > p:not(.overline) { max-width: 39ch; margin: 22px 0 0; }
.history-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px,5vw,80px); align-items: start; }
.history-photo, .river-story figure { margin: 0; min-width: 0; }
.history-photo img, .river-story img { width: 100%; height: auto; display: block; }
.history-photo figcaption, .river-story figcaption {
  display: flex; gap: 6px 13px; align-items: baseline; flex-wrap: wrap;
  margin-top: 11px; font-size: 12px; color: #635054;
}
.history-photo figcaption a, .river-story figcaption a { text-underline-offset: 3px; }
.history figure figcaption span, .river-story figcaption span { margin-inline-end: auto; }
.dates { min-width: 0; border-top: 1px solid #ad9796; }
.dates details { border-bottom: 1px solid #ad9796; }
.dates summary {
  display: grid; grid-template-columns: minmax(112px,.65fr) 1fr 18px;
  gap: 0 13px; align-items: center; min-height: 75px;
  padding: 11px 0; cursor: pointer; list-style: none;
}
.dates summary::-webkit-details-marker { display: none; }
.dates time { font: 400 clamp(25px,3.05vw,47px)/1 var(--display); letter-spacing: -.025em; }
.dates summary span { font-size: 14px; font-weight: 600; }
.dates summary i { display: block; position: relative; width: 16px; border-top: 1px solid #8a344b; }
.dates summary i::after { content: ""; position: absolute; top: -8px; left: 7px; height: 15px; border-left: 1px solid #8a344b; transition: transform .2s; }
.dates details[open] summary i::after { transform: scaleY(0); }
.date-body { padding: 0 23px 20px min(14%,48px); }
.date-body p { margin: 0 0 8px; color: #49373b; max-width: 39ch; }
.date-body a, .calendar-link, .river-copy > a { font-size: 13px; text-underline-offset: 4px; }
.calendar-link, .river-copy > a { display: inline-flex; align-items: center; min-height: 44px; margin-top: 14px; }
.history a:focus-visible, .history summary:focus-visible, .river-story a:focus-visible { outline-color: #8a344b; }
.river-story {
  display: grid; grid-template-columns: 1.38fr 1fr; gap: clamp(22px,5vw,80px); align-items: center;
  background: #e4d9cc; padding-block: clamp(42px,7vw,98px);
}
.river-story h2 { font-size: clamp(48px,7vw,108px); }
.diagram-choices { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 12px; }
.diagram-choices button {
  min-height: 44px; padding: 7px 12px; border: 1px solid #aa9294;
  color: #512b35; background: transparent; cursor: pointer; font-size: 13px;
}
.diagram-choices button[aria-pressed="true"] { background: #512b35; color: #fff4e9; border-color: #512b35; }
.diagram-choices button:focus-visible { outline-color: #8a344b; }
.diagram-bands, .diagram-ratio { display: none; }
[data-diagram="bands"] .diagram-bands, [data-diagram="ratio"] .diagram-ratio { display: block; }
.diagram-readout { margin: 10px 0 0; font-size: 13px; color: #635054; }
.fabric-shot img { transform-origin: 52% 57%; }
.aerial-shot img { object-position: 59% 54%; }

@media (max-width: 820px) {
  .masthead { flex-wrap: wrap; row-gap: 0; }
  .masthead-controls { margin-inline-start: auto; }
  .chapter-nav { order: 3; flex-basis: 100%; gap: 18px; }
  .chapter-nav a { font-size: 12px; min-height: 38px; }
  .history-grid, .river-story { grid-template-columns: 1fr; }
  .history-grid figure { order: 2; }
  .river-story .river-copy { order: -1; }
}
@media (max-width: 420px) {
  .skip-story { margin-inline-start: 13px; font-size: 12px; }
  .dates summary { grid-template-columns: minmax(92px,.66fr) 1fr 14px; gap: 0 9px; }
  .history-photo figcaption, .river-story figcaption { font-size: 11px; }
}
.aerial-credit { margin: 10px 0 0; color: var(--dim); font-size: 12px; }
.aerial-credit a { text-underline-offset: 3px; }

.proclamation {
  padding: clamp(64px, 9vw, 142px) clamp(19px, 8vw, 135px);
  background: #eee5d9;
  color: #2b191d;
  scroll-margin-top: 66px;
}
.proclamation-intro {
  display: grid;
  grid-template-columns: 1.36fr 1fr;
  gap: clamp(20px, 6vw, 85px);
  align-items: end;
  margin-bottom: clamp(30px, 6vw, 75px);
}
.proclamation .overline { color: #8a344b; }
.proclamation h2 {
  margin: 13px 0 0;
  font: 400 clamp(58px, 9vw, 132px)/.86 var(--display);
  letter-spacing: -.046em;
  max-width: 12ch;
}
.proclamation-intro > p { max-width: 42ch; margin: 0; }
.archive-layout { display: grid; grid-template-columns: 1.62fr 1fr; gap: clamp(18px,5vw,76px); align-items: center; }
.archive-frame { min-width: 0; margin: 0; }
.archive-lens { overflow: hidden; background: #312728; aspect-ratio: 1714 / 1213; }
.archive-lens img {
  width: 100%; height: 100%; display: block;
  transform-origin: var(--archive-origin, 50% 50%);
  transform: scale(var(--archive-zoom, 1));
  transition: transform .65s cubic-bezier(.2,.75,.23,1),transform-origin .65s cubic-bezier(.2,.75,.23,1);
}
.archive-lens[data-focus="stage"] { --archive-origin: 50% 33%; --archive-zoom: 1.65; }
.archive-lens[data-focus="hall"] { --archive-origin: 50% 77%; --archive-zoom: 1.55; }
.archive-frame figcaption { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; color: #5a474c; font-size: 12px; margin-top: 12px; }
.archive-text { min-width: 0; }
.archive-options { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0 16px; }
.archive-options button {
  min-height: 44px; padding: 7px 12px; border: 1px solid #b19a9b;
  color: #512b35; background: transparent; cursor: pointer; font-size: 13px;
}
.archive-options button[aria-pressed="true"] { color: #fff4e9; background: #512b35; border-color: #512b35; }
.archive-readout { margin: 0 0 14px; max-width: 43ch; }
.archive-text > a { display: block; width: fit-content; margin-top: 7px; font-size: 13px; }
.proclamation a { text-underline-offset: 4px; }
.proclamation a:focus-visible, .archive-options button:focus-visible { outline-color: #8a344b; }
.history { background: #e6dbce; }
.history-image { width: min(100%, 420px); justify-self: center; }
.history-image img { display: block; width: 100%; height: auto; }
.history-image p { margin: 7px 0 0; font-size: 12px; }
@media(max-width: 820px) {
  .archive-layout, .proclamation-intro { grid-template-columns: 1fr; }
  .history-image { order: 2; }
  .chapter-nav { gap: clamp(9px,4vw,18px); }
  .proclamation { scroll-margin-top: 90px; }
}
@media(prefers-reduced-motion: reduce) { .archive-lens img { transition: none; } }
