/* ==========================================================================
   Kallery — thème galerie photo plein écran
   Tokens de design (définitifs, cf. handoff) :
   fond #0d0b09 · texte #faf8f4 · titres Cormorant Garamond · UI Inter
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/inter.woff2') format('woff2');
}

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url('../fonts/cormorant-garamond.woff2') format('woff2');
}

:root {
  --kl-bg: #0d0b09;
  --kl-ink: #faf8f4;
  --kl-veil-rest: 0.62;
  --kl-veil-hover: 0.08;
  --kl-veil-mobile: 0.55;
  --kl-bar-on: rgba(250, 248, 244, 0.95);
  --kl-bar-off: rgba(250, 248, 244, 0.28);
  --kl-serif: 'Cormorant Garamond', Georgia, serif;
  --kl-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html, body { height: 100%; }

body.kl-body {
  margin: 0;
  background: var(--kl-bg);
  color: var(--kl-ink);
  font-family: var(--kl-sans);
  -webkit-font-smoothing: antialiased;
}

.kl-body a { color: inherit; text-decoration: none; }

/* --------------------------------------------------------------------
   Menu de catégories
   -------------------------------------------------------------------- */

.kl-categories-page,
.kl-category-page { overflow: hidden; }

.kl-menu {
  display: flex;
  flex-direction: row;
  width: 100vw;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: hidden;
  background: var(--kl-bg);
}

.kl-tile {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  display: block;
  cursor: pointer;
  transition: flex-grow 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.kl-tile.kl-tile-empty { cursor: default; }

.kl-tile-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kl-tile-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 9, 8, 0.78), rgba(10, 9, 8, 0.15) 55%, rgba(10, 9, 8, 0.32));
  opacity: var(--kl-veil-rest);
  transition: opacity 0.65s ease;
  pointer-events: none;
}

.kl-tile-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 32px 44px;
  font-family: var(--kl-serif);
  font-size: clamp(26px, 3vw, 42px);
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  pointer-events: none;
}

/* Hover : uniquement pointeur fin (souris) — jamais "collé" au tactile */
@media (hover: hover) and (pointer: fine) {
  .kl-tile:hover { flex-grow: 2.6; }
  .kl-tile:hover .kl-tile-veil { opacity: var(--kl-veil-hover); }
  .kl-tile:hover .kl-tile-title { opacity: 1; transform: translateY(0); }
}

.kl-empty-msg {
  margin: auto;
  font-family: var(--kl-serif);
  font-size: 20px;
}

/* Mobile : colonnes → sections plein écran, scroll-snap vertical */
@media (max-width: 767px) {
  .kl-menu {
    flex-direction: column;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
  }
  .kl-tile {
    flex: none;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }
  .kl-tile-veil { opacity: var(--kl-veil-mobile); }
  .kl-tile-title {
    padding: 0 32px 64px;
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------
   Visionneuse plein écran
   -------------------------------------------------------------------- */

.kl-viewer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10;
}

.kl-viewer-stage { position: absolute; inset: 0; }

.kl-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
}

.kl-photo.is-active { opacity: 1; }

.kl-viewer-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--kl-serif);
  font-size: 20px;
  color: var(--kl-ink);
  text-align: center;
  padding: 0 32px;
}

.kl-viewer-close {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 84px;
  z-index: 3;
  cursor: pointer;
  display: block;
}

.kl-viewer-prev,
.kl-viewer-next {
  position: absolute;
  top: 84px;
  bottom: 0;
  width: 50%;
  z-index: 2;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  appearance: none;
}

.kl-viewer-prev { left: 0; }
.kl-viewer-next { right: 0; }

.kl-viewer-title {
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  z-index: 4;
  text-align: center;
  pointer-events: none;
  font-family: var(--kl-serif);
  font-size: 22px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--kl-ink);
  opacity: 1;
  transition: opacity 0.5s ease;
}

.kl-viewer-title.is-hidden { opacity: 0; }

.kl-viewer-bars {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: none;
  gap: 4px;
  z-index: 5;
  pointer-events: none;
}

.kl-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--kl-bar-off);
  transition: background 0.3s ease;
}

.kl-bar.is-filled { background: var(--kl-bar-on); }

@media (max-width: 767px) {
  .kl-viewer-bars { display: flex; }
}

/* --------------------------------------------------------------------
   Accueil éditorial (optionnel)
   -------------------------------------------------------------------- */

.kl-hero {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.kl-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kl-hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 9, 8, 0.85), rgba(10, 9, 8, 0.2) 60%, rgba(10, 9, 8, 0.35));
}

.kl-hero-content {
  position: relative;
  z-index: 1;
  padding: 0 48px 80px;
  max-width: 720px;
}

.kl-hero-eyebrow {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 12px;
}

.kl-hero-title {
  font-family: var(--kl-serif);
  font-weight: 500;
  font-size: clamp(36px, 6vw, 68px);
  letter-spacing: 0.01em;
  margin: 0 0 16px;
}

.kl-hero-subtitle {
  font-size: 17px;
  line-height: 1.6;
  opacity: 0.85;
  margin: 0 0 32px;
  max-width: 52ch;
}

.kl-hero-cta {
  display: inline-block;
  padding: 14px 28px;
  border: 1px solid var(--kl-ink);
  border-radius: 2px;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.3s ease, color 0.3s ease;
}

.kl-hero-cta:hover { background: var(--kl-ink); color: var(--kl-bg); }

.kl-home-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px;
  line-height: 1.7;
}

/* --------------------------------------------------------------------
   Pages de contenu génériques (blog, article, erreur, 404...)
   -------------------------------------------------------------------- */

.kl-doc {
  max-width: 720px;
  margin: 0 auto;
  padding: 96px 24px 80px;
  line-height: 1.7;
}

.kl-doc-title {
  font-family: var(--kl-serif);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 44px);
  margin: 0 0 24px;
}

.kl-doc-date { opacity: 0.6; font-size: 14px; margin-bottom: 24px; }

.kl-blog-list { list-style: none; margin: 40px 0 0; padding: 0; }

.kl-blog-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid rgba(250, 248, 244, 0.15);
}

.kl-blog-date { opacity: 0.6; font-size: 14px; white-space: nowrap; }

/* --------------------------------------------------------------------
   Pages fournies par les plugins Grav (connexion, mot de passe oublié,
   réinitialisation, profil, formulaires...) — ces templates étendent
   partials/base.html.twig mais amènent leur propre balisage générique
   (#grav-login, .form-field...) qu'il faut habiller pour le thème sombre,
   sinon ils héritent du fond/texte de la galerie et deviennent illisibles.
   -------------------------------------------------------------------- */

.kl-body #grav-login {
  background: #17140f;
  border: 1px solid rgba(250, 248, 244, 0.14);
  color: var(--kl-ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.kl-body #grav-login h4 { font-family: var(--kl-serif); font-weight: 500; font-size: 22px; }

.kl-body #grav-login hr { border-color: rgba(250, 248, 244, 0.14); }

.kl-body .form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
  text-align: left;
  color: var(--kl-ink);
}

.kl-body .form-field,
.kl-body .form-data { margin-bottom: 1rem; }

.kl-body .form-input-wrapper { text-align: left; }

.kl-body input[type="text"],
.kl-body input[type="password"],
.kl-body input[type="email"],
.kl-body input[type="search"],
.kl-body input[type="tel"],
.kl-body input[type="url"],
.kl-body textarea,
.kl-body select,
.kl-body .form-input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(250, 248, 244, 0.06);
  border: 1px solid rgba(250, 248, 244, 0.25);
  border-radius: 3px;
  color: var(--kl-ink);
  font-family: var(--kl-sans);
  font-size: 15px;
}

.kl-body input:focus,
.kl-body textarea:focus,
.kl-body select:focus {
  outline: none;
  border-color: var(--kl-ink);
}

.kl-body .rememberme { text-align: left; }

.kl-body .rememberme label { color: var(--kl-ink); font-size: 14px; }

.kl-body .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 3px;
  border: 1px solid var(--kl-ink);
  background: transparent;
  color: var(--kl-ink);
  font-size: 14px;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.kl-body .button.primary { background: var(--kl-ink); color: var(--kl-bg); }

.kl-body .button:hover { background: var(--kl-ink); color: var(--kl-bg); }

.kl-body .form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 1.25rem;
}

.kl-body .alert.error { color: #ff8a80; }
.kl-body .alert.info { color: #7fd99a; }
