/**
 * Layout Styles
 * Top navigation bar, main content, and structural components
 * Extracted from inline styles in layout.html for better maintainability
 */

/* ===========================================
   TOP NAVIGATION BAR
   =========================================== */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: #080808;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    border-bottom: 2px solid #d4af37;
    /* Subtle shadow - avoid heavy band that cuts off content below */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.topbar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.topbar-logo:hover {
    opacity: 0.9;
}

.topbar-logo img {
    display: block;
}

.topbar-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.topbar-link {
    color: #e0e0e0;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.topbar-link.has-dropdown::after {
    content: '\25BE';
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.topbar-link:hover {
    color: #d4af37;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* ===========================================
   TOPBAR ACTION BUTTONS
   =========================================== */

.topbar-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.topbar-action-btn {
    background: none;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    border-radius: 4px;
}

.topbar-action-btn:hover {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.1);
}

/* Mobile topbar - improved spacing, keep Map button in view */
@media (max-width: 900px) {
    .topbar {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        gap: 0.5rem;
    }

    .mobile-menu-btn {
        margin-right: 1rem;
        padding: 0.5rem;
    }

    .topbar-actions {
        gap: 0.5rem;
        margin-left: 0.5rem;
        flex-shrink: 0;
    }

    .topbar-action-btn {
        padding: 0.5rem 0.25rem;
        min-width: 44px;
        min-height: 44px;
    }

    .topbar-logo {
        margin-left: 0.25rem;
    }

    .topbar-logo img {
        width: 40px;
        height: 40px;
    }
}

/* ===========================================
   MOBILE SIDEBAR - Improved look
   =========================================== */

@media (max-width: 900px) {
    /* Scoped: no blue in sidebar - override any inherited accent/link colors */
    .mobile-sidebar,
    .mobile-sidebar * {
        --accent-color: #d4af37;
        --color-accent: #d4af37;
    }

    .mobile-sidebar a:not(:hover):not(.active) {
        color: #ccc !important;
    }

    .mobile-sidebar a:hover,
    .mobile-sidebar a.active {
        color: #d4af37 !important;
    }

    .mobile-sidebar a:focus-visible {
        outline: 2px solid #d4af37;
        outline-offset: 2px;
    }

    /* Backdrop when sidebar is open */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1999;
        cursor: pointer;
        transition: opacity 0.3s ease;
    }

    .mobile-sidebar.active ~ .sidebar-backdrop {
        display: block;
    }

    /* Sidebar panel - use transform so it fully hides regardless of width */
    .mobile-sidebar {
        left: 0 !important;
        width: min(320px, 85vw);
        background: linear-gradient(180deg, #0a0a0a 0%, #080808 100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 175, 55, 0.15);
        border-right: 2px solid rgba(212, 175, 55, 0.5);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding-top: env(safe-area-inset-top);
        transform: translateX(-100%);
    }

    .mobile-sidebar.active {
        transform: translateX(0);
    }

    /* Header */
    .sidebar-header {
        padding: 1.25rem 1rem;
        background: rgba(212, 175, 55, 0.06);
        border-bottom: 1px solid rgba(212, 175, 55, 0.25);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar-title {
        font-family: 'Cinzel', serif;
        font-size: 1.1rem;
        font-weight: 700;
        color: #d4af37;
        letter-spacing: 0.08em;
    }

    .sidebar-close-btn {
        background: rgba(212, 175, 55, 0.1);
        border: 1px solid rgba(212, 175, 55, 0.3);
        color: #d4af37;
        width: 44px;
        height: 44px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.2s, border-color 0.2s;
    }

    .sidebar-close-btn:hover {
        background: rgba(212, 175, 55, 0.2);
        border-color: #d4af37;
    }

    /* Content area */
    .sidebar-content {
        padding: 1rem 0.75rem 2rem;
    }

    /* Nav items - larger touch targets */
    .sidebar-nav .nav-item-li a,
    .sidebar-nav .nav-item-li .nav-item {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        border-radius: 8px;
        margin-bottom: 0.25rem;
        color: #ccc;
        transition: background 0.2s, color 0.2s;
    }

    .sidebar-nav .nav-item-li a:hover,
    .sidebar-nav .nav-item-li a.active,
    .sidebar-nav .nav-item-li .nav-item:hover,
    .sidebar-nav .nav-item-li .nav-item.active {
        background: rgba(212, 175, 55, 0.12);
        color: #d4af37;
    }

    /* Group headers */
    .sidebar-nav .nav-group-title {
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
        letter-spacing: 0.1em;
        color: #d4af37;
        opacity: 0.9;
        border-bottom: 1px solid rgba(212, 175, 55, 0.2);
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }

    .sidebar-nav .nav-group-title:first-child {
        margin-top: 0;
    }

    /* Nested nav */
    .sidebar-nav .nav-group-content .sidebar-nav {
        padding-left: 1rem;
        border-left: 2px solid rgba(212, 175, 55, 0.2);
        margin-left: 0.5rem;
    }
}

/* ===========================================
   DROPDOWN MENUS - HIGH FANTASY STYLE
   =========================================== */

.topbar-dropdown {
    position: relative;
    overflow: visible;
}

.topbar-dropdown-content {
    display: none;
    position: absolute;
    background: #080808 !important;
    background-color: #080808 !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    min-width: 180px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.9);
    z-index: 1001;
    border: 1px solid #d4af37;
    border-top: 2px solid #d4af37;
    border-radius: 0;
    top: 100%;
    left: 0;
    right: auto;
    padding: 0.5rem 0;
    flex-direction: column;
    flex-wrap: wrap;
    max-height: 600px;
    width: max-content;
    overflow: visible !important;
}

.topbar-dropdown:hover .topbar-dropdown-content,
.topbar-dropdown.is-open .topbar-dropdown-content {
    display: flex;
    overflow: visible !important;
}

.topbar-dropdown-item {
    color: #a9a9a9;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    width: 220px;
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.4;
    transition: all 0.2s ease;
    border-bottom: 1px solid #1a1a1a;
    box-sizing: border-box;
    background-color: #080808 !important;
    opacity: 1 !important;
    position: relative;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.topbar-dropdown-item:last-child {
    border-bottom: none;
}

.topbar-dropdown-item:hover {
    background-color: #121212;
    color: #d4af37;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
    padding-left: 20px;
}

/* ===========================================
   NESTED DROPDOWNS
   =========================================== */

.nested-dropdown {
    position: relative;
    display: block;
}

.topbar-dropdown-item.has-submenu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.nested-dropdown-content {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background-color: #080808 !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    min-width: 180px;
    width: max-content;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.9);
    z-index: 1003;
    border: 1px solid #d4af37;
    border-left: 2px solid #d4af37;
    border-radius: 0;
    padding: 0.5rem 0;
    flex-direction: column;
    flex-wrap: wrap;
    max-height: 80vh;
    overflow: visible !important;
}

.nested-dropdown:hover>.nested-dropdown-content,
.nested-dropdown.is-open>.nested-dropdown-content {
    display: flex;
}

.nested-dropdown-content .topbar-dropdown-item {
    width: auto;
    min-width: 180px;
    white-space: normal;
    box-sizing: border-box;
}

.nested-dropdown-content .topbar-dropdown-item:hover {
    padding-left: 20px;
}

.nested-dropdown-content .nested-dropdown {
    width: auto;
    min-width: 180px;
}

/* ===========================================
   MAIN CONTENT AREA
   =========================================== */

.main-content {
    margin-top: 60px;
    padding: 0 0 3rem;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin-right: 0 !important;
    overflow-y: auto;
    height: calc(100vh - 60px);
    display: block;
    background-color: #080808;
}

.markdown-body {
    width: 100%;
    max-width: 1000px;
    padding: 2rem 4rem;
    margin: 0 auto;
    min-height: 100%;
    box-sizing: border-box;
    line-height: 1.8;
}

/* ===========================================
   APP CONTAINER & AUTH STATES
   =========================================== */

.app-container {
    display: none;
    flex-direction: column;
}

html.authenticated .app-container {
    display: flex;
}

#password-overlay {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2000;
    color: white;
    align-items: center;
    justify-content: center;
}

html.authenticated #password-overlay {
    display: none !important;
}

/* ===========================================
   FIREFLY CANVAS
   =========================================== */

#firefly-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.app-container {
    position: relative;
    z-index: 2;
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #d4af37;
    color: #080808;
    padding: 8px 16px;
    z-index: 10000;
    font-family: 'Cinzel', serif;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===========================================
   PASSWORD INPUT FOCUS STATES
   =========================================== */

#password-input:focus {
    border-color: #d4af37 !important;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

#password-submit:hover {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

/* ===========================================
   PAGE FLIP BUTTONS - Book-style navigation
   =========================================== */

.page-flip-nav {
    position: fixed;
    top: 92%;
    transform: translateY(-50%);
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 100;
}

.page-flip-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 8, 0.9);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #d4af37;
    font-size: 2rem;
    text-decoration: none;
    pointer-events: auto;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.page-flip-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: #d4af37;
    color: #e5c158;
}

.page-flip-prev {
    left: 0;
    border-right: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 0 8px 8px 0;
}

.page-flip-next {
    right: 0;
    border-left: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px 0 0 8px;
}

@media (max-width: 768px) {
    .page-flip-nav {
        display: flex;
        flex-direction: column-reverse;
        gap: 0.5rem;
        top: auto;
        bottom: max(1.5rem, env(safe-area-inset-bottom));
        transform: none;
        left: auto;
        right: max(1rem, env(safe-area-inset-right));
        z-index: 99;
    }

    .page-flip-btn {
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        border-radius: 8px;
        background: #080808 !important;
        border: 2px solid rgba(212, 175, 55, 0.4) !important;
    }

    .page-flip-prev {
        border-right: 2px solid rgba(212, 175, 55, 0.4);
    }

    .page-flip-next {
        border-left: 2px solid rgba(212, 175, 55, 0.4);
    }

    .page-flip-btn:hover {
        background: #121212 !important;
    }
}

/* Wiki links in content - distinct styling for internal links */
.markdown-body a.wiki-link {
    color: #d4af37;
    text-decoration: none;
    border-bottom: 1px dashed rgba(212, 175, 55, 0.5);
    transition: color 0.2s, border-color 0.2s;
}

.markdown-body a.wiki-link:hover {
    color: #e5c158;
    border-bottom-color: #d4af37;
}

/* ===========================================
   SEARCH MODAL
   =========================================== */

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10vh 1rem 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.search-modal.search-open {
    opacity: 1;
    visibility: visible;
}

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.search-modal-content {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: #080808;
    border: 2px solid #d4af37;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.search-modal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: #121212;
    border: 1px solid #333;
    color: #e0e0e0;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.search-input::placeholder {
    color: #666;
}

.search-close-btn {
    background: none;
    border: none;
    color: #a9a9a9;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.search-close-btn:hover {
    color: #d4af37;
}

.search-results {
    overflow-y: auto;
    padding: 0.5rem;
    flex: 1;
    min-height: 0;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #e0e0e0;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.search-result-item:hover,
.search-result-item:focus {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
    color: #d4af37;
}

.search-result-title {
    display: block;
    font-weight: 600;
}

.search-result-breadcrumb {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.25rem;
}

.search-result-snippet {
    display: block;
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.25rem;
    line-height: 1.5;
}

.search-result-item mark {
    background: rgba(212, 175, 55, 0.35);
    color: inherit;
}

/* Brief flash highlight when navigating from search */
mark.search-highlight-flash {
    background: rgba(212, 175, 55, 0.5);
    color: inherit;
    animation: search-highlight-flash 2s ease-out forwards;
}

@keyframes search-highlight-flash {
    0% {
        background: rgba(212, 175, 55, 0.7);
        box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.3);
    }
    40% {
        background: rgba(212, 175, 55, 0.4);
        box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
    }
    100% {
        background: transparent;
        box-shadow: none;
    }
}

.search-no-results {
    padding: 1.5rem;
    color: #666;
    font-style: italic;
    margin: 0;
}

.search-hint {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: #666;
    margin: 0;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.search-hint kbd {
    background: #1a1a1a;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.7em;
}

body.search-modal-open {
    overflow: hidden;
}

/* ===========================================
   TABLE OF CONTENTS (Self-contained floating box)
   =========================================== */

.page-toc-wrapper {
    display: none;
    position: fixed;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

body.has-page-toc .page-toc-wrapper {
    display: block;
}

.page-toc-toggle {
    display: none;
    position: fixed;
    left: 1rem;
    bottom: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #080808 !important;
    border: 2px solid #d4af37;
    color: #d4af37;
    cursor: pointer;
    z-index: 101;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: color 0.2s, border-color 0.2s;
}

.page-toc-toggle:hover,
.page-toc-toggle:active,
.page-toc-toggle:focus {
    background: #121212 !important;
}

/* Desktop: TOC fades to 35% when not hovered */
@media (min-width: 901px) {
    .page-toc-wrapper {
        opacity: 0.35;
        transition: opacity 0.25s ease;
    }

    .page-toc-wrapper:hover {
        opacity: 1;
    }
}

.page-toc-container {
    background: #080808;
    border: 2px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(212, 175, 55, 0.1);
    padding: 1rem 1.25rem;
    max-width: 240px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.page-toc {
    padding: 0;
    background: transparent;
    border: none;
}

.page-toc-title {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #d4af37;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.page-toc-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.page-toc-list ol {
    margin: 0.25rem 0 0 0;
    padding-left: 0.75rem;
    list-style: none;
    border-left: 1px solid rgba(212, 175, 55, 0.2);
}

.page-toc-link {
    display: block;
    padding: 0.35rem 0.5rem;
    color: #a9a9a9;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
    border-radius: 4px;
}

.page-toc-link:hover {
    color: #d4af37;
}

.page-toc-h2 { font-weight: 600; }
.page-toc-h3 { font-size: 0.8rem; }
.page-toc-h4, .page-toc-h5, .page-toc-h6 { font-size: 0.75rem; color: #888; }

/* Mobile: TOC as bottom sheet (slides up from bottom), large touch-friendly text */
@media (max-width: 900px) {
    .page-toc-wrapper {
        left: 0 !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        transform: none !important;
        width: 100% !important;
        pointer-events: none;
    }

    .page-toc-wrapper * {
        pointer-events: auto;
    }

    /* Backdrop when TOC is open - dims content, click to dismiss */
    .page-toc-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        cursor: pointer;
    }

    .page-toc-wrapper:not(.page-toc-collapsed) .page-toc-backdrop {
        display: block;
    }

    body.has-page-toc .page-toc-toggle {
        display: flex;
        left: max(1rem, env(safe-area-inset-left));
        bottom: max(1.5rem, env(safe-area-inset-bottom));
        right: auto;
    }

    /* Bottom sheet: anchored at bottom, takes lower 70% of screen */
    .page-toc-container {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: none !important;
        height: 70vh !important;
        height: 70dvh !important;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        border-radius: 16px 16px 0 0;
        padding: 1.5rem max(1rem, env(safe-area-inset-left)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-right));
        overflow-y: auto;
        z-index: 100;
    }

    .page-toc-wrapper:not(.page-toc-collapsed) .page-toc-container {
        transform: translateY(0);
    }

    .page-toc-wrapper.page-toc-collapsed .page-toc-container {
        transform: translateY(100%);
        pointer-events: none;
    }

    /* Mobile: larger, touch-friendly text */
    .page-toc-title {
        font-size: 1rem !important;
        margin-bottom: 1rem !important;
        padding-bottom: 0.75rem !important;
    }

    .page-toc-link {
        font-size: 1.1rem !important;
        padding: 0.75rem 0.5rem !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }

    .page-toc-h2 { font-size: 1.1rem !important; font-weight: 600 !important; }
    .page-toc-h3 { font-size: 1.05rem !important; }
    .page-toc-h4, .page-toc-h5, .page-toc-h6 { font-size: 1rem !important; color: #aaa !important; }

    .page-toc-list ol {
        padding-left: 1rem !important;
    }
}

/* ===========================================
   SITE FOOTER
   =========================================== */

.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem 2rem;
    padding: 1.5rem 2rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    margin-top: 2rem;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    background: rgba(8, 8, 8, 0.5);
}

.site-footer-home {
    display: flex;
    align-items: center;
    transition: opacity 0.2s ease;
}

.site-footer-home:hover {
    opacity: 0.85;
}

.site-footer-home img {
    display: block;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1.5rem;
}

.site-footer-links a {
    color: #b8a060;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.site-footer-links a:hover {
    color: #d4af37;
}

.site-footer-legal {
    width: 100%;
    margin: 0;
    text-align: center;
    font-size: 0.75rem;
    color: #888;
}

.site-footer-legal a {
    color: #b8a060;
    text-decoration: none;
}

.site-footer-legal a:hover {
    color: #d4af37;
}

@media (max-width: 600px) {
    .site-footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

@media (min-width: 601px) {
    .site-footer {
        flex-direction: row;
    }

    .site-footer-legal {
        width: auto;
        margin-left: auto;
    }
}