/* Home page motion layer (index.html only; pairs with assets/js/motion.js).
   Rules: everything here is either static styling or a hidden state that only exists
   after motion.js adds a class (html.mo-on). No JS = the production page, untouched.
   Animated properties: transform and opacity only. */

/* Candles + spark exist in the markup; static look (also the no-JS / reduced-motion look) */
.chart__candles line { stroke: #a89880; stroke-opacity: 0.45; stroke-width: 1; }
.chart__candles .candle--up rect { fill: #c6a066; fill-opacity: 0.32; stroke: #c6a066; stroke-opacity: 0.7; stroke-width: 1; }
.chart__candles .candle--up line { stroke: #c6a066; stroke-opacity: 0.55; }
.chart__candles .candle--down rect { fill: none; stroke: #a89880; stroke-opacity: 0.5; stroke-width: 1; }
.chart__spark-ring { opacity: 0.6; }

/* Visually hidden, still read by screen readers */
.mo-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Scroll progress (top, RTL fills from the right) ---------- */
.mo-progress {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 60;
  height: 2px;
  background: linear-gradient(270deg, #c6a066, #e0bc7a 70%, rgb(224 188 122 / 40%));
  transform: scaleX(0);
  transform-origin: 100% 50%;
  pointer-events: none;
}

/* ---------- Headline mask reveal (words grouped into lines) ---------- */
.mo-split .mo-w {
  display: inline-block;
  /* room for Hebrew descenders (ק ן ך ף ץ) without changing the line box */
  padding-block: 0.06em 0.16em;
  margin-block: -0.06em -0.16em;
  overflow: clip;
  vertical-align: top;
}
.mo-split .mo-w > span { display: inline-block; }
.mo-num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ---------- Skip link (all JS modes) ---------- */
.mo-skip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  background: rgb(28 24 20 / 72%);
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms linear, color 120ms linear, border-color 120ms linear;
}
.page-landing a.mo-skip { color: var(--accent); }
.page-landing a.mo-skip:hover {
  border-color: var(--accent-hover);
  background: rgb(198 160 102 / 12%);
  color: var(--accent-hover);
}
.mo-skip svg { width: 16px; height: 16px; flex: none; }
.page-landing .mo-skip:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 3px; }

/* ---------- Card stack (only when motion.js enables it) ---------- */
.mo-hud {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 28px;
}
.mo-counter, .mo-track { display: none; }
.mo-stack-on .mo-counter { display: inline; }
.mo-stack-on .mo-track { display: block; }
.mo-counter {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mo-counter b { color: var(--accent); font-weight: 500; }
.mo-track {
  position: relative;
  flex: 1 1 auto;
  min-width: 40px;
  height: 1px;
  background: var(--line);
  overflow: hidden;
}
.mo-track__fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(270deg, #e0bc7a, #c6a066);
  transform: scaleX(0);
  transform-origin: 100% 50%;
}

.mo-stack-on .quotes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin-top: 28px;
  padding-top: 48px; /* room for the 3 older cards that peek above the front one (3 x 16px) */
  overflow: visible;
  border: 0;
  background: none;
}
.mo-stack-on .quote {
  grid-area: 1 / 1;
  position: relative;
  isolation: isolate;
  height: auto;
  padding: 40px 44px 36px;
  border: 1px solid rgb(198 160 102 / 22%);
  background:
    radial-gradient(120% 80% at 100% 0%, rgb(198 160 102 / 9%), transparent 60%),
    linear-gradient(180deg, #2c261e, #221d17);
  transform-origin: 50% 0%;
  backface-visibility: hidden;
}
/* gold hairline on the top edge */
.mo-stack-on .quote::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: -1px;
  height: 1px;
  background: linear-gradient(270deg, transparent, rgb(224 188 122 / 75%) 30%, rgb(224 188 122 / 75%) 70%, transparent);
  pointer-events: none;
}
.mo-stack-on .quote svg { width: 26px; height: 26px; }
.mo-stack-on .quote blockquote {
  margin-top: 22px;
  font-size: clamp(1.08rem, 0.9rem + 0.6vw, 1.42rem);
  line-height: 1.6;
}
.mo-stack-on .quote figcaption {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding-top: 28px;
  color: var(--accent);
}
.mo-stack-on .quote figcaption::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}
/* fake shadow: a static box-shadow layer whose opacity is animated */
.mo-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  box-shadow: 0 34px 70px -28px rgb(0 0 0 / 85%), 0 10px 24px -12px rgb(0 0 0 / 60%);
  pointer-events: none;
}
/* dim overlay for cards that move to the back of the deck */
.mo-dim {
  position: absolute;
  inset: -1px;
  z-index: 2;
  background: #0d0b09;
  opacity: 0;
  pointer-events: none;
}
.mo-stack-on .mo-pinned .quote { will-change: transform, opacity; }

@media (min-width: 1024px) {
  .mo-stack-on #voices .wrap {
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    grid-template-rows: auto auto auto 1fr;
    column-gap: 64px;
    align-items: start;
  }
  .mo-stack-on #voices .section__label { grid-column: 1; grid-row: 1; }
  .mo-stack-on #voices .wrap > .reveal { grid-column: 1; grid-row: 2; }
  .mo-stack-on #voices .mo-hud { grid-column: 1; grid-row: 3; flex-wrap: wrap; margin-top: 40px; }
  .mo-stack-on #voices .quotes { grid-column: 2; grid-row: 1 / 5; margin-top: 0; }
  .mo-stack-on .mo-hud .mo-track { flex-basis: 100%; order: 3; }
  .mo-stack-on .mo-hud .mo-counter { font-size: 15px; }
}

@media (max-width: 639px) {
  .mo-stack-on .quote { padding: 26px 22px 24px; }
  .mo-stack-on .quote svg { width: 22px; height: 22px; }
  .mo-stack-on .quote blockquote { margin-top: 14px; font-size: 1rem; line-height: 1.55; }
  .mo-stack-on .quote figcaption { padding-top: 18px; }
  .mo-stack-on #voices .section__label { margin-bottom: 20px; }
  .mo-stack-on #voices h2 { font-size: 1.6rem; }
  .mo-stack-on .mo-hud { gap: 12px; margin-top: 18px; }
  .mo-stack-on .quotes { margin-top: 8px; }
  .mo-skip { padding: 8px 14px; font-size: 13px; }
}

/* ---------- Cursor glow + magnetic CTA (fine pointer only, added by JS) ---------- */
.mo-glow {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 45;
  width: 420px;
  height: 420px;
  margin: -210px 0 0 -210px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(224 188 122 / 15%), rgb(198 160 102 / 6%) 45%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  contain: strict;
}
.mo-magnetic { transition-property: background-color, border-color, color; }

@media (prefers-reduced-motion: reduce) {
  .mo-progress, .mo-glow { display: none; }
}
