/* ═══════════════════════════════════════════════════
   AIconic – Hero Slider Widget  |  v1.1.1
   DIGITAL 360X – https://digital360x.net
   ═══════════════════════════════════════════════════ */

/* ══════════════════════════════════════
   VARIABLES (fallbacks statiques)
══════════════════════════════════════ */
.aiconic-hero-widget {
  --ah-accent-start:  #D8B976;
  --ah-accent-end:    #ECD496;
  --ah-accent-grad:   linear-gradient(135deg, var(--ah-accent-start), var(--ah-accent-end));
  --ah-panel-bg:      rgba(8, 8, 12, 0.85);
  --ah-panel-border:  rgba(216, 185, 118, 0.22);
  --ah-panel-blur:    14px;
  --ah-panel-radius:  0px;
  --ah-panel-padding: 56px;
  --ah-panel-width:   44%;
  --ah-hero-height:   88vh;
  --ah-panel-valign:  center;
  --ah-transition:    0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ══════════════════════════════════════
   WRAPPER — conteneur racine
   position:relative + hauteur explicite
   pour que les enfants absolute se réfèrent à lui
══════════════════════════════════════ */
.aiconic-hero-widget {
  position: relative;
  width: 100%;
  height: var(--ah-hero-height);   /* hauteur fixe, pas min-height */
  overflow: hidden;
  isolation: isolate;
  display: block;                   /* pas de flex sur le wrapper */
}

/* ══════════════════════════════════════
   BACKGROUND — couvre tout le wrapper
══════════════════════════════════════ */
.ah-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* ── Slideshow ── */
.ah-slideshow {
  position: absolute;
  inset: 0;
}

.ah-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  opacity: 0;
  transition: opacity 1.2s ease;
  will-change: opacity;
}

.ah-slide--active {
  opacity: 1;
}

/* Zoom-out */
.ah-slideshow[data-transition="zoom-out"] .ah-slide {
  transform: scale(1.07);
  transition: opacity 1.2s ease, transform 7s ease;
}
.ah-slideshow[data-transition="zoom-out"] .ah-slide--active {
  transform: scale(1);
}

/* Glissement */
.ah-slideshow[data-transition="slide"] .ah-slide {
  transform: translateX(5%);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.ah-slideshow[data-transition="slide"] .ah-slide--active {
  transform: translateX(0);
}

/* ── Vidéo locale ── */
.ah-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ── YouTube ── */
.ah-yt-fallback {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.ah-youtube {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 177.78vh;   /* 16/9 en vh */
  height: 56.25vw;   /* 9/16 en vw */
  min-width: 100%;
  min-height: 100%;
  border: none;
  pointer-events: none;
}

/* ── Overlay ── */
.ah-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ══════════════════════════════════════
   LAYOUT INTÉRIEUR
   Calque au-dessus du bg, flex pour
   positionner le panneau
══════════════════════════════════════ */
.ah-layout {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: stretch;
}

/* ── Spacer (côté sans panneau) ── */
.ah-spacer {
  flex: 1;
  min-width: 0;
}

/* ══════════════════════════════════════
   PANNEAU CONTENT
══════════════════════════════════════ */
.ah-panel {
  position: relative;
  flex-shrink: 0;
  width: var(--ah-panel-width);
  display: flex;
  flex-direction: column;
  justify-content: var(--ah-panel-valign);
  background: var(--ah-panel-bg);
  backdrop-filter: blur(var(--ah-panel-blur));
  -webkit-backdrop-filter: blur(var(--ah-panel-blur));
  border-left: 1px solid var(--ah-panel-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    -20px 0 60px rgba(0, 0, 0, 0.3);
  overflow-y: auto;   /* scroll si contenu trop long */
}

/* Position gauche : panneau à gauche, spacer à droite */
.ah-panel--left .ah-layout {
  flex-direction: row-reverse;
}
.ah-panel--left .ah-panel {
  border-left: none;
  border-right: 1px solid var(--ah-panel-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    20px 0 60px rgba(0, 0, 0, 0.3);
}

/* Centré/flottant : le layout est géré par le style scoped du widget.
   Ces règles sont les fallbacks de base. */
.ah-panel--center .ah-layout {
  align-items: flex-end;    /* défaut : bas, override par scoped style */
  justify-content: center;  /* défaut : centre */
}
.ah-panel--center .ah-spacer {
  display: none;
}
.ah-panel--center .ah-panel {
  /* largeur, radius, transform : injectés via style scoped */
  border-left: none;
  border-right: none;
}

/* ── Barre accent verticale ── */
.ah-panel[data-bar="1"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12%;
  height: 76%;
  width: 3px;
  background: var(--ah-accent-grad);
  border-radius: 0 2px 2px 0;
  pointer-events: none;
}
.ah-panel--left .ah-panel[data-bar="1"]::before {
  left: auto;
  right: 0;
  border-radius: 2px 0 0 2px;
}

/* ── Filet supérieur lumineux ── */
.ah-panel::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--ah-accent-start) 40%,
    var(--ah-accent-end) 60%,
    transparent 100%
  );
  opacity: 0.45;
  pointer-events: none;
}

/* ══════════════════════════════════════
   PANEL INNER — contenu
══════════════════════════════════════ */
.ah-panel__inner {
  padding: var(--ah-panel-padding);
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}

/* ── Badge ── */
.ah-panel__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ah-accent-start);
  border: 1px solid rgba(216, 185, 118, 0.38);
  padding: 5px 13px;
  border-radius: 2px;
  margin-bottom: 20px;
  width: fit-content;
  line-height: 1;
}

/* ── Titre ── */
.ah-panel__title {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: 800;
  line-height: 1.22;
  color: #FFFFFF;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.ah-title__accent {
  font-style: normal;
  background: var(--ah-accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Séparateur ── */
.ah-panel__sep {
  width: 36px;
  height: 2px;
  border-radius: 1px;
  margin-bottom: 18px;
  flex-shrink: 0;
}

/* ── Intro ── */
.ah-panel__intro {
  font-size: 0.875rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.68);
  margin: 0 0 22px;
}
.ah-panel__intro p {
  margin: 0;
}
.ah-panel__intro strong {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 600;
}

/* ══════════════════════════════════════
   BULLETS
══════════════════════════════════════ */
.ah-bullets {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.ah-bullet {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.ah-bullet__icon {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 7px;
}

.ah-bullet__text {
  font-size: 0.845rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.80);
}

/* ══════════════════════════════════════
   BOUTONS CTA
══════════════════════════════════════ */
.ah-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.ah-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.855rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-radius: 3px;
  border: 1px solid transparent;
  transition:
    background var(--ah-transition),
    color var(--ah-transition),
    border-color var(--ah-transition),
    transform var(--ah-transition),
    box-shadow var(--ah-transition);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}

/* Primaire */
.ah-cta--primary {
  background: var(--ah-accent-start);
  color: #0A0A0A;
  border-color: var(--ah-accent-start);
}
.ah-cta--primary:hover {
  background: var(--ah-accent-end);
  border-color: var(--ah-accent-end);
  color: #0A0A0A;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(216, 185, 118, 0.32);
  text-decoration: none;
}

/* Secondaire */
.ah-cta--secondary {
  background: transparent;
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.45);
}
.ah-cta--secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.75);
  color: #FFFFFF;
  transform: translateY(-2px);
  text-decoration: none;
}

.ah-cta__arrow {
  display: inline-block;
  transition: transform var(--ah-transition);
}
.ah-cta--secondary:hover .ah-cta__arrow {
  transform: translateX(4px);
}

/* ══════════════════════════════════════
   DOTS NAVIGATION
══════════════════════════════════════ */
.ah-dots {
  position: absolute;
  bottom: 24px;
  right: 32px;     /* côté panneau par défaut */
  z-index: 10;
  display: flex;
  gap: 8px;
  align-items: center;
}

.ah-panel--left .ah-dots {
  right: auto;
  left: 32px;
}

.ah-panel--center .ah-dots {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}

.ah-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 0;
  transition: background 0.3s ease, width 0.3s ease;
  flex-shrink: 0;
}
.ah-dot--active {
  width: 22px;
  border-radius: 3px;
  background: var(--ah-accent-start);
}

/* ══════════════════════════════════════
   SCROLL INDICATOR
══════════════════════════════════════ */
.ah-scroll-indicator {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.ah-scroll-indicator__line {
  display: block;
  width: 1px;
  height: 44px;
  background: linear-gradient(to bottom, var(--ah-accent-start), transparent);
  animation: ah-scroll-pulse 1.9s ease-in-out infinite;
  transform-origin: top;
}

@keyframes ah-scroll-pulse {
  0%   { opacity: 0; transform: scaleY(0.2); }
  40%  { opacity: 1; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1); }
}

/* ══════════════════════════════════════
   TABLETTE (≤ 1100px)
══════════════════════════════════════ */
@media (max-width: 1100px) {
  .aiconic-hero-widget { --ah-panel-width: 50%; }
}
@media (max-width: 900px) {
  .aiconic-hero-widget { --ah-panel-width: 56%; }
}

/* ══════════════════════════════════════
   TABLETTE
══════════════════════════════════════ */
@media (max-width: 1100px) { .aiconic-hero-widget { --ah-panel-width: 50%; } }
@media (max-width: 900px)  { .aiconic-hero-widget { --ah-panel-width: 58%; } }

/* ══════════════════════════════════════
   MOBILE (≤ 768px)
   Structure de base — les valeurs
   spécifiques sont dans le <style> scoped
   généré par le PHP render()
══════════════════════════════════════ */
@media (max-width: 768px) {

  /* Widget : hauteur écran exacte, gérée par JS */
  .aiconic-hero-widget {
    height: 100dvh;
    max-height: 100dvh;
    min-height: unset;
    overflow: hidden;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    max-width: 100vw;
    box-sizing: border-box;
  }

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

  /* ── MODE "bottom-panel" : layout vertical ── */
  .ah-mob--bottom-panel .ah-layout {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch;
    height: 100%;
    overflow: hidden;
  }

  .ah-mob--bottom-panel .ah-spacer {
    /* flex-basis injecté par le <style> scoped */
    flex-shrink: 0;
    min-height: 0;
    position: relative;
  }

  .ah-mob--bottom-panel .ah-panel {
    flex: 1 1 0;
    min-height: 0;
    width: 100% !important;
    border-left:   none !important;
    border-right:  none !important;
    border-bottom: none !important;
    border-top: 1px solid var(--ah-panel-border) !important;
    box-shadow: 0 -6px 32px rgba(0,0,0,0.3) !important;
    margin-top: -16px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Barre accent → horizontal */
  .ah-mob--bottom-panel .ah-panel[data-bar="1"]::before {
    top: 0; left: 50%; transform: translateX(-50%);
    width: 42px; height: 3px;
    right: auto; bottom: auto;
    border-radius: 0 0 3px 3px;
  }

  /* Poignée */
  .ah-mob--bottom-panel .ah-panel::after {
    content: '';
    position: absolute;
    top: 9px; left: 50%; transform: translateX(-50%);
    width: 32px; height: 3px;
    background: rgba(255,255,255,0.14);
    border-radius: 2px;
    pointer-events: none;
  }

  /* ── MODES "overlay" : image plein écran ── */
  .ah-mob--overlay-bottom .aiconic-hero-widget,
  .ah-mob--overlay-center .aiconic-hero-widget {
    /* Le widget garde toute la hauteur */
  }

  /* layout overlay : absolu sur tout le widget */
  .ah-mob--overlay-bottom .ah-layout,
  .ah-mob--overlay-center .ah-layout {
    position: absolute !important;
    inset: 0;
    z-index: 2;
  }

  /* Panneau overlay : positionné par le style scoped */
  .ah-mob--overlay-bottom .ah-panel,
  .ah-mob--overlay-center .ah-panel {
    width: 92%; /* override par style scoped */
    border-left:   none;
    border-right:  none;
  }

  /* Dots positionnés différemment selon le mode */
  .ah-mob--bottom-panel .ah-dots {
    bottom: 14px; left: 50%; transform: translateX(-50%);
    position: absolute; right: auto; top: auto; z-index: 5;
  }

  .ah-mob--overlay-bottom .ah-dots,
  .ah-mob--overlay-center .ah-dots {
    bottom: 16px; left: 50%; transform: translateX(-50%);
    position: absolute; z-index: 10;
  }

  /* ── MODE card-overlap : règles de base (valeurs via style scoped) ── */
  /* Le widget devient un flux vertical normal, pas de overflow hidden */
  .ah-mob--card-overlap.aiconic-hero-widget {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
  }

  /* L'image prend une hauteur propre, arrondie en bas */
  .ah-mob--card-overlap .ah-bg {
    position: relative !important;
    overflow: hidden;
    border-radius: 0 0 20px 20px; /* coins bas arrondis pour un effet maquette */
  }

  /* Slideshow et vidéo héritent de la hauteur du parent .ah-bg */
  .ah-mob--card-overlap .ah-slideshow,
  .ah-mob--card-overlap .ah-video,
  .ah-mob--card-overlap .ah-yt-fallback {
    position: absolute;
    inset: 0;
    height: 100%;
  }

  /* Layout : flux normal, sort de absolute */
  .ah-mob--card-overlap .ah-layout {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    z-index: 2;
  }

  /* Spacer inutile en card-overlap */
  .ah-mob--card-overlap .ah-spacer { display: none !important; }

  /* Panneau : carte détachée */
  .ah-mob--card-overlap .ah-panel {
    position: relative !important;
    width: auto !important;
    flex: none !important;
    overflow: visible !important;
    /* Les valeurs exactes (margin, radius, bg, shadow) viennent du style scoped */
  }

  /* Contenu panneau en card-overlap : pas de compression, contenu libre */
  .ah-mob--card-overlap .ah-panel__inner {
    overflow: visible !important;
  }

  .ah-mob--card-overlap .ah-panel__intro {
    display: block !important;        /* pas de line-clamp */
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
  }

  /* ── Contenu panneau : tout strictement contenu ── */
  .ah-panel__inner {
    /* Garantit que rien ne déborde */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding: 22px 20px 24px !important; /* override par scoped si besoin */
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }

  /* Tous les enfants directs du panneau restent dans la largeur */
  .ah-panel__inner > * {
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
  }

  .ah-panel__badge {
    font-size: 9px;
    padding: 4px 10px;
    margin-bottom: 10px;
    flex-shrink: 0;
    width: fit-content;
    max-width: 100%;
  }

  .ah-panel__title {
    font-size: clamp(1rem, 4.8vw, 1.4rem);
    line-height: 1.22;
    margin-bottom: 10px;
    flex-shrink: 0;
    word-break: break-word;
  }

  .ah-panel__sep {
    width: 28px;
    margin-bottom: 10px;
    flex-shrink: 0;
  }

  .ah-panel__intro {
    font-size: 0.82rem;
    line-height: 1.6;
    margin-bottom: 12px;
    flex-shrink: 0;
    max-width: 100%;
    word-break: break-word;
  }

  .ah-bullets {
    gap: 8px;
    margin-bottom: 14px;
    flex-shrink: 0;
    max-width: 100%;
    padding: 0;
    /* Réinitialise align-self du desktop */
    align-self: stretch !important;
  }

  .ah-bullet  { gap: 9px; max-width: 100%; }
  .ah-bullet__icon { width: 5px; height: 5px; margin-top: 6px; flex-shrink: 0; }
  .ah-bullet__text {
    font-size: 0.8rem;
    line-height: 1.5;
    max-width: 100%;
    word-break: break-word;
  }

  /* ── CTAs : verticaux, pleine largeur, strictement dans le panneau ── */
  .ah-ctas {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
    flex-shrink: 0;
    margin-top: 4px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .ah-cta {
    display: flex !important;
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 13px 16px !important;
    font-size: 0.82rem !important;
    white-space: normal !important;
    box-sizing: border-box !important;
    /* Réinitialise le white-space du desktop */
    letter-spacing: 0.02em;
  }

  .ah-scroll-indicator { display: none; }
}

/* ══════════════════════════════════════
   PAYSAGE MOBILE
══════════════════════════════════════ */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .aiconic-hero-widget {
    height: 100dvh; max-height: 100dvh;
    display: block;
  }
  .ah-layout {
    position: absolute !important; inset: 0;
    flex-direction: row !important; align-items: stretch !important;
    height: 100% !important;
  }
  .ah-spacer { flex: 1 !important; min-height: unset !important; }
  .ah-panel {
    flex: 0 0 50% !important; width: 50% !important;
    border-radius: 0 !important; border-top: none !important;
    border-left: 1px solid var(--ah-panel-border) !important;
    margin-top: 0 !important; overflow-y: auto;
    justify-content: center;
  }
  .ah-panel__inner { padding: 20px 24px !important; }
  .ah-panel__title { font-size: clamp(0.95rem, 2.2vw, 1.2rem); }
  .ah-panel__intro { font-size: 0.8rem; margin-bottom: 8px; }
  .ah-bullets { gap: 6px; margin-bottom: 10px; }
  .ah-ctas { flex-direction: row; }
  .ah-scroll-indicator { display: none; }
}

/* ══════════════════════════════════════
   REDUCED MOTION
══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .ah-slide { transition: opacity 0.3s ease !important; transform: none !important; }
  .ah-scroll-indicator__line { animation: none !important; opacity: 0.5; }
  .ah-cta { transition: background 0.2s, color 0.2s !important; transform: none !important; }
}
