/* ----- Couleurs : mode jour par défaut ----- */
:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --muted: #666;
  --accent: #4f46e5;
  --card: #ffffff;
  --border: #d4d4d8;
  --hover: #f4f4f5;
  color-scheme: light;
}

/* Mode nuit automatique, sauf si l'utilisateur a choisi le mode jour */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111;
    --text: #eee;
    --muted: #999;
    --accent: #818cf8;
    --card: #1c1c1c;
    --border: #3f3f46;
    --hover: #27272a;
    color-scheme: dark;
  }
}

/* Mode nuit forcé par le bouton */
:root[data-theme="dark"] {
  --bg: #111;
  --text: #eee;
  --muted: #999;
  --accent: #818cf8;
  --card: #1c1c1c;
  --border: #3f3f46;
  --hover: #27272a;
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  line-height: 1.6;
}

header, main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#meta, .tags {
  color: var(--muted);
  font-size: 0.9rem;
}

article {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
}

.why {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  font-style: italic;
}

.sources {
  font-size: 0.85rem;
}

a {
  color: var(--accent);
}

/* ----- Sélecteur d'édition ----- */
:root {
  --border: #d4d4d8;
  --hover: #f4f4f5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --border: #3f3f46;
    --hover: #27272a;
  }
}

.edition-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.edition-picker select {
  appearance: none;               /* retire le style du navigateur */
  -webkit-appearance: none;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;           /* forme de pilule */
  padding: 8px 36px 8px 14px;     /* place à droite pour la flèche */
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;

  /* flèche personnalisée en SVG */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.edition-picker select:hover {
  background-color: var(--hover);
  border-color: var(--accent);
}

.edition-picker select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ----- Groupe de contrôles et bouton de thème ----- */
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

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

.theme-toggle:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

body {
  transition: background-color 0.2s, color 0.2s;
}

/* ----- Articles repliables ----- */
.summary {
  font-size: 1.05rem;
}

.details {
  display: grid;
  grid-template-rows: 0fr;            /* replié */
  transition: grid-template-rows 0.35s ease;
}

.details-inner {
  overflow: hidden;
}

/* Déroulé : au clic (toujours) */
article.open .details {
  grid-template-rows: 1fr;
}

/* Déroulé : au survol, seulement sur les appareils avec une souris */
@media (hover: hover) {
  article:hover .details {
    grid-template-rows: 1fr;
    transition-delay: 0.15s;          /* évite d'ouvrir en passant juste la souris */
  }
}

article {
  transition: box-shadow 0.2s;
}

article:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.read-more {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.read-more:hover {
  text-decoration: underline;
}

.read-more:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .details { transition: none; }
}

