/* ============================================================
   PAX SILICA — base.css
   Reset, global atmosphere layers, base typography, utilities.
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink-body);
  background-color: var(--bg-void);
  overflow-x: hidden;
}

html, body { overflow-x: clip; }
main.page { overflow-x: clip; }

img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input { font: inherit; }
a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #8ce7ff; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

::selection { background: rgba(242, 182, 60, 0.32); color: #fff8ea; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 200;
  background: var(--bg-3); color: var(--ink-hi);
  padding: .5rem .9rem; font-family: var(--font-mono); font-size: var(--step--2);
  border: 1px solid var(--line-strong);
  transition: top .2s var(--ease-boot);
}
.skip-link:focus-visible { top: 1rem; }

/* ---------- global fixed atmosphere ---------------------------------- */

.atmo {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.atmo__vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 18% -10%, rgba(30, 48, 96, 0.32), transparent 60%),
    radial-gradient(90% 80% at 88% 12%, rgba(20, 68, 92, 0.25), transparent 55%),
    radial-gradient(110% 110% at 50% 118%, rgba(70, 40, 16, 0.22), transparent 58%),
    linear-gradient(180deg, #05070f 0%, #070b17 40%, #060811 100%);
}
.atmo__grid {
  position: absolute; inset: -1px;
  background-image:
    linear-gradient(rgba(126, 152, 208, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 152, 208, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(126, 152, 208, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 152, 208, 0.03) 1px, transparent 1px);
  background-size: 140px 140px, 140px 140px, 35px 35px, 35px 35px;
  mask-image: radial-gradient(130% 120% at 50% 0%, black 35%, rgba(0,0,0,.35) 75%);
  opacity: .55;
}
#dust { position: fixed; inset: 0; z-index: 1; pointer-events: none; }

.scanline {
  position: fixed; left: 0; right: 0; height: 34vh; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(120, 190, 255, 0.028) 42%,
    rgba(150, 210, 255, 0.05) 50%,
    rgba(120, 190, 255, 0.028) 58%,
    transparent 100%);
  animation: scan-drift 13s linear infinite;
  mix-blend-mode: screen;
}
@keyframes scan-drift {
  from { transform: translateY(-45vh); }
  to   { transform: translateY(145vh); }
}

.wafer-glints { position: absolute; inset: 0; overflow: hidden; }
.wafer-glints i {
  position: absolute; width: 26vmin; height: 26vmin; border-radius: 50%;
  background: radial-gradient(circle,
    rgba(148, 200, 255, 0.055) 0%,
    rgba(242, 182, 60, 0.035) 38%,
    transparent 70%);
  filter: blur(6px);
  animation: glint-pulse 9s ease-in-out infinite;
}
.wafer-glints i:nth-child(1) { top: -6%; right: 8%; animation-delay: 0s; }
.wafer-glints i:nth-child(2) { bottom: 12%; left: -6%; width: 34vmin; height: 34vmin; animation-delay: 3.2s; }
.wafer-glints i:nth-child(3) { top: 44%; right: -9%; width: 30vmin; height: 30vmin; animation-delay: 6.1s; }
@keyframes glint-pulse {
  0%, 100% { opacity: .15; transform: scale(.92); }
  50% { opacity: .75; transform: scale(1); }
}

/* ---------- layout shell --------------------------------------------- */

.page {
  position: relative; z-index: 3;
  padding-left: 0;
}
@media (min-width: 1080px) {
  .page { padding-left: var(--rail-w); }
}

.section {
  position: relative;
  padding: var(--sec-pad-y) var(--gutter);
  max-width: 1460px;
  margin-inline: auto;
}
.section + .section { border-top: 1px solid var(--line-faint); }

/* extreme type contrast kit */
.mono {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: .08em;
}
.microlabel {
  font-family: var(--font-mono);
  font-size: var(--step--3);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.display {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink-hi);
  line-height: .98;
  letter-spacing: .01em;
}

/* long-form reading passages only — warm humanist serif (territory) */
.prose {
  font-family: var(--font-serif);
  font-size: clamp(1.02rem, .97rem + .3vw, 1.19rem);
  line-height: 1.78;
  color: var(--ink-body);
  max-width: var(--measure);
}
.prose p + p { margin-top: 1em; }
.prose strong { color: var(--ink-hi); font-weight: 600; }
.prose em { color: #dde6f6; }
.lede { font-size: clamp(1.14rem, 1.06rem + .5vw, 1.42rem); line-height: 1.72; }

.sans-body { font-size: var(--step--1); color: var(--ink-mid); line-height: 1.66; }

/* pull quotes are long-form reading — serif italic voice */
.pullquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.3rem, 1.05rem + 1.5vw, 2.05rem);
  line-height: 1.42;
  color: #f2ead6;
  position: relative;
  padding-left: clamp(1.2rem, 3vw, 2.2rem);
  max-width: 34ch;
}
.pullquote::before {
  content: "";
  position: absolute; left: 0; top: .28em; bottom: .28em; width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  box-shadow: 0 0 18px rgba(242, 182, 60, .4);
}
.pullquote cite {
  display: block; margin-top: .9rem;
  font-family: var(--font-mono); font-style: normal;
  font-size: var(--step--2); letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold-bright);
}
.pullquote--red::before { background: linear-gradient(180deg, var(--red), var(--red-deep)); box-shadow: 0 0 18px rgba(255,84,100,.35); }
.pullquote--red cite { color: var(--red); }
.pullquote--cyan::before { background: linear-gradient(180deg, var(--cyan), var(--blue)); box-shadow: 0 0 18px rgba(69,216,255,.35); }
.pullquote--cyan cite { color: var(--cyan); }

/* ---------- status chips / tags -------------------------------------- */

.chip {
  display: inline-flex; align-items: center; gap: .45em;
  font-family: var(--font-mono);
  font-size: var(--step--3);
  letter-spacing: .16em; text-transform: uppercase;
  padding: .34em .7em;
  border: 1px solid var(--line-soft);
  color: var(--ink-mid);
  white-space: nowrap;
}
.chip::before { content: ""; width: 5px; height: 5px; background: currentColor; flex: none; }

.chip--confirmed { color: var(--green); border-color: rgba(82,238,160,.42); background: var(--green-a12); }
.chip--confirmed::before { box-shadow: 0 0 7px currentColor; }
.chip--target { color: var(--gold-bright); border-style: dashed; border-color: rgba(242,182,60,.52); background: var(--gold-a12); }
.chip--target::before { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); border-radius: 0; }
.chip--alert { color: var(--red); border-color: rgba(255,84,100,.45); background: var(--red-a12); }
.chip--data { color: var(--cyan); border-color: rgba(69,216,255,.4); background: var(--cyan-a10); }
.chip--node { color: var(--gold-bright); border-color: rgba(242,182,60,.6); background: var(--gold-a12); }
.chip--guest { color: var(--violet); border-color: rgba(164,139,255,.4); background: var(--violet-a15); }
.chip--muted { color: var(--ink-dim); }

/* citation chip: anchor w/ hover tooltip (CSS-only) */
.cite {
  position: relative;
  font-family: var(--font-mono);
  font-size: .62rem;
  letter-spacing: .07em;
  color: var(--cyan);
  border: 1px solid rgba(69,216,255,.35);
  background: var(--cyan-a10);
  padding: .1em .38em;
  margin-left: .3em;
  vertical-align: super;
  text-decoration: none;
  cursor: help;
  transition: background .15s ease, color .15s ease;
}
.cite:hover, .cite:focus-visible { background: rgba(69,216,255,.24); color: #aeeaff; }
.cite::after {
  content: attr(data-cite);
  position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%) translateY(3px);
  min-width: max-content; max-width: 280px; width: max-content;
  background: #0c1322;
  color: var(--ink-body);
  border: 1px solid var(--line-strong);
  padding: .45em .7em;
  font-size: .64rem; letter-spacing: .04em;
  line-height: 1.45;
  opacity: 0; visibility: hidden;
  transition: opacity .18s ease, transform .18s ease;
  z-index: var(--z-tooltip);
  box-shadow: 0 10px 28px rgba(0,0,0,.55);
  white-space: normal;
}
.cite:hover::after, .cite:focus-visible::after {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

/* ---------- reveal system -------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity var(--dur-reveal) var(--ease-boot),
    transform var(--dur-reveal) var(--ease-boot);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}
[data-reveal].is-in { opacity: 1; transform: none; }

[data-reveal="x"] { transform: translateX(-30px); }
[data-reveal="stamp"] { transform: rotate(-5deg) scale(1.3); opacity: 0; }
[data-reveal="stamp"].is-in {
  animation: stamp-settle var(--dur-stamp) var(--ease-settle) forwards;
}
@keyframes stamp-settle {
  0%   { opacity: 0; transform: rotate(-5deg) scale(1.3); filter: blur(3px); }
  55%  { opacity: 1; transform: rotate(-7deg) scale(.94); filter: blur(0); }
  100% { transform: rotate(-6deg) scale(1); }
}

html.no-motion [data-reveal],
html.no-motion [data-reveal].is-in,
html:not(.js) [data-reveal] {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
  transition: none !important;
}

/* ---------- dossier panel primitives --------------------------------- */

.panel {
  position: relative;
  background:
    linear-gradient(158deg, rgba(23, 33, 58, 0.72), rgba(12, 18, 33, 0.88));
  border: 1px solid var(--line-soft);
  box-shadow: var(--panel-shadow);
}
.panel__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem .95rem;
  border-bottom: 1px solid var(--line-faint);
  background: rgba(8, 12, 24, 0.55);
}
.panel__title {
  font-family: var(--font-mono);
  font-size: var(--step--3);
  letter-spacing: .24em; text-transform: uppercase;
  color: var(--ink-mid);
}
.panel__dots { display: inline-flex; gap: 5px; }
.panel__dots i { width: 6px; height: 6px; border: 1px solid var(--line-strong); transform: rotate(45deg); }
.panel__body { padding: 1.15rem 1.2rem 1.35rem; }

.corner-ticks::before,
.corner-ticks::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
}
.corner-ticks::before { top: -1px; left: -1px; border-top: 2px solid var(--gold-a45); border-left: 2px solid var(--gold-a45); }
.corner-ticks::after  { bottom: -1px; right: -1px; border-bottom: 2px solid var(--gold-a45); border-right: 2px solid var(--gold-a45); }

/* section header scaffold */
.sec-head { position: relative; margin-bottom: clamp(2rem, 5vh, 3.6rem); }
.sec-head .sec-index {
  position: absolute; z-index: 0; right: 0; top: -.18em;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(6.5rem, 16vw, 15rem);
  line-height: 1; color: transparent;
  -webkit-text-stroke: 1px rgba(150, 178, 230, 0.14);
  user-select: none; pointer-events: none;
}
.sec-kicker {
  display: flex; align-items: center; gap: .8rem;
  margin-bottom: 1rem;
}
.sec-kicker .rule { height: 1px; flex: 0 1 90px; background: linear-gradient(90deg, var(--gold-a45), transparent); }
.sec-title {
  font-size: var(--step-4);
  letter-spacing: .015em;
  margin-bottom: .9rem;
}
.sec-sub {
  max-width: 60ch;
  font-size: var(--step-1);
  color: var(--ink-mid);
  line-height: 1.5;
}

/* stamped header plate */
.stamp {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--gold-bright);
  border: 2px solid rgba(242, 182, 60, 0.65);
  padding: .45em 1em .4em 1.3em;
  position: relative;
  transform: rotate(-6deg);
  background:
    repeating-linear-gradient(-45deg, rgba(242,182,60,.05) 0 6px, transparent 6px 12px), var(--gold-a12);
  text-shadow: 0 0 14px rgba(242, 182, 60, .35);
  box-shadow: 0 0 22px rgba(242, 182, 60, .12);
}
.stamp--red { color: #ffb3bc; border-color: rgba(255, 84, 100, .6); background: repeating-linear-gradient(-45deg, rgba(255,84,100,.05) 0 6px, transparent 6px 12px), var(--red-a12); text-shadow: 0 0 14px rgba(255,84,100,.3); }
.stamp--green { color: #b7ffd9; border-color: rgba(82,238,160,.55); background: repeating-linear-gradient(-45deg, rgba(82,238,160,.05) 0 6px, transparent 6px 12px), var(--green-a12); text-shadow: none; }
.stamp--cyan { color: #c3efff; border-color: rgba(69,216,255,.55); background: repeating-linear-gradient(-45deg, rgba(69,216,255,.05) 0 6px, transparent 6px 12px), var(--cyan-a10); text-shadow: none; }

/* reduced motion collapses atmosphere */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scanline { display: none; }
  .wafer-glints i { animation: none; opacity: .3; }
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}
html.no-motion .atmo__grid { opacity: .4; }
