/* ============================================
   MARIE DUFRÈNE-PLANCHER — SITE VITRINE
   Style principal
   ============================================ */

@font-face {
  font-family: 'SugoProClassic';
  src: url('fonts/SugoProClassic-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'SugoProClassic';
  src: url('fonts/SugoProClassic-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
}
@font-face {
  font-family: 'SugoProClassic';
  src: url('fonts/SugoProClassic-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}

/* ── Variables ── */
:root {
  --color-sculpt: #4a7fa5;
  --color-dessin: #9e3d6a;
  --color-active: #8a8a00;
  --color-nav-bg: #f0eeeb;
  --color-border: #ccc;
  --color-text: #1a1a1a;
  --color-text-light: #555;
  --color-white: #ffffff;
  --nav-height: 62px;
  --nav-bar-h: 10px;
  --font-main: 'SugoProClassic', 'Georgia', serif;
  --font-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --transition: 0.25s ease;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-white);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2vh 2vw;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ── Cadre principal (le carré de la maquette) ── */
.site-frame {
  width: 100%;
  max-width: 848px;
  min-height: 877px;
  border: 1px solid #999;
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: var(--color-white);
  position: relative;
  margin-bottom: 2vh;
}

/* ── Navigation ── */
.nav {
  position: relative;
  z-index: 10;
  background: #ffffff;
  height: var(--nav-height);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  margin-top: 25px;
  margin-bottom: 30px;
}

/* Barre grise sous brand + liens uniquement (s'arrête avant "En") */
.nav-inner {
  display: flex;
  align-items: stretch;
  width: 100%;
  padding: 0 7%;
  gap: 0;
  position: relative;
  z-index: 1;
}

/* Wrapper brand + liens — la barre part du M de Marie et finit au t de Contact */
.nav-menu {
  display: flex;
  align-items: stretch;
  position: relative;
}

.nav-menu::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;        /* aligné sur le M de Marie */
  right: 22px;    /* recule du padding droit du dernier lien = finit au t de Contact */
  height: var(--nav-bar-h);
  background: #c8c8c8;
  pointer-events: none;
  z-index: 0;
}

.nav-brand {
  font-family: var(--font-main);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: flex-end;
  white-space: nowrap;
  color: var(--color-text);
  margin-right: 32px;
  flex-shrink: 0;
  padding-bottom: 8px;
  position: relative;
  z-index: 1;
  transition: color var(--transition);
}

.nav-brand::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-bar-h);
  background: transparent;
  transition: background var(--transition);
  z-index: 2;
}

.nav-brand:hover { color: var(--color-active); }
.nav-brand:hover::after { background: #ffffff; }

.nav-links {
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
  z-index: 1;
}

.nav-link {
  font-family: var(--font-main);
  font-weight: 400;
  font-size: 1.5rem;
  padding: 0 22px 8px;
  display: flex;
  align-items: flex-end;
  position: relative;
  color: var(--color-text);
  transition: color var(--transition);
  white-space: nowrap;
}

/* "Perce" la barre grise en blanc sur le bouton survolé/actif */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 22px;
  right: 22px;
  height: var(--nav-bar-h);
  background: transparent;
  transition: background var(--transition);
  z-index: 2;
}

.nav-link:hover { color: var(--color-active); }
.nav-link:hover::after { background: #ffffff; }

.nav-link.active { color: var(--color-active); font-weight: 400; }
.nav-link.active::after { background: #ffffff; }

.nav-lang {
  font-family: var(--font-main);
  font-weight: 300;
  font-size: 1.15rem;
  display: flex;
  align-items: flex-end;
  margin-left: auto;
  padding-right: 0;
  color: var(--color-text);
  cursor: pointer;
  transition: color var(--transition);
  padding-bottom: 8px;
}
.nav-lang:hover { color: var(--color-active); }

/* ── Hamburger (mobile) ── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  margin-left: auto;
  padding: 8px;
  z-index: 110;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  transition: all var(--transition);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Page sections (SPA routing) ── */
.page { display: none; flex: 1; }
.page.active { display: flex; flex-direction: column; }

/* ============================================
   PAGE ACCUEIL — DIAPORAMA
   ============================================ */
#page-home {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 400px;
}

.slideshow {
  position: absolute;
  top: 0;
  bottom: 7%;    /* marge blanche en bas */
  left: 7%;      /* aligné sur le M de Marie */
  right: 7%;     /* aligné sur le En */
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.slide.active { opacity: 1; }

.slide img, .slide svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.slide-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 5;
}
.slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.7);
  cursor: pointer;
  transition: background var(--transition);
}
.slide-dot.active { background: rgba(255,255,255,0.95); }

/* ============================================
   PAGE ŒUVRES — 2 BOUTONS-IMAGE
   ============================================ */
#page-oeuvres {
  padding: 0 7% 0;
  flex: 1;
  justify-content: flex-start;
}

.oeuvres-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0 20px;
  margin-top: 30px;
}

/* Les boutons occupent la première row */
.categorie-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: block;
  width: 100%;
  aspect-ratio: 1;
}

/* Wrapper interne de l'image — prend toute la hauteur du bouton */
.categorie-img {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.categorie-btn img,
.categorie-btn svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  display: block;
}

.categorie-btn:hover img,
.categorie-btn:hover svg { transform: scale(1.04); }

/* Label SOUS l'image, dans la row 2 de la grid — texte noir sur fond blanc */
.categorie-label {
  display: block;
  font-family: var(--font-main);
  font-weight: 400;
  font-size: 1rem;
  color: var(--color-text);
  letter-spacing: 0.03em;
  padding: 8px 0 16px;
  background: var(--color-white);
  text-align: left;
  grid-row: 2;
}

/* ============================================
   PAGE GALERIE — GRILLE 4x4
   ============================================ */
#page-sculptures,
#page-dessins {
  padding: 0 7% 24px;
  margin-top: -20px;
  flex: 1;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-width: 100%;
}

.gallery-thumb {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.gallery-thumb img,
.gallery-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.gallery-thumb:hover img,
.gallery-thumb:hover svg {
  transform: scale(1.06);
  opacity: 0.85;
}

/* Placeholder coloré par catégorie quand pas d'image */
#page-sculptures .gallery-thumb { background: var(--color-sculpt); }
#page-dessins   .gallery-thumb { background: var(--color-dessin); }

/* back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin: 4px 0 15px;
  cursor: pointer;
  transition: color var(--transition);
}
.back-link:hover { color: var(--color-text); }
.back-link svg { width: 14px; height: 14px; }

/* ============================================
   PAGE DÉTAIL ŒUVRE
   ============================================ */
#page-detail {
  flex: 1;
  padding: 0 7% 24px;
  margin-top: -20px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 145px;
  grid-template-rows: auto auto minmax(60px, auto);
  column-gap: 18px;
  row-gap: 1px;
  max-width: 100%;
  margin: 0 auto;
}

/* Grande image principale */
.detail-main {
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  background: #eee;
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
}
.detail-main img,
.detail-main svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Bande angles en bas de l'image principale */
.detail-angles {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  padding-top: 0;
  margin-top: -25px;
}

.angle-thumb {
  width: 100%;
  aspect-ratio: 1;
  padding-bottom: 0;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  opacity: 0.5;
  transition: opacity var(--transition);
}
.angle-thumb.active { opacity: 1; }
.angle-thumb img,
.angle-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Emplacement vide (transparent) pour garder 6 colonnes */
.angle-thumb.empty {
  visibility: hidden;
  cursor: default;
  pointer-events: none;
}


.angle-label {
  display: none;
}

.angle-thumb:not(.active):hover { opacity: 0.8; }
.angle-thumb.active:hover { opacity: 1; }

/* Liste scrollable de droite */
.detail-sidebar {
  grid-column: 2;
  grid-row: 1 / 4;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  align-self: stretch;
  height: 100%;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #aaa #e8e8e8;
}

.detail-sidebar::-webkit-scrollbar { width: 5px; }
.detail-sidebar::-webkit-scrollbar-track { background: #e8e8e8; border-radius: 3px; }
.detail-sidebar::-webkit-scrollbar-thumb { background: #aaa; border-radius: 3px; }
.detail-sidebar::-webkit-scrollbar-thumb:hover { background: #888; }

.sidebar-thumb {
  flex-shrink: 0;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: opacity var(--transition);
}

.sidebar-thumb:not(.active) { opacity: 0.45; }
.sidebar-thumb.active { opacity: 1; }
.sidebar-thumb:hover { opacity: 0.8; }
.sidebar-thumb.active:hover { opacity: 1; }

.sidebar-thumb img,
.sidebar-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Navigation latérale (flèches haut/bas) */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.sidebar-arrow {
  width: 100%;
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background var(--transition);
  color: #666;
  font-size: 14px;
}
.sidebar-arrow:hover { background: #e0e0e0; }
.sidebar-arrow:disabled { opacity: 0.3; cursor: default; }

/* Texte descriptif */
.detail-text {
  grid-column: 1;
  grid-row: 3;
  padding-top: 4px;
  margin-top: -30px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--color-text-light);
  line-height: 1.1;
  max-width: 680px;
}
.detail-text p + p { margin-top: 0px; }

/* ============================================
   PAGE À PROPOS
   ============================================ */
#page-apropos {
  flex: 1;
  padding: 48px 7%;
}

.apropos-text {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-text);
  line-height: 1.3;
  max-width: 680px;
}
.apropos-text p + p { margin-top: 1px; }

.apropos-text p + p { margin-top: 1.2em; }

/* ============================================
   PAGE CONTACT
   ============================================ */
#page-contact {
  flex: 1;
  padding: 48px 7%;
}

.contact-item {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 12px;
}

.contact-item span {
  font-weight: 600;
  margin-right: 6px;
}

.contact-item a {
  color: var(--color-active);
  transition: opacity var(--transition);
}
.contact-item a:hover { opacity: 0.7; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 320px) {
  :root { --nav-height: 52px; }

  body { padding: 2vh 2vw; align-items: flex-start; }

  .site-frame { min-height: auto; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 8px 0 20px;
    border-bottom: 1px solid var(--color-border);
    z-index: 99;
  }
  .nav-links.open { display: flex; }

  .nav-link {
    padding: 12px 20px;
    font-size: 1.1rem;
  }
  .nav-link::after { display: none; }
  .nav-link.active { background: rgba(0,0,0,0.04); }

  .nav-lang { display: none; }
  .nav-toggle { display: flex; }

  /* Galerie */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  /* Détail */
  .detail-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }
  .detail-main { grid-column: 1; grid-row: 1; }
  .detail-angles { grid-column: 1; grid-row: 2; }
  .detail-sidebar {
    grid-column: 1;
    grid-row: 3;
    flex-direction: row;
    max-height: 80px;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 4px;
  }
  .sidebar-thumb { width: 72px; flex-shrink: 0; }
  .sidebar-nav { display: none; }
  .detail-text { grid-column: 1; grid-row: 4; }

  /* À propos / Contact */
  #page-apropos, #page-contact { padding: 28px 7%; }

  /* Œuvres — sur mobile, les images gardent un ratio carré */
  .categorie-btn { aspect-ratio: 1; }
  .categorie-img { aspect-ratio: 1; height: auto; }
}

@media (max-width: 320px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-brand { font-size: 1rem; }
  .oeuvres-grid { gap: 8px; }
}
