/* ==========================================================================
   motion.css — the animation layer.
   Every primitive here degrades to "fully visible, no movement" under
   prefers-reduced-motion, and to "fully visible" with JS off.
   ========================================================================== */

/* ======================= Page curtain ======================= */
/* Woven reveal: four kente panels lift in sequence on first paint. */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  pointer-events: none;
}
.curtain__panel {
  background: var(--ink);
  transform-origin: top;
  transition: transform 900ms var(--ease);
  transition-delay: calc(var(--i) * 80ms);
}
.curtain__panel:nth-child(1) { background: var(--ink); }
.curtain__panel:nth-child(2) { background: var(--earth-deep); }
.curtain__panel:nth-child(3) { background: var(--ink-2); }
.curtain__panel:nth-child(4) { background: var(--ink); }
.is-loaded .curtain__panel { transform: scaleY(0); }
.is-loaded .curtain { pointer-events: none; }

.curtain__mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  transition: opacity 400ms var(--ease);
}
.is-loaded .curtain__mark { opacity: 0; }

/* ======================= Scroll progress ======================= */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(var(--p, 0));
  transform-origin: left;
  background: linear-gradient(90deg, var(--gold), var(--clay), var(--jade));
  z-index: calc(var(--z-header) + 1);
  pointer-events: none;
}

/* ======================= Split text ======================= */
/* JS wraps each word in .w > span. The span is what moves; .w clips. */
.split .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.split .w > span {
  display: inline-block;
  transform: translateY(105%) rotate(3deg);
  opacity: 0;
  transition:
    transform 900ms var(--ease),
    opacity 600ms var(--ease);
  transition-delay: calc(var(--wi, 0) * 55ms);
}
.split.is-in .w > span,
.is-ready .split .w > span { transform: none; opacity: 1; }

/* ======================= Clip reveal ======================= */
/* Images wipe open from the bottom, with a gold bar sweeping across.
   IMPORTANT: the clip-path goes on the CHILDREN, never on .clip itself.
   A self-clipped element has zero visible area, so IntersectionObserver
   reports intersectionRatio 0 and the reveal never fires — the animation
   would prevent its own trigger. .clip stays unclipped and observable. */
.clip { position: relative; }
.clip > * {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1100ms var(--ease);
}
.clip.is-in > * { clip-path: inset(0 0 0 0); }

.clip-bar {
  position: relative;
  overflow: hidden;
}
.clip-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 2;
  pointer-events: none;
}
.clip-bar.is-in::after {
  animation: sweep 1100ms var(--ease) forwards;
}
@keyframes sweep {
  0%   { transform: scaleX(0); transform-origin: left; }
  48%  { transform: scaleX(1); transform-origin: left; }
  52%  { transform: scaleX(1); transform-origin: right; }
  100% { transform: scaleX(0); transform-origin: right; }
}

/* ======================= Parallax ======================= */
/* --py is written by JS from scroll position. */
.par { will-change: transform; transform: translate3d(0, var(--py, 0px), 0); }

/* ======================= Kente band ======================= */
/* A ticker of woven colour + repeating word, the site's loudest moment. */
.band {
  position: relative;
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: var(--ink-2);
  padding-block: var(--s-5);
}
.band__track {
  display: flex;
  gap: var(--s-6);
  width: max-content;
  align-items: center;
  animation: bandscroll 40s linear infinite;
}
.band--rev .band__track { animation-direction: reverse; }
.band:hover .band__track { animation-play-state: paused; }
@keyframes bandscroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.band__word {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1rem + 3vw, 3.4rem);
  font-weight: 800;
  letter-spacing: var(--tr-display);
  color: var(--bone);
  white-space: nowrap;
}
.band__word--out {
  color: transparent;
  -webkit-text-stroke: 1px var(--earth-lift);
}
.band__dot {
  width: 10px; height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--gold);
}
.band__dot:nth-child(4n)   { background: var(--clay); }
.band__dot:nth-child(6n)   { background: var(--jade); }

/* ======================= Counters ======================= */
.count { font-variant-numeric: tabular-nums; }

/* ======================= Magnetic buttons ======================= */
.mag { transition: transform 400ms var(--ease); }

/* ======================= Sticky feature stack ======================= */
.stack { display: grid; gap: var(--s-6); }
@media (min-width: 900px) {
  .stack { grid-template-columns: 1fr 1fr; align-items: start; gap: var(--s-8); }
  .stack__sticky { position: sticky; top: 22vh; }
}
.stack__item {
  padding-block: var(--s-6);
  border-block-end: 1px solid var(--line);
  opacity: 0.42;
  transition: opacity var(--d-base) var(--ease), transform var(--d-base) var(--ease);
}
.stack__item.is-active { opacity: 1; }
.stack__item h3 {
  font-size: clamp(1.15rem, 0.95rem + 1vw, 1.6rem);
  font-weight: 600;
  display: flex;
  gap: var(--s-4);
  align-items: baseline;
}
.stack__item p { color: var(--bone-dim); font-size: var(--step-small); margin-top: var(--s-3); }
.stack__n { color: var(--gold); flex: none; }

/* ======================= Hover cursor glow ======================= */
/* A soft gold light that follows the pointer over feature grids.
   Pointer-fine only: on touch it would be dead weight. */
.glow { position: relative; overflow: hidden; }
.glow::before {
  content: "";
  position: absolute;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold) 16%, transparent), transparent 68%);
  transform: translate3d(calc(var(--mx, -999px) - 190px), calc(var(--my, -999px) - 190px), 0);
  opacity: 0;
  transition: opacity var(--d-base) var(--ease);
  pointer-events: none;
  z-index: 0;
}
@media (hover: hover) and (pointer: fine) {
  .glow:hover::before { opacity: 1; }
}
.glow > * { position: relative; z-index: 1; }

/* ======================= Tilt ======================= */
.tilt { transition: transform 500ms var(--ease); transform-style: preserve-3d; }

/* ======================= FAQ accordion ======================= */
/* Native <details> — works with zero JS, animates when supported. */
.faq__item {
  border-block-end: 1px solid var(--line);
}
.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-block: var(--s-5);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 0.9rem + 0.9vw, 1.4rem);
  font-weight: 600;
  letter-spacing: var(--tr-display);
  transition: color var(--d-fast) var(--ease);
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q:hover { color: var(--gold); }
.faq__sign {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid var(--line-firm);
  border-radius: 50%;
  color: var(--gold);
  transition: transform var(--d-base) var(--ease), border-color var(--d-fast) var(--ease);
}
.faq__item[open] .faq__sign { transform: rotate(45deg); border-color: var(--gold); }
.faq__a {
  padding-block-end: var(--s-5);
  color: var(--bone-dim);
  font-size: var(--step-small);
  max-width: 60ch;
}
@supports (interpolate-size: allow-keywords) {
  .faq__item::details-content {
    block-size: 0;
    overflow: hidden;
    transition: block-size var(--d-base) var(--ease), content-visibility var(--d-base) allow-discrete;
  }
  .faq__item[open]::details-content { block-size: auto; }
}

/* ==========================================================================
   REDUCED MOTION — everything above becomes static and fully visible.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .curtain { display: none !important; }
  .progress { display: none !important; }

  .split .w > span { transform: none !important; opacity: 1 !important; transition-delay: 0s !important; }
  .clip > * { clip-path: none !important; }
  .clip-bar::after { display: none !important; }
  .par { transform: none !important; }

  .band__track { animation: none !important; transform: none !important; }
  .band { overflow-x: auto; }

  .mag { transform: none !important; }
  .glow::before { display: none !important; }
  .tilt { transform: none !important; }

  .stack__item { opacity: 1 !important; }
  .stack__sticky { position: static !important; }
}

/* ==========================================================================
   NO JS — nothing may stay hidden.
   ========================================================================== */
.no-js .curtain { display: none; }
.no-js .split .w > span { transform: none; opacity: 1; }
.no-js .clip > * { clip-path: none; }
.no-js .stack__item { opacity: 1; }
.no-js .par { transform: none; }

/* ==========================================================================
   Ambient cool mist — a soft, slow, blue-white haze that drifts across the
   whole site on its own (no cursor). Fixed just below the header so it tints
   content but never the nav/menus. Purely CSS; frozen under reduced motion.
   ========================================================================== */
.mist {
  position: fixed; inset: 0; overflow: hidden; pointer-events: none;
  z-index: calc(var(--z-header) - 1);
}
.mist span {
  position: absolute; border-radius: 50%;
  filter: blur(52px); will-change: transform;
}
/* Gold / amber palette, head → tail — light and soft. */
.mist span:nth-child(1) { background: radial-gradient(circle, rgba(246,205,110,0.42), rgba(246,205,110,0) 72%); }
.mist span:nth-child(2) { background: radial-gradient(circle, rgba(249,214,130,0.34), rgba(249,214,130,0) 72%); }
.mist span:nth-child(3) { background: radial-gradient(circle, rgba(226,150,80,0.28), rgba(226,150,80,0) 72%); }
.mist span:nth-child(4) { background: radial-gradient(circle, rgba(246,205,110,0.22), rgba(246,205,110,0) 72%); }

/* Fallback (touch / no-JS): drift slowly on its own, positioned across the page. */
.mist:not(.mist--live) span:nth-child(1) { width: 56vw; height: 56vw; left: -12vw; top: -12vh; animation: mist-a 54s var(--ease-io) infinite; }
.mist:not(.mist--live) span:nth-child(2) { width: 48vw; height: 48vw; right: -14vw; top: 16vh; animation: mist-b 66s var(--ease-io) infinite; }
.mist:not(.mist--live) span:nth-child(3) { width: 52vw; height: 52vw; left: 20vw; bottom: -22vh; animation: mist-c 60s var(--ease-io) infinite; }
.mist:not(.mist--live) span:nth-child(4) { width: 40vw; height: 40vw; right: 12vw; bottom: -10vh; animation: mist-b 72s var(--ease-io) infinite reverse; }
@keyframes mist-a { 0%,100% { transform: translate(0,0) scale(1);    } 50% { transform: translate(9vw,7vh) scale(1.16);  } }
@keyframes mist-b { 0%,100% { transform: translate(0,0) scale(1.06); } 50% { transform: translate(-8vw,5vh) scale(1);    } }
@keyframes mist-c { 0%,100% { transform: translate(0,0) scale(1);    } 50% { transform: translate(6vw,-6vh) scale(1.14); } }

/* Live (cursor-follow, set by JS): the blobs are sized + positioned in JS and
   trail the pointer as a liquid; no autonomous drift. */
.mist--live span { top: 0; left: 0; right: auto; bottom: auto; animation: none !important; }

@media (prefers-reduced-motion: reduce) { .mist span { animation: none !important; } }
