/*
 * Les Transnumériques | Landing page, version 1
 * Styles structurés : base, panneaux, survol, About, mobile, accessibilité.
 * Les réglages globaux se trouvent dans panels.js (design / logo).
 */
:root {
  --motion-duration: 800ms;
  --motion-easing: ease-in-out;
  --panel-grow: 9;
  --about-grow: 15;
  --title-opacity: .5;
  --title-hover-opacity: .83;
  --title-desktop-size: clamp(20px, 2.1vw, 36px);
  --title-mobile-size: clamp(19px, 5.2vw, 27px);
  --mobile-min-panel-height: 74px;
  --separator-color: rgba(255,255,255,.85);
  --action-background: rgba(0,0,0,.8);
  --panel-count: 8;
}

*, *::before, *::after { box-sizing: border-box; }
html { margin: 0; background: #0d0d0d; }
body {
  margin: 0;
  min-width: 280px;
  font-family: Arial, Helvetica, sans-serif;
  color: #fff;
  background: #0d0d0d;
  overflow: hidden;
}
#app { position: relative; min-height: 100vh; min-height: 100dvh; }

/* Logo superposé, indépendant de la taille des panneaux. */
.festival-logo {
  position: fixed;
  z-index: 15;
  top: clamp(13px, 1.7vw, 30px);
  width: var(--logo-desktop-width, 280px);
  line-height: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(255,255,255,.12));
}
.logo-right { right: clamp(14px, 1.8vw, 30px); }
.logo-left  { left: clamp(14px, 1.8vw, 30px); }
.festival-logo img { display: block; width: 100%; height: auto; }
.festival-logo .logo-main { position: relative; opacity: 1; }
.festival-logo .logo-alt {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 220ms ease;
}
/* About reçoit un fond sombre au survol : basculer vers la variante claire du logo. */
@media (min-width: 821px) and (hover: hover) and (pointer: fine) {
  #app:has(.panel-about:hover, .panel-about:focus-visible) .logo-main { opacity: 0; }
  #app:has(.panel-about:hover, .panel-about:focus-visible) .logo-alt { opacity: 1; }
}

/* Panneaux plein écran et images proportionnelles. */
.panels {
  position: relative;
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}
.panel {
  position: relative;
  display: block;
  flex: 1 1 0%;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #222;
  color: inherit;
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  transition: flex-grow var(--motion-duration) var(--motion-easing);
  -webkit-tap-highlight-color: transparent;
}
.panel + .panel { border-left: 2px solid var(--separator-color); }
.panel:focus-visible { outline: 3px solid #fbd54e; outline-offset: -4px; z-index: 8; }
.panel-image {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  object-position: var(--desktop-image-position, center);
  filter: brightness(var(--image-brightness, 1));
  transition: filter var(--motion-duration) ease;
  user-select: none;
  pointer-events: none;
}
.panel-shade {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(0,0,0,.14) 0%, transparent 19%, transparent 74%, rgba(0,0,0,.24) 100%);
  pointer-events: none;
}

/* Titres alternés : vers le haut pour les panneaux pairs, vers le bas pour les impairs. */
.panel-title {
  position: absolute;
  z-index: 2;
  left: 50%;
  display: block;
  width: max-content;
  max-height: calc(100% - 48px);
  writing-mode: vertical-rl;
  white-space: nowrap;
  text-align: center;
  font-size: var(--title-desktop-size);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: #fff;
  opacity: var(--title-opacity);
  text-shadow: 0 1px 10px rgba(0,0,0,.25);
  pointer-events: none;
  transition: opacity 280ms ease;
  background:#000;
}
.direction-up .panel-title {
  bottom: clamp(20px, 3.2vh, 42px);
  transform: translateX(-50%) rotate(180deg);
}
.direction-down .panel-title {
  top: clamp(20px, 3.2vh, 42px);
  transform: translateX(-50%);
}

/* Cartouche central au survol, tous les liens restent cliquables sur toute leur surface. */
.panel-action {
  position: absolute;
  z-index: 5;
  left: 50%; top: 50%;
  transform: translate(-50%, calc(-50% + 8px));
  opacity: 0;
  padding: 12px 21px;
  background: var(--action-background);
  color: #fff;
  font-size: clamp(10px, .95vw, 13px);
  font-weight: 700;
  letter-spacing: .16em;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

/* Texte About : panneau élargi, fond noir translucide, défilement si nécessaire. */
.about-preview {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(13px, 2vh, 24px);
  padding: clamp(24px, 4.5vw, 72px);
  padding-top: clamp(115px, 13vh, 160px);
  background: rgba(9, 14, 17, .94);
  color: #eee;
  opacity: 0;
  overflow-y: auto;
  pointer-events: none;
  transition: opacity 280ms ease;
}
/* Texte anglais du panneau About */
.about-preview-paragraph:nth-last-child(-n+2),
.dialog-paragraph:nth-of-type(n+3) {
  color: #29b3e4;
}

.about-preview-heading {
  font-size: clamp(21px, 1.8vw, 31px);
  font-weight: 700;
  line-height: 1.3;
  border-left: 4px solid #29b3e4;
  padding-left: 14px;
}
.about-preview-paragraph {
  display: block;
  max-width: 75ch;
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.65;
  font-weight: 400;
}

@media (min-width: 821px) and (hover: hover) and (pointer: fine) {
  .panel:hover { flex-grow: var(--panel-expand, var(--panel-grow)); }
  .panel:hover .panel-title { opacity: var(--title-hover-opacity); }
  .panel:hover .panel-action {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  .panel-about:hover .about-preview { opacity: 1; pointer-events: auto; }
  .panel-about:hover .panel-title, .panel-about:hover .panel-action { opacity: 0; }
}
@media (min-width: 821px) and (hover: hover) and (pointer: fine) {
  .panel:focus-visible { flex-grow: var(--panel-expand, var(--panel-grow)); }
  .panel:focus-visible .panel-title { opacity: var(--title-hover-opacity); }
  .panel:focus-visible .panel-action { opacity: 1; transform: translate(-50%, -50%); }
  .panel-about:focus-visible .about-preview { opacity: 1; pointer-events: auto; }
  .panel-about:focus-visible .panel-title, .panel-about:focus-visible .panel-action { opacity: 0; }
}

/* Fenêtre About (ouverte au clic, notamment sur mobile). */
.about-dialog {
  position: fixed;
  margin: auto;
  width: min(860px, calc(100vw - 28px));
  max-height: min(89dvh, 920px);
  padding: 0;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 0;
  background: #121719;
  color: #f4f5f6;
  box-shadow: 0 28px 110px rgba(0,0,0,.55);
  overflow-y: auto;
}
.about-dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(5px); }
.dialog-content { padding: clamp(36px, 6vw, 70px); }
.dialog-heading {
  margin: 0 54px 30px 0;
  padding-left: 16px;
  border-left: 4px solid #2ba8da;
  font-size: clamp(26px, 4.6vw, 40px);
  line-height: 1.15;
  letter-spacing: -.025em;
}
.dialog-paragraph { margin: 0 0 1.2em; font-size: clamp(15px, 1.45vw, 18px); line-height: 1.7; }
.dialog-links { margin-top: 28px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.2); display: flex; flex-wrap: wrap; gap: 11px 25px; }
.dialog-link { color: #8edfff; text-underline-offset: 4px; }
.dialog-link:hover { color: #fff; }
.dialog-close {
  position: sticky;
  z-index: 1;
  float: right;
  top: 13px;
  right: 13px;
  margin: 13px 13px -55px 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  background: #090d0f;
  color: #fff;
  cursor: pointer;
  font: 32px/1 Arial, sans-serif;
}
.dialog-close:focus-visible, .dialog-link:focus-visible { outline: 3px solid #fbd54e; outline-offset: 3px; }
body.dialog-open { overflow: hidden; }
.no-script { margin: 10vh auto; max-width: 60ch; padding: 24px; line-height: 1.6; }
.no-script a { color: #80d1ff; }

/* Téléphone, tablette tactile ou écran étroit : bandes horizontales empilées. */
@media (max-width: 820px), (hover: none), (pointer: coarse) {
  body { overflow-x: hidden; overflow-y: auto; }
  .panels {
    flex-direction: column;
    height: max(100dvh, calc(var(--panel-count) * var(--mobile-min-panel-height)));
    min-height: 100dvh;
    overflow: visible;
  }
  .panel {
    flex: 1 1 0%;
    width: 100%;
    min-width: 100%;
    min-height: var(--mobile-min-panel-height);
    height: auto;
    transition: none;
  }
  .panel + .panel { border-left: 0; border-top: 2px solid var(--separator-color); }
  .panel-image { object-position: var(--mobile-image-position, center); }
  .panel-shade { background: linear-gradient(to bottom, rgba(0,0,0,.04), rgba(0,0,0,.05) 30%, rgba(0,0,0,.58)); }
  .panel-title,
  .direction-up .panel-title,
  .direction-down .panel-title {
    inset: auto auto 11px 19px;
    width: auto;
    max-height: none;
    writing-mode: horizontal-tb;
    transform: none;
    opacity: 1;
    color: #fff;
    font-size: var(--title-mobile-size);
    line-height: 1.1;
    letter-spacing: -.015em;
    text-shadow: 0 1px 4px rgba(0,0,0,.7), 0 2px 12px rgba(0,0,0,.38);
  }
  .panel-action { display: none; }
  .about-preview { display: none; }
  .festival-logo { top: 9px; width: var(--logo-mobile-width, 160px); }
  .logo-right { right: 11px; }
  .logo-left { left: 11px; }
  .dialog-content { padding: 44px 24px 28px; }
}
@media (max-height: 600px) and (min-width: 821px) and (hover: hover) and (pointer: fine) {
  .about-preview { padding-top: 30px; gap: 10px; }
  .about-preview-paragraph { font-size: 14px; line-height: 1.45; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}


/* Trois dernières éditions plus larges sur ordinateur */
@media (min-width: 821px) and (hover: hover) and (pointer: fine) {

  .panel:nth-child(-n+3) {
    flex-grow: 1.4;
  }

  /* Conserver l'expansion normale au survol */
  .panel:nth-child(-n+3):hover,
  .panel:nth-child(-n+3):focus-visible {
    flex-grow: var(--panel-expand, var(--panel-grow));
  }

}

