/* =========================================================
   Olalux — Responsive Audit & Global Fixes
   Loaded LAST. Fixes overflow, typography, layout drift,
   nav cut-off, image distortion, and small-screen issues.
   Mobile-first approach with progressive enhancement.
   ========================================================= */

/* =========================================================
   1. GLOBAL FOUNDATION — overflow guards, box-sizing
   ========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

html,
body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

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

img {
    display: block;
}

/* Prevent overflow from rogue children */
section,
header,
footer,
main,
nav,
article,
aside {
    max-width: 100%;
}

/* =========================================================
   A11Y HELPERS
   ========================================================= */
.visually-hidden,
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-to-content {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 9999;
    padding: 12px 18px;
    background: var(--ink-900, #0e0a14);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: top 240ms ease;
}

.skip-to-content:focus {
    top: 16px;
    outline: 2px solid var(--accent, #c9526e);
    outline-offset: 2px;
}

/* Keyboard focus visible — modern */
:focus-visible {
    outline: 2px solid var(--accent, #c9526e);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline-offset: 3px;
}

/* Remove default focus on mouse click */
:focus:not(:focus-visible) {
    outline: none;
}

/* =========================================================
   2. CONTAINER SYSTEM — fluid, capped at 1320px
   ========================================================= */
:root {
    --container-max: 1320px;
    --container-pad-mobile: 16px;
    --container-pad-tablet: 24px;
    --container-pad-desktop: 32px;

    --section-pad-y-mobile: 48px;
    --section-pad-y-tablet: 64px;
    --section-pad-y-desktop: clamp(72px, 8vw, 120px);

    --header-h-mobile: 96px;
    --header-h-tablet: 116px;
    --header-h-desktop: 136px;
}

.olx-container,
.watch-container,
.lens-container {
    width: 100%;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-pad-mobile);
    padding-right: var(--container-pad-mobile);
}

@media (min-width: 768px) {
    .olx-container,
    .watch-container,
    .lens-container {
        padding-left: var(--container-pad-tablet);
        padding-right: var(--container-pad-tablet);
    }
}

@media (min-width: 1280px) {
    .olx-container,
    .watch-container,
    .lens-container {
        padding-left: var(--container-pad-desktop);
        padding-right: var(--container-pad-desktop);
    }
}

/* =========================================================
   3. BODY OFFSET — match fixed header
   ========================================================= */
body {
    padding-top: var(--header-h-mobile) !important;
    transition: padding-top 0.28s ease;
}

@media (min-width: 768px) {
    body { padding-top: var(--header-h-tablet) !important; }
}

@media (min-width: 1024px) {
    body { padding-top: var(--header-h-desktop) !important; }
}

/* When header collapses to nav-only, reduce offset */
body.has-compact-header { padding-top: 64px !important; }
@media (max-width: 920px) {
    body.has-compact-header { padding-top: 56px !important; }
}

/* =========================================================
   4. NAV BAR — ensure full center + edge-to-edge
   ========================================================= */
.olx-nav-bar.header__menu .olx-container,
.olx-nav-bar .olx-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    margin: 0 !important;
}

@media (min-width: 768px) {
    .olx-nav-bar.header__menu .olx-container,
    .olx-nav-bar .olx-container {
        padding-left: 24px !important;
        padding-right: 24px !important;
    }
}

/* =========================================================
   5. TYPOGRAPHY — fluid clamp, no overflow
   ========================================================= */
h1, h2, h3, h4, h5, h6, p, a, span, li, label {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

h1 { font-size: clamp(1.75rem, 4vw + 0.5rem, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw + 0.5rem, 2.5rem); }
h3 { font-size: clamp(1.125rem, 1.6vw + 0.4rem, 1.5rem); }
h4 { font-size: clamp(1rem, 1.2vw + 0.4rem, 1.25rem); }

@media (max-width: 480px) {
    .olx-hero-copy h1 { font-size: clamp(2rem, 8vw, 2.5rem) !important; }
    .olx-section-head h2,
    .olx-consult-copy h2 { font-size: clamp(1.5rem, 6vw, 2rem) !important; }
    .olx-hero-copy p,
    .olx-section-head p { font-size: 0.9375rem !important; }
}

/* =========================================================
   6. HERO SECTION — mobile-safe
   ========================================================= */
@media (max-width: 768px) {
    .olx-hero-shell { grid-template-columns: 1fr !important; }
    .olx-hero-visual { min-height: clamp(240px, 60vw, 360px) !important; }
    .olx-hero-copy { padding: clamp(28px, 6vw, 44px) !important; }
    .olx-hero-actions { flex-direction: column; align-items: stretch; }
    .olx-hero-actions .olx-btn { width: 100%; }
}

@media (max-width: 480px) {
    .olx-stats-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .olx-stats-row > div {
        padding: 12px 0 !important;
        border-right: 0 !important;
        border-bottom: 1px solid var(--ink-200);
    }
    .olx-stats-row > div:last-child { border-bottom: 0; }
}

/* =========================================================
   7. PRODUCT GRIDS — auto-fit responsive
   ========================================================= */
.olx-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)) !important;
    gap: clamp(12px, 2vw, 24px) !important;
}

.olx-collection-grid {
    gap: clamp(12px, 1.6vw, 22px) !important;
}

.watch-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)) !important;
    gap: clamp(14px, 2vw, 24px) !important;
}

.olx-feature-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)) !important;
    gap: clamp(14px, 1.6vw, 20px) !important;
}

.olx-review-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)) !important;
    gap: clamp(14px, 1.6vw, 20px) !important;
}

/* =========================================================
   8. SECTION HEAD — wrap on small screens
   ========================================================= */
@media (max-width: 720px) {
    .olx-section-head,
    .olx-section-head-row {
        grid-template-columns: 1fr !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }
    .olx-section-head .olx-link-arrow,
    .olx-section-head-row .olx-link-arrow {
        align-self: flex-start;
    }
}

/* =========================================================
   9. PRODUCT DETAIL — responsive
   ========================================================= */
@media (max-width: 991px) {
    .watch-detail-grid {
        grid-template-columns: 1fr !important;
        gap: clamp(20px, 4vw, 32px) !important;
    }
    .watch-info-col { padding-top: 0; }
    .watch-thumbnails {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .watch-button-group { grid-template-columns: 1fr !important; }
    .watch-quantity-box {
        flex-wrap: wrap;
        gap: 12px;
    }
    .watch-stock-text { width: 100%; margin: 0; }
}

/* =========================================================
   10. CART — responsive table-less layout
   ========================================================= */
@media (max-width: 991px) {
    .shop-cart .row {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    .cart-summary { position: static !important; }
}

@media (max-width: 720px) {
    .cart-item {
        grid-template-columns: 80px 1fr !important;
        padding: 14px !important;
        gap: 14px !important;
    }
    .cart-item-details {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        align-items: flex-start;
    }
    .cart-item-price,
    .cart-item-total {
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        text-align: left;
        width: 100%;
    }
    .cart-item-quantity { width: 100%; }
    .cart-item-remove {
        position: absolute;
        top: 14px;
        right: 14px;
    }
    .cart-item { position: relative; }
    .cart-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .btn-continue,
    .btn-update {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================================
   11. SHOP SIDEBAR — collapse to top on tablet
   ========================================================= */
@media (max-width: 991px) {
    .watch-shop-layout {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    .watch-sidebar {
        position: static !important;
        flex-direction: column;
    }
    .watch-sidebar-block { padding: 22px 18px; }
}

/* =========================================================
   12. TABS — scrollable on small screens
   ========================================================= */
@media (max-width: 575px) {
    .watch-tabs-nav {
        overflow-x: auto;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
        padding: 0 14px !important;
    }
    .watch-tabs-nav::-webkit-scrollbar { display: none; }
    .watch-tab-btn { white-space: nowrap; flex-shrink: 0; }
    .watch-tabs-content { padding: 20px 16px !important; }
}

/* =========================================================
   13. FOOTER — graceful collapse
   ========================================================= */
@media (max-width: 991px) {
    .footer .row {
        grid-template-columns: 1fr 1fr !important;
        gap: 32px !important;
    }
}

@media (max-width: 575px) {
    .footer .row {
        grid-template-columns: 1fr !important;
        gap: 28px !important;
        text-align: left;
    }
    .footer__social { justify-content: flex-start; }
    .newsletter__input-group { flex-direction: row !important; }
}

/* =========================================================
   14. AUTH / FORMS — input width safety
   ========================================================= */
input,
select,
textarea {
    max-width: 100%;
}

.checkout-form,
.olx-consult-form,
.auth-form,
.login-form form,
.register-form form {
    max-width: 100%;
}

@media (max-width: 720px) {
    .olx-consult-form { grid-template-columns: 1fr !important; }
    .olx-consult-shell { grid-template-columns: 1fr !important; }
}

/* =========================================================
   15. BUTTONS — never overflow container
   ========================================================= */
.olx-btn,
.watch-btn,
.btn-continue,
.btn-update,
.btn-checkout,
.btn-checkout-momo,
.watch-add-cart-btn,
.watch-filter-btn {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================================
   16. BREADCRUMB — wrap, never overflow
   ========================================================= */
.watch-breadcrumb-list,
.breadcrumb__links {
    flex-wrap: wrap !important;
}

/* =========================================================
   17. COLLECTIONS — mobile-safe asymmetric
   ========================================================= */
@media (max-width: 1024px) {
    .olx-collections .olx-collection-card:nth-child(1),
    .olx-collections .olx-collection-card:nth-child(2),
    .olx-collections .olx-collection-card:nth-child(3),
    .olx-collections .olx-collection-card:nth-child(4) {
        grid-column: span 6 !important;
        grid-row: span 1 !important;
    }
    .olx-collections .olx-collection-card.is-wide {
        grid-column: span 12 !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

@media (max-width: 600px) {
    .olx-collections .olx-collection-grid {
        grid-template-columns: 1fr !important;
    }
    .olx-collections .olx-collection-card:nth-child(n) {
        grid-column: span 1 !important;
    }
    .olx-collections .olx-collection-card { min-height: 260px !important; }
    .olx-collections .olx-collection-card .col-cta {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* =========================================================
   18. HEADER — mobile compact
   ========================================================= */
@media (max-width: 920px) {
    .olx-header-grid {
        grid-template-columns: auto 1fr auto !important;
        gap: 12px !important;
        min-height: 60px !important;
    }
    .olx-search { display: none; }
    .olx-logo-copy small { display: none; }
    .olx-logo-copy strong { font-size: 1rem !important; }
    .olx-logo-mark { width: 36px !important; height: 36px !important; }
    .olx-action-btn,
    .olx-user-pill { min-height: 38px !important; }
    .olx-action-wide span { display: none; }
    .olx-action-wide { width: 38px !important; padding: 0 !important; }
    .olx-topbar { font-size: 0.625rem !important; }
    .olx-topbar a { font-size: 0.625rem !important; }
}

@media (max-width: 480px) {
    .olx-topbar .olx-container {
        flex-direction: column;
        gap: 2px;
        padding: 6px 16px !important;
        min-height: auto !important;
    }
    .olx-topbar span,
    .olx-topbar a { line-height: 1.3; }
}

/* =========================================================
   19. ANIMATION — disable on touch devices for perf
   ========================================================= */
@media (hover: none) and (pointer: coarse) {
    .olx-product-card:hover,
    .watch-product-card:hover,
    .olx-collection-card:hover,
    .olx-feature-grid article:hover,
    .cart-item:hover {
        transform: none;
        box-shadow: var(--elev-2);
    }
    .olx-product-card:hover .olx-product-media img,
    .watch-product-card:hover .watch-product-img,
    .olx-collection-card:hover img {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =========================================================
   20. PERFORMANCE — content-visibility for below-fold
   ========================================================= */
.olx-section,
.watch-shop-section,
.shop-cart {
    contain: layout style;
}

/* Prevent will-change leak */
.olx-product-card,
.watch-product-card,
.olx-collection-card {
    will-change: auto;
}

.olx-product-card:hover,
.watch-product-card:hover,
.olx-collection-card:hover {
    will-change: transform;
}

/* =========================================================
   21. FALLBACKS — safe defaults
   ========================================================= */
@supports not (aspect-ratio: 1) {
    .olx-product-media,
    .watch-product-img-wrapper,
    .watch-main-image {
        height: 0;
        padding-bottom: 100%;
        position: relative;
    }
    .olx-product-media > *,
    .watch-product-img-wrapper > *,
    .watch-main-image > * {
        position: absolute;
        inset: 0;
    }
}

@supports not (backdrop-filter: blur(10px)) {
    .olx-site-header { background: rgba(255, 255, 255, 0.97) !important; }
    .search-model { background: rgba(14, 10, 20, 0.96) !important; }
}

/* =========================================================
   22. PRINT — minimal cleanup
   ========================================================= */
@media print {
    .olx-site-header,
    .footer,
    .olx-topbar,
    .search-model,
    .canvas__open,
    .olx-action-btn { display: none !important; }
    body { padding-top: 0 !important; }
}
