/* ===================================================================
   Ritus Candelabrum - homepage
   Solar stage, orbiting stations, and the sections below it.
   =================================================================== */

/* =================================================== the stage */
.stage {
  position: relative;
  /* 100vh of sticky viewport + one screenful of scroll per station */
  height: calc(100vh + var(--stage-travel, 270vh));
}

.stage__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.stage__sun {
  position: absolute;
  inset: 0;
  z-index: 50;           /* stations sort in front of or behind this */
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.4s var(--ease-out);
  /* the canvas needs no input (parallax listens on window) - without this it
     would swallow every drag that starts on empty space around the cards */
  pointer-events: none;
}

.stage__sun.is-ready { opacity: 1; }

/* CSS-only stand-in when WebGL is unavailable */
.stage__fallback {
  position: absolute;
  z-index: 49;
  top: 50%;
  left: 50%;
  width: min(52vmin, 560px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 38%, #fff1cd 0%, #ffc46a 22%, #ef8a24 48%, #c9500f 72%, #6e2205 100%);
  box-shadow: 0 0 120px 30px rgba(220, 110, 30, 0.35);
  display: none;
}

.no-webgl .stage__fallback { display: block; }

.stage__title {
  position: absolute;
  z-index: 60;
  left: 50%;
  top: clamp(5rem, 10vh, 6.5rem);
  transform: translateX(-50%);
  text-align: center;
  width: min(90vw, 640px);
  pointer-events: none;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.stage__title h1 {
  font-family: var(--font-roman);
  font-size: clamp(1.05rem, 1.9vw, 1.5rem);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  text-transform: uppercase;
  color: var(--ink-1);
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.95), 0 0 60px rgba(0, 0, 0, 0.8);
  line-height: 1.2;
}

.stage__title p {
  margin-top: 0.7rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(0.98rem, 1.4vw, 1.2rem);
  color: var(--ink-2);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.95), 0 0 50px rgba(0, 0, 0, 0.9);
}

.stage.is-turning .stage__title {
  opacity: 0;
  transform: translateX(-50%) translateY(-14px);
}

/* =================================================== orbit */
/* No z-index here on purpose: the stations must sort against the sun canvas
   inside .stage__pin, so .orbit must not open its own stacking context. */
.orbit {
  position: absolute;
  inset: 0;
  touch-action: pan-y;
  cursor: grab;
}

.orbit.is-dragging { cursor: grabbing; }

.station {
  position: absolute;
  top: 53%;
  left: 50%;
  width: var(--station-w);
  margin: calc(var(--station-h) / -2) 0 0 calc(var(--station-w) / -2);
  --station-w: clamp(168px, 15vw, 216px);
  --station-h: clamp(278px, 25vw, 356px);
  height: var(--station-h);
  padding: 1.4rem 1.25rem;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  border: 1px solid var(--line);
  /* deliberately translucent: the star behind bleeds through the frosted panel,
     which is what stops a station from reading as a hole cut in the sun */
  background:
    linear-gradient(165deg, rgba(32, 19, 36, 0.72), rgba(10, 6, 14, 0.86));
  backdrop-filter: blur(11px) saturate(1.15);
  box-shadow: 0 30px 70px -34px rgba(0, 0, 0, 0.95);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  transition: border-color 0.5s var(--ease), box-shadow 0.5s var(--ease), background 0.5s var(--ease);
  text-align: left;
  color: inherit;
  overflow: hidden;
  user-select: none;
  -webkit-user-drag: none;   /* anchors native-drag by default; the ring owns the drag */
}

/* layer promotion only where the cards actually animate every frame -
   the mobile list has no business holding eight composited layers */
.orbit .station { will-change: transform, opacity, filter; }
.orbit .station__shade { will-change: opacity; }

/* Depth dimming lives on this overlay: its opacity animates on the
   compositor, where a per-frame brightness() filter would re-rasterise the
   whole card every frame and stutter. Sits above the content on purpose -
   the card darkens as a whole, text included, like an unlit object. */
.station__shade {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #050308;
  opacity: 0;
  pointer-events: none;
}

/* The sun is the only light in the scene, so the edge facing the centre of the
   stage catches it. JS feeds the direction and strength per frame. */
.station::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: var(--lit, 0);
  background: linear-gradient(
    var(--lit-angle, 0deg),
    rgba(255, 226, 176, 0.95) 0%,
    rgba(255, 178, 92, 0.42) 3%,
    rgba(255, 140, 50, 0.16) 14%,
    rgba(255, 120, 40, 0.06) 34%,
    transparent 58%);
}

.station::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 80% at 50% 0%, rgba(233, 169, 63, 0.14), transparent 60%);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}

.station.is-active {
  border-color: var(--line-strong);
}

.station.is-active::after { opacity: 1; }

/* A station crossing the disc is wrapped in its light: glow spilling outward,
   and the edge itself catching fire on the inside. */
.station {
  box-shadow:
    0 30px 70px -34px rgba(0, 0, 0, 0.95),
    0 0 calc(26px + var(--halo, 0) * 78px) calc(var(--halo, 0) * 10px)
      rgba(255, 138, 48, calc(var(--halo, 0) * 0.5)),
    inset 0 0 calc(var(--halo, 0) * 34px) rgba(255, 176, 92, calc(var(--halo, 0) * 0.34)),
    inset 0 0 0 1px rgba(255, 196, 120, calc(var(--halo, 0) * 0.5));
}

.station.is-active {
  box-shadow:
    0 40px 90px -34px rgba(0, 0, 0, 0.95),
    0 0 60px -18px rgba(233, 169, 63, 0.45),
    0 0 calc(26px + var(--halo, 0) * 78px) calc(var(--halo, 0) * 10px)
      rgba(255, 138, 48, calc(var(--halo, 0) * 0.5)),
    inset 0 0 calc(var(--halo, 0) * 34px) rgba(255, 176, 92, calc(var(--halo, 0) * 0.34)),
    inset 0 0 0 1px rgba(255, 196, 120, calc(var(--halo, 0) * 0.5));
}

/* light sweeping across a station as it lands in front */
.station__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(102deg, transparent 32%, rgba(255, 231, 182, 0.26) 48%, transparent 64%);
}

.station.is-arriving .station__sheen { animation: sheen 0.85s var(--ease-out); }
.station.is-arriving { animation: station-land 0.7s var(--ease-out); }

@keyframes sheen {
  0% { transform: translateX(-115%); opacity: 0; }
  22% { opacity: 1; }
  100% { transform: translateX(115%); opacity: 0; }
}

@keyframes station-land {
  0% { border-color: var(--gold-hot); }
  100% { border-color: var(--line-strong); }
}

.station__num {
  font-family: var(--font-roman);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--gold-deep);
}

.station__art {
  margin: 0.85rem 0 0.75rem;
  width: 46px;
  height: 46px;
  color: var(--gold);
  opacity: 0.92;
  transition: color 0.5s var(--ease), transform 0.5s var(--ease-out);
}

.station.is-active .station__art {
  transform: scale(1.06);   /* colour comes from the card tint */
}

.station__latin {
  font-family: var(--font-roman);
  font-size: clamp(1.1rem, 1.5vw, 1.4rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-1);
  line-height: 1.15;
}

.station__name {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-style: italic;
  color: var(--gold-hot);
  margin-top: 0.3rem;
  line-height: 1.25;
}

.station__blurb {
  margin-top: 0.75rem;
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--ink-2);
  opacity: 0;
  max-height: 0;
  transition: opacity 0.45s var(--ease), max-height 0.45s var(--ease);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;      /* never crowd the badge row below */
  flex-shrink: 1;
  min-height: 0;              /* on tight cards the blurb clips before the badge row can collide */
}

.station.is-active .station__blurb { opacity: 1; max-height: 3.9rem; }

/* below this the ring cards are proportionally shorter: two blurb lines max */
@media (max-width: 1439px) {
  .orbit .station__blurb { -webkit-line-clamp: 2; }
  .orbit .station.is-active .station__blurb { max-height: 2.8rem; }
}

.station__foot {
  margin-top: auto;
  padding-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;      /* the cost pill and "intră" must never clip the card */
  gap: 0.5rem 0.6rem;
}

.station__go { margin-left: auto; }

.station__go {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-roman);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-hot);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  white-space: nowrap;
}

.station__go svg { width: 13px; height: 13px; }

.station.is-active .station__go { opacity: 1; transform: none; }

/* =================================================== rail */
.rail {
  position: absolute;
  z-index: 60;
  left: 50%;
  bottom: clamp(1.6rem, 4vh, 3rem);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  width: min(92vw, 560px);
}

.rail__ticks {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.rail__tick {
  width: 26px;
  height: 2px;
  border: 0;
  padding: 0;
  border-radius: 2px;
  background: rgba(233, 169, 63, 0.22);
  transition: background 0.4s var(--ease), transform 0.4s var(--ease);
}

.rail__tick:hover { background: rgba(233, 169, 63, 0.5); }

.rail__tick.is-on {
  background: var(--gold);
  transform: scaleY(2.2);
}

.rail__hint {
  font-family: var(--font-roman);
  font-size: 0.7rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-4);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.rail__hint::before,
.rail__hint::after {
  content: '';
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong));
}

.rail__hint::after { background: linear-gradient(90deg, var(--line-strong), transparent); }

/* =================================================== phone: vertical drum
   A portrait screen has height to travel through but no width, so the same
   ring turns around a horizontal axis instead: stations rise from below,
   pass across the sun, and leave at the top. The gesture that turns it is
   an ordinary page scroll, so nothing is hijacked. */
.stations-list { display: none; }

@media (max-width: 860px) {
  .station {
    --station-w: clamp(168px, 52vw, 226px);
    --station-h: clamp(182px, 48vw, 206px);
    top: 50%;
    padding: 0.95rem 1rem;
  }

  .station__num { font-size: 0.78rem; }
  .station__art { width: 34px; height: 34px; margin: 0.45rem 0 0.4rem; }
  .station__latin { font-size: 1.1rem; }
  .station__name { font-size: 0.9rem; margin-top: 0.15rem; }
  /* the italic subtitle already says what each station is; on a phone the
     blurb only clipped mid-sentence and stole the height the drum needs */
  .orbit .station__blurb { display: none; }
  .station__foot { padding-top: 0.6rem; }

  /* the rail reads as a vertical track beside the drum */
  .rail {
    left: auto;
    right: 0.5rem;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    flex-direction: column;
    gap: 0.6rem;
  }

  .rail__ticks { flex-direction: column; gap: 0.15rem; }

  /* the tick stays a hairline but the finger gets a real target: padding
     grows the hit area while background-clip keeps the mark thin */
  .rail__tick {
    width: 2px;
    height: 18px;
    box-sizing: content-box;
    padding: 10px 16px;
    background-clip: content-box;
  }

  .rail__tick.is-on { transform: scaleX(2.4); }
  .rail__hint { display: none; }

  .stage__title { top: auto; bottom: clamp(1.2rem, 4vh, 2.2rem); }
  .stage__title h1 { font-size: 1rem; letter-spacing: 0.34em; }
  .stage__title p { font-size: 0.92rem; }
}

/* reduced motion keeps the plain list and drops the pinned stage entirely */
@media (prefers-reduced-motion: reduce) {
  .stage { height: auto; }

  .stage__pin {
    position: relative;
    height: clamp(430px, 62vh, 560px);
  }

  /* the pin is no longer full height, so the canvas edge would slice the
     corona in a straight line - fade it out instead */
  .stage__sun {
    -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent 97%);
    mask-image: linear-gradient(to bottom, #000 62%, transparent 97%);
  }

  .orbit, .rail { display: none; }

  .stage__title { top: auto; bottom: clamp(1.5rem, 5vh, 3rem); }

  .stations-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.9rem;
    padding-block: var(--s-6);
  }

  .stations-list .station {
    position: static;
    margin: 0;
    width: auto;
    height: auto;
    min-height: 0;
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
    padding: 1.2rem;
  }

  .stations-list .station__blurb { opacity: 1; max-height: none; -webkit-line-clamp: unset; }
  .stations-list .station__go { opacity: 1; transform: none; }
  .stations-list .station__shade { display: none; }
}

/* the duplicate list only exists as the reduced-motion fallback */
body.has-ring .stations-list { display: none; }

/* =================================================== sections below */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--s-5);
  counter-reset: step;
}

.step {
  position: relative;
  padding-top: var(--s-5);
  border-top: 1px solid var(--line-soft);
}

.step::before {
  counter-increment: step;
  content: counter(step, upper-roman);
  font-family: var(--font-roman);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  color: var(--gold);
  display: block;
  margin-bottom: 0.9rem;
}

.step h3 { margin-bottom: 0.5rem; }
.step p { font-size: 0.95rem; }

/* colour strip */
.hues {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 0.7rem;
}

.hue {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.95rem 0.9rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: rgba(255, 233, 205, 0.022);
  transition: border-color 0.35s var(--ease), transform 0.35s var(--ease-out), background 0.35s;
}

.hue:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
  background: rgba(255, 233, 205, 0.05);
}

.hue__dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--hue);
  box-shadow: 0 0 18px -2px var(--hue);
}

.hue__name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--ink-1);
  line-height: 1;
}

.hue__intent { font-size: var(--fs-xs); color: var(--ink-3); }

/* split feature */
.split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

.split__media {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  aspect-ratio: 4 / 5;
  background: var(--void-2);
}

.split__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* token teaser */
.token-teaser {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s-4);
}

.token-teaser__item {
  padding: 1.3rem 1.2rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: rgba(255, 233, 205, 0.022);
}

.token-teaser__k {
  font-family: var(--font-display);
  font-size: 2.1rem;
  color: var(--gold-hot);
  line-height: 1;
}

.token-teaser__v { font-size: 0.88rem; color: var(--ink-3); margin-top: 0.4rem; }

/* closing band */
.band {
  text-align: center;
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background:
    radial-gradient(70% 120% at 50% 0%, rgba(208, 82, 28, 0.14), transparent 65%);
}

.band h2 { margin-bottom: var(--s-4); }
