/* Valentina : mobile d'abord, gros textes et grandes zones de touche (public parfois peu à l'aise avec le numérique). */
:root {
  --green: #0f5c4d;
  --green-dark: #0a4238;
  --gold: #f4c542;
  --bg: #faf7f0;
  --card: #ffffff;
  --text: #1d1d1b;
  --muted: #5d5d58;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  --radius: 16px;
  color-scheme: light;
  font-family: 'Noto Sans Tamil', 'Inter', system-ui, sans-serif;
  font-size: 100%;
}

/* Thème sombre : suit le réglage du téléphone, sauf choix explicite (bouton ☾/☀, attribut data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614;
    --card: #1e2421;
    --text: #f1efe8;
    --muted: #b4b2aa;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614;
  --card: #1e2421;
  --text: #f1efe8;
  --muted: #b4b2aa;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

[lang="fr"] { font-family: 'Inter', system-ui, sans-serif; }

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--green);
  color: #fff;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.theme-toggle {
  flex: none;
  width: 48px; height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.6); border-radius: 50%;
  background: transparent; color: #fff;
  display: grid; place-items: center; padding: 0; margin: 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
/* Icônes dessinées (SVG) : les caractères ☾/☀ s'affichaient en émoji ou décentrés sur téléphone. */
.theme-toggle svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun, .theme-toggle[aria-pressed="true"] .icon-moon { display: none; }
.theme-toggle[aria-pressed="true"] .icon-sun { display: block; }
.theme-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; color: inherit; text-decoration: none; min-height: 44px; }
.brand strong { display: block; font-size: 1.25rem; font-family: 'Inter', sans-serif; }
.brand small { display: block; font-size: 0.85rem; opacity: 0.9; }
.brand-mark {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--gold); color: var(--green-dark);
  font-weight: 700; font-size: 1.4rem;
}

main { max-width: 960px; margin: 0 auto; padding: 1.25rem 1rem calc(2rem + env(safe-area-inset-bottom)); }

h1 { font-size: 1.6rem; margin: 0; line-height: 1.3; }
.sub { color: var(--muted); margin: 0.15rem 0 1.25rem; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.card:active { transform: scale(0.99); }
.card:focus-visible, .back:focus-visible, .brand:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--green-dark); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play {
  position: absolute; inset: 0; margin: auto;
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(244, 197, 66, 0.95);
  display: grid; place-items: center;
}
.play::after { content: ''; border-left: 22px solid var(--green-dark); border-top: 14px solid transparent; border-bottom: 14px solid transparent; margin-left: 6px; }
.duration { position: absolute; right: 0.5rem; bottom: 0.5rem; background: rgba(0, 0, 0, 0.75); color: #fff; font: 600 0.8rem 'Inter', sans-serif; padding: 0.1rem 0.45rem; border-radius: 6px; }

.card-body { padding: 0.85rem 1rem 1rem; }
.card-body h2 { font-size: 1.15rem; margin: 0; line-height: 1.35; }
.card-body p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }

.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; font-size: 1.1rem; }

.back {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 48px; padding: 0 1.1rem; margin-bottom: 1rem;
  border: 0; border-radius: 999px; background: var(--green); color: #fff;
  font: inherit; font-size: 1.05rem; cursor: pointer;
}
.back small { opacity: 0.85; font-family: 'Inter', sans-serif; }

.player { background: #000; border-radius: var(--radius); overflow: hidden; margin: 0 -1rem 1rem; }
@media (min-width: 640px) { .player { margin: 0 0 1rem; } }
.player video { display: block; width: 100%; max-height: 75vh; background: #000; }

#player-view p { margin: 0 0 0.75rem; font-size: 1.05rem; }
#player-view .sub { font-size: 0.95rem; }
