/* ============================================
   Base — Reset, Typography, Utilities (Revamped 2026)
   ============================================ */

/* ── Reset ── */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--paper); /* prevents white background when zoomed out beyond viewport */
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: var(--font-light);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  /* Subtle grain texture */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-blend-mode: multiply;
  background-size: 150px 150px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: .025;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body.loading { overflow: hidden; }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 { font-weight: var(--font-light); line-height: 1.1; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* ── Selection ── */
::selection { background: var(--forest); color: var(--gold); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--gold-30); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }

/* ── Focus ── */
:focus-visible { outline: 2px solid var(--forest); outline-offset: 3px; }

/* ── Containers ── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 64px);
}
.container--wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 64px);
}

/* ── Section defaults ── */
section { padding: var(--space-3xl) 0; }

/* ── Eyebrow ── */
.section-eyebrow {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: 13px;
  letter-spacing: .18em;
  color: var(--gold-text);
  display: block;
  margin-bottom: var(--space-md);
}

/* ── Section Title ── */
.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.8rem, 5vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--forest);
  margin-bottom: var(--space-md);
}
.section-title em {
  font-style: italic;
  color: var(--gold-text);
}

/* ── Gold divider ── */
.gold-line {
  width: 56px;
  height: 1px;
  background: var(--gold-grad);
  margin-bottom: 32px;
  border: none;
}

/* ── Buttons — see css/buttons.css for the full system ── */
/* Legacy aliases kept for any inline usage */
.btn-primary { /* defined in buttons.css */ }
.btn-ghost   { /* defined in buttons.css */ }
.btn-champ   { /* defined in buttons.css */ }

/* ─────────────────────────────────────────
   REVEAL ANIMATIONS
───────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s var(--ease-default), transform .8s var(--ease-default);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-children > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s var(--ease-default), transform .6s var(--ease-default);
}
.reveal-children.visible > * { opacity: 1; transform: translateY(0); }
.reveal-children.visible > *:nth-child(1) { transition-delay: 0s; }
.reveal-children.visible > *:nth-child(2) { transition-delay: .08s; }
.reveal-children.visible > *:nth-child(3) { transition-delay: .16s; }
.reveal-children.visible > *:nth-child(4) { transition-delay: .24s; }
.reveal-children.visible > *:nth-child(5) { transition-delay: .30s; }
.reveal-children.visible > *:nth-child(6) { transition-delay: .36s; }

/* ─────────────────────────────────────────
   PAGE LOADER
───────────────────────────────────────── */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity .6s var(--ease-default), visibility .6s;
}
.loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-brand {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--forest);
  opacity: 0;
  transform: translateY(10px);
  animation: loaderFadeIn .8s .2s var(--ease-default) forwards;
}
.loader-line {
  width: 56px;
  height: 1px;
  background: var(--gold-30);
  margin-top: 20px;
  position: relative;
  overflow: hidden;
}
.loader-line::after {
  content: '';
  position: absolute;
  left: -100%;
  top: 0;
  width: 100%;
  height: 100%;
  background: var(--gold-grad);
  animation: loaderSlide 1.2s .4s var(--ease-default) forwards;
}

@keyframes loaderFadeIn { to { opacity: 1; transform: translateY(0); } }
@keyframes loaderSlide   { to { left: 0; } }

/* ─────────────────────────────────────────
   STAT COUNTERS (authority section)
───────────────────────────────────────── */
.stat-num {
  font-family: var(--serif);
  font-size: 3.2rem;
  font-weight: 500;
  color: var(--forest);
  line-height: 1;
  /* Ensure visible on light background */
  text-shadow: none;
  opacity: 1;
}
.stat-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.88rem;
  letter-spacing: .06em;
  color: var(--ink);
  opacity: .65;
  margin-top: 8px;
  font-weight: 400;
}

/* ─────────────────────────────────────────
   CARD BASE
───────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid rgba(var(--gold-rgb), .44);
  border-radius: var(--radius-md);
  padding: clamp(22px, 3vw, 36px);
  box-shadow: var(--shadow-card);
}

/* ─────────────────────────────────────────
   TOPBAR (shared component for quiz / report pages)
───────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 24px;
  background: rgba(251,250,245,.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(var(--gold-rgb),.28);
}
.topbar .wm {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 18px;
  color: var(--forest);
  letter-spacing: .01em;
}
