/*
 * Structure commune à tous les thèmes. Les thèmes (theme-*.css) redéfinissent les variables
 * et ajoutent leur signature visuelle ; ils ne doivent pas avoir à défaire ce fichier.
 */

:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --ink: #1a1a1a;
    --muted: #555555;
    --line: #dddddd;
    --accent: #2f6a12;
    --buy-bg: #1a1a1a;
    --buy-ink: #ffffff;
    --silo: var(--accent);

    --font-body: system-ui, sans-serif;
    --font-display: var(--font-body);
    --font-meta: var(--font-body);

    --radius-s: 4px;
    --radius-m: 8px;
    --radius-l: 16px;

    --measure: 68ch;
    --wide: 1180px;
    --gutter: clamp(16px, 4vw, 40px);
    --space: clamp(48px, 8vw, 96px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; }

.skip-link {
    position: absolute; left: 16px; top: -100px; z-index: 100;
    background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-s);
}
.skip-link:focus { top: 16px; }

/* ---------- En-tête ---------- */

.site-header__inner {
    max-width: var(--wide); margin: 0 auto; padding: 18px var(--gutter);
    display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand__name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 22px; }
.site-nav a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.site-nav a[aria-current] { text-decoration: underline; text-underline-offset: 0.35em; text-decoration-thickness: 2px; }
.nav-toggle { display: none; }

@media (max-width: 760px) {
    .nav-toggle {
        display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
        font: inherit; font-weight: 600; color: inherit; background: none;
        border: 1px solid currentColor; border-radius: var(--radius-m); cursor: pointer;
    }
    .site-nav { flex-basis: 100%; display: none; }
    .site-nav.is-open { display: block; }
    .site-nav ul { flex-direction: column; gap: 0; }
    .site-nav li + li { border-top: 1px solid var(--line); }
}

/* ---------- Conteneurs ---------- */

.hero, .home-featured, .home-silos, .home-method,
.article, .hub, .error-page {
    max-width: var(--wide); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter);
}
.home-featured, .home-silos, .home-method { padding-top: var(--space); }
.section-title { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 28px; }

/* ---------- Fil d'Ariane ---------- */

.breadcrumb ol { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; font-family: var(--font-meta); font-size: 0.875rem; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin: 0 8px; opacity: 0.6; }
.breadcrumb a { color: inherit; }

/* ---------- Page de contenu ---------- */

.article__header, .hub__header { padding-top: clamp(32px, 6vw, 72px); padding-bottom: 32px; max-width: 900px; }
.article__title, .hub__title { font-size: clamp(2.1rem, 5vw, 3.5rem); }
.article__lede, .hub__lede { font-size: 1.25rem; line-height: 1.5; color: var(--muted); margin: 18px 0 0; max-width: 60ch; }
.article__meta { font-family: var(--font-meta); font-size: 0.875rem; color: var(--muted); margin: 18px 0 0; }

.article__layout { display: grid; gap: 40px; padding-bottom: var(--space); }
.prose { max-width: var(--measure); min-width: 0; }
@media (min-width: 1000px) {
    .article__layout.has-toc { grid-template-columns: minmax(0, var(--measure)) 260px; justify-content: space-between; }
    .article__layout.has-toc .toc { order: 2; position: sticky; top: 24px; align-self: start; }
}

.toc__title { font-family: var(--font-meta); font-weight: 700; margin: 0 0 10px; }
.toc ol { margin: 0; padding-left: 1.3em; font-size: 0.95rem; line-height: 1.45; }
.toc li + li { margin-top: 8px; }
.toc a { color: inherit; }

.prose > * + * { margin-top: 1.1em; }
.prose p, .prose ul, .prose ol { margin-bottom: 0; }
.prose h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 2.2em; }
.prose h3 { font-size: 1.25rem; margin-top: 1.8em; }
.prose li + li { margin-top: 0.45em; }
.prose ul, .prose ol { padding-left: 1.4em; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; line-height: 1.4; min-width: 520px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.prose thead th { font-family: var(--font-meta); }

/* ---------- Produits ---------- */

.button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px;
    font-family: var(--font-body); font-weight: 700; font-size: 1rem; text-decoration: none; border-radius: var(--radius-m);
    background: var(--buy-bg); color: var(--buy-ink); border: 0; cursor: pointer;
}
.button:hover { text-decoration: none; filter: brightness(1.1); }
.button--small { min-height: 44px; padding: 0 16px; font-size: 0.9375rem; }

.product { display: grid; gap: 20px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.product__media img { width: 140px; height: 140px; object-fit: contain; }
@media (min-width: 640px) { .product:has(.product__media) { grid-template-columns: 140px 1fr; } }
.product__brand { font-family: var(--font-meta); font-size: 0.8125rem; color: var(--muted); margin: 0; }
.product__name { font-size: 1.3rem; margin: 4px 0 0; }
.product__for { font-weight: 700; margin: 8px 0 0; }
.product__summary { margin: 8px 0 0; color: var(--muted); }
.product__verdict { display: grid; gap: 16px; margin-top: 16px; }
@media (min-width: 640px) { .product__verdict { grid-template-columns: 1fr 1fr; } }
.product__list-title { font-family: var(--font-meta); font-weight: 700; font-size: 0.875rem; margin: 0 0 6px; }
.product__verdict ul { margin: 0; padding-left: 1.2em; font-size: 0.95rem; line-height: 1.45; }
.product__verdict li + li { margin-top: 4px; }
.product__action { margin-top: 20px; }
@media (max-width: 639px) { .product__action .button { width: 100%; } }

.picks { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px 24px; background: var(--surface); }
.picks__title { font-family: var(--font-meta); font-weight: 700; margin: 0 0 12px; }
.picks__list { margin: 0; padding: 0; list-style: none; counter-reset: pick; }
.pick { counter-increment: pick; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; padding: 14px 0; }
.pick + .pick { border-top: 1px solid var(--line); }
.pick::before { content: counter(pick); grid-row: span 2; font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; min-width: 1.2em; }
.pick__for { font-family: var(--font-meta); font-size: 0.875rem; color: var(--muted); }
.pick__name { color: inherit; font-weight: 700; }
.pick .button { grid-column: 2; justify-self: start; margin-top: 6px; }
@media (min-width: 720px) {
    .pick { grid-template-columns: auto 1fr auto; }
    .pick .button { grid-column: 3; grid-row: 1 / span 2; margin: 0; }
}

/* ---------- Pages mères ---------- */

.hub { padding-bottom: var(--space); }
.hub__intro { margin-bottom: 40px; }
.hub__group + .hub__group { margin-top: 48px; }
.hub__group-title { font-size: 1.4rem; margin-bottom: 16px; }
.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.entry { padding: 18px 0; border-top: 1px solid var(--line); }
.entry__link { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: inherit; text-decoration: none; }
.entry__link:hover { text-decoration: underline; }
.entry__text { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }

/* ---------- Liens de fin de page ---------- */

.related { max-width: var(--measure); padding: 32px 0 var(--space); border-top: 1px solid var(--line); }
.related__title { font-size: 1.15rem; margin-bottom: 14px; }
.related__list { margin: 0; padding-left: 1.2em; }
.related__list li + li { margin-top: 6px; }

/* ---------- Pied de page ---------- */

.site-footer { margin-top: var(--space); border-top: 1px solid var(--line); }
.site-footer__inner { max-width: var(--wide); margin: 0 auto; padding: 40px var(--gutter) 56px; font-size: 0.9375rem; color: var(--muted); }
.site-footer__about { margin: 0; max-width: 70ch; }
.site-footer__disclosure { margin: 12px 0 0; }
.site-footer__links { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 24px; }
.site-footer__links a { color: inherit; display: inline-block; padding: 10px 0; }

.error-page { padding-top: clamp(48px, 8vw, 96px); max-width: 760px; }
.error-page__title { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 16px; }

/* ---------- Comparateur de styles (local uniquement) ---------- */

.theme-switch {
    position: fixed; right: 12px; bottom: 12px; z-index: 50; display: flex; gap: 4px; padding: 4px;
    background: #ffffff; border: 1px solid #c8c8c8; border-radius: 999px; font: 600 13px/1 system-ui, sans-serif;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.theme-switch a { color: #333333; text-decoration: none; padding: 8px 12px; border-radius: 999px; }
.theme-switch a[aria-current] { background: #333333; color: #ffffff; }

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

/* Les blocs produit insérés dans .prose gardent leurs propres marges */
.prose .product h3 { margin-top: 4px; }
.prose .product__name { font-size: 1.3rem; }
.prose .product ul { padding-left: 1.2em; }
.prose .product, .prose .picks { margin-top: 1.6em; margin-bottom: 1.6em; }
