/* ==========================================================================
   Panneau de détail LOKI (réalisations, articles, page scarabée)
   ========================================================================== */
html.lp-lock { overflow: hidden; scrollbar-gutter: stable; }

#loki-panel { position: fixed; inset: 0; z-index: 90000; display: none; }
#loki-panel.open { display: block; }

#loki-panel .lp-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .35s ease;
}
#loki-panel.visible .lp-backdrop { opacity: 1; }

#loki-panel .lp-window {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: min(1500px, 100%);
  transform: translate(-50%, 40px) scale(.985);
  opacity: 0;
  background: #000; color: #fff;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1), opacity .3s ease;
  outline: none;
}
@media (min-width: 1600px) {
  #loki-panel .lp-window { top: 24px; bottom: 24px; border-radius: 40px; }
}
#loki-panel.visible .lp-window { transform: translate(-50%, 0) scale(1); opacity: 1; }
#loki-panel .lp-window.lp-light { background: #fff; color: #000; }

/* Barre fixe : titre + boutons */
#loki-panel .lp-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0));
  pointer-events: none;
}
#loki-panel .lp-light .lp-bar { background: linear-gradient(to bottom, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0)); }
#loki-panel .lp-title {
  font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  font-size: clamp(.8rem, .7rem + .4vw, 1rem);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .3s ease;
}
#loki-panel .lp-window:not(.lp-loading) .lp-title { opacity: .9; }
#loki-panel .lp-actions { display: flex; gap: 10px; pointer-events: auto; }
#loki-panel .lp-btn {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(0, 0, 0, .35); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  cursor: pointer; position: relative; padding: 0;
  transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
#loki-panel .lp-light .lp-btn { border-color: rgba(0, 0, 0, .25); background: rgba(255, 255, 255, .6); color: #000; }
#loki-panel .lp-btn:hover, #loki-panel .lp-btn:focus-visible { background: var(--bleu); border-color: var(--bleu); color: #fff; transform: scale(1.06); outline: none; }
#loki-panel .lp-btn[hidden] { display: none; }
#loki-panel .lp-btn span { position: absolute; left: 50%; top: 50%; background: currentColor; display: block; }
#loki-panel .lp-close span { width: 18px; height: 2px; transform: translate(-50%, -50%) rotate(45deg); }
#loki-panel .lp-close span + span { transform: translate(-50%, -50%) rotate(-45deg); }
#loki-panel .lp-prev span, #loki-panel .lp-next span {
  width: 11px; height: 11px; background: none;
  border-top: 2px solid currentColor; border-left: 2px solid currentColor;
}
#loki-panel .lp-prev span { transform: translate(-30%, -50%) rotate(-45deg); }
#loki-panel .lp-next span { transform: translate(-70%, -50%) rotate(135deg); }

/* Contenu */
#loki-panel .lp-content { min-height: 100%; margin-top: -72px; }
#loki-panel .lp-content #reference,
#loki-panel .lp-content #article { animation: lp-fade .35s ease both; }
#loki-panel .lp-enter-right #reference, #loki-panel .lp-enter-right #article { animation: lp-slide-right .4s cubic-bezier(.2, .8, .2, 1) both; }
#loki-panel .lp-enter-left #reference, #loki-panel .lp-enter-left #article { animation: lp-slide-left .4s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lp-slide-right { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes lp-slide-left { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }

/* Les boutons de fermeture historiques des fragments sont remplacés par la barre */
#loki-panel #reference-close, #loki-panel #article-close { display: none; }
#loki-panel #reference-speech-sticky { top: 90px; }
#loki-panel #article-speech-sticky { top: 90px; }

/* Squelette de chargement */
.lp-skeleton { display: grid; gap: 40px; padding: 110px 5% 60px; min-height: 100vh; }
@media (min-width: 600px) { .lp-skeleton { grid-template-columns: 35% 55%; justify-content: space-between; } }
.lp-sk-line, .lp-sk-img {
  display: block; border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .08) 25%, rgba(255, 255, 255, .18) 50%, rgba(255, 255, 255, .08) 75%);
  background-size: 200% 100%; animation: lp-shimmer 1.2s linear infinite;
}
.lp-light .lp-sk-line, .lp-light .lp-sk-img { background-image: linear-gradient(90deg, rgba(0, 0, 0, .06) 25%, rgba(0, 0, 0, .12) 50%, rgba(0, 0, 0, .06) 75%); }
.lp-sk-line { height: 18px; margin-bottom: 14px; }
.lp-sk-text .lp-sk-line:first-child { height: 44px; margin-bottom: 28px; }
.lp-sk-line.w60 { width: 60%; } .lp-sk-line.w70 { width: 70%; } .lp-sk-line.w80 { width: 80%; } .lp-sk-line.w90 { width: 90%; }
.lp-sk-media { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.lp-sk-img { aspect-ratio: 4 / 5; border-radius: 40px; }
@keyframes lp-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Carte cliquée : retour immédiat */
a.js-popup-link.is-loading { opacity: .6; cursor: progress; }

/* Réduction des animations */
@media (prefers-reduced-motion: reduce) {
  #loki-panel .lp-window, #loki-panel .lp-backdrop { transition: none; }
  #loki-panel .lp-content * { animation: none !important; }
}
