/* =================================================================
   MEDUMOND — Base: reset, dark-document defaults, helpers, animations.
   Cinematic single-page system.
   ================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);   /* offset anchor jumps for the fixed nav */
}
html:focus-within { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ivory);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, canvas { display: block; max-width: 100%; }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

::selection { background: var(--green); color: var(--ink); }

/* ---- Layout helpers ---- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.container--narrow { max-width: var(--container-narrow); }

/* ---- Chapter primitives ---- */
.chapter { padding-block: var(--space-10); position: relative; }
.chapter--deep { background: var(--ink-deep); }

/* Mono chapter label ("01 — The Clinical Reality") */
.chapter__label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono-label);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-2);
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}
.chapter__label::before {
  content: "";
  width: 28px; height: 1px;
  background: var(--green);
  display: inline-block;
}

.chapter__title {
  font-size: var(--fs-h2);
  color: var(--ivory);
  margin-top: var(--space-4);
  max-width: 22ch;
}
.chapter__intro {
  margin-top: var(--space-4);
  max-width: 60ch;
  font-size: var(--fs-lead);
  color: var(--ivory-soft);
}

/* Oversized mono numeral (01, 02 …) */
.numeral {
  font-family: var(--font-mono);
  font-size: var(--fs-numeral);
  font-weight: 300;
  color: var(--green);
  opacity: 0.55;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Technical mono tag ("PATH-01", "Layer 1 of 4", "EV-01") */
.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-2);
}

/* Status badge (bordered pill with optional pulsing dot) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--ivory-soft);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
}
.badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(63,163,125,0.6);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(63,163,125,0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(63,163,125,0); }
  100% { box-shadow: 0 0 0 0 rgba(63,163,125,0); }
}

/* Outcome / Synthesis / Principle block */
.outcome {
  border-left: 2px solid var(--green);
  padding: var(--space-5) var(--space-6);
  margin-top: var(--space-7);
  background: linear-gradient(90deg, var(--green-soft), transparent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.outcome__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-2);
  display: block;
  margin-bottom: var(--space-2);
}
.outcome p { color: var(--ivory); font-size: 1.05rem; }

/* Visually-hidden (a11y) */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Scroll-reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--t-reveal) var(--ease), transform var(--t-reveal) var(--ease);
  will-change: opacity, transform;
}
.reveal.from-left { transform: translateX(-36px); }
.reveal.from-right { transform: translateX(36px); }
.reveal.is-visible { opacity: 1; transform: none; }

/* Stagger helper */
.reveal[data-delay="1"] { transition-delay: 0.1s; }
.reveal[data-delay="2"] { transition-delay: 0.2s; }
.reveal[data-delay="3"] { transition-delay: 0.3s; }
.reveal[data-delay="4"] { transition-delay: 0.4s; }

/* ---- Respect reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
  .container { padding-inline: var(--space-5); }
  .chapter { padding-block: var(--space-9); }
}
