@import 'modules/sleepBetter/sleepBetter.css';
@import 'modules/ourProducts/ourProducts.css';
@import 'modules/builtAround/builtAround.css';
@import 'modules/scientifically/scientifically.css';
@import 'modules/blogs/blogs.css';
@import 'modules/aboutUs/aboutUs.css';
@import 'modules/stillWaking/stillWaking.css';

/* ================= Basic reset ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ================= Main View (Web default) ================= */
.main-view {
    position: relative;
    width: 100%;
    min-height: 100vh;

    /* [Modified] Removed first web_firstscreen.png, now managed by sleepBetter module */
    background-image:
        url('images/web_bg_shadow_right.png'),
        url('images/web_bg_shadow_left.png'),
        url('images/web_center_bg.png'),
        url('images/web_bg_shadow_right.png'),
        url('images/web_bottom_bg.png');

    background-repeat: no-repeat;

    /* [Revise] Removed first item 100% auto */
    background-size:
        60% auto,
        60% auto,
        100% auto,
        60% auto,
        100% auto;

    /* [Revise] Removed first item top center */
    background-position:
        right 1100px,
        left 2100px,
        center 3130px,
        right 4500px,
        bottom left;
}

/* ================= Navbar ================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    align-items: center;
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.12);
}

.nav-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    align-items: center;
    flex: 1;
}

.raizz-logo {
    height: 22px;
    width: auto;
    object-fit: contain;
    filter: none;
}

.nav-links {
    display: flex;
    align-items: center;
    /* Per requirement: first button 123px from right edge of axi-logo */
    margin-left: 123px;
    /* Per requirement: 70px spacing between other buttons */
    gap: 70px;
}

.nav-link-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;

    /* Strictly follow the requirements: White, Avenir, weight 400 (Roman), size 16px */
    color: #FFFFFF;
    font-family: 'Avenir', -apple-system, sans-serif;
    font-weight: 400;
    /* Roman */
    font-size: 16px;
    /* First letter of each word capitalized */
    text-transform: capitalize;
    text-decoration: none;

    transition: opacity 0.2s ease;
}

.nav-link-btn:hover {
    opacity: 0.7;
}

/* [Key change] Optimized CTA button */
.nav-cta {
    /* Color styles */
    background: #ffffff;
    color: #000;
    border: 1px solid #ffffff;

    /* Font styles */
    font-family: 'Avenir', -apple-system, sans-serif;
    font-weight: 500;
    font-size: 18px;

    /* Size and layout */
    height: 49px;

    /* [Modified] Vertical padding changed to 12px, horizontal padding to 20px */
    padding: 12px 20px;

    /* center alignment */
    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    text-decoration: none;
}

.nav-cta:hover {
    opacity: 0.8;
}

/* Hamburger — hidden on desktop */
.nav-hamburger {
    display: none;
}

/* Mobile nav drawer — hidden by default */
.nav-drawer {
    display: none;
}


/* ================= Content ================= */
.content-bg-view {
    width: 1200px;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.module-container {
    margin-top: 160px;
    width: 100%;
}

.module-container[data-module="sleepBetter"] {
    margin-top: 0px;
}

.module-container[data-module="ourProducts"] {
    margin-top: 100px;
}

/* ================= back to top button ================= */
.to-top-wrapper {
    position: fixed;
    right: 16px;
    bottom: 40px;
    z-index: 999;

    /* New: hidden by default with smooth fade-in animation */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* New: show button when .show class is present */
.to-top-wrapper.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.to-top-btn {
    width: 50px;
    height: 50px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.to-top-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.to-top-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ================= H5 adaptation ================= */
@media (max-width: 1024px) {

    /* ===== core variables ===== */
    :root {
        --center-scale: 1;
        /* Zoom */
        --center-offset: 1;
        /* Location */
    }

    .navbar {
        height: 54px;
    }

    .nav-content {
        width: 100%;
        margin: 0 auto;
        padding: 0 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .nav-left {
        flex: 1;
    }

    .raizz-logo {
        height: 14px;
    }

    .nav-cta {
        /* H5: override above styles to maintain small size */
        font-size: 14px;
        height: auto;
        /* H5: no fixed 49px height needed */
        padding: 8px 12px;
        /* H5: restore padding */
        white-space: nowrap;
        background: transparent;
        color: #fff;
        border: 1px solid rgba(255, 255, 255, 0.6);
        border-radius: 20px;
        /* Flex centering works fine, or reset display property */
    }

    .nav-links {
        display: none;
    }

    .nav-hamburger {
        display: block;
        background: none;
        border: none;
        color: #FFFFFF;
        font-size: 22px;
        cursor: pointer;
        padding: 0 0 0 12px;
        line-height: 1;
        width: 34px;
        text-align: center;
    }

    /* Mobile nav drawer — full height overlay */
    .nav-drawer {
        display: flex;
        flex-direction: column;
        background-color: rgba(5, 10, 20, 1);
        background-image: url('images/web-dropdown-shadow-h5.png');
        background-size: 100% auto;
        background-position: center top;
        background-repeat: no-repeat;
        background-blend-mode: screen;
        position: fixed;
        top: 54px;
        left: 0;
        right: 0;
        height: calc(100vh - 54px);
        overflow-y: auto;
        z-index: 999;
        transform: translateY(-110%);
        transition: transform 0.3s ease;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-drawer.open {
        transform: translateY(0);
    }

    .nav-drawer .nav-link-btn {
        width: 100%;
        text-align: center;
        padding: 14px 16px;
        font-size: 18px;
        font-family: 'Avenir', -apple-system, sans-serif;
        font-weight: 400;
        color: #FFFFFF;
        background: none;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        cursor: pointer;
        letter-spacing: -0.3px;
    }

    /* CTA button inside drawer */
    .nav-drawer-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        background-color: #FFFFFF;
        color: #000000;
        font-family: 'Avenir', sans-serif;
        font-weight: 700;
        font-size: 18px;
        padding: 18px 32px;
        border-radius: 999px;
        text-decoration: none;
        margin: 32px 20px;
    }

    /* ===== H5 background ===== */
    .main-view {
        background-image:
            url('images/web_bg_shadow_top_h5.png'),
            url('images/web_bg_shadow_right_h5.png'),
            url('images/web_bg_shadow_left_h5.png'),
            url('images/web_center_bg_h5.png'),
            url('images/web_bottom_bg_h5.png');

        background-repeat: no-repeat;

        /* Image 5: scale independently */
        background-size:
            100% auto,
            100% auto,
            100% auto,
            calc(100% * var(--center-scale)) auto,
            100% auto;

        /* Image 5: offset independently */
        background-position:
            top center,
            center 1200px,
            center 2700px,
            center calc(3680px * var(--center-offset)),
            bottom center;
    }

    .module-container {
        margin-top: 80px;
    }

    .module-container[data-module="sleepBetter"] {
        margin-top: 55px;
    }

    .module-container[data-module="ourProducts"] {
        margin-top: 60px;
    }

    /* Corresponding track class in your CSS file */
    .mobile-carousel-track {
        /* Keep original */
        overflow-x: auto;
        display: flex;
        /* New */
        scroll-snap-type: x mandatory;
        /* or proximity */
        -webkit-overflow-scrolling: touch;
        /* iOS smooth scrolling */
    }

    /* Each card item inside */
    .card-item-class-name {
        scroll-snap-align: center;
        /* or start */
    }

    .to-top-btn {
        width: 44px;
        height: 44px;
    }

}

/* ================= center image individually adapts to devices ================= */

/* iPhone SE */
@media (max-width: 1024px) and (max-height: 700px) {
    :root {
        --center-scale: 1.02;
        --center-offset: 1.02;
    }
}

/* iPhone XR */
@media (max-width: 1024px) and (min-height: 701px) and (max-height: 820px) {
    :root {
        --center-scale: 1.0;
        --center-offset: 1.0;
        /* 🔹 After adjustment, XR display renders normally */
    }
}

/* iPhone 12 Pro */
@media (max-width: 1024px) and (min-height: 821px) and (max-height: 900px) {
    :root {
        --center-scale: 1.0;
        --center-offset: 1.02;
    }
}

/* iPhone 17 / 17 Pro / 17 Pro Max */
@media (max-width: 1024px) and (min-height: 980px) {
    :root {
        --center-scale: 1.05;
        --center-offset: 1.1;
    }
}

@media (min-width: 1025px) {
    .to-top-wrapper {
        right: 110px;
        bottom: 100px;
    }
    .to-top-btn {
        width: 50px;
        height: 50px;
    }
}