/* ================================================================
   Sections 04–09, ported from pixeluniverse/styles.css (v4).
   Same markup, same motion (pu-motion.js); colors mapped onto this
   site's tokens so nothing here hard-codes the Pixel Universe palette.
   Loaded after styles.css.
   ================================================================ */

/* token bridge: PU names → this site's palette */
:root {
  --noir:  var(--void);
  --bone:  var(--signal);
  --sand:  var(--body-c);
  --crimson: var(--volt);
  --flare: var(--volt-h);
  --ash:   #5E5E66;
  --room:  #F4F1EA;                 /* the inversion's light room (Hiba's bone) */
  --hairline-light: rgba(6,6,8,.10);
}

.btn-ink { background: var(--noir); color: var(--bone); }
.btn-ink:hover { box-shadow: 0 0 0 2px var(--hairline-light), 0 10px 28px rgba(6,6,8,.22); }

/* ================================================================
   04 · WHO — founder quote (the photo wipe lives in styles.css)
   ================================================================ */
.founder-quote p {
  font-family: var(--f-body); font-style: italic; font-weight: 500;
  font-size: clamp(1.15rem, 1.6vw, 1.35rem); line-height: 1.35;
  color: var(--bone); margin-bottom: .7rem;
}
.founder-quote cite { font-style: normal; display: block; }
.who-grid + .who-grid { margin-top: clamp(4rem, 8vw, 7rem); }

/* ================================================================
   05 · SOLUTION — the inversion (light room)
   ================================================================ */
.solution { color: var(--tx); }
.solution .h2, .solution h3 { color: var(--ink); }

/* no motion (reduced-motion or no JS): the section is statically light */
html:not(.has-motion) .solution {
  --bg: var(--room); --ink: var(--noir); --tx: var(--noir); --mut: var(--ash);
  background: var(--bg);
}

.solution-cols {
  display: grid;
  grid-template-columns: 1fr 2px 1fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  margin: 4rem 0 3.5rem;
  align-items: stretch;
}
.sol-col {
  padding: clamp(1.6rem, 3vw, 2.4rem);
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}
.sol-col h3 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin-bottom: 1rem; }
.sol-col p { max-width: 46ch; }

.crimson-rule { width: 2px; background: var(--crimson); border-radius: 2px; }

/* rocket motion graphic — inks in --ink so it survives the inversion */
.rocket-stage { margin-top: clamp(3rem, 7vw, 5rem); }
.rocket-stage svg { display: block; width: 100%; height: auto; }
.rk-part { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rk-guide, .rk-cross { fill: none; stroke: var(--mut); stroke-width: 1; opacity: .5; }
.rk-cross { stroke-width: 1.1; }
.rk-dim { font-family: var(--f-mono); font-size: 10px; letter-spacing: .18em; fill: var(--mut); }
.rk-speed { stroke: var(--mut); stroke-width: 1.5; stroke-linecap: round; }
.rk-puff { fill: none; stroke: var(--mut); stroke-width: 1.2; }
.rk-flame-outer { fill: var(--mut); fill-opacity: .3; stroke: var(--mut); stroke-width: 1.5; }
.rk-flame-inner { fill: var(--ink); fill-opacity: .8; }

.sol-close {
  font-family: var(--f-display); font-weight: 600;
  text-transform: uppercase; line-height: .95; letter-spacing: .005em;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  color: var(--ink);
  margin-bottom: 2.5rem;
  text-wrap: balance;
}

/* ================================================================
   06 · FOUNDATION — the blueprint
   ================================================================ */
.pillars { margin-top: 4.5rem; display: flex; flex-direction: column; gap: clamp(4rem, 8vw, 7rem); }

.pillar {
  display: grid; grid-template-columns: 1fr 1.3fr;
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.pillar:nth-child(even) { grid-template-columns: 1.3fr 1fr; }
.pillar:nth-child(even) .blueprint { order: 2; }

.blueprint { width: 100%; max-width: 340px; justify-self: center; }
.blueprint * {
  fill: none; stroke: rgba(255,255,255,.7); stroke-width: 1.2;
  stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.blueprint .bp-mark { stroke: var(--bone); fill: rgba(255,255,255,.08); }

.pillar-copy h3 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin-bottom: .9rem; }
.pillar-copy p { max-width: 50ch; }

/* ================================================================
   07 · THREE FRONTS — sticky panels
   ================================================================ */
.fronts-grid {
  margin-top: 4.5rem;
  display: grid;
  grid-template-columns: 1fr 1px 1.2fr;
  gap: clamp(2rem, 4vw, 4rem);
}

.fronts-sticky {
  position: sticky; top: 22vh;
  align-self: start;
  height: fit-content;
}

.odometer {
  font-family: var(--f-display);
  font-size: clamp(5rem, 10vw, 8.5rem);
  color: var(--bone); line-height: 1;
  height: 1em; overflow: hidden;
  margin-bottom: 1.4rem;
}
.odo-track { display: flex; flex-direction: column; transition: transform .6s var(--ease); }
.odo-track span { height: 1em; line-height: 1; display: block; }

.front-names { position: relative; min-height: 2.2em; display: block; }
.front-name {
  position: absolute; inset: 0 auto auto 0;
  font-family: var(--f-display); font-weight: 600;
  text-transform: uppercase; letter-spacing: .005em;
  font-size: clamp(1.7rem, 2.8vw, 2.5rem); line-height: .95;
  color: var(--bone);
  opacity: 0; transform: translateY(12px);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.front-name.is-active { opacity: 1; transform: translateY(0); }

.fronts-progress { background: var(--hairline); position: relative; }
.fronts-progress span {
  position: absolute; top: 0; left: 0; width: 100%; height: 0%;
  background: var(--crimson);
}

.fronts-panels { display: flex; flex-direction: column; gap: clamp(5rem, 18vh, 11rem); padding: 4vh 0 10vh; }
.front-panel h3 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin-bottom: 1rem; }
.front-panel p { max-width: 52ch; margin-bottom: 1.2rem; }
.front-stat { color: var(--bone); }

/* ================================================================
   08 · FUNNEL
   ================================================================ */
.funnel { padding: 0; }
.funnel-pin { min-height: 100vh; display: flex; align-items: center; padding: 12vh 0; }

.funnel-grid {
  display: grid; grid-template-columns: 1.1fr 1fr;
  gap: clamp(2.5rem, 6vw, 6rem); align-items: center;
}

.stages { margin-top: 3rem; display: flex; flex-direction: column; gap: 2.2rem; }
.stage {
  opacity: .35; padding-left: 1.1rem; border-left: 2px solid transparent;
  transition: opacity .3s var(--ease), border-color .3s var(--ease);
}
.stage.is-active { opacity: 1; border-left-color: var(--bone); }
.stage h3 { font-size: 1.6rem; margin: .5rem 0 .4rem; }
.stage p { font-size: 1rem; max-width: 46ch; }

.funnel-canvas-wrap { position: relative; aspect-ratio: 3 / 4; max-height: 76vh; }
#funnelCanvas { width: 100%; height: 100%; display: block; }

/* ================================================================
   09 · WHO IT'S FOR — marquee
   ================================================================ */
.for { overflow: hidden; }

.marquee {
  margin-top: clamp(4rem, 8vh, 6rem);
  display: flex; flex-direction: column; gap: .6rem;
  user-select: none;
  direction: ltr;                   /* the loop math assumes left-to-right, in every language */
}
.marquee-row {
  display: flex; white-space: nowrap; will-change: transform;
  font-family: var(--f-display); font-weight: 600;
  font-size: clamp(3.2rem, 8.5vw, 7.5rem);
  text-transform: uppercase; letter-spacing: .005em; line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--bone);
}
.marquee-row > span { padding-right: .25em; }
.mq-item { transition: color .35s var(--ease); }
.mq-item:hover { color: var(--bone); }
.mq-sep { -webkit-text-stroke-color: rgba(255,255,255,.4); padding: 0 .2em; }

.for-closer {
  margin: clamp(5rem, 20vh, 20vh) auto;
  text-align: center;
  font-family: var(--f-display); font-weight: 600;
  text-transform: uppercase; letter-spacing: .005em; line-height: .95;
  font-size: clamp(2.2rem, 4.6vw, 4rem);
  color: var(--bone);
  max-width: 16ch;
  text-wrap: balance;
  padding-inline: 16px;
}

/* ================================================================
   right-to-left (Arabic)
   ================================================================ */
[dir="rtl"] .stage { padding-left: 0; padding-right: 1.1rem; border-left: 0; border-right: 2px solid transparent; }
[dir="rtl"] .stage.is-active { border-right-color: var(--bone); }
[dir="rtl"] .front-name { inset: 0 0 auto auto; }
[dir="rtl"] .sol-close, [dir="rtl"] .front-name, [dir="rtl"] .for-closer,
[dir="rtl"] .marquee-row { text-transform: none; line-height: 1.25; }
[dir="rtl"] .marquee-row > span { padding-right: 0; padding-left: .25em; }
/* joined Arabic letters overlap inside each word, so an outline draws those seams:
   use a soft solid fill instead, and keep the full fill on hover */
[dir="rtl"] .marquee-row { -webkit-text-stroke: 0; color: rgba(255,255,255,.16); }
[dir="rtl"] .mq-sep { color: rgba(255,255,255,.3); }

/* Arabic: every display/body font goes through Cairo */
[dir="rtl"] { --f-display: 'Cairo', sans-serif; --f-body: 'Cairo', 'Satoshi', sans-serif; }
/* arrows inside buttons and links are a hard-coded → in the HTML */
[dir="rtl"] .btn .arr, [dir="rtl"] .link-draw .arr { display: inline-block; transform: scaleX(-1); }
[dir="rtl"] .btn:hover .arr, [dir="rtl"] .link-draw:hover .arr { transform: scaleX(-1) translateX(4px); }

/* ================================================================
   reduced motion
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  .stage { opacity: 1; }
  .marquee-row { flex-wrap: wrap; white-space: normal; transform: none !important; padding-inline: 4vw; }
  .marquee-row > span + span { display: none; }
}

/* ================================================================
   responsive
   ================================================================ */
@media (max-width: 768px) {
  .solution-cols { grid-template-columns: 1fr; }
  .crimson-rule { width: 100%; height: 2px; }

  .pillar, .pillar:nth-child(even) { grid-template-columns: 1fr; }
  .pillar:nth-child(even) .blueprint { order: 0; }
  .blueprint { max-width: 260px; }

  .fronts-grid { grid-template-columns: 1fr; }
  /* a sticky side odometer can't follow panels in a single column —
     each panel carries its own number instead */
  .fronts-sticky { display: none; }
  .fronts-progress { display: none; }
  .front-names { display: none; }
  .fronts-panels { gap: 3.5rem; padding: 1rem 0 0; counter-reset: front; }
  .front-panel::before {
    counter-increment: front;
    content: "0" counter(front);
    display: block;
    font-family: var(--f-display);
    font-size: 4rem; line-height: 1;
    color: var(--bone);
    margin-bottom: .7rem;
  }

  .funnel-pin { min-height: 0; padding: var(--sec-pad) 0; }
  .funnel-grid { grid-template-columns: 1fr; }
  .funnel-canvas-wrap { max-width: 380px; margin-inline: auto; width: 100%; }
  .stage { opacity: 1; }
}
