/* Discover — feuille de style unique du front (D-01 : zéro dépendance, CSS natif, zéro build). */

:root {
  /* Colors — sombre et sobre, l'image prime */
  --color-bg: #0e1014;
  --color-surface: #171a21;
  --color-surface-2: #1f242e;
  --color-border: #2a303c;
  --color-text: #eceff4;
  --color-text-muted: #8b93a3;
  --color-primary: #eceff4;
  --color-primary-hover: #ffffff;
  --color-accent: #6e9fff;   /* état actif : onglet courant, filtre sélectionné, focus clavier, lien externe au survol */
  --color-danger: #e5484d;   /* nope */
  --color-success: #46a758;  /* like */

  /* Typography */
  --font-sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  /* Shapes */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 10px rgba(0,0,0,0.45);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.55);
}

/* ---- Reset et body ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--color-bg); color: var(--color-text); font-family: var(--font-sans); }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---- App-shell plein écran (iOS safe-area) ---- */
.shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  overflow: hidden;
  background: var(--color-bg);
}
@media (min-width: 480px) {
  .shell {
    max-width: 420px;
    height: min(780px, 100dvh);
    margin: 0 auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }
}

/* ---- Barre du haut ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  flex: none;
  padding: 0 var(--space-4);
}
.topbar .title { font-size: var(--text-sm); color: var(--color-text-muted); }
.icon-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.icon-btn:hover { color: var(--color-text); }

/* ---- Zones d'écran ---- */
.screen { display: none; flex: 1; position: relative; min-height: 0; }
.screen.active { display: block; }
.deck-area { position: absolute; inset: 0; }
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-align: center;
  padding: var(--space-6);
}

/* ---- Barre d'onglets (3 onglets fixes : Swipe / Matchs / Potes) ---- */
.tabbar {
  display: flex;
  flex: none;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  border-top: 2px solid transparent;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  min-height: 44px;
  padding: var(--space-2);
}
.tab.active { color: var(--color-text); border-top-color: var(--color-accent); }

/* ---- Écran de login ---- */
.login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: var(--space-8) var(--space-6);
  gap: var(--space-4);
}
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field label { font-size: var(--text-xs); color: var(--color-text-muted); }
.field input {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  color: var(--color-text);
  min-height: 44px;
  font-size: 16px; /* sous 16px, iOS Safari zoome au focus et casse le plein écran */
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-md);
  min-height: 44px;
  font-weight: 800;
}
.btn-primary:hover { background: var(--color-primary-hover); }
.form-error { font-size: var(--text-sm); color: var(--color-danger); }

/* ---- Bannière ---- */
#banner {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  right: var(--space-2);
  z-index: 20;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-sm);
}
#banner[hidden] { display: none; }
#banner.error { border-color: var(--color-danger); color: var(--color-danger); }

/* ---- Deck épuisé : écran calme, pas d'alerte, pas de bouton de rechargement ---- */
.end-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  background: var(--color-surface);
}
.end-screen h2 { font-size: var(--text-xl); font-weight: 800; }
.end-screen .sub { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-2); }

/* ---- Accessibilité transverse ---- */
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ===== Couche carte : Immersion, tampons, actions, volet ⓘ, volet filtres ===== */

/* ---- Tampons de swipe ---- */
.stamp {
  position: absolute;
  top: 48px;
  padding: 6px 14px;
  border: 3px solid;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: var(--text-2xl);
  letter-spacing: 2px;
  opacity: 0;
  transform: rotate(-12deg);
  pointer-events: none;
  z-index: 6;
}
.stamp-like { left: 20px; color: var(--color-success); border-color: var(--color-success); }
.stamp-nope { right: 20px; color: var(--color-danger); border-color: var(--color-danger); transform: rotate(12deg); }

/* ---- Barre d'actions ---- */
.actions {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  z-index: 7;
}
.act {
  width: 58px;
  height: 58px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: rgba(14,16,20,0.75);
  backdrop-filter: blur(6px);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-md);
}
.act:hover { transform: scale(1.12); }
.act-nope { color: var(--color-danger); }
.act-nope:hover { background: var(--color-danger); color: #fff; }
.act-like { color: var(--color-success); }
.act-like:hover { background: var(--color-success); color: #fff; }
.act-rewind {
  color: var(--color-text-muted);
  width: 48px;
  height: 48px;
  min-width: 44px;
  min-height: 44px;
  font-size: 19px;
  align-self: center;
}
.act-rewind:hover { background: var(--color-surface-2); color: var(--color-text); }

/* ---- Chips et badges ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(4px);
  font-size: var(--text-xs);
}
.badge-source {
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.18);
}

/* ---- Carte Immersion (variante A, gagnante) ---- */
.card-a { position: absolute; inset: 0; touch-action: none; user-select: none; }
.card-a .photo { position: absolute; inset: 0; background-size: cover; background-position: center top; }
.card-a .segs { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; gap: 4px; z-index: 5; }
.card-a .seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.3); transition: background 0.15s; }
.card-a .seg.on { background: #fff; }
.card-a .tap { position: absolute; top: 0; bottom: 35%; width: 33%; z-index: 4; }
.card-a .tap.left { left: 0; }
.card-a .tap.right { right: 0; }
.card-a .grad {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 16px 92px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55) 40%, rgba(0,0,0,0.92));
  z-index: 5;
}
.card-a .name { font-size: var(--text-3xl); font-weight: 800; text-shadow: 0 1px 4px rgba(0,0,0,0.6); }
.card-a .name .age { font-weight: 400; font-size: var(--text-2xl); color: rgba(255,255,255,0.85); }
.card-a .meta-line { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Volet ⓘ ---- */
.card-a .info-btn {
  position: absolute;
  right: 14px;
  bottom: 96px;
  min-width: 44px;
  min-height: 44px;
  padding: var(--space-2);
  border-radius: var(--radius-full);
  border: none;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 18px;
  z-index: 6;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-a .info-btn:hover { background: rgba(255,255,255,0.35); }
.card-a .sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -78%;
  height: 76%;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 8;
  transition: bottom 0.28s ease;
  overflow-y: auto;
  padding: 16px;
  box-shadow: var(--shadow-lg);
}
.card-a.open .sheet { bottom: 0; }
.card-a .sheet .close {
  position: sticky;
  top: 0;
  float: right;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Fiche info (partagée par le volet ⓘ) ---- */
.info-h {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-text-muted);
  margin: 18px 0 8px;
}
.info-h:first-child { margin-top: 4px; }
.id-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: var(--text-sm); }
.id-grid .k { color: var(--color-text-muted); font-size: var(--text-xs); }
.studio-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--text-xs);
  margin-bottom: 8px;
}
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
  text-decoration: none;
  font-size: var(--text-xs);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  transition: all 0.15s;
}
.links a:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ---- Volet filtres : surface distincte, ne touche jamais à .card-a ---- */
.filter-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -100%;
  height: 60%;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 9;
  transition: bottom 0.28s ease;
  overflow-y: auto;
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
}
.filter-sheet.open { bottom: 0; }
.filter-sheet .close {
  position: sticky;
  top: 0;
  float: right;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}
.filter-group { margin-bottom: var(--space-4); }
.filter-group .row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.filter-chip {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.filter-chip.on { border-color: var(--color-accent); color: var(--color-accent); }
