/* ============ The Cloud Next Door — technical broadsheet ============ */

:root {
  --paper: #f3f2ec;
  --paper-deep: #e9e7dc;
  --ink: #15171a;
  --ink-soft: #474b52;
  --rule: #cfccbd;
  --wire: #2b5d8a;         /* the cloud — headers, links */
  --measured: #1e5f4a;     /* a meter, a court record */
  --estimate: #a87b2d;     /* a model, methodology stated */
  --disputed: #a8431a;     /* boundary-dependent, contested */
  --serif: "Newsreader", Georgia, serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* stop mobile browsers inflating font sizes (breaks the centered masthead) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.16rem;
  line-height: 1.62;
  background-image:
    radial-gradient(ellipse at top, rgba(255,255,255,.5), transparent 60%),
    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.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

a { color: var(--wire); text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- masthead ---------- */

.masthead {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem 2rem;
  border-bottom: 3px double var(--rule);
}

.kicker {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.2rem;
}

.masthead h1 {
  font-family: var(--display);
  font-variation-settings: "SOFT" 0, "WONK" 0;
  font-weight: 600;
  font-size: clamp(2.5rem, 7.5vw, 5.2rem);
  line-height: 1.02;
  margin: 0 0 2rem;
  letter-spacing: -.01em;
}

.masthead h1 em { font-style: italic; color: var(--wire); }

.standfirst {
  max-width: 38em;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 300;
  margin: 0 auto 1.4rem;
}

.byline {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--ink-soft);
  max-width: 46em;
  margin: 0 auto 2rem;
}

.scroll-cue {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--ink-soft);
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .scroll-cue { animation: none; }
}

/* ---------- prose ---------- */

.prose {
  max-width: 42em;
  margin: 0 auto;
  padding: 4rem 1.5rem 1rem;
}

.prose h2 {
  font-family: var(--display);
  font-variation-settings: "SOFT" 0, "WONK" 1;
  font-weight: 720;
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  line-height: 1.08;
  margin: 0 0 1.2rem;
}

.section-no {
  display: block;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--wire);
  margin-bottom: .8rem;
}
.section-no::after {
  content: "";
  display: block;
  width: 3.2rem;
  border-bottom: 3px solid var(--wire);
  margin-top: .5rem;
}

/* ---------- confidence tags ---------- */

/* Inline epistemic-status chips: ✓ measured, ≈ estimate, ? disputed.
   One per claim cluster; each maps to a row (and its grade column) in
   tools/datacenters/research/claims.md. The word lives in the tooltip. */
.conf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  vertical-align: .18em;
  cursor: help;
}
.conf-measured { color: var(--measured); background: rgba(30,95,74,.07); }
.conf-estimate { color: var(--estimate); background: rgba(168,123,45,.09); }
.conf-disputed { color: var(--disputed); background: rgba(168,67,26,.08); }

/* ---------- zoom widget ---------- */

.zoom-widget { margin: 2.2rem 0 1rem; }

.zoom-fallback {
  font-family: var(--mono);
  font-size: .85rem;
  line-height: 1.9;
  color: var(--ink-soft);
  padding-left: 1.2rem;
}

.zoom-row { margin-bottom: 1.6rem; }

.zoom-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .35rem;
}
.zoom-place {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
}
.zoom-figure {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--ink-soft);
}
.zoom-figure strong { color: var(--ink); font-weight: 600; }

.zoom-track {
  position: relative;
  height: 16px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
}
.zoom-bar {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 0;
  min-width: 2px;   /* the world row stays visible at 1.5% */
}
.zoom-row.grade-measured .zoom-bar { background: var(--measured); }
.zoom-row.grade-estimate .zoom-bar { background: var(--estimate); }
.zoom-row.grade-disputed .zoom-bar { background: var(--disputed); }
@media (prefers-reduced-motion: no-preference) {
  .zoom-bar { transition: width 1s cubic-bezier(.25,.7,.3,1); }
}

.zoom-src {
  font-family: var(--mono);
  font-size: .66rem;
  color: var(--ink-soft);
  margin: .3rem 0 0;
}

.widget-note {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* ---------- comparison strip (a question next to a flight) ---------- */

.compare-strip {
  margin: 2rem 0;
  border-top: 1px solid var(--rule);
}
.compare-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--rule);
}
.compare-act {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
}
.compare-fig {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.compare-fig strong { color: var(--ink); font-weight: 600; }

@media (max-width: 480px) {
  .compare-row { flex-direction: column; gap: .25rem; }
  .compare-fig { white-space: normal; }
}

/* ---------- close & footer ---------- */

.fin {
  font-family: var(--display);
  font-weight: 550;
  font-size: 1.35rem;
  line-height: 1.45;
  border-top: 3px double var(--rule);
  padding-top: 1.6rem;
  margin-top: 2.4rem;
}

.essay-trail {
  margin-top: 2rem;
  font-size: .9rem;
  color: var(--ink-soft);
  line-height: 1.7;
}
.essay-trail p { margin: 0; }
.essay-trail a { color: var(--ink-soft); text-underline-offset: 3px; }
.essay-trail a:hover { color: var(--ink); }
.essay-trail--before-sources {
  margin: 0 0 1.25rem;
  padding: 0;
  max-width: none;
}

.methodology {
  border-top: 3px double var(--rule);
  margin-top: 5rem;
  padding: 2.5rem 1.5rem 4rem;
  max-width: 46em;
  margin-left: auto;
  margin-right: auto;
  font-size: .88rem;
  color: var(--ink-soft);
}
.methodology h3 { font-family: var(--display); color: var(--ink); }

#sources { position: relative; z-index: 1; background: var(--paper); }
.sources-list dt { font-weight: 600; margin-top: .9rem; }
.sources-list dd { margin: .1rem 0 0 0; font-size: .95rem; color: var(--ink-soft); }
.sources-note {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--ink-soft);
  margin-top: 1.5rem;
  line-height: 1.6;
}

.read-next { margin-bottom: 2.2rem; }
.read-next p {
  font-size: .92rem;
  color: var(--ink-soft);
  margin: .5rem 0;
  line-height: 1.55;
}
.read-next a { font-weight: 600; }

.series-nav {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: .5rem 0 1.5rem;
}
.series-nav a { color: var(--ink); text-decoration: none; }
.series-nav a:hover { text-decoration: underline; }
.series-nav .series-here { color: var(--ink-soft); font-style: italic; }

/* back link to the Notes & Tones home */
.site-back {
  font-family: "IBM Plex Mono", monospace;
  font-size: .8rem;
  letter-spacing: .04em;
  padding: .9rem clamp(1.2rem, 5vw, 2.4rem);
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .3rem 1.5rem;
}
.site-back a { color: var(--wire); text-decoration: none; }
.site-back a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- mobile ---------- */

@media (max-width: 480px) {
  .masthead h1 { font-size: clamp(1.6rem, 11.5vw, 2.5rem); }
  .zoom-head { flex-direction: column; gap: .1rem; }
}
