/* public/assets/css/mobile-app.css — Interface « Application mobile » épurée, soignée et sans aucun débordement horizontal (<= 768px).
   L'affichage ordinateur (> 768px) reste 100 % inchangé. */

/* Masquer la barre d'onglets mobile sur grand écran */
.app-tabbar { display: none; }

@media (max-width: 768px) {
    :root {
        --header-h: 56px;
        --app-tabbar-h: 62px;
    }

    /* =============================================================
       0. VERROU ANTI-DÉBORDEMENT HORIZONTAL GLOBAL (TOUTES PAGES)
       ============================================================= */
    html,
    body,
    main {
        max-width: 100% !important;
        overflow-x: clip !important;
    }

    main > section,
    .section,
    .container,
    .split,
    .grid-2,
    .grid-3,
    .bento,
    .plans,
    .tarifs-grid,
    .tarifs-grid--3,
    .tarifs-grid--4,
    .reassurance-strip,
    .ai-badges-grid,
    .hero,
    .hero-center,
    .card,
    .case,
    .plan,
    .review,
    .cta-band,
    .guide-layout,
    .guide-body {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .container > *,
    .split > *,
    .grid-2 > *,
    .grid-3 > *,
    .bento > *,
    .plans > *,
    .tarifs-grid > * {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    img,
    svg,
    video,
    iframe,
    table {
        max-width: 100%;
    }

    /* =============================================================
       1. DÉCHARGE VISUELLE : calme, sobre, raffiné (zéro bruit lourd)
       ============================================================= */
    .net,
    .grid-bg,
    .orb,
    .hero-scene,
    .cta-aurora,
    .bento .card-art,
    .card-art,
    .season-deco,
    .season-canvas,
    .season-ribbon,
    main > section::after,
    .section::after {
        display: none !important;
    }

    /* Texte accentué propre et lumineux sans double drop-shadow agressif */
    .grad-text,
    .hero-home-title .grad-text,
    .hero-title-typed .typed,
    .price-flag-amount,
    .specular-metal {
        background: none !important;
        -webkit-background-clip: initial !important;
        background-clip: initial !important;
        -webkit-text-fill-color: currentColor !important;
        color: var(--cd-accent-ink) !important;
        filter: none !important;
        font-style: italic !important;
        will-change: auto !important;
        display: inline !important;
    }

    [data-theme="light"] .grad-text,
    [data-theme="light"] .hero-home-title .grad-text,
    [data-theme="light"] .hero-title-typed .typed,
    [data-theme="light"] .price-flag-amount,
    [data-theme="light"] .specular-metal {
        color: #94591C !important;
    }

    /* Cartes plates élégantes (finition app native, zéro aberration chromatique) */
    .card,
    .case,
    .bento .card,
    .plan,
    .cta-band,
    .review,
    .founder-card,
    .guide-takeaway-card,
    .ai-badge-col,
    [data-theme="light"] .card,
    [data-theme="light"] .case,
    [data-theme="light"] .bento .card,
    [data-theme="light"] .plan,
    [data-theme="light"] .cta-band,
    [data-theme="light"] .review,
    [data-theme="light"] .founder-card,
    [data-theme="light"] .ai-badge-col {
        background: var(--cd-surface-card) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: 1px solid var(--cd-border) !important;
        border-radius: 16px !important;
        box-shadow: 0 2px 12px -4px rgba(0, 0, 0, 0.14) !important;
        transform: none !important;
        transition: border-color 0.2s ease, background-color 0.2s ease !important;
    }

    [data-theme="light"] .card,
    [data-theme="light"] .case,
    [data-theme="light"] .bento .card,
    [data-theme="light"] .plan,
    [data-theme="light"] .cta-band,
    [data-theme="light"] .review,
    [data-theme="light"] .founder-card,
    [data-theme="light"] .ai-badge-col {
        background: #FFFFFF !important;
        border-color: #E4DDD2 !important;
        box-shadow: 0 2px 10px -4px rgba(26, 37, 51, 0.08) !important;
    }

    .card:hover,
    .case:hover,
    .bento .card:hover,
    .plan:hover,
    .cta-band:hover {
        transform: none !important;
    }

    /* Boutons propres, tactiles, jamais débordants */
    .btn {
        border-radius: 14px !important;
        min-height: 46px !important;
        white-space: normal !important;
        text-align: center !important;
        max-width: 100% !important;
        line-height: 1.25 !important;
    }

    a.btn-primary,
    .btn-primary,
    .btn-cta {
        background: linear-gradient(135deg, #D9A06A 0%, #C07A2E 100%) !important;
        color: #1A2533 !important;
        border: 0 !important;
        font-weight: 700 !important;
        box-shadow: 0 8px 20px -8px rgba(192, 122, 46, 0.55) !important;
    }

    html[data-theme="light"] .btn-row > .btn:first-child,
    html[data-theme="light"] a.btn-primary,
    html[data-theme="light"] .btn-primary,
    html[data-theme="light"] .btn-cta {
        background: linear-gradient(135deg, #A86420 0%, #825010 100%) !important;
        color: #FFFFFF !important;
        box-shadow: 0 8px 20px -8px rgba(130, 80, 16, 0.4) !important;
    }

    .btn-ghost,
    .btn-secondary {
        background: rgb(var(--cd-tint) / 0.05) !important;
        border: 1px solid var(--cd-border-strong) !important;
        color: var(--cd-ink) !important;
        box-shadow: none !important;
    }

    [data-theme="light"] .btn-ghost,
    [data-theme="light"] .btn-secondary {
        background: #FFFFFF !important;
        border-color: #D6CEC2 !important;
        color: #1A2533 !important;
    }

    /* =============================================================
       2. TOP APP BAR (56px, propre, sobre, boutons 36×36 alignés)
       ============================================================= */
    .site-header {
        height: 56px !important;
        background: color-mix(in srgb, var(--cd-surface) 92%, transparent) !important;
        backdrop-filter: blur(14px) !important;
        -webkit-backdrop-filter: blur(14px) !important;
        border-bottom: 1px solid var(--cd-border) !important;
        box-shadow: none !important;
    }

    .header-inner {
        height: 56px !important;
        padding-inline: 14px !important;
        gap: 6px !important;
    }

    .site-header .logo { gap: 8px !important; }
    .site-header .logo .mark { width: 30px !important; height: 30px !important; }
    .site-header .logo-text { font-size: 1.06rem !important; }

    .header-cta .btn-cta { display: none !important; }
    .header-cta {
        gap: 6px !important;
        padding-right: 52px;
    }

    .header-tel,
    .burger {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        border-radius: 10px !important;
        border: 1px solid var(--cd-border) !important;
        background: rgb(var(--cd-tint) / 0.04) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
    }

    .header-tel svg { width: 18px !important; height: 18px !important; }

    /* Bouton Accessibilité intégré dans la barre haute (cible WCAG >= 44px) */
    .a11y-fab {
        position: fixed !important;
        top: 6px !important;
        right: 10px !important;
        left: auto !important;
        bottom: auto !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        border-radius: 10px !important;
        border: 1px solid var(--cd-border) !important;
        background: rgb(var(--cd-tint) / 0.06) !important;
        color: var(--cd-ink) !important;
        box-shadow: none !important;
        z-index: 960 !important;
    }
    .a11y-fab svg { width: 20px !important; height: 20px !important; }

    .a11y-panel {
        left: 12px !important;
        right: 12px !important;
        top: 64px !important;
        bottom: auto !important;
        width: auto !important;
        max-height: calc(100dvh - 140px) !important;
        border-radius: 18px !important;
    }

    /* =============================================================
       3. PREMIER ÉCRAN D'ACCUEIL (fluide, jamais tronqué au zoom texte)
       ============================================================= */
    .hero.hero-home,
    .hero-home,
    main > section.hero-home {
        min-height: 85svh !important;
        height: auto !important;
        max-height: none !important;
        box-sizing: border-box !important;
        padding-top: calc(var(--header-h) + 20px) !important;
        padding-bottom: calc(var(--app-tabbar-h) + 32px + env(safe-area-inset-bottom, 0px)) !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        position: relative !important;
        overflow: visible !important;
        background:
            radial-gradient(85% 48% at 50% 18%, rgba(47, 107, 158, 0.22) 0%, transparent 70%),
            radial-gradient(65% 36% at 50% 72%, rgba(192, 122, 46, 0.12) 0%, transparent 72%),
            var(--cd-surface) !important;
    }

    [data-theme="light"] .hero.hero-home,
    [data-theme="light"] .hero-home,
    [data-theme="light"] main > section.hero-home {
        background:
            radial-gradient(85% 48% at 50% 16%, rgba(47, 107, 158, 0.11) 0%, transparent 70%),
            radial-gradient(65% 36% at 50% 74%, rgba(192, 122, 46, 0.1) 0%, transparent 72%),
            #F7F3ED !important;
    }

    .hero-home .hero-center {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        width: 100% !important;
        margin-top: auto !important;
        margin-bottom: auto !important;
        padding-inline: 18px !important;
    }

    /* Pastille d'ancrage Poitiers en tête du premier écran */
    .hero-home .hero-center::before {
        content: "POITIERS · VIENNE · AGENCE NUMÉRIQUE";
        display: inline-flex;
        align-items: center;
        padding: 5px 12px;
        margin-bottom: 18px;
        border-radius: 999px;
        font-family: var(--cd-font-sans);
        font-size: 0.67rem;
        font-weight: 700;
        letter-spacing: 0.14em;
        color: var(--cd-brand-ink);
        background: color-mix(in srgb, var(--cd-brand) 14%, transparent);
        border: 1px solid color-mix(in srgb, var(--cd-brand-ink) 28%, transparent);
    }

    .hero-home .hero-home-title {
        font-size: clamp(1.88rem, 7.6vw, 2.32rem) !important;
        line-height: 1.14 !important;
        letter-spacing: -0.015em !important;
        text-align: center !important;
        text-wrap: balance !important;
        margin: 0 0 14px 0 !important;
        max-width: 15ch !important;
    }

    .hero-title-lead { font-size: inherit !important; display: inline !important; }
    .hero-title-typed { font-size: inherit !important; display: inline !important; }

    .hero-home .lead {
        font-size: 0.94rem !important;
        line-height: 1.56 !important;
        text-align: center !important;
        max-width: 35ch !important;
        margin: 0 auto !important;
        color: var(--cd-slate) !important;
    }

    .hero-home .btn-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        max-width: 316px !important;
        gap: 10px !important;
        margin: 24px auto 0 !important;
    }

    .hero-home .btn-row .btn {
        width: 100% !important;
        padding: 12px 18px !important;
        font-size: 0.95rem !important;
    }

    .hero-home .cta-tertiary {
        text-align: center !important;
        margin-top: 10px !important;
        font-size: 0.85rem !important;
    }

    .hero-home .hero-points {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px !important;
        margin: 18px auto 0 !important;
        padding: 0 !important;
    }

    .hero-home .hero-points li {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        padding: 5px 11px !important;
        border-radius: 999px !important;
        font-size: 0.77rem !important;
        background: rgb(var(--cd-tint) / 0.05) !important;
        border: 1px solid var(--cd-border) !important;
        color: var(--cd-slate) !important;
    }

    /* Indicateur de scroll masqué sur mobile/tablette (évite un contour vide à droite) */
    .hero-home .scroll-hint {
        display: none !important;
    }

    /* =============================================================
       4. PAGES INTÉRIEURES & SECTIONS : 100 % VERTICAL, 0 DÉBORDEMENT
       ============================================================= */
    .container {
        padding-inline: 16px !important;
    }

    main > section.section,
    .section,
    #savoir-faire {
        padding-top: 32px !important;
        padding-bottom: 32px !important;
    }

    main > section.section-tight,
    .section-tight,
    section.cta-inline-wrap,
    main > section.cta-inline-wrap,
    .cta-section,
    main > section.cta-section {
        padding-top: 22px !important;
        padding-bottom: 22px !important;
    }

    /* Hero des pages intérieures (Tarifs, IA, Sites, Cyber, Labo, Contact…) */
    .hero:not(.hero-home) {
        min-height: auto !important;
        height: auto !important;
        padding-top: calc(var(--header-h) + 22px) !important;
        padding-bottom: 28px !important;
    }

    .hero:not(.hero-home) .h1 {
        font-size: clamp(1.55rem, 6.6vw, 2rem) !important;
        line-height: 1.18 !important;
        text-wrap: balance !important;
    }

    .hero:not(.hero-home) .lead {
        font-size: 0.93rem !important;
        line-height: 1.54 !important;
    }

    .hero:not(.hero-home) .btn-row,
    .cta-band .btn-row,
    .section .btn-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        gap: 10px !important;
        margin-top: 18px !important;
    }

    .hero:not(.hero-home) .btn-row .btn,
    .cta-band .btn-row .btn,
    .section .btn-row .btn {
        width: 100% !important;
    }

    .badge {
        max-width: 100% !important;
        white-space: normal !important;
        text-align: center !important;
        line-height: 1.35 !important;
        font-size: 0.78rem !important;
    }

    /* En-têtes de sections propres */
    .section-head,
    .section-head.center {
        text-align: left !important;
        margin-inline: 0 !important;
        margin-bottom: 18px !important;
    }

    .section-head.center .eyebrow::after { display: none !important; }
    .section-head .eyebrow,
    .eyebrow {
        font-size: 0.7rem !important;
        letter-spacing: 0.12em !important;
        margin-bottom: 4px !important;
    }
    .section-head .h2,
    .h2 {
        font-size: 1.4rem !important;
        line-height: 1.22 !important;
        margin-bottom: 6px !important;
    }
    .section-head .lead,
    .lead {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        margin-top: 6px !important;
    }

    /* =============================================================
       5. GRILLES & CARTES : 100 % VERTICALES, COMPACTES, 0 DÉBORDEMENT
       ============================================================= */

    /* 6 Métiers (.bento) → Liste d'application compacte */
    .bento {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .bento .card {
        display: grid !important;
        grid-template-columns: 42px minmax(0, 1fr) !important;
        column-gap: 14px !important;
        row-gap: 4px !important;
        align-items: start !important;
        padding: 14px !important;
    }

    .bento .card-icon {
        grid-column: 1 !important;
        grid-row: 1 / span 3 !important;
        width: 42px !important;
        height: 42px !important;
        margin: 2px 0 0 0 !important;
        border-radius: 12px !important;
    }

    .bento .card .h3 {
        grid-column: 2 !important;
        font-size: 1.02rem !important;
        line-height: 1.25 !important;
        margin: 0 !important;
    }

    .bento .card p {
        grid-column: 2 !important;
        font-size: 0.85rem !important;
        line-height: 1.45 !important;
        margin: 0 !important;
    }

    .bento .card .text-link {
        grid-column: 2 !important;
        font-size: 0.82rem !important;
        margin-top: 4px !important;
    }

    /* Toutes les grilles multi-colonnes passent en 1 colonne propre (zéro débordement) */
    .split,
    .grid-2,
    .grid-3,
    .plans,
    .plans--2,
    .plans--3,
    .plans--4,
    .tarifs-grid,
    .tarifs-grid--3,
    .tarifs-grid--4 {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 14px !important;
        margin-inline: 0 !important;
        padding-inline: 0 !important;
        overflow: visible !important;
    }

    /* Badges Claude : grille 2×2 compacte sans aucun débordement */
    .ai-badges-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        margin-inline: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    .ai-badge-col {
        padding: 14px 10px !important;
        min-width: 0 !important;
    }
    .ai-badge-title { font-size: 0.86rem !important; }
    .ai-badge-issuer,
    .ai-badge-recipient { font-size: 0.72rem !important; }

    /* Page Tarifs : réassurance 2×2 propre + barre de catégories collante sous la Top App Bar */
    .reassurance-strip {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        width: 100% !important;
        margin-top: 20px !important;
    }
    .reassurance-item {
        padding: 12px 10px !important;
        min-width: 0 !important;
        border-radius: 14px !important;
    }
    .reassurance-item strong { font-size: 0.82rem !important; line-height: 1.25 !important; }
    .reassurance-item span { font-size: 0.74rem !important; line-height: 1.3 !important; }

    .tarifs-nav-wrap {
        top: calc(var(--header-h) + 6px) !important;
        padding: 0 12px !important;
        margin-bottom: 20px !important;
        max-width: 100% !important;
    }
    .tarifs-nav {
        padding: 4px 6px !important;
        gap: 4px !important;
    }
    .tarifs-nav-item {
        padding: 6px 11px !important;
        font-size: 0.78rem !important;
    }

    /* Correctif grilles inline de tarifs.html.twig (calculateur & comparateur) */
    .theme-tarifs [style*="minmax(310px"] {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 18px !important;
    }
    .theme-tarifs [style*="position: sticky"] {
        position: static !important;
    }

    /* Labo IA : sélecteur d'outils enveloppé proprement */
    .lab-toggle {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    .lab-toggle button {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        white-space: normal !important;
    }

    .card { padding: 16px !important; }
    .card-icon { width: 38px !important; height: 38px !important; margin-bottom: 10px !important; border-radius: 10px !important; }
    .card .h3 { font-size: 1.05rem !important; }
    .card p { font-size: 0.87rem !important; line-height: 1.48 !important; margin-top: 6px !important; }

    .lab-points { gap: 10px !important; margin-top: 16px !important; }
    .lab-points li {
        padding: 12px 14px !important;
        border-radius: 14px !important;
        background: var(--cd-surface-card) !important;
        border: 1px solid var(--cd-border) !important;
    }
    [data-theme="light"] .lab-points li { background: #FFFFFF !important; }

    .founder { gap: 18px !important; }
    .founder-card { width: 100% !important; max-width: 100% !important; padding: 14px !important; }
    .founder-img-wrap img { max-height: 220px !important; object-fit: cover !important; border-radius: 12px !important; }

    .cta-band { padding: 24px 18px !important; text-align: left !important; }

    /* Pied de page avec dégagement confortable pour la barre d'onglets fixe */
    .site-footer {
        padding-top: 32px !important;
        padding-bottom: calc(var(--app-tabbar-h) + 32px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* =============================================================
       6. BARRE D'ONGLETS FIXE EN BAS (BOTTOM APP TAB BAR)
       ============================================================= */
    .app-tabbar {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: center;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 955;
        height: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px));
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        background: color-mix(in srgb, var(--cd-surface) 94%, transparent);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border-top: 1px solid var(--cd-border);
        box-shadow: 0 -4px 20px -10px rgba(0, 0, 0, 0.22);
        font-family: var(--cd-font-sans);
    }

    html.intro .app-tabbar { display: none !important; }
    @media print { .app-tabbar { display: none !important; } }

    .app-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 46px;
        padding: 4px 2px;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: var(--cd-slate) !important;
        text-decoration: none !important;
        font-size: 0.67rem;
        font-weight: 500;
        line-height: 1;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.18s ease, background-color 0.18s ease;
    }

    .app-tab svg {
        width: 21px;
        height: 21px;
        flex: none;
        stroke-width: 1.8;
    }

    .app-tab.is-active {
        color: var(--cd-brand-ink) !important;
        font-weight: 700;
    }

    .app-tab.is-ai {
        color: var(--cd-accent-ink) !important;
        font-weight: 600;
    }

    .app-tab:active {
        background: rgb(var(--cd-tint) / 0.08);
    }

    /* Assistant IA intégré dans le 5e onglet */
    .ac-fab { display: none !important; }

    .ac-panel {
        left: 10px !important;
        right: 10px !important;
        bottom: calc(var(--app-tabbar-h) + 10px + env(safe-area-inset-bottom, 0px)) !important;
        width: auto !important;
        height: min(500px, calc(100dvh - 144px)) !important;
        border-radius: 18px !important;
    }

    /* Sommaire flottant : mini-pilule discrète au-dessus de la barre d'onglets à gauche */
    .rtoc-fab {
        left: 12px !important;
        bottom: calc(var(--app-tabbar-h) + 10px + env(safe-area-inset-bottom, 0px)) !important;
        width: auto !important;
        max-width: 168px !important;
        height: 36px !important;
        padding: 0 11px 0 6px !important;
        gap: 7px !important;
        border-radius: 999px !important;
        background: color-mix(in srgb, var(--cd-surface-card) 92%, transparent) !important;
        box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.22) !important;
    }

    .rtoc-ring-wrap,
    .rtoc-ring-svg {
        width: 24px !important;
        height: 24px !important;
    }

    .rtoc-ring-val { font-size: 0.54rem !important; }
    .rtoc-meta { display: flex !important; }
    .rtoc-current { font-size: 0.72rem !important; }
    .rtoc-sub { display: none !important; }
    .rtoc-chev { display: block !important; width: 13px !important; height: 13px !important; }

    .rtoc-panel {
        left: 10px !important;
        right: 10px !important;
        bottom: calc(var(--app-tabbar-h) + 54px + env(safe-area-inset-bottom, 0px)) !important;
        width: auto !important;
        max-height: min(410px, calc(100dvh - 180px)) !important;
        border-radius: 18px !important;
    }

    /* Menu mobile propre au-dessus de la barre d'onglets */
    .mobile-menu {
        top: 56px !important;
        bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px)) !important;
        height: auto !important;
        padding: 18px 16px 24px !important;
        background: var(--cd-surface) !important;
        border-top: 1px solid var(--cd-border) !important;
    }
}
