/* elilignes — thème moderne */
:root {
  --bg-body: #0d1628;
  --bg-card: #131f35;
  --bg-header: rgba(13, 22, 40, 0.92);
  --text-main: #e8e6e3;
  --text-muted: #9ca3af;
  --accent: #c9a962;
  --accent-soft: rgba(201, 169, 98, 0.2);
  --border: rgba(255, 255, 255, 0.08);
  --font-display: "Cormorant Garamond", "Georgia", serif;
  --font-logo: "Playfair Display", "Cormorant Garamond", serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-main);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- En-tête (identique sur toutes les pages) ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
}

.site-header .header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header h1 {
  font-family: var(--font-logo);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.site-header h1 a {
  color: inherit;
  text-decoration: none;
}
.site-header .header-logo {
  display: block;
  height: 3.25rem;
  width: auto;
  object-fit: contain;
}

/* Actions à droite du header (réseaux + recherche) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.header-actions .header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  color: var(--text-muted);
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.header-actions .header-icon:hover {
  color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.08);
}
.header-actions .header-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}
.header-actions .header-search {
  cursor: pointer;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.main-nav a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease;
}

.main-nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Page courante : lien actif (optionnel, via classe .active) */
.main-nav a.active {
  color: var(--accent);
}

/* ----- Hero (page d'accueil uniquement) ----- */
.hero {
  position: relative;
  min-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: var(--bg-card) no-repeat center center;
  background-size: cover;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Hero slideshow : 3 images, fondu au changement, couleurs intactes (aucun overlay) */
.hero-slideshow {
  background: none;
}

.hero-slideshow .hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
}

.hero-slideshow .hero-slide { z-index: 0; }

.hero-slideshow.hero-slide-at-0 .hero-slide-0,
.hero-slideshow.hero-slide-at-1 .hero-slide-1,
.hero-slideshow.hero-slide-at-2 .hero-slide-2 {
  opacity: 1;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1.5rem;
  max-width: 640px;
}

.hero-content .hero-logo {
  max-width: 280px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 0.75rem;
}

.hero-content p {
  font-size: 1.05rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8), 0 1px 12px rgba(0,0,0,0.5);
}

/* ----- Contenu principal ----- */
main {
  flex: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  width: 100%;
}

main .page-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

main .page-intro {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.98rem;
}

/* Carte de présentation (accueil) */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 2rem 2.25rem;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.presentation h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.presentation p + p {
  margin-top: 0.85rem;
}

.presentation p {
  color: var(--text-main);
}

.fade-in {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp 0.7s ease-out forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Grille 6 images carrées (accueil) */
.home-random-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2.5rem;
}

.home-random-grid .square-img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.home-random-grid .square-img-wrap:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  transform: scale(1.02);
}

.home-random-grid .square-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.home-random-grid .square-img-wrap:hover img {
  transform: scale(1.06);
}

@media (max-width: 600px) {
  .home-random-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1.75rem;
  }
}

/* Grille 6 techniques (page techniques.php) */
.technique-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
}

.technique-link {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.technique-link:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  transform: scale(1.02);
}

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

.technique-link:hover img {
  transform: scale(1.06);
}

.technique-link span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  color: #e5e7eb;
  padding: 1rem 0.85rem;
  font-size: 1rem;
  font-weight: 500;
}

@media (max-width: 600px) {
  .technique-links {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Grille classes (7 éléments) : 4+3 pour éviter l'orpheline */
.classe-links {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
  .classe-links {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .classe-links {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Grille sujets (11 éléments) */
.sujet-links {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
  .sujet-links {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .sujet-links {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Zone contenu dynamique (pages avec base de données) */
.main-content.db-content {
  margin-top: 1rem;
  min-height: 200px;
}

/* Styles pour contenu injecté (tables, listes, cartes) */
.db-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: var(--bg-card);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.db-content th,
.db-content td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.db-content th {
  background: rgba(201, 169, 98, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.db-content tr:last-child td {
  border-bottom: none;
}

.db-content tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.db-content .db-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.db-content .db-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  padding: 1rem;
}

.db-content .db-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  border-radius: 6px;
}

/* Page admin */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.admin-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid var(--border);
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.admin-nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.admin-nav a.active {
  color: var(--accent);
  border-color: var(--accent);
}
.admin-actions {
  margin-bottom: 1.5rem;
}
.btn-accent {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: var(--bg-body);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s ease, transform 0.15s ease;
}
.btn-accent:hover {
  background: #d4b86a;
  transform: translateY(-1px);
}
.db-content .form-inline {
  display: inline;
  margin: 0;
}
.db-content .btn-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.db-content .btn-cell:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.db-content .btn-cell.btn-supp:hover {
  color: #e57373;
  background: rgba(229, 115, 115, 0.15);
  border-color: #e57373;
}

/* Grille galerie */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg-card);
  cursor: pointer;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

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

.gallery-item:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.gallery-item-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  color: #e5e7eb;
  padding: 1rem 0.85rem;
  font-size: 0.85rem;
}

/* Galerie publique : afficher les items (sans animation JS) */
.gallery-grid-wrap .gallery-item,
.main-content.gallery-grid-wrap .gallery-item {
  opacity: 1;
  transform: none;
}

/* Galerie admin : actions par image */
.admin-gallery .gallery-item {
  opacity: 1;
  transform: none;
}
.admin-gallery .admin-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}
.admin-gallery .admin-item-actions .form-inline {
  display: inline-flex;
  margin: 0;
}
.admin-gallery .admin-item-actions .btn-cell {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}
.admin-gallery .gallery-item-caption {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.admin-gallery .gallery-item a {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* Formulaire admin */
.admin-form .form-row {
  margin-bottom: 1rem;
}
.admin-form label,
.admin-form .form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  color: var(--text-muted);
}
.admin-form input[type="text"],
.admin-form input[type="date"],
.admin-form input[type="file"],
.admin-form select {
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-main);
}
.admin-form .form-actions {
  margin-top: 1.5rem;
}
.admin-form .form-note {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 1rem;
}
.main-content.admin-form-wrap {
  max-width: 520px;
}

/* ----- Pied de page (identique sur toutes les pages) ----- */
.site-footer {
  margin-top: auto;
  padding: 1.75rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  text-align: center;
}

.site-footer .footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.site-footer .footer-line {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  justify-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}
.site-footer .footer-line .site-name {
  grid-column: 1;
}
.site-footer .footer-line .footer-email {
  grid-column: 3;
}

.site-footer .site-name {
  margin: 0;
}

.site-footer .site-name a {
  display: inline-block;
}

.site-footer .footer-logo {
  display: block;
  height: 3.25rem;
  width: auto;
  object-fit: contain;
}

.site-footer .footer-email {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-style: italic;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer .footer-email:hover {
  color: var(--accent);
}

.site-footer a[href^="mailto:"] {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer a[href^="mailto:"]:hover {
  color: var(--accent);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .site-header .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-nav {
    width: 100%;
  }

  .hero {
    min-height: 60vh;
  }

  .card {
    padding: 1.5rem 1.25rem;
  }

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

@media (max-width: 480px) {
  .site-header {
    padding: 0.75rem 1rem;
  }

  .main-nav a {
    padding: 0.4rem 0.65rem;
    font-size: 0.85rem;
  }
}
