/* ═══════════════════════════════════════════════════
   LUCIOLE RESPONSIVE v3 · fix grids, layouts & mobile fixes
   ═══════════════════════════════════════════════════ */

/* ======== TABLETTE (≤ 1024px) ======== */
@media (max-width: 1024px) {

    /* --- Service page (template-service.php) --- */
    .svc-etapes-grid { grid-template-columns: 1fr !important; gap: 20px !important; }
    .svc-tarifs-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 20px !important; }
    .svc-video-grid { grid-template-columns: 1fr !important; gap: 32px !important; text-align: center !important; }

    /* --- Tarifs page (template-tarifs.php) --- */
    .tarifs-section-layout,
    .tarifs-section-layout-rev { grid-template-columns: 1fr !important; gap: 32px !important; }
    .tarifs-base-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .tarifs-blindage-grid { grid-template-columns: 1fr !important; }

    /* --- Homepage --- */
    .about-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
    .process-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
    .pricing-home-grid { grid-template-columns: 1fr !important; gap: 20px !important; max-width: 500px !important; margin: 0 auto !important; }

    /* --- À propos --- */
    .apropos-histoire-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
    .apropos-valeurs-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
    .apropos-chiffres-grid { grid-template-columns: repeat(2, 1fr) !important; }

    /* --- Local pages --- */
    .local-zones-list { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ======== MOBILE (≤ 768px) ======== */
@media (max-width: 768px) {

    /* --- Service page --- */
    .svc-situations-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
    .svc-tarifs-grid { grid-template-columns: 1fr !important; gap: 16px !important; }

    /* Situation cards with video - stack vertically */
    .sit-card[style*="grid-template-columns:1fr 320px"],
    .sit-card[style*="grid-template-columns: 1fr 320px"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    .sit-video-wrap { max-width: 280px; margin: 0 auto; }

    /* Modal gallery grid */
    .sit-modal > div > div:last-of-type > div {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* --- Tarifs page --- */
    .tarifs-features-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
    .tarifs-base-grid { grid-template-columns: 1fr !important; }

    /* --- À propos --- */
    .apropos-engagements-grid { grid-template-columns: 1fr !important; }
    .apropos-chiffres-grid { grid-template-columns: 1fr !important; }

    /* --- Homepage stats --- */
    .about-stats { gap: 12px !important; }

    /* --- Hero features (Intervention 45 min / Prix juste / 9h-minuit) --- */
    .hero-features {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: stretch !important;
        margin-bottom: 24px !important;
        padding-bottom: 20px !important;
    }
    .hero-feature {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 14px !important;
        text-align: left !important;
        background: rgba(255,255,255,0.5);
        border: 1px solid rgba(138,127,232,0.12);
        border-radius: 12px;
        padding: 12px 16px;
    }
    .hero-feature-icon {
        font-size: 24px !important;
        margin-bottom: 0 !important;
        flex-shrink: 0;
        line-height: 1 !important;
    }
    .hero-feature-text {
        font-size: 14px !important;
        text-align: left !important;
        line-height: 1.3 !important;
        letter-spacing: 0 !important;
        text-transform: none !important;
        white-space: normal !important;
        font-weight: 600 !important;
    }
    .hero-feature-text br { display: none !important; }

    /* Reduce hero top spacing & ensure room for sticky CTA */
    .hero { padding-top: 16px !important; padding-bottom: 100px !important; }
    .hero-image-box {
        border-radius: 24px !important;
        overflow: hidden !important;
    }
    .hero-content { padding-top: 12px !important; }
    .hero-google-badge { margin-bottom: 16px !important; }
    .hero-feature {
        padding: 10px 14px !important;
        gap: 10px !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    .hero-feature-icon {
        font-size: 20px !important;
    }
    .hero-features {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* --- Hero bullets centered on mobile --- */
    .hero-bullets {
        text-align: center !important;
        max-width: 360px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .hero-bullets li {
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        gap: 8px !important;
        list-style: none !important;
    }
    .hero-bullets li::before,
    .hero-bullets li::marker { content: none !important; display: none !important; }
    .hero-bullets li > span:not(.check) { text-align: center !important; }

    /* --- Hero sub CTA (Dépl. inclus / CB / Devis) --- */
    .hero-sub-cta {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px 12px !important;
        margin-top: 20px !important;
        font-size: 12px !important;
    }
    .hero-sub-cta span {
        background: rgba(255,255,255,0.8);
        border: 1px solid rgba(138,127,232,0.15);
        border-radius: 50px;
        padding: 6px 12px;
        white-space: nowrap;
    }

    /* --- Media logos: fix ugly huge size on mobile --- */
    .media-logos-row {
        gap: 20px 28px !important;
    }
    .media-logo-box img,
    .media-logo-box svg {
        height: 28px !important;
        width: auto !important;
        max-width: 100% !important;
        object-fit: contain !important;
    }

    /* --- Container padding --- */
    .container { padding-left: 20px !important; padding-right: 20px !important; }

    /* --- CF7 form grid --- */
    .cf7-row { grid-template-columns: 1fr !important; }
    .devis-modal .cf7-row { grid-template-columns: 1fr !important; }

    /* --- Devis popup --- */
    .devis-modal > div { padding: 28px 20px !important; }

    /* --- Section padding reduction --- */
    section[style*="padding:80px"] { padding: 56px 0 !important; }
    section[style*="padding:60px"] { padding: 40px 0 !important; }
    section[style*="padding:100px"] { padding: 64px 0 !important; }

    /* --- Hero content --- */
    .hero-content { padding: 40px 20px !important; }

    /* --- Section titles --- */
    .section-title { font-size: clamp(24px, 6vw, 32px) !important; line-height: 1.2 !important; }

    /* --- Any grids defined inline with repeat(3,1fr) or repeat(4,1fr) --- */
    [style*="grid-template-columns:repeat(3,1fr)"],
    [style*="grid-template-columns: repeat(3, 1fr)"],
    [style*="grid-template-columns:repeat(4,1fr)"],
    [style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* 1fr 1fr inline → stack */
    [style*="grid-template-columns:1fr 1fr"]:not([style*="auto-fit"]):not(.mobile-zones-grid),
    [style*="grid-template-columns: 1fr 1fr"]:not([style*="auto-fit"]):not(.mobile-zones-grid) {
        grid-template-columns: 1fr !important;
    }

    /* 300px + 1fr layouts → stack */
    [style*="grid-template-columns:300px 1fr"],
    [style*="grid-template-columns: 300px 1fr"],
    [style*="grid-template-columns:1fr 300px"],
    [style*="grid-template-columns: 1fr 300px"] {
        grid-template-columns: 1fr !important;
    }

    /* auto-fit grids: reduce min size for better fit */
    [style*="minmax(160px"] {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    }

    /* Images/videos responsive · ne pas casser les logos/SVG avec height forcé */
    img:not(.media-logo-box img):not([style*="height:"]),
    video { max-width: 100% !important; }
    img[style*="height:"] {
        max-width: 100% !important;
        /* garde la height inline */
    }

    /* Flex containers that could overflow */
    [style*="display:flex"][style*="gap:60px"] { gap: 24px !important; }
    [style*="display:flex"][style*="gap:40px"] { gap: 20px !important; }

    /* Large text clamps */
    h1[style*="font-size:clamp"] { font-size: clamp(28px, 8vw, 44px) !important; }
    h2[style*="font-size:clamp"] { font-size: clamp(24px, 6vw, 36px) !important; }

    /* Horizontal scroll prevention */
    body { overflow-x: hidden !important; }

    /* --- Mobile nav: Services summary -> clickable link at top of dropdown --- */
    .mobile-sub-details .mobile-sub-links::before {
        display: block;
        padding: 6px 0 10px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        color: var(--yellow) !important;
        border-bottom: 1px dashed rgba(255,255,255,.1);
        margin-bottom: 6px;
    }
}

/* ======== SMALL MOBILE (≤ 480px) ======== */
@media (max-width: 480px) {

    /* Tighter section padding */
    section[style*="padding:80px"] { padding: 40px 0 !important; }
    section[style*="padding:60px"] { padding: 32px 0 !important; }

    /* Smaller card padding */
    .sit-card,
    [class*="card"][style*="padding:32px"] { padding: 20px !important; }

    /* Container padding */
    .container { padding-left: 16px !important; padding-right: 16px !important; }

    /* Modal padding */
    .devis-modal > div,
    .sit-modal > div { padding: 24px 16px !important; border-radius: 16px !important; }

    /* Sticky CTA smaller */
    .luciole-cta-bar,
    .sticky-cta { font-size: 14px !important; padding: 12px 16px !important; }

    /* Hero and big titles */
    h1 { font-size: clamp(24px, 7vw, 36px) !important; }

    /* Zone pills smaller */
    .zone-pill { font-size: 13px !important; padding: 8px 12px !important; }

    /* Buttons - full width on very small screens */
    .cta-button, .luciole-cta-primary { width: 100% !important; text-align: center !important; }

    /* Media logos even tighter */
    .media-logos-row { gap: 16px 20px !important; }
    .media-logo-box img,
    .media-logo-box svg { height: 24px !important; }
}

/* ======== ULTRA SMALL (≤ 360px) ======== */
@media (max-width: 360px) {
    .container { padding-left: 12px !important; padding-right: 12px !important; }
    h1 { font-size: 22px !important; }
    .section-title { font-size: 22px !important; }
}
