/* ============================================================
   GLOBAL FRAME & LAYOUT
   ============================================================ */

.aev-shell .aev-frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  margin: 0;
  background: #000;
  font-family: "Lexend", sans-serif;
  font-weight: 400;
  color: #fff;
}

.aev-shell .aev-viewer,
.aev-shell .openseadragon-container {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  background: transparent !important;
}

body.admin-bar .aev-shell .aev-frame {
  height: calc(100vh - 32px);
}

/* ============================================================
   HERO OVERLAY
   ============================================================ */

.aev-hero.fade-out {
  opacity: 0;
  transition: opacity .3s ease-in-out;
}

.aev-hero-text p {
  margin: 0 0 .5em;
}

.aev-shell .aev-hero {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 24px;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 10;
}

.aev-shell .aev-hero[data-state="hidden"] {
  opacity: 0;
}

.aev-shell .aev-hero-card {
  background: #05050596;
  padding: 24px;
  border-radius: 6px;
  max-width: min(420px, 70%);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  pointer-events: auto;
  position: relative;
  margin-top: 140px;
}

.aev-shell .aev-hero-title {
  font-weight: 800;
  font-size: 28px;
  margin-bottom: 8px;
  color: #61ce70;
}

.aev-hero-text {
    padding: 16px;
    font-size: 0.8rem;
    line-height: 1.6rem;
}

.aev-shell .aev-hero-cta {
  margin-top: 12px;
  padding: .55rem .9rem;
  border: 1px solid #61ce70;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

/* Close icon */
.aev-hero-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  opacity: .8;
}
.aev-hero-close:hover { opacity: 1; }

/* ============================================================
   FIXED LAUNCHER BUTTON (desktop base)
   ============================================================ */

.aev-launcher {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 20;
  padding: 10px 18px;
  border-radius: 6px;
  background: #050505b0;
  border: 1px solid #61ce70;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  backdrop-filter: blur(4px);
}
.aev-launcher:hover {
  background: #ffffff20;
}

/* ============================================================
   FOCUS RING
   ============================================================ */

.aev-shell button:focus {
  outline: 2px solid #f6a45f;
  outline-offset: 2px;
}

/* ============================================================
   SIDE PANEL (desktop)
   ============================================================ */

.aev-shell .aev-panel {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: min(36ch, 34%);
  z-index: 10;
  display: none;
}

.aev-shell .aev-panel.visible {
  display: block;
  opacity: 1;
  transition: opacity .25s ease-in-out;
}

.aev-shell .aev-panel[data-side="right"] { right: 24px; }
.aev-shell .aev-panel[data-side="left"]  { left: 24px; }

.aev-shell .aev-panel-inner {
  background: #05050596;
  padding: 18px 18px 48px;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0,0,0,.2);
}

.aev-shell .aev-panel-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 .25rem;
  color: #fff;
}

.aev-shell .aev-panel-body {
  line-height: 1.55;
  font-size: 15px;
  color: #fff;
}

/* Nav buttons */
.aev-shell .aev-panel-nav {
  position: absolute;
  bottom: 8px;
  right: 12px;
  display: flex;
  gap: 6px;
}

.aev-shell .aev-panel-nav button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid #61ce70;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 0 16px 3px 12px;
  color: #61ce70;
}
.aev-shell .aev-panel-nav .aev-back { margin-right: 6px; }

/* ============================================================
   LOADING PLACEHOLDER
   ============================================================ */

.aev-shell .aev-viewer::before {
  content: "Chargement...";
  color: #000;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2em;
  opacity: .7;
}

/* ============================================================
   MOBILE (≤ 900px)
   ============================================================ */

@media (max-width: 900px) {

  /* Disable default touch scroll */
  .aev-shell,
  .aev-shell .aev-frame,
  .aev-shell .aev-viewer,
  .aev-shell .openseadragon-container {
    touch-action: none;
  }

  html, body {
    overscroll-behavior: none;
  }

  /* ---------------------------------------
     HERO is hidden by default on mobile
     --------------------------------------- */
  .aev-shell .aev-hero {
    display: none;
  }
  .aev-shell .aev-hero[data-state="visible"] {
    display: flex;
  }

  /* Hero adjustments */
  .aev-shell .aev-hero-card {
    background: #050505c0;
    padding: 14px;
    border-radius: 6px;
    max-width: 92%;
    margin: 120px auto 0 auto;
    text-align: center;
  }

  .aev-shell .aev-hero-title {
    font-size: 22px;
  }

  .aev-shell .aev-hero-cta {
    padding: .6rem 1.1rem;
    border-width: 2px;
    font-size: 15px;
  }

  /* ---------------------------------------
     PANEL becomes bottom sheet
     --------------------------------------- */
  .aev-shell .aev-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none;
    width: 100%;
    height: 30vh;
    max-height: 45vh;
    background: #050505e0;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    z-index: 15;
    display: none;
  }

  .aev-shell .aev-panel.visible {
    display: block;
    opacity: 1;
    transition: opacity .25s ease-in-out, transform .25s ease;
  }

  .aev-shell .aev-panel-inner {
    background: transparent;
    padding: 16px 18px 56px;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .aev-shell .aev-panel-title {
    font-size: 20px;
    font-weight: 800;
  }

  .aev-shell .aev-panel-body {
    font-size: 14px;
    line-height: 1.6;
  }

  /* Nav buttons pinned top-right */
  .aev-shell .aev-panel-nav {
    position: absolute;
    top: 10px;
    right: 12px;
    bottom: auto;
    gap: 8px;
  }

  .aev-shell .aev-panel-nav button {
    width: 40px;
    height: 40px;
    font-size: 22px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 50%;
  }

  .aev-shell .aev-panel[data-side="left"] {
    left: 0;
  }

  /* ---------------------------------------
     MOBILE launcher overrides
     --------------------------------------- */
  .aev-launcher {
    bottom: 12px;
    left: 12px;
    padding: 8px 14px;
    font-size: 14px;
  }

  .aev-shell button:focus {
    outline: 2px solid #f6a45f;
    outline-offset: 3px;
  }
}
