/* ============================================================
   COMPONENTS.CSS — Navbar, Footer, Cards, Lightbox, Back-to-top
   ============================================================ */

/* ======================== NAVBAR ======================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 0 24px;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    transition: background var(--transition), box-shadow var(--transition), transform 0.5s ease;
    background: transparent;
}

.navbar.scrolled {
    background: rgba(128, 0, 32, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* On non-home pages, navbar is always solid */
body:not([data-page="home"]) .navbar {
    background: rgba(128, 0, 32, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.nav-container {
    max-width: var(--container-width);
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
}

.logo-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-sub {
    display: block;
    font-size: 0.65em;
    font-weight: 400;
    opacity: 0.8;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* ---- Shared appearance for top-level links + dropdown toggles ---- */
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    white-space: nowrap;
    cursor: pointer;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--white);
    background: rgba(255, 255, 255, 0.15);
}

.nav-link.active {
    color: var(--white);
    background: rgba(255, 111, 0, 0.3);
}

.nav-dropdown-toggle.active-group {
    color: var(--gold);
}

.nav-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.85;
    transition: transform var(--transition);
}

.nav-dropdown {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-dropdown-link {
    display: block;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--dark);
    white-space: nowrap;
    transition: all var(--transition);
}

/* ============ DESKTOP MEGA-MENU (>=1025px) ============ */
@media (min-width: 1025px) {
    .nav-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 224px;
        margin-top: 10px;
        background: var(--white);
        border-top: 3px solid var(--saffron);
        border-radius: var(--radius);
        box-shadow: var(--shadow-lg);
        padding: 8px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
        z-index: 1001;
    }

    /* invisible bridge so the menu doesn't close in the toggle->panel gap */
    .nav-dropdown::before {
        content: '';
        position: absolute;
        top: -13px;
        left: 0;
        right: 0;
        height: 13px;
    }

    /* Right-align the last group's panel so it never overflows the viewport */
    .nav-item.has-dropdown:last-child .nav-dropdown {
        left: auto;
        right: 0;
    }

    .nav-item.has-dropdown:hover > .nav-dropdown,
    .nav-item.has-dropdown:focus-within > .nav-dropdown,
    .nav-item.has-dropdown.open > .nav-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-item.has-dropdown:hover > .nav-dropdown-toggle .nav-caret,
    .nav-item.has-dropdown:focus-within > .nav-dropdown-toggle .nav-caret,
    .nav-item.has-dropdown.open > .nav-dropdown-toggle .nav-caret {
        transform: rotate(180deg);
    }

    .nav-dropdown-link:hover,
    .nav-dropdown-link:focus-visible {
        background: var(--cream);
        color: var(--maroon);
    }

    .nav-dropdown-link.active {
        background: rgba(255, 111, 0, 0.12);
        color: var(--maroon);
    }
}

/* ============ MOBILE DRAWER + ACCORDION (<=1024px) ============ */
@media (max-width: 1024px) {
    .navbar {
        padding: 0 16px;
    }

    .navbar .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: min(86vw, 340px);
        height: 100vh;
        height: 100dvh;
        background: var(--maroon);
        padding: calc(var(--nav-height) + 12px) 0 40px;
        visibility: hidden;
        transition: right var(--transition), visibility var(--transition);
        box-shadow: -5px 0 24px rgba(0, 0, 0, 0.35);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 999;
    }

    .nav-menu.active {
        right: 0;
        visibility: visible;
    }

    .nav-links {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0 14px;
    }

    .nav-item {
        position: static;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .nav-link {
        width: 100%;
        justify-content: space-between;
        font-size: 1rem;
        padding: 14px 14px;
        border-radius: 0;
    }

    .nav-link:hover,
    .nav-link:focus-visible,
    .nav-link.active {
        background: rgba(255, 255, 255, 0.1);
    }

    /* accordion panel */
    .nav-dropdown {
        max-height: 0;
        overflow: hidden;
        padding-left: 10px;
        transition: max-height 0.32s ease;
    }

    .nav-item.open > .nav-dropdown {
        max-height: 640px;
    }

    .nav-item.open > .nav-dropdown-toggle .nav-caret {
        transform: rotate(180deg);
    }

    .nav-dropdown-link {
        color: rgba(255, 255, 255, 0.82);
        padding: 11px 14px;
        font-size: 0.92rem;
    }

    .nav-dropdown-link:hover,
    .nav-dropdown-link:focus-visible,
    .nav-dropdown-link.active {
        background: rgba(255, 255, 255, 0.1);
        color: var(--gold);
    }

    /* Mobile overlay (element created by main.js) */
    .nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .nav-overlay.active {
        display: block;
    }
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    z-index: 1001;
}

.hamburger-line {
    width: 26px;
    height: 3px;
    background: var(--white);
    border-radius: 3px;
    transition: all var(--transition);
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

/* ======================== SKIP LINK (accessibility) ======================== */
.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 1200;
    background: var(--maroon);
    color: var(--white);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: top var(--transition);
}
.skip-link:focus { top: 12px; }

/* ======================== STATS ROW ======================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.stat-item {
    text-align: center;
    padding: 28px 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    border-top: 4px solid var(--saffron);
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--saffron);
    display: inline;
}

.stat-suffix {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--saffron);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-top: 4px;
    font-weight: 500;
}

/* ======================== LIGHTBOX ======================== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    text-align: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
    color: var(--white);
    margin-top: 16px;
    font-size: 1rem;
    font-weight: 400;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    color: var(--white);
    font-size: 2rem;
    padding: 12px 16px;
    transition: all var(--transition);
    z-index: 2001;
    border-radius: var(--radius-sm);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lightbox-close {
    top: 20px;
    right: 24px;
    font-size: 2.5rem;
}

.lightbox-prev {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

/* ======================== FOOTER ======================== */
.footer {
    background: var(--dark);
    color: rgba(255, 255, 255, 0.8);
    padding: 44px 0 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px 26px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-col h3 {
    font-size: 1rem;
    color: var(--gold);
    margin-bottom: 12px;
}

.footer-links li {
    margin-bottom: 4px;
}

.footer-links a {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--saffron);
}

.footer-contact p {
    font-size: 0.85rem;
    margin-bottom: 8px;
    line-height: 1.55;
}

.footer-contact a {
    color: var(--saffron);
}

.footer-contact a:hover {
    color: var(--gold);
}

.social-links {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 600;
    transition: all var(--transition);
}

.social-link:hover {
    background: var(--saffron);
    border-color: var(--saffron);
    color: var(--white);
}

/* Placeholder state until real profile URLs are added (no href) */
.social-link.is-placeholder {
    opacity: 0.5;
    cursor: default;
}

.social-link.is-placeholder:hover {
    background: none;
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    transform: none;
}

.footer-hours p {
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.footer-note {
    margin-top: 12px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.65);
    font-style: italic;
}

.footer-bottom {
    text-align: center;
    padding: 18px 0;
    font-size: 0.83rem;
    color: rgba(255, 255, 255, 0.65);
}

.footer-disclaimer {
    margin-top: 6px;
    font-size: 0.78rem;
}

.footer-disclaimer a {
    color: var(--saffron);
}

/* Portal footer (expanded link columns + info row) */
.footer-grid--portal {
    grid-template-columns: repeat(4, 1fr);
}

.footer-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 26px;
    padding: 22px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-legal-links { margin-bottom: 10px; }
.footer-legal-links a { color: rgba(255, 255, 255, 0.7); }
.footer-legal-links a:hover { color: var(--saffron); }

@media (max-width: 900px) {
    .footer-grid--portal { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .footer-grid--portal { grid-template-columns: 1fr; }
    .footer-info { grid-template-columns: 1fr; }
}

/* ======================== SITE ALERT BAR ======================== */
/* Auto-expiring advisories rendered by js/alerts.js. Fixed above the navbar;
   js/alerts.js offsets the navbar by the bar's height. */
.site-alert-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    font-family: var(--font-body);
}

.site-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 8px 24px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--white);
}

.site-alert-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* Severity backgrounds (default = info) */
.site-alert-row { background: var(--maroon); }
.site-alert-row[data-severity="caution"],
.site-alert-row[data-severity="weather"],
.site-alert-row[data-severity="traffic"] { background: #9a6700; }
.site-alert-row[data-severity="warning"] { background: #b3450b; }
.site-alert-row[data-severity="closure"] { background: #7a0012; }
.site-alert-row[data-severity="festival"] { background: #8a2d6b; }

.site-alert-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.site-alert-text { flex: 1; }

.site-alert-text strong {
    font-weight: 600;
    margin-right: 6px;
}

.site-alert-link {
    color: var(--gold);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: underline;
}

.site-alert-link:hover { color: var(--white); }

.site-alert-dismiss {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.3rem;
    line-height: 1;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.site-alert-dismiss:hover { background: rgba(255, 255, 255, 0.15); color: var(--white); }

@media (max-width: 600px) {
    .site-alert {
        padding: 6px 14px;
        gap: 8px;
        font-size: 0.78rem;
    }
    .site-alert-icon { display: none; }
}

/* ======================== VERIFIED-INFORMATION FACT CARD ======================== */
/* Reusable block for any time-sensitive fact: value + status + source + last-checked. */
.verified-fact {
    background: var(--white);
    border: 1px solid rgba(128, 0, 32, 0.12);
    border-left: 4px solid var(--saffron);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
}

.verified-fact[data-status="CONFLICTED"],
.verified-fact[data-status="NEEDS-ONSITE-CONFIRMATION"],
.verified-fact[data-status="NEEDS-TRUST-CONFIRMATION"] {
    border-left-color: #9a6700;
}

.verified-fact[data-status="VERIFIED"] { border-left-color: #2e7d32; }

.verified-fact-label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #777;
    font-weight: 600;
}

.verified-fact-value {
    display: block;
    font-size: 1.02rem;
    color: var(--dark);
    margin: 4px 0 8px;
    font-weight: 500;
}

.verified-fact-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    color: #666;
}

.vf-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #fff3e0;
    color: #b3450b;
}

.vf-status[data-status="VERIFIED"] { background: #e8f5e9; color: #2e7d32; }
.vf-status[data-status="TIME-SENSITIVE"] { background: #fff3e0; color: #9a6700; }
.vf-status[data-status="CONFLICTED"] { background: #fff8e1; color: #8a6d00; }

/* Compact "last verified · source" note placed under existing info/cards */
.fact-note {
    display: block;
    margin-top: 8px;
    font-size: 0.72rem;
    color: #888;
    line-height: 1.4;
}

.fact-note .vf-source { font-style: italic; }

/* Callout / advisory box (e.g. dress code) */
.advisory {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: #fff8e1;
    border: 1px solid #f0d98a;
    border-left: 4px solid #c89200;
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    margin: 28px 0;
}

.advisory-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1.2; }

.advisory h3 { color: #8a6d00; font-size: 1.1rem; margin-bottom: 6px; }
.advisory p { font-size: 0.92rem; color: #5c4a00; margin-bottom: 6px; }
.advisory p:last-child { margin-bottom: 0; }
.advisory a { color: var(--maroon); font-weight: 600; text-decoration: underline; }

/* Tradition vs history note (sits on the dark legends section) */
.tradition-note {
    max-width: 760px;
    margin: -28px auto 48px;
    text-align: center;
    font-size: 0.92rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.82);
}

.tradition-note a {
    color: var(--gold);
    font-weight: 600;
    text-decoration: underline;
}

.tradition-note a:hover { color: var(--white); }

/* ======================== BACK TO TOP ======================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--saffron);
    color: var(--white);
    font-size: 1.3rem;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(255, 111, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition);
    z-index: 900;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--maroon);
    transform: translateY(-3px);
}

/* ======================== PAGE TRANSITION OVERLAY ======================== */
.page-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, var(--saffron), var(--maroon));
    transform: translateX(-100%);
    pointer-events: none;
}

.page-transition-overlay.active {
    animation: pageSlideIn 0.5s ease forwards;
}

@keyframes pageSlideIn {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

/* New wordmark logo (replaces icon+text); white glow for contrast on the maroon navbar */
.nav-logo-img {
    height: 46px;
    width: auto;
    display: block;
    filter:
        drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff)
        drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff)
        drop-shadow(1px 1px 0 #fff) drop-shadow(-1px 1px 0 #fff)
        drop-shadow(1px -1px 0 #fff) drop-shadow(-1px -1px 0 #fff);
}
@media (max-width: 768px) {
    .nav-logo-img { height: 38px; }
}
