/* ---------- Thèmes ---------- */
:root {
  --bg: #faf8f5;
  --text: #1c2128;
  --text-soft: #5b6570;
  --accent: #d98e04;
  --active: #16a34a;
  --pending: #d97706;
  --inactive: #9ca3af;
  --card: #ffffff;
  --border: #ece7df;
  --shadow: 0 1px 3px rgba(28, 33, 40, 0.06), 0 6px 20px rgba(28, 33, 40, 0.05);
  --radius: 14px;
}

:root.dark {
  --bg: #0f1419;
  --text: #e6e9ed;
  --text-soft: #97a1ad;
  --accent: #f5a623;
  --active: #22c55e;
  --pending: #f59e0b;
  --inactive: #4b5563;
  --card: #171d26;
  --border: #232b36;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Thème auto si l'utilisateur n'a rien choisi (pas de classe .dark/.light forcée) */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #0f1419;
    --text: #e6e9ed;
    --text-soft: #97a1ad;
    --accent: #f5a623;
    --active: #22c55e;
    --pending: #f59e0b;
    --inactive: #4b5563;
    --card: #171d26;
    --border: #232b36;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

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

main, .hero, .footer {
  margin: 0 auto;
  padding: 0 20px;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 16px;
}

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

code, .badge, .endpoints code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding-top: 64px;
  padding-bottom: 40px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.tagline {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 28px 0 12px;
}

.subtagline {
  color: var(--text-soft);
  font-size: 1.05rem;
  max-width: 34rem;
  margin: 0 auto;
}

/* ---------- Sections ---------- */
section { margin: 48px auto; }

section.sources {
  max-width: 1024px;
}

/* ---------- Cartes sources ---------- */
.sources-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start; /* une carte ouverte ne doit pas étirer ses voisines */
}

.source-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.source-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.source-name {
  font-weight: 600;
  font-size: 1.02rem;
}

.source-desc {
  color: var(--text-soft);
  font-size: 0.92rem;
  margin: 8px 0 16px;
}

.badge {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.badge-official { color: var(--accent); border-color: var(--accent); }
.badge-verified { color: var(--active); border-color: var(--active); }

.source-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Indicateur d'état ---------- */
.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--inactive);
  position: relative;
  flex: none;
}

.state-pending .dot { background: var(--pending); }

.state-active .dot {
  background: var(--active);
}

/* Pulsation douce : seul élément animé de la page */
.state-active .dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--active);
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  0%   { transform: scale(1);   opacity: 0.55; }
  80%, 100% { transform: scale(2.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .state-active .dot::after { animation: none; }
}

/* ---------- Boutons ---------- */
button {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 9px 16px;
  transition: opacity 0.15s ease;
}

button:hover { opacity: 0.9; }

.btn-alert {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Bloc "proposer une source" ---------- */
.propose-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 18px 20px;
  text-align: center;
  text-decoration: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-soft);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.propose-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--accent);
}

.propose-plus {
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
}

.propose-text {
  font-size: 0.9rem;
  font-weight: 500;
}

/* ---------- Formulaire inline (par carte) ---------- */
.subscribe-inline {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.subscribe-inline[hidden] { display: none; }

.field-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input[type='email'] {
  flex: 1;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

input[type='email']:focus {
  outline: none;
  border-color: var(--accent);
}

.subscribe-inline button[type='submit'] {
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
}

.form-message {
  font-size: 0.9rem;
  min-height: 1.2em;
  margin: 12px 0 0;
}

.form-message.ok { color: var(--active); }
.form-message.err { color: #dc2626; }

.reassurance {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin: 10px 0 0;
}

/* ---------- Développeurs ---------- */
.endpoints {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.endpoints code {
  font-size: 0.85rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px 8px;
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 32px;
  padding-bottom: 48px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.credit { color: var(--text-soft); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.loading, .sources-error {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.sources-error { color: #dc2626; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .sources-list { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .tagline { font-size: 1.5rem; }
  .footer { flex-direction: column; align-items: center; text-align: center; }
}
