/* ── Variables globales (thème neutre par défaut) ─────────── */
:root {
    --color-primary:    #2563eb;
    --color-secondary:  #64748b;
    --color-accent:     #f59e0b;
    --color-bg:         #f8fafc;
    --color-surface:    #ffffff;
    --color-text:       #1e293b;
    --color-muted:      #94a3b8;
    --color-border:     #e2e8f0;

    --font-heading: 'Georgia', serif;
    --font-body:    system-ui, -apple-system, sans-serif;

    --radius:  0.5rem;
    --shadow:  0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);

    --header-h: 88px;
}

/* ── Reset minimal ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ──────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}
.header-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}
.site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.42);
    z-index: 1;
}
.header-inner {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}
@media (max-width: 640px) {
    :root { --header-h: 64px; }
}
.site-logo {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
}
.header-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.header-nav a { color: var(--color-text); font-size: .9rem; }

/* Cloche notifications */
.notif-bell { position: relative; font-size: 1.2rem; }
.notif-badge {
    position: absolute;
    top: -6px; right: -8px;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 999px;
    line-height: 1.4;
}

/* Avatar */
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }

/* Dropdown user */
.header-user { position: relative; display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 500;
    padding-top: 8px;
    background: transparent;
    min-width: 160px;
    flex-direction: column;
}
.dropdown::before {
    content: '';
    position: absolute;
    inset: 8px 0 0 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: -1;
}
.dropdown a { display: block; padding: .6rem 1rem; font-size: .9rem; color: var(--color-text); }
.dropdown a:hover { background: var(--color-bg); }
.header-user:hover .dropdown,
.header-user:focus-within .dropdown { display: flex; }

/* Burger (mobile) */
.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .25rem;
    margin-left: auto;
}
.burger span { display: block; width: 24px; height: 2px; background: var(--color-text); border-radius: 2px; }

/* ── Hero carnet (styles de base, surchargés par les thèmes) ── */
.carnet-hero {
    position: relative;
    min-height: 200px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.carnet-hero__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}
.carnet-hero__inner {
    position: relative;
    z-index: 1;
    padding: 2rem 1.5rem 1.25rem;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,.52) 0%, transparent 100%);
}
.carnet-hero__title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,.5);
    margin-bottom: .35rem;
}
.carnet-hero__desc {
    color: rgba(255,255,255,.85);
    font-size: .95rem;
    margin: 0;
}
.carnet-badge {
    display: inline-block;
    margin-top: .5rem;
    font-size: .78rem;
    padding: .2rem .65rem;
    border-radius: 999px;
    background: rgba(0,0,0,.35);
    color: #fff;
}
/* ── Nav carnet ─────────────────────────────────────────────── */
.carnet-nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: var(--header-h);
    z-index: 90;
}
.carnet-nav__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: .25rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.carnet-nav__inner::-webkit-scrollbar { display: none; }
.carnet-nav__link {
    padding: .65rem .75rem;
    font-size: .88rem;
    color: var(--color-secondary);
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    text-decoration: none;
}
.carnet-nav__link:hover { color: var(--color-primary); text-decoration: none; }
.carnet-nav__link.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.carnet-nav__publish { margin-left: auto; }

/* ── Main & Footer ───────────────────────────────────────── */
.site-main { flex: 1; }
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: .85rem;
    color: var(--color-muted);
    border-top: 1px solid var(--color-border);
}

/* ── Flash messages ──────────────────────────────────────── */
.flash {
    padding: .75rem 1rem;
    margin: 0;
    font-size: .9rem;
    text-align: center;
}
.flash--success { background: #dcfce7; color: #166534; }
.flash--error   { background: #fee2e2; color: #991b1b; }
.flash--info    { background: #dbeafe; color: #1e40af; }

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1.25rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid transparent;
    transition: opacity .15s, background .15s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary  { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-outline  { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-danger   { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-sm       { padding: .3rem .8rem; font-size: .8rem; }
.btn-lg       { padding: .75rem 1.75rem; font-size: 1rem; }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, #1e40af 100%);
    color: #fff;
    padding: 4rem 1rem;
    text-align: center;
}
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero h1 { font-family: var(--font-heading); font-size: clamp(1.6rem, 4vw, 2.5rem); line-height: 1.25; margin-bottom: 1rem; }
.hero p  { font-size: 1.05rem; opacity: .9; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero .btn-outline { color: #fff; border-color: #fff; }

/* ── Grille carnets ──────────────────────────────────────── */
.carnets-vedette { max-width: 1200px; margin: 0 auto; padding: 2.5rem 1rem; }
.carnets-vedette h2 { font-family: var(--font-heading); font-size: 1.4rem; margin-bottom: 1.5rem; }
.carnets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}
.carnet-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    color: var(--color-text);
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
}
.carnet-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.carnet-card__cover { width: 100%; height: 160px; object-fit: cover; }
.carnet-card__cover--placeholder {
    display: flex; align-items: center; justify-content: center;
    height: 160px; background: var(--color-bg); font-size: 2.5rem;
}
.carnet-card__body { padding: 1rem; flex: 1; }
.carnet-card__body h3 { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.carnet-card__meta   { font-size: .8rem; color: var(--color-muted); margin-bottom: .4rem; }
.carnet-card__desc   { font-size: .85rem; color: var(--color-secondary); }

/* ── Page d'erreur ───────────────────────────────────────── */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 5rem; color: var(--color-muted); }

/* ── Utilitaires ─────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Modération badge ────────────────────────────────────── */
.mod-link { position:relative; }
.mod-badge { position:absolute;top:-6px;right:-10px;background:#ef4444;color:#fff;font-size:.65rem;font-weight:700;min-width:18px;height:18px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;padding:0 4px; }
.comment-sent { font-size:.82rem;color:#166534;background:#dcfce7;border-radius:.4rem;padding:.4rem .7rem;margin-top:.4rem; }

/* ── Likes ───────────────────────────────────────────────── */
.like-btn.liked { color: #ef4444; }
.like-btn.liked::before { content: '♥'; }
@keyframes like-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); }
    70%  { transform: scale(.9); }
    100% { transform: scale(1); }
}
.like-btn.like-pop { animation: like-pop .3s ease; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .header-nav { display: none; flex-direction: column; position: absolute; top: var(--header-h); left: 0; right: 0; background: var(--color-surface); border-bottom: 1px solid var(--color-border); padding: 1rem; gap: .75rem; }
    .header-nav.open { display: flex; }
    .burger { display: flex; }
    .hero { padding: 2.5rem 1rem; }
}
