/* ==========================================================================
   Causality Engine — Marketing Academy
   Brand System V6.0 — "Confident Clarity"
   Dark canvas, amber signature, Geist type, φ-based spacing.
   ========================================================================== */

/* ---- Fonts ---- */
@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ---- */
:root {
  /* Canvas & surfaces */
  --bg: #0f0f11;
  --surface-1: rgba(255, 255, 255, 0.02);
  --surface-2: rgba(255, 255, 255, 0.045);
  --surface-3: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Text — exponential decay opacity hierarchy */
  --text: #fafafa;
  --text-secondary: rgba(250, 250, 250, 0.705);
  --text-tertiary: rgba(250, 250, 250, 0.497);
  --text-ghost: rgba(250, 250, 250, 0.35);

  /* Semantic palette — OKLCH near-equidistant hues */
  --amber: #fbbf24;   /* primary accent — insight, discovery */
  --emerald: #34d399; /* positive */
  --rose: #fb7185;    /* negative / pain */
  --sky: #38bdf8;     /* informational */
  --violet: #a78bfa;  /* AI / research-derived */

  --amber-dim: rgba(251, 191, 36, 0.12);
  --emerald-dim: rgba(52, 211, 153, 0.1);
  --rose-dim: rgba(251, 113, 133, 0.1);
  --sky-dim: rgba(56, 189, 248, 0.1);
  --violet-dim: rgba(167, 139, 250, 0.1);

  /* Spacing — φⁿ × 8px */
  --sp-xs: 8px;
  --sp-sm: 13px;
  --sp-md: 21px;
  --sp-lg: 34px;
  --sp-xl: 55px;
  --sp-2xl: 89px;

  /* Type — Fibonacci scale */
  --fs-mono: 10px;
  --fs-caption: 12px;
  --fs-body: 14px;
  --fs-h3: 20px;
  --fs-h2: 30px;
  --fs-h1: 48px;

  /* Motion — CE master easing */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-micro: 150ms;
  --t-standard: 300ms;
  --t-emphasis: 500ms;
  --t-dramatic: 800ms;

  --radius: 8px;
  --radius-lg: 13px;

  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: var(--amber-dim); color: var(--amber); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img, svg, video, iframe { max-width: 100%; display: block; }

/* ---- Shared primitives ---- */

.mono-label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

.mono-label.amber { color: var(--amber); }
.mono-label.emerald { color: var(--emerald); }
.mono-label.rose { color: var(--rose); }
.mono-label.sky { color: var(--sky); }
.mono-label.violet { color: var(--violet); }

/* Glass surface — level 2, radial top-left highlight for dimensionality */
.glass {
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.04), transparent 55%),
    var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: 10px var(--sp-md);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--fs-body);
  font-weight: 500;
  transition: transform var(--t-micro) var(--ease),
              background var(--t-micro) var(--ease),
              border-color var(--t-micro) var(--ease),
              opacity var(--t-micro) var(--ease);
  user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.3; pointer-events: none; }

.btn-amber {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1502;
  font-weight: 600;
}
.btn-amber:hover { background: #fcd34d; border-color: #fcd34d; }

/* ==========================================================================
   Academy home
   ========================================================================== */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(15, 15, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 50;
}

.brand-lockup {
  display: flex;
  align-items: baseline;
  gap: var(--sp-xs);
  font-weight: 700;
  font-size: var(--fs-body);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-lockup .engine { color: var(--amber); }
.brand-lockup .division {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  border-left: 1px solid var(--border);
  padding-left: var(--sp-xs);
  margin-left: 2px;
}

.home-hero {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--sp-2xl) var(--sp-lg) var(--sp-xl);
  text-align: center;
}

.home-hero h1 {
  font-size: clamp(34px, 6vw, var(--fs-h1));
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: var(--sp-md) 0;
}
.home-hero h1 .accent { color: var(--amber); }

.home-hero p {
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  font-size: 16px;
}

.course-grid {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--sp-lg) var(--sp-2xl);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-md);
}

.course-card {
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  transition: transform var(--t-standard) var(--ease),
              border-color var(--t-standard) var(--ease);
}
a.course-card:hover { transform: translateY(-2px) scale(1.01); border-color: var(--border-strong); }

.course-card .thumb {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(80% 120% at 20% 0%, var(--amber-dim), transparent 60%),
    var(--surface-1);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.course-card .thumb .play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--amber);
  display: grid;
  place-items: center;
  transition: transform var(--t-standard) var(--ease);
}
a.course-card:hover .thumb .play { transform: scale(1.08); }
.course-card .thumb .play svg { width: 16px; height: 16px; fill: #1a1502; margin-left: 2px; }

.course-card h3 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.course-card p { color: var(--text-secondary); font-size: var(--fs-caption); flex: 1; }

.course-card.locked { opacity: 0.55; }
.course-card.locked .thumb { background: var(--surface-1); }

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-xs);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-lg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm) var(--sp-md);
  align-items: center;
  justify-content: space-between;
  color: var(--text-tertiary);
  font-size: var(--fs-caption);
}
.site-footer a { color: var(--text-secondary); transition: color var(--t-micro) var(--ease); }
.site-footer a:hover { color: var(--amber); }

/* ==========================================================================
   Lesson / slideshow shell
   ========================================================================== */

.deck {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--border);
  background: rgba(15, 15, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 40;
}

.deck-header .lesson-name {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  text-align: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-progress {
  height: 2px;
  background: var(--surface-2);
  position: relative;
}
.deck-progress .bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--amber);
  transition: width var(--t-emphasis) var(--ease);
}

.deck-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ---- Slides ---- */
.slide {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-lg) var(--sp-md) var(--sp-2xl);
  display: none;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.slide.active { display: block; }

.slide-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  min-height: 100%;
  justify-content: center;
}

.slide-head { text-align: center; }
.slide-head .kicker { margin-bottom: var(--sp-sm); }
.slide-head h2 {
  font-size: clamp(24px, 4.5vw, var(--fs-h2));
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.slide-head .lede {
  color: var(--text-secondary);
  max-width: 620px;
  margin: var(--sp-sm) auto 0;
}

/* Entrance animation — triggered when slide becomes active */
.slide.active .anim {
  animation: rise var(--t-emphasis) var(--ease) both;
  animation-delay: calc(var(--stagger, 0) * 100ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .slide.active .anim { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ---- Deck footer nav ---- */
.deck-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  border-top: 1px solid var(--border);
  background: rgba(15, 15, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.deck-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.deck-dots button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid transparent;
  padding: 0;
  transition: all var(--t-micro) var(--ease);
}
.deck-dots button:hover { background: var(--text-ghost); }
.deck-dots button.on { background: var(--amber); transform: scale(1.2); }

.deck-count {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.deck-count b { color: var(--text); font-weight: 500; }

/* ==========================================================================
   Flow nodes & connectors (FigJam rebuild, CE-branded)
   ========================================================================== */

.flow {
  position: relative;
  /* connector overlay svg is injected as first child */
}
.flow > svg.connectors {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}
.flow-label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--text-tertiary);
}

.node {
  position: relative;
  z-index: 1;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.045), transparent 55%),
    #17171a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-md);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  transition: transform var(--t-standard) var(--ease),
              border-color var(--t-standard) var(--ease),
              box-shadow var(--t-standard) var(--ease);
}
.node:hover { transform: translateY(-2px) scale(1.01); }

.node .node-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-xs);
}

/* Accent variants — semantic mapping of the FigJam sticky colors */
.node.rose { border-color: rgba(251, 113, 133, 0.35); }
.node.rose:hover { border-color: var(--rose); box-shadow: 0 8px 32px rgba(251, 113, 133, 0.08); }
.node.rose .node-tag { color: var(--rose); }

.node.sky { border-color: rgba(56, 189, 248, 0.35); }
.node.sky:hover { border-color: var(--sky); box-shadow: 0 8px 32px rgba(56, 189, 248, 0.08); }
.node.sky .node-tag { color: var(--sky); }

.node.violet { border-color: rgba(167, 139, 250, 0.35); }
.node.violet:hover { border-color: var(--violet); box-shadow: 0 8px 32px rgba(167, 139, 250, 0.08); }
.node.violet .node-tag { color: var(--violet); }

.node.emerald { border-color: rgba(52, 211, 153, 0.35); }
.node.emerald:hover { border-color: var(--emerald); box-shadow: 0 8px 32px rgba(52, 211, 153, 0.08); }
.node.emerald .node-tag { color: var(--emerald); }

.node.amber {
  border-color: rgba(251, 191, 36, 0.5);
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(251, 191, 36, 0.08), transparent 60%),
    #1a1608;
}
.node.amber:hover { border-color: var(--amber); box-shadow: 0 8px 32px rgba(251, 191, 36, 0.12); }
.node.amber .node-tag { color: var(--amber); }

.node.hero-node {
  text-align: center;
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  padding: var(--sp-lg);
}

/* Decision diamond */
.node.decision {
  border-radius: var(--radius);
  text-align: center;
  font-weight: 600;
  border-color: rgba(251, 191, 36, 0.5);
}

/* Quote nodes */
.node.quote { font-size: 15px; line-height: 1.55; }
.node.quote .q { color: var(--text); font-weight: 500; }
.node.quote .q::before { content: '\201C'; color: var(--amber); font-weight: 700; margin-right: 1px; }
.node.quote .q::after { content: '\201D'; color: var(--amber); font-weight: 700; margin-left: 1px; }

/* Evidence node metric */
.node .big-stat {
  font-size: var(--fs-h3);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

/* Grid helpers for flow layouts */
.flow-grid {
  display: grid;
  gap: var(--sp-md);
  position: relative;
  z-index: 1;
}
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

.flow-row-gap { height: var(--sp-2xl); }
.flow-center { display: flex; justify-content: center; position: relative; z-index: 1; }
.flow-center > .node { max-width: 420px; }

/* Mobile: collapse to vertical stacks; connectors replaced by CSS arrows */
@media (max-width: 719px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .flow > svg.connectors { display: none; }
  .flow-row-gap { height: var(--sp-lg); }
  .flow-grid { gap: var(--sp-lg); }
  .flow .m-arrow::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -30px;
    width: 1px;
    height: 26px;
    background: var(--border-strong);
  }
  .flow .m-arrow::after {
    content: '';
    position: absolute;
    left: 50%;
    top: -11px;
    width: 7px;
    height: 7px;
    margin-left: -3px;
    border-right: 1px solid var(--border-strong);
    border-bottom: 1px solid var(--border-strong);
    transform: rotate(45deg);
  }
}
@media (max-width: 599px) {
  .deck-dots { display: none; }
}

/* ---- Video embed ---- */
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    radial-gradient(90% 130% at 15% 0%, var(--amber-dim), transparent 55%),
    var(--surface-1);
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  text-align: center;
  padding: var(--sp-md);
}
.video-placeholder .play-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--amber);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 32px rgba(251, 191, 36, 0.25);
}
.video-placeholder .play-badge svg { width: 22px; height: 22px; fill: #1a1502; margin-left: 3px; }
.video-placeholder p { color: var(--text-secondary); font-size: var(--fs-caption); max-width: 380px; }

/* ---- Stat strip (cover slide) ---- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-sm);
}
.stat-strip .stat {
  padding: var(--sp-sm) var(--sp-md);
  text-align: left;
}
.stat-strip .num {
  font-size: var(--fs-h3);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.stat-strip .num.amber { color: var(--amber); }
@media (max-width: 719px) { .stat-strip { grid-template-columns: 1fr; } }

/* ---- CTA panel ---- */
.cta-panel {
  text-align: center;
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
}
.cta-panel h3 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; }
.cta-panel p { color: var(--text-secondary); max-width: 520px; }
.cta-actions { display: flex; gap: var(--sp-sm); flex-wrap: wrap; justify-content: center; margin-top: var(--sp-xs); }
