@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');

/* ---------- Root Variables ---------- */
:root {
    --ink: #2b2b2b;
    --paper: #ffffff;
    --soft: #f7f6f4;
    --brand: #b59a5b; /* tan / gold buttons */
    --brand-dark: #9a8147;
    --sale: #d62828;
    --muted: #6d6d6d;
    --header-h: 88px;
    --header-h-small: 62px;
    --hd-red: #e31e24;
    --hd-dark: #222222;
    --hd-gray: #f8f9fa;
    --hd-border: #e9ecef;
}

/* ---------- Global Layout & Reset ---------- */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--paper);
    overflow-x: hidden;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

main {
    flex: 1; /* Pushes the footer to the bottom of the screen */
}
/* ---------- Form & Focus States ---------- */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ---------- Top Utility Bar ---------- */
.top-bar {
    background-color: var(--hd-gray);
    border-bottom: 1px solid var(--hd-border);
    font-size: 0.85rem;
}

/* ---------- Main Branding Header ---------- */
.main-header {
    padding: 15px 0;
}

.brand-logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--hd-dark);
    text-decoration: none;
    letter-spacing: -0.5px;
}

    .brand-logo span {
        color: var(--hd-red);
    }

/* ---------- Search Bar Input Group ---------- */
.header-search .form-select {
    max-width: 160px;
    background-color: #f1f3f5;
    border-right: none;
}

    .header-search .form-control:focus,
    .header-search .form-select:focus {
        box-shadow: none;
        border-color: #ced4da;
    }

.header-search .btn-search {
    background-color: var(--hd-red);
    color: #fff;
    padding: 0 20px;
}

    .header-search .btn-search:hover {
        background-color: #c8181d;
        color: #fff;
    }

/* ---------- Header Action Icons ---------- */
.header-actions .action-item {
    color: var(--hd-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions .icon-box {
    font-size: 1.5rem;
    position: relative;
}

.header-actions .badge-count {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: var(--hd-red);
    color: white;
    font-size: 0.65rem;
    border-radius: 50%;
    padding: 2px 5px;
}

/* ---------- Navigation Bar & Dropdowns ---------- */
.main-navbar {
    background-color: #fff;
    border-top: 1px solid var(--hd-border);
    padding: 0;
}

    .main-navbar .nav-link {
        color: var(--hd-dark);
        font-weight: 600;
        font-size: 0.95rem;
        padding: 14px 18px !important;
        text-transform: uppercase;
    }

        .main-navbar .nav-link:hover,
        .main-navbar .nav-link.active {
            color: var(--hd-red);
        }

        .main-navbar .nav-link.highlight-red {
            color: var(--hd-red);
        }

.dropdown-menu {
    border-radius: 0;
    border-top: 2px solid var(--hd-red);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
    /* Override Bootstrap active dropdown item background color */
    .dropdown-menu .dropdown-item.active,
    .dropdown-menu .dropdown-item:active {
        background-color: #f8f9fa; /* Light gray background */
        color: #212529; /* Dark text color */
    }

/* Change focus/active border and shadow on the dropdown toggle button to red */
.header-search .dropdown-toggle:focus,
.header-search .dropdown-toggle:active,
.header-search .show > .dropdown-toggle.btn-outline-secondary {
    border-color: var(--hd-red) !important;
    box-shadow: 0 0 0 0.25rem rgba(227, 30, 36, 0.25) !important;
}
/* Hover-to-open dropdown on desktop */
@media (min-width: 992px) {
    .navbar .nav-item.dropdown:hover > .dropdown-menu {
        display: block;
        margin-top: 0;
    }
}

/* ---------- Buttons ---------- */
.btn-brand {
    background: var(--brand);
    border: 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .02em;
    padding: .7rem 1.6rem;
    border-radius: 6px;
}

    .btn-brand:hover, .btn-brand:focus-visible {
        background: var(--brand-dark);
        color: #fff;
    }

/* ---------- Hero ---------- */
.hero {
    position: relative;
}

.hero-img {
    width: 100%;
    height: clamp(380px, 62vh, 640px);
    object-fit: cover;
    display: block;
}

.hero-panel {
    position: absolute;
    left: clamp(1rem, 11vw, 12rem);
    top: 50%;
    transform: translateY(-50%);
    width: min(780px, calc(100% - 2rem));
    background: rgba(35, 35, 35, .94);
    color: #fff;
    padding: clamp(1.25rem, 3vw, 3rem);
    border-radius: 14px;
}

.hero-lead {
    font-size: clamp(1.1rem, 2.4vw, 2rem);
    font-weight: 300;
    margin: 0 0 .25rem;
}

.hero-title {
    font-size: clamp(1.6rem, 4.4vw, 3.6rem);
    font-weight: 700;
    line-height: 1.08;
    text-transform: uppercase;
    margin: 0 0 1.5rem;
}

.hero-dots {
    margin-bottom: 1.25rem;
    z-index: 3;
}

    .hero-dots [data-bs-target] {
        width: 14px;
        height: 14px;
        border-radius: 50%;
        border: 0;
        background: #ddd;
        opacity: 1;
        margin: 0 6px;
    }

    .hero-dots .active {
        background: #222;
    }

.hero .carousel-control-prev-icon,
.hero .carousel-control-next-icon {
    filter: invert(1) drop-shadow(0 0 2px rgba(0,0,0,.6));
}

/* ---------- Category cards ---------- */
.category-row {
    padding: 3rem clamp(1rem, 2vw, 2rem);
}

.category-img {
    display: block;
    overflow: hidden;
    border-radius: 4px;
}

    .category-img img {
        width: 100%;
        aspect-ratio: 8 / 5;
        object-fit: cover;
        display: block;
        transition: transform .4s ease;
    }

    .category-img:hover img {
        transform: scale(1.03);
    }

.category-lead {
    font-size: 1.15rem;
    margin: 1.1rem 0 .1rem;
}

.category-title {
    font-size: 2rem;
    font-weight: 400;
    text-transform: uppercase;
    margin: 0 0 1rem;
}

/* ---------- Best sellers ---------- */
.best-sellers {
    background: var(--soft);
    padding: 3rem 0 4rem;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.best-sellers-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    margin: 0;
}

.scroller-buttons {
    display: flex;
    gap: .6rem;
}

.scroller-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 0;
    background: #ececec;
    font-size: 1.7rem;
    line-height: 1;
    display: grid;
    place-items: center;
    color: var(--ink);
}

    .scroller-btn:hover {
        background: #dedede;
    }

.product-scroller {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: .75rem;
    scrollbar-width: none;
}

    .product-scroller::-webkit-scrollbar {
        display: none;
    }

.product-card {
    flex: 0 0 clamp(200px, 23%, 280px);
    scroll-snap-align: start;
}

.product-img {
    position: relative;
    display: block;
    background: #fff;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 4px;
}

    .product-img img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

.product-name {
    font-size: 1rem;
    font-weight: 400;
    margin: .9rem 0 .25rem;
    min-height: 2.9em;
}

    .product-name a {
        color: var(--ink);
        text-decoration: none;
    }

        .product-name a:hover {
            color: var(--brand-dark);
        }

.product-price {
    margin: 0;
    font-weight: 700;
}

    .product-price .was {
        color: var(--muted);
        font-weight: 400;
        margin-right: .5rem;
    }

.badge-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    font-size: .8rem;
    padding: .15rem .5rem;
    border-radius: 3px;
    color: #fff;
}

.badge-soldout {
    background: #1d1d1d;
}

.badge-sale {
    background: var(--sale);
}

/* ---------- Footer Styling ---------- */
.footer-newsletter {
    background-color: #bfa175;
    color: #fff;
}

    .footer-newsletter .form-control {
        border-radius: 0;
        border: none;
        padding: 10px 15px;
    }

        .footer-newsletter .form-control:focus {
            box-shadow: none;
        }

    .footer-newsletter .btn-join {
        background-color: #222222;
        color: #fff;
        border-radius: 0;
        padding: 10px 25px;
        font-weight: 600;
        text-transform: uppercase;
    }

        .footer-newsletter .btn-join:hover {
            background-color: #000;
            color: #fff;
        }

.footer-main {
    background-color: #f8f9fa;
    color: #6c757d;
    font-size: 0.9rem;
}

    .footer-main h5 {
        color: #222222;
        font-size: 1rem;
        font-weight: 700;
        text-transform: uppercase;
        margin-bottom: 1.2rem;
        letter-spacing: 0.5px;
    }

    .footer-main ul li a {
        color: #6c757d;
        text-decoration: none;
        display: inline-block;
        margin-bottom: 0.5rem;
    }

        .footer-main ul li a:hover {
            color: #e31e24;
        }

.footer-bottom {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    font-size: 0.85rem;
    color: #adb5bd;
}

/* ---------- Back to top ---------- */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1040;
    width: 50px;
    height: 50px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-size: 2.0rem;
    display: none;
    place-items: center;
}

    .back-to-top.show {
        display: grid;
    }

/* ---------- Motion & mobile queries ---------- */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 767.98px) {
    .product-card {
        flex-basis: 70%;
    }

    .hero-panel {
        left: 1rem;
    }

    .back-to-top {
        width: 52px;
        height: 52px;
    }
}

/* Category Header Banner */
.category-banner {
    position: relative;
    background-color: #f1f3f5; /* Light fallback background */
    background-image: url('/images/your-banner-bg.jpg'); /* Replace with your image path */
    background-size: cover;
    background-position: right center; /* Aligns image to the right */
    background-repeat: no-repeat;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

/* Optional gradient overlay on mobile or left side so text stays readable */
@media (max-width: 991.98px) {
    .category-banner {
        background-position: center;
        background-color: rgba(241, 243, 245, 0.95);
    }
}

.main-navbar .navbar-nav .nav-item:first-child .nav-link {
    padding-left: 0 !important;
}

/* 2. Smooth page-load fade-in (eliminates harsh white flash/snap) */
main[role="main"] {
    min-height: 60vh;
    animation: pageFadeIn 0.25s ease-out;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 3. Lock Header & Logo height so async logo rendering never pushes content down */
.main-header {
    min-height: 84px;
    display: flex;
    align-items: center;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
}

    .brand-logo img {
        max-height: 48px;
        width: auto;
        object-fit: contain;
    }

/* 4. Lock Hero Carousel height BEFORE images finish downloading */
#heroCarousel .carousel-item {
    height: 460px; /* Adjust to match your desired desktop banner height */
    background-color: #f3f4f6; /* Clean placeholder while image paints */
}

#heroCarousel .hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 767.98px) {
    #heroCarousel .carousel-item {
        height: 300px;
    }
}

/* 5. Smooth desktop dropdown hover without jitter */
@media (min-width: 992px) {
    .navbar .nav-item.dropdown .dropdown-menu {
        display: block;
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
        margin-top: 0;
        pointer-events: none;
    }

    .navbar .nav-item.dropdown:hover > .dropdown-menu,
    .navbar .nav-item.dropdown:focus-within > .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }
}

.product-card-img-wrapper {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #f8f9fa;
}

    .product-card-img-wrapper img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

.product-card:hover .product-card-img-wrapper img {
    transform: scale(1.04);
}


/* Fix dropdown layout shift and jitter */
.navbar .nav-item.dropdown {
    position: relative;
}

@media (min-width: 992px) {
    .navbar .nav-item.dropdown .dropdown-menu {
        display: block;
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
        margin-top: 0;
        pointer-events: none;
        position: absolute;
        top: 100%;
        left: 0;
    }

    .navbar .nav-item.dropdown:hover > .dropdown-menu,
    .navbar .nav-item.dropdown:focus-within > .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }
}

.hero-panel--right {
    left: auto; /* cancel the default left offset */
    right: clamp(1rem, 11vw, 12rem); /* mirror of the left offset */
}

.hero-panel--plain {
    background: transparent;
    padding: 0; /* the padding only made sense with a box */
    width: min(620px, calc(100% - 2rem));
    text-shadow: 0 2px 12px rgba(0, 0, 0, .55);
    z-index: 2;
    left: auto; /* cancel the default left offset */
    right: clamp(1rem, 11vw, 12rem); /* mirror of the left offset */
}