/* =============================================================================
   PONT DE LUMIÈRE DÉCORATIF (sous la navbar, toutes pages)
   -----------------------------------------------------------------------------
   Poutre de structure (truss) pleine largeur + projecteurs SVG accrochés
   dessous, chacun projetant un cône de lumière diffus qui se fond dans la page.
   - Fixe sous la navbar : forme le haut du cadre avec les montants latéraux
     (#side-truss) et reste visible en permanence au scroll.
   - pointer-events none : purement décoratif, ne bloque aucun clic.
   - Les projecteurs s'allument un par un au chargement (délais en cascade,
     petit scintillement d'amorçage type lampe de scène).
   - Hors du hero (classe .lb-folded posée par le script), chaque projecteur
     pivote vers le haut autour de son crochet et se plaque contre la poutre,
     cône éteint en fondu, mouvement inverse au retour dans le hero.
   Injecté par components/light-bridge.js.
   ============================================================================= */

#light-bridge {
  position: fixed;
  top: 80px;              /* juste sous la navbar (80px) */
  left: 0; right: 0;
  height: 200px;
  pointer-events: none;
  z-index: 50;            /* sous la navbar (100), au-dessus des fonds de hero */
  overflow: hidden;
  transition: opacity 700ms ease;
}

/* Hors du hero (projecteurs repliés) : l'ensemble devient discret.
   Toujours sticky sous la navbar ; opacité pleine au retour dans le hero. */
#light-bridge.lb-folded { opacity: 0.35; }

/* Poutre : deux membrures + treillis diagonal */
.lb-truss {
  height: 18px;
  border-top: 2px solid rgba(148,163,184,0.45);
  border-bottom: 2px solid rgba(148,163,184,0.45);
  background:
    repeating-linear-gradient(63deg,  transparent 0 11px, rgba(148,163,184,0.32) 11px 13px),
    repeating-linear-gradient(-63deg, transparent 0 11px, rgba(148,163,184,0.32) 11px 13px);
}

.lb-spots {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  margin-top: -1px;
}

.lb-spot {
  width: 120px; height: 176px;
  display: flex; justify-content: center;
  opacity: 0;
  animation: lb-on 700ms ease-out forwards;
}
.lb-spot svg {
  display: block;
  /* pivot = crochet d'accroche sur la poutre (haut-centre du SVG) */
  transform-origin: 50% 0;
  transition: transform 1100ms cubic-bezier(0.33, 0, 0.2, 1);
}

/* Cône : fondu pendant la rotation */
.lb-spot polygon { transition: opacity 800ms ease; }

/* Hors du hero : projecteurs pivotés contre la poutre, cônes éteints.
   Cascade de gauche à droite dans les deux sens ; la poutre ne bouge pas. */
#light-bridge.lb-folded .lb-spot svg { transform: rotate(-90deg); }
#light-bridge.lb-folded .lb-spot polygon { opacity: 0; }
.lb-spot:nth-child(1) svg.lb-spot:nth-child(1) polygon { transition-delay: 0s; }
.lb-spot:nth-child(2) svg.lb-spot:nth-child(2) polygon { transition-delay: 0.12s; }
.lb-spot:nth-child(3) svg.lb-spot:nth-child(3) polygon { transition-delay: 0.24s; }
.lb-spot:nth-child(4) svg.lb-spot:nth-child(4) polygon { transition-delay: 0.36s; }
.lb-spot:nth-child(5) svg.lb-spot:nth-child(5) polygon { transition-delay: 0.48s; }

/* Allumage un par un, avec un léger scintillement d'amorçage */
.lb-spot:nth-child(1) { animation-delay: 0.20s; }
.lb-spot:nth-child(2) { animation-delay: 0.42s; }
.lb-spot:nth-child(3) { animation-delay: 0.64s; }
.lb-spot:nth-child(4) { animation-delay: 0.86s; }
.lb-spot:nth-child(5) { animation-delay: 1.08s; }

@keyframes lb-on {
  0%   { opacity: 0; }
  45%  { opacity: 1; }
  60%  { opacity: 0.45; }
  100% { opacity: 1; }
}

/* Mobile : 3 projecteurs seulement */
@media (max-width: 768px) {
  #light-bridge { height: 160px; }
  .lb-spot { height: 140px; }
  .lb-spot svg { height: 140px; width: 96px; }
  .lb-spot:nth-child(2).lb-spot:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-spot { animation: none; opacity: 1; }
  /* changement d'état instantané, sans mouvement */
  #light-bridge, .lb-spot svg, .lb-spot polygon { transition: none; }
}

/* =============================================================================
   MONTANTS VERTICAUX (side truss), prolongent le pont de lumière sur les
   bords de l'écran, comme les pieds de structure d'un stand.
   - Fixes : restent visibles au scroll, collés aux bords, pleine hauteur.
   - Même style que la poutre horizontale (membrures + treillis slate
     translucide) : discrets sur fond clair, plus marqués sur fond sombre.
   - Étroits (18px bordures comprises) : jamais sous le contenu, les
     conteneurs les plus larges laissent ≥ 40px de marge à 1280px.
   - Desktop large uniquement (masqués sous 1280px).
   Injecté par components/light-bridge.js.
   ============================================================================= */

#side-truss { display: none; }

@media (min-width: 1280px) {
  #side-truss { display: block; }

  .st-rail {
    position: fixed;
    top: 0; bottom: 0;
    width: 14px;
    pointer-events: none;
    z-index: 40;            /* sous le pont (50) et la navbar (100) */
    border-left:  2px solid rgba(148,163,184,0.45);
    border-right: 2px solid rgba(148,163,184,0.45);
    background:
      repeating-linear-gradient(27deg,  transparent 0 11px, rgba(148,163,184,0.32) 11px 13px),
      repeating-linear-gradient(153deg, transparent 0 11px, rgba(148,163,184,0.32) 11px 13px);
    /* Apparition au chargement : fondu du haut vers le bas, une seule fois */
    animation: st-reveal 1600ms ease-out both;
  }
  .st-left  { left: 0; }
  .st-right { right: 0; }

  @keyframes st-reveal {
    from { opacity: 0; clip-path: inset(0 0 100% 0); }
    to   { opacity: 1; clip-path: inset(0 0 0 0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .st-rail { animation: none; }
}
