/* ============================================================
   PAX SILICA — DECODED
   base.css · tokens, fonts, reset, atmosphere layers
   ============================================================ */

@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/chakra-petch-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/chakra-petch-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/chakra-petch-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/space-grotesk-var.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-600-normal.woff2') format('woff2');
}

:root {
  /* --- depth base: tonal navy/charcoal, never flat black --- */
  --ink-0: #050810;
  --ink-1: #080d1a;
  --ink-2: #0c1425;
  --ink-3: #12203a;
  --ink-4: #1a2b4d;

  --line: rgba(126, 156, 208, 0.14);
  --line-2: rgba(126, 156, 208, 0.26);
  --line-3: rgba(160, 190, 235, 0.42);

  --txt: #e2e9f4;
  --txt-dim: #98a5bc;
  --txt-faint: #5f6d86;

  /* --- signal palette --- */
  --gold: #f2b53a;        /* Golden Node */
  --gold-hi: #ffd67e;
  --gold-deep: #b07d1a;
  --red: #ff4f60;         /* signal red / PH red */
  --red-deep: #c22839;
  --cyan: #45d8ff;        /* data / PH blue side */
  --cyan-deep: #1e8fc0;
  --blue: #4d82ff;
  --green: #6cf592;       /* verified / OK */
  --green-deep: #2fae5f;
  --amber: #ffb454;       /* target-date stamp */

  --gold-glow: rgba(242, 181, 58, 0.16);
  --cyan-glow: rgba(69, 216, 255, 0.13);
  --red-glow: rgba(255, 79, 96, 0.14);

  --font-display: 'Chakra Petch', 'Bahnschrift', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --font-body: 'Space Grotesk', 'Segoe UI', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;

  --wrap: 1240px;
  --rail-w: 78px;
  --topbar-h: 46px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snap: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--ink-4) var(--ink-0);
}

body {
  margin: 0;
  background: var(--ink-0);
  color: var(--txt);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* tonal depth wash over the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -4;
  background:
    radial-gradient(1100px 700px at 82% -8%, rgba(30, 62, 120, 0.34), transparent 62%),
    radial-gradient(900px 640px at -12% 34%, rgba(20, 44, 88, 0.30), transparent 60%),
    radial-gradient(1000px 760px at 68% 108%, rgba(64, 42, 10, 0.20), transparent 62%),
    linear-gradient(180deg, #070b15 0%, #05080f 46%, #060a13 100%);
}

::selection { background: rgba(242, 181, 58, 0.85); color: #14100a; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--gold-hi); }
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.04;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

p { margin: 0 0 1.05em; }
strong { color: var(--txt); font-weight: 600; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(20px, 4.5vw, 52px);
}

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

/* ============================================================
   ATMOSPHERE LAYERS
   ============================================================ */

/* circuit-trace grid */
.bg-circuit {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(110, 150, 210, 0.045) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(110, 150, 210, 0.045) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(0deg, rgba(110, 150, 210, 0.02) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(90deg, rgba(110, 150, 210, 0.02) 0 1px, transparent 1px 14px);
  mask-image: radial-gradient(120% 90% at 50% 40%, #000 30%, transparent 88%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 40%, #000 30%, transparent 88%);
}

/* faint topographic contours of Luzon */
.bg-contours {
  position: fixed;
  z-index: -3;
  pointer-events: none;
  right: -6vw;
  top: 8vh;
  width: min(52vw, 760px);
  opacity: 0.5;
}

/* scanline sweep */
.bg-scan {
  position: fixed;
  left: 0;
  right: 0;
  top: -12%;
  height: 11%;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(96, 200, 255, 0.05) 46%, rgba(96, 200, 255, 0.09) 50%, rgba(96, 200, 255, 0.05) 54%, transparent);
  animation: scan-sweep 11s linear infinite;
}
@keyframes scan-sweep {
  0% { transform: translateY(0); }
  100% { transform: translateY(1050%); }
}

/* wafer-diffraction glints */
.bg-glints {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(420px 300px at 12% 18%, rgba(69, 216, 255, 0.05), transparent 70%),
    radial-gradient(520px 380px at 88% 62%, rgba(242, 181, 58, 0.05), transparent 70%),
    radial-gradient(380px 300px at 60% 92%, rgba(120, 90, 255, 0.04), transparent 70%);
  animation: glint-drift 26s ease-in-out infinite alternate;
}
@keyframes glint-drift {
  0% { filter: hue-rotate(0deg); transform: translate3d(0, 0, 0); }
  100% { filter: hue-rotate(38deg); transform: translate3d(-1.5%, 1.5%, 0); }
}

#dust {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* ============================================================
   TYPE UTILITIES + EDITORIAL VOICE
   ============================================================ */

.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--txt-dim);
}
.kicker b { color: var(--gold); font-weight: 600; }

.lede {
  font-size: clamp(1.12rem, 1.5vw, 1.34rem);
  line-height: 1.55;
  color: var(--txt);
  max-width: 62ch;
}

.prose { max-width: 66ch; }
.prose p { color: #c6d1e2; }
.prose .hl-gold { color: var(--gold-hi); font-weight: 600; }
.prose .hl-cyan { color: var(--cyan); font-weight: 600; }
.prose .hl-red { color: var(--red); font-weight: 600; }
.prose .hl-green { color: var(--green); font-weight: 600; }

/* pull quotes */
.pull {
  position: relative;
  margin: 2.6rem 0;
  padding: 1.6rem clamp(1.2rem, 3vw, 2.2rem) 1.4rem;
  border-left: 3px solid var(--gold);
  background: linear-gradient(90deg, var(--gold-glow), transparent 68%);
}
.pull::before {
  content: "";
  position: absolute;
  left: -3px;
  top: -8px;
  width: 3px;
  height: 8px;
  background: var(--gold);
  box-shadow: 0 0 14px var(--gold);
}
.pull blockquote {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  line-height: 1.32;
  text-transform: none;
  letter-spacing: 0.005em;
  color: var(--txt);
}
.pull blockquote em { color: var(--gold-hi); font-style: normal; }
.pull cite {
  display: block;
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--txt-dim);
}
.pull--red { border-left-color: var(--red); background: linear-gradient(90deg, var(--red-glow), transparent 68%); }
.pull--red::before { background: var(--red); box-shadow: 0 0 14px var(--red); }
.pull--red blockquote em { color: var(--red); }
.pull--cyan { border-left-color: var(--cyan); background: linear-gradient(90deg, var(--cyan-glow), transparent 68%); }
.pull--cyan::before { background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }
.pull--cyan blockquote em { color: var(--cyan); }

/* dossier stamps */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  padding: 0.42em 0.8em;
  border: 1px solid currentColor;
  color: var(--txt-dim);
  white-space: nowrap;
}
.stamp--gold { color: var(--gold); }
.stamp--red { color: var(--red); }
.stamp--green { color: var(--green); }
.stamp--amber { color: var(--amber); }
.stamp--cyan { color: var(--cyan); }

/* corner-bracket frame */
.frame {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(16, 26, 48, 0.72), rgba(8, 13, 26, 0.9));
}
.frame::before, .frame::after,
.frame > .corner::before, .frame > .corner::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--gold);
  opacity: 0.85;
}
.frame::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.frame::after { top: -2px; right: -2px; border-left: 0; border-bottom: 0; }
.frame > .corner::before { bottom: -2px; left: -2px; border-right: 0; border-top: 0; }
.frame > .corner::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }

/* data readout rows */
.readout { border-top: 1px solid var(--line); }
.readout > div {
  display: grid;
  grid-template-columns: minmax(110px, 38%) 1fr;
  gap: 1rem;
  padding: 0.68rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.readout dt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--txt-faint);
  padding-top: 0.28em;
}
.readout dd { margin: 0; color: #c9d4e5; }
.readout dd b { color: var(--gold-hi); font-weight: 600; }

/* big stat blocks */
.stat {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(18, 30, 56, 0.6), rgba(8, 13, 26, 0.85));
  position: relative;
}
.stat::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 26px;
  height: 2px;
  background: var(--gold);
  opacity: 0.7;
}
.stat .num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 3.6vw, 3rem);
  line-height: 1;
  color: var(--gold-hi);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.stat .num.c-cyan { color: var(--cyan); }
.stat .num.c-green { color: var(--green); }
.stat .num.c-red { color: var(--red); }
.stat .lab {
  margin-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--txt-dim);
  line-height: 1.5;
}

/* citation sups */
.cite {
  font-family: var(--font-mono);
  font-size: 0.68em;
  vertical-align: super;
  line-height: 0;
  margin-left: 0.15em;
}
.cite a {
  color: var(--cyan-deep);
  border-bottom: 1px dotted rgba(69, 216, 255, 0.5);
  padding-bottom: 1px;
  transition: color 0.18s, border-color 0.18s;
}
.cite a:hover, .cite a:focus-visible { color: var(--gold-hi); border-color: var(--gold); }

#cite-tip {
  position: fixed;
  z-index: 90;
  max-width: 320px;
  padding: 0.7rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--txt);
  background: rgba(10, 17, 32, 0.96);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--cyan);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.16s, transform 0.16s;
}
#cite-tip.on { opacity: 1; transform: translateY(0); }
#cite-tip .tip-src { color: var(--gold-hi); display: block; margin-bottom: 0.25rem; letter-spacing: 0.08em; }

/* source flash on jump */
@keyframes src-flash {
  0% { background: rgba(242, 181, 58, 0.28); }
  100% { background: transparent; }
}
.src-flash { animation: src-flash 1.6s var(--ease-out); }

/* ============================================================
   REVEAL SYSTEM (JS-gated so no-JS stays visible)
   ============================================================ */
.js .rv { opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); transition-delay: var(--d, 0s); }
.js .rv-l { transform: translateX(-34px); }
.js .rv-r { transform: translateX(34px); }
.js .rv-s { transform: scale(0.94); }
.js .rv-in { opacity: 1; transform: none; }

/* ============================================================
   REDUCED MOTION — calmer, equally complete
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .bg-scan, .bg-glints { display: none; }
  .js .rv { opacity: 1; transform: none; }
}
