
/* ============================================================
   SCVA — HEADER + MODERN SMART LOGO
   MOBILE RESPONSIVE + RIGHT SIDE DRAWER (JS-CONTROLLED)
   SINGLE SOURCE OF TRUTH FOR HEADER STYLES

   Z-INDEX MAP:
     backdrop       → 99990
     header shell   → 99999
     drawer .links  → 100001
     logo / pwrap   → 100002
     hamburger      → 100003
============================================================ */


/* ============================================================
   HEADER SHELL — STICKY
============================================================ */

header {
    position: -webkit-sticky;
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 99999;
    isolation: isolate;
    overflow: visible;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    width: 100%;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    height: var(--header-h, 80px);
    position: relative;
    overflow: visible;
    box-sizing: border-box;
}


/* ============================================================
   LOGO
============================================================ */

.logo {
    display: flex;
    align-items: center;
    gap: 11px;
    font-family: Fraunces, Georgia, serif;
    font-weight: 700;
    letter-spacing: -.5px;
    color: var(--brand);
    flex-shrink: 0;
    text-decoration: none;
}

.logo-mark {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--brand2), var(--brand));
    display: grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow:
        0 4px 12px rgba(35, 42, 124, .28),
        inset 0 1px 0 rgba(255, 255, 255, .18);
    transition: transform .25s ease, box-shadow .25s ease;
}

.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
    background: #1b1500;
}

.logo-mark::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: inherit;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(255, 255, 255, .30) 50%,
        transparent 70%
    );
    background-size: 250% 100%;
    background-position: 100% 0;
    transition: background-position .6s ease;
    pointer-events: none;
    z-index: 2;
}

.logo:hover .logo-mark {
    transform: translateY(-1px) scale(1.04);
    box-shadow:
        0 7px 18px rgba(35, 42, 124, .34),
        inset 0 1px 0 rgba(255, 255, 255, .22);
}

.logo:hover .logo-mark::after {
    background-position: 0 0;
}


/* ============================================================
   WORDMARK
============================================================ */

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.02;
    min-width: 0;
}

.logo-text .name {
    font-family: Fraunces, Georgia, serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: -.4px;
}

.logo-text .tagline {
    font-family: "Hind Siliguri", system-ui, sans-serif;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 3px;
    opacity: .85;
    white-space: nowrap;
}


/* ============================================================
   NAVIGATION LINKS
============================================================ */

.links {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-left: auto;
    font-weight: 500;
    font-size: 17px;
}

.links a:hover {
    color: var(--brand2);
}

.links .call-mobile {
    display: none;
}


/* ============================================================
   CALL LINK
============================================================ */

.call {
    color: inherit;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.call:hover {
    color: #2563eb;
}


/* ============================================================
   JOIN BUTTON
============================================================ */

.btn.join {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 20px;
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #1b1500;
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.btn.join:hover {
    filter: brightness(.95);
}


/* ============================================================
   HAMBURGER BUTTON
============================================================ */

.nav-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--brand);
    transition: transform .25s ease, opacity .2s ease;
}

.nav-toggle:hover {
    background: var(--bg);
}


/* ============================================================
   PROFILE DROPDOWN
============================================================ */

.pwrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 100000;
}

.pwrap[open] {
    z-index: 100001;
}

.profile-trigger {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 3px;
    border-radius: 50%;
    outline: none;
}

.profile-trigger:hover {
    background: var(--bg);
}

.avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b7a99, #c9d1e3);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    border: 0;
    overflow: hidden;
}


/* ============================================================
   PROFILE DROPDOWN BOX
============================================================ */

.pdrop {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 300px;
    max-width: calc(100vw - 24px);
    display: none;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .20);
    z-index: 100002;
}

.pwrap[open] > .pdrop {
    display: block;
}

.pdrop::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 17px;
    width: 12px;
    height: 12px;
    background: var(--surface);
    border-left: 1px solid var(--line);
    border-top: 1px solid var(--line);
    transform: rotate(45deg);
}


/* ============================================================
   PROFILE INFORMATION
============================================================ */

.pu {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 22px 18px 16px;
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.pu .profile-large {
    width: 68px;
    height: 68px;
    min-width: 68px;
    font-size: 25px;
    margin-bottom: 10px;
    border: 3px solid var(--surface);
    box-shadow: 0 0 0 2px var(--line);
}

.pu b {
    display: block;
    max-width: 100%;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.4;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.pu span {
    display: block;
    max-width: 100%;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.pu .profile-id {
    color: var(--brand2);
    font-weight: 700;
}

.pu .st {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 10px;
    padding: 4px 11px;
    border-radius: 20px;
    background: rgba(37, 176, 3, .09);
    color: #25b003;
    font-size: 11px;
    font-weight: 800;
}

.pu .st::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #25b003;
}


/* ============================================================
   PROFILE MENU
============================================================ */

.pm {
    list-style: none;
    margin: 0;
    padding: 7px;
    border-bottom: 1px solid var(--line);
}

.pm li {
    margin: 0;
    padding: 0;
}

.pm a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    transition: background .15s ease, color .15s ease;
}

.pm a i.bi {
    width: 19px;
    height: 19px;
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.pm a:hover {
    background: var(--bg);
    color: var(--brand);
}

.pm a:hover i.bi {
    color: var(--brand);
}


/* ============================================================
   PROFILE FOOTER
============================================================ */

.pf {
    padding: 12px 14px 14px;
}

.pf form {
    margin: 0;
}

.so {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: transparent;
    font-weight: 800;
    font-size: 13px;
    color: #ec1f00;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: background .15s ease, border-color .15s ease;
}

.so i.bi {
    font-size: 16px;
}

.so:hover {
    background: rgba(236, 31, 0, .07);
    border-color: rgba(236, 31, 0, .3);
}

.pl {
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
    color: var(--muted);
}


/* ============================================================
   MOBILE DRAWER + BACKDROP
============================================================ */

.nav-backdrop {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99990;
    background: rgba(0, 0, 0, .42);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .3s ease, visibility .3s;
}


/* ============================================================
   MOBILE / TABLET — RIGHT SIDE DRAWER
============================================================ */

@media (max-width: 860px) {

    header {
        position: -webkit-sticky;
        position: sticky;
        top: env(safe-area-inset-top, 0px);
        z-index: 99999;
    }

    .nav {
        justify-content: space-between;
        gap: 10px;
    }

    .logo {
        margin-right: auto;
    }

    .call {
        display: none;
    }

    /* Hamburger */
    .nav-toggle {
        display: inline-flex !important;
        position: relative;
        z-index: 100003 !important;
        pointer-events: auto !important;
        touch-action: manipulation;
        isolation: isolate;
    }

    .nav-toggle span {
        pointer-events: none;
    }

    /* Backdrop */
    .nav-backdrop {
        display: block;
    }

    body.nav-open .nav-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }


    /* ========================================================
       RIGHT SIDE DRAWER
    ======================================================== */

    .links {
        display: flex !important;
        position: fixed !important;

        top: calc(
            var(--header-h, 80px) +
            env(safe-area-inset-top, 0px) +
            8px
        ) !important;

        right: 0 !important;
        left: auto !important;

        width: min(320px, 85vw) !important;

        height: calc(
            100vh -
            var(--header-h, 80px) -
            env(safe-area-inset-top, 0px) -
            8px
        ) !important;

        max-height: calc(
            100vh -
            var(--header-h, 80px) -
            env(safe-area-inset-top, 0px) -
            8px
        ) !important;

        flex-direction: column;
        align-items: stretch;
        gap: 0;

        margin: 0 !important;
        padding: 20px 20px 25px;

        background: var(--surface);

        border: 1px solid var(--line);
        border-right: 0;
        border-radius: 14px 0 0 14px;

        box-shadow: -12px 0 35px rgba(0, 0, 0, .15);

        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;

        z-index: 100001;

        transform: translate3d(105%, 0, 0) !important;

        visibility: hidden;
        pointer-events: none;

        transition:
            transform .35s cubic-bezier(.22, 1, .36, 1),
            visibility .35s;
    }


    /* OPEN DRAWER */

    body.nav-open header .links {
        transform: translate3d(0, 0, 0) !important;
        visibility: visible;
        pointer-events: auto;
        touch-action: pan-y;
    }


    /* Navigation links */

    .links a {
        display: block;
        width: 100%;
        padding: 15px 8px;
        border-bottom: 1px solid var(--line);
        font-size: 16px;
        box-sizing: border-box;
        position: relative;
        z-index: 1;
    }

    .links a:last-child {
        border-bottom: 0;
    }


    /* Mobile Contact */

    .links .call-mobile {
        display: block;
        font-weight: 700;
        color: var(--brand);
    }


    /* Logo */

    .logo-text .tagline {
        display: none;
    }

    .logo-text .name {
        font-size: 20px;
    }


    /* Header controls */

    body.nav-open header .nav-toggle,
    body.nav-open header .logo,
    body.nav-open header .pwrap {
        position: relative;
        z-index: 100002;
    }


    /* Hamburger animation */

    body.nav-open header .nav-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    body.nav-open header .nav-toggle span:nth-child(2) {
        opacity: 0;
    }

    body.nav-open header .nav-toggle span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }


    /*
       IMPORTANT:
       Do not apply overflow:hidden to body here.
       It can interfere with sticky positioning on mobile.
    */

    body.nav-open {
        overflow-x: clip;
    }

    body.nav-open .nav-backdrop {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        pointer-events: auto;
        touch-action: none;
    }
}


/* ============================================================
   PHONE
============================================================ */

@media (max-width: 480px) {

    .logo {
        gap: 9px;
    }

    .logo-mark {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .logo-text .name {
        font-size: 18px;
    }

    .avatar {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .pdrop {
        position: fixed;
        top: calc(var(--header-h, 64px) + env(safe-area-inset-top, 0px));
        right: 10px;
        width: 290px;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - var(--header-h, 64px) - 20px);
        overflow-y: auto;
    }

    .pdrop::before {
        right: 18px;
    }
}


/* ============================================================
   SMALL PHONE
============================================================ */

@media (max-width: 380px) {

    .nav {
        justify-content: space-between;
        gap: 8px;
    }

    .logo {
        margin-right: auto;
    }

    .logo-text .name {
        font-size: 16px;
    }

    .nav-toggle {
        width: 40px;
        height: 40px;
    }
}


/* ============================================================
   REDUCED MOTION
============================================================ */

@media (prefers-reduced-motion: reduce) {

    .links,
    .nav-toggle span,
    .logo-mark,
    .nav-backdrop {
        transition: none !important;
    }
}


/* ============================================================
   JOIN BUTTON — NO WRAPPING
============================================================ */

.nav > .btn.join,
.btn.join {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    width: auto;
    min-width: max-content;
    white-space: nowrap;
    line-height: 1.2;
}

.btn.join i {
    flex: none;
    display: inline-block;
    line-height: 1;
}


/* ============================================================
   HAMBURGER — TOUCH FIX
============================================================ */

.nav-toggle {
    pointer-events: auto;
    touch-action: manipulation;
}

.nav-toggle span {
    flex: 0 0 2px;
    min-height: 2px;
    pointer-events: none;
}


/* ============================================================
   FALLBACKS FOR OLDER MOBILE BROWSERS
============================================================ */

.nav-backdrop {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.logo-mark::after {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}


/* ============================================================
   MOBILE FINAL FIXES
============================================================ */

@media (max-width: 860px) {

    .nav {
        flex-wrap: nowrap;
    }

    .btn.join {
        padding: 8px 14px;
        min-height: 40px;
        font-size: 14px;
        gap: 6px;
    }

    .links {
        height: calc(
            100vh -
            var(--header-h, 64px) -
            8px
        ) !important;

        max-height: calc(
            100vh -
            var(--header-h, 64px) -
            8px
        ) !important;
    }
}


/* ============================================================
   MODERN VIEWPORT HEIGHT SUPPORT
============================================================ */

@supports (height: 100dvh) {

    @media (max-width: 860px) {

        .links {
            height: calc(
                100dvh -
                var(--header-h, 64px) -
                env(safe-area-inset-top, 0px) -
                8px
            ) !important;

            max-height: calc(
                100dvh -
                var(--header-h, 64px) -
                env(safe-area-inset-top, 0px) -
                8px
            ) !important;
        }
    }
}


/* ============================================================
   VERY SMALL PHONES
============================================================ */

@media (max-width: 360px) {

    .btn.join {
        padding: 7px 11px;
        font-size: 13px;
    }

    .logo-text .name {
        font-size: 15px;
    }
}


/* ============================================================
   STICKY HEADER SAFEGUARD
============================================================ */

@media (max-width: 860px) {

    html {
        scroll-padding-top: var(--header-h, 80px);
    }

    header,
    body.nav-open header {
        position: -webkit-sticky;
        position: sticky;
        top: env(safe-area-inset-top, 0px);
        z-index: 99999;
    }
}


/* ============================================================
   IMPORTANT JAVASCRIPT REQUIREMENT

   CSS only displays the drawer when body has .nav-open.

   The #navToggle button must have a JavaScript click handler
   that adds/removes that class.

   Example:
   document.body.classList.toggle("nav-open");

============================================================ */


/* ============================================================
   END OF SCVA HEADER CSS
============================================================ */
