/* ===== Tokens thbl (agents/THEME.md §4) — copiés tels quels ===== */
:root {
  --bg: #ffffff;
  --text: #17151c;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --border: #ececef;
  --accent-strong: #7c3aed;
  --accent-text: #7c3aed;
  --focus-ring: #8c52ff;
  color-scheme: light;

  --surface: #faf9fc;
  --danger-text: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131117;
    --text: #f1eef7;
    --text-muted: #a39cae;
    --text-faint: #6f6879;
    --border: #2b2733;
    --accent-text: #b794ff;
    --focus-ring: #b794ff;
    color-scheme: dark;

    --surface: #1b1821;
    --danger-text: #ff8a80;
  }
}

:root[data-theme="dark"] {
  --bg: #131117;
  --text: #f1eef7;
  --text-muted: #a39cae;
  --text-faint: #6f6879;
  --border: #2b2733;
  --accent-text: #b794ff;
  --focus-ring: #b794ff;
  color-scheme: dark;

  --surface: #1b1821;
  --danger-text: #ff8a80;
}

/* ===== Reset minimal ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 0;
  line-height: 1.55;
  font-size: 16px;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }

.focusable:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ===== Utilitaires (évitent tout style="" inline -> CSP style-src strict) ===== */
.visually-hidden {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.row-between--baseline { align-items: baseline; }
.m0 { margin: 0; }
.mt-sm { margin-top: 0.75rem; }
.mt-md { margin-top: 1.25rem; }
.mt-lg { margin-top: 1.5rem; }
.inline-form { display: inline; }
.u-accent { color: var(--accent-text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ===== Layout ===== */
.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.wrap--wide { max-width: 1080px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-strong);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

/* ===== Header ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 0.15rem;
  white-space: nowrap;
}
.brand strong { color: var(--text); }
.brand span { color: var(--accent-text); }
.brand:hover, .brand:focus-visible { color: var(--accent-text); }

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.search-form {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.3rem 0.3rem 0.9rem;
  gap: 0.4rem;
  background: var(--surface);
}
.search-form input[type="search"] {
  border: 0;
  background: transparent;
  outline: none;
  width: 11rem;
  color: var(--text);
}
.search-form input[type="search"]::placeholder { color: var(--text-faint); }
.search-form button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  color: var(--text-muted);
  display: flex;
}
.search-form button:hover { color: var(--accent-text); }

/* Bouton "switch" pill (THEME.md §7) */
.pill-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.pill-group button, .pill-group a {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1.2;
  transition: background-color .15s ease, color .15s ease;
}
.pill-group button:hover, .pill-group a:hover { color: var(--text); }
.pill-group [aria-pressed="true"], .pill-group [aria-current="true"] {
  background: var(--accent-strong);
  color: #fff;
}

/* ===== Hero / featured article ===== */
.featured {
  display: grid;
  gap: 1.25rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 720px) {
  .featured { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 2.5rem; }
}
.featured__media {
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}
.featured__media img { width: 100%; height: 100%; object-fit: cover; }
.featured__eyebrow {
  color: var(--accent-text);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0;
}
.featured h1, .featured h2 {
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.15rem);
  line-height: 1.2;
  margin-top: 0.5rem;
}
.featured p.excerpt {
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-size: 1.02rem;
}
.featured .meta { margin-top: 1rem; }

/* ===== Article list ===== */
.article-list {
  display: grid;
  gap: 1.5rem;
  padding: 2rem 0;
}
@media (min-width: 640px) {
  .article-list { grid-template-columns: repeat(2, 1fr); }
}
.article-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}
.article-card__media {
  aspect-ratio: 16 / 9;
  background: var(--surface);
}
.article-card__media img { width: 100%; height: 100%; object-fit: cover; }
.article-card__body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.article-card h3 { font-size: 1.05rem; line-height: 1.35; }
.article-card h3 a::after { content: ""; position: absolute; inset: 0; }
.article-card { position: relative; }
.article-card h3 a { position: static; }
.article-card:hover, .article-card:has(a:focus-visible) {
  border-color: var(--accent-text);
}
.article-card .excerpt {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
}
.meta {
  color: var(--text-faint);
  font-size: 0.82rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.meta .tag {
  color: var(--accent-text);
  font-weight: 600;
}

.empty-state {
  padding: 3rem 0;
  text-align: center;
  color: var(--text-muted);
}

.error-page { padding: 4rem 0; text-align: center; }
.error-page h1 { margin-top: 0.5rem; font-size: 1.6rem; }
.error-page p { color: var(--text-muted); margin-top: 0.75rem; }
.error-page .btn { margin-top: 1.5rem; display: inline-flex; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  padding: 1rem 0 3rem;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  min-width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.pagination a:hover, .pagination a:focus-visible { color: var(--accent-text); border-color: var(--accent-text); }
.pagination .current { background: var(--accent-strong); color: #fff; border-color: var(--accent-strong); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ===== Article page ===== */
.article-hero {
  aspect-ratio: 21 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 1.5rem 0;
}
.article-hero img { width: 100%; height: 100%; object-fit: cover; }
.article-header { padding-top: 2rem; }
.article-header h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); line-height: 1.2; }
.article-header .meta { margin-top: 0.75rem; }
.article-header .excerpt { color: var(--text-muted); font-size: 1.1rem; margin-top: 1rem; }

.article-body {
  font-size: 1.05rem;
  padding: 1.5rem 0 2rem;
}
.article-body h2 { font-size: 1.4rem; margin-top: 2rem; margin-bottom: 0.75rem; }
.article-body h3 { font-size: 1.15rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.article-body p { margin: 1rem 0; }
.article-body ul, .article-body ol { margin: 1rem 0; padding-left: 1.4rem; }
.article-body li { margin: 0.35rem 0; }
.article-body a { color: var(--accent-text); text-decoration: underline; text-decoration-color: var(--border); }
.article-body a:hover, .article-body a:focus-visible { text-decoration-color: var(--accent-text); }
.article-body blockquote {
  margin: 1.25rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--accent-strong);
  color: var(--text-muted);
}
.article-body code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.9em;
}
.article-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}
.article-body pre code { border: 0; padding: 0; background: none; }
.article-body img { border-radius: 10px; margin: 1.25rem 0; }

.sources {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 1.5rem;
}
.sources h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.6rem;
}
.sources ul { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.sources a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  word-break: break-word;
  font-size: 0.92rem;
}
.sources a:hover, .sources a:focus-visible { text-decoration-color: var(--accent-text); }

.lang-note {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* ===== Search page ===== */
.search-header { padding: 2rem 0 0.5rem; }
.search-header h1 { font-size: 1.6rem; }
.search-header form.search-form { margin-top: 1rem; width: 100%; max-width: 28rem; }
.search-header form.search-form input[type="search"] { width: 100%; }

/* ===== Footer (THEME.md §7 — contenu standard, tous sites thbl) ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 2.5rem;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.site-footer__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}
.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.site-footer__brand img { height: 14px; width: auto; opacity: 0.8; }
.footer-link {
  color: var(--text-faint);
  text-decoration: underline;
  text-decoration-color: var(--border);
}
.footer-link:hover, .footer-link:focus-visible { color: var(--accent-text); text-decoration-color: var(--accent-text); }
@media (max-width: 480px) {
  .site-footer__row { flex-direction: column; align-items: flex-start; }
}

/* ===== Boutons génériques ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.btn:hover { border-color: var(--accent-text); color: var(--accent-text); }
.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); color: #fff; opacity: .92; }
.btn-danger { color: var(--danger-text); border-color: var(--danger-text); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; }
