/**
 * Pinapp — couche UX premium (GSAP / Lenis / curseur)
 * Identité : teal #00E5B0, violet #5B4FE8, cosmos nuit inchangé en base.
 */

/* ── Variables (nuit = aligné identité existante) ── */
:root,
html[data-theme='dark'],
html:not([data-theme]) {
  /* Cosmos Awwwards (aligné prompt) */
  --pp-bg: #050a14;
  --pp-card: rgba(255, 255, 255, 0.04);
  --pp-text: #e8f4f8;
  --pp-muted: rgba(232, 244, 248, 0.5);
  --pp-teal: #00e5b0;
  --pp-violet: #5b4fe8;
  --pp-border: rgba(0, 229, 176, 0.08);
  --pp-glass: rgba(15, 20, 40, 0.5);
  --pp-shadow: rgba(0, 0, 0, 0.25);
}

/* Mode jour — thème crème (couche additive, ne supprime pas le dark) */
html[data-theme='light'] {
  --pp-bg: #f7f5f0;
  --pp-card: #ffffff;
  --pp-text: #1a1e2c;
  --pp-muted: rgba(26, 30, 44, 0.52);
  --pp-teal: #00b89c;
  --pp-violet: #4a3fd4;
  --pp-border: rgba(0, 184, 156, 0.14);
  --pp-glass: rgba(255, 255, 255, 0.72);
  --pp-shadow: rgba(0, 0, 0, 0.06);
}

/* Lenis : hauteur / overflow compatibles smooth scroll */
html.lenis,
html.lenis body {
  height: auto;
  overflow: visible !important;
}

/* Préchargeur vortex (cosmos) */
#pp-preloader {
  position: fixed;
  inset: 0;
  z-index: 100025;
  background: var(--pp-bg, #050a14);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#pp-preloader.done {
  opacity: 0;
  pointer-events: none;
}

#pp-vortex {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Canvas étoiles lointaines — conservé après le preloader, sous le contenu (nuit) */
#pp-cosmos-stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 1s ease;
}

/* Léger scintillement — évite halos / « cercles » trop visibles sur le contenu */
#pp-cosmos-stars.pp-cosmos-stars--visible {
  opacity: 0.22;
}

html[data-theme='light'] #pp-cosmos-stars {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  #pp-cosmos-stars {
    display: none !important;
  }
}

#pp-preloader-words {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.pp-intro-word {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  white-space: nowrap;
  opacity: 0;
  will-change: opacity, transform;
  font-family: 'Cormorant Garamond', serif;
}

.pp-intro-word--muted {
  font-style: italic;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--pp-text);
}

.pp-intro-word--ia {
  font-style: italic;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--pp-teal);
}

.pp-intro-word--brand {
  font-weight: 600;
  font-style: normal;
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  color: var(--pp-violet);
}

#pp-preloader-logo {
  position: relative;
  z-index: 3;
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}

#pp-preloader-logo img {
  display: block;
  width: min(88px, 22vw);
  height: auto;
}

body.pp-preloader-active {
  overflow: hidden !important;
}

/* Fond canvas particules — ne pas déborder sur le contenu */
#pc {
  overflow: hidden;
  contain: paint;
  clip-path: inset(0);
}

/* Cartes Films IA accueil : fond cosmos + léger zoom sur l’iframe (masque bandes claires du player Vimeo) */
.pp-home-film-ia__frame {
  position: relative;
  background-color: var(--pp-bg, #050a14);
  background-image: radial-gradient(
    ellipse 85% 70% at 50% 45%,
    rgba(91, 79, 232, 0.12) 0%,
    rgba(5, 10, 20, 0.98) 62%,
    var(--pp-bg, #050a14) 100%
  );
  overflow: hidden;
  isolation: isolate;
}

.pp-home-film-ia__frame > iframe.pp-home-film-ia__embed {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 108%;
  height: 108%;
  min-width: 100%;
  min-height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  transform: translate(-50%, -50%) scale(1.04);
  transform-origin: center center;
}

/* Carte colonne : même fond que le site sous le titre */
.pp-home-film-ia__card {
  background: var(--pp-bg, #050a14);
}

html[data-theme='light'] body.pp-aww-body {
  background: var(--pp-bg);
  color: var(--pp-text);
  transition:
    background 0.6s ease,
    color 0.45s ease;
}

html[data-theme='light'] .hero {
  background: linear-gradient(135deg, #f7f5f0 0%, #ede8e0 45%, #f0edf5 100%);
}

html[data-theme='light'] .hero .hero__eyebrow,
html[data-theme='light'] .hero .hero__baseline,
html[data-theme='light'] .hero .hero__lead,
html[data-theme='light'] .hero .hero__micro {
  color: var(--pp-muted);
}

html[data-theme='light'] .hero h1 .word {
  color: var(--pp-text);
}

html[data-theme='light'] .hero h1 .hero__gradient {
  color: var(--pp-teal);
  -webkit-text-fill-color: var(--pp-teal);
}

html[data-theme='light'] .pp-trust-wrap {
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme='light'] .nav {
  background: rgba(247, 245, 240, 0.88) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--pp-border) !important;
}

html[data-theme='light'] .nav__logo-text {
  color: var(--pp-text) !important;
}

html[data-theme='light'] .pp-svc-card,
html[data-theme='light'] .studio-card {
  background: var(--pp-card) !important;
  border: 1px solid var(--pp-border) !important;
  box-shadow: 0 4px 24px var(--pp-shadow);
}

/* Curseur custom — desktop fin */
@media (min-width: 769px) and (pointer: fine) {
  html.pp-custom-cursor {
    cursor: none;
  }

  html.pp-custom-cursor a:focus-visible,
  html.pp-custom-cursor button:focus-visible,
  html.pp-custom-cursor input:focus-visible,
  html.pp-custom-cursor textarea:focus-visible,
  html.pp-custom-cursor select:focus-visible {
    cursor: pointer;
  }
}

@media (max-width: 768px), (pointer: coarse) {
  .pp-cursor-dot,
  .pp-cursor-circle {
    display: none !important;
  }
}

.pp-cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99998;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pp-teal);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition:
    opacity 0.3s,
    width 0.3s,
    height 0.3s,
    background 0.3s;
  mix-blend-mode: difference;
  will-change: transform;
}

.pp-cursor-circle {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99997;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--pp-teal) 30%, transparent);
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    width 0.4s ease,
    height 0.4s ease,
    border-color 0.3s,
    opacity 0.3s;
  will-change: transform, width, height;
}

.pp-cursor-circle.hover {
  width: 60px;
  height: 60px;
  border-color: color-mix(in srgb, var(--pp-teal) 60%, transparent);
}

.pp-cursor-circle__label {
  position: absolute;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pp-text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  white-space: nowrap;
}

/* Split mots */
.pp-split {
  overflow: visible;
}

.pp-split .pp-word {
  display: inline-block;
  will-change: transform, opacity;
}

.pp-split .pp-char {
  display: inline-block;
  will-change: transform, opacity;
}

/* Reveal clip — état initial ; animation pilotée par GSAP (pp-awwwards-effects.js) */
.pp-reveal {
  clip-path: inset(12% 0% 12% 0%);
  opacity: 0.3;
  transition: none;
}

.pp-reveal img,
.pp-reveal video {
  transform: scale(1.12);
  transition: transform 1.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.pp-reveal.revealed {
  clip-path: inset(0% 0% 0% 0%);
  opacity: 1;
}

.pp-reveal.revealed img,
.pp-reveal.revealed video {
  transform: scale(1);
}

/* Parallax parent */
.pp-parallax-wrap {
  overflow: hidden;
}

/* Fade scroll — état initial ; animation pilotée par GSAP */
.pp-fade {
  opacity: 0;
  transform: translateY(40px);
  transition: none;
}

.pp-fade.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Ligne teal */
.pp-line {
  width: 100%;
  max-width: 200px;
  height: 1px;
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--pp-teal), transparent);
  transform: scaleX(0);
  transform-origin: center;
  pointer-events: none;
}

.pp-line--spaced {
  margin: 2rem auto;
}

/* Cartes démo + CTA — hover */
a.pp-reveal {
  transition:
    border-color 0.4s ease,
    transform 0.4s ease;
}

a.pp-reveal:hover {
  border-color: color-mix(in srgb, var(--pp-teal) 20%, transparent) !important;
  transform: translateY(-4px);
}

.btn--primary,
.hero-v6__cta-primary,
.hero-v6__cta-secondary {
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.btn--primary:hover,
.hero-v6__cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px color-mix(in srgb, var(--pp-teal) 15%, transparent);
}

/* Magnétique : éviter conflit avec transform CSS existants sur .btn */
.pp-magnetic {
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  .pp-char,
  .pp-word {
    opacity: 1 !important;
    transform: none !important;
  }

  .pp-reveal {
    clip-path: none !important;
  }

  .pp-reveal img,
  .pp-reveal video {
    transform: none !important;
  }

  .pp-fade {
    opacity: 1 !important;
    transform: none !important;
  }

  .pp-line {
    transform: scaleX(1) !important;
  }

  .pp-cursor-dot,
  .pp-cursor-circle {
    display: none !important;
  }

  html.pp-custom-cursor {
    cursor: auto !important;
  }
}
