/* ============================================================
   Atelier du Terroir — Thème frontend démo
   Palette : vert nature, blanc cassé, warm orange
   ============================================================ */

:root {
    --green-dark:  #2D5016;
    --green:       #4A7C59;
    --green-light: #8DB97F;
    --green-pale:  #EEF4E9;
    --bg:          #F7F6F0;
    --bg-card:     #FFFFFF;
    --text:        #2C2C2C;
    --text-muted:  #6B6B6B;
    --border:      #D4C9B0;
    --accent:      #E8892A;
    --accent-hover:#C9701A;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: Georgia, 'Times New Roman', serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    padding-top: 40px; /* bandeau démo */
}

/* ── Typographie ────────────────────────────────────────────── */
h1, h2, h3 { font-family: Georgia, serif; color: var(--green-dark); line-height: 1.3; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
p  { margin-bottom: 1rem; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-hover); }

/* ── Layout ─────────────────────────────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.container--narrow { max-width: 720px; }

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
    background: var(--bg-card);
    border-bottom: 2px solid var(--green-pale);
    position: sticky;
    top: 40px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}
.site-header__brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
}
.site-header__icon {
    width: 42px;
    height: 42px;
    background: var(--green-pale);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.site-header__name { font-size: 1.25rem; font-weight: bold; color: var(--green-dark); }
.site-header__tagline { font-size: .75rem; color: var(--text-muted); font-family: system-ui, sans-serif; }
.site-header__admin-link {
    font-family: system-ui, sans-serif;
    font-size: .8rem;
    background: var(--green);
    color: #fff;
    padding: .4rem .9rem;
    border-radius: 6px;
    font-weight: 600;
    transition: background .2s;
}
.site-header__admin-link:hover { background: var(--green-dark); text-decoration: none; }

/* ── Hero liste ─────────────────────────────────────────────── */
.page-hero {
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
    color: #fff;
    padding: 3rem 1.5rem;
    text-align: center;
}
.page-hero h1 { color: #fff; margin-bottom: .5rem; }
.page-hero p  { color: rgba(255,255,255,.8); font-size: 1.05rem; margin-bottom: 0; font-family: system-ui, sans-serif; }

/* ── Grille articles ─────────────────────────────────────────── */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    padding: 2.5rem 0;
}

/* ── Card article ────────────────────────────────────────────── */
.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
    text-decoration: none;
    color: inherit;
}
.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(45, 80, 22, .12);
    text-decoration: none;
}
.article-card__img {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--green-pale);
    position: relative;
}
.article-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}
.article-card:hover .article-card__img img { transform: scale(1.04); }
.article-card__img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--green-light);
}
.article-card__body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.article-card__date { font-family: system-ui, sans-serif; font-size: .75rem; color: var(--text-muted); }
.article-card__title { font-size: 1.05rem; color: var(--green-dark); line-height: 1.4; }
.article-card__resume { font-size: .875rem; color: var(--text-muted); font-family: system-ui, sans-serif; line-height: 1.5; flex: 1; }
.article-card__link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-family: system-ui, sans-serif;
    font-size: .8rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: .5rem;
}
.article-card__link::after { content: '→'; }

/* ── Page article ────────────────────────────────────────────── */
.article-header { padding: 2.5rem 0 1.5rem; }
.article-header__back {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-family: system-ui, sans-serif;
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}
.article-header__back::before { content: '←'; }
.article-header__back:hover { color: var(--accent); text-decoration: none; }
.article-header__meta {
    font-family: system-ui, sans-serif;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}
.article-header__title { font-size: 2rem; margin-bottom: 1rem; }
.article-header__resume {
    font-size: 1.1rem;
    color: var(--text-muted);
    border-left: 4px solid var(--green);
    padding-left: 1rem;
    font-style: italic;
}

/* ── Galerie images article ──────────────────────────────────── */
.article-gallery { margin: 2rem 0; }
.article-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem;
}
.article-gallery__item {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: var(--green-pale);
    cursor: pointer;
}
.article-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}
.article-gallery__item:hover img { transform: scale(1.05); }
.article-gallery__caption { font-size: .75rem; color: var(--text-muted); margin-top: .4rem; font-family: system-ui, sans-serif; text-align: center; }

/* ── Contenu article ─────────────────────────────────────────── */
.article-content { padding: 0 0 3rem; }
.article-content h3 { margin: 1.5rem 0 .75rem; color: var(--green); }
.article-content ul, .article-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.article-content li { margin-bottom: .35rem; }
.article-content strong { color: var(--green-dark); }
.article-content em { color: var(--text-muted); }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-state__icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state__text { color: var(--text-muted); font-family: system-ui, sans-serif; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
    background: var(--green-dark);
    color: rgba(255,255,255,.7);
    padding: 2rem 1.5rem;
    text-align: center;
    font-family: system-ui, sans-serif;
    font-size: .8rem;
    margin-top: 3rem;
}
.site-footer a { color: var(--accent); }
.site-footer a:hover { color: var(--accent-hover); }
.site-footer__demo-note {
    display: inline-block;
    background: rgba(255,255,255,.1);
    border-radius: 6px;
    padding: .4rem .8rem;
    margin-top: .75rem;
    font-style: italic;
}

/* ── Burger toggle ───────────────────────────────────────────── */
.nav-toggle {
    display: none;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--green-dark);
    flex-shrink: 0;
}

/* ── Mobile nav ──────────────────────────────────────────────── */
.site-nav--mobile {
    display: none;
    flex-direction: column;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.5rem 1rem;
    gap: 0.25rem;
}
.site-nav--mobile.open { display: flex; }

.mobile-nav__link {
    display: block;
    padding: 0.65rem 0.5rem;
    font-family: system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--green-dark);
    text-decoration: none;
    border-bottom: 1px solid var(--green-pale);
}
.mobile-nav__link:hover { color: var(--accent); text-decoration: none; }

/* Admin link mobile — discret, en bas du menu */
.site-nav--mobile .admin-link-mobile {
    margin-top: 0.5rem;
    border-top: 1px solid var(--border) !important;
    border-bottom: none !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    opacity: 0.4;
    color: var(--text-muted) !important;
}
.site-nav--mobile .admin-link-mobile:hover,
.site-nav--mobile .admin-link-mobile:active {
    opacity: 1;
    color: var(--green-dark) !important;
}

/* Footer admin */
.site-footer__admin {
    margin-top: 0.75rem;
}

/* ── Admin link — mobile/desktop ─────────────────────────────── */
@media (min-width: 601px) {
    .nav-toggle { display: none; }
    .admin-link-desktop { opacity: 0.35; transition: opacity 0.2s; }
    .admin-link-desktop:hover { opacity: 1; }
}

@media (max-width: 600px) {
    .admin-link-desktop { display: none; }
    .nav-toggle { display: block; }
    .theme-toggle { display: none; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    h1 { font-size: 1.7rem; }
    .articles-grid { grid-template-columns: 1fr; }
    .site-header__tagline { display: none; }
}

/* ── Toggles dans le menu mobile ────────────────────────────── */
.mobile-toggles {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 0 0.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
}
.mobile-toggle-btn {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.85rem;
    font-family: Georgia, serif;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.mobile-toggle-btn:hover {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}
@media (min-width: 601px) {
    .mobile-toggles { display: none; }
}

/* ── Bouton toggle light/dark ────────────────────────────────── */
.theme-toggle {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 99px;
    padding: 0.3rem 0.7rem;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover {
    background: var(--green-pale);
    border-color: var(--green);
    color: var(--green-dark);
}

/* ── Dark mode ───────────────────────────────────────────────── */
html[data-theme="dark"] {
    /* Accents éclairés pour lisibilité sur fonds sombres */
    --green-dark:  #6FAE8A;   /* était #2D5016 — illisible sur fond sombre */
    --green:       #5A9E75;   /* était #4A7C59 — légèrement éclairci */
    --green-pale:  #0A1A0A;
    --bg:          #111412;
    --bg-card:     #1A201A;
    --text:        #E8E8E0;
    --text-muted:  #8FA090;
    --border:      #283528;
}

/* Footer : conserver le fond sombre caractéristique */
html[data-theme="dark"] .site-footer {
    background: #081208;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3 {
    color: #B8D4A8;
}

html[data-theme="dark"] .article-header__title {
    color: #D0E8C0;
}

html[data-theme="dark"] .article-card__title {
    color: #B8D4A8;
}

/* Éléments spécifiques non couverts par h1-h3 */
html[data-theme="dark"] .site-header__name    { color: #B8D4A8; }
html[data-theme="dark"] .nav-toggle           { color: #8FA090; }
html[data-theme="dark"] .mobile-nav__link     { color: #B8D4A8; }
html[data-theme="dark"] .article-content strong { color: #B8D4A8; }
html[data-theme="dark"] .contact-info h2,
html[data-theme="dark"] .contact-form-wrap h2  { color: #B8D4A8; }
