:root {
    --tabbar-height: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
    min-height: 100dvh;
}

.app-tabbar {
    display: none;
}

@media (max-width: 820px) {
    body {
        padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom));
    }

    .admin-bar .app-tabbar {
        bottom: 0;
    }

    .topbar,
    .site-nav,
    .nav-toggle,
    .header-actions > a span,
    .view-toggle,
    .newsletter {
        display: none !important;
    }

    .site-header {
        box-shadow: 0 10px 30px rgba(80, 58, 32, 0.06);
    }

    .header-main {
        grid-template-columns: auto auto;
        gap: 10px 12px;
        min-height: 64px;
        padding-block: 8px;
    }

    .header-search {
        display: flex !important;
        grid-column: 1 / -1;
        order: 3;
        min-height: 44px;
    }

    .header-search input {
        padding: 10px 14px;
        font-size: 15px;
    }

    .header-search button {
        width: 44px;
        min-width: 44px;
    }

    .brand img {
        height: 42px;
        max-width: 150px;
    }

    .header-actions {
        justify-content: flex-end;
        gap: 4px;
    }

    .header-actions a,
    .header-actions .cart-btn {
        width: 42px;
        height: 42px;
        justify-content: center;
        border-radius: 50%;
        background: var(--cream-2);
    }

    .cart-btn em,
    .cart-count,
    .header-wish .wish-count {
        top: 2px;
        left: 2px;
    }

    .container {
        width: min(1180px, calc(100% - 24px));
    }

    .section {
        padding: 18px 0;
        scroll-margin-top: 120px;
        scroll-margin-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 16px);
    }

    .section-head h2,
    .section-head.split h2 {
        font-size: 22px;
        text-align: start;
    }

    .section-head.split {
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: start;
        grid-template-columns: none;
    }

    .hero {
        padding: 10px 0 4px;
    }

    .hero-slider {
        min-height: 438px;
        border-radius: 22px;
        overflow: hidden;
        background: #fff;
        box-shadow: 0 12px 28px rgba(80, 58, 32, 0.08);
    }

    .hero-slide {
        background: #fff;
    }

    .hero-slide::before,
    .hero-slide.align-left::before,
    .hero-slide.align-right::before {
        display: none;
    }

    .hero-media {
        inset: 0 0 auto;
        height: 210px;
        object-fit: cover;
        object-position: center;
    }

    .hero-slide[data-hero="1"] .hero-media {
        object-position: 8% center;
    }

    .hero-slide[data-hero="2"] .hero-media {
        object-position: 92% center;
    }

    .hero-slide[data-hero="3"] .hero-media {
        object-position: 22% center;
    }

    .hero-slide[data-hero="4"] .hero-media {
        object-position: 82% center;
    }

    .hero-copy {
        left: 0 !important;
        right: 0 !important;
        top: 210px;
        bottom: 0;
        transform: none;
        width: auto;
        padding: 14px 16px 38px;
        background: #fff;
        backdrop-filter: none;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .hero-copy .eyebrow {
        display: inline-block;
        margin: 0 0 6px;
        font-size: 12px;
    }

    .hero-copy h1 {
        font-size: 20px;
        margin: 0 0 8px;
        color: var(--ink);
    }

    .hero-copy .hero-text {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
        margin: 0 0 12px;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.55;
    }

    .hero-copy .btn-gold {
        width: 100%;
        min-height: 42px;
        padding: 0 18px;
        font-size: 14px;
    }

    .hero-perks,
    .hero-badge,
    .hero-arrow {
        display: none;
    }

    .hero-dots {
        bottom: 12px;
    }

    .categories .section-head {
        margin-bottom: 14px;
    }

    .category-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
        overflow: visible;
        padding: 0;
        scroll-snap-type: none;
    }

    .category-card {
        flex: none;
        width: 100%;
        min-height: 132px;
        padding: 12px 6px 10px;
        border-radius: 18px;
        box-shadow: 0 8px 20px rgba(80, 58, 32, 0.06);
    }

    .category-icon {
        width: 70px;
        height: 70px;
        margin: 0 auto 6px;
    }

    .category-label {
        min-height: 2.6em;
        font-size: 12px;
        line-height: 1.3;
    }

    .promo-grid,
    .article-grid,
    .footer-grid,
    .pharmacist-card,
    .newsletter-card {
        grid-template-columns: 1fr !important;
        grid-template-rows: none;
    }

    .article-card,
    .article-card.is-featured {
        flex-direction: column;
        grid-row: auto;
    }

    .article-card-media,
    .article-card.is-featured .article-card-media {
        width: 100%;
        flex: 0 0 auto;
        aspect-ratio: 16 / 10;
        min-height: 0;
    }

    .article-card-body {
        padding: 14px 14px 16px;
    }

    .article-card h3 {
        font-size: 16px;
    }

    .article-card p {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .trust-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px;
        padding: 10px;
        border-radius: 22px;
    }

    .trust-card {
        min-height: 138px;
        padding: 14px 8px 12px;
        background: var(--cream-2);
        border-radius: 16px;
    }

    .trust-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 8px;
    }

    .trust-icon svg {
        width: 24px;
        height: 24px;
    }

    .trust-card h3 {
        font-size: 13px;
        min-height: 2.6em;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
    }

    .trust-card p {
        font-size: 11.5px;
        min-height: 1.4em;
    }

    .product-grid,
    .woocommerce ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px;
    }

    .product-card,
    .article-card,
    .entry-card {
        border-radius: 18px;
    }

    .product-body {
        padding: 10px 10px 12px;
    }

    .product-body h3 {
        font-size: 12.5px;
        height: auto;
        min-height: 38px;
        line-height: 1.45;
    }

    .product-brand,
    .product-rating {
        font-size: 11px;
    }

    .price strong {
        font-size: 15px;
    }

    .btn-cart {
        min-height: 40px;
        font-size: 12.5px;
        border-radius: 10px;
        gap: 6px;
    }

    .product-toolbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .product-toolbar-actions {
        flex-direction: row;
    }

    .sort-field select {
        min-height: 40px;
        font-size: 13px;
    }

    .pharmacist-copy {
        padding: 24px 18px;
        text-align: start;
    }

    .site-footer {
        padding-bottom: 12px;
    }

    .app-tabbar {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        height: calc(var(--tabbar-height) + var(--safe-bottom));
        padding: 6px 8px var(--safe-bottom);
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--line);
        box-shadow: 0 -10px 30px rgba(80, 58, 32, 0.08);
    }

    .app-tabbar a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: #8a8076;
        font-size: 11px;
        font-weight: 700;
        min-height: 52px;
        border-radius: 14px;
    }

    .app-tabbar a.is-active {
        color: var(--gold-dark);
        background: var(--gold-soft);
    }

    .app-tabbar svg {
        width: 22px;
        height: 22px;
    }

    .tab-cart {
        position: relative;
        display: grid;
        place-items: center;
    }

    .tab-cart .cart-count {
        position: absolute;
        top: -6px;
        left: -8px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: var(--gold);
        color: #fff;
        font-size: 10px;
        font-style: normal;
        display: grid;
        place-items: center;
    }
}

@media (min-width: 821px) and (max-width: 1100px) {
    .product-grid,
    .woocommerce ul.products {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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