/* ============================
   Kalaimagal Header Styles
   ============================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&display=swap');

/* --- Reset & Base --- */
.bhf-hidden { display: none !important; }

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

.km-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Top Bar --- */
.km-topbar {
    background: #1a1a2e;
    color: #ccc;
    font-size: 13px;
    line-height: 1;
    padding: 8px 0;
}

.km-topbar .km-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.km-topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.km-topbar-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #ccc;
    text-decoration: none;
    transition: color 0.2s;
}

.km-topbar-item:hover { color: #fff; }

.km-topbar-item svg { flex-shrink: 0; }

.km-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.km-topbar-right a {
    color: #aaa;
    transition: color 0.2s;
    display: inline-flex;
}

.km-topbar-right a:hover { color: #fff; }

/* --- Main Header / Navbar --- */
.km-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    transition: box-shadow 0.3s, background 0.3s;
}

.km-header.km-sticky {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.km-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    gap: 24px;
}

/* --- Logo --- */
.km-logo {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.km-logo img {
    height: 50px;
    width: auto;
    display: block;
}

/* --- Desktop Nav --- */
.km-nav {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}

.km-nav > li { position: relative; }

.km-nav > li > a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 18px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 17px;
    font-weight: 600;
    color: #222;
    text-decoration: none;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.km-nav > li > a:hover,
.km-nav > li > a:focus {
    color: #800020;
    background: rgba(128, 0, 32, 0.05);
}

.km-arrow {
    transition: transform 0.25s;
    margin-top: 1px;
}

/* --- Desktop Dropdown --- */
.km-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    list-style: none;
    margin: 0;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.25s, visibility 0.25s, transform 0.25s;
    z-index: 100;
}

.km-has-dropdown.hover > .km-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.km-has-dropdown.hover > a .km-arrow {
    transform: rotate(180deg);
}

.km-dropdown li a {
    display: block;
    padding: 10px 20px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px;
    font-weight: 500;
    color: #444;
    text-decoration: none;
    transition: color 0.15s, background 0.15s, padding-left 0.15s;
}

.km-dropdown li a:hover {
    color: #800020;
    background: rgba(128, 0, 32, 0.04);
    padding-left: 26px;
}

/* --- Header Actions (CTA + Hamburger) --- */
.km-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.km-cta-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 24px;
    background: #800020;
    color: #fff;
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.km-cta-btn:hover {
    background: #600018;
    transform: translateY(-1px);
}

/* --- Hamburger Button (hidden on desktop) --- */
.km-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: #800020;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 8px rgba(128,0,32,0.2);
    transition: background 0.2s;
}

.km-hamburger:hover { background: #600018; }

.km-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

/* --- Overlay --- */
.km-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.km-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* --- Mobile Slide-out Menu --- */
.km-mobile-menu {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: 1999;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.km-mobile-menu.open {
    right: 0;
}

/* Mobile header (logo + close) */
.km-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.km-mobile-logo img {
    height: 40px;
    width: auto;
}

.km-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 2px solid #800020;
    border-radius: 50%;
    background: transparent;
    color: #800020;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    padding: 0;
}

.km-close:hover,
.km-close:active {
    background: #800020;
    color: #fff;
}

/* Mobile nav list */
.km-mobile-nav {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    flex: 1;
}

.km-mobile-nav > li > a,
.km-mobile-dropdown-trigger > a {
    display: block;
    padding: 14px 24px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    font-weight: 600;
    color: #222;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}

.km-mobile-nav > li > a:hover,
.km-mobile-nav > li > a:active,
.km-mobile-dropdown-trigger > a:hover {
    color: #800020;
    background: rgba(128,0,32,0.04);
}

/* Mobile dropdown trigger row */
.km-mobile-dropdown-trigger {
    display: flex;
    align-items: center;
}

.km-mobile-dropdown-trigger > a {
    flex: 1;
}

.km-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 16px;
    border: 1.5px solid #800020;
    border-radius: 50%;
    background: transparent;
    color: #800020;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.25s;
    flex-shrink: 0;
    padding: 0;
}

.km-mobile-toggle:hover {
    background: rgba(128,0,32,0.06);
}

.km-mobile-has-dropdown.open .km-mobile-toggle {
    background: #800020;
    color: #fff;
    transform: rotate(180deg);
}

/* Mobile submenu */
.km-mobile-dropdown {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #fafafa;
}

.km-mobile-has-dropdown.open .km-mobile-dropdown {
    max-height: 500px;
}

.km-mobile-dropdown li a {
    display: block;
    padding: 11px 24px 11px 44px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    font-weight: 500;
    color: #555;
    text-decoration: none;
    transition: color 0.15s;
}

.km-mobile-dropdown li a:hover {
    color: #800020;
}

/* Mobile footer in menu */
.km-mobile-footer {
    padding: 20px 24px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.km-mobile-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #800020;
    color: #fff;
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    justify-content: center;
    transition: background 0.2s;
}

.km-mobile-cta:hover { background: #600018; }

.km-mobile-email {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: #888;
    text-decoration: none;
    transition: color 0.2s;
}

.km-mobile-email:hover { color: #800020; }

/* --- Scroll to Top Button --- */
.scroll-top {
    width: 50px;
    height: 50px;
    line-height: 50px;
    position: fixed;
    bottom: 105%;
    right: 30px;
    font-size: 16px;
    border-radius: 6px;
    z-index: 99;
    color: #fff;
    text-align: center;
    cursor: pointer;
    background: #800020;
    transition: 0.4s ease;
    border: none;
    opacity: 0;
}

.scroll-top:hover { background: #600018; }
.scroll-top.open { bottom: 30px; opacity: 1; }

/* ===========================
   Responsive
   =========================== */

/* Tablet: show hamburger, hide desktop nav & CTA */
@media (max-width: 1024px) {
    .km-topbar { display: none; }

    .km-header-inner {
        height: 64px;
    }

    .km-nav { display: none; }

    .km-cta-btn { display: none; }

    .km-hamburger { display: flex; }

    .km-logo img { height: 42px; }
}

@media (max-width: 576px) {
    .km-header-inner {
        height: 56px;
        padding: 0 16px;
    }

    .km-logo img { height: 36px; }

    .km-hamburger {
        width: 40px;
        height: 40px;
    }
}