/* ════ UI-LØFT 2026: mobil fanebjælke, trykflader, desktop-læsbarhed ════
   På telefoner flyttes header-navigationen ned som en fast fanebjælke
   (app-mønster). Ingen HTML-ændringer: ikonerne vælges ud fra linkets href,
   så samme fil virker på da/de/no og både style.css- og theme-light-sider.
   Pia-siderne har deres egne bundbjælker og inkluderer IKKE denne fil. */

:root { --tabbar-h: 60px; }

/* Blød overgang mellem siderne; fanebjælken står stille imens (ignoreres af ældre browsere) */
@view-transition { navigation: auto; }
@media (max-width: 768px) { header nav { view-transition-name: tabbar; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }

@media (max-width: 768px) {
    header nav {
        position: fixed !important;
        left: 0; right: 0; bottom: 0;
        margin: 0 !important;
        z-index: 60 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: space-around;
        align-items: stretch;
        gap: 0 !important;
        padding: 0.25rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom)) !important;
        background: color-mix(in srgb, var(--bg2, #efe7d4) 94%, transparent);
        -webkit-backdrop-filter: blur(14px) saturate(120%);
        backdrop-filter: blur(14px) saturate(120%);
        border-top: 1px solid var(--border, #d7c9a8);
        box-shadow: 0 -4px 18px rgba(20, 16, 8, 0.08);
    }
    header nav { transition: transform 0.28s cubic-bezier(.2,0,.2,1); }
    html.tabbar-hidden header nav { transform: translateY(100%); }
    header nav a {
        flex: 1 1 0;
        min-width: 0;
        min-height: 50px;
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 0.3rem 0.1rem !important;
        border-radius: 12px !important;
        font-size: 0.64rem !important;
        font-weight: 500;
        letter-spacing: 0 !important;
        line-height: 1.1;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--text2) !important;
        background: none !important;
        -webkit-tap-highlight-color: transparent;
    }
    header nav a::before {
        content: '';
        flex-shrink: 0;
        width: 22px; height: 22px;
        background-color: currentColor;
        -webkit-mask: var(--tab-icon) center / contain no-repeat;
        mask: var(--tab-icon) center / contain no-repeat;
        transition: transform 0.2s ease;
    }
    header nav a.active { color: var(--accent) !important; font-weight: 600; }
    header nav a.active::before { transform: translateY(-1px) scale(1.06); }
    header nav a:active::before { transform: scale(0.92); }

    /* Ikoner (lucide-stil, 24×24 streg). Rækkefølgen betyder noget:
       "Mine bede" skal stå sidst, fordi galleri.html's link har href="/" */
    header nav a { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E"); }
    /* Design bed: blomst */
    header nav a[href="/"], header nav a[href="/de/"], header nav a[href="/no/"] {
        --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='2.2'/%3E%3Cpath d='M12 5.8c0-2 1.2-3.3 2.4-3.3 1.4 0 2 1.6 1 3.1M14.2 8c2 0 3.3 1.2 3.3 2.4 0 1.4-1.6 2-3.1 1M12 10.2c0 2-1.2 3.3-2.4 3.3-1.4 0-2-1.6-1-3.1M9.8 8c-2 0-3.3-1.2-3.3-2.4 0-1.4 1.6-2 3.1-1'/%3E%3Cpath d='M12 10.5V22M12 18c-2.5 0-4.5-1.5-5-4 2.5 0 4.5 1.5 5 4zM12 16c2.5 0 4.5-1.5 5-4-2.5 0-4.5 1.5-5 4z'/%3E%3C/svg%3E");
    }
    /* Havedesigner: kort */
    header nav a[href^="/havedesigner"] {
        --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4 3 6.5v13.5l6-2.5 6 2.5 6-2.5V4l-6 2.5z'/%3E%3Cpath d='M9 4v13.5M15 6.5V20'/%3E%3C/svg%3E");
    }
    /* Galleri: billeder */
    header nav a[href*="galleri"], header nav a[href*="galerie"] {
        --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-4.5-4.5L6 21'/%3E%3C/svg%3E");
    }
    /* Guide: bog */
    header nav a[href*="inspiration"], header nav a[href*="inspirasjon"] {
        --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4h6a4 4 0 0 1 4 4v13a3 3 0 0 0-3-3H2zM22 4h-6a4 4 0 0 0-4 4v13a3 3 0 0 1 3-3h7z'/%3E%3C/svg%3E");
    }
    /* Plæneplan: græs */
    header nav a[href*="plaeneplan"] {
        --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 21h20M5 21c0-5-1.5-8-3-10M9 21c0-6 1-10 3-13M13 21c0-5 2-9 5-11M17 21c0-3 1.5-5.5 4-7'/%3E%3C/svg%3E");
    }
    /* Mine bede: lag */
    header nav a[onclick*="showMyDesigns"], header nav a[href*="view=designs"] {
        --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 2 10 5-10 5L2 7z'/%3E%3Cpath d='m2 12 10 5 10-5M2 17l10 5 10-5'/%3E%3C/svg%3E");
    }

    /* Plads til bjælken: sideindhold og øvrige faste bundelementer løftes op */
    body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)) !important; }
    #sticky-price { bottom: calc(var(--tabbar-h) + 0.6rem + env(safe-area-inset-bottom)) !important; }
    #cookie-bar, #sticky-bar,
    #mobile-sticky-cta.active {
        bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)) !important;
    }
    .undo-btn,
    .hd-toast {
        bottom: calc(var(--tabbar-h) + 1rem + env(safe-area-inset-bottom)) !important;
    }
    /* Når bjælken er gledet væk, falder de øvrige bundelementer ned på plads */
    #sticky-price, #cookie-bar, #sticky-bar, #mobile-sticky-cta.active, .undo-btn, .hd-toast { transition: bottom 0.28s cubic-bezier(.2,0,.2,1), transform .4s cubic-bezier(.2,0,.2,1), opacity .25s ease; }
    html.tabbar-hidden #sticky-price { bottom: calc(0.9rem + env(safe-area-inset-bottom)) !important; }
    html.tabbar-hidden #cookie-bar, html.tabbar-hidden #sticky-bar,
    html.tabbar-hidden #mobile-sticky-cta.active { bottom: 0 !important; }
    html.tabbar-hidden .undo-btn,
    html.tabbar-hidden .hd-toast { bottom: calc(1rem + env(safe-area-inset-bottom)) !important; }

    /* Headeren bliver lavere, når menuen er flyttet ned */
    header { padding-bottom: 0.9rem !important; }

    /* "Havedesigner" er for langt til en fane — kortere label via ::after */
    header nav a[href^="/havedesigner"] { font-size: 0 !important; }
    header nav a[href^="/havedesigner"]::after { content: 'Havedesign'; font-size: 0.64rem; }

    /* ── Trykflader: mindst 44 px høje på telefon ── */
    .theme-toggle { width: 44px !important; height: 44px !important; top: 0.7rem !important; right: 0.7rem !important; }
    .pia-invite .pia-cta { min-height: 46px; }
    .pia-invite .pia-alt,
    .video-teaser button { min-height: 44px; display: inline-flex !important; align-items: center; }
    .wizard-step details > summary { display: list-item !important; padding: 0.8rem 0 !important; }
    /* Usynlig udvidelse af trykfladen — linket ser ud som før */
    .pia-invite .pia-body a[href*="plaeneplan"] { position: relative; }
    .pia-invite .pia-body a[href*="plaeneplan"]::after { content: ''; position: absolute; inset: -12px 0; }
    .gallery-filters button { min-height: 44px; padding-left: 1rem !important; padding-right: 1rem !important; }
    #cookie-bar { flex-wrap: nowrap !important; padding: 0.6rem 1rem !important; gap: 0.8rem !important; }
    #cookie-bar button { min-height: 44px; min-width: 60px; flex-shrink: 0; }
}

@media (max-width: 768px) {
    /* Link-chips med inline-stil (sæsonbånd og guide-links på forsiderne) */
    a[style*="padding:0.3rem 0.7rem"] { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ── Desktop: smallere formular, større tekst ──
   Wizard'en strakte sig over 1236 px med 10-12 px tekst. Planen/resultatet
   nedenfor beholder fuld bredde — kun trinene og Pia-kortet samles i midten. */
@media (min-width: 1024px) {
    .container > .wizard-step,
    .container > .pia-invite { max-width: 880px; margin-left: auto; margin-right: auto; }
    .wizard-step { padding: 1.9rem 2.2rem; }
    .wizard-step h2 { font-size: 1.2rem !important; }
    .wizard-step .filter-group label,
    .wizard-step label { font-size: 0.8rem !important; }
    .wizard-step select,
    .wizard-step input[type="number"],
    .wizard-step input[type="text"] { font-size: 1rem; padding: 0.65rem 0.8rem; }
    .wizard-step details > summary { font-size: 0.88rem !important; }
    .sun-option { padding: 0.95rem 0.7rem; }
    .sun-label { font-size: 0.9rem; }
    .sun-desc { font-size: 0.76rem; }
    .sun-option--unknown { min-width: 104px; }
    header nav a { font-size: 0.88rem; padding: 0.5rem 1.15rem; }
    header .tagline { font-size: 0.95rem; }
    .pia-invite .pia-q { font-size: 1.3rem; }
    .pia-invite .pia-cta { font-size: 1rem; padding: 0.8rem 1.5rem; }
    .pia-invite .pia-alt { font-size: 0.95rem; }
}
