/* ═══════════════════════════════════════════════════════════════
   PRAANA — BASE · reset, typography, shell, tab nav, shared atoms
   ═══════════════════════════════════════════════════════════════ */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.62;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -.035em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1.05em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

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

b, strong { color: var(--ink); font-weight: 650; }

canvas { display: block; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1.1rem; border-radius: 0 0 var(--r-sm) 0;
  font-size: var(--t-small); font-weight: 600;
}
.skip:focus { left: 0; }

/* ── layout ───────────────────────────────────────────────── */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gut); }
.wrap-narrow { max-width: var(--maxw-narrow); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--mono);
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: ''; width: 18px; height: 1px; background: currentColor; opacity: .55;
}

.lede {
  font-size: var(--t-lede);
  line-height: 1.5;
  color: var(--ink-2);
  letter-spacing: -.015em;
}

.fine {
  font-family: var(--mono);
  font-size: var(--t-fine);
  line-height: 1.5;
  color: var(--ink-4);
  letter-spacing: -.005em;
}

.hl { color: var(--accent); }
.mono { font-family: var(--mono); }

/* ── top bar ──────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 80;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  height: 66px;
  padding: 0 var(--gut);
  background: rgba(250,250,248,.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.topbar.stuck { border-bottom-color: var(--rule); }

.brand { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.brand canvas { width: 22px; height: 22px; }
.brand span {
  font-family: var(--display);
  font-weight: 700;
  font-size: .96rem;
  letter-spacing: .16em;
  color: var(--ink);
}

/* ── tab nav ──────────────────────────────────────────────── */
.tabnav {
  position: relative;
  display: flex; align-items: center; gap: .15rem;
  padding: 4px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
}
.tabnav .tab-ink {
  position: absolute; top: 4px; left: 0; height: calc(100% - 8px);
  background: var(--card);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-1);
  transition: transform .48s var(--ease-out), width .48s var(--ease-out);
  will-change: transform, width;
  pointer-events: none;
}
.tabnav button {
  position: relative; z-index: 1;
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: var(--sans);
  font-size: .845rem;
  font-weight: 560;
  letter-spacing: -.01em;
  color: var(--ink-3);
  padding: .52rem 1.02rem;
  border-radius: var(--r-pill);
  white-space: nowrap;
  transition: color .3s var(--ease);
}
.tabnav button:hover { color: var(--ink-2); }
.tabnav button[aria-selected="true"] { color: var(--ink); font-weight: 640; }
.tabnav button .tnum {
  font-family: var(--mono); font-size: .66rem; color: var(--ink-4);
  margin-right: .42rem; letter-spacing: 0;
}
.tabnav button[aria-selected="true"] .tnum { color: var(--accent); }

.topbar-cta { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }

/* ── buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--sans); font-size: .9rem; font-weight: 580;
  letter-spacing: -.01em;
  padding: .72rem 1.32rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper);
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
.btn:hover { transform: translateY(-1.5px); box-shadow: var(--sh-2); background: #000; }
.btn.ghost {
  background: transparent; color: var(--ink); border-color: var(--rule-2);
}
.btn.ghost:hover { background: var(--card); border-color: var(--rule-strong); }
.btn.sm { padding: .48rem .95rem; font-size: .82rem; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }

.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--mono); font-size: var(--t-fine); font-weight: 500;
  letter-spacing: -.01em;
  padding: .38rem .8rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--rule-2);
  background: var(--card);
  color: var(--ink-2);
  transition: border-color .25s var(--ease), transform .25s var(--ease), color .25s var(--ease);
}
a.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* ── panels ───────────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; animation: panelIn .5s var(--ease-out) both; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

section { position: relative; }
.band { padding: clamp(4rem, 9vh, 7.5rem) 0; }
.band.tint { background: var(--paper-2); }

/* ── reveal ───────────────────────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal][data-d="1"] { transition-delay: .08s; }
[data-reveal][data-d="2"] { transition-delay: .16s; }
[data-reveal][data-d="3"] { transition-delay: .24s; }
[data-reveal][data-d="4"] { transition-delay: .32s; }
[data-reveal][data-d="5"] { transition-delay: .40s; }

/* ── kinetic word reveal ──────────────────────────────────── */
.kw { display: inline-block; overflow: hidden; vertical-align: bottom; }
.kw > i {
  display: inline-block; font-style: inherit;
  transform: translateY(105%);
  transition: transform .78s var(--ease-out);
}
.kin.in .kw > i { transform: none; }

/* ── scrollytelling engine · PINNED CROSS-FADE ────────────────
   The stage and the copy are pinned together for the whole
   sequence. Scrolling never moves either one — it only
   cross-fades the copy layer. Fixes both the "text drifts up and
   down" problem and short-viewport layouts, because the pinned
   unit is always exactly one screen tall.
   ─────────────────────────────────────────────────────────── */
.roll { position: relative; }

/* the pinned viewport-height unit */
.roll-pin {
  position: sticky;
  top: var(--bar-h, 66px);
  height: calc(100svh - var(--bar-h, 66px));
  min-height: 460px;
  display: flex; align-items: center;
  overflow: hidden;
}
.roll-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr);
  gap: clamp(1.25rem, 3vw, 3.4rem);
  align-items: center;
  width: 100%;
}

/* the scroll driver — invisible, provides the scroll length only */
.roll-track { position: relative; }
.roll-step { height: 100svh; }
.roll-step:first-child { height: 62svh; }
.roll-step:last-child { height: 88svh; }

.roll-stage {
  position: relative;
  height: min(74vh, 640px);
  max-height: calc(100svh - var(--bar-h, 66px) - 3rem);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 90% at 50% 0%, #fff 0%, var(--card-tint) 55%, var(--paper-2) 100%);
  box-shadow: var(--sh-2);
  overflow: hidden;
}
.roll-stage canvas { width: 100%; height: 100%; }

.roll-stage-head {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .78rem 1.05rem;
  font-family: var(--mono); font-size: var(--t-micro);
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-4);
  border-bottom: 1px solid var(--rule);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.roll-stage-head .rsh-live { display: inline-flex; align-items: center; gap: .45rem; color: var(--accent); }
.rsh-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  animation: pulseDot 2.2s var(--ease-io) infinite;
}
@keyframes pulseDot { 0%,100%{opacity:.28;transform:scale(.8)} 50%{opacity:1;transform:scale(1)} }

/* ── the copy column ── */
.roll-copy { position: relative; display: flex; align-items: center; gap: 1.1rem; }

/* slides stack in one place and cross-fade — nothing translates */
.roll-slides {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
}
.roll-slides > .rs {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  filter: blur(6px);
  transition: opacity .5s var(--ease), filter .5s var(--ease), visibility 0s linear .5s;
  will-change: opacity, filter;
}
.roll-slides > .rs.on {
  opacity: 1;
  visibility: visible;
  filter: none;
  transition: opacity .55s var(--ease-out) .06s, filter .55s var(--ease-out) .06s, visibility 0s;
}

.rs { max-width: 46ch; }

.rs-n {
  font-family: var(--mono); font-size: var(--t-micro); font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent);
  display: flex; align-items: center; gap: .55rem;
  margin-bottom: .85rem;
}
.rs-n::after { content: ''; flex: 1 1 auto; height: 1px; background: var(--accent-line); }

.rs h3 {
  font-size: var(--t-h2);
  letter-spacing: -.038em;
  line-height: 1.02;
  margin-bottom: .8rem;
}
.rs p {
  font-size: clamp(1rem, 1.12vw, 1.14rem);
  line-height: 1.55;
  color: var(--ink-2);
  letter-spacing: -.012em;
}
.rs p + p { margin-top: .6rem; }

.rs-meta { display: flex; flex-wrap: wrap; gap: .38rem; margin-top: 1.25rem; }
.rs-meta span {
  font-family: var(--mono); font-size: var(--t-micro);
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
  background: transparent;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-pill);
  padding: .26rem .62rem;
}

.rs-stat { display: flex; align-items: baseline; gap: .6rem; margin-top: 1.25rem; }
.rs-stat b {
  font-family: var(--display); font-size: clamp(1.7rem, 2.4vw, 2.3rem); font-weight: 700;
  letter-spacing: -.045em; color: var(--accent); line-height: 1;
}
.rs-stat i { font-style: normal; font-size: var(--t-fine); color: var(--ink-3); max-width: 22ch; line-height: 1.4; }

/* progress rail — vertical, beside the copy */
.roll-rail {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: .5rem;
  align-items: center;
  padding-right: .2rem;
}
.roll-rail i {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--rule-strong);
  transition: all .45s var(--ease);
}
.roll-rail i.on { background: var(--accent); height: 22px; border-radius: 2px; }

/* legacy alias so older markup keeps rendering */
.rs-card { display: contents; }

/* ── footer ───────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 3.2rem 0 2.4rem;
  margin-top: 0;
}
.foot {
  display: flex; flex-wrap: wrap; gap: 2rem;
  justify-content: space-between; align-items: flex-start;
}
.foot .f-logo {
  font-family: var(--display); font-weight: 700; letter-spacing: .18em;
  font-size: 1rem; color: var(--ink); margin-bottom: .5rem;
}
.foot .f-tag { font-size: .92rem; color: var(--ink-3); max-width: 42ch; }
.foot .f-right { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; }
.foot .f-right a { font-size: .88rem; color: var(--ink-3); transition: color .25s var(--ease); }
.foot .f-right a:hover { color: var(--ink); }
.foot .f-copy { font-family: var(--mono); font-size: var(--t-fine); color: var(--ink-4); }

/* ── responsive ───────────────────────────────────────────── */
@media (max-width: 1080px) {
  /* stacked: stage on top, copy cross-fading beneath — still pinned,
     still no vertical drift. */
  .roll-grid { grid-template-columns: 1fr; gap: 1rem; align-content: center; }
  .roll-stage { height: min(46svh, 380px); }
  .roll-copy { gap: .75rem; }
  .rs { max-width: none; }
  .rs h3 { font-size: var(--t-h3); }
  .rs p { font-size: .98rem; line-height: 1.5; }
  .roll-rail { flex-direction: row; padding: 0; }
  .roll-rail i.on { height: 4px; width: 22px; border-radius: 2px; }
  .roll-copy { flex-direction: column-reverse; align-items: flex-start; }
}

/* very short viewports — trim the copy to its essentials rather than
   letting the pinned unit overflow */
@media (max-height: 720px) and (min-width: 1081px) {
  .rs h3 { font-size: var(--t-h3); }
  .rs p { font-size: .96rem; line-height: 1.5; }
  .rs-stat b { font-size: 1.6rem; }
}
@media (max-height: 620px) {
  .roll-stage { height: min(52svh, 320px); }
  .rs p + p { display: none; }
  .rs-meta { margin-top: .8rem; }
}

@media (max-width: 860px) {
  :root { --bar-h: 116px; }
  .topbar { height: auto; flex-wrap: wrap; padding-top: .6rem; padding-bottom: .6rem; gap: .7rem; }
  .tabnav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabnav::-webkit-scrollbar { display: none; }
  .tabnav button { padding: .48rem .78rem; font-size: .8rem; }
  .topbar-cta .btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
      transition-duration: .001ms !important; scroll-behavior: auto !important; }
  [data-reveal] { opacity: 1; transform: none; }
  .kw > i { transform: none; }
  .roll-slides > .rs { filter: none; }
}
