/* ================================================
   STARTER TEMPLATE — SAVEURS DU MONDE
   Site de recettes à convertir en thème WordPress
   CMS Q4 Web — Séance 3
   ================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ---- VARIABLES ---- */
:root {
    --primary: #d35400;
    --primary-light: #e67e22;
    --primary-dark: #a04000;
    --bg: #fdfaf6;
    --card-bg: #ffffff;
    --text: #2c1810;
    --text-light: #7a6b62;
    --text-muted: #a09080;
    --border: #e8ddd4;
    --shadow: 0 2px 12px rgba(44, 24, 16, 0.08);
    --shadow-hover: 0 8px 24px rgba(44, 24, 16, 0.15);
    --radius: 12px;
    --badge-easy: #27ae60;
    --badge-medium: #f39c12;
    --badge-hard: #e74c3c;
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---- RESET ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

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


/* ================================================
   LAYOUT
   ================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}


/* ================================================
   HEADER
   En WordPress → header.php
   ================================================ */

.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.site-logo span {
    color: var(--primary);
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.site-nav a {
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--primary);
}

/* Menu hamburger mobile */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}


/* ================================================
   HERO — Page d'accueil
   ================================================ */

.hero {
    padding: 4rem 0 2rem;
    text-align: center;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}


/* ================================================
   GRILLE DE RECETTES
   En WordPress → archive-recette.php (The Loop)
   ================================================ */

.recipes-section {
    padding: 2rem 0 4rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
}

.recipes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}


/* ================================================
   CARTE DE RECETTE
   En WordPress → dans The Loop de archive-recette.php
   ================================================ */

.recipe-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

/* Image de la carte */
.recipe-card__image {
    height: 220px;
    overflow: hidden;
    position: relative;
}

.recipe-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.recipe-card:hover .recipe-card__image img {
    transform: scale(1.05);
}

/* Placeholder d'image (gradient + emoji) */
/* En WordPress → remplacé par the_post_thumbnail() */
.recipe-card__image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    user-select: none;
}

.recipe-card__image--placeholder.tajine {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}

.recipe-card__image--placeholder.padthai {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.recipe-card__image--placeholder.tiramisu {
    background: linear-gradient(135deg, #c9a96e 0%, #6d4c2a 100%);
}

/* Corps de la carte */
.recipe-card__body {
    padding: 1.25rem;
}

.recipe-card__category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.recipe-card__title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.recipe-card__title a {
    color: var(--text);
}

.recipe-card__title a:hover {
    color: var(--primary);
}

/* Métadonnées (temps, personnes, difficulté) */
/* En WordPress → get_field('temps_de_preparation'), etc. */
.recipe-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.recipe-card__meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Extrait */
/* En WordPress → the_excerpt() ou wp_trim_words() */
.recipe-card__excerpt {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
}


/* ================================================
   BADGES DE DIFFICULTÉ
   En WordPress → get_field('difficulte')
   ================================================ */

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    line-height: 1.6;
}

.badge--facile { background: var(--badge-easy); }
.badge--moyen { background: var(--badge-medium); }
.badge--difficile { background: var(--badge-hard); }


/* ================================================
   PAGE RECETTE INDIVIDUELLE — HERO
   En WordPress → single-recette.php
   ================================================ */

.recipe-hero {
    height: 400px;
    position: relative;
    overflow: hidden;
}

.recipe-hero--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    user-select: none;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}

.recipe-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipe-hero__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem 0 2rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
}

.recipe-hero__category {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.recipe-hero__title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
}


/* ================================================
   PAGE RECETTE — LAYOUT 2 COLONNES
   ================================================ */

.recipe-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    padding: 2rem 0 4rem;
}

/* Lien retour */
.nav-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1.5rem 0;
    color: var(--primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-back:hover {
    color: var(--primary-dark);
}


/* ================================================
   PAGE RECETTE — CONTENU PRINCIPAL
   ================================================ */

.recipe-content h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
    color: var(--text);
}

.recipe-content h2:first-child {
    margin-top: 0;
}

.recipe-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--text-light);
}

/* Étapes numérotées */
/* En WordPress → the_content() ou champs ACF */
.recipe-steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
}

.recipe-steps li {
    counter-increment: step;
    padding: 1.25rem 1.25rem 1.25rem 4rem;
    position: relative;
    margin-bottom: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    line-height: 1.7;
    color: var(--text-light);
}

.recipe-steps li::before {
    content: counter(step);
    position: absolute;
    left: 1.25rem;
    top: 1.25rem;
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}


/* ================================================
   PAGE RECETTE — SIDEBAR (Champs ACF)
   ================================================ */

/* Carte métadonnées */
/* En WordPress → get_field('temps_de_preparation'), etc. */
.recipe-meta-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
    align-self: start;
    z-index: 2;
}

.recipe-meta-card h3,
.recipe-ingredients h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
}

.recipe-meta-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.recipe-meta-item:last-child {
    border-bottom: none;
}

.recipe-meta-item__label {
    color: var(--text-light);
}

.recipe-meta-item__value {
    font-weight: 600;
}

/* Carte ingrédients */
/* En WordPress → get_field('ingredients') + explode("\n") */
.recipe-ingredients {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-top: 1.5rem;
}

.recipe-ingredients ul {
    list-style: none;
    padding: 0;
}

.recipe-ingredients li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    border-bottom: 1px dashed var(--border);
    font-size: 0.95rem;
    position: relative;
    color: var(--text-light);
}

.recipe-ingredients li:last-child {
    border-bottom: none;
}

.recipe-ingredients li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
    font-size: 1.2rem;
}


/* ================================================
   NAVIGATION ENTRE ARTICLES
   En WordPress → previous_post_link() / next_post_link()
   ================================================ */

.post-nav {
    display: flex;
    justify-content: space-between;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

.post-nav a {
    font-weight: 500;
    font-size: 0.95rem;
}


/* ================================================
   FOOTER
   En WordPress → footer.php
   ================================================ */

.site-footer {
    background: var(--text);
    color: rgba(255, 255, 255, 0.7);
    padding: 2.5rem 0;
    margin-top: 4rem;
    text-align: center;
    font-size: 0.9rem;
}

.site-footer a {
    color: var(--primary-light);
}


/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 992px) {
    .recipes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .recipe-layout {
        grid-template-columns: 1fr;
    }

    .recipe-meta-card {
        position: static;
    }

    /* Sidebar passe en dessous sur tablette */
    .recipe-layout aside {
        order: -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }

    .recipe-ingredients {
        margin-top: 0;
    }

    .recipe-hero {
        height: 350px;
    }

    .recipe-hero__title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .site-nav ul {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .site-nav.open ul {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .recipe-layout aside {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .recipes-grid {
        grid-template-columns: 1fr;
    }

    .recipe-hero {
        height: 280px;
    }

    .recipe-hero__title {
        font-size: 1.6rem;
    }

    .recipe-hero__overlay {
        padding: 2rem 0 1.5rem;
    }

    .post-nav {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}


/* ================================================
   FILTRES — Boutons de filtrage par taxonomie
   ================================================ */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.filtre-btn {
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 25px;
    background: var(--card-bg);
    color: var(--text-light);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filtre-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filtre-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}


/* ================================================
   CHEF — Styles spécifiques
   ================================================ */

.chef-pays {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.chef-specialites {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 2rem;
}

.chef-specialites li {
    background: var(--primary-light);
    color: white;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.related-chefs {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 1rem 0 2rem;
}

.related-chef {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s, box-shadow 0.2s;
}

.related-chef:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.related-chef img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.related-chef span {
    font-weight: 600;
}


/* ================================================
   WordPress — Styles pour les images générées
   ================================================ */

.recipe-card__image img,
.recipe-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* ================================================
   MENU — État actif (WordPress ajoute ces classes)
   ================================================ */

.site-nav .current-menu-item > a,
.site-nav .current-menu-ancestor > a,
.site-nav .current-menu-parent > a,
.site-nav .current_page_item > a {
    color: var(--primary) !important;
    font-weight: 600;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 2px;
}
