/* a11y utilities — 2026-04-23 P0 fixes */

.skip-to-content {
    position: absolute;
    top: -44px;
    left: 0;
    z-index: 10000;
    padding: 12px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    background: #1e40af;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    transition: top 0.2s ease;
}

.skip-to-content:focus,
.skip-to-content:focus-visible {
    top: 0;
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

:where(a, button, input, select, textarea, [role="button"], [tabindex]):focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

main:focus {
    outline: none;
}

/* Touch target minimum 44×44 (WCAG 2.5.5 / Apple HIG) */
@media (max-width: 1024px) {
    .logo-group {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    .lang-switcher__trigger,
    .mobile-tablet-only,
    .hamburger-close {
        min-width: 44px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .hero-login-link,
    .hero-guest-search__link {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 10px 0;
    }
}

/* Mobile header (replaces master.js::applyMobileStyles inline cssText) */
@media (max-width: 768px) {
    .lang-switcher__trigger {
        padding: 8px 10px !important;
        font-size: 13px !important;
        border: 2px solid #667eea !important;
        border-radius: 8px !important;
        gap: 5px !important;
        background: #fff !important;
        box-shadow: 0 2px 6px rgba(102, 126, 234, 0.15) !important;
    }

    .lang-switcher__trigger .lang-switcher__flag {
        font-size: 17px;
    }

    .lang-switcher__trigger .lang-switcher__arrow {
        width: 10px;
        height: 10px;
    }

    .lang-switcher__trigger .lang-switcher__name {
        display: none;
    }

    #hamburgerToggle {
        padding: 10px !important;
        font-size: 18px !important;
        border: 2px solid #667eea !important;
        border-radius: 8px !important;
        background: #fff !important;
        color: #667eea !important;
        cursor: pointer !important;
        box-shadow: 0 2px 6px rgba(102, 126, 234, 0.15) !important;
    }

    .logo-icon img,
    .header-logo img {
        height: 38px !important;
        width: auto !important;
    }

    .header-right,
    .header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .bottom-nav-label {
        overflow: visible;
        line-height: 1.4;
        padding-bottom: 2px;
    }

    .bottom-nav-item {
        padding: 10px 4px 6px 4px;
        gap: 2px;
    }

    .bottom-nav-icon {
        margin-top: 4px;
    }
}

/* Shipping calculator FX rate hint (was inline style in _shipping-tabs.blade.php) */
.uc-fx-hint {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: #059669;
    font-family: ui-monospace, monospace;
    font-weight: 600;
}

/* 2026-04-23 P2-12: WCAG AA contrast fixes for hero links
   - .hero-login-link was rgba(255,255,255,0.7) — contrast depended on hero image.
   - .hero-guest-search__link was #8B5CF6 (4.23:1) — below AA 4.5 for normal text. */
.hero-login-link {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.hero-guest-search__link {
    color: #7c3aed !important;
}

/* Bottom nav active label: #8B5CF6 (4.23:1) → #7C3AED (5.70:1) for AA */
.bottom-nav-item.active .bottom-nav-label {
    color: #7c3aed !important;
}

/* 2026-04-23: keep 實際重量 / 商品總金額 row on mobile — currency select's
   shorthand `flex: 0 0 auto` uses flex-basis:auto so `width:100px` is ignored
   and Chinese option text ("人民幣") stretches it to fill 155px, pushing the
   price input off-screen. Lock the basis at 78px. */
@media (max-width: 640px) {
    .uc-price-group .uc-currency {
        flex: 0 0 108px !important;
        width: 108px !important;
        max-width: 108px !important;
    }
    .uc-price-group .uc-input {
        flex: 1 1 0 !important;
        min-width: 0 !important;
    }
}

/* Shipping calc active sea tab: teal #0D9488 (3.74:1) → #0F766E (~5.1:1) for AA */
.calc-tab.calc-tab--sea.is-active,
.calc-tab.calc-tab--sea.is-active > span {
    color: #0f766e !important;
}

/* 2026-04-23 P2-11: minimum legible font-size for body text.
   cards.css / landing.css / festival-base.css load AFTER a11y.css, so matching
   their selector specificity would lose the cascade. `body.home-page` adds a
   type selector, raising specificity to (0,3,1) to beat cards.css (0,3,0). */
body.home-page .hero-stats .stat-label,
body.home-page .statistics .stat-label,
body.home-page .landing-hero .hero-stats .stat-label,
body.home-page .card--customs .code-label {
    font-size: 12px !important;
}

body .fest-countdown__label,
body.home-page .fest-countdown__label {
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

@media (max-width: 480px) {
    body.home-page .hero-stats .stat-label,
    body.home-page .card--customs .code-label {
        font-size: 12px !important;
    }
}

@media (max-width: 767px) {
    body .fest-countdown__label,
    body.home-page .fest-countdown__label {
        font-size: 11px !important;
    }
}
