/* ════════════════════════════════════════════════════════════════
   EPIC PORTFOLIO — pinned-stage scrollytelling.
   Section is 8× viewport tall; the stage pins for the whole scroll;
   8 scenes (intro + 6 companies + "more on the way") crossfade
   based on scroll position. Each scene is full-bleed brand color
   with massive typography and coordinated reveal motion.
   ════════════════════════════════════════════════════════════════ */

.mq-epic {
  position: relative;
  background: #0a0710;
  color: #fff;
  --scenes: 8;
}

/* Tall rail provides the scroll runway — 8 viewports of scroll */
.mq-epic__rail {
  height: calc(var(--scenes) * 100vh);
  position: relative;
}

/* The stage pins for the entire rail */
.mq-epic__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  width: 100%;
}

/* Each scene fills the stage; only the active one is visible.
   We use visibility (not opacity transitions) for the scene-level toggle
   so inactive scenes can't bleed through, and animations (not transitions)
   for inner reveals so they tick reliably. */
.mq-epic__scene {
  position: absolute;
  inset: 0;
  background: var(--c-bg);
  color: var(--c-fg);
  padding: 8vh 8vw 12vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 6vw;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
}
.mq-epic__scene.is-active {
  visibility: visible;
  pointer-events: auto;
}



/* Reveal keyframes — animations tick more reliably than transitions */
@keyframes mq-epic-rise {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: none; }
}
@keyframes mq-epic-rise-sm {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}
@keyframes mq-epic-mark-in {
  from { opacity: 0; transform: scale(0.88) translateY(20px); }
  to   { opacity: 1; transform: none; }
}

/* Massive chapter numeral — corner watermark */
.mq-epic__num {
  position: absolute;
  top: 4vh;
  right: 4vw;
  font: 700 clamp(180px, 26vw, 440px)/0.82 var(--font-display);
  letter-spacing: -0.06em;
  color: var(--c-fg);
  opacity: 0.07;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

/* Left column — mark */
.mq-epic__left {
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center;
  position: relative; z-index: 1;
  padding-left: 4vw;
}
.mq-epic__mark {
  width: clamp(220px, 26vw, 460px);
  height: auto;
  display: block;
  filter: drop-shadow(0 32px 80px rgba(0,0,0,0.28));
}
.mq-epic__scene.is-active .mq-epic__mark {
  animation: mq-epic-mark-in 900ms cubic-bezier(.16,.85,.3,1) 180ms forwards;
}

/* Letter mark fallback (for companies without a logo image) */
.mq-epic__mark-letter {
  font: 700 clamp(280px, 38vw, 560px)/0.85 var(--font-display);
  letter-spacing: -0.08em;
  color: var(--c-fg);
}
.mq-epic__scene.is-active .mq-epic__mark-letter {
  animation: mq-epic-rise 900ms cubic-bezier(.16,.85,.3,1) 180ms forwards;
}

/* Equity-grid mark — used by Smartshares.
   Animated cap-table grid that builds from top, sparks on the bottom cell.
   Scoped to .mq-epic so it doesn't depend on share.css being loaded. */
.mq-epic__equity {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: clamp(240px, 28vw, 420px);
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 32px 80px rgba(0,0,0,0.35));
}
.mq-epic__equity .cell {
  border-radius: 2px;
}
.mq-epic__equity .r1 { background: rgba(255,255,255,0.95); }
.mq-epic__equity .r2 { background: rgba(255,255,255,0.55); }
.mq-epic__equity .r3 { background: rgba(232,163,61,0.85); }
.mq-epic__equity .r4 { background: #14A3A3; }

/* Entrance — replays each time the scene becomes active in the scrolly */
@media (prefers-reduced-motion: no-preference) {
  .mq-epic__scene.is-active .mq-epic__equity .cell {
    animation: mq-epic-cell-in 600ms ease-out backwards;
  }
  .mq-epic__scene.is-active .mq-epic__equity .r1.c1 { animation-delay: 220ms; }
  .mq-epic__scene.is-active .mq-epic__equity .r1.c2 { animation-delay: 300ms; }
  .mq-epic__scene.is-active .mq-epic__equity .r1.c3 { animation-delay: 380ms; }
  .mq-epic__scene.is-active .mq-epic__equity .r1.c4 { animation-delay: 460ms; }
  .mq-epic__scene.is-active .mq-epic__equity .r2.c1 { animation-delay: 640ms; }
  .mq-epic__scene.is-active .mq-epic__equity .r2.c2 { animation-delay: 720ms; }
  .mq-epic__scene.is-active .mq-epic__equity .r2.c3 { animation-delay: 800ms; }
  .mq-epic__scene.is-active .mq-epic__equity .r3.c1 { animation-delay: 980ms; }
  .mq-epic__scene.is-active .mq-epic__equity .r3.c2 { animation-delay: 1060ms; }
  .mq-epic__scene.is-active .mq-epic__equity .r4 {
    animation: mq-epic-cell-spark 800ms ease-out backwards;
    animation-delay: 1340ms;
  }
}
@keyframes mq-epic-cell-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes mq-epic-cell-spark {
  0%   { opacity: 0; transform: translateY(-12px) scale(0.7); box-shadow: 0 0 0 0 rgba(20,163,163,0); }
  60%  { opacity: 1; transform: none; box-shadow: 0 0 0 18px rgba(20,163,163,0.4); }
  100% { opacity: 1; transform: none; box-shadow: 0 0 0 0 rgba(20,163,163,0); }
}

/* Right column — narrative */
.mq-epic__right {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  gap: 18px;
  max-width: 640px;
  padding-right: 2vw;
}

.mq-epic__eyebrow {
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-fg);
  opacity: 0.75;
  margin: 0 0 4px;
}
.mq-epic__scene.is-active .mq-epic__eyebrow {
  animation: mq-epic-rise-sm 600ms cubic-bezier(.16,.85,.3,1) 240ms forwards;
}

.mq-epic__name {
  font: 700 clamp(72px, 9.5vw, 168px)/0.88 var(--font-display);
  letter-spacing: -0.045em;
  color: var(--c-fg);
  margin: 0;
}
.mq-epic__scene.is-active .mq-epic__name {
  animation: mq-epic-rise 900ms cubic-bezier(.16,.85,.3,1) 320ms forwards;
}

.mq-epic__pitch {
  font: 500 clamp(18px, 1.55vw, 24px)/1.45 var(--font-sans);
  color: var(--c-fg);
  margin: 8px 0 0;
  max-width: 560px;
  opacity: 0.92;
}
.mq-epic__scene.is-active .mq-epic__pitch {
  animation: mq-epic-rise-sm 600ms cubic-bezier(.16,.85,.3,1) 440ms forwards;
}

.mq-epic__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1.5px solid color-mix(in oklab, var(--c-fg) 22%, transparent);
}
.mq-epic__scene.is-active .mq-epic__stats {
  animation: mq-epic-rise-sm 600ms cubic-bezier(.16,.85,.3,1) 560ms forwards;
}
.mq-epic__stats > div b {
  display: block;
  font: 700 clamp(26px, 2.6vw, 40px)/1 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--c-fg);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.mq-epic__stats > div span {
  font: 600 10px/1.3 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-fg);
  opacity: 0.65;
}

.mq-epic__link {
  margin-top: 28px;
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 16px;
  font: 600 14px/1 var(--font-sans);
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--c-fg);
  text-decoration: none;
  padding: 20px 30px;
  border: 1.5px solid color-mix(in oklab, var(--c-fg) 32%, transparent);
  border-radius: 999px;
  transition: background 280ms ease, color 280ms ease, gap 240ms ease, border-color 280ms ease;
}
.mq-epic__scene.is-active .mq-epic__link {
  animation: mq-epic-rise-sm 600ms cubic-bezier(.16,.85,.3,1) 680ms forwards;
}
.mq-epic__link:hover {
  background: var(--c-fg);
  color: var(--c-bg);
  gap: 22px;
  border-color: var(--c-fg);
}
.mq-epic__link span {
  font: 700 16px/1 var(--font-display);
  display: inline-block;
  transition: transform 240ms cubic-bezier(.16,.85,.3,1);
}
.mq-epic__link:hover span { transform: translateX(4px); }

/* ── Per-company tokens (background + foreground) ───────────── */
.mq-epic__scene[data-co="avero"]       { --c-bg: #4A0E0E; --c-fg: #FDFCF9; }
.mq-epic__scene[data-co="align"]       { --c-bg: #1E8488; --c-fg: #ECFCFD; }
.mq-epic__scene[data-co="permissio"]   { --c-bg: #4B6F94; --c-fg: #F0F4F8; }
.mq-epic__scene[data-co="smartshares"] { --c-bg: #0A1628; --c-fg: #F1F5F9; }
.mq-epic__scene[data-co="rhc"]         { --c-bg: #00416B; --c-fg: #DAF1F9; }
.mq-epic__scene[data-co="illumera"]    { --c-bg: #08010d; --c-fg: #fafafa; }
.mq-epic__scene[data-co="intro"]       { --c-bg: #0a0710; --c-fg: #fff; }
.mq-epic__scene[data-co="next"]        { --c-bg: #14151a; --c-fg: #d6d8e0; }

/* Subtle radial wash to add depth */
.mq-epic__scene::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(1100px 700px at 80% 20%, color-mix(in oklab, var(--c-fg) 9%, transparent) 0%, transparent 65%),
    radial-gradient(900px 600px at 10% 90%, color-mix(in oklab, var(--c-fg) 6%, transparent) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* Intro scene — full-stage hero treatment */
.mq-epic__scene[data-co="intro"] {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 8vw;
}
.mq-epic__scene[data-co="intro"] .mq-epic__intro-eyebrow {
  font: 700 12px/1 var(--font-mono);
  letter-spacing: 0.30em;
  text-transform: uppercase;
  color: var(--orange-400);
  margin: 0 0 32px;
}
.mq-epic__scene[data-co="intro"].is-active .mq-epic__intro-eyebrow {
  animation: mq-epic-rise-sm 700ms cubic-bezier(.16,.85,.3,1) 100ms forwards;
}
.mq-epic__scene[data-co="intro"] .mq-epic__intro-title {
  font: 700 clamp(80px, 12vw, 220px)/0.9 var(--font-display);
  letter-spacing: -0.045em;
  color: var(--c-fg);
  margin: 0 0 40px;
  max-width: 1400px;
}
.mq-epic__scene[data-co="intro"].is-active .mq-epic__intro-title {
  animation: mq-epic-rise 900ms cubic-bezier(.16,.85,.3,1) 240ms forwards;
}
.mq-epic__scene[data-co="intro"] .mq-epic__intro-title em {
  font-style: normal;
  color: var(--orange-400);
}
.mq-epic__scene[data-co="intro"] .mq-epic__intro-sub {
  font: 400 clamp(20px, 1.6vw, 26px)/1.5 var(--font-sans);
  color: rgba(255,255,255,0.7);
  max-width: 720px;
  margin: 0 0 56px;
}
.mq-epic__scene[data-co="intro"].is-active .mq-epic__intro-sub {
  animation: mq-epic-rise-sm 700ms cubic-bezier(.16,.85,.3,1) 440ms forwards;
}
.mq-epic__scene[data-co="intro"] .mq-epic__intro-hint {
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  display: inline-flex; align-items: center; gap: 14px;
}
.mq-epic__scene[data-co="intro"].is-active .mq-epic__intro-hint {
  animation: mq-epic-rise-sm 700ms cubic-bezier(.16,.85,.3,1) 620ms forwards;
}
.mq-epic__scene[data-co="intro"] .mq-epic__intro-hint::after {
  content: "↓";
  font-family: var(--font-display);
  font-size: 18px;
  animation: mq-epic-bounce 2s ease-in-out infinite;
}
@keyframes mq-epic-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* "More on the way" scene — softer, more reflective */
.mq-epic__scene[data-co="next"] {
  text-align: center;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 10vh 8vw;
}
.mq-epic__scene[data-co="next"] .mq-epic__next-img {
  width: clamp(140px, 14vw, 220px);
  height: auto;
  opacity: 0.45;
  margin: 0 0 40px;
}
.mq-epic__scene[data-co="next"].is-active .mq-epic__next-img {
  animation: mq-epic-mark-in 900ms cubic-bezier(.16,.85,.3,1) 180ms forwards;
}
.mq-epic__scene[data-co="next"] .mq-epic__next-eyebrow {
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.30em;
  text-transform: uppercase;
  color: var(--orange-300);
  margin: 0 0 28px;
}
.mq-epic__scene[data-co="next"].is-active .mq-epic__next-eyebrow {
  animation: mq-epic-rise-sm 700ms cubic-bezier(.16,.85,.3,1) 240ms forwards;
}
.mq-epic__scene[data-co="next"] .mq-epic__next-title {
  font: 700 clamp(60px, 8vw, 140px)/0.95 var(--font-display);
  letter-spacing: -0.04em;
  color: var(--c-fg);
  margin: 0 0 32px;
  max-width: 1100px;
}
.mq-epic__scene[data-co="next"].is-active .mq-epic__next-title {
  animation: mq-epic-rise 900ms cubic-bezier(.16,.85,.3,1) 360ms forwards;
}
.mq-epic__scene[data-co="next"] .mq-epic__next-sub {
  font: 400 clamp(17px, 1.4vw, 22px)/1.55 var(--font-sans);
  color: rgba(214,216,224,0.78);
  max-width: 620px;
  margin: 0;
}
.mq-epic__scene[data-co="next"].is-active .mq-epic__next-sub {
  animation: mq-epic-rise-sm 700ms cubic-bezier(.16,.85,.3,1) 540ms forwards;
}

/* ── Persistent chrome ─────────────────────────────────────── */

/* Top progress bar */
.mq-epic__progress {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,0.06);
  z-index: 5;
}
.mq-epic__progress-fill {
  height: 100%;
  width: var(--p, 0%);
  background: linear-gradient(90deg, #ff4081, #ff6e40);
  transition: width 240ms cubic-bezier(.16,.85,.3,1);
}

/* Chapter dots — right side rail */
.mq-epic__dots {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 4;
}
.mq-epic__dots button {
  width: 10px; height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.25);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 280ms cubic-bezier(.16,.85,.3,1);
  position: relative;
}
.mq-epic__dots button::after {
  content: attr(data-label);
  position: absolute;
  right: 22px; top: 50%;
  transform: translateY(-50%) translateX(8px);
  font: 600 10px/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0,0,0,0.7);
  padding: 6px 10px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  white-space: nowrap;
}
.mq-epic__dots button:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.mq-epic__dots button.is-active {
  background: #fff;
  transform: scale(1.6);
}

/* ── Mobile / reduced-motion fallback — stacked scenes ─────── */
@media (max-width: 899px), (prefers-reduced-motion: reduce) {
  .mq-epic__rail { height: auto; }
  .mq-epic__stage { position: relative; height: auto; }
  .mq-epic__scene {
    position: relative;
    opacity: 1;
    pointer-events: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 12vh 6vw;
  }
  .mq-epic__scene .mq-epic__mark,
  .mq-epic__scene .mq-epic__mark-letter,
  .mq-epic__scene .mq-epic__eyebrow,
  .mq-epic__scene .mq-epic__name,
  .mq-epic__scene .mq-epic__pitch,
  .mq-epic__scene .mq-epic__stats,
  .mq-epic__scene .mq-epic__link,
  .mq-epic__scene[data-co="intro"] *,
  .mq-epic__scene[data-co="next"] * {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .mq-epic__scene[data-co="intro"] .mq-epic__intro-eyebrow,
  .mq-epic__scene[data-co="next"] .mq-epic__next-eyebrow { opacity: 1; }
  .mq-epic__scene[data-co="intro"] .mq-epic__intro-sub,
  .mq-epic__scene[data-co="next"] .mq-epic__next-sub { opacity: 0.78; }
  .mq-epic__eyebrow { opacity: 0.75; }
  .mq-epic__pitch { opacity: 0.92; }
  .mq-epic__dots, .mq-epic__progress { display: none; }
  .mq-epic__num { font-size: clamp(80px, 30vw, 220px); top: 8px; right: 16px; }
}
