/* =========================================================
   BR HOME SOLUTIONS
   Global responsive improvements
   Desktop, tablet and mobile
   ========================================================= */

/* ---------- Global safeguards ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    max-width: 100%;
    overflow-x: clip;
    scroll-padding-top: 100px;
}

body {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
}

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

input,
select,
textarea,
button {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

.container,
.site-header-container {
    min-width: 0;
}

.container > *,
.section-heading > *,
.site-header-container > * {
    min-width: 0;
}

/* Prevent long text from breaking layouts. */

h1,
h2,
h3,
h4,
p,
a,
button,
label,
.product-name,
.cart-product-details,
.order-confirmation-number strong {
    overflow-wrap: anywhere;
}

/* ---------- Images and media ---------- */

img {
    height: auto;
}

video {
    display: block;
    height: auto;
}

picture {
    display: block;
    max-width: 100%;
}

/* ---------- Interactive elements ---------- */

a,
button,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button,
.button,
input[type="submit"],
input[type="button"] {
    touch-action: manipulation;
}

:focus-visible {
    outline: 3px solid rgba(181, 139, 72, 0.75);
    outline-offset: 3px;
}

/* ---------- Header and navigation ---------- */

.site-header {
    width: 100%;
}

.site-header-container {
    width: min(calc(100% - 48px), var(--container-width));
    margin-inline: auto;
}

.brand-link {
    min-width: 0;
}

.brand-logo {
    max-width: 100%;
}

.primary-navigation {
    min-width: 0;
}

.nav-link-custom {
    white-space: normal;
}

.header-quote-button {
    flex-shrink: 0;
}

/* ---------- Buttons ---------- */

.button {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.button svg {
    flex: 0 0 auto;
}

/* ---------- Forms ---------- */

form {
    min-width: 0;
    max-width: 100%;
}

input,
select,
textarea {
    min-width: 0;
}

textarea {
    resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
}

/* ---------- Grid and flex safeguards ---------- */

.category-grid,
.product-grid,
.project-grid,
.benefit-grid,
.catalogue-product-grid,
.checkout-form-grid {
    min-width: 0;
}

.category-grid > *,
.product-grid > *,
.project-grid > *,
.benefit-grid > *,
.catalogue-product-grid > * {
    min-width: 0;
}

/* ---------- Tables ---------- */

table {
    max-width: 100%;
}

.table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---------- Tablet ---------- */

@media (max-width: 1050px) {
    html {
        scroll-padding-top: 85px;
    }

    .site-header-container {
        width: min(calc(100% - 36px), var(--container-width));
    }

    .section-heading {
        gap: 24px;
    }

    .section-heading h2 {
        min-width: 0;
    }

    .section-heading > p {
        min-width: 0;
    }

    .hero-content,
    .hero-slide-content {
        max-width: 100%;
    }

    .promotion-copy {
        min-width: 0;
    }
}

/* ---------- Mobile ---------- */

@media (max-width: 760px) {
    html {
        scroll-padding-top: 78px;
    }

    .container {
        width: calc(100% - 36px);
    }

    .site-header-container {
        width: calc(100% - 28px);
        min-height: 68px;
        gap: 12px;
    }

    .brand-link {
        flex: 0 1 auto;
    }

    .brand-logo {
        width: 115px;
        height: 48px;
        object-fit: contain;
    }

    .mobile-menu-toggle {
        flex: 0 0 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .primary-navigation {
        max-width: 100%;
        max-height: calc(100dvh - 74px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .nav-link-custom {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .header-quote-button {
        min-height: 44px;
    }

    .section {
        padding-block: 64px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
        margin-bottom: 28px;
    }

    .section-heading h2 {
        max-width: 100%;
        font-size: clamp(27px, 6vw, 36px);
    }

    .section-heading > p {
        max-width: 100%;
        font-size: 14px;
    }

    .button {
        min-height: 44px;
        padding: 12px 16px;
    }

    .footer-bottom {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        padding-block: 20px;
        gap: 10px;
    }
}

/* ---------- Small mobile ---------- */

@media (max-width: 380px) {
    .container {
        width: calc(100% - 28px);
    }

    .site-header-container {
        width: calc(100% - 20px);
        min-height: 64px;
        gap: 8px;
    }

    .brand-logo {
        width: 100px;
        height: 44px;
    }

    .section {
        padding-block: 48px;
    }

    .section-heading h2 {
        font-size: clamp(25px, 7vw, 30px);
    }

    .button {
        padding-inline: 12px;
        gap: 8px;
    }
}

/* ---------- Reduced motion accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Fix mobile navigation open/closed state */
@media (max-width: 760px) {
    .site-header .primary-navigation {
        display: none;
    }

    .site-header .primary-navigation.is-open {
        display: flex;
    }
}

/* Homepage-specific mobile composition */
@media (max-width: 760px) {
    .site-header-container { min-height: 68px; }
    .site-header .brand-logo { width: clamp(100px, 30vw, 122px); height: 44px; }

    .hero-section,
    .hero-slider,
    .hero-slides,
    .hero-slide,
    .hero-fallback {
        height: calc(100svh - 68px);
        min-height: 500px;
    }
    .hero-media { object-position: 67% center; }
    .hero-overlay {
        background: linear-gradient(90deg, rgb(22 24 20 / 86%) 0%, rgb(22 24 20 / 65%) 68%, rgb(22 24 20 / 35%) 100%);
    }
    .hero-content-container { width: calc(100% - 36px); }
    .hero-slide .hero-content,
    .hero-content {
        max-width: 540px;
        padding: 52px 0 82px;
    }
    .hero-content h1,
    .hero-fallback-content h1 {
        max-width: 12ch;
        margin-bottom: 15px;
        font-size: clamp(32px, 8.2vw, 46px);
        line-height: 1.08;
        text-wrap: balance;
    }
    .hero-description { max-width: 38ch; margin-bottom: 19px; font-size: 14px; line-height: 1.6; }
    .hero-button { min-width: 0; }
    .hero-controls { bottom: 14px; gap: 10px; }
    .hero-control { width: 42px; height: 42px; }

    .section { padding-block: 50px; }
    .product-grid,
    .solution-grid { grid-template-columns: minmax(0, 1fr); }

    .promotion-section { padding: 8px 0 48px; }
    .promotion-card { min-height: 0; }
    .promotion-copy { padding: 26px 22px 23px; }
    .promotion-copy h2 { margin-bottom: 11px; font-size: clamp(25px, 7vw, 32px); }
    .promotion-copy p { margin-bottom: 16px; font-size: 13px; line-height: 1.65; }
    .promotion-decoration { min-height: 126px; }
    .promotion-decoration-inner span:first-child { font-size: 52px; }
    .promotion-decoration::before { width: 110px; height: 110px; }
    .promotion-decoration::after { width: 150px; height: 150px; }
}

@media (max-width: 380px) {
    .hero-section,
    .hero-slider,
    .hero-slides,
    .hero-slide,
    .hero-fallback { height: calc(100svh - 64px); }
    .hero-content-container { width: calc(100% - 28px); }
    .hero-content h1,
    .hero-fallback-content h1 { font-size: clamp(30px, 8vw, 36px); }
    .hero-description { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-slide.is-active .hero-media,
    .hero-slide.is-active .hero-content h1,
    .hero-slide.is-active .hero-description,
    .hero-slide.is-active .hero-button { animation: none !important; }
}

/* Footer logo — white background for brand visibility */

.site-footer .footer-brand img,
.site-footer .footer-logo,
.site-footer .brand-logo {
    display: block;
    width: 190px;
    max-width: 100%;
    height: auto;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    object-fit: contain;
}

/* Mobile footer logo */
@media (max-width: 760px) {
    .site-footer .footer-brand img,
    .site-footer .footer-logo,
    .site-footer .brand-logo {
        width: 175px;
        padding: 10px 14px;
        border-radius: 9px;
    }
}

.contact-cta {
    background-color: var(--color-deep);
    background-image:
        linear-gradient(
            90deg,
            rgba(20, 21, 18, 0.65),
            rgba(20, 21, 18, 0.78)
        ),
        url("/images/backgrounds/contact-cta-background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* =========================================================
   PRODUCTS PAGE — PREMIUM HERO RESPONSIVENESS
   ========================================================= */

/* Desktop */
.catalogue-hero {
    position: relative;
    min-height: 430px;
    background-color: var(--color-deep);
}

.catalogue-hero-image {
    object-position: center 55%;
}

.catalogue-hero-overlay {
    background:
        linear-gradient(
            90deg,
            rgba(11, 37, 64, 0.94) 0%,
            rgba(11, 37, 64, 0.78) 42%,
            rgba(11, 37, 64, 0.30) 100%
        ),
        linear-gradient(
            0deg,
            rgba(11, 37, 64, 0.25),
            transparent 50%
        );
}

.catalogue-hero-content {
    position: relative;
    z-index: 1;
    padding-top: 38px;
    padding-bottom: 54px;
}

.catalogue-breadcrumbs {
    margin-bottom: 30px;
    font-size: 12px;
}

.catalogue-hero h1 {
    max-width: 720px;
    font-size: clamp(38px, 4.5vw, 58px);
    line-height: 1.1;
    text-wrap: balance;
}

.catalogue-hero-content > p {
    max-width: 540px;
    font-size: 15px;
    line-height: 1.8;
}

.catalogue-hero-actions {
    gap: 14px;
}

.catalogue-hero-actions .button {
    min-height: 48px;
}

/* Tablet */
@media (max-width: 900px) {
    .catalogue-hero {
        min-height: 390px;
    }

    .catalogue-hero-image {
        object-position: 60% center;
    }

    .catalogue-hero-overlay {
        background: linear-gradient(
            90deg,
            rgba(11, 37, 64, 0.94) 0%,
            rgba(11, 37, 64, 0.78) 58%,
            rgba(11, 37, 64, 0.52) 100%
        );
    }

    .catalogue-hero-content {
        padding-top: 32px;
        padding-bottom: 42px;
    }

    .catalogue-hero h1 {
        max-width: 600px;
        font-size: clamp(34px, 5.5vw, 46px);
    }
}

/* Mobile */
@media (max-width: 700px) {
    .catalogue-hero {
        min-height: 0;
        align-items: stretch;
    }

    .catalogue-hero-image {
        object-position: 62% center;
    }

    .catalogue-hero-overlay {
        background: linear-gradient(
            90deg,
            rgba(11, 37, 64, 0.91) 0%,
            rgba(11, 37, 64, 0.79) 100%
        );
    }

    .catalogue-hero-content {
        width: calc(100% - 36px);
        padding-top: 26px;
        padding-bottom: 34px;
    }

    .catalogue-breadcrumbs {
        gap: 7px;
        margin-bottom: 24px;
        font-size: 11px;
        line-height: 1.6;
    }

    .catalogue-hero-eyebrow {
        margin-bottom: 10px;
        font-size: 9px;
        letter-spacing: 0.16em;
    }

    .catalogue-hero h1 {
        max-width: 100%;
        margin: 8px 0 14px;
        font-size: clamp(30px, 8vw, 40px);
        line-height: 1.12;
        letter-spacing: -0.04em;
        text-wrap: balance;
    }

    .catalogue-hero-content > p {
        max-width: 100%;
        margin: 0 0 22px;
        font-size: 13px;
        line-height: 1.75;
    }

    .catalogue-hero-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .catalogue-hero-actions .button {
        width: 100%;
        min-height: 46px;
        justify-content: center;
        padding: 12px 14px;
        font-size: 12px;
    }
}

/* Narrow phones */
@media (max-width: 380px) {
    .catalogue-hero-content {
        width: calc(100% - 28px);
        padding-top: 22px;
        padding-bottom: 28px;
    }

    .catalogue-breadcrumbs {
        margin-bottom: 20px;
        font-size: 10px;
    }

    .catalogue-hero h1 {
        font-size: 29px;
    }

    .catalogue-hero-content > p {
        font-size: 12px;
    }
}

/* PRODUCTS PAGE — CTA BACKGROUND IMAGE */
.catalogue-help-panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background-color: var(--color-deep);
    background-image:
        linear-gradient(
            90deg,
            rgba(25, 26, 22, 0.88) 0%,
            rgba(25, 26, 22, 0.72) 55%,
            rgba(25, 26, 22, 0.48) 100%
        ),
        url("/images/home/solution-cta.png");
    background-size: cover;
    background-position: center 55%;
    background-repeat: no-repeat;
}

/* Keep CTA content above the background */
.catalogue-help-panel > * {
    position: relative;
    z-index: 1;
}

/* Mobile background positioning and readability */
@media (max-width: 700px) {
    .catalogue-help-panel {
        background-position: 60% center;
        background-image:
            linear-gradient(
                90deg,
                rgba(25, 26, 22, 0.86) 0%,
                rgba(25, 26, 22, 0.72) 100%
            ),
            url("/images/home/solution-cta.png");
    }
}

/* PRODUCTS PAGE — CONTACT CTA BACKGROUND */
.catalogue-contact {
    background-color: var(--color-deep);
    background-image:
        linear-gradient(
            90deg,
            rgba(25, 26, 22, 0.88) 0%,
            rgba(25, 26, 22, 0.72) 55%,
            rgba(25, 26, 22, 0.48) 100%
        ),
        url("/images/home/solution-cta.png");
    background-size: cover;
    background-position: center 55%;
    background-repeat: no-repeat;
}

@media (max-width: 700px) {
    .catalogue-contact {
        background-image:
            linear-gradient(
                90deg,
                rgba(25, 26, 22, 0.86),
                rgba(25, 26, 22, 0.72)
            ),
            url("/images/home/solution-cta.png");
        background-position: 60% center;
    }
}

/* =========================================
   CONSISTENT DIRECTIONAL SCROLL ANIMATIONS
   Home, About Us and Products
   ========================================= */

/* Default: content visible if JavaScript is unavailable */
.reveal-on-scroll,
.reveal-left,
.reveal-right,
.reveal-up,
.catalogue-product-card {
    opacity: 1;
    transform: none;
}

/* Initial animation states */
.reveal-ready .reveal-on-scroll {
    opacity: 0;
    transform: translateY(24px);
}

.reveal-ready .reveal-left {
    opacity: 0;
    transform: translateX(-45px);
}

.reveal-ready .reveal-right {
    opacity: 0;
    transform: translateX(45px);
}

.reveal-ready .reveal-up {
    opacity: 0;
    transform: translateY(30px);
}

/* Product cards slide upward */
.reveal-ready .catalogue-product-card {
    opacity: 0;
    transform: translateY(24px);
}

/* Smooth transitions */
.reveal-ready .reveal-on-scroll,
.reveal-ready .reveal-left,
.reveal-ready .reveal-right,
.reveal-ready .reveal-up,
.reveal-ready .catalogue-product-card {
    transition:
        opacity 650ms ease,
        transform 650ms cubic-bezier(0.2, 0.65, 0.3, 1);
    will-change: opacity, transform;
}

/* Final visible states */
.reveal-ready .reveal-on-scroll.is-visible,
.reveal-ready .reveal-left.is-visible,
.reveal-ready .reveal-right.is-visible,
.reveal-ready .reveal-up.is-visible,
.reveal-ready .catalogue-product-card.is-visible {
    opacity: 1;
    transform: translate(0, 0);
}

/* Mobile: shorter movement */
@media (max-width: 760px) {
    .reveal-ready .reveal-left {
        transform: translateX(-20px);
    }

    .reveal-ready .reveal-right {
        transform: translateX(20px);
    }

    .reveal-ready .reveal-up,
    .reveal-ready .reveal-on-scroll,
    .reveal-ready .catalogue-product-card {
        transform: translateY(14px);
    }

    .reveal-ready .reveal-on-scroll.is-visible,
    .reveal-ready .reveal-left.is-visible,
    .reveal-ready .reveal-right.is-visible,
    .reveal-ready .reveal-up.is-visible,
    .reveal-ready .catalogue-product-card.is-visible {
        transform: translate(0, 0);
    }
}

/* Accessibility: respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .reveal-ready .reveal-on-scroll,
    .reveal-ready .reveal-left,
    .reveal-ready .reveal-right,
    .reveal-ready .reveal-up,
    .reveal-ready .catalogue-product-card {
        opacity: 1;
        transform: none;
        transition: none;
        will-change: auto;
    }
}

/* =========================================
   Home and Products directional animations
   ========================================= */

/* Initial states */
.reveal-ready .reveal-on-scroll.reveal-from-left {
    opacity: 0;
    transform: translateX(-40px);
}

.reveal-ready .reveal-on-scroll.reveal-from-right {
    opacity: 0;
    transform: translateX(40px);
}

/* Products cards */
.reveal-ready .catalogue-product-card.reveal-from-left {
    opacity: 0;
    transform: translateX(-35px);
}

.reveal-ready .catalogue-product-card.reveal-from-right {
    opacity: 0;
    transform: translateX(35px);
}

/* Smooth animation */
.reveal-ready .reveal-on-scroll,
.reveal-ready .catalogue-product-card {
    transition:
        opacity 650ms ease,
        transform 650ms cubic-bezier(0.2, 0.65, 0.3, 1);
}

/* Final state */
.reveal-ready .reveal-on-scroll.is-visible,
.reveal-ready .catalogue-product-card.is-visible {
    opacity: 1;
    transform: translate(0, 0);
}

/* Mobile: reduce the movement distance */
@media (max-width: 760px) {
    .reveal-ready .reveal-on-scroll.reveal-from-left,
    .reveal-ready .catalogue-product-card.reveal-from-left {
        transform: translateX(-18px);
    }

    .reveal-ready .reveal-on-scroll.reveal-from-right,
    .reveal-ready .catalogue-product-card.reveal-from-right {
        transform: translateX(18px);
    }

    .reveal-ready .reveal-on-scroll.is-visible,
    .reveal-ready .catalogue-product-card.is-visible {
        transform: translate(0, 0);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .reveal-ready .reveal-on-scroll,
    .reveal-ready .catalogue-product-card {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Active navigation indicator */
.site-header #primary-navigation a.is-active {
    color: var(--color-gold);
}

.site-header #primary-navigation a.is-active::after {
    width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .site-header #primary-navigation a::after {
        transition: none;
    }
}

/* =========================================
   Active Header Navigation Highlight
   ========================================= */

.site-header .primary-navigation a.is-active,
.site-header #primary-navigation a.is-active {
    color: var(--color-gold) !important;
    font-weight: 700;
    position: relative;
}

.site-header .primary-navigation a.is-active::after,
.site-header #primary-navigation a.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -8px;
    width: 100%;
    height: 2px;
    background-color: var(--color-gold);
    opacity: 1;
    transform: scaleX(1);
}

/* Keep inactive links unchanged */
.site-header .primary-navigation a:not(.is-active)::after,
.site-header #primary-navigation a:not(.is-active)::after {
    background-color: transparent;
}

/* Accessible keyboard navigation */
.site-header .primary-navigation a:focus-visible,
.site-header #primary-navigation a:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 5px;
}


/* ==========================================
   Persistent active page navigation highlight
   ========================================== */

.site-header .primary-navigation a.active,
.site-header .primary-navigation a.is-active,
.site-header .primary-navigation a[aria-current="page"],
.site-header #primary-navigation a.active,
.site-header #primary-navigation a.is-active,
.site-header #primary-navigation a[aria-current="page"] {
    color: var(--color-gold) !important;
    font-weight: 700 !important;
}

/* Persistent gold underline */
.site-header .primary-navigation a.active::after,
.site-header .primary-navigation a.is-active::after,
.site-header .primary-navigation a[aria-current="page"]::after,
.site-header #primary-navigation a.active::after,
.site-header #primary-navigation a.is-active::after,
.site-header #primary-navigation a[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 100%;
    height: 2px;
    background-color: var(--color-gold);
    opacity: 1;
    transform: scaleX(1);
}

/* ==========================================
   Products page - Need Help card readability
   ========================================== */

.catalogue-help-panel {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    color: #ffffff;

    background-color: var(--color-deep);
    background-image:
        linear-gradient(
            135deg,
            rgba(11, 37, 64, 0.92),
            rgba(11, 37, 64, 0.72)
        ),
        url("/images/backgrounds/contact-cta-background.png");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.catalogue-help-panel .eyebrow {
    color: var(--color-gold);
}

.catalogue-help-panel h2 {
    color: #ffffff;
    font-size: 20px;
    line-height: 1.4;
}

.catalogue-help-panel p {
    color: var(--color-surface-soft);
    font-size: 13px;
    line-height: 1.8;
}

.catalogue-help-panel .catalogue-help-button {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    color: var(--color-deep);
    background: var(--color-gold);
    border: 1px solid var(--color-gold);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

.catalogue-help-panel .catalogue-help-button:hover {
    color: var(--color-deep);
    background: var(--color-gold);
    border-color: var(--color-gold);
}

/* ==========================================
   Products page - Search form layout
   ========================================== */

.catalogue-search {
    display: flex;
    width: 100%;
    align-items: stretch;
    gap: 10px;
}

.catalogue-search input[type="search"] {
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    box-sizing: border-box;
}

.catalogue-search button[type="submit"] {
    display: inline-flex;
    flex: 0 0 82px;
    width: 82px;
    min-width: 82px;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    line-height: 1.2;
}

/* Small screens */
@media (max-width: 480px) {
    .catalogue-search {
        gap: 8px;
    }

    .catalogue-search button[type="submit"] {
        flex-basis: 76px;
        width: 76px;
        min-width: 76px;
        padding-right: 8px;
        padding-left: 8px;
    }
}
