/* ============================================================
   STÉPHANE ALUNNO — Refonte design -28
   CSS global unifié et propre
   ============================================================ */

/* === Variables === */
:root {
  --font-main: 'CaviarDreamsRegular', tahoma, arial;
  --c-black: #000;
  --c-white: #fff;
  --c-gray: #777;
  --c-border: #e8e8e8;
  --header-h: 70px;
  --medium-nav-h: 38px;
  --edge: clamp(16px, 4vw, 48px);
  --gap: clamp(12px, 2vw, 24px);
  --max-w: 1440px;
}

/* === Fonts (Caviar Dreams depuis le site -27) === */
@font-face {
  font-family: 'CaviarDreamsRegular';
  src: url('../Stephane Alunno PHOTO -27 matomo suivi visites - EN LIGNE/font/caviar/CaviarDreams-webfont.woff') format('woff'),
       url('../Stephane Alunno PHOTO -27 matomo suivi visites - EN LIGNE/font/caviar/CaviarDreams-webfont.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'CaviarDreamsRegular';
  src: url('../Stephane Alunno PHOTO -27 matomo suivi visites - EN LIGNE/font/caviar/Caviar_Dreams_Bold-webfont.woff') format('woff'),
       url('../Stephane Alunno PHOTO -27 matomo suivi visites - EN LIGNE/font/caviar/Caviar_Dreams_Bold-webfont.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  color: var(--c-black);
  background: var(--c-white);
  overflow-x: hidden;
}

/* Décalage pour les ancres / navigation : contenu jamais caché sous le header + medium-nav */
html {
  scroll-padding-top: calc(var(--header-h) + var(--medium-nav-h) + 16px);
}

body { padding-top: var(--header-h); }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }


/* ============================================================
   HEADER
   ============================================================ */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--c-white);
  z-index: 100;
  border-bottom: 1px solid var(--c-border);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--edge);
  max-width: var(--max-w);
  margin: 0 auto;
  gap: 2rem;
}

.site-name {
  font-size: clamp(14px, 1.5vw, 19px);
  letter-spacing: 0.22em;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

#main-nav { flex: 1; }

#main-nav ul {
  display: flex;
  justify-content: flex-end;
  gap: clamp(16px, 2vw, 32px);
  list-style: none;
  margin: 0; padding: 0;
}

#main-nav a {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#main-nav a:hover { text-decoration: underline; }

/* Burger */
#burger {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 56px;
  height: var(--header-h);
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--c-black);
  z-index: 200;
  line-height: 1;
}

@media (max-width: 768px) {
  #burger { display: flex; }

  #main-nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--c-white);
    border-bottom: 1px solid var(--c-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    z-index: 150;
  }

  #main-nav.open { max-height: 400px; }

  #main-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px var(--edge);
  }

  #main-nav li + li { border-top: 1px solid var(--c-border); }
  #main-nav a { display: block; padding: 12px 0; }
}


/* ============================================================
   MEDIUM NAV — switcher de médium
   ============================================================ */
.medium-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(20px, 3vw, 48px);
  height: var(--medium-nav-h);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-white);
  position: sticky;
  top: var(--header-h);
  z-index: 90;
}

.medium-nav a {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-gray);
  transition: color 0.2s;
  padding: 2px 0;
  white-space: nowrap;
}

.medium-nav a:hover { color: var(--c-black); }

.medium-nav a.active {
  color: var(--c-black);
  border-bottom: 1px solid var(--c-black);
  padding-bottom: 1px;
}

@media (max-width: 480px) {
  .medium-nav {
    gap: 16px;
    padding: 0 var(--edge);
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
}


/* ============================================================
   HOME — TRIPTYQUE
   3 panneaux pleine hauteur, un par médium
   ============================================================ */
.triptyque {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(100dvh - var(--header-h));
  gap: 2px;
  background: #111;
}

.medium-panel {
  position: relative;
  overflow: hidden;
  display: block;
}

.panel-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.8);
  transition: filter 0.6s ease, transform 0.6s ease;
}

.medium-panel:hover .panel-bg {
  filter: brightness(1);
  transform: scale(1.04);
}

.panel-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: clamp(32px, 6vh, 72px);
}

.panel-label {
  color: var(--c-white);
  font-size: clamp(11px, 1.1vw, 15px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
}

.panel-line {
  display: block;
  width: 20px;
  height: 1px;
  background: rgba(255,255,255,0.45);
  margin: 12px auto 0;
  transition: width 0.5s ease, background 0.5s ease;
}

.medium-panel:hover .panel-line {
  width: 44px;
  background: rgba(255,255,255,0.85);
}

@media (max-width: 640px) {
  .triptyque {
    grid-template-columns: 1fr;
    height: auto;
    gap: 2px;
  }
  .medium-panel { height: 38vh; }
  .panel-label { font-size: 10px; letter-spacing: 0.28em; }
}


/* ============================================================
   MEDIUM PORTAL — liste des séries
   ============================================================ */
.portal-intro {
  padding: clamp(40px, 5vw, 72px) var(--edge) clamp(24px, 3vw, 40px);
  text-align: center;
}

.portal-title {
  font-size: clamp(12px, 1.3vw, 16px);
  letter-spacing: 0.32em;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--c-black);
  margin: 0;
}

.portal-desc {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--c-gray);
  margin-top: 8px;
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  padding: 0 var(--edge) clamp(64px, 8vw, 96px);
}

@media (max-width: 1024px) { .series-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .series-grid { grid-template-columns: 1fr; } }

.series-card { display: block; }

.series-card-img {
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #f0f0f0;
}

.series-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.45s ease, transform 0.55s ease;
}

.series-card:hover .series-card-img img {
  filter: brightness(0.8);
  transform: scale(1.03);
}

.series-card-label {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  line-height: 1.35;
  color: var(--c-black);
}

.series-card-medium {
  display: block;
  font-size: 0.72rem;
  color: var(--c-gray);
  margin-top: 2px;
  letter-spacing: 0.04em;
  font-style: italic;
}


/* ============================================================
   GALLERY PAGE — page de série
   ============================================================ */
.gallery-wrap {
  padding: clamp(80px, 8vw, 100px) var(--edge) clamp(48px, 6vw, 80px);
}

.thumb-grid {
  display: block;
  column-count: 3;
  column-gap: var(--gap);
}

@media (max-width: 1024px) { .thumb-grid { column-count: 2; } }
@media (max-width: 540px)  { .thumb-grid { column-count: 1; } }

.thumb {
  display: block;
  break-inside: avoid-column;
  -webkit-column-break-inside: avoid;
  margin-bottom: var(--gap);
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: auto;
  border: none;
  transition: filter 0.35s ease;
}

.thumb:hover img { filter: brightness(0.8); }

/* Texte de présentation sous la galerie */
.series-text {
  padding: clamp(16px, 2vw, 32px) var(--edge) clamp(80px, 10vw, 120px);
}

.series-text h2 {
  font-size: clamp(13px, 1.3vw, 17px);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 1.2rem;
}

.series-text p {
  font-size: 0.87rem;
  line-height: 1.75;
  color: var(--c-gray);
  margin: 0 0 1em;
}

.series-medium-tag {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-gray);
  margin-bottom: 0.5rem;
  display: block;
}


/* ============================================================
   LIGHTBOX — plein écran, fond crème blanc cassé
   ============================================================ */
.lb {
  position: fixed;
  inset: 0;           /* top/right/bottom/left: 0 — couvre toujours le viewport réel */
  background: #f7f4ef;
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
}

.lb.open {
  display: flex;
  cursor: pointer; /* iOS Safari : déclenche les events click sur éléments non-interactifs */
}

/* Blocage du scroll derrière */
html.lb-open,
body.lb-open {
  overflow: hidden !important;
  height: 100% !important;
}
body.lb-open { padding-top: 0 !important; }

/* Bouton fermer — fixed, toujours visible */
.lb-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: max(14px, env(safe-area-inset-right, 0px));
  z-index: 10000;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 50%;
  color: rgba(0,0,0,0.55);
  font-size: 18px;
  line-height: 1;
  transition: background 0.2s;
  appearance: none;
}

.lb-close:hover { background: rgba(0,0,0,0.12); }

@media (max-width: 640px) {
  .lb-close { width: 44px; height: 44px; font-size: 20px; }
}

/* Zone image — desktop: limitée à 1200px, mobile: plein écran */
.lb-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1200px;
  min-height: 0;
  overflow: hidden;           /* évite le débordement du swiper en paysage */
  padding-top: 54px; /* espace pour le bouton fermer */
}

@media (max-width: 640px) {
  .lb-body { max-width: 100%; padding-top: 50px; }
}

/* Swiper */
#swiperMain { width: 100%; height: 100%; }

#swiperMain .swiper-wrapper,
#swiperMain .swiper-slide { height: 100%; }

#swiperMain .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
}

#swiperMain .swiper-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: manipulation;
}

/* Pied lightbox : légende centrée */
.lb-footer {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 72px max(14px, env(safe-area-inset-bottom, 0px)) 72px;
}

/* Mobile portrait */
@media (max-width: 640px) {
  .lb-footer {
    max-width: 100%;
    padding: 0 60px max(10px, env(safe-area-inset-bottom, 0px));
    min-height: 54px;
    align-items: center;
  }
}

.lb-caption {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(0,0,0,0.5);
  text-align: center;
  min-height: 16px;
}

/* Conteneur nav : sorti du flux sans display:none (qui cacherait les boutons fixed) */
.lb-nav {
  position: absolute;
  width: 0;
  height: 0;
  overflow: visible;
}

/* ── Flèches desktop : centrées verticalement sur les bords ── */
#prevBtn,
#nextBtn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10001;
  appearance: none;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.04);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgba(0,0,0,0.45);
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 16px;
  display: grid; place-items: center;
  transition: all 0.2s;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

#prevBtn { left: max(16px, env(safe-area-inset-left, 0px)); }
#nextBtn { right: max(16px, env(safe-area-inset-right, 0px)); }

#prevBtn:hover,
#nextBtn:hover { background: rgba(0,0,0,0.1); color: rgba(0,0,0,0.85); border-color: rgba(0,0,0,0.2); }

#prevBtn:disabled,
#nextBtn:disabled { opacity: 0.18; cursor: not-allowed; }

/* ── Tap-to-show UI ──
   Desktop (hover:hover) : contrôles toujours visibles, la classe n'a aucun effet.
   Mobile/tactile (hover:none) : contrôles masqués par défaut, révélés au tap.
────────────────────────────────────────────────────────── */
.lb-close,
.lb-footer {
  transition: opacity 0.28s ease, background 0.2s ease;
}

@media (hover: none) {
  .lb--ui-hidden .lb-close,
  .lb--ui-hidden #prevBtn,
  .lb--ui-hidden #nextBtn,
  .lb--ui-hidden .lb-footer {
    opacity: 0;
    pointer-events: none;
  }
}

/* ── Flèches mobile portrait : en bas à côté de la légende ── */
@media (max-width: 640px) {
  #prevBtn,
  #nextBtn {
    top: auto;
    bottom: max(7px, env(safe-area-inset-bottom, 0px));
    transform: none;
    width: 40px; height: 40px;
    font-size: 14px;
  }
  #prevBtn { left: max(10px, env(safe-area-inset-left, 0px)); }
  #nextBtn { right: max(10px, env(safe-area-inset-right, 0px)); }
}

/* ── Mobile paysage : image plein écran, UI en overlay ── */
@media (max-height: 500px) {
  /* .lb-body remplit tout l'espace — le footer ne consomme plus de hauteur */
  .lb-body {
    padding-top: 0;
    max-width: 100%;
  }

  /* Footer en overlay semi-transparent en bas de l'image */
  .lb-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-width: 100%;
    padding: 5px 56px max(5px, env(safe-area-inset-bottom, 0px));
    min-height: 34px;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
  }

  /* Bouton fermer : légèrement plus haut vers le bord */
  .lb-close { top: max(6px, env(safe-area-inset-top, 0px)); }

  /* Flèches : sur les côtés, centrées verticalement (pas en bas) */
  #prevBtn,
  #nextBtn {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: 38px; height: 38px;
    font-size: 13px;
  }
  #prevBtn { left: max(8px, env(safe-area-inset-left, 0px)); }
  #nextBtn { right: max(8px, env(safe-area-inset-right, 0px)); }
}


/* ============================================================
   PAGES TEXTE — Infos & Contact
   ============================================================ */

/* Conteneur centré avec air généreux */
.page-content {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(48px, 6vw, 80px) var(--edge) clamp(72px, 9vw, 112px);
}

/* Titres */
.page-content h1 {
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-black);
  margin: 0 0 clamp(28px, 4vw, 48px);
  line-height: 1.3;
}

.page-content h2 {
  font-size: clamp(11px, 1.1vw, 14px);
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-black);
  margin: clamp(36px, 5vw, 60px) 0 1rem;
}

.page-content h3 {
  font-size: clamp(11px, 1vw, 13px);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-gray);
  margin: clamp(28px, 4vw, 48px) 0 0.8rem;
}

/* Paragraphes avec air et lisibilité */
.page-content p {
  font-size: 0.88rem;
  line-height: 1.9;
  color: var(--c-gray);
  margin: 0 0 1.4em;
}

/* Listes d'expositions / publications : chaque <br> donne déjà un saut,
   on ajoute juste du souffle vertical au bloc */
.page-content p br + br { display: none; } /* évite les doubles sauts parasites */

/* Liens dans le contenu */
.page-content a {
  color: var(--c-black);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.page-content a:hover { color: var(--c-gray); }

/* Image bio (sa.html) */
.bio-photo {
  width: clamp(160px, 28vw, 280px);
  height: auto;
  display: block;
  margin: clamp(36px, 5vw, 64px) auto;
}

/* Portrait contact (contactphoto.html) */
.portrait {
  width: clamp(140px, 22vw, 240px);
  height: auto;
  display: block;
  margin: clamp(32px, 4vw, 56px) auto;
}

/* Liste d'expositions / publications */
.expo-list {
  list-style: none;
  margin: 0 0 1.4em;
  padding: 0;
}

.expo-list li {
  display: grid;
  grid-template-columns: 10em 1fr;
  gap: 0 1.2em;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--c-gray);
  padding: 0.55em 0;
  border-bottom: 1px solid var(--c-border);
}

.expo-list li:first-child { border-top: 1px solid var(--c-border); }

.expo-date {
  color: var(--c-black);
  white-space: nowrap;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  padding-top: 0.05em;
}

.expo-type {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.35);
  margin-left: 0.5em;
}

/* Liens réseaux sociaux (contact) */
.social-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.social-list li {
  padding: 0.6em 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.88rem;
}

.social-list li:first-child { border-top: 1px solid var(--c-border); }

.social-list a {
  color: var(--c-black);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.social-list a:hover { text-decoration: underline; }

/* Mobile : liste expo en colonne simple */
@media (max-width: 540px) {
  .expo-list li {
    grid-template-columns: 1fr;
    gap: 0.15em 0;
  }
}

/* ============================================================
   JUSTIFIED ROW GALLERY — rangées justifiées bord à bord
   ============================================================ */
.thumb-grid--justified {
  /* reset column-count */
  column-count: unset;
  column-gap: unset;
  /* flex row layout */
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-content: flex-start;
}

.thumb-grid--justified .thumb {
  flex-shrink: 0;
  margin-bottom: 0;        /* reset du layout colonnes */
  break-inside: auto;
  -webkit-column-break-inside: auto;
  overflow: hidden;
  /* width & height posés par JS */
}

.thumb-grid--justified .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;      /* sans cropping grâce au ratio exact */
  display: block;
}


/* ============================================================
   SECTION HEADER — séparateur entre deux séries sur une même page
   ============================================================ */
.series-section-header {
  padding: clamp(48px, 6vw, 80px) var(--edge) clamp(20px, 2.5vw, 32px);
  border-top: 1px solid var(--c-border);
}

.series-section-header h2 {
  font-size: clamp(12px, 1.2vw, 15px);
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-black);
  margin: 0 0 0.6rem;
}

.series-section-header p {
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--c-gray);
  margin: 0 0 0.8em;
}

/* Première section (pas de border-top) */
.series-section-header:first-of-type {
  border-top: none;
  padding-top: clamp(32px, 4vw, 56px);
}

/* Galerie qui suit directement un section-header : espace réduit (le header fournit déjà l'espacement) */
.series-section-header + .gallery-wrap {
  padding-top: clamp(20px, 2vw, 32px);
}

/* Deuxième galerie sur la même page (ex. pochoir) : pas de padding-top supplémentaire */
.gallery-wrap + .series-section-header + .gallery-wrap {
  padding-top: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
  padding: 20px var(--edge) 36px;
  border-top: 1px solid var(--c-border);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--c-gray);
}

#footer a { color: inherit; }
#footer a:hover { text-decoration: underline; }

.footer-left { text-align: left; }
.footer-center { text-align: center; }
.footer-right ul { display: flex; justify-content: flex-end; gap: 16px; }

@media (max-width: 640px) {
  #footer { grid-template-columns: 1fr; gap: 6px; }
  .footer-left, .footer-center { text-align: center; }
  .footer-right ul { justify-content: center; }
}
