/* predictwhy.com — design system
   Single source of truth. Every page imports this.
   Last updated: build night — May 2026
   -------------------------------------------- */

/* FONTS */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300..800;1,6..72,300..800&family=DM+Sans:opsz,wght@9..40,300..700&family=JetBrains+Mono:wght@400;500&display=swap');

/* TOKENS */
:root {
  --bg:          #FAF7F2;
  --bg-tint:     #F2EDE4;
  --card:        #FFFEFB;
  --ink:         #14161A;
  --ink-2:       #2B2D33;
  --muted:       #6E6A66;
  --muted-2:     #A29C94;
  --line:        #E5DFD3;
  --acc:         #C45A3D;
  --acc-soft:    #F1D9CE;
  --acc-deep:    #993C1D;
  --green:       #2C7A4F;
  --green-soft:  #D4EDDF;

  --serif:  "Newsreader", Georgia, serif;
  --sans:   "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:   "JetBrains Mono", ui-monospace, monospace;

  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;

  --shadow-sm: 0 1px 3px rgba(20,22,26,.06), 0 1px 2px rgba(20,22,26,.04);
  --shadow-md: 0 4px 12px rgba(20,22,26,.08), 0 2px 4px rgba(20,22,26,.04);

  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
  --ease-inout: cubic-bezier(0.4, 0, 0.2, 1);

  --nav-h: 60px;
  --page-w: 1120px;
  --text-w: 720px;
}

/* DARK MODE */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0F1014;
    --bg-tint:  #161820;
    --card:     #1A1C22;
    --ink:      #F0EDE8;
    --ink-2:    #C8C4BC;
    --muted:    #807C78;
    --muted-2:  #5C5855;
    --line:     #2A2C34;
    --acc-soft: #3D1F15;
    --green-soft: #0D2B1C;
  }
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
.page, .page-narrow, main {
  -webkit-overflow-scrolling: touch;
}
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font: inherit; }
ul, ol { list-style: none; }

/* NAVIGATION */
.topnav {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(250, 247, 242, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: background 0.3s var(--ease-out);
  overflow: visible;
}
@media (prefers-color-scheme: dark) {
  .topnav { background: rgba(15, 16, 20, 0.88); }
}
.topnav-inner {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--ink);
  font-weight: 500;
}
.brand .dot { color: var(--acc); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
  position: relative;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-tint); }
.nav-links a.active { color: var(--ink); }
.nav-links a.cta-nav {
  background: var(--acc);
  color: white;
  font-weight: 500;
  margin-left: 8px;
}
.nav-links a.cta-nav:hover { background: var(--acc-deep); }
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out), opacity 0.3s;
}

/* PAGE WRAPPER */
.page {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 0 32px;
}
.page-narrow {
  max-width: var(--text-w);
  margin: 0 auto;
  padding: 0 32px;
}

/* SECTION SPACING */
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }
.section-lg { padding: 120px 0; }

/* EYEBROW */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.eyebrow-bare {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc);
  margin-bottom: 12px;
}

/* TYPOGRAPHY */
h1.display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 7vw, 80px);
  line-height: 1.03;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-wrap: balance;
}
h1.display em {
  font-style: italic;
  color: var(--acc);
}
h2.headline {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
h2.headline em { font-style: italic; color: var(--acc); }
h3.title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
}
h4.label-title {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.3;
}
p.lead {
  font-family: var(--serif);
  font-size: clamp(17px, 2.2vw, 22px);
  font-weight: 300;
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}
p.body-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-2);
}
p.body-text + p.body-text { margin-top: 16px; }
.mono-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 999px;
  transition: background 0.2s var(--ease-out), color 0.2s, transform 0.15s, border-color 0.2s;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--acc);
  color: white;
  border-color: var(--acc);
}
.btn-primary:hover { background: var(--acc-deep); border-color: var(--acc-deep); }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover { border-color: var(--ink); background: var(--bg-tint); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 10px 16px;
}
.btn-ghost:hover { color: var(--ink); background: var(--bg-tint); }
.btn-sm {
  font-size: 12px;
  padding: 8px 16px;
}
.btn-lg {
  font-size: 16px;
  padding: 16px 32px;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* CARDS */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--muted-2); }
.card-sm { padding: 16px; border-radius: var(--r-md); }
.card-accent { border-left: 3px solid var(--acc); }

/* BADGE / PILL */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--bg-tint);
}
.badge-acc { background: var(--acc-soft); color: var(--acc-deep); border-color: var(--acc-soft); }
.badge-green { background: var(--green-soft); color: var(--green); border-color: var(--green-soft); }
.badge-live {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green-soft);
}
.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-live 1.8s ease-in-out infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* DIVIDER */
.divider {
  height: 1px;
  background: var(--line);
  margin: 48px 0;
}
.section-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.section-tag::before,
.section-tag::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* INLINE REFERENCE CALLOUT */
.ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--acc);
  background: var(--acc-soft);
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.ref-chip:hover { background: #e8c4b5; }
.ref-popover {
  position: absolute;
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  max-width: 320px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
}
.ref-popover.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* PROGRESS BAR */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--acc);
  width: 0%;
  z-index: 200;
  transition: width 0.1s linear;
}

/* SCROLL REVEAL — initial state, GSAP animates in */
.reveal {
  opacity: 0;
  transform: translateY(24px);
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
/* Safety net — if GSAP never fires (short pages, no scroll) fall back to visible */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* GRID UTILITIES */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.auto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.auto-grid-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

/* STAT CARD */
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
}
.stat-num {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}
.stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.stat-bar {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  background: var(--acc);
  border-radius: 2px;
  width: 0;
  transition: width 1.6s var(--ease-out);
}
.stat-fill.green { background: var(--green); }

/* MARQUEE / CAROUSEL */
.marquee-wrap {
  overflow: hidden;
  position: relative;
}
.marquee-wrap::before,
.marquee-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  width: 80px;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}
.marquee-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--bg), transparent);
}
.marquee-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--bg), transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
}
.marquee-track:hover { animation-play-state: paused; }
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* FOOTER */
.foot {
  border-top: 1px solid var(--line);
  padding: 40px 0 32px;
  margin-top: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.foot a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.foot a:hover { color: var(--ink); }
.foot-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* MOBILE NAV */
@media (max-width: 768px) {
  .topnav-inner { padding: 0 20px; }
  .nav-links { display: none; }
  /* nav-links hidden on mobile — mobile menu is a separate overlay */
  .nav-links { display: none !important; }
  .nav-hamburger { display: flex; }
  .page, .page-narrow { padding: 0 20px; }
  .section { padding: 56px 0; }
  .section-lg { padding: 80px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  h1.display { font-size: clamp(36px, 10vw, 56px); }
}

@media (max-width: 480px) {
  .page, .page-narrow { padding: 0 16px; }
}

/* PRINT */

/* ── MOBILE MENU OVERLAY ─────────────────────────────────────────── */
/* Completely separate from the nav — lives at body level             */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 9999;
  flex-direction: column;
  padding: 16px 24px 40px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}
.mobile-menu-overlay.open {
  display: flex;
}
.mobile-menu-overlay a {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 400;
  color: var(--ink);
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  display: block;
  transition: color 0.15s;
}
.mobile-menu-overlay a:hover { color: var(--acc); }
.mobile-menu-overlay a:last-child { border-bottom: none; }
.mobile-menu-overlay a.cta-nav {
  margin-top: 16px;
  background: var(--acc);
  color: white;
  border-bottom: none;
  text-align: center;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 500;
}
@media (prefers-color-scheme: dark) {
  .mobile-menu-overlay { background: var(--bg); }
}

@media print {
  .topnav, .foot, #reading-progress { display: none; }
  .page { max-width: 100%; padding: 0; }
  body { font-size: 11pt; background: white; color: black; }
}

/* ── PAGE CTA STRIP — end of every relevant page ── */
#page-cta-strip {
  margin: 72px 0 0;
}
.pcta-inner {
  background: #14161A;
  border-radius: var(--r-xl);
  padding: 44px 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: center;
}
@media (prefers-color-scheme: dark) {
  .pcta-inner {
    background: var(--card);
    border: 1px solid var(--line);
  }
}
.pcta-question {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(20px, 3vw, 28px);
  color: #F5F2EE;
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
@media (prefers-color-scheme: dark) {
  .pcta-question { color: var(--ink); }
}
.pcta-sub {
  font-size: 14px;
  color: rgba(245,242,238,0.58);
  line-height: 1.6;
  max-width: 520px;
}
@media (prefers-color-scheme: dark) {
  .pcta-sub { color: var(--muted); }
}
.pcta-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  min-width: 200px;
}
.pcta-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #E89A82;
  color: #14161A;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 13px 24px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s;
  text-align: center;
}
.pcta-btn-primary:hover { background: #d88870; }
.pcta-btn-primary:active { transform: scale(0.97); }
.pcta-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: rgba(245,242,238,0.75);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  padding: 11px 24px;
  border-radius: 999px;
  border: 1px solid rgba(245,242,238,0.2);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
  text-align: center;
}
.pcta-btn-secondary:hover {
  border-color: rgba(245,242,238,0.5);
  color: #F5F2EE;
}
@media (prefers-color-scheme: dark) {
  .pcta-btn-secondary { color: var(--muted); border-color: var(--line); }
  .pcta-btn-secondary:hover { color: var(--ink); border-color: var(--muted-2); }
}
@media (max-width: 768px) {
  .pcta-inner {
    grid-template-columns: 1fr;
    padding: 32px 28px;
    gap: 24px;
  }
  .pcta-btns {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: unset;
  }
  .pcta-btn-primary,
  .pcta-btn-secondary { flex: 1; min-width: 140px; }
}
