/* Cosmic Warning Network — site styles */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/fraunces-italic-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plexmono-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/plexmono-500-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #07080b;
  --bg-2: #0d0e13;
  --ink: #ece8de;
  --ink-body: #cfcabf;
  --ink-2: #a39e91;
  --ink-3: #6b675e;
  --line: rgba(236, 232, 222, 0.11);
  --line-strong: rgba(236, 232, 222, 0.26);
  --accent: #d9a13b;
  --accent-soft: rgba(217, 161, 59, 0.14);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.65, 0.2, 1);
  --gutter: clamp(20px, 6vw, 96px);
  --measure: 38rem;
  --side: 14rem;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 0, "WONK" 0;
  font-size: clamp(1.0625rem, 0.98rem + 0.35vw, 1.2rem);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--bg); }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

a { color: inherit; text-decoration: none; }

abbr[title] { text-decoration: none; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 0.9rem;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.skip:focus { top: 1rem; }

/* ---------- Starfield (fixed, behind everything) ---------- */

.field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}
.field svg { width: 100%; height: 100%; display: block; }

/* ---------- Labels ---------- */

.label {
  margin: 0;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.6;
}
.label--dim { color: var(--ink-3); }

/* ---------- Top bar ---------- */

.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4rem;
  padding: 0 var(--gutter);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: linear-gradient(to bottom, rgba(7, 8, 11, 0.92), rgba(7, 8, 11, 0.55));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  white-space: nowrap;
}
.mark svg { width: 20px; height: 20px; flex: none; }
.mark__glyph-ring { stroke: var(--ink); }
.mark__glyph-core { fill: var(--accent); }

.top__status {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: blink 2.6s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (max-width: 760px) {
  .top__status span.long { display: none; }
}
@media (max-width: 560px) {
  .top__status { display: none; }
}

/* ---------- Hero ---------- */

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

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding: 8rem var(--gutter) 6rem;
  overflow: hidden;
  isolation: isolate;
}

.hero > :not(.hero__rings) { position: relative; z-index: 1; }

.hero h1 {
  margin: 1.25rem 0 1.75rem;
  max-width: 14ch;
  font-weight: 300;
  font-size: clamp(2.7rem, 1.4rem + 5.2vw, 6.2rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  text-wrap: balance;
}

.hero__lede {
  margin: 0;
  max-width: 34rem;
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.55rem);
  line-height: 1.42;
  color: var(--ink-2);
  text-wrap: pretty;
}

.hero__cue {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 3.5rem;
  width: fit-content;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: color 0.4s var(--ease);
}
.hero__cue:hover { color: var(--ink); }
.hero__cue svg {
  width: 14px;
  height: 14px;
  stroke: var(--accent);
  animation: bob 2.8s var(--ease) infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

.hero__rings {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: calc(-1 * clamp(4rem, 12vw, 14rem));
  width: min(92vmin, 980px);
  height: min(92vmin, 980px);
  transform: translateY(-50%);
  color: var(--line-strong);
  pointer-events: none;
}
.rings { width: 100%; height: 100%; display: block; overflow: visible; }
.rings__static circle { stroke-width: 1; vector-effect: non-scaling-stroke; }
.rings__static circle:nth-child(1) { opacity: 0.9; }
.rings__static circle:nth-child(2) { opacity: 0.7; }
.rings__static circle:nth-child(3) { opacity: 0.5; }
.rings__static circle:nth-child(4) { opacity: 0.35; }
.rings__static circle:nth-child(5) { opacity: 0.22; }
.rings__axis { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rings__core { fill: var(--accent); }
.rings__halo {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.6;
  vector-effect: non-scaling-stroke;
}
.pulse {
  stroke: var(--accent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: pulse 7.5s cubic-bezier(0.15, 0.6, 0.4, 1) infinite;
}
.pulse:nth-child(2) { animation-delay: 2.5s; }
.pulse:nth-child(3) { animation-delay: 5s; }
@keyframes pulse {
  0% { transform: scale(0.04); opacity: 0.95; }
  60% { opacity: 0.28; }
  100% { transform: scale(1); opacity: 0; }
}

@media (max-width: 820px) {
  .hero { padding-top: 7rem; padding-bottom: 5rem; }
  .hero__rings {
    top: 9rem;
    right: -30vw;
    width: 110vw;
    height: 110vw;
    transform: none;
    opacity: 0.6;
  }
}

/* ---------- Sections ---------- */

.part {
  border-top: 1px solid var(--line);
  padding: clamp(4.5rem, 10vw, 8.5rem) var(--gutter);
  background: linear-gradient(to bottom, rgba(7, 8, 11, 0.55), rgba(7, 8, 11, 0.55));
}

.part__inner {
  display: grid;
  grid-template-columns: var(--side) minmax(0, var(--measure));
  column-gap: clamp(2rem, 6vw, 7rem);
  justify-content: start;
}

.part__side {
  position: sticky;
  top: 6rem;
  align-self: start;
  display: grid;
  gap: 0.5rem;
}
.part__num {
  margin: 0 0 0.25rem;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.part__side .label { max-width: 11rem; }

.part h2 {
  margin: 0 0 1.75rem;
  font-weight: 400;
  font-size: clamp(1.7rem, 1.25rem + 1.9vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.018em;
  font-variation-settings: "opsz" 96, "SOFT" 0, "WONK" 0;
  text-wrap: balance;
}

.part p { margin: 0 0 1.4em; color: var(--ink-body); text-wrap: pretty; }
.part p:last-child { margin-bottom: 0; }

.turn {
  margin: 3rem 0 0 !important;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--ink) !important;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  text-wrap: balance;
}
.callout {
  margin: 3rem 0 0 !important;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.75rem);
  line-height: 1.32;
  letter-spacing: -0.005em;
  color: var(--ink) !important;
  font-variation-settings: "opsz" 72, "SOFT" 0, "WONK" 0;
  text-wrap: pretty;
}
.turn::before, .callout::before {
  content: "";
  display: block;
  width: 3rem;
  height: 1px;
  margin-bottom: 1.5rem;
  background: var(--accent);
}

/* Stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 2rem 3rem;
  margin: 3rem 0;
  padding: 2.25rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat { margin: 0; }
.stat__n {
  display: block;
  font-weight: 300;
  font-size: clamp(2.6rem, 1.8rem + 3.2vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  color: var(--ink);
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
}
.stat__l {
  display: block;
  margin-top: 0.85rem;
  max-width: 16rem;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  line-height: 1.7;
  text-transform: uppercase;
  color: var(--ink-3);
}

@media (max-width: 820px) {
  .part__inner { grid-template-columns: minmax(0, 1fr); row-gap: 1.75rem; }
  .part__side { position: static; grid-template-columns: auto 1fr; align-items: baseline; gap: 1rem; }
  .part__num { font-size: 1.5rem; margin: 0; }
}

/* ---------- Closing ---------- */

.close {
  position: relative;
  border-top: 1px solid var(--line);
  padding: clamp(6rem, 15vw, 13rem) var(--gutter);
  background:
    radial-gradient(ellipse 70% 60% at 50% 115%, var(--accent-soft), transparent 70%),
    linear-gradient(to bottom, rgba(7, 8, 11, 0.55), rgba(7, 8, 11, 0.7));
  overflow: hidden;
}
.close h2 {
  margin: 1.25rem 0 2rem;
  max-width: 15ch;
  font-weight: 300;
  font-size: clamp(2.4rem, 1.4rem + 5vw, 6.2rem);
  line-height: 1.0;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  text-wrap: balance;
}
.close p {
  margin: 0;
  max-width: 34rem;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* ---------- Footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  padding: 2rem var(--gutter) 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  justify-content: space-between;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: rgba(7, 8, 11, 0.7);
}
.foot p { margin: 0; }
.foot a:hover { color: var(--ink); }

/* ---------- Not found page ---------- */

.nf {
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding: 8rem var(--gutter) 6rem;
}
.nf h1 {
  margin: 1rem 0 1.5rem;
  font-weight: 300;
  font-size: clamp(2.5rem, 1.5rem + 5vw, 6rem);
  line-height: 1;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
}
.nf p { margin: 0 0 2.5rem; max-width: 30rem; color: var(--ink-2); }

/* ---------- Reveal on scroll ---------- */

.js .r {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.js .r.in { opacity: 1; transform: none; }
.js .hero .r:nth-child(2) { transition-delay: 0.08s; }
.js .hero .r:nth-child(3) { transition-delay: 0.18s; }
.js .hero .r:nth-child(4) { transition-delay: 0.3s; }
.js .hero .r:nth-child(5) { transition-delay: 0.42s; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  .js .r { opacity: 1; transform: none; transition: none; }
  .pulse, .dot, .hero__cue svg { animation: none; }
  .pulse { opacity: 0; }
}

@media print {
  .field, .hero__rings, .top, .hero__cue { display: none; }
  body { background: #fff; color: #000; }
  .part p, .close p { color: #000; }
}
