/* ─────────────────────────────────────────────
   STYLE V9 — MOBILE LUXE + HARMONISATION
   Charge APRES style-v8.css. Strictement additif.
   Objectif :
     - Navigation mobile/tablette parfaite
     - Harmonisation des couleurs sur petit écran (palette unifiée luxe)
     - Sections cinéma adaptées
     - Cookies & IA & audio totalement utilisables sur téléphone
───────────────────────────────────────────── */


/* ───────── HARMONISATION CHROMATIQUE MOBILE ─────────
   Sur mobile, on resserre la palette : ivoire profond, encre,
   touche de bronze unique. Aucune dispersion. */

@media (max-width: 768px) {
  :root {
    /* Légère désaturation globale pour un ton plus pierre / monastique */
    --v9-mobile-warmth: 1;
  }

  body {
    /* Réchauffement subtil + densification - effet "page de livre rare" */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  /* Tous les fonds clairs du site convergent vers la même nuance ivoire */
  .sec--blanc,
  .sec--creme {
    background: #f5f1e8 !important;
  }

  /* Tous les fonds sombres convergent vers la même nuance encre profonde */
  .sec--noir {
    background: #1a1814 !important;
  }

  /* Bordures unifiées : or désaturé léger, jamais brutal */
  .sec--noir .ck,
  .ck {
    border-color: rgba(184, 159, 110, .28) !important;
  }
}


/* ───────── HEADER & NAVIGATION MOBILE ─────────
   Sur mobile, le header existant fonctionne mais on l'affine. */

@media (max-width: 768px) {
  /* Fond légèrement teinté pour un meilleur contraste lecture */
  header.hd,
  .hd {
    background: rgba(245, 241, 232, .92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: .5px solid rgba(184, 159, 110, .12);
    padding: 12px 0 !important;
  }

  /* Le logo doit rester respiré */
  .hd .logo,
  .hd .lg {
    transform: scale(.92);
    transform-origin: left center;
  }

  /* CTA ENTRER EN RELATION : caché sur mobile (encombrant), accessible via menu */
  .hd .btn-primary {
    display: none;
  }

  /* Burger plus généreux + zone de tap accrue */
  .ntog {
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin-right: -6px;
  }
  .ntog span {
    width: 22px;
    height: 1px;
  }

  /* Menu plein écran : ambiance plus luxueuse */
  body.nopen .nav {
    background: rgba(245, 241, 232, .985) !important;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    gap: 26px !important;
    padding: 90px 32px 80px !important;
    justify-content: flex-start !important;
    align-items: center !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    -webkit-overflow-scrolling: touch !important;
    height: 100vh !important;
    height: calc(var(--vh, 1vh) * 100) !important;
  }

  /* Bouton de fermeture du menu (croix fixe en haut-droite) */
  body.nopen::before {
    content: '×';
    position: fixed;
    top: 18px;
    right: 22px;
    width: 44px;
    height: 44px;
    line-height: 40px;
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    font-weight: 200;
    color: rgba(40, 36, 30, .68);
    z-index: 200;
    cursor: pointer;
    pointer-events: none;     /* le clic est géré sur .ntog (déjà natif) */
  }

  body.nopen .nl {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px !important;
    letter-spacing: 1.5px !important;
    text-transform: none !important;
    font-weight: 300;
    color: rgba(40, 36, 30, .88);
    transition: color .4s ease;
  }
  body.nopen .nl.active {
    color: rgba(140, 110, 72, .95) !important;
    font-style: italic;
  }
  body.nopen .nl::after {
    content: '';
    display: block;
    width: 20px;
    height: .5px;
    margin: 8px auto 0;
    background: rgba(140, 110, 72, .42);
    opacity: 0;
    transition: opacity .4s ease, width .4s ease;
  }
  body.nopen .nl.active::after {
    opacity: 1;
    width: 36px;
  }

  /* Sélecteur de langue dans le menu mobile */
  body.nopen .lng {
    margin-top: 24px;
    padding-top: 24px;
    border-top: .5px solid rgba(140, 110, 72, .18);
    display: flex;
    gap: 18px;
    justify-content: center;
  }
}


/* ───────── HERO (.ph) ADAPTATIF ─────────
   On ajuste la respiration verticale et la taille typographique. */

@media (max-width: 768px) {
  .ph {
    min-height: 80vh !important;
    padding: 90px 0 60px !important;
    display: flex;
    align-items: center;
  }
  .ph-h1 {
    font-size: clamp(38px, 9vw, 62px) !important;
    line-height: 1.05 !important;
    letter-spacing: -.5px !important;
  }
  .ph-sub {
    font-size: 15px !important;
    line-height: 1.55 !important;
    max-width: 92% !important;
    margin-top: 22px !important;
    opacity: .82 !important;
  }
  .kicker,
  .ph .kicker {
    font-size: 9px !important;
    letter-spacing: 4px !important;
    margin-bottom: 18px !important;
  }
}


/* ───────── SECTIONS CINEMA — MOBILE ─────────
   Sur mobile : 88vh, citation centrée en bas, taille adaptée. */

@media (max-width: 768px) {
  .cine {
    height: 88vh;
    min-height: 540px;
  }
  .cine-frame {
    inset: 14px;
  }
  .cine-meta--tl {
    top: 28px;
    left: 28px;
  }
  .cine-num {
    font-size: 16px;
    letter-spacing: 3.5px;
  }
  .cine-cap {
    font-size: 8px;
    letter-spacing: 4px;
  }
  .cine-quote {
    bottom: 36px;
    left: 28px;
    right: 28px;
    max-width: none;
    text-align: left;
  }
  .cine-quote blockquote {
    font-size: 24px !important;
    line-height: 1.28 !important;
  }
  .cine-quote figcaption {
    font-size: 11.5px !important;
    margin-top: 8px;
  }
  .cine-veil--bottom {
    background:
      linear-gradient(180deg,
        rgba(20,18,14,0)    0%,
        rgba(20,18,14,0)    25%,
        rgba(20,18,14,.45) 60%,
        rgba(20,18,14,.78) 100%) !important;
  }
}


/* ───────── SECTIONS DE CONTENU — MOBILE ─────────
   Padding, tailles typographiques, respiration. */

@media (max-width: 768px) {
  .sec {
    padding: 72px 0 !important;
  }
  .container {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
  .container.split {
    grid-template-columns: 1fr !important;
    gap: 48px !important;
  }
  .display,
  h2.display {
    font-size: clamp(32px, 7.2vw, 48px) !important;
    line-height: 1.08 !important;
    letter-spacing: -.4px !important;
  }
  .lead {
    font-size: 16.5px !important;
    line-height: 1.6 !important;
  }
  .body,
  p.body {
    font-size: 15px !important;
    line-height: 1.68 !important;
  }
  .eyebrow {
    font-size: 8.5px !important;
    letter-spacing: 4px !important;
    margin-bottom: 16px !important;
  }
  .pillars li {
    font-size: 14.5px !important;
    line-height: 1.6 !important;
    padding: 10px 0 !important;
  }
}


/* ───────── BOUTONS / CTA — MOBILE ─────────
   Surface tactile généreuse + lisibilité. */

@media (max-width: 768px) {
  .btn,
  .btn-primary,
  .btn-l,
  .btn-line,
  .btn-ghost,
  a.btn,
  button.btn {
    min-height: 50px !important;
    padding: 16px 28px !important;
    font-size: 10px !important;
    letter-spacing: 4px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  /* Pleine largeur pour les CTA principaux des formulaires */
  form .btn,
  form .btn-primary,
  .ai-pn .btn {
    width: 100% !important;
  }
}


/* ───────── FORMULAIRES — MOBILE ─────────
   iOS impose 16px minimum pour éviter le zoom auto. */

@media (max-width: 768px) {
  input,
  textarea,
  select {
    font-size: 16px !important;
    min-height: 50px !important;
    padding: 14px 16px !important;
  }
  textarea {
    min-height: 140px !important;
  }
  label {
    font-size: 9px !important;
    letter-spacing: 3.5px !important;
    margin-bottom: 8px !important;
  }
}


/* ───────── COOKIES — MOBILE FORCÉ VISIBLE ─────────
   Garantit qu'aucun overlay ne masque le bandeau. */

@media (max-width: 768px) {
  .ck {
    z-index: 99990 !important;       /* au-dessus de tout sauf sceau */
    left: 16px !important;
    right: 16px !important;
    bottom: max(16px, env(safe-area-inset-bottom, 16px)) !important;
    max-width: none !important;
    width: auto !important;
    padding: 18px 20px !important;
    background: rgba(20, 18, 16, .96) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .ck p {
    font-size: 13px !important;
    line-height: 1.55 !important;
    margin-bottom: 14px !important;
  }
  .ck-row {
    justify-content: space-between !important;
    gap: 10px !important;
  }
  .ck-btn {
    flex: 1;
    min-height: 42px !important;
    padding: 10px 14px !important;
    font-size: 9px !important;
    letter-spacing: 3.5px !important;
  }
}


/* ───────── WHISPER & SUGGESTIONS IA — MOBILE ─────────
   Position basse + animation subtile. */

@media (max-width: 768px) {
  .ba-whisper {
    left: 16px !important;
    right: 16px !important;
    bottom: max(80px, env(safe-area-inset-bottom, 0) + 80px) !important;
    max-width: none !important;
    width: auto !important;
    padding: 14px 18px !important;
    font-size: 13.5px !important;
    line-height: 1.5 !important;
    z-index: 99980 !important;
    background: rgba(20, 18, 16, .94) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: .5px solid rgba(184, 159, 110, .28) !important;
  }
  .sg-bubble {
    left: 16px !important;
    right: 16px !important;
    bottom: max(80px, env(safe-area-inset-bottom, 0) + 80px) !important;
    width: auto !important;
    max-width: none !important;
    z-index: 99980 !important;
  }
}


/* ───────── BOUTON AMBIANCE / CURSEUR — MOBILE ─────────
   On masque le curseur custom (pas de pointer fine), mais on
   conserve le bouton d'ambiance accessible. */

@media (max-width: 768px) {
  #cur,
  .cursor,
  .v7-vignette {
    display: none !important;
  }
  body { cursor: auto !important; }

  .amb-trigger {
    bottom: max(16px, env(safe-area-inset-bottom, 0) + 16px) !important;
    left: 16px !important;
    width: 46px !important;
    height: 46px !important;
    z-index: 99970 !important;
  }

  /* Chapitre romain : on ne le cache plus, mais on le décale */
  .chapitre {
    display: flex !important;
    right: 16px !important;
    bottom: max(16px, env(safe-area-inset-bottom, 0) + 16px) !important;
    z-index: 99970;
  }
  .chapitre-num {
    font-size: 12px !important;
    letter-spacing: 3px !important;
  }
  .chapitre-cap {
    font-size: 8px !important;
    letter-spacing: 2.5px !important;
  }
}


/* ───────── PORTFOLIO & PROJETS — MOBILE ─────────
   Grille en colonne unique avec respiration éditoriale. */

@media (max-width: 768px) {
  .proj-c,
  [class*="proj-grid"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .proj-card,
  .proj-i {
    margin-bottom: 0 !important;
  }
  .proj-card h3,
  .proj-i h3 {
    font-size: 22px !important;
    line-height: 1.2 !important;
  }
}


/* ───────── FOOTER — MOBILE ─────────
   Densification verticale + lisibilité. */

@media (max-width: 768px) {
  .ft {
    padding: 60px 0 40px !important;
  }
  .ft .container {
    grid-template-columns: 1fr !important;
    gap: 36px !important;
  }
  .ft a, .ft p, .ft span {
    font-size: 13px !important;
  }
  .empreinte {
    font-size: 11px !important;
    margin-top: 28px !important;
  }
}


/* ───────── SAFE AREA INSETS (iOS notch) ─────────
   Respect des zones de sécurité iPhone X+. */

@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }
}


/* ───────── TABLETTE (769px - 1024px) ─────────
   Entre mobile et desktop : compromis. */

@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding-left: 36px !important;
    padding-right: 36px !important;
  }
  .ph-h1 {
    font-size: clamp(48px, 7vw, 78px) !important;
  }
  .container.split {
    gap: 56px !important;
  }
  .cine-quote {
    bottom: 50px;
    right: 50px;
  }
  .cine-quote blockquote {
    font-size: 30px !important;
  }
  /* Burger visible sur tablette portrait */
  .ntog { display: flex !important; }
  .nav { display: none !important; }
  body.nopen .nav { display: flex !important; }
}


/* ───────── ICONE AMBIANCE AUDIO — MOBILE ÉTAT ON/OFF ─────────
   On affine l'état visuel pour l'audio mobile. */

.amb-trigger.is-playing {
  background: rgba(140, 110, 72, .18) !important;
  border-color: rgba(184, 159, 110, .55) !important;
}
.amb-trigger.is-playing svg {
  color: rgba(184, 159, 110, .92) !important;
}


/* ───────── AI PROACTIVE PANEL ─────────
   Panneau plus présent, plus chaleureux qu'un simple whisper. */

.ai-proactive {
  position: fixed;
  z-index: 99985;
  right: 22px;
  bottom: 22px;
  max-width: 340px;
  width: calc(100vw - 44px);
  background: rgba(245, 241, 232, .98);
  border: .5px solid rgba(184, 159, 110, .38);
  border-radius: 2px;
  padding: 18px 20px 16px;
  box-shadow: 0 12px 36px rgba(20, 18, 14, .12),
              0 2px 8px rgba(20, 18, 14, .06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .9s cubic-bezier(.22,.61,.36,1),
              transform .9s cubic-bezier(.22,.61,.36,1);
  pointer-events: none;
}
.ai-proactive.is-on {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ai-proactive-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.ai-proactive-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(184, 159, 110, .85);
  box-shadow: 0 0 0 0 rgba(184, 159, 110, .5);
  animation: aiPulse 2.4s ease-in-out infinite;
}
@keyframes aiPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 159, 110, .35); }
  50%      { box-shadow: 0 0 0 8px rgba(184, 159, 110, 0); }
}
.ai-proactive-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 12px;
  letter-spacing: .5px;
  color: rgba(40, 36, 30, .62);
  flex: 1;
}
.ai-proactive-close {
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  font-size: 18px;
  font-weight: 200;
  color: rgba(40, 36, 30, .42);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .3s ease;
}
.ai-proactive-close:hover { color: rgba(40, 36, 30, .82); }

.ai-proactive-body {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(28, 26, 22, .92);
  margin: 0 0 14px;
}
.ai-proactive-body em {
  font-style: italic;
  color: rgba(140, 110, 72, .92);
}

.ai-proactive-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-proactive-action {
  background: none;
  border: .5px solid rgba(184, 159, 110, .42);
  color: rgba(40, 36, 30, .82);
  font-family: 'Tenor Sans', sans-serif;
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background .4s ease, border-color .4s ease, color .4s ease;
}
.ai-proactive-action:hover {
  background: rgba(184, 159, 110, .12);
  border-color: rgba(184, 159, 110, .72);
  color: rgba(40, 36, 30, .96);
}
.ai-proactive-action.primary {
  background: rgba(140, 110, 72, .15);
  border-color: rgba(184, 159, 110, .65);
}
.ai-proactive-action.primary:hover {
  background: rgba(140, 110, 72, .28);
}

@media (max-width: 768px) {
  .ai-proactive {
    left: 16px !important;
    right: 16px !important;
    bottom: max(16px, env(safe-area-inset-bottom, 0) + 16px) !important;
    max-width: none !important;
    width: auto !important;
    padding: 18px 18px 16px !important;
  }
  /* Si le bandeau cookies est ouvert, l'IA proactive monte au-dessus */
  body:has(.ck.open) .ai-proactive {
    bottom: max(180px, env(safe-area-inset-bottom, 0) + 180px) !important;
  }
  .ai-proactive-body {
    font-size: 16.5px !important;
  }
  .ai-proactive-action {
    font-size: 9px !important;
    padding: 11px 14px !important;
    flex: 1;
    text-align: center;
  }
}


/* ───────── BANDEAU IA "Activez le son" — MOBILE ─────────
   iOS bloque l'autoplay audio. On propose un opt-in élégant. */

.audio-invite {
  position: fixed;
  z-index: 99975;
  bottom: max(80px, env(safe-area-inset-bottom, 0) + 80px);
  left: 16px;
  right: 16px;
  padding: 14px 18px;
  background: rgba(20, 18, 16, .94);
  border: .5px solid rgba(184, 159, 110, .32);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .8s cubic-bezier(.22,.61,.36,1),
              transform .8s cubic-bezier(.22,.61,.36,1);
  pointer-events: none;
}
.audio-invite.is-on {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.audio-invite-text {
  flex: 1;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.45;
  color: rgba(245, 241, 232, .88);
}
.audio-invite-btn {
  background: none;
  border: .5px solid rgba(184, 159, 110, .55);
  color: rgba(245, 241, 232, .92);
  font-family: 'Tenor Sans', sans-serif;
  font-size: 8.5px;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  padding: 10px 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .4s ease, color .4s ease;
}
.audio-invite-btn:hover {
  background: rgba(184, 159, 110, .18);
}
.audio-invite-close {
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  font-size: 18px;
  font-weight: 200;
  color: rgba(245, 241, 232, .55);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

@media (min-width: 769px) {
  /* Sur desktop, on garde l'ambiance auto existante - pas d'invite */
  .audio-invite { display: none; }
}
