/*
Theme Name: NC Canvas
Description: Thème minimal maison (pas de dépendance à un thème tiers) : contrôle total du HTML/CSS, palette et polices pilotées par site via des theme_mods.
Author: NC ECOM
Version: 1.0
Text Domain: nc-canvas
*/

/* ==========================================================================
   Variables (repli par défaut ; surchargées par site via functions.php)
   ========================================================================== */
:root {
    --color-primary: #0067FF;
    --color-primary-hover: #005EE9;
    --color-heading: #0F172A;
    --color-text: #364151;
    --color-background: #FFFFFF;
    --color-secondary-background: #E7F6FF;
    --color-border: #070614;
    --color-secondary-border: #D1DAE5;
    --color-accent: #222222;
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;

    --container-width: 1200px;
    --radius: 10px;
    --radius-pill: 999px;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.14);

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 3rem;
    --space-xl: 5rem;

    --bp-mobile: 900px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-background);
    line-height: 1.65;
    font-size: 1rem;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); }
a:hover { color: var(--color-primary-hover); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-heading);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.75rem;
}
h1 { font-size: 2.75rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.4rem; }
p { margin: 0 0 1.25rem; }
p:last-child { margin-bottom: 0; }

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
}

/* ==========================================================================
   Boutons
   ========================================================================== */
.btn {
    display: inline-block;
    padding: 0.9rem 1.9rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); text-decoration: none; }
.btn--accent { background: var(--color-accent); color: #fff; }
.btn--accent:hover { color: #fff; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--color-secondary-border);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.2s ease;
}
.site-header.is-scrolled { box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08); }
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 1rem 1.5rem;
    max-width: var(--container-width);
    margin: 0 auto;
}
.site-branding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 0;
}
.site-branding img { max-height: 44px; width: auto; }
.site-branding__title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--color-heading);
    white-space: nowrap;
}

.header-nav-area { display: flex; align-items: center; gap: var(--space-md); flex: 1; justify-content: flex-end; }

.primary-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.5rem;
    flex-wrap: nowrap;
}
.primary-nav a {
    color: var(--color-heading);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.98rem;
}
.primary-nav a:hover { color: var(--color-primary); }

.header-search { position: relative; }
.header-search__toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-heading);
    padding: 0.4rem;
    display: flex;
    align-items: center;
}
.header-search__toggle svg { width: 20px; height: 20px; }
.header-search__form {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: #fff;
    box-shadow: var(--shadow-hover);
    border-radius: var(--radius);
    padding: 0.75rem;
    width: 280px;
}
.header-search__form.is-open { display: flex; gap: 0.5rem; }
.header-search__form input[type="search"] {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--color-secondary-border);
    border-radius: 6px;
    font-family: inherit;
}
.header-search__form button {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0 1rem;
    cursor: pointer;
}

.mobile-nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.4rem; }
.mobile-nav-toggle svg { width: 26px; height: 26px; color: var(--color-heading); }

@media (max-width: 900px) {
    .primary-nav { display: none; width: 100%; order: 3; }
    .primary-nav.is-open { display: block; }
    .primary-nav ul { flex-direction: column; gap: 0; padding: 1rem 0; }
    .primary-nav a { display: block; padding: 0.65rem 0; border-top: 1px solid var(--color-secondary-border); }
    .site-header__inner { flex-wrap: wrap; }
    .header-nav-area { flex: 1; justify-content: flex-end; }
    .mobile-nav-toggle { display: flex; }
}

/* ==========================================================================
   Sections (bandes pleine largeur)
   ========================================================================== */
.section { padding: var(--space-xl) 0; }
.section + .section { border-top: none; }
.section__inner > *:first-child { margin-top: 0; }

.hero {
    position: relative;
    min-height: 460px;
    display: flex;
    align-items: center;
    color: #fff;
    background-size: cover;
    background-position: center;
    text-align: center;
}
.hero__overlay { position: absolute; inset: 0; opacity: 0.55; }
.hero__content { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: var(--space-lg) 1.5rem; }
.hero h1 { color: #fff; font-size: 2.75rem; }
.hero p { color: #fff; font-size: 1.2rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-md);
    text-align: center;
}
.stats-grid strong { display: block; font-size: 2.4rem; color: var(--color-primary); font-family: var(--font-heading); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); align-items: center; }
.split img { border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* ==========================================================================
   Grilles de cartes (services, catégories, derniers articles)
   ========================================================================== */
.card-grid {
    display: grid;
    /* Fixed max track width (not 1fr): with few items (a category with a
       single post, a lone leftover card on the last row), 1fr stretches
       each card to fill the whole row — verified live, a single post card
       rendered nearly full-width. A capped track keeps cards a consistent
       size regardless of how many there are. */
    grid-template-columns: repeat(auto-fit, minmax(260px, 300px));
    justify-content: center;
    gap: var(--space-md);
}
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card img { width: 100%; height: 200px; object-fit: cover; transition: transform 0.4s ease; }
.card:hover img { transform: scale(1.06); }
.card__body { padding: 1.4rem 1.6rem 1.7rem; }
.card__title { margin: 0 0 0.4rem; font-size: 1.1rem; }
.card__title a { color: var(--color-heading); text-decoration: none; }
.card__title a:hover { color: var(--color-primary); }
.card__meta { font-size: 0.85rem; opacity: 0.65; margin: 0; }
.card__text { font-size: 0.95rem; margin: 0.6rem 0 0; }

/* ==========================================================================
   Bloc "Derniers articles" (core/latest-posts) : bloc dynamique Gutenberg
   réel (nécessaire pour que WordPress interroge et affiche les vrais
   articles), stylé pour matcher notre design system de cartes ci-dessus.
   ========================================================================== */
.wp-block-latest-posts.wp-block-latest-posts__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 300px));
    justify-content: center;
    gap: var(--space-md);
    list-style: none;
    margin: 0;
    padding: 0;
}
.wp-block-latest-posts__list > li {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding-bottom: 1.2rem;
}
.wp-block-latest-posts__list > li:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.wp-block-latest-posts__featured-image { margin: 0 0 1rem; overflow: hidden; }
.wp-block-latest-posts__featured-image img { width: 100%; height: 200px; object-fit: cover; transition: transform 0.4s ease; }
.wp-block-latest-posts__list > li:hover .wp-block-latest-posts__featured-image img { transform: scale(1.06); }
.wp-block-latest-posts__post-title {
    display: block;
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    color: var(--color-heading);
    margin: 0 1.4rem 0.4rem;
}
.wp-block-latest-posts__post-date { display: block; font-size: 0.85rem; opacity: 0.65; margin: 0 1.4rem; }

/* ==========================================================================
   Formulaire de contact (Contact Form 7)
   ========================================================================== */
.wpcf7-form p { margin-bottom: 1.4rem; }
.wpcf7-form label { display: block; font-weight: 600; margin-bottom: 0.4rem; color: var(--color-heading); }
.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-secondary-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
}
.wpcf7-form textarea { min-height: 160px; resize: vertical; }
.wpcf7-form input[type="submit"] {
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 0.9rem 2.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.wpcf7-form input[type="submit"]:hover { transform: translateY(-2px); }
.wpcf7-not-valid-tip { color: #c0392b; font-size: 0.85rem; margin-top: 0.3rem; }
.wpcf7-response-output { border-radius: 8px; padding: 1rem; margin-top: 1.5rem; }

/* ==========================================================================
   Contenu générique (pages, articles)
   ========================================================================== */
.page-content, .single-content { padding: var(--space-lg) 0; }
.entry-title { font-size: 2.2rem; margin-bottom: 0.5rem; }
.entry-meta { color: var(--color-text); opacity: 0.65; font-size: 0.9rem; margin-bottom: var(--space-md); }
.entry-featured-image { margin-bottom: var(--space-md); border-radius: var(--radius); overflow: hidden; }
.entry-featured-image img { width: 100%; }
.entry-content :is(h2, h3) { margin-top: 2rem; }
/* Same rule for generated page content (legal pages etc.), which isn't
   wrapped in .entry-content — without this, each <h3> rubric on a legal
   page sits flush against the previous paragraph with no breathing room. */
.container > :is(h2, h3):not(:first-child) { margin-top: 2rem; }

/* ==========================================================================
   Pied de page
   ========================================================================== */
.site-footer {
    background: var(--color-heading);
    color: rgba(255, 255, 255, 0.82);
    padding: var(--space-lg) 0 var(--space-md);
    margin-top: var(--space-xl);
}
.footer-menu ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 2rem;
    list-style: none;
    margin: 0 0 var(--space-md);
    padding: 0;
}
.footer-menu a { color: #fff; opacity: 0.85; text-decoration: none; }
.footer-menu a:hover { opacity: 1; text-decoration: underline; }
.site-footer__copyright { text-align: center; font-size: 0.85rem; opacity: 0.6; }

/* ==========================================================================
   Recherche / archives
   ========================================================================== */
.archive-header, .search-header { padding: var(--space-lg) 0 var(--space-sm); text-align: center; }
.no-results { padding: var(--space-lg) 0; text-align: center; }

/* ==========================================================================
   Apparition au scroll (classe ajoutée par nav.js ; sans JS, aucun style
   .reveal n'est appliqué, le contenu reste normalement visible)
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
}
