/* Sticky Navigation Bar */
:root {
    --nav-overlay-z-index: 1500;
    --nav-modal-z-index: 2000;
    --nav-transition-duration: 0.3s;
    --nav-scroll-threshold: 100px;
}

#main-nav {
    position: sticky;
    top: 0;
    background: var(--bg-primary, #fdf6e8);
    border-bottom: 1px solid var(--border-color, #e0dcc4);
    z-index: var(--nav-z-index);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform var(--nav-transition-duration) ease;
}

#main-nav.nav-hidden {
    transform: translateY(-100%);
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0.75rem var(--spacing-md, 1.25rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.nav-right-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
    pointer-events: auto;
    position: relative;
    z-index: calc(var(--nav-z-index) + 1);
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: clamp(0.5rem, 3vw, 2rem);
    flex: 1;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    min-width: 0;
    min-height: 0;
}

.nav-link {
    color: var(--text-secondary, #343a40);
    text-decoration: none;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-family: var(--font-body, Georgia, 'Times New Roman', serif);
    transition: color var(--duration-fast) var(--ease-out-cubic);
    position: relative;
    padding: 0.5rem 0;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.nav-link:visited {
    color: var(--text-secondary, #343a40) !important;
}

.nav-link:focus {
    outline: none;
}

.nav-link:hover {
    color: var(--color-secondary, #d4822a);
    text-decoration: none;
}

.nav-link.active {
    color: var(--color-primary, #2c5f5a);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    padding: 0 0.75rem;
    height: 2px;
    background: var(--color-secondary, #d4822a);
    animation: slideInUnderline var(--duration-base) var(--ease-out-cubic);
}

@keyframes slideInUnderline {
    from {
        transform: translateX(-50%) scaleX(0);
    }

    to {
        transform: translateX(-50%) scaleX(1);
    }
}

.nav-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    text-decoration: none;
    padding: 0 !important;
    transition: all 0.2s ease;
}

.nav-logo img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    transition: box-shadow var(--duration-fast) var(--ease-out-cubic), transform var(--duration-fast) var(--ease-out-cubic);
    box-shadow: 0 2px 8px rgba(44, 95, 90, 0.1);
}

.nav-logo:hover img {
    box-shadow: 0 4px 16px rgba(44, 95, 90, 0.15);
    transform: scale(1.05);
}



.nav-logo.active::after {
    display: none;
}



/* Compact Icon Buttons in Navbar */
.cta-icon-btn,
.hints-icon-btn,
.dark-mode-toggle {
    background: transparent;
    border: 1px solid var(--border-color, #e0dcc4);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary, #343a40);
    position: relative;
    pointer-events: auto;
    touch-action: manipulation;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.cta-icon-btn i[data-lucide],
.hints-icon-btn i[data-lucide],
.dark-mode-toggle i[data-lucide] {
    width: 1.2rem;
    height: 1.2rem;
    color: var(--color-secondary, #d4822a);
    stroke: var(--color-secondary, #d4822a);
    stroke-width: 2;
    transition: inherit;
}

.cta-icon-btn:hover,
.hints-icon-btn:hover,
.dark-mode-toggle:hover {
    background: var(--bg-secondary, #f8f4e6);
}

/* CTA Modal - Anchored to navbar */
.cta-modal {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    display: none;
    z-index: var(--nav-overlay-z-index);
    pointer-events: none;
}

.cta-modal.active {
    pointer-events: auto;
}

.cta-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    cursor: pointer;
}

/* CTA Container in Modal - Anchored popover */
.cta-modal .cta-container {
    position: relative;
    background: var(--bg-secondary, #f8f4e6);
    border: 1px solid var(--border-color, #e0dcc4);
    border-radius: 0.5rem;
    padding: var(--spacing-md, 1.25rem);
    max-width: 500px;
    width: calc(100% - 2rem);
    margin-left: auto;
    margin-right: 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s ease, transform 0.2s ease;
    contain: layout style;
    z-index: calc(var(--nav-overlay-z-index) + 1);
}

.cta-container:hover {
    border-color: var(--color-secondary, #d4822a);
    transform: translateY(-2px);
}

.cta-button {
    display: flex;
    align-items: center;
    gap: var(--spacing-md, 1.25rem);
    text-align: left;
    color: var(--text-primary, #000000);
}

.cta-button i[data-lucide] {
    width: 2rem;
    height: 2rem;
    stroke-width: 2.5;
    color: var(--color-secondary, #d4822a);
    flex-shrink: 0;
}

.cta-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs, 0.5rem);
}

.cta-text-wrapper span:first-child {
    font-family: 'Georgia', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #000000);
}

.cta-subtext {
    font-size: 0.85rem;
    color: var(--text-secondary, #343a40);
    font-style: italic;
    font-weight: 400;
    line-height: 1.4;
}

.cta-close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-secondary, #343a40);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cta-close-btn:hover {
    background-color: var(--border-color, #e0dcc4);
    color: var(--text-primary, #000000);
}

/* Visitor Hints - Anchored to navbar */
.visitor-hints {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    display: none;
    z-index: var(--nav-modal-z-index);
    pointer-events: none;
}

.visitor-hints.active {
    pointer-events: auto;
}

.hint-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: pointer;
}

.hint-content {
    position: relative;
    background: var(--bg-primary, #fdf6e8);
    padding: 1rem;
    border-radius: 0.5rem;
    max-width: 450px;
    width: calc(100% - 2rem);
    margin-left: auto;
    margin-right: 1rem;
    max-height: 80vh;
    overflow-y: auto;
    z-index: calc(var(--nav-modal-z-index) + 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.hint-content h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-primary, #000000);
}

.hint-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.hint-step {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.hint-step i[data-lucide],
.hint-step img {
    flex-shrink: 0;
    color: var(--color-secondary, #d4822a);
}

.hint-step strong {
    color: var(--text-primary, #000000);
    font-size: 0.9rem;
}

.hint-step div {
    color: var(--text-secondary, #343a40);
    font-size: 0.85rem;
}

.hint-close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-secondary, #343a40);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hint-close-btn:hover {
    background-color: var(--border-color, #e0dcc4);
    color: var(--text-primary, #000000);
}

.hint-close-btn-action {
    background: var(--accent-secondary, #d4822a);
    color: var(--color-white, #ffffff);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: block;
    margin: 0.5rem auto 0;
    transition: background-color 0.2s ease;
}

.hint-close-btn-action:hover {
    background: var(--accent-primary, #2c5f5a);
}

/* Dark mode icon visibility */
@media (prefers-color-scheme: dark) {

    .cta-icon-btn,
    .hints-icon-btn,
    .dark-mode-toggle {
        background: var(--bg-secondary, #252b2a);
    }

    .cta-icon-btn i[data-lucide],
    .hints-icon-btn i[data-lucide],
    .dark-mode-toggle i[data-lucide],
    .cta-button i[data-lucide],
    .hint-step i[data-lucide] {
        color: var(--accent-secondary, #d4822a) !important;
        stroke: var(--accent-secondary, #d4822a) !important;
    }

    .cta-icon-btn:hover,
    .hints-icon-btn:hover,
    .dark-mode-toggle:hover {
        background: var(--bg-secondary, #252b2a);
    }

    /* CTA Modal dark mode text fixes */
    .cta-modal .cta-container {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }

    .cta-button {
        color: var(--text-primary);
    }

    .cta-text-wrapper span:first-child {
        color: var(--text-primary);
    }

    .cta-subtext {
        color: var(--text-secondary);
    }

    /* Hint modal dark mode text fixes */
    .hint-content {
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
    }

    .hint-content h3 {
        color: var(--text-primary);
    }

    .hint-step strong {
        color: var(--text-primary);
    }

    .hint-step div {
        color: var(--text-primary);
    }

    .hint-close-btn {
        color: var(--text-secondary);
    }

    .hint-close-btn:hover {
        background-color: var(--border-color);
        color: var(--text-primary);
    }

    .hint-close-btn-action {
        background: var(--accent-secondary);
        color: var(--text-primary);
    }

    .hint-close-btn-action:hover {
        background: var(--accent-primary);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.6rem var(--spacing-md, 1.25rem);
        gap: 0.75rem;
    }

    .nav-list {
        gap: clamp(0.4rem, 2vw, 1rem);
        flex: 1;
        min-width: 0;
        flex-wrap: nowrap;
    }

    .nav-link {
        font-size: clamp(0.85rem, 2.5vw, 1rem);
        padding: 0.4rem;
        flex-shrink: 0;
    }

    .nav-logo {
        padding: 0.25rem !important;
        flex-shrink: 0;
    }

    .nav-logo img {
        width: 36px;
        height: 36px;
    }

    .nav-right-section {
        flex-shrink: 0;
        gap: 0.75rem;
    }

    .cta-icon-btn,
    .hints-icon-btn,
    .dark-mode-toggle {
        width: auto;
        height: auto;
        flex-shrink: 0;
        border: none;
        background: transparent;
        padding: 0;
    }

    .cta-icon-btn i[data-lucide],
    .hints-icon-btn i[data-lucide],
    .dark-mode-toggle i[data-lucide] {
        width: 1.1rem;
        height: 1.1rem;
    }

    .hint-content {
        width: 95%;
        max-height: 85vh;
        padding: var(--spacing-sm, 0.75rem);
    }

    .hint-content h3 {
        font-size: 0.85rem;
    }

    .hint-step {
        gap: var(--spacing-xs, 0.5rem);
    }

    .hint-step strong {
        font-size: 0.8rem;
    }

    .hint-step div {
        font-size: 0.75rem;
    }

    .hint-close {
        padding: 0.45rem 0.9rem;
        font-size: 0.85rem;
    }

    .cta-modal .cta-container {
        width: 90vw;
        max-width: 95%;
        padding: var(--spacing-sm, 0.75rem);
    }

    .cta-button i[data-lucide] {
        width: 1.5rem;
        height: 1.5rem;
    }

    .cta-text-wrapper span:first-child {
        font-size: 0.9rem;
    }

    .cta-subtext {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .nav-list {
        gap: clamp(0.3rem, 1.8vw, 0.6rem);
        flex-wrap: nowrap;
    }

    .nav-link {
        font-size: clamp(0.8rem, 2.2vw, 0.95rem);
        padding: 0.3rem;
        flex-shrink: 0;
    }

    .nav-logo img {
        width: 34px;
        height: 34px;
    }

    .nav-right-section {
        gap: 0.5rem;
    }

    .cta-icon-btn,
    .hints-icon-btn,
    .dark-mode-toggle {
        width: auto;
        height: auto;
        flex-shrink: 0;
        border: none;
        background: transparent;
        padding: 0;
    }

    .cta-icon-btn i[data-lucide],
    .hints-icon-btn i[data-lucide],
    .dark-mode-toggle i[data-lucide] {
        width: 1.1rem;
        height: 1.1rem;
    }

    .hint-content {
        width: 95%;
        max-height: 90vh;
        padding: var(--spacing-xs, 0.5rem);
    }

    .hint-content h3 {
        font-size: 0.8rem;
    }

    .hint-step {
        gap: var(--spacing-xs, 0.5rem);
    }

    .hint-step strong {
        font-size: 0.75rem;
    }

    .hint-step div {
        font-size: 0.7rem;
    }

    .hint-close {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    .cta-modal .cta-container {
        width: 90vw;
        max-width: 95%;
        padding: var(--spacing-xs, 0.5rem);
    }

    .cta-button i[data-lucide] {
        width: 1.25rem;
        height: 1.25rem;
    }

    .cta-text-wrapper span:first-child {
        font-size: 0.8rem;
    }

    .cta-subtext {
        font-size: 0.65rem;
    }
}