/* ============================================
   COPSOS — Hero Experience V1
   Energy beneath the surface.
   ============================================ */

.hero {
  --hero-energy: 0.55;
  --hero-fracture-opacity: 0.72;
  --hero-bloom: 0.55;
  --hero-exit: 0;

  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  display: block;
  overflow: hidden;
  color: var(--color-white);
  background: var(--color-obsidian);
}

.hero[data-hero-energy="dormant"] {
  --hero-energy: 0.28;
  --hero-fracture-opacity: 0.4;
  --hero-bloom: 0.28;
}

.hero[data-hero-energy="active"] {
  --hero-energy: 0.7;
  --hero-fracture-opacity: 0.85;
  --hero-bloom: 0.62;
}

.hero[data-hero-energy="impact"] {
  --hero-energy: 1;
  --hero-fracture-opacity: 1;
  --hero-bloom: 0.95;
}

/* —— Layers —— */

.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* L01 Matter — croûte + lave animée (CSS only) */
.hero__layer--matter {
  overflow: hidden;
  background: #0a0506;
}

.hero__crust {
  position: absolute;
  inset: -8%;
  background:
    url("/assets/img/fracture/earth-lava.jpg") center / cover no-repeat;
  transform-origin: 55% 45%;
  animation: hero-crust-drift 28s ease-in-out infinite alternate;
  will-change: transform;
}

.hero__lava {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  will-change: transform, opacity;
}

.hero__lava--a {
  background:
    radial-gradient(
      ellipse 50% 42% at 40% 55%,
      rgba(255, 70, 35, 0.55) 0%,
      rgba(255, 43, 43, 0.25) 32%,
      transparent 68%
    ),
    radial-gradient(
      ellipse 35% 45% at 70% 35%,
      rgba(255, 110, 50, 0.35) 0%,
      transparent 65%
    );
  mix-blend-mode: screen;
  animation: hero-lava-a 14s ease-in-out infinite;
}

.hero__lava--b {
  background:
    radial-gradient(
      ellipse 28% 32% at 58% 48%,
      rgba(255, 160, 80, 0.4) 0%,
      rgba(255, 43, 43, 0.2) 38%,
      transparent 72%
    );
  mix-blend-mode: color-dodge;
  animation: hero-lava-b 9s ease-in-out infinite;
}

.hero__lava--c {
  background:
    radial-gradient(
      ellipse 16% 65% at 56% 42%,
      rgba(255, 55, 40, 0.45) 0%,
      transparent 58%
    ),
    radial-gradient(
      ellipse 55% 22% at 32% 72%,
      rgba(179, 18, 23, 0.35) 0%,
      transparent 62%
    );
  mix-blend-mode: screen;
  animation: hero-lava-c 18s ease-in-out infinite;
}

/* L02 Texture */
.hero__layer--texture {
  opacity: 0.28;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.05 0 0 0 0 0.055 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

/* L03 Energy + fracture */
.hero__layer--energy {
  z-index: 1;
}

.hero__energy-bloom {
  position: absolute;
  top: 8%;
  bottom: 18%;
  left: clamp(42%, 48vw, 56%);
  width: min(28vw, 16rem);
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(179, 18, 23, calc(0.08 * var(--hero-energy))) 22%,
    rgba(255, 43, 43, calc(0.2 * var(--hero-energy))) 48%,
    rgba(179, 18, 23, calc(0.1 * var(--hero-energy))) 74%,
    transparent 100%
  );
  filter: blur(34px);
  opacity: var(--hero-bloom);
  will-change: opacity, transform;
}

.hero__fracture {
  position: absolute;
  top: 4%;
  bottom: 12%;
  left: clamp(44%, 50vw, 58%);
  width: min(12vw, 7.5rem);
  height: auto;
  transform: translateX(-55%) rotate(-6deg);
  opacity: var(--hero-fracture-opacity);
  overflow: visible;
}

.hero__fracture-core,
.hero__fracture-branch,
.hero__fracture-hairline {
  vector-effect: non-scaling-stroke;
}

/* L04 Atmosphere */
.hero__layer--atmosphere {
  z-index: 2;
  background:
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(255, 255, 255, 0.035), transparent 55%),
    radial-gradient(ellipse 40% 30% at 70% 20%, rgba(59, 130, 246, 0.025), transparent 60%);
  opacity: 0.9;
}

/* L05 Media slot — above matter/texture/energy/atmosphere, below veil */
.hero__layer--media {
  z-index: 3;
}

.hero__placeholder,
.hero__picture,
.hero__video-wrap,
.hero__webgl {
  position: absolute;
  inset: 0;
}

.hero__placeholder {
  background:
    radial-gradient(ellipse 80% 60% at 55% 40%, rgba(18, 18, 20, 0.35), transparent 65%);
}

.hero__picture img,
.hero__poster img,
.hero__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hero-object-position, center center);
}

.hero__picture img {
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
}

.hero__picture img.is-loaded {
  opacity: 1;
}

.hero__poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
}

.hero__poster img {
  opacity: 1;
}

.hero__video {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  transition: opacity 700ms var(--ease-out);
  background: transparent;
}

.hero__video-wrap.is-playing .hero__video {
  opacity: 1;
}

.hero__video-wrap.is-playing .hero__poster {
  opacity: 0;
  transition: opacity 700ms var(--ease-out);
}

/* Media present: keep matter/fracture, tone texture so faces stay clean */
.hero[data-hero-mode="image"] .hero__layer--texture,
.hero[data-hero-mode="video"] .hero__layer--texture {
  opacity: 0.12;
  mix-blend-mode: soft-light;
}

/* Subtle COPSOS energy behind media — visible only at edges if media doesn't fill */
.hero[data-hero-mode="image"] .hero__layer--energy,
.hero[data-hero-mode="video"] .hero__layer--energy {
  opacity: 0.45;
}

.hero[data-hero-mode="image"] .hero__layer--atmosphere,
.hero[data-hero-mode="video"] .hero__layer--atmosphere {
  opacity: 0.35;
}

.hero[data-hero-mode="image"] .hero__placeholder,
.hero[data-hero-mode="video"] .hero__placeholder,
.hero[data-hero-mode="webgl"] .hero__placeholder {
  display: none;
}

/* L03b — Subtle grain treatment ON TOP of CMS media, below veil */
.hero[data-hero-mode="image"] .hero__layer--media::after,
.hero[data-hero-mode="video"] .hero__layer--media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.1;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.05 0 0 0 0 0.055 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

/* Media integrated into matter — readable left, visible right */
.hero[data-hero-mode="image"] .hero__layer--veil,
.hero[data-hero-mode="video"] .hero__layer--veil {
  background:
    linear-gradient(
      105deg,
      rgba(5, 5, 5, 0.78) 0%,
      rgba(5, 5, 5, 0.32) 38%,
      rgba(5, 5, 5, 0.08) 62%,
      rgba(5, 5, 5, 0.35) 100%
    ),
    linear-gradient(
      to top,
      rgba(5, 5, 5, 0.88) 0%,
      rgba(5, 5, 5, 0.28) 36%,
      rgba(5, 5, 5, 0.05) 62%,
      rgba(5, 5, 5, 0.22) 100%
    );
}

@media (max-width: 767px) {
  .hero__picture img,
  .hero__poster img,
  .hero__video {
    object-position: var(--hero-object-position-mobile, center 28%);
  }

  .hero[data-hero-mode="image"] .hero__layer--veil,
  .hero[data-hero-mode="video"] .hero__layer--veil {
    background:
      linear-gradient(
        to top,
        rgba(5, 5, 5, 0.96) 0%,
        rgba(5, 5, 5, 0.62) 36%,
        rgba(5, 5, 5, 0.32) 60%,
        rgba(5, 5, 5, 0.48) 100%
      );
  }
}

/* L06 Veil — readability */
.hero__layer--veil {
  z-index: 4;
  background:
    linear-gradient(
      105deg,
      rgba(5, 5, 5, 0.72) 0%,
      rgba(5, 5, 5, 0.28) 42%,
      rgba(5, 5, 5, 0.18) 62%,
      rgba(5, 5, 5, 0.55) 100%
    ),
    linear-gradient(
      to top,
      rgba(5, 5, 5, 0.94) 0%,
      rgba(5, 5, 5, 0.45) 34%,
      rgba(5, 5, 5, 0.2) 58%,
      rgba(5, 5, 5, 0.4) 100%
    );
}

.hero[data-hero-overlay="soft"] .hero__layer--veil {
  opacity: 0.72;
}

.hero[data-hero-overlay="strong"] .hero__layer--veil {
  opacity: 1;
  filter: brightness(0.88);
}

/* —— Stage: centered logo + bottom-left editorial —— */

.hero__stage {
  position: relative;
  z-index: 5;
  box-sizing: border-box;
  min-height: 100svh;
  width: min(100% - 2rem, var(--container-wide));
  margin: 0 auto;
  padding:
    calc(var(--header-height) + clamp(0.65rem, 2vh, 1.5rem))
    0
    clamp(3.5rem, 7vh, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: clamp(1rem, 2.5vh, 2rem);
}

.hero__logo-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(10rem, 38vh, 26rem);
  padding: clamp(0.35rem, 1.5vh, 1rem) 0;
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  align-self: flex-start;
  width: 100%;
  max-width: min(100%, 36rem);
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(1.15rem, 2.2vh, 1.65rem);
  justify-items: start;
}

.hero__copy {
  max-width: min(100%, 34rem);
  padding-right: 0.5rem;
}

.hero__brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 0.82;
  text-indent: 0.06em;
  text-shadow: 0 0 80px rgba(255, 43, 43, 0.06);
  max-width: 100%;
}

/* Official typographic logo — centered hero mark */
.hero-brand-logo {
  display: block;
  width: clamp(520px, 50vw, 880px);
  max-width: min(880px, 96vw);
  height: auto;
  object-fit: contain;
  margin: 0 auto;
  opacity: 1;
  visibility: visible;
  background: transparent;
  border: 0;
  pointer-events: none;
  user-select: none;
}

.hero__role {
  margin: 0;
  color: var(--color-titanium);
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 1.1vw, 0.82rem);
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-indent: 0.32em;
}

.hero__tagline {
  margin: clamp(0.85rem, 1.8vh, 1.15rem) 0 0;
  max-width: 16ch;
  font-size: clamp(1.05rem, 1.8vw, 1.28rem);
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: 0.01em;
}

.hero__tagline-en {
  margin-top: 0.45rem;
  max-width: 26ch;
  color: var(--color-smoke);
  font-size: clamp(0.72rem, 1.05vw, 0.8rem);
  letter-spacing: 0.04em;
  opacity: 0.75;
  line-height: 1.45;
}

.hero__actions {
  margin: 0;
}

.hero__actions.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 0.85rem;
}

.hero__cta {
  min-height: 3.15rem;
  padding-inline: 1.35rem;
}

/* —— Scroll indicator —— */

.hero__scroll {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: clamp(1.25rem, 3vh, 2rem);
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 3rem;
  color: var(--color-smoke);
}

.hero__scroll-line {
  display: block;
  width: 1px;
  height: 1.75rem;
  background: linear-gradient(
    180deg,
    rgba(247, 247, 247, 0.05),
    rgba(247, 247, 247, 0.55),
    rgba(255, 43, 43, 0.45)
  );
  transform-origin: top center;
}

/* —— Entry — contenu visible (is-ready au boot) —— */

.hero.is-ready .hero-brand-logo,
.hero.is-ready .hero__role,
.hero.is-ready .hero__tagline,
.hero.is-ready .hero__actions {
  opacity: 1;
  transform: none;
}

.hero.is-ready .hero__tagline-en {
  opacity: 0.75;
  transform: none;
}

.hero.is-ready .hero__scroll {
  opacity: calc(1 - var(--hero-exit, 0));
  transform: translateX(-50%);
}

/* Exit réversible — derniers % du hero dans le viewport */
.hero .hero__logo-stage,
.hero .hero__content {
  opacity: calc(1 - var(--hero-exit, 0) * 0.92);
  will-change: opacity;
}

.hero .hero__media,
.hero .hero__layer--matter {
  transform: scale(calc(1 + var(--hero-exit, 0) * 0.028));
  transform-origin: center center;
  will-change: transform;
}

.hero .hero__fracture {
  opacity: calc(var(--hero-fracture-opacity) * (1 + var(--hero-exit, 0) * 0.45));
}

.hero .hero__energy-bloom {
  opacity: calc(var(--hero-bloom) * (1 + var(--hero-exit, 0) * 0.35));
}

@media (prefers-reduced-motion: reduce) {
  .hero {
    --hero-exit: 0 !important;
  }

  .hero .hero__logo-stage,
  .hero .hero__content,
  .hero .hero__media,
  .hero .hero__layer--matter {
    transform: none !important;
    will-change: auto;
  }

  .hero .hero__logo-stage,
  .hero .hero__content,
  .hero.is-ready .hero__scroll {
    opacity: 1 !important;
  }
}

/* Idle — fissure / bloom très léger */
.hero.is-alive .hero__energy-bloom {
  animation: hero-bloom 11s var(--ease-breathe) infinite;
}

.hero.is-alive .hero__fracture {
  animation: hero-fracture 11s var(--ease-breathe) infinite;
}

@keyframes hero-bloom {
  0%,
  100% {
    opacity: calc(var(--hero-bloom) * 0.9);
  }
  50% {
    opacity: calc(var(--hero-bloom) * 1.06);
  }
}

@keyframes hero-fracture {
  0%,
  100% {
    opacity: calc(var(--hero-fracture-opacity) * 0.92);
  }
  50% {
    opacity: var(--hero-fracture-opacity);
  }
}

@keyframes hero-crust-drift {
  0% {
    transform: scale(1.05) translate3d(-1.5%, 0.5%, 0);
  }
  100% {
    transform: scale(1.12) translate3d(2%, -1.5%, 0);
  }
}

@keyframes hero-lava-a {
  0% {
    transform: translate3d(-4%, 2%, 0) scale(1);
    opacity: 0.55;
  }
  50% {
    transform: translate3d(5%, -4%, 0) scale(1.12);
    opacity: 0.95;
  }
  100% {
    transform: translate3d(2%, 4%, 0) scale(1.04);
    opacity: 0.65;
  }
}

@keyframes hero-lava-b {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.4;
  }
  50% {
    transform: translate3d(-6%, 3%, 0) scale(1.18);
    opacity: 0.85;
  }
}

@keyframes hero-lava-c {
  0% {
    transform: translate3d(2%, -3%, 0) scale(1.02);
    opacity: 0.45;
  }
  50% {
    transform: translate3d(-4%, 2%, 0) scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: translate3d(3%, 2%, 0) scale(1.05);
    opacity: 0.5;
  }
}

/* —— Desktop editorial shift —— */

@media (min-width: 960px) {
  .hero__stage {
    padding-left: clamp(0rem, 2vw, 1rem);
  }

  .hero__copy {
    transform: translateX(clamp(0rem, 1.5vw, 1.25rem));
    max-width: min(100%, 48rem);
  }

  .hero__fracture {
    left: 58%;
    transform: translateX(-50%) rotate(-7deg);
  }

  .hero__energy-bloom {
    left: 58%;
  }

  .hero:not([data-hero-mode="image"]):not([data-hero-mode="video"]) .hero__layer--veil {
    background:
      linear-gradient(
        100deg,
        rgba(5, 5, 5, 0.82) 0%,
        rgba(5, 5, 5, 0.35) 38%,
        rgba(5, 5, 5, 0.12) 58%,
        rgba(5, 5, 5, 0.4) 100%
      ),
      linear-gradient(
        to top,
        rgba(5, 5, 5, 0.9) 0%,
        rgba(5, 5, 5, 0.35) 36%,
        transparent 62%
      );
  }

  .hero[data-hero-mode="image"] .hero__layer--veil,
  .hero[data-hero-mode="video"] .hero__layer--veil {
    background:
      linear-gradient(
        100deg,
        rgba(5, 5, 5, 0.86) 0%,
        rgba(5, 5, 5, 0.4) 38%,
        rgba(5, 5, 5, 0.18) 56%,
        rgba(5, 5, 5, 0.5) 100%
      ),
      linear-gradient(
        to top,
        rgba(5, 5, 5, 0.92) 0%,
        rgba(5, 5, 5, 0.42) 34%,
        rgba(5, 5, 5, 0.12) 60%,
        rgba(5, 5, 5, 0.35) 100%
      );
  }
}

/* —— Short laptop heights —— */

@media (max-height: 760px) and (min-width: 768px) {
  .hero-brand-logo {
    width: clamp(340px, 42vw, 640px);
    max-width: min(640px, 94vw);
  }

  .hero__logo-stage {
    min-height: clamp(5.5rem, 22vh, 12rem);
    padding: 0;
  }

  .hero__stage {
    gap: 0.65rem;
    padding-bottom: 3rem;
  }

  .hero__tagline {
    margin-top: 0.75rem;
  }
}

@media (max-height: 620px) and (min-width: 768px) {
  .hero-brand-logo {
    width: clamp(280px, 38vw, 500px);
  }

  .hero__logo-stage {
    min-height: clamp(4rem, 18vh, 9rem);
  }
}

/* —— Mobile dedicated composition —— */

@media (max-width: 767px) {
  .hero__stage {
    min-height: 100svh;
    padding-top: calc(var(--header-height) + 0.75rem);
    padding-bottom: clamp(3.25rem, 8vh, 4.25rem);
    gap: clamp(0.85rem, 2.5vh, 1.25rem);
    justify-content: flex-start;
  }

  .hero__logo-stage {
    flex: 0 0 auto;
    min-height: 0;
    padding: 0.15rem 0;
  }

  .hero-brand-logo {
    width: min(92vw, 580px);
    max-width: 100%;
  }

  .hero__content {
    flex: 0 0 auto;
    min-height: 0;
    gap: 1.15rem;
  }

  .hero__role {
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    font-size: 0.78rem;
  }

  .hero__tagline {
    max-width: 14ch;
    font-size: 1.15rem;
  }

  .hero__tagline-en {
    font-size: 0.72rem;
    max-width: 26ch;
  }

  .hero__actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .hero__cta {
    width: 100%;
    min-height: 3.15rem;
  }

  .hero__fracture {
    top: 6%;
    bottom: 28%;
    left: 50%;
    width: 22vw;
    max-width: 5.5rem;
    transform: translateX(-50%) rotate(-3deg);
  }

  .hero__energy-bloom {
    top: 10%;
    bottom: 30%;
    left: 50%;
    width: 42vw;
  }

  .hero__layer--atmosphere {
    opacity: 0.55;
  }

  .hero__layer--veil {
    background:
      linear-gradient(
        to top,
        rgba(5, 5, 5, 0.96) 0%,
        rgba(5, 5, 5, 0.55) 38%,
        rgba(5, 5, 5, 0.28) 62%,
        rgba(5, 5, 5, 0.45) 100%
      );
  }

  .hero__scroll {
    bottom: 1rem;
  }
}

@media (max-width: 379px) {
  .hero__tagline {
    font-size: 1.05rem;
  }

  .hero__actions {
    grid-template-columns: 1fr;
  }
}

/* —— Reduced motion —— */

@media (prefers-reduced-motion: reduce) {
  .hero[data-hero-motion] .hero-brand-logo,
  .hero[data-hero-motion] .hero__role,
  .hero[data-hero-motion] .hero__tagline,
  .hero[data-hero-motion] .hero__tagline-en,
  .hero[data-hero-motion] .hero__actions,
  .hero[data-hero-motion] .hero__scroll,
  .hero[data-hero-motion] .hero__energy-bloom,
  .hero[data-hero-motion] .hero__fracture {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .hero[data-hero-motion] .hero__scroll {
    transform: translateX(-50%) !important;
  }

  .hero.is-alive .hero__energy-bloom,
  .hero.is-alive .hero__fracture {
    animation: none !important;
  }

  .hero__crust,
  .hero__lava--a,
  .hero__lava--b,
  .hero__lava--c {
    animation: none !important;
    will-change: auto;
    transform: none !important;
  }

  .hero__lava--a,
  .hero__lava--b,
  .hero__lava--c {
    opacity: 0.35;
  }
}
