/* ============================================================
   LARUGA.FR — drawer.css
   Sliding drawer panel, overlay, lightbox, accordion, and
   gallery styles for the project detail view.
   Depends on: main.css (variables & resets must be loaded first)
   ============================================================ */

/* Chromatic accent inheritance per pole */
.drawer[data-pole="p01"] { --pole-accent: var(--color-p01); }
.drawer[data-pole="p02"] { --pole-accent: var(--color-p02); }
.drawer[data-pole="p03"] { --pole-accent: var(--color-p03); }
.drawer[data-pole="p04"] { --pole-accent: var(--color-p04); }
.drawer[data-pole="p05"] { --pole-accent: var(--color-p05); }
.drawer[data-pole="p06"] { --pole-accent: var(--color-p06); }
.drawer[data-pole="p07"] { --pole-accent: var(--color-p07); }
.drawer[data-pole="p08"] { --pole-accent: var(--color-p08); }
.drawer[data-pole="p09"] { --pole-accent: var(--color-p09); }

/* ------------------------------------------------------------
   1. DRAWER OVERLAY — semi-opaque backdrop behind the drawer
   ------------------------------------------------------------ */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(26, 26, 24, 0.30);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) ease;
  /* Backdrop blur for a modern editorial feel */
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ------------------------------------------------------------
   2. DRAWER PANEL — slides in from the right edge
   ------------------------------------------------------------ */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 78vw;
  max-width: 900px;
  height: 100%;
  background-color: var(--parchemin);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-overflow-scrolling: touch;
  /* Custom scrollbar to match brand */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  /* Subtle left border to separate from main content */
  border-left: 1px solid var(--border);
}

.drawer::-webkit-scrollbar {
  width: 4px;
}

.drawer::-webkit-scrollbar-track {
  background: transparent;
}

.drawer::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 0;
}

.drawer.open {
  transform: translateX(0);
  animation: retroApertureOpen 0.44s cubic-bezier(0.12, 0.9, 0.25, 1) forwards;
}

/* Retro CRT monitor shutdown beam collapse on close */
.drawer.closing {
  pointer-events: none !important;
  animation: retroApertureClose 0.38s cubic-bezier(0.18, 0.9, 0.3, 1) forwards !important;
}

.drawer.closing::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.3) 0px,
    rgba(255, 255, 255, 0.3) 2px,
    transparent 2px,
    transparent 4px
  );
  pointer-events: none;
  z-index: 101;
  animation: crtCloseFlicker 0.38s steps(4) forwards;
}

@keyframes retroApertureClose {
  0% {
    transform: translateX(0);
    clip-path: inset(0 0 0 0);
    filter: brightness(1) contrast(1);
    opacity: 1;
  }
  25% {
    transform: translateX(0);
    clip-path: inset(48.2% 0 48.2% 0);
    filter: brightness(3.6) contrast(2) drop-shadow(0 0 35px rgba(255, 60, 40, 0.9));
    opacity: 1;
  }
  60% {
    transform: translateX(6%);
    clip-path: inset(49.2% 35% 49.2% 35%);
    filter: brightness(4.5) contrast(2.2) drop-shadow(0 0 45px #fff);
    opacity: 0.95;
  }
  85% {
    transform: translateX(25%);
    clip-path: inset(49.8% 48% 49.8% 48%);
    filter: brightness(3);
    opacity: 0.6;
  }
  100% {
    transform: translateX(100%);
    clip-path: inset(50% 50% 50% 50%);
    filter: brightness(0);
    opacity: 0;
  }
}

@keyframes crtCloseFlicker {
  0%   { opacity: 0.85; }
  50%  { opacity: 0.45; }
  100% { opacity: 0; }
}

/* Cathode Ray Tube fine raster lines that briefly flash on open */
.drawer.open::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(26, 26, 24, 0.12) 0px,
    rgba(26, 26, 24, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 99;
  opacity: 0.85;
  animation: crtRasterFade 0.5s ease-out forwards;
}

@keyframes crtRasterFade {
  0%   { opacity: 0.9; }
  50%  { opacity: 0.45; }
  100% { opacity: 0; }
}

/* Reinforced Retro CRT high-voltage electron scanline sweep */
.drawer.open::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 80, 60, 0.35) 40%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(255, 100, 80, 0.4) 60%,
    rgba(255, 255, 255, 0) 100%
  );
  box-shadow: 0 0 30px rgba(255, 60, 40, 0.6);
  pointer-events: none;
  z-index: 100;
  animation: retroScanlineSweep 0.52s cubic-bezier(0.2, 0.85, 0.35, 1) forwards;
}

@keyframes retroApertureOpen {
  0% {
    transform: translateX(60%);
    clip-path: inset(48.5% 0 48.5% 0);
    filter: brightness(3.5) contrast(2) drop-shadow(-10px 0 30px rgba(255, 60, 40, 0.9));
  }
  20% {
    transform: translateX(15%);
    clip-path: inset(28% 0 28% 0);
    filter: brightness(2.6) contrast(1.6) drop-shadow(-15px 0 40px rgba(255, 60, 40, 0.7));
  }
  50% {
    transform: translateX(0);
    clip-path: inset(0% 0 0% 0);
    filter: brightness(1.6) contrast(1.3);
  }
  75% {
    transform: translateX(-2px);
    clip-path: inset(0 0 0 0);
    filter: brightness(1.15) contrast(1.1);
  }
  100% {
    transform: translateX(0);
    clip-path: none;
    filter: none;
  }
}

@keyframes retroScanlineSweep {
  0% {
    transform: translateY(-100%);
    opacity: 1;
  }
  40% {
    opacity: 0.95;
  }
  100% {
    transform: translateY(110vh);
    opacity: 0;
  }
}

/* Staggered CRT decoding for inner elements without GPU blur to keep text razor-sharp */
.drawer.open .drawer-header {
  animation: crtElementIn 0.3s 0.04s both ease-out;
}
.drawer.open .drawer-hero-action {
  animation: crtElementIn 0.3s 0.08s both ease-out;
}
.drawer.open .drawer-summary,
.drawer.open .drawer-description {
  animation: crtElementIn 0.3s 0.12s both ease-out;
}
.drawer.open .drawer-gallery {
  animation: crtElementIn 0.3s 0.16s both ease-out;
}
.drawer.open .accordion {
  animation: crtElementIn 0.3s 0.20s both ease-out;
}

@keyframes crtElementIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------------------------------------------------------
   3. DRAWER INNER — padding wrapper for all content
   ------------------------------------------------------------ */
.drawer-inner {
  padding: 2rem 3rem 6rem;
  flex: 1;
  box-sizing: border-box;
}

/* ------------------------------------------------------------
   4. DRAWER TOP BAR & CONTROLS (Sticky)
   ------------------------------------------------------------ */
.drawer-close-bar {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
  padding: 0.9rem 2.5rem;
  background-color: rgba(232, 228, 220, 0.96);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(26, 26, 24, 0.05);
}

.drawer-nav-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Boutons Précédent / Suivant épurés sans cadres */
.drawer-nav-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--anthracite-light);
  background: transparent;
  border: none;
  outline: none;
  padding: 0.35rem 0.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  pointer-events: all;
  transition: color var(--duration-base), transform var(--duration-fast);
}

.drawer-nav-btn:hover:not(:disabled) {
  background: transparent;
  color: var(--cardinal);
  border: none;
}

.drawer-prev-btn:hover:not(:disabled) {
  transform: translateX(-3px);
}

.drawer-next-btn:hover:not(:disabled) {
  transform: translateX(3px);
}

.drawer-nav-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none;
}

/* Bouton Fermer épuré sans cadre */
.drawer-close {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cardinal);
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0.35rem 0.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: all !important;
  transition: color var(--duration-base), opacity var(--duration-base), transform var(--duration-fast);
}

.drawer-close:hover {
  background: transparent;
  color: var(--cardinal-dark);
  border: none;
  box-shadow: none;
  transform: scale(1.05);
  opacity: 0.85;
}

/* ------------------------------------------------------------
   5. DRAWER CONTENT HIERARCHY
   ------------------------------------------------------------ */

/* Archive / reference code */
.drawer-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--pole-accent, var(--cardinal));
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.drawer-code::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--pole-accent, var(--cardinal));
}

/* Large display title */
.drawer-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 6.5vw, 110px);
  color: var(--anthracite);
  line-height: 0.88;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin-bottom: 1.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  min-width: 0;
}

/* Metadata row: discipline, year, client, etc. */
.drawer-subtitle {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--anthracite);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.drawer-subtitle-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-subtitle-item strong {
  font-weight: 400;
  color: var(--anthracite-light);
}

/* Short summary paragraph */
.drawer-summary {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--anthracite-light);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

/* Extended description body copy */
.drawer-description {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--anthracite-light);
  line-height: 1.8;
  margin-bottom: 2.5rem;
}

.drawer-description p {
  margin-bottom: 1em;
}

.drawer-description p:last-child {
  margin-bottom: 0;
}

/* Inline links within description */
.drawer-description a {
  color: var(--cardinal);
  text-decoration: underline;
  text-decoration-color: rgba(139, 26, 26, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--duration-base);
}

.drawer-description a:hover {
  text-decoration-color: var(--cardinal);
}

/* ------------------------------------------------------------
   5b. INTERFACES 3D INTÉGRÉES (iframes)
   ------------------------------------------------------------ */
.drawer-embeds {
  display: grid;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

.drawer-embeds[hidden] {
  display: none;
}

.drawer.open .drawer-embeds {
  animation: crtElementIn 0.3s 0.14s both ease-out;
}

.drawer-embed {
  margin: 0;
}

.drawer-embed-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.drawer-embed-label {
  color: var(--pole-accent, var(--cardinal));
  font-weight: 700;
}

.drawer-embed-title {
  color: var(--mono-grey);
  flex: 1;
  min-width: 0;
}

/* Cadre : même taille avant et après le lancement (pas de saut de mise en page) */
.drawer-embed-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
  background: var(--white-warm);
  overflow: hidden;
}

.drawer-embed-frame.is-live {
  border-color: var(--anthracite);
}

/* Téléphone : cadre plus haut pour laisser de la place à la maquette sous la barre d'outils */
@media (max-width: 767px) {
  .drawer-embed-frame {
    aspect-ratio: 4 / 5 !important;
  }
}

.drawer-embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Écran d'attente : trame de mire + bouton de lancement */
.drawer-embed-launch {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
  border: 0;
  cursor: pointer;
  color: var(--anthracite);
  background:
    repeating-linear-gradient(0deg, rgba(26, 26, 24, 0.035) 0 1px, transparent 1px 4px),
    linear-gradient(rgba(192, 187, 176, 0.45) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(192, 187, 176, 0.45) 1px, transparent 1px) 0 0 / 48px 48px,
    radial-gradient(110% 85% at 50% 45%, var(--white-warm), var(--parchemin));
  font-family: var(--font-mono);
  transition: background-color var(--duration-base) var(--ease-standard);
}

.drawer-embed-launch-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--anthracite);
  background: var(--white-warm);
  color: var(--pole-accent, var(--cardinal));
  font-size: 20px;
  padding-left: 4px;
  transition: background-color var(--duration-base) var(--ease-standard),
              color var(--duration-base) var(--ease-standard);
}

.drawer-embed-launch:hover .drawer-embed-launch-icon,
.drawer-embed-launch:focus-visible .drawer-embed-launch-icon {
  background: var(--pole-accent, var(--cardinal));
  color: var(--white-warm);
}

.drawer-embed-launch:focus-visible {
  outline: 2px solid var(--cardinal);
  outline-offset: -2px;
}

.drawer-embed-launch-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.drawer-embed-launch-size,
.drawer-embed-launch-hint {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mono-grey);
}

.drawer-embed-launch-hint {
  position: absolute;
  bottom: 14px;
}

/* Jeux jouables : format écran conservé sur téléphone, fond noir, lien plein écran */
@media (max-width: 767px) {
  .drawer-embed.is-game .drawer-embed-frame {
    aspect-ratio: 16 / 9 !important;
  }
}

.drawer-embed.is-game .drawer-embed-frame.is-live {
  background: #000;
}

.drawer-embed-full {
  color: var(--pole-accent, var(--cardinal));
  text-decoration: none;
  font-weight: 700;
}

.drawer-embed-full:hover,
.drawer-embed-full:focus-visible {
  text-decoration: underline;
}

/* ------------------------------------------------------------
   6. GALLERY GRID
   ------------------------------------------------------------ */
.drawer-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

/* Individual image cell */
.drawer-gallery-item {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  cursor: pointer;
  background-color: var(--parchemin-dark);
  position: relative;
  /* Ring on keyboard focus for accessibility */
}

.drawer-gallery-item:focus-visible {
  outline: 2px solid var(--cardinal);
  outline-offset: 2px;
}

.drawer-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}

.drawer-gallery-item:hover img {
  transform: scale(1.05);
}

/* Image index badge removed as requested */
.drawer-gallery-item::before {
  display: none !important;
}

/* ------------------------------------------------------------
   PROJECT ARCHETYPES (TYPOLOGIES DE PROJETS)
   ------------------------------------------------------------ */

/* 1. GABARIT HERO ACTION (INTERACTIVE / LIEN / PLATEFORME) */
.drawer-hero-action {
  margin: 1.5rem 0 2.5rem;
  padding: 1.5rem 1.75rem;
  background: var(--parchemin-mid);
  border: 1px solid var(--border);
  border-left: 4px solid var(--pole-accent, var(--cardinal));
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.drawer-hero-action-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--mono-grey);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.drawer-hero-beacon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--pole-accent, var(--cardinal));
  font-weight: 700;
}

.drawer-hero-beacon::before {
  content: '';
  width: 8px;
  height: 8px;
  background-color: var(--pole-accent, var(--cardinal));
  border-radius: 50%;
  box-shadow: 0 0 8px var(--pole-accent, var(--cardinal));
  animation: beaconPulse 1.8s infinite ease-in-out;
}

@keyframes beaconPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

.drawer-hero-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.75rem;
  background: var(--anthracite);
  color: var(--white-warm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--anthracite);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(26, 26, 24, 0.12);
}

.drawer-hero-btn:hover {
  background: var(--pole-accent, var(--cardinal));
  border-color: var(--pole-accent, var(--cardinal));
  color: var(--white-warm);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 26, 26, 0.3);
}

.drawer-hero-btn-arrow {
  font-size: 1.2em;
  transition: transform 0.25s ease;
}

.drawer-hero-btn:hover .drawer-hero-btn-arrow {
  transform: translate(3px, -3px);
}

/* ── Module Parasite In Situ ("L'Insecte d'écran anti-présentiel") ── */
.drawer-parasite-control {
  border-left: 4px solid var(--cardinal) !important;
  background: var(--parchemin-mid);
  gap: 1.25rem;
}

.drawer-parasite-control .parasite-beacon {
  color: var(--cardinal);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.drawer-parasite-control .parasite-hw-indicator {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--mono-grey);
  letter-spacing: 0.08em;
}

.drawer-parasite-control .parasite-control-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.drawer-parasite-control .parasite-status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 11px;
}

.drawer-parasite-control .parasite-status-label {
  color: var(--mono-grey);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.drawer-parasite-control .parasite-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--parchemin);
}

.drawer-parasite-control .parasite-status-tag.is-active {
  border-color: var(--cardinal);
  color: var(--cardinal);
  background: rgba(139, 26, 26, 0.06);
}

.drawer-parasite-control .parasite-status-tag.is-inactive {
  border-color: var(--border);
  color: var(--mono-grey);
}

.drawer-parasite-control .parasite-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  background: var(--mono-grey);
}

.drawer-parasite-control .parasite-status-tag.is-active .parasite-status-dot {
  background: var(--cardinal);
  box-shadow: 0 0 6px var(--cardinal);
  animation: beaconPulse 1.4s infinite ease-in-out;
}

.drawer-parasite-control .parasite-control-desc {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--anthracite-light);
  margin: 0;
}

.drawer-parasite-control .parasite-toggle-btn {
  width: 100%;
  border-radius: 0;
  cursor: pointer;
  background: var(--anthracite);
  color: var(--white-warm);
}

.drawer-parasite-control .parasite-toggle-btn.is-active {
  background: var(--cardinal);
  border-color: var(--cardinal);
}

.drawer-parasite-control .parasite-toggle-btn.is-active:hover {
  background: var(--cardinal-dark, #6e1414);
  border-color: var(--cardinal-dark, #6e1414);
}

/* 2. GABARIT SÉRIE PHOTOGRAPHIQUE (PHOTOS PLEIN FORMAT) */
.drawer[data-type="photo"] .drawer-gallery {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  margin: 2.5rem 0 4rem;
}

.drawer[data-type="photo"] .drawer-gallery-item {
  aspect-ratio: auto;
  max-height: none;
  background: #121210;
  padding: 0.35rem 0.35rem 0.65rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 18px rgba(26, 26, 24, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.drawer[data-type="photo"] .drawer-gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(26, 26, 24, 0.22);
}

.drawer[data-type="photo"] .drawer-gallery-item img {
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  display: block;
}

.drawer[data-type="photo"] .drawer-gallery-item:hover img {
  transform: none;
}

.photo-meta-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #8c8880;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.photo-meta-code {
  color: var(--cardinal-light);
  font-weight: 700;
}



/* Shown when a project has no gallery images */
.drawer-no-gallery {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mono-grey);
  font-style: italic;
  letter-spacing: 0.05em;
  padding: 1rem 0;
  margin-bottom: 2rem;
}

/* ------------------------------------------------------------
   7. ACCORDION — expandable sections for extra info/metadata
   ------------------------------------------------------------ */
.accordion {
  margin-top: 2rem;
  border-bottom: 1px solid var(--border);
}

.accordion-item {
  border-top: 1px solid var(--border);
}

.accordion-item[style*="display: none"] {
  display: none !important;
  border: none !important;
}

/* Accordion trigger button */
.accordion-trigger {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--anthracite);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: left;
  transition: color var(--duration-fast);
}

.accordion-trigger:hover {
  color: var(--pole-accent, var(--cardinal));
}

/* Icon indicator — rotates 45° when open to form an × */
.accordion-trigger .acc-icon {
  color: var(--pole-accent, var(--cardinal));
  font-size: 1.2em;
  line-height: 1;
  transition: transform 0.3s var(--ease-standard);
  flex-shrink: 0;
  margin-left: var(--space-md);
}

.accordion-trigger.open .acc-icon {
  transform: rotate(45deg);
}

/* Accordion content — animated height reveal */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--anthracite-light);
  line-height: 1.8;
}

.accordion-content.open {
  /* Generous height to accommodate text and multiple images */
  max-height: 5000px;
}

/* Inner padding so the content doesn't feel cramped */
.accordion-content-inner {
  padding: 0 0 1.5rem;
}

/* Rich content styling (Textes & Images dans Artefacts / Méthodologie) */
.accordion-text-rich {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--anthracite-light);
  line-height: 1.8;
}

.accordion-rich-p {
  margin: 0;
}

/* Sélecteurs préfixés par .accordion-content pour passer devant les règles
   génériques ul/li plus bas (sinon puce « • » en plus du tiret, et retrait doublé) */
.accordion-content .accordion-rich-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.accordion-content .accordion-rich-list li {
  list-style: none;
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0;
  line-height: 1.7;
}

.accordion-rich-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--pole-accent, var(--cardinal));
  font-weight: 700;
}

/* Figures et images insérées dans les accordions */
.accordion-figure {
  margin: 1.25rem 0;
  padding: 0.75rem;
  background: var(--parchemin-mid);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 6px 18px rgba(26, 26, 24, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.accordion-figure:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(26, 26, 24, 0.1);
}

.accordion-img {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  border: 1px solid rgba(26, 26, 24, 0.08);
  transition: opacity 0.2s ease;
}

.accordion-img:hover {
  opacity: 0.92;
}

.accordion-caption {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--mono-grey);
  text-transform: uppercase;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(192, 187, 176, 0.5);
}

/* Preformatted text blocks within accordions (e.g. technical specs) */
.accordion-content pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--anthracite-light);
  background-color: var(--parchemin-mid);
  padding: var(--space-md);
  border-left: 2px solid var(--border);
  margin: var(--space-sm) 0;
  line-height: 1.6;
}

/* Lists within accordion content */
.accordion-content ul,
.accordion-content ol {
  padding-left: 1.25em;
  margin: var(--space-sm) 0;
}

.accordion-content li {
  list-style: disc;
  margin-bottom: 0.4em;
}

.accordion-content ol li {
  list-style: decimal;
}

/* Key-value metadata table within accordion */
.accordion-meta-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  margin: var(--space-sm) 0;
}

.accordion-meta-table th {
  text-align: left;
  font-weight: 400;
  color: var(--mono-grey);
  text-transform: uppercase;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  width: 35%;
}

.accordion-meta-table td {
  text-align: left;
  color: var(--anthracite-light);
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(192, 187, 176, 0.4);
}

/* Lore text within accordion */
.lore-text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--anthracite-light);
  font-style: italic;
  padding: 0.5rem 0;
}

/* Links wrapper within accordion */
.drawer-links-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-top: 0.5rem;
}

.drawer-link-item {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: var(--parchemin-mid);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--anthracite);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.drawer-link-item:hover {
  background-color: var(--cardinal);
  border-color: var(--cardinal);
  color: var(--white-warm);
}

.drawer-link-arrow {
  color: var(--cardinal);
  transition: color 0.2s ease, transform 0.2s ease;
}

.drawer-link-item:hover .drawer-link-arrow {
  color: var(--white-warm);
  transform: translate(2px, -2px);
}

/* ------------------------------------------------------------
   8. LIGHTBOX — full-screen image viewer
   ------------------------------------------------------------ */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(26, 26, 24, 0.95);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  /* Ensure lightbox is above drawer (z-index 201) */
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

/* The displayed image — constrained to viewport with padding */
.lightbox-img {
  max-width: 85vw;
  max-height: 85vh;
  object-fit: contain;
  display: block;
  /* Subtle entrance animation when lightbox opens */
  animation: fadeIn 0.25s ease both;
}

/* Close button — top-right corner */
.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--white-warm);
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: var(--space-xs) var(--space-sm);
  transition: color var(--duration-base), opacity var(--duration-base);
  z-index: 10;
}

.lightbox-close:hover {
  color: var(--cardinal-light);
  opacity: 0.85;
}

/* Previous / Next navigation buttons */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2rem;
  font-size: 1.5rem;
  color: var(--white-warm);
  transition: color var(--duration-base), opacity var(--duration-base);
  z-index: 10;
  /* Large click target for usability */
  line-height: 1;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  color: var(--cardinal-light);
  opacity: 0.85;
}

/* Lightbox caption / counter */
.lightbox-caption {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(244, 241, 236, 0.55);
  letter-spacing: 0.1em;
  text-align: center;
  white-space: nowrap;
}

/* Indicator dots for image position */
.lightbox-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.lightbox-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: rgba(244, 241, 236, 0.3);
  transition: background-color var(--duration-base);
}

.lightbox-dot.active {
  background-color: var(--cardinal);
}

/* ------------------------------------------------------------
   9. DRAWER CHILD PROJECTS LIST
   Child projects shown within parent drawer
   ------------------------------------------------------------ */
.drawer-children {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
}

.drawer-children-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mono-grey);
  padding: var(--space-md) 0 var(--space-sm);
}

.drawer-child-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(192, 187, 176, 0.4);
  cursor: pointer;
  transition: color var(--duration-base);
}

.drawer-child-item:hover .drawer-child-title {
  color: var(--cardinal);
}

.drawer-child-code {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--mono-grey);
  letter-spacing: 0.08em;
  flex-shrink: 0;
  width: 80px;
}

.drawer-child-title {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.5vw, 36px);
  color: var(--anthracite);
  line-height: 0.9;
  flex: 1;
  transition: color var(--duration-base);
}

.drawer-child-year {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--anthracite-light);
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   10. MOBILE RESPONSIVE — 768px and below
   ------------------------------------------------------------ */
@media (max-width: 767px) {

  /* Overlay allégé sans backdrop-filter coûteux pour mobile GPU */
  .drawer-overlay {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background-color: rgba(26, 26, 24, 0.45);
    transition: opacity 0.25s ease;
  }

  /* Full-viewport drawer on mobile — no peek */
  .drawer {
    width: 100vw;
    max-width: none;
    border-left: none;
    /* Transition fluide purement matérielle (transform GPU 60fps) */
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  /* Ouverture allégée sur smartphone (remplace retroApertureOpen avec clip-path/filtres) */
  .drawer.open {
    animation: none !important;
    transform: translateX(0) !important;
    clip-path: none !important;
    filter: none !important;
  }

  /* Fermeture allégée sur smartphone (remplace retroApertureClose avec clip-path/filtres) */
  .drawer.closing {
    animation: none !important;
    transform: translateX(100%) !important;
    clip-path: none !important;
    filter: none !important;
    transition: transform 0.24s cubic-bezier(0.4, 0, 1, 1) !important;
  }

  /* Désactivation des balayages lourds de lignes cathodiques sur smartphone */
  .drawer.open::before,
  .drawer.open::after,
  .drawer.closing::after {
    display: none !important;
    content: none !important;
  }

  /* Suppression des délais et reflows d'éléments internes lors de l'ouverture mobile */
  .drawer.open .drawer-header,
  .drawer.open .drawer-hero-action,
  .drawer.open .drawer-summary,
  .drawer.open .drawer-description,
  .drawer.open .drawer-gallery {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  /* Adjust drawer inner padding for smaller screens */
  .drawer-inner {
    padding: 2.25rem 1.25rem 5rem;
  }

  /* Typographie mobile proportionnée et nette */
  .drawer-code {
    font-size: 11px;
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
  }

  .drawer-title {
    font-size: clamp(24px, 7.5vw, 48px);
    line-height: 0.92;
    margin-bottom: 1.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    min-width: 0;
  }

  /* Stack metadata items on mobile */
  .drawer-subtitle {
    flex-direction: column;
    gap: var(--space-xs);
    font-size: 11px;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
  }

  .drawer-summary {
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 2rem;
  }

  .drawer-description {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 2rem;
  }

  .accordion-trigger {
    font-size: 11px;
    letter-spacing: 0.1em;
    padding: 1.1rem 0;
  }

  .accordion-content {
    font-size: 0.92rem;
    line-height: 1.65;
  }

  /* Gallery adapts to fewer columns on narrow viewports */
  .drawer-gallery {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.4rem;
  }

  /* Contours photos discrets et fins sur smartphone (supprime les gros encadrements noirs) */
  .drawer[data-type="photo"] .drawer-gallery {
    gap: 1.5rem;
    margin: 1.5rem 0 2.5rem;
  }

  .drawer[data-type="photo"] .drawer-gallery-item {
    padding: 3px 3px 6px;
    gap: 0.35rem;
    border: 1px solid rgba(26, 26, 24, 0.12);
    box-shadow: none;
    background: #141311;
  }

  .photo-meta-strip {
    font-size: 8.5px;
    padding-top: 0.35rem;
    letter-spacing: 0.08em;
  }

  /* Lightbox prev/next have smaller padding on mobile */
  .lightbox-prev,
  .lightbox-next {
    padding: 1rem;
    font-size: 1.2rem;
  }

  .lightbox-prev {
    left: 0;
  }

  .lightbox-next {
    right: 0;
  }

  .lightbox-img {
    max-width: 95vw;
    max-height: 80vh;
  }

  /* Close button uses sticky behavior — ensure it stays visible */
  .drawer-close {
    top: 1rem;
  }
}

/* ------------------------------------------------------------
   11. TABLET & IPAD — 768px – 1024px intermediate adjustments & crisp text
   ------------------------------------------------------------ */
@media (min-width: 768px) and (max-width: 1024px) {

  .drawer {
    width: 88vw;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  /* Désactivation des filtres GPU et clip-path sur tablette/iPad pour garantir des textes d'une netteté absolue */
  .drawer.open {
    animation: none !important;
    transform: translateX(0) !important;
    clip-path: none !important;
    filter: none !important;
  }

  .drawer.closing {
    animation: none !important;
    transform: translateX(100%) !important;
    clip-path: none !important;
    filter: none !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 1, 1) !important;
  }

  .drawer.open::before,
  .drawer.open::after,
  .drawer.closing::after {
    display: none !important;
    content: none !important;
  }

  .drawer.open .drawer-header,
  .drawer.open .drawer-hero-action,
  .drawer.open .drawer-summary,
  .drawer.open .drawer-description,
  .drawer.open .drawer-gallery,
  .drawer.open .accordion {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .drawer-inner {
    padding: 2.5rem 2rem 5rem;
  }

  .drawer-title {
    font-size: clamp(40px, 9vw, 100px);
  }

  .drawer-gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* ------------------------------------------------------------
   12. IPAD & DISPOSITIFS TACTILES TOUTES TAILLES (Y COMPRIS PAYSAGE 11" & 12.9")
   Empêche tout artefact de rasterisation WebKit sur écran Retina
   ------------------------------------------------------------ */
@media (hover: none) and (pointer: coarse) {
  .drawer.open {
    clip-path: none !important;
    filter: none !important;
  }

  .drawer.open::before,
  .drawer.open::after {
    display: none !important;
  }

  .drawer.open .drawer-header,
  .drawer.open .drawer-hero-action,
  .drawer.open .drawer-summary,
  .drawer.open .drawer-description,
  .drawer.open .drawer-gallery,
  .drawer.open .accordion {
    filter: none !important;
  }

  .drawer-title,
  .drawer-summary,
  .drawer-description,
  .drawer-code,
  .drawer-subtitle {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
}

