/*
 * AKASHA.CAT — Capa de FONS VIU + HERO 3D
 * Persephone · sistema premium (nivell Awwwards)
 * ----------------------------------------------------------------
 * · bg-stage: aures + mandala de geometria sagrada + gra (TOTES les
 *   pàgines, darrere el contingut). Llegat conservat.
 * · hero3d: hero a tota l'alçada de la HOME que allotja el canvas
 *   WebGL (assets/js/hero3d.js) amb escut de llegibilitat radial.
 * Requereix: design-tokens.css carregat abans.
 * Tot respecta prefers-reduced-motion (al final).
 * ================================================================ */

/* ════════════════════════════════════════════════════════════════
   CAPA DE FONS VIU (fixa, darrere TOT, no interactiva)
   ════════════════════════════════════════════════════════════════ */
.bg-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 78% 8%,
      var(--color-bg-base) 0%,
      var(--color-bg-2) 48%,
      var(--color-bg-sand) 100%);
}

/* La HOME amaga el fons CSS dins del hero (el canvas WebGL el cobreix),
   però el deixa per a la resta de la pàgina sota el hero. */

/* ── Aures d'energia que flueixen lentament ── */
.aura {
  position: absolute;
  border-radius: 50%;
  filter: blur(54px);
  will-change: transform;
  transform: translateZ(0);
}
.aura--1 {
  width: 52vw; height: 52vw; left: -10vw; top: -6vw;
  background: radial-gradient(circle, var(--color-aura-peach) 0%, rgba(243, 217, 198, 0) 62%);
  opacity: 0.42; animation: aura-drift-1 72s ease-in-out infinite alternate;
}
.aura--2 {
  width: 48vw; height: 48vw; right: -8vw; top: 8vw;
  background: radial-gradient(circle, var(--color-aura-mauve) 0%, rgba(220, 211, 224, 0) 64%);
  opacity: 0.38; animation: aura-drift-2 84s ease-in-out infinite alternate;
}
.aura--3 {
  width: 56vw; height: 56vw; left: 12vw; bottom: -20vw;
  background: radial-gradient(circle, var(--color-aura-sage) 0%, rgba(215, 224, 210, 0) 64%);
  opacity: 0.36; animation: aura-drift-3 92s ease-in-out infinite alternate;
}
.aura--4 { display: none; }
@keyframes aura-drift-1 { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(5vw,4vh,0) scale(1.12); } }
@keyframes aura-drift-2 { 0% { transform: translate3d(0,0,0) scale(1.04); } 100% { transform: translate3d(-5vw,5vh,0) scale(0.94); } }
@keyframes aura-drift-3 { 0% { transform: translate3d(0,0,0) scale(0.97); } 100% { transform: translate3d(4vw,-5vh,0) scale(1.10); } }

/* ── Mandala de geometria sagrada (línia fina daurada, gir lentíssim) ── */
.sacred {
  position: absolute;
  top: 38%; left: 78%;
  width: min(118vh, 96vw);
  height: min(118vh, 96vw);
  transform: translate(-50%, -50%);
  color: var(--color-gold);
  opacity: 0.15;
  will-change: transform;
}
.sacred svg { width: 100%; height: 100%; display: block; }
.sacred .rot     { transform-box: fill-box; transform-origin: center; animation: sacred-spin 220s linear infinite; }
.sacred .rot-rev { transform-box: fill-box; transform-origin: center; animation: sacred-spin 300s linear infinite reverse; }
@keyframes sacred-spin { to { transform: rotate(360deg); } }

/* ── Constel·lació de punts (twinkle) ── */
.stars { position: absolute; inset: 0; }
.star {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: var(--color-gold-soft); opacity: 0.5;
  animation: star-twinkle 6s ease-in-out infinite;
}
@keyframes star-twinkle { 0%,100% { opacity: 0.2; transform: scale(0.8); } 50% { opacity: 0.7; transform: scale(1.25); } }

/* ── Gra de pel·lícula subtil ── */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* El contingut viu per damunt del fons viu */
.shell { position: relative; z-index: 2; }

/* Vel de llegibilitat per a textos sobre el fons (interior) */
.veil { position: relative; }
.veil::before {
  content: ""; position: absolute; inset: -30px -50px; z-index: -1;
  background: radial-gradient(ellipse at center, rgba(251, 248, 243, 0.78) 0%, rgba(251, 248, 243, 0) 72%);
  pointer-events: none;
}
@media (max-width: 768px) { .veil::before { inset: -20px -12px; } }

/* ════════════════════════════════════════════════════════════════
   HERO 3D — secció a tota l'alçada amb canvas WebGL (assets/js/hero3d.js)
   Markup:  <section class="hero3d">
              <canvas id="akasha-hero-canvas"></canvas>
              <div class="hero3d-fallback" hidden></div>
              <div class="hero3d-inner"> …copy… </div>
            </section>
   ════════════════════════════════════════════════════════════════ */
.hero3d {
  position: relative;
  /* Resta la barra d'anunci + nav perquè el hero ompli la primera vista. */
  min-height: clamp(620px, calc(100svh - 132px), 1000px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  /* El hero porta el seu propi color de fons (per si el canvas triga). */
  background: var(--color-bg-base);
  margin-bottom: clamp(2rem, 5vw, 5rem);
}

/* Canvas WebGL: ple, darrere el contingut. hero3d.js el dimensiona. */
#akasha-hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* Fallback clar (sense WebGL / reduced-motion): aura estàtica de gradient. */
.hero3d-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(58% 52% at 24% 20%, var(--color-aura-peach) 0%, rgba(243, 217, 198, 0) 60%),
    radial-gradient(54% 50% at 80% 26%, var(--color-aura-mauve) 0%, rgba(220, 211, 224, 0) 62%),
    radial-gradient(60% 56% at 60% 90%, var(--color-aura-sage) 0%, rgba(215, 224, 210, 0) 60%),
    linear-gradient(180deg, var(--color-bg-base) 0%, var(--color-bg-2) 55%, var(--color-bg-sand) 100%);
}
.hero3d-fallback[hidden] { display: none; }

/* Gra propi del hero (sobre el canvas, sota el text) per a textura. */
.hero3d::after {
  content: "";
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Contingut del hero — centrat, amb escut de llegibilitat radial darrere. */
.hero3d-inner {
  position: relative;
  z-index: 2;
  width: min(840px, 100% - clamp(2.5rem, 10vw, 8rem));
  margin-inline: auto;
  text-align: center;
  padding: clamp(3rem, 8vh, 7rem) 0;
}
/* Escut radial: el text fosc es llegeix sobre l'aura en moviment. */
.hero3d-inner::before {
  content: "";
  position: absolute;
  inset: clamp(-6rem, -8vh, -3rem) clamp(-7vw, -10vw, -4rem);
  z-index: -1;
  background: var(--veil-hero);
  pointer-events: none;
}

/* Eyebrow del hero */
.hero3d-eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-gold-action);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.85rem;
  text-shadow: 0 1px 16px rgba(251, 248, 243, 0.7);
}
.hero3d-eyebrow::before,
.hero3d-eyebrow::after {
  content: ""; width: 28px; height: 1px;
  background: var(--color-gold); opacity: 0.55;
}

/* Titular gran Cormorant amb accent italic */
.hero3d-inner h1 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2.9rem, 2rem + 5.4vw, 6.4rem);
  line-height: 1.04;
  letter-spacing: -0.005em;
  color: var(--color-text-primary);
  margin: 1.5rem auto 0;
  max-width: 16ch;
  text-shadow: var(--text-shadow-hero);
}
.hero3d-inner h1 em,
.hero3d-inner h1 .gold {
  font-style: italic;
  color: var(--color-gold-action);
}
@supports (background-clip: text) {
  .hero3d-inner h1 .gold {
    background: linear-gradient(96deg, var(--color-gold-deep), var(--color-gold-action));
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
}

/* Subcopy curt */
.hero3d-sub {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
  max-width: 40ch;
  margin: 1.6rem auto 0;
  text-shadow: 0 1px 16px rgba(251, 248, 243, 0.7);
}

/* Frases rotatòries (reaprofita #hero-phrases del site.js) */
.hero3d .hero-phrases {
  font-family: var(--font-serif); font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  color: var(--color-gold-action);
  min-height: 1.5em; margin: 1.4rem auto 0; max-width: 34ch;
  text-shadow: 0 1px 16px rgba(251, 248, 243, 0.7);
}

/* CTA del hero */
.hero3d .cta-row {
  margin-top: 2.4rem;
  display: flex; align-items: center; gap: 1.3rem;
  flex-wrap: wrap; justify-content: center;
}
.hero3d .cta-note {
  font-size: var(--text-sm); color: var(--color-text-secondary);
  font-weight: 300; max-width: 22ch;
  text-shadow: 0 1px 14px rgba(251, 248, 243, 0.7);
}

/* Indicador de scroll, centrat a baix */
.hero3d .scroll-ind {
  position: absolute; bottom: clamp(18px, 3vh, 34px); left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 0.64rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--color-gold-action); z-index: 2;
  text-shadow: 0 1px 14px rgba(251, 248, 243, 0.7);
}
.hero3d .scroll-ind .track {
  width: 1px; height: 40px; background: var(--hair);
  position: relative; overflow: hidden; order: 2;
}
.hero3d .scroll-ind .track::after {
  content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 16px;
  background: var(--color-gold); animation: scroll-slide 2.4s ease-in-out infinite;
}
@keyframes scroll-slide { 0% { transform: translateY(-18px); opacity: 0; } 40% { opacity: 1; } 100% { transform: translateY(42px); opacity: 0; } }

/* Entrada esglaonada del contingut del hero (sense JS, pura CSS) */
.hero3d-inner .hero3d-eyebrow,
.hero3d-inner h1,
.hero3d-sub,
.hero3d .hero-phrases,
.hero3d .cta-row {
  opacity: 0; transform: translateY(20px);
  animation: hero-rise 1.1s var(--ease-premium) forwards;
}
.hero3d-inner .hero3d-eyebrow { animation-delay: 0.15s; }
.hero3d-inner h1              { animation-delay: 0.32s; }
.hero3d-sub                   { animation-delay: 0.55s; }
.hero3d .hero-phrases         { animation-delay: 0.72s; }
.hero3d .cta-row              { animation-delay: 0.86s; }
@keyframes hero-rise { to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  .hero3d { min-height: clamp(560px, calc(100svh - 120px), 820px); }
  .hero3d-inner h1 { max-width: 14ch; }
  .hero3d .hero-phrases { font-size: 1.12rem; }
}

/* ════════════════════════════════════════════════════════════════
   HERO ASIMÈTRIC (LLEGAT) — conservat per compatibilitat. La home ja
   no l'usa (ara fa servir .hero3d), però altres usos no es trenquen.
   ════════════════════════════════════════════════════════════════ */
.hero {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 40px;
  padding: 32px 0 60px;
  position: relative;
}
.hero-copy { max-width: 620px; position: relative; }
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-gold-action);
  font-weight: 600;
  margin-bottom: 26px;
  display: flex; align-items: center; gap: 14px;
}
.eyebrow::before { content: ""; width: 34px; height: 1px; background: var(--color-gold); opacity: 0.6; }
.hero h1 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: var(--text-hero);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-primary);
  margin-bottom: 28px;
}
.hero h1 em { font-style: italic; color: var(--color-text-secondary); }
.hero h1 .gold { font-style: italic; color: var(--color-gold-action); }
@supports (background-clip: text) {
  .hero h1 .gold {
    background: linear-gradient(90deg, var(--color-gold-deep, #A9844E), var(--color-gold-action, #8A6D3B));
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
}
.hero .subcopy { display: none; }
.hero .hero-phrases {
  font-family: var(--font-serif); font-style: italic;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  color: var(--color-gold-action); min-height: 1.6em;
  margin-bottom: 34px; max-width: 30ch;
}
.cta-row { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.cta-note {
  font-size: var(--text-sm); color: var(--color-text-secondary);
  max-width: 220px; line-height: 1.45; font-weight: 300;
}
.hero-stream { margin-top: 30px; display: flex; flex-direction: column; gap: 0.2rem; }
.hero-stream p { font-size: var(--text-sm); color: var(--color-text-secondary); max-width: 44ch; font-weight: 300; }
.hero-figure { position: relative; height: 100%; min-height: 420px; display: flex; align-items: center; justify-content: center; }
.focal { width: min(440px, 84%); aspect-ratio: 1; position: relative; }
.focal svg { width: 100%; height: 100%; color: var(--color-gold); overflow: visible; }
.focal .spin-slow     { transform-box: fill-box; transform-origin: center; animation: sacred-spin 160s linear infinite; }
.focal .spin-slow-rev { transform-box: fill-box; transform-origin: center; animation: sacred-spin 220s linear infinite reverse; }
.focal .pulse-ring    { transform-box: fill-box; transform-origin: center; animation: focal-breathe 9s ease-in-out infinite; }
@keyframes focal-breathe { 0%,100% { opacity: 0.5; transform: scale(1); } 50% { opacity: 0.85; transform: scale(1.025); } }
.focal-core {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.05rem; color: var(--color-text-secondary);
  text-align: center; letter-spacing: 0.08em;
  background: radial-gradient(circle, rgba(251, 248, 243, 0.92) 40%, rgba(251, 248, 243, 0) 75%);
  padding: 30px; border-radius: 50%;
}
.scroll-ind {
  position: absolute; bottom: 14px; left: 0;
  display: flex; align-items: center; gap: 12px;
  font-size: 0.66rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--color-text-secondary);
}
.scroll-ind .track { width: 1px; height: 46px; background: var(--hair); position: relative; overflow: hidden; }
.scroll-ind .track::after {
  content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 18px;
  background: var(--color-gold); animation: scroll-slide 2.4s ease-in-out infinite;
}

/* ── Emblema fènix/lotus amb line-draw (peu i hero secundari) ── */
.emblem { color: var(--color-gold); }
.emblem svg { width: 100%; height: 100%; overflow: visible; }
.emblem path, .emblem circle, .emblem line {
  stroke: currentColor; fill: none; stroke-width: 1.1;
  stroke-dasharray: 1200; stroke-dashoffset: 1200;
  animation: emblem-draw 3.4s ease forwards;
}
@keyframes emblem-draw { to { stroke-dashoffset: 0; } }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE (llegat .hero)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 18px; gap: 14px; }
  .hero-figure { order: -1; min-height: 280px; }
  .focal { width: min(320px, 72%); }
  .hero .scroll-ind { position: static; margin-top: 24px; }
  .sacred { top: 30%; left: 70%; opacity: 0.10; }
}

@media (max-width: 768px) {
  .aura { animation: none !important; will-change: auto; filter: blur(40px); }
  .aura--2, .aura--3 { display: none; }
  .aura--1 {
    width: 92vw; height: 92vw; left: 50%; top: -28vw;
    transform: translateX(-50%);
    opacity: 0.34;
    background: radial-gradient(circle,
      var(--color-aura-peach) 0%,
      var(--color-aura-blush) 36%,
      rgba(243, 217, 198, 0) 70%);
  }
  .sacred { display: none; }
  .hero-figure { min-height: 240px; }
  .focal { width: min(280px, 66vw); }
  .focal svg { overflow: hidden; }
}

@media (max-width: 560px) {
  .hero .hero-phrases { font-size: 1.1rem; }
  .hero { padding-bottom: 36px; }
  .focal { width: min(240px, 62vw); }
}

/* ════════════════════════════════════════════════════════════════
   prefers-reduced-motion — atura tot el moviment
   ════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .aura, .sacred .rot, .sacred .rot-rev, .star,
  .focal .spin-slow, .focal .spin-slow-rev, .focal .pulse-ring,
  .scroll-ind .track::after, .hero3d .scroll-ind .track::after { animation: none !important; }
  .emblem path, .emblem circle, .emblem line { stroke-dashoffset: 0 !important; animation: none !important; }
  /* Hero3d: contingut visible immediatament, sense transform. */
  .hero3d-inner .hero3d-eyebrow,
  .hero3d-inner h1,
  .hero3d-sub,
  .hero3d .hero-phrases,
  .hero3d .cta-row { opacity: 1 !important; transform: none !important; animation: none !important; }
}
