/* Mobile-first responsive fixes */
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    overflow-x: hidden;
    max-width: 100%;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

main {
    overflow-x: clip;
    max-width: 100%;
}

.container-fluid {
    max-width: 100%;
}

/* Bootstrap rows: allow columns to shrink and wrap text */
.row {
    max-width: 100%;
}

.row > [class*="col"] {
    min-width: 0;
}

img {
    max-width: 100%;
    height: auto;
}

/* Consistent horizontal padding on small screens */
@media (max-width: 575.98px) {
    .container-fluid.px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* Top bar */
@media (max-width: 575.98px) {
    .top-bar {
        font-size: 0.72rem;
    }

    .top-bar-right {
        gap: 0.65rem !important;
    }

    .top-link-compact {
        font-size: 0.72rem;
    }
}

/* Header */
@media (max-width: 767.98px) {
    .main-header .row {
        --bs-gutter-y: 0.75rem;
    }

    .brand-logo {
        width: 48px;
        height: 48px;
    }

    .search-input {
        padding: 0.55rem 0.85rem;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .search-btn {
        padding: 0 1rem;
        min-width: 44px;
        min-height: 44px;
    }
}

.mobile-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    width: 100%;
}

.mobile-header-actions a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.1rem;
}

/* Navigation */
@media (max-width: 991.98px) {
    .nav-shell {
        gap: 0.5rem;
    }

    .main-nav .categories-toggle.d-lg-none {
        flex: 1;
        min-height: 44px;
        font-size: 0.82rem;
        padding: 0.5rem 0.65rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .main-nav .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main-nav .nav-links-wrap {
        flex-basis: 100%;
        width: 100%;
        margin-top: 0.35rem;
        padding-top: 0.65rem;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .main-nav .navbar-nav {
        width: 100%;
        align-items: stretch;
        text-align: center;
    }

    .main-nav .nav-link {
        padding: 0.7rem 0.5rem;
    }

    .main-nav .nav-actions {
        width: 100%;
        justify-content: center;
        padding: 0.35rem 0 0.5rem;
    }
}

/* Hero */
@media (max-width: 991.98px) {
    .hero-section {
        padding-top: 0.65rem;
    }

    .hero-layout,
    .hero-slider {
        min-height: clamp(400px, 50vh, 500px);
    }
}

@media (max-width: 767.98px) {
    .hero-layout,
    .hero-slider {
        min-height: clamp(420px, 58vh, 540px);
    }
}

@media (max-width: 575.98px) {
    .hero-layout,
    .hero-slider {
        min-height: clamp(440px, 72vh, 620px);
    }

    .hero-section {
        padding-bottom: 0.5rem;
    }

    .hero-overlay {
        padding: 1.5rem 1rem 2rem;
    }

    .hero-title {
        font-size: clamp(1.35rem, 7vw, 1.75rem);
        letter-spacing: 0.02em;
    }

    .hero-kicker {
        font-size: 0.68rem;
        letter-spacing: 0.08em;
    }

    .hero-sub {
        font-size: 0.78rem;
        margin-bottom: 0.85rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .btn-hero {
        padding: 0.55rem 1.1rem;
        font-size: 0.8rem;
        min-height: 44px;
    }

    .hero-nav {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .hero-prev {
        left: 6px;
    }

    .hero-next {
        right: 6px;
    }

    .hero-mini-logo {
        width: 40px;
        height: 40px;
    }
}

/* Sections */
@media (max-width: 767.98px) {
    .section-block,
    .features-bar,
    .promo-banner,
    .shop-categories-section,
    .bg-section {
        overflow-x: clip;
        max-width: 100%;
    }

    .section-block > .container-fluid,
    .features-bar > .container-fluid,
    .promo-banner > .container-fluid {
        margin-left: auto;
        margin-right: auto;
    }

    .section-heading,
    .section-heading-panel {
        text-align: center;
    }

    .features-bar .feature-item {
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    /* Why Choose Us — centered cards on mobile */
    .why-section > .container-fluid {
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }

    .why-section .row.g-4 {
        --bs-gutter-x: 1rem;
        margin-left: auto;
        margin-right: auto;
        justify-content: center;
    }

    .why-section .col-lg-5,
    .why-section .col-lg-7 {
        width: 100%;
        max-width: 100%;
    }

    .why-section .section-heading {
        text-align: center;
    }

    .why-section .why-image {
        display: block;
        max-width: min(100%, 22rem);
        margin-left: auto;
        margin-right: auto;
    }

    .why-section .col-lg-7 > .row {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        justify-content: center;
    }

    .why-section .col-lg-7 > .row > [class*='col-'] {
        width: 100%;
        max-width: min(100%, 22rem);
        margin-left: auto;
        margin-right: auto;
        flex: 0 0 100%;
    }

    .why-section .why-card {
        text-align: center;
        width: 100%;
    }

    .why-section .why-icon {
        margin-left: auto;
        margin-right: auto;
    }

    .why-section .reveal[data-animate='fade-right'] {
        transform: none !important;
    }

    /* Side-slide reveals shift layout on narrow screens */
    .reveal[data-animate='fade-up'],
    .reveal[data-animate='fade-down'],
    .reveal[data-animate='fade-left'],
    .reveal[data-animate='fade-right'],
    .reveal[data-animate='scale-in'] {
        transform: none !important;
    }

    .section-block {
        padding: 2.25rem 0;
    }

    .section-heading h2 {
        font-size: 1.3rem;
    }

    .promo-banner {
        padding-bottom: 2rem;
    }

    .promo-off {
        font-size: 1.65rem;
    }

    .promo-center h3 {
        font-size: 1.1rem;
    }

    .flash-deal-card {
        padding: 1.15rem;
    }

    .countdown-timer {
        font-size: 1.55rem;
    }

    .testimonial-card {
        padding: 1.25rem;
    }

    .testimonial-text {
        font-size: 0.95rem;
    }

    .page-banner {
        min-height: 160px;
    }

    .page-banner-content {
        padding: 2rem 0;
    }

    .cta-strip {
        padding-bottom: 2rem;
    }

    .cta-strip-inner {
        padding: 1.25rem;
        text-align: center;
        justify-content: center;
    }

    .cta-strip-inner .d-flex {
        width: 100%;
        justify-content: center;
    }

    .cta-strip-inner .btn {
        flex: 1 1 auto;
        min-width: 140px;
    }
}

/* Products */
@media (max-width: 575.98px) {
    .product-title {
        font-size: 0.75rem;
    }

    .btn-cart {
        font-size: 0.7rem;
        padding: 0.5rem 0.35rem;
        min-height: 40px;
    }

    .product-badge {
        font-size: 0.6rem;
    }

    .price-current {
        font-size: 0.85rem;
    }

    .price-old {
        font-size: 0.72rem;
    }
}

@media (hover: none) {
    .product-quick-actions {
        opacity: 1;
        transform: none;
    }

    .hover-lift:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Shop filters — horizontal scroll on phone */
@media (max-width: 767.98px) {
    .shop-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.35rem;
        margin: 0 -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .shop-filters::-webkit-scrollbar {
        display: none;
    }

    .filter-chip {
        flex-shrink: 0;
        min-height: 40px;
    }
}

/* Collections */
@media (max-width: 575.98px) {
    .collection-card {
        min-height: 180px;
    }

    .collection-image img {
        min-height: 180px;
    }

    .collection-caption {
        padding: 0.85rem;
    }

    .collection-caption h5 {
        font-size: 0.9rem;
    }

    .collection-caption p {
        font-size: 0.72rem;
        margin-bottom: 0.45rem;
    }
}

/* FAQ accordion */
@media (max-width: 575.98px) {
    .faq-accordion .accordion-button {
        font-size: 0.88rem;
        padding: 0.85rem 1rem;
    }
}

/* Footer */
@media (max-width: 575.98px) {
    .newsletter-form {
        flex-direction: column;
        gap: 0.5rem !important;
    }

    .newsletter-form .form-control,
    .newsletter-form .btn {
        width: 100%;
        border-radius: 4px !important;
        min-height: 44px;
    }

    .footer-bottom {
        text-align: center;
        justify-content: center !important;
    }

    .footer-bottom > span {
        width: 100%;
        justify-content: center;
    }
}

/* Back to top — safe area */
.back-to-top {
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
}

/* Touch targets */
@media (max-width: 991.98px) {
    .btn,
    .nav-link,
    .filter-chip {
        min-height: 44px;
    }
}

.offcanvas.category-offcanvas {
    max-width: min(320px, 92vw);
}

/* Lookbook grid on very small screens */
@media (max-width: 399.98px) {
    .lookbook-item figcaption {
        font-size: 0.68rem;
    }
}

/* Features bar — prevent text collision / horizontal bleed */
.features-bar {
    overflow-x: clip;
}

.features-grid > .col {
    display: flex;
}

.feature-item {
    flex: 1;
    width: 100%;
}

.categories-grid {
    max-width: 100%;
}

.categories-grid > [class*="col"] {
    max-width: 100%;
}

.feature-item h6 {
    font-size: clamp(0.78rem, 3.2vw, 0.9rem);
    line-height: 1.3;
    margin-bottom: 0.25rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.feature-item p {
    font-size: clamp(0.68rem, 2.8vw, 0.8rem);
    line-height: 1.35;
    margin: 0 auto;
    max-width: 14rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.stats-grid .col {
    min-width: 0;
}

/* Clip animated / wide children */
.bg-section,
.hero-section,
.promo-banner,
.brand-marquee,
.testimonial-slider,
.hero-slider {
    max-width: 100%;
    overflow-x: clip;
}

.brand-marquee {
    width: 100%;
}

.promo-inner,
.flash-deal-card,
.cta-strip-inner {
    max-width: 100%;
}

/* Scroll-reveal transforms can extend layout before visible */
.reveal {
    max-width: 100%;
}

/* Keep 2 columns on tablet — avoid 4 cramped icons until very wide screens */
@media (min-width: 576px) and (max-width: 1399.98px) {
    .features-grid {
        --bs-columns: 2;
    }
}

@media (max-width: 991.98px) {
    .shop-categories-section {
        padding-top: 2.25rem;
    }

    .top-bar > .container-fluid > .d-flex {
        flex-wrap: wrap;
        justify-content: center !important;
        row-gap: 0.35rem;
    }

    .nav-shell {
        max-width: 100%;
        overflow-x: clip;
    }

    .main-header .brand-text {
        overflow-wrap: anywhere;
    }
}
