/* Local Font Definitions */
@font-face {
    font-family: 'Red Hat Display';
    src: url('../fonts/RedHatDisplay-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('../fonts/RedHatDisplay-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('../fonts/RedHatDisplay-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('../fonts/RedHatDisplay-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Lavishly Yours';
    src: url('../fonts/LavishlyYours-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Theme variables (needed for header styling) */
:root {
    --primary-color: #7B2429; /* red */
    --secondary-color: #718b5e; /* green */
    --secondary-color-rgb: 113, 139, 94; /* for rgba(var(--secondary-color-rgb), a) */
    --accent-color: #A1BBAC;
    --bg-color: #DDE5DB;
    --surface-color: #7FAE6E1a;
    --border-color: #7FAE6E33;
    --text-color: #7B2429;
    --gold-color: #98a300;
    --green-text-color-rgb: 114, 140, 97;
    --primary-rgb: 123, 36, 41; /* for rgba(var(--primary-rgb), a) */
    --border-radius: 0.6vw; /* consistent border radius */
}

/* Navigation Container */
.nav-container {
    position: fixed;
    margin: 1.4vh;
    z-index: 9999;
    box-sizing: border-box;
    padding: 1.7vh;
    background: rgba(221, 229, 219, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(107, 59, 41, 0.1);
    transition: all 0.3s ease;
    left: 0;
    right: 0;
    font-family: 'Red Hat Display', sans-serif;
    overflow: visible;
}

/* Liquid Glass Effects */
.liquidGlass-wrapper {
    position: relative;
    display: flex;
    overflow: visible;
    font-weight: 600;
}

.liquidGlass-effect {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    filter: none;
}

.liquidGlass-tint {
    position: absolute;
    inset: 0;
    background: #aebbaa;
}

.liquidGlass-shine {
    position: absolute;
    inset: 0;
    box-shadow: inset 2px 2px 2px rgba(255, 255, 255, 0.4),
                inset -1px -1px 1px rgba(0, 0, 0, 0.12),
                0 3px 10px rgba(0, 0, 0, 0.08);
}

.liquidGlass-text {
    position: relative;
    z-index: 5;
    display: flex;
    width: 100%;
}

.nav-container.liquidGlass-wrapper {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    border-radius: var(--border-radius);
}

/* Override liquid glass for nav-container specifically */
.nav-container.liquidGlass-wrapper .liquidGlass-effect {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--border-radius);
}

.nav-container.liquidGlass-wrapper .liquidGlass-tint {
    background: #aebbaa;
    border-radius: var(--border-radius);
}

.nav-container.liquidGlass-wrapper .liquidGlass-shine {
    box-shadow: inset 2px 2px 2px rgba(255, 255, 255, 0.4),
                inset -1px -1px 1px rgba(0, 0, 0, 0.12),
                0 3px 14px rgba(0, 0, 0, 0.12);
    border-radius: var(--border-radius);
}

.nav-content {
    height: 3vh;
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    min-width: 0;
    justify-content: space-between; /* Push items to opposite ends */
}

.header-motto {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(-0.5vh);
    font-family: 'Lavishly Yours', cursive;
    font-size: 4.5vh;
    font-weight: 400;
    color: var(--primary-color);
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}

@media (max-width: 768px) {
    .header-motto {
        display: none;
    }
}

@media (min-width: 769px) {
    .nav-content { 
        justify-content: space-between; /* Keep space-between on desktop too */
    }
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.7vh;
    align-items: center;
    min-width: 0;
    margin: 0;
    padding: 0;
    flex: 1; /* Take up remaining space */
    justify-content: flex-end; /* Align to the right */
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
}

/* Dropdown styles */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    border-left: rgba(var(--secondary-color-rgb), 0.5) 1px solid;
    border-right: rgba(var(--secondary-color-rgb), 0.5) 1px solid;
    border-bottom: rgba(var(--secondary-color-rgb), 0.5) 1px solid;
    margin-top: 0.2vh;
    background: #AEBBAA;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    padding: 0.5vh 0;
    list-style: none;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 10000;
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-link {
    display: inline-block;
    color: var(--text-color);
    text-decoration: none;
    font-size: 2.2vh !important;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    opacity: 0.8;
    position: relative;
    width: 100%;
    text-align: center;
}

.nav-dropdown-link::after {
    content: '';
    position: absolute;
    bottom: -0.2vh;
    left: 50%;
    transform: translateX(-50%);
    height: 0.2vh;
    background: rgba(var(--green-text-color-rgb), 0.5);
    width: 0;
    transition: width 0.3s ease;
}

.nav-dropdown-link:hover {
    color: rgba(var(--green-text-color-rgb), 1);
    opacity: 1;
}

.nav-dropdown-link:hover::after {
    width: calc(100% - 3vw);
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 2.2vh !important;
    transition: all 0.3s ease;
    position: relative;
    opacity: 0.8;
    display: inline-flex;
    align-items: center;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -0.2vh;
    left: 0;
    width: 0;
    height: 0.3vh;
    background: rgba(var(--green-text-color-rgb), 0.5);
    transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: rgba(var(--green-text-color-rgb), 1);
    opacity: 1;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.menu-toggle span {
    width: 25px;
    height: 2px;
    background: var(--primary-color);
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Header Buttons */
.header-buttons {
    display: flex;
    gap: 1.7vh;
    align-items: center;
    flex-shrink: 0;
}

.header-buttons .app-header-button {
    display: flex;
    align-items: center;
    gap: 0.5vw;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-family: 'Red Hat Display', sans-serif;
    transition: all 0.3s ease;
    padding: 0.6vw;
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-color);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05),
                0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-buttons .app-header-button img,
.header-buttons .app-header-button svg {
    width: 1.2vw;
    height: 1.2vw;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.header-buttons .app-header-button .app-header-homeIcon {
    width: 1.2vw;
    height: 1.2vw;
}

.header-buttons .app-header-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
                0 0 0 1px rgba(255, 255, 255, 0.3) inset;
    color: rgb(var(--green-text-color-rgb));
}

/* Active state for header buttons */
.header-buttons .app-header-button.active {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12),
                0 0 0 1px rgba(255, 255, 255, 0.35) inset;
    color: rgb(var(--green-text-color-rgb));
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    inset: 0 0 0 100%; /* initially positioned off-canvas to the right */
    width: 100%;
    /* Use dynamic viewport units for mobile browsers that support them */
    height: 100svh; /* preferred when supported */
    min-height: 100vh; /* fallback */
    background: rgba(221, 229, 219, 0.98);
    backdrop-filter: blur(20px);
    z-index: 9998;
    transition: inset 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
    font-family: 'Red Hat Display', sans-serif;
    padding-top: 0;
}

.mobile-nav.active {
    inset: 0; /* slide into full-screen view */
}

.mobile-nav-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 8vw;
    font-weight: 500;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.3s ease;
    display: block;
    text-align: center;
    max-width: 90%;
    margin: 0 auto;
}

.mobile-nav.active .mobile-nav-link {
    opacity: 1;
    transform: translateY(0);
}

/* Highlight the active page in the mobile menu */
.mobile-nav-link.active {
    color: var(--secondary-color);
    text-decoration: underline;
}

.mobile-nav-link:nth-child(2) { transition-delay: 0.1s; }
.mobile-nav-link:nth-child(3) { transition-delay: 0.2s; }
.mobile-nav-link:nth-child(4) { transition-delay: 0.3s; }
.mobile-nav-link:nth-child(5) { transition-delay: 0.4s; }

/* Override font-size for header button labels to match main page */
.app-header-mapLabel,
.app-header-backLabel,
.app-header-listingsLabel {
    font-size: 2.2vh !important;
    line-height: 1;
    display: inline-block;
    font-weight: 500;
}

/* Create specific gap after first letter "T" in map button */
.app-header-mapLabel::first-letter {
    margin-right: 0.05em;
}

/* Mobile motto styling */
.mobile-nav-motto {
    position: absolute;
    top: 10vh;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    font-family: 'Lavishly Yours', cursive;
    font-size: 10vw;
    font-weight: 400;
    color: var(--primary-color);
    text-align: center;
    opacity: 0;
    transition: all 0.3s ease;
    width: 90%;
}

.mobile-nav.active .mobile-nav-motto {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0.05s;
}

/* Add site credit styles for the mobile nav */
.mobile-nav .site-credit {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.6;
    text-align: center;
    width: 100%;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    :root {
        --border-radius: 1.5vw !important; /* increase border radius on mobile */
    }

    .nav-menu {
        display: none;
    }
    
    .menu-toggle {
        display: flex;
        flex-shrink: 0;
        margin-left: 3vw;
    }
    
    .nav-content {
        justify-content: flex-start;
        overflow: visible;
    }
    
    .header-buttons {
        gap: 2vw;
        flex: 1;
        overflow-x: auto;
        overflow-y: hidden;
        padding-right: 2vw;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .header-buttons::-webkit-scrollbar {
        display: none;
    }
    
    .header-buttons .app-header-button .app-header-homeIcon {
        width: 5vw;
        height: 5vw;
    }
    
    .header-buttons .app-header-button {
        font-size: 3.5vw;
        padding: 1.5vw;
        gap: 1.5vw;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    .header-buttons .app-header-button img {
        width: 5vw;
        height: 5vw;
    }
    
    .nav-link {
        font-size: 4vw;
    }

    .app-header-mapLabel,
    .app-header-backLabel,
    .app-header-listingsLabel {
        font-size: 3.5vw !important;
        line-height: 1;
        display: inline-block;
    }
}