/* ============================================================
   Europe Toiture 84 — reparations-toiture.fr
   Feuille de style unique, mobile-first, sans framework.
   ============================================================ */

/* ------------------------------------------------------------
   1. Tokens de design (variables CSS)
   ------------------------------------------------------------ */
:root {
    /* Couleurs
       --accent aligné sur le rouge terracotta du logo reparations-toiture.fr.
       Nuances calculées pour préserver le contraste WCAG AA sur le beige clair.
       --accent       : couleur dominante (toit du logo)
       --accent-dark  : hover, textes importants (plus sombre, +contraste)
       --accent-light : fonds subtils, badges (plus clair) */
    --bg:             #f7f4ef;
    --surface:        #ffffff;
    --surface-alt:    #efe8dc;
    --text:           #2f2a24;
    --text-muted:     #6b6258;
    --text-light:     #8a8278;
    --accent:         #c85a3f;
    --accent-dark:    #a2442d;
    --accent-light:   #e89a82;
    --border:         #ddd2c5;
    --border-strong:  #b9ad9b;
    --success:        #3b6d11;
    --danger:         #a32d2d;

    /* Rayons */
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      16px;
    --radius-pill:    999px;

    /* Ombres */
    --shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md:      0 10px 30px rgba(0, 0, 0, 0.06);

    /* Layout */
    --container:      1180px;
    --container-narrow: 780px;

    /* Transitions */
    --ease:           cubic-bezier(0.2, 0.7, 0.3, 1);
    --duration-fast:  0.15s;
}

/* ------------------------------------------------------------
   2. Reset & base
   ------------------------------------------------------------ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

img,
picture,
svg {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent-dark);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color var(--duration-fast) var(--ease);
}

a:hover,
a:focus-visible {
    color: var(--accent);
}

h1, h2, h3, h4 {
    line-height: 1.2;
    margin: 0 0 0.6em;
    color: var(--text);
    font-weight: 700;
}

h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.8rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }
h3 { font-size: clamp(1.1rem, 1rem + 0.4vw, 1.25rem); }
h4 { font-size: 1rem; }

p {
    margin: 0 0 1em;
}

ul, ol {
    margin: 0 0 1em;
    padding-left: 1.25em;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* Accessibilité : focus visible cohérent partout */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Skip link (accessibilité clavier) */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    padding: 12px 20px;
    background: var(--text);
    color: #fff;
    text-decoration: none;
    border-radius: 0 0 var(--radius-sm) 0;
    z-index: 1000;
}
.skip-link:focus {
    left: 0;
    top: 0;
    color: #fff;
}

/* ------------------------------------------------------------
   3. Container
   ------------------------------------------------------------ */
.container {
    width: min(100% - 2rem, var(--container));
    margin-inline: auto;
}

.container-narrow {
    width: min(100% - 2rem, var(--container-narrow));
    margin-inline: auto;
}

/* ------------------------------------------------------------
   4. Header
   ------------------------------------------------------------ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(247, 244, 239, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    /* 88px = logo 68px + ~10px respiration haut/bas.
       Ajuste à 76px si tu repasses à un logo plus petit (48-56px). */
    min-height: 88px;
}

.logo {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text);
    line-height: 1.2;
}

.logo:hover,
.logo:focus-visible {
    color: var(--text);
}

.logo-title {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.logo-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* Variante avec image :
   - pas de flex column (l'image porte tout le message visuel)
   - dimensions CSS explicites qui préservent le ratio du logo (5:1 environ)
   - hauteur cappée pour respecter la hauteur du header (~60px)
   - responsive : largeur réduite sur mobile sans déformer le ratio */
.logo-has-image {
    flex-direction: row;
    align-items: center;
    line-height: 1;
    /* Empêche le flex parent de comprimer le lien à 0 */
    flex-shrink: 0;
}

.logo-image {
    display: block;
    /* Hauteur fixe pour préserver le ratio 5:1 (largeur s'adapte).
       Les attributs HTML width/height fournissent le ratio au navigateur,
       mais height:auto+flex ne suffit pas pour un SVG sans dimensions intrinsèques :
       on impose donc une hauteur explicite.

       3 tailles préréglées pour ajustement selon le rendu visuel :
       - 48px  → compact, discret (ratio 5:1 → ~240px de large)
       - 56px  → équilibré (actuel, ~280px)
       - 68px  → présence forte, header plus imposant (~340px)
       - 80px  → maximum, ton essai inline à 400×80 */
    height: 68px;
    width: auto;
    max-width: 380px;
    object-fit: contain;
}

@media (max-width: 600px) {
    .logo-image {
        height: 48px;
        max-width: 240px;
    }
}

/* Utilitaire : masquer visuellement tout en restant accessible
   aux lecteurs d'écran et aux moteurs de recherche.
   Technique standard WebAIM. */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.main-nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 4px;
    border-bottom: 2px solid transparent;
    transition: border-color var(--duration-fast) var(--ease),
                color var(--duration-fast) var(--ease);
}

.main-nav a:hover,
.main-nav a:focus-visible,
.main-nav a[aria-current="page"] {
    color: var(--accent-dark);
    border-bottom-color: var(--accent);
}

.menu-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.menu-toggle-icon {
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
}

.menu-toggle-icon span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
}

/* ------------------------------------------------------------
   5. Buttons
   ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0 1.25rem;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    border-radius: var(--radius-pill);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease),
                transform var(--duration-fast) var(--ease);
}

.btn:hover,
.btn:focus-visible {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}

.btn:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background: var(--surface);
    color: var(--text);
    border-color: var(--text);
}

.btn-small {
    min-height: 38px;
    padding: 0 0.875rem;
    font-size: 0.95rem;
    color: #fff !important;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ------------------------------------------------------------
   6. Hero
   ------------------------------------------------------------ */
.hero {
    padding: clamp(3rem, 4vw, 4.5rem) 0 clamp(2.5rem, 3vw, 3.5rem);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 2rem;
    align-items: start;
}

/* Variante sans colonne droite (ni image, ni carte) */
.hero-single .hero-grid {
    grid-template-columns: 1fr;
}

.hero-single .hero-text {
    max-width: 65ch;
}

.eyebrow {
    display: inline-block;
    margin: 0 0 0.75rem;
    padding: 0.25rem 0.75rem;
    background: var(--surface-alt);
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-text {
    max-width: 65ch;
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.hero-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
}

.hero-card h2 {
    margin-top: 0;
}

.hero-card p {
    color: var(--text-muted);
    margin-bottom: 0;
}

.hero-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    margin-bottom: 1rem;
    background: var(--surface-alt);
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-dark);
}

/* Hero image : alternative visuelle à la hero-card */
.hero-image-wrap {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--surface-alt);
    /* Aspect ratio 2:1 préservé même avant le chargement de l'image */
    aspect-ratio: 2 / 1;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ------------------------------------------------------------
   6bis. Galerie (grille 2×2)
   ------------------------------------------------------------ */
.gallery-section {
    padding: clamp(2rem, 3vw, 3.5rem) 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    max-width: 900px;
}

.gallery-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-alt);
    aspect-ratio: 4 / 3;
    box-shadow: var(--shadow-sm);
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--duration-fast) var(--ease);
}

.gallery-item:hover .gallery-img {
    transform: scale(1.03);
}

/* ------------------------------------------------------------
   7. Sections
   ------------------------------------------------------------ */
.section {
    padding: clamp(2rem, 3vw, 3.5rem) 0;
}

.section-alt {
    background: var(--surface-alt);
}

.section-header {
    margin-bottom: 2rem;
    max-width: 65ch;
}

.section-header h2 {
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* ------------------------------------------------------------
   8. Cartes (grids de contenu)
   ------------------------------------------------------------ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.card-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card h3 {
    margin-top: 0;
    color: var(--accent-dark);
}

.card p {
    color: var(--text-muted);
    margin-bottom: 0;
}

.card-link {
    display: block;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text);
    transition: transform var(--duration-fast) var(--ease),
                border-color var(--duration-fast) var(--ease),
                box-shadow var(--duration-fast) var(--ease);
}

.card-link:hover,
.card-link:focus-visible {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    color: var(--text);
}

.card-link strong {
    display: block;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--accent-dark);
    margin-bottom: 0.25rem;
}

.card-link span {
    display: block;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ------------------------------------------------------------
   9. Contenu éditorial (pages locales)
   ------------------------------------------------------------ */
.content-block {
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.content-block h2 {
    margin-top: 0;
    color: var(--text);
    font-size: 1.3rem;
}

.content-block p {
    color: var(--text-muted);
    margin-bottom: 0;
}

.content-grid {
    display: grid;
    gap: 1.25rem;
}

/* ------------------------------------------------------------
   10. FAQ
   ------------------------------------------------------------ */
.faq-list {
    display: grid;
    gap: 0.75rem;
    max-width: var(--container-narrow);
}

.faq-item {
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--duration-fast) var(--ease);
}

.faq-item[open] {
    border-color: var(--border-strong);
}

.faq-item summary {
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    padding-right: 2rem;
    position: relative;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    line-height: 1;
    color: var(--accent);
    font-weight: 400;
    transition: transform var(--duration-fast) var(--ease);
}

.faq-item[open] summary::after {
    content: "−";
}

.faq-item p {
    margin: 0.75rem 0 0;
    color: var(--text-muted);
}

/* ------------------------------------------------------------
   11. Breadcrumbs
   ------------------------------------------------------------ */
.breadcrumbs {
    padding: 1rem 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumbs ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.breadcrumbs li {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumbs li:not(:last-child)::after {
    content: "›";
    color: var(--text-light);
    font-weight: 600;
    margin-left: 0.5rem;
}

.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
    color: var(--accent-dark);
    text-decoration: underline;
}

.breadcrumbs [aria-current="page"] {
    color: var(--text);
    font-weight: 600;
}

/* ------------------------------------------------------------
   12. CTA
   ------------------------------------------------------------ */
.cta-section {
    padding: clamp(2.5rem, 3vw, 3.5rem) 0;
}

.cta-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.cta-box h2 {
    margin: 0 0 0.5rem;
}

.cta-box p {
    margin: 0;
    color: var(--text-muted);
}

.cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ------------------------------------------------------------
   13. Nearby links
   ------------------------------------------------------------ */
.nearby-section {
    padding: 2.5rem 0;
}

.nearby-section h2 {
    margin-bottom: 1.25rem;
}

/* ------------------------------------------------------------
   14. Forms (contact)
   ------------------------------------------------------------ */
.form-layout {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 2rem;
    align-items: start;
}

.form-layout > div {
    padding: 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.contact-form {
    display: grid;
    gap: 0.75rem;
}

.contact-form label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.contact-form input,
.contact-form textarea,
.contact-form select {
    width: 100%;
    padding: 0.75rem 0.875rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font: inherit;
    color: var(--text);
    transition: border-color var(--duration-fast) var(--ease);
}

.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus {
    border-color: var(--accent);
    outline: 2px solid transparent;
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* Honeypot : invisible pour humains, indexable pour bots */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-message {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
}

.form-message-success {
    background: #eaf3de;
    border: 1px solid #c0dd97;
    color: #27500a;
}

.form-message-error {
    background: #fcebeb;
    border: 1px solid #f7c1c1;
    color: #791f1f;
}

/* ------------------------------------------------------------
   15. Footer
   ------------------------------------------------------------ */
.site-footer {
    margin-top: auto;
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border);
    background: #f2ece2;
    color: var(--text-muted);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-col h3 {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col li {
    margin-bottom: 0.4rem;
}

.footer-col a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-col a:hover,
.footer-col a:focus-visible {
    color: var(--accent-dark);
    text-decoration: underline;
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.875rem;
}

.footer-bottom p {
    margin: 0;
}

/* ------------------------------------------------------------
   16. Responsive — Mobile (≤ 900px)
   ------------------------------------------------------------ */
@media (max-width: 900px) {
    .hero-grid,
    .card-grid,
    .card-grid-2,
    .footer-grid,
    .form-layout {
        grid-template-columns: 1fr;
    }

    .hero-image-wrap {
        max-width: 100%;
        aspect-ratio: 16 / 9;
    }

    .gallery-grid {
        gap: 0.75rem;
    }

    .footer-grid {
        gap: 1.5rem;
    }

    .cta-box {
        padding: 1.5rem;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 76px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 1rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
    }

    .main-nav.is-open {
        display: flex;
    }

    .main-nav a {
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid var(--border);
    }

    .main-nav a:last-child {
        border-bottom: none;
    }

    .main-nav a[aria-current="page"] {
        background: var(--surface-alt);
    }

    .menu-toggle {
        display: inline-flex;
    }

    .cta-box {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .footer-bottom {
        flex-direction: column;
    }
}

/* ------------------------------------------------------------
   17. Responsive — Small mobile (≤ 500px)
   ------------------------------------------------------------ */
@media (max-width: 500px) {
    .hero-actions,
    .cta-actions {
        width: 100%;
    }

    .hero-actions .btn,
    .cta-actions .btn {
        width: 100%;
    }

    .container {
        width: calc(100% - 1.5rem);
    }
}

/* ------------------------------------------------------------
   18. Print
   ------------------------------------------------------------ */
@media print {
    .site-header,
    .site-footer,
    .cta-section,
    .nearby-section,
    .menu-toggle {
        display: none;
    }

    body {
        background: #fff;
        color: #000;
    }

    a {
        color: #000;
        text-decoration: underline;
    }
}