/* ==========================================
   POKÉDEX IRL — Styles
   Aventures Créatives — Explorateur moderne
   ========================================== */

/* ── Variables ── */
:root {
  --bg:         #0a0a0a;
  --border:     #1c1c1c;
  --border-l:   #2a2a2a;

  --text:       #e8e2d5;
  --text-2:     #7a7568;
  --text-3:     #3a3530;

  --accent:     #c9a84c;

  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans:  'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;

  /* Types */
  --mammal:    #c2915d;
  --bird:      #7bb3e8;
  --amphibian: #6bcf6b;
  --reptile:   #c9b636;
  --insect:    #b5c236;
  --fish:      #6b7fe8;
  --arachnid:  #b09ab8;

  --gap-h: clamp(1.5rem, 5vw, 4rem);
  --max-w: 1100px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }

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

/* Grain subtil */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

/* ── Conteneur ── */
.container {
  max-width: calc(var(--max-w) + 2 * var(--gap-h));
  margin: 0 auto;
  padding: 0 var(--gap-h);
}

.dot { color: var(--border-l); }

/* ══════════════════════════════
   NAV
══════════════════════════════ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.4rem var(--gap-h);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-back {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-back:hover { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover  { color: var(--text); }
.nav-link.active { color: var(--accent); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--text-3);
}

/* ══════════════════════════════
   HEADER
══════════════════════════════ */
.pokedex-header {
  padding: 8rem 0 3.5rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.38em;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.pokedex-title {
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.pokedex-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.pokedex-lead {
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  color: var(--text-2);
  font-weight: 300;
  line-height: 1.9;
  margin-bottom: 2rem;
}

.header-progress {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.progress-track {
  width: 180px;
  height: 2px;
  background: var(--border-l);
  border-radius: 1px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.6s ease;
  width: 0%;
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-2);
}

/* ══════════════════════════════
   CONTROLS
══════════════════════════════ */
.controls-bar {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 63px;
  z-index: 50;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.controls-inner {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-input {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 300;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-l);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 4px;
  outline: none;
  flex: 1;
  min-width: 180px;
  transition: border-color 0.15s;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-3); }

.type-select {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-l);
  color: var(--text-2);
  padding: 0.6rem 1rem;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.type-select:focus { border-color: var(--accent); }
.type-select option { background: #111; color: var(--text); }

/* ══════════════════════════════
   ÉPISODE
══════════════════════════════ */
.episode-section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
}

.episode-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.episode-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  margin-top: 0.5rem;
}

.episode-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.episode-yt-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--text-2);
  text-decoration: none;
  border: 1px solid var(--border-l);
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.episode-yt-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.episode-video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-l);
}

.episode-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ══════════════════════════════
   GRILLE
══════════════════════════════ */
.pokedex-main {
  flex: 1;
  padding-bottom: 6rem;
}

.animal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

/* ── Carte ── */
.animal-card {
  background: var(--bg);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.animal-card:hover { background: #0f0f0f; }

.animal-card.active {
  background: #0f0f0f;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.animal-card.not-captured { cursor: default; }

/* Image */
.card-image {
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  background: #090909;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.animal-card:hover .card-image img { transform: scale(1.05); }

.card-emoji { font-size: 3rem; line-height: 1; }

.card-image--unknown {
  background: #111;
  border-bottom: 1px solid var(--border-l);
}

.card-question {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-style: italic;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1;
}

[data-theme="light"] .card-image--unknown { background: #d8d0c4; }

.not-captured .card-name   { color: var(--text-3); }
.not-captured .card-number { color: var(--text-3); }

/* Infos */
.card-info {
  padding: 0.75rem 0.875rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card-number {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.not-captured .card-number { color: var(--text-3); }

.card-name {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}

.not-captured .card-name { color: var(--text-3); }

.card-types {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 0.1rem;
}

.card-type {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 2px;
}

/* Couleurs types */
.type-mammal    { background: rgba(194,145, 93,0.15); color: #c2915d; border: 1px solid rgba(194,145, 93,0.25); }
.type-bird      { background: rgba(123,179,232,0.15); color: #7bb3e8; border: 1px solid rgba(123,179,232,0.25); }
.type-amphibian { background: rgba(107,207,107,0.15); color: #6bcf6b; border: 1px solid rgba(107,207,107,0.25); }
.type-reptile   { background: rgba(201,182, 54,0.15); color: #c9b636; border: 1px solid rgba(201,182, 54,0.25); }
.type-insect    { background: rgba(181,194, 54,0.15); color: #b5c236; border: 1px solid rgba(181,194, 54,0.25); }
.type-fish      { background: rgba(107,127,232,0.15); color: #6b7fe8; border: 1px solid rgba(107,127,232,0.25); }
.type-arachnid  { background: rgba(176,154,184,0.15); color: #b09ab8; border: 1px solid rgba(176,154,184,0.25); }

/* État vide */
.empty-state {
  grid-column: 1 / -1;
  background: var(--bg);
  padding: 5rem 2rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--text-3);
}

/* ══════════════════════════════
   MODAL
══════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #111;
  border: 1px solid var(--border-l);
  border-radius: 6px;
  width: 100%;
  max-width: 780px;
  overflow: hidden;
  position: relative;
  animation: modal-in 0.22s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-l);
  border-radius: 4px;
  color: var(--text-2);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 10;
  font-family: var(--font-sans);
  line-height: 1;
  padding: 0;
}

.modal-close:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }

/* ── Intérieur détail ── */
.detail-inner {
  display: grid;
  grid-template-columns: 300px 1fr;
}

.detail-photo {
  background: #090909;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
}

.detail-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.detail-emoji-large {
  font-size: 5rem;
  line-height: 1;
}

/* Panneau d'info */
.detail-info {
  padding: 2rem 1.75rem;
  overflow-y: auto;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.detail-info::-webkit-scrollbar { width: 3px; }
.detail-info::-webkit-scrollbar-track { background: transparent; }
.detail-info::-webkit-scrollbar-thumb { background: var(--border-l); border-radius: 2px; }

.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.detail-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.detail-types { display: flex; gap: 4px; flex-wrap: wrap; }

.detail-name {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.detail-scientific {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-2);
  margin-bottom: 1.5rem;
}

/* Stats */
.detail-stats {
  border-top: 1px solid var(--border);
  margin-bottom: 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--text-3);
  text-transform: uppercase;
  flex-shrink: 0;
}

.stat-val {
  font-family: var(--font-sans);
  font-size: 0.825rem;
  color: var(--text-2);
  text-align: right;
  line-height: 1.4;
}

/* Badges conservation */
.conservation-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 3px;
  display: inline-block;
}

.conservation-lc { background: rgba( 68,204, 68,0.1); color: #4acc4a; border: 1px solid rgba( 68,204, 68,0.2); }
.conservation-nt { background: rgba(204,204, 68,0.1); color: #cccc44; border: 1px solid rgba(204,204, 68,0.2); }
.conservation-vu { background: rgba(255,136, 51,0.1); color: #ff8833; border: 1px solid rgba(255,136, 51,0.2); }
.conservation-en { background: rgba(255, 68, 34,0.1); color: #ff4422; border: 1px solid rgba(255, 68, 34,0.2); }
.conservation-cr { background: rgba(255, 34,  0,0.1); color: #ff2200; border: 1px solid rgba(255, 34,  0,0.2); }

/* Description */
.detail-desc {
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--text-2);
  line-height: 1.85;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

/* Infos capture */
.detail-capture-info {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.capture-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-l);
  padding: 0.3rem 0.7rem;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.5;
}

.capture-icon { font-size: 0.75rem; }

/* Bouton YouTube */
.youtube-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  background: rgba(204, 0, 0, 0.1);
  border: 1px solid rgba(204, 0, 0, 0.28);
  border-radius: 4px;
  color: #ff5555;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-decoration: none;
  transition: all 0.15s;
  margin-top: auto;
  padding-top: 0.75rem;
  cursor: pointer;
}

.youtube-btn:hover {
  background: rgba(204, 0, 0, 0.2);
  border-color: rgba(204, 0, 0, 0.5);
}

.youtube-btn.disabled {
  opacity: 0.28;
  pointer-events: none;
  cursor: default;
}

/* ── Animal inconnu ── */
.detail-unknown {
  padding: 3.5rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.detail-unk-question {
  font-family: var(--font-serif);
  font-size: 5rem;
  font-style: italic;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.detail-unk-number {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--text-3);
}

.detail-unk-name {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-style: italic;
  font-weight: 400;
  color: var(--text-3);
}

.detail-unknown p {
  font-size: 0.85rem;
  color: var(--text-3);
  font-weight: 300;
  max-width: 280px;
  line-height: 1.7;
}

/* ══════════════════════════════
   LIGHTBOX
══════════════════════════════ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: lb-in 0.18s ease;
}

.lightbox.open { display: flex; }

@keyframes lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  animation: lb-scale 0.18s ease;
}

@keyframes lb-scale {
  from { transform: scale(0.94); }
  to   { transform: scale(1); }
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: color 0.12s;
}

.lightbox-close:hover { color: #fff; }

/* ══════════════════════════════
   FOOTER
══════════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: auto;
}

.footer-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s;
}

.social-link svg { flex-shrink: 0; opacity: 0.7; transition: opacity 0.2s; }
.social-link:hover { color: var(--accent); }
.social-link:hover svg { opacity: 1; }

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--text-3);
}

/* ══════════════════════════════
   RESPONSIVE
══════════════════════════════ */
@media (max-width: 680px) {
  .detail-inner {
    grid-template-columns: 1fr;
  }

  .detail-photo {
    height: 55vw;
    min-height: unset;
  }

  .detail-info {
    max-height: 65vh;
    padding: 1.5rem 1.25rem;
  }

  .modal {
    max-height: 94vh;
  }

  .nav-meta { display: none; }
}

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

/* ══════════════════════════════
   BOUTON THÈME
══════════════════════════════ */
.theme-toggle {
  font-size: 0.8rem;
  background: none;
  border: 1px solid var(--border-l);
  color: var(--text-2);
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ══════════════════════════════
   THÈME CLAIR
══════════════════════════════ */
[data-theme="light"] {
  --bg:       #f7f3ec;
  --border:   #e5ddd0;
  --border-l: #d0c8ba;
  --text:     #1a1510;
  --text-2:   #7a6e62;
  --text-3:   #b5a898;
}

[data-theme="light"] .nav    { background: rgba(247, 243, 236, 0.9); }
[data-theme="light"] .controls-bar { background: rgba(247, 243, 236, 0.97); }

[data-theme="light"] .animal-card         { background: #f7f3ec; }
[data-theme="light"] .animal-card:hover   { background: #ede8df; }
[data-theme="light"] .animal-card.active  { background: #ede8df; }
[data-theme="light"] .card-image          { background: #e0d8c8; }

[data-theme="light"] .modal-overlay  { background: rgba(0, 0, 0, 0.45); }
[data-theme="light"] .modal          { background: #ede8df; }
[data-theme="light"] .modal-close    { background: rgba(0, 0, 0, 0.04); }
[data-theme="light"] .modal-close:hover { background: rgba(0, 0, 0, 0.1); }

[data-theme="light"] .detail-photo { background: #d0c8ba; }

[data-theme="light"] .search-input,
[data-theme="light"] .type-select  { background: rgba(0, 0, 0, 0.05); }
[data-theme="light"] .type-select option { background: #f0ebe0; }

[data-theme="light"] .capture-badge { background: rgba(0, 0, 0, 0.04); }
