/*
 * Structure commune à tous les thèmes. Aucune couleur ni police en dur :
 * tout passe par les variables définies dans styles/themes/<thème>.css.
 */
:root {
    --bg: #fff; --surface: #fff; --text: #222; --muted: #666;
    --primary: #333; --primary-text: #fff; --accent: #333; --danger: #c62828;
    --border: #ddd; --radius: 10px; --shadow: none;
    --font-body: system-ui, sans-serif; --font-title: system-ui, sans-serif;
    --title-weight: 800; --title-transform: none; --title-spacing: normal;
    --giant-bg: var(--primary); --giant-text: var(--primary-text);
    --giant-shadow: var(--shadow); --giant-radius: var(--radius);
    --card-tilt: 0deg;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font-family: var(--font-body); font-size: 1.05rem; line-height: 1.6;
    min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; padding-block: 2rem 4rem; }
a { color: var(--accent); }
img, iframe { max-width: 100%; }
h1, h2, h3, .logo-text, .btn-giant {
    font-family: var(--font-title); font-weight: var(--title-weight);
    text-transform: var(--title-transform); letter-spacing: var(--title-spacing);
    line-height: 1.15;
}
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 .5rem; }
h2 { font-size: 1.6rem; }

.container { width: min(1100px, 100% - 2.5rem); margin-inline: auto; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem; z-index: 10; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.signup-hint { margin-top: 1.5rem; padding: .8rem 1rem; border: 2px dashed var(--border); border-radius: var(--radius); }
.signup-hint a { font-weight: 700; }
.center { text-align: center; }
.lead { font-size: 1.2rem; color: var(--muted); }

/* En-tête */
.site-header { background: var(--header-bg, var(--surface)); border-bottom: var(--header-border, 1px solid var(--border)); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .9rem; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--header-text, var(--text)); }
.logo-icon { font-size: 1.8rem; }
.logo-text { font-size: 1.45rem; }
.main-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.main-nav a:not(.btn) { color: var(--header-text, var(--text)); text-decoration: none; font-weight: 600; }
.main-nav a:not(.btn):hover { color: var(--accent); }

/* Boutons */
.btn {
    display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
    padding: .7rem 1.2rem; border-radius: var(--radius); border: 2px solid transparent;
    font: inherit; font-weight: 700; text-decoration: none; transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); }
.btn-small { padding: .45rem .9rem; font-size: .95rem; }
.btn-primary { background: var(--primary); color: var(--primary-text); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-like { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-like.is-liked { background: var(--accent); color: var(--primary-text); border-color: var(--accent); }

/* LE gros bouton */
.btn-giant {
    display: inline-flex; align-items: center; justify-content: center; gap: .8rem;
    font-size: clamp(1.8rem, 6vw, 3.4rem); padding: 1.6rem 3rem; margin-block: 1.5rem;
    background: var(--giant-bg); color: var(--giant-text); border: var(--giant-border, none);
    border-radius: var(--giant-radius); box-shadow: var(--giant-shadow);
    text-decoration: none; cursor: pointer; transition: transform .15s;
}
.btn-giant:hover { transform: scale(1.04) rotate(-1deg); }
.btn-giant:active { transform: scale(.97); }
.btn-giant-icon { font-size: 1.2em; }
.btn-submit { width: 100%; font-size: 1.6rem; padding: 1.1rem; }

/* Accueil */
.hero { text-align: center; padding-block: 2.5rem 1.5rem; }
.hero-title { font-size: clamp(2.4rem, 7vw, 4.5rem); }
.hero-accent { color: var(--accent); }
.hero-secondary { display: flex; justify-content: center; align-items: center; gap: 1rem; flex-wrap: wrap; }
.counter { color: var(--muted); font-weight: 600; }
.home-section { margin-top: 3rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.pitch { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }

/* Cartes */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.3rem; }
.card {
    background: var(--surface); border: var(--card-border, 1px solid var(--border));
    border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--card-shadow, var(--shadow));
    display: flex; flex-direction: column; gap: .5rem; transition: transform .15s;
}
.card-grid .card:nth-child(odd) { transform: rotate(var(--card-tilt)); }
.card-grid .card:nth-child(even) { transform: rotate(calc(var(--card-tilt) * -1)); }
.card-grid .card:hover { transform: rotate(0) translateY(-4px); }
.card-title { margin: 0; font-size: 1.3rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-excerpt { margin: 0; color: var(--muted); flex: 1; }
.card-meta { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; font-size: .88rem; color: var(--muted); }
.likes { color: var(--accent); font-weight: 700; }
.sketch-card { cursor: pointer; }
.sketch-card:hover .card-title a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.card-like { margin: 0; display: inline; }
button.likes { background: none; border: 1px solid transparent; border-radius: 999px; padding: .1rem .45rem; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; transition: transform .1s; }
button.likes:hover { border-color: var(--accent); transform: scale(1.1); }
button.likes.is-liked { background: var(--accent); color: var(--primary-text); }

.tag { display: inline-block; padding: .15rem .6rem; border-radius: 999px; background: var(--tag-bg, var(--bg)); color: var(--tag-text, var(--accent)); text-decoration: none; font-size: .88rem; font-weight: 600; border: 1px solid var(--border); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag small { opacity: .6; }

/* Listes */
.page-head { margin-bottom: 1rem; }
.sort-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.sort-link { padding: .4rem 1rem; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 600; }
.sort-link.is-active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.pagination { display: flex; justify-content: center; gap: .4rem; margin-top: 2.5rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 2.4rem; padding: .4rem .7rem; text-align: center; border-radius: var(--radius); border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.pagination .current { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.pagination .gap { border: none; }
.empty-state { text-align: center; padding: 3rem 1rem; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); margin-top: 2rem; }

/* Détail */
.sketch-detail { max-width: 760px; margin-inline: auto; }
.sketch-body { font-size: 1.15rem; margin-block: 1.5rem; }
.video { position: relative; aspect-ratio: 16 / 9; margin-block: 1.5rem; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--radius); }
.sketch-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }
.prose { max-width: 760px; margin-inline: auto; }

/* Mécanismes */
.mechanism-family { margin-top: 2.5rem; }
.mechanism-family h2, .mechanism-ideas h2 { margin-bottom: 1rem; }
.mechanism h2 { margin-top: 2rem; }
.mechanism-status { padding: .7rem 1rem; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); font-size: .95rem; }
.mechanism-ideas { margin-top: 3rem; }
.mechanism-cta { text-align: center; margin-top: 3rem; }

/* Formulaires */
.form-page { max-width: 720px; margin-inline: auto; }
.form-page.narrow { max-width: 480px; }
.sketch-form > div, .form-row { margin-bottom: 1.3rem; }
label { display: block; font-weight: 700; margin-bottom: .35rem; }
input[type=text], input[type=email], input[type=url], textarea, select {
    width: 100%; padding: .8rem 1rem; font: inherit; color: var(--text);
    background: var(--input-bg, var(--surface)); border: 2px solid var(--border); border-radius: var(--radius);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.help-text, .form-text { font-size: .88rem; color: var(--muted); margin-top: .3rem; }
.sketch-form ul { color: var(--danger); margin: .3rem 0 0; padding-left: 1.2rem; font-weight: 600; }
.email-box { background: var(--tag-bg, var(--bg)); border: 2px dashed var(--accent); border-radius: var(--radius); padding: 1.1rem 1.2rem .4rem; margin-bottom: 1.3rem; }
.hp-field { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.inline-form { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-bottom: 2rem; }
.inline-form label { margin: 0; }
.inline-form input { width: auto; flex: 1; min-width: 200px; }

/* Messages */
.flash { padding: .9rem 1.2rem; border-radius: var(--radius); margin-bottom: 1.5rem; font-weight: 600; border: 1px solid var(--border); background: var(--surface); }
.flash-success { border-color: #2e7d32; }
.flash-error { border-color: var(--danger); color: var(--danger); }

/* Tableaux, modération */
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { text-align: left; padding: .7rem; border-bottom: 1px solid var(--border); }
.status { font-weight: 700; font-size: .88rem; }
.status-ok { color: #2e7d32; } .status-wait { color: #e68a00; } .status-no { color: var(--danger); }
.moderation-card { margin-bottom: 1.5rem; }
.moderation-actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.reject-form { display: flex; gap: .5rem; flex: 1; flex-wrap: wrap; }
.reject-form select, .reject-form input { width: auto; flex: 1; min-width: 160px; }

/* Pied de page */
.site-footer { border-top: 1px solid var(--border); background: var(--footer-bg, var(--surface)); color: var(--muted); font-size: .92rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1.5rem; }
.footer-inner nav { display: flex; gap: 1rem; }
.footer-inner a { color: var(--muted); }

/* Sélecteur de thème (mode développeur) */
.theme-switcher {
    position: fixed; right: 1rem; bottom: 3.5rem; z-index: 100; display: flex; gap: .3rem; align-items: center; flex-wrap: wrap;
    background: #111; color: #fff; padding: .45rem .6rem; border-radius: 999px; font: 13px/1.2 system-ui, sans-serif;
    box-shadow: 0 6px 20px rgba(0,0,0,.3); opacity: .85;
}
.theme-switcher:hover { opacity: 1; }
.theme-switcher a { color: #fff; text-decoration: none; padding: .25rem .6rem; border-radius: 999px; }
.theme-switcher a.is-active, .theme-switcher a:hover { background: #fff; color: #111; }

@media (max-width: 640px) {
    .main-nav { gap: .8rem; font-size: .95rem; }
    .btn-giant { padding: 1.2rem 1.6rem; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Page d'erreur 404 : l'illustration fait le titre (« 4 », la tête du personnage, « 4 ») */
.error-page { display: grid; place-items: center; text-align: center; padding: 1rem 1rem 3rem; }
.error-content { max-width: 40rem; }
.error-visual { margin: 0; line-height: 0; }
.error-visual img { width: 100%; max-width: 38rem; height: auto; }
.error-title { font-family: var(--font-title); font-size: 1.6rem; font-weight: 700; margin: .5rem 0; }
.error-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.error-actions .btn:not(.btn-primary) { background: var(--surface); border: 3px solid var(--text); }

/* Mode développeur (App\Dev\DevMode) */
.nav-account { display: inline-flex; align-items: center; gap: .45rem; }
.nav-account img { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.dev-badge { position: fixed; left: 1rem; bottom: 1rem; z-index: 1000; padding: .35rem .8rem; border-radius: 999px; background: #2b1d3a; color: #fff; font-size: .8rem; font-weight: 700; text-decoration: none; opacity: .85; }
.dev-badge:hover { opacity: 1; color: #fff; }

/* Marmite magique (mode dev) */
.marmite-layout { display: grid; grid-template-columns: 1fr minmax(280px, 380px); gap: 2rem; align-items: start; margin-top: 1.5rem; }
.pantry h2 { margin-top: 0; }
.pantry-family { font-size: 1rem; margin: 1.2rem 0 .5rem; color: var(--muted); }
.pantry-items { display: flex; flex-wrap: wrap; gap: .5rem; }
.ingredient-chip { position: relative; display: inline-flex; align-items: stretch; border-radius: 999px; border: 2px solid var(--text); background: var(--tag-bg, var(--surface)); transition: transform .15s, opacity .15s; }
.ingredient-chip:hover { transform: translateY(-2px) rotate(-2deg); }
.ingredient-chip.is-in { opacity: .35; }
.ingredient { cursor: grab; font: inherit; font-weight: 700; font-size: .92rem; padding: .4rem .5rem .4rem .85rem; border: 0; background: none; color: var(--tag-text, var(--accent)); border-radius: 999px 0 0 999px; }
.ingredient-info { cursor: help; font: 700 .8rem/1 Georgia, serif; font-style: italic; width: 1.45rem; height: 1.45rem; margin: auto .35rem auto 0; border-radius: 50%; border: 2px solid var(--tag-text, var(--accent)); background: var(--surface); color: var(--tag-text, var(--accent)); padding: 0; }
.ingredient-info:hover, .ingredient-info:focus-visible { background: var(--tag-text, var(--accent)); color: var(--surface); }
/* Ordinateur : le résumé en bulle, tout de suite au survol (pas de survol au doigt : le i suffit). */
@media (hover: hover) {
    .ingredient-chip:hover::after { content: attr(data-summary); position: absolute; left: 0; bottom: calc(100% + .5rem); width: max-content; max-width: 260px; padding: .5rem .7rem; border-radius: 10px; background: var(--text); color: var(--surface); font-size: .85rem; font-weight: 600; line-height: 1.35; z-index: 5; pointer-events: none; }
}
.pantry-items .ingredient-chip:hover { z-index: 5; }
.pot-zone { position: sticky; top: 1rem; text-align: center; }
.pot { position: relative; border-radius: var(--radius); padding: .5rem; border: 3px dashed transparent; transition: border-color .2s; }
.pot.is-over { border-color: var(--accent); }
.pot-content { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; min-height: 3.2rem; align-content: flex-end; }
.pot-empty { margin: 0; align-self: center; }
.pot-item { display: inline-flex; align-items: center; border-radius: 999px; border: 2px solid var(--text); background: var(--surface); animation: pot-float 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.4s); }
.pot-item button { font: inherit; font-weight: 700; border: 0; background: none; color: var(--text); cursor: pointer; }
.pot-item-name { font-size: .85rem; padding: .2rem .2rem .2rem .65rem; }
.pot-item-name:hover { color: var(--accent); }
.pot-item-out { font-size: 1.05rem; line-height: 1; padding: .2rem .55rem .25rem .3rem; color: var(--muted) !important; }
.pot-item-out:hover { color: var(--danger) !important; }
.pot-svg { width: 100%; max-width: 300px; display: block; margin: -.4rem auto 0; overflow: visible; }
.pot-body, .pot-rim, .pot-foot { fill: var(--text); }
.pot-soup { fill: var(--accent); }
.pot-bubbles circle { fill: var(--primary); opacity: .85; transform-box: fill-box; transform-origin: center; animation: pot-bubble 2.2s ease-in-out infinite; }
.pot-bubbles circle:nth-child(2) { animation-delay: -.7s; } .pot-bubbles circle:nth-child(3) { animation-delay: -1.3s; } .pot-bubbles circle:nth-child(4) { animation-delay: -1.8s; }
.pot-spoon { stroke: var(--muted); stroke-width: 9; stroke-linecap: round; transform-box: view-box; transform-origin: 170px 75px; }
.pot-steam path { fill: none; stroke: var(--muted); stroke-width: 5; stroke-linecap: round; opacity: 0; transform: translateY(0); }
.pot.is-splash .pot-svg { animation: pot-splash .45s ease-out; }
.pot-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1rem; }
.pot-status { min-height: 1.6em; font-weight: 700; color: var(--accent); }
.is-cooking .pot-svg { animation: pot-shake .5s ease-in-out infinite; }
.is-cooking .pot-bubbles circle { animation-duration: .7s; }
.is-cooking .pot-spoon { animation: pot-stir 1.2s ease-in-out infinite; }
.is-cooking .pot-steam path { animation: pot-steam 1.8s ease-out infinite; }
.is-cooking .pot-steam path:nth-child(2) { animation-delay: -.6s; } .is-cooking .pot-steam path:nth-child(3) { animation-delay: -1.2s; }
.is-cooking .pot-item { animation: pot-swirl 1s linear infinite; animation-delay: calc(var(--i) * -.15s); }
.dish { margin-top: 2.5rem; padding: 1.5rem; background: var(--surface); border: var(--card-border, 1px solid var(--border)); border-radius: var(--radius); box-shadow: var(--card-shadow, var(--shadow)); animation: pot-serve .5s ease-out; }
.dish-title { margin-top: 0; font-size: 2rem; }
.dish-pitch { font-size: 1.15rem; font-weight: 700; color: var(--accent); }
.dish-ingredients { padding-left: 1.2rem; }
@keyframes pot-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-5px) rotate(2deg); } }
@keyframes pot-swirl { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(6px, -6px) rotate(8deg); } 50% { transform: translate(0, -10px) rotate(0); } 75% { transform: translate(-6px, -6px) rotate(-8deg); } 100% { transform: translate(0, 0) rotate(0); } }
@keyframes pot-bubble { 0%, 100% { transform: scale(.6); } 50% { transform: scale(1.15) translateY(-4px); } }
@keyframes pot-splash { 0% { transform: scale(1); } 40% { transform: scale(1.06, .94); } 100% { transform: scale(1); } }
@keyframes pot-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1.5deg); } 75% { transform: rotate(1.5deg); } }
@keyframes pot-stir { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-35deg); } }
@keyframes pot-steam { 0% { opacity: 0; transform: translateY(10px); } 30% { opacity: .7; } 100% { opacity: 0; transform: translateY(-25px); } }
@keyframes pot-serve { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .marmite-page *, .marmite-page *::before { animation: none !important; } }

/* Fiche d'un ingrédient : panneau à droite (ordinateur), en bas de l'écran (téléphone) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 100; }
.sheet { position: fixed; z-index: 101; top: 0; right: 0; bottom: 0; width: min(440px, 100%); overflow-y: auto; padding: 1.5rem 1.5rem 2rem; background: var(--surface); border-left: var(--card-border, 1px solid var(--border)); box-shadow: -6px 0 0 var(--accent); animation: sheet-in-right .25s ease-out; }
.sheet[hidden], .sheet-backdrop[hidden], .mobile-cook[hidden] { display: none; }
.sheet-close { position: absolute; top: .6rem; right: .8rem; font-size: 1.8rem; line-height: 1; border: 0; background: none; color: var(--muted); cursor: pointer; }
.sheet-title { margin: 0 2rem .3rem 0; }
.sheet-summary { font-weight: 700; color: var(--accent); }
.sheet-body h2 { font-size: 1.15rem; margin: 1.2rem 0 .3rem; }
.sheet-actions { position: sticky; bottom: -2rem; display: flex; flex-wrap: wrap; gap: .6rem; padding: 1rem 0 1rem; background: var(--surface); }
.mobile-cook { display: none; }
@media (max-width: 800px) {
    .sheet { top: auto; left: 0; width: 100%; max-height: 82vh; border-left: 0; border-top: var(--card-border, 1px solid var(--border)); border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 -6px 0 var(--accent); animation: sheet-in-up .25s ease-out; }
    .mobile-cook { display: block; position: fixed; z-index: 30; left: 1rem; right: 1rem; bottom: calc(3.6rem + env(safe-area-inset-bottom)); font-size: 1.15rem; padding: .8rem; }
    /* Après les règles ordinateur, sinon la marmite reste collée en haut et cache le garde-manger. */
    .marmite-layout { grid-template-columns: 1fr; gap: 1rem; }
    .pot-zone { order: -1; position: static; }
    .pot-svg { max-width: 190px; }
    .marmite-page { padding-bottom: 6rem; }
}
@keyframes sheet-in-right { from { transform: translateX(100%); } to { transform: none; } }
@keyframes sheet-in-up { from { transform: translateY(100%); } to { transform: none; } }
