/* ============================================================
   SWARM — design system
   Register: ops-room editorial. Near-black ground, hairline
   structure, Latvian carmine as the single accent, serif for
   argument, mono for apparatus. No gradients, no radii, no
   shadows. Density is the ornament.
   ============================================================ */

:root {
  --bg: #0e0e10;
  --panel: #141417;
  --panel-2: #18181c;
  --ink: #e9e6df;
  --muted: #9b978d;
  --faint: #757167;
  --line: rgba(233, 230, 223, 0.16);
  --line-soft: rgba(233, 230, 223, 0.07);
  --carmine: #a4343a;
  --carmine-bright: #c2444b;
  --strong: #ffffff;
  --skyline-o: 0.16;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, monospace;
  --measure: 42rem;
}

/* Light mode: the printed dispatch. Warm paper, near-black ink,
   the same carmine — now reading as a stamp instead of a signal. */
:root[data-theme="light"] {
  --bg: #f2efe7;
  --panel: #e9e5d9;
  --panel-2: #e1dccd;
  --ink: #1c1b18;
  --muted: #55524a;
  --faint: #6e6a5d;
  --line: rgba(28, 27, 24, 0.24);
  --line-soft: rgba(28, 27, 24, 0.1);
  --carmine: #a4343a;
  --carmine-bright: #8a262c;
  --strong: #0f0e0c;
  --skyline-o: 0.2;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: color .3s ease, background-color .3s ease;
}

::selection { background: var(--carmine); color: #f2efe7; }

/* ---------- skyline band ----------
   In document flow at the foot of the page, above the colophon —
   it only appears when the reader scrolls to the end, and never
   sits underneath text. */
#skyline {
  pointer-events: none;
  color: var(--ink);
  opacity: var(--skyline-o);
  margin-top: 32px;
}
#skyline svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  margin: 0 auto;
}

a { color: inherit; }

.mono { font-family: var(--mono); }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--carmine); color: var(--ink);
  font-family: var(--mono); font-size: 12px;
  padding: 8px 14px; z-index: 10000; text-decoration: none;
}
.skip:focus { left: 0; }

:focus-visible { outline: 1px solid var(--carmine-bright); outline-offset: 2px; }

/* ---------- progress hairline ---------- */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--carmine-bright); z-index: 9998;
  opacity: 0; transition: width .35s cubic-bezier(.6,0,.2,1), opacity .25s linear;
}
#progress.run { opacity: 1; width: 82%; }
#progress.done { opacity: 0; width: 100%; }

/* ---------- loading screen ---------- */
#loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  opacity: 1; visibility: visible;
  transition: opacity .32s ease, visibility 0s linear 0s;
}
#loader.hidden {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .32s ease, visibility 0s linear .32s;
}
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.auseklis { width: 84px; height: 84px; }
.auseklis path {
  fill: none; stroke: var(--carmine-bright); stroke-width: 2.5;
  stroke-dasharray: 1; stroke-dashoffset: 0;
}
#loader.boot .a1 { animation: draw .55s cubic-bezier(.5,0,.3,1) both; }
#loader.boot .a2 { animation: draw .55s cubic-bezier(.5,0,.3,1) .18s both; }
#loader.boot .a3 { animation: draw .45s cubic-bezier(.5,0,.3,1) .38s both; }
#loader.pulse .auseklis { animation: starPulse .5s ease both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes starPulse {
  0% { opacity: .25; transform: scale(.96); }
  100% { opacity: 1; transform: scale(1); }
}
.loader-status {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-family: var(--mono); text-transform: uppercase;
}
#loader-line { font-size: 13px; letter-spacing: .32em; color: var(--ink); }
.loader-sub { font-size: 10px; letter-spacing: .18em; color: var(--faint); }

/* ---------- masthead ---------- */
#masthead {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.mast-top {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 18px 24px 14px;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
}
.mast-coords { font-size: 11px; letter-spacing: .14em; color: var(--faint); }
.logotype {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  font-family: var(--mono); font-weight: 600;
  font-size: 20px; letter-spacing: .38em; text-indent: .38em;
  color: var(--ink);
}
.logo-star { width: 17px; height: 17px; color: var(--carmine-bright); flex: none; }
.mast-nav { justify-self: end; display: flex; gap: 26px; }
.mast-nav a {
  font-size: 11px; letter-spacing: .16em; text-decoration: none;
  color: var(--muted); padding-bottom: 3px;
  border-bottom: 1px solid transparent;
}
.mast-nav a:hover { color: var(--ink); }
.mast-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--carmine); }
.theme-btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  color: var(--carmine-bright); padding: 0 0 3px;
  border-bottom: 1px solid transparent;
}
.theme-btn:hover { color: var(--ink); }
.mast-rule {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; gap: 16px;
  padding: 8px 24px;
  border-top: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint);
}
.rule-tag { color: var(--muted); }

/* ---------- main frame ---------- */
main {
  max-width: 1200px; margin: 0 auto;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  min-height: 62vh;
}
main:focus { outline: none; }

/* ---------- front: lead dispatch ---------- */
.lead {
  display: grid; grid-template-columns: 7fr 3fr; gap: 0;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.lead.has-media { grid-template-columns: 4fr 5fr 3fr; }
.lead-media {
  padding: 44px 0 44px 24px;
  display: flex; flex-direction: column; gap: 9px;
  position: relative;
}
.lead-media a { display: block; }
.lead-media img {
  display: block; width: 100%;
  aspect-ratio: 16 / 9; object-fit: cover;
  border: 1px solid var(--line);
}
.lead-media figcaption {
  font-size: 10px; letter-spacing: .16em;
  color: var(--faint); text-transform: uppercase;
}
/* registration ticks sit on the file image */
.lead-media::before, .lead-media::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border-color: var(--carmine); border-style: solid;
}
.lead-media::before { top: 38px; left: 18px; border-width: 1px 0 0 1px; }
.lead-media::after { bottom: 60px; right: -6px; border-width: 0 1px 1px 0; }
.lead.has-media .lead-body::before, .lead.has-media .lead-body::after { display: none; }
.lead.has-media .lead-kicker, .lead.has-media .lead h1, .lead.has-media .lead-dek { padding-left: 0; }
.lead.has-media .lead-body { padding: 48px 40px 52px 40px; }
.lead-body {
  padding: 54px 48px 58px 24px;
  position: relative;
}
/* corner ticks on the lead block */
.lead-body::before, .lead-body::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border-color: var(--carmine); border-style: solid;
}
.lead-body::before { top: 22px; left: 24px; border-width: 1px 0 0 1px; }
.lead-body::after { bottom: 22px; left: 24px; border-width: 0 0 1px 1px; }
.lead-kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em;
  color: var(--carmine-bright); text-transform: uppercase;
  margin-bottom: 22px; padding-left: 28px;
}
.lead h1 {
  font-size: clamp(2.5rem, 5.2vw, 4.3rem);
  font-weight: 500; line-height: 1.02; letter-spacing: -0.015em;
  padding-left: 28px;
  font-variation-settings: "opsz" 72;
}
.lead h1 a { text-decoration: none; }
.lead h1 a:hover { color: var(--carmine-bright); }
.lead-dek {
  margin-top: 20px; padding-left: 28px;
  font-style: italic; font-size: 1.2rem; line-height: 1.5;
  color: var(--muted); max-width: 34rem;
}
.lead-meta {
  border-left: 1px solid var(--line);
  padding: 54px 24px 58px 28px;
  display: flex; flex-direction: column; gap: 0;
  font-family: var(--mono);
}
.meta-row {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.meta-row:first-child { padding-top: 0; }
.meta-k { font-size: 10px; letter-spacing: .16em; color: var(--faint); text-transform: uppercase; }
.meta-v { font-size: 13px; letter-spacing: .06em; color: var(--ink); text-transform: uppercase; }
.lead-go {
  margin-top: auto; padding-top: 26px;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--carmine-bright); text-decoration: none;
}
.lead-go:hover { color: var(--ink); }

/* ---------- section headers ---------- */
.sect-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); text-transform: uppercase;
}
.sect-head .sect-no { font-size: 11.5px; letter-spacing: .18em; color: var(--carmine-bright); }
.sect-head .sect-count { font-size: 11px; letter-spacing: .14em; color: var(--faint); }

/* ---------- front: two-column zone ---------- */
.front-cols { display: grid; grid-template-columns: 8fr 4fr; }
.col-index { border-right: 1px solid var(--line); }

/* ledger rows */
.row {
  display: grid;
  grid-template-columns: 64px 96px 116px 1fr 110px;
  gap: 18px; align-items: start;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  transition: background .15s ease;
}
.row-no, .row-date { margin-top: 8px; }
.row-thumb { display: block; }
.row-thumb img {
  display: block; width: 100%;
  aspect-ratio: 16 / 9; object-fit: cover;
  border: 1px solid var(--line-soft);
}
.row:hover .row-thumb img { border-color: var(--line); }
.row:hover { background: var(--panel); }
.row-no {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  color: var(--faint);
}
.row:hover .row-no { color: var(--carmine-bright); }
.row-date {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  color: var(--faint); text-transform: uppercase;
}
.row-main { min-width: 0; }
.row-title {
  display: block;
  font-size: 1.4rem; font-weight: 500; line-height: 1.2;
  letter-spacing: -0.01em;
}
.row:hover .row-title { color: var(--strong); }
.row-dek {
  display: block;
  margin-top: 6px; font-size: 1rem; font-style: italic;
  color: var(--muted); line-height: 1.5;
}
.row-tags {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  color: var(--faint); text-transform: uppercase; text-align: right;
  line-height: 1.9; margin-top: 8px;
}

/* wire rail */
.col-rail { display: flex; flex-direction: column; }
.wire-item {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
}
.wire-time { font-size: 10px; letter-spacing: .16em; color: var(--carmine-bright); display: block; margin-bottom: 5px; }
.wire-text { font-size: 12.5px; letter-spacing: .03em; line-height: 1.6; color: var(--muted); text-transform: uppercase; }
.rail-quote {
  margin: 26px 22px 30px;
  padding-left: 16px;
  border-left: 2px solid var(--carmine);
  font-style: italic; font-size: 1.05rem; line-height: 1.55;
  color: var(--muted);
}
.rail-quote .q-src {
  display: block; margin-top: 10px;
  font-family: var(--mono); font-style: normal; font-size: 9px;
  letter-spacing: .18em; color: var(--faint); text-transform: uppercase;
}

/* ---------- article page ---------- */
.article-head {
  border-bottom: 1px solid var(--line);
  padding: 0;
}
.crumb {
  display: block; padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  color: var(--faint); text-decoration: none; text-transform: uppercase;
}
.crumb:hover { color: var(--carmine-bright); }
.article-head-inner { padding: 46px 24px 50px; max-width: 56rem; }
.article-kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em;
  color: var(--carmine-bright); text-transform: uppercase; margin-bottom: 20px;
}
.article-head h1 {
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  font-weight: 500; line-height: 1.05; letter-spacing: -0.015em;
  font-variation-settings: "opsz" 72;
}
.article-dek {
  margin-top: 18px; font-style: italic; font-size: 1.18rem;
  color: var(--muted); max-width: 36rem; line-height: 1.5;
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: 26px;
  padding: 12px 24px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  color: var(--faint); text-transform: uppercase;
}
.article-meta b { color: var(--muted); font-weight: 500; }

.article-hero {
  max-width: 56rem;
  margin: 46px auto 0;
  padding: 0 24px;
}
.article-hero img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line);
}
.article-hero figcaption {
  margin-top: 9px;
  font-size: 10px; letter-spacing: .16em;
  color: var(--faint); text-transform: uppercase;
}

.article-body {
  padding: 52px 24px 30px;
  max-width: var(--measure);
  margin: 0 auto;
  font-size: 1.14rem; line-height: 1.78;
}
.article-body > p { margin-bottom: 1.45em; }
.article-body > p:first-of-type::first-letter {
  float: left; font-size: 3.3em; line-height: .82;
  padding: .06em .12em 0 0;
  color: var(--carmine-bright); font-weight: 500;
}
.article-body h2 {
  font-size: 1.55rem; font-weight: 500; line-height: 1.25;
  margin: 2em 0 .8em; letter-spacing: -0.01em;
}
.article-body h3 {
  font-size: 1.2rem; font-weight: 600; margin: 1.8em 0 .7em;
}
.article-body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--carmine);
  text-underline-offset: 3px;
}
.article-body a:hover { color: var(--carmine-bright); }
.article-body blockquote {
  margin: 1.8em 0; padding-left: 20px;
  border-left: 2px solid var(--carmine);
  font-style: italic; color: var(--muted);
}
.article-body ul, .article-body ol { margin: 0 0 1.45em 1.4em; }
.article-body li { margin-bottom: .5em; }
.article-body hr {
  border: none; border-top: 1px solid var(--line);
  margin: 2.4em auto; width: 120px;
}
.article-body code {
  font-family: var(--mono); font-size: .85em;
  background: var(--panel-2); padding: 2px 6px;
  border: 1px solid var(--line-soft);
}
.article-body strong { font-weight: 600; color: var(--strong); }

.end-mark {
  display: flex; justify-content: center; padding: 10px 0 56px;
}
.end-mark svg { width: 22px; height: 22px; color: var(--carmine); }

.article-next {
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 1fr;
}
.next-cell {
  padding: 26px 24px 30px; text-decoration: none;
  display: flex; flex-direction: column; gap: 10px;
}
.next-cell + .next-cell { border-left: 1px solid var(--line-soft); }
.next-cell:hover { background: var(--panel); }
.next-k {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  color: var(--faint); text-transform: uppercase;
}
.next-t { font-size: 1.25rem; font-weight: 500; line-height: 1.25; }
.next-cell:hover .next-t { color: var(--carmine-bright); }
.next-cell.empty { pointer-events: none; }

/* ---------- about page ---------- */
.about-grid {
  display: grid; grid-template-columns: 7fr 5fr;
}
.about-main { padding: 50px 40px 60px 24px; }
.about-main h1 {
  font-size: clamp(2rem, 4vw, 3rem); font-weight: 500;
  line-height: 1.08; letter-spacing: -0.015em; margin-bottom: 30px;
  max-width: 22ch;
}
.about-main p {
  max-width: 38rem; font-size: 1.12rem; line-height: 1.75;
  margin-bottom: 1.4em;
}
.about-main p strong { font-weight: 600; color: var(--strong); }
.about-side {
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.side-block { padding: 24px 26px 28px; border-bottom: 1px solid var(--line-soft); }
.side-k {
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  color: var(--carmine-bright); text-transform: uppercase; margin-bottom: 14px;
}
.desk-row { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.desk-row:last-child { border-bottom: none; }
.desk-name { font-size: 1.05rem; font-weight: 500; }
.desk-role {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  color: var(--faint); text-transform: uppercase; margin-top: 3px;
}
.side-block p.side-note {
  font-size: .98rem; font-style: italic; color: var(--muted); line-height: 1.6;
}
.side-mono {
  font-family: var(--mono); font-size: 12px; letter-spacing: .07em;
  color: var(--muted); line-height: 2;
}
.side-mono span { display: block; }

/* ---------- states ---------- */
.notice {
  margin: 60px auto; max-width: 34rem; padding: 26px 28px;
  border: 1px solid var(--line); font-family: var(--mono);
}
.notice h2 { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--carmine-bright); margin-bottom: 12px; }
.notice p { font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.notice code { color: var(--ink); }

/* ---------- footer ---------- */
#colophon { border-top: 1px solid var(--line); }
.foot-grid {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  padding: 26px 24px 34px;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint);
}
.foot-grid > div { display: flex; flex-direction: column; gap: 8px; }
.foot-name { color: var(--ink); letter-spacing: .3em; font-weight: 600; }
.foot-mid { text-align: center; align-items: center; }
.foot-right { text-align: right; align-items: flex-end; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .lead, .lead.has-media { grid-template-columns: 1fr; }
  .lead-media { padding: 22px 24px 0; }
  .lead-media::before, .lead-media::after { display: none; }
  .lead-meta {
    border-left: none; border-top: 1px solid var(--line-soft);
    padding: 22px 24px 30px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px;
  }
  .lead-go { grid-column: 1 / -1; margin-top: 8px; }
  .front-cols { grid-template-columns: 1fr; }
  .col-index { border-right: none; }
  .about-grid { grid-template-columns: 1fr; }
  .about-side { border-left: none; border-top: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .mast-top { grid-template-columns: auto 1fr; padding: 16px 18px 12px; }
  .mast-coords { display: none; }
  .logotype { font-size: 16px; }
  .mast-nav { gap: 18px; }
  .mast-rule { padding: 8px 18px; }
  .lead-body { padding: 38px 18px 42px; }
  .lead-body::before { left: 18px; }
  .lead-body::after { left: 18px; }
  .lead-kicker, .lead h1, .lead-dek { padding-left: 22px; }
  .lead-meta { grid-template-columns: 1fr; padding: 18px; }
  .sect-head { padding: 12px 18px; }
  .lead-media { padding: 18px 18px 0; }
  .row {
    display: block; position: relative;
    padding: 20px 136px 20px 18px;
  }
  .row-no, .row-date { display: inline-block; margin: 0 10px 6px 0; }
  .row-thumb {
    position: absolute; top: 24px; right: 18px; width: 104px;
  }
  .row-main { display: block; }
  .row-tags { text-align: left; margin-top: 8px; }
  .article-head-inner { padding: 36px 18px 40px; }
  .article-body { padding: 40px 18px 20px; font-size: 1.08rem; }
  .article-meta { gap: 16px; padding: 12px 18px; }
  .crumb { padding: 12px 18px; }
  .article-next { grid-template-columns: 1fr; }
  .next-cell + .next-cell { border-left: none; border-top: 1px solid var(--line-soft); }
  .about-main { padding: 38px 18px 44px; }
  .foot-grid { grid-template-columns: 1fr; gap: 18px; }
  .foot-mid, .foot-right { text-align: left; align-items: flex-start; }
}
