/* ==========================================================================
   CONFIGURATION & THEMING
   ========================================================================== */

:root {
    /* Colors */
    --bg-color: #ffffff;
    --menu-footer-color: #f4f4f4;
    --menu-color: #f5f5f5;
    --entry-color: #f5f5f5;
    --text-color: #1a1a1a;
    --link-color: #ff8c00;
    --accent-color: #ff8c00;
    --accent-color-secondary: #FFDD99;
    --border-color: #FFDD99;
    --footer-bottom-color: #fafafa;
    --transparent-background: #eaeaeadd;
    --pill-color: #111;
    
    /* Layout */
    --sidebar-width: 320px;
    
    /* Transitions */
    --transition-speed: 0.3s;
    
    /* Pill */
    --pill-radius: 999px;
    --pill-padding-y: 0.25rem;
    --pill-padding-x: 0.6rem;
    --pill-border: transparent;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #191919;
        --menu-footer-color: #222222;
        --menu-color: #272727;
        --entry-color: #272727;
        --text-color: #ffffff;
        --link-color: #FFDD99;
        --accent-color: #FFDD99;
        --accent-color-secondary: #FFDD99;
        --border-color: #FFDD99;
        --footer-bottom-color: #222222;
        --transparent-background: #2f2f2fdd;
        --pill-color: #111;
    }
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

p {
    margin-bottom: 1em;
}

ul,
ol {
    margin: 1em 0 1em 3em;
    list-style: numbers;
}

ul ul {
    list-style: lower-alpha;
}

li {
    margin-bottom: 1em;
    font-size: 95%;
}

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

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: fixed;
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    background: var(--accent-color);
    color: #fff;
    z-index: 2000;
    text-decoration: none;
    border-radius: 4px;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   NAVIGATION / MENU
   ========================================================================== */

/* Menu container - off canvas for mobile, permanent for desktop */
#menu-container {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(86vw, 360px);
    background-color: var(--menu-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    transform: translateX(-100%);
    transition: transform var(--transition-speed) ease, width var(--transition-speed) ease;
    overflow-y: scroll;
    overflow-x: hidden;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
}

/* Ensure menu content scrolls properly */
#menu-container .menu-content {
    overflow: visible;
    height: auto;
}

#menu-container.open {
    transform: translateX(0);
}

#menu-container.closed {
    transform: translateX(-100%);
}

body.menu-open {
    overflow: hidden;
}

/* Desktop: menu always visible, collapse to icon only */
@media (min-width: 768px) {
    #menu-container {
        transform: translateX(0);
        width: var(--sidebar-width);
        overflow-y: auto;
        transition: width var(--transition-speed) ease;
    }
    
    #menu-container.open,
    #menu-container.closed {
        transform: translateX(0);
    }
    
    #menu-container.closed {
        width: 0;
        background: transparent;
        overflow: hidden;
        box-shadow: none;
        padding: 0;
    }
    
    #menu-container.closed .menu-content {
        display: none;
    }
    
    #menu-container .close-menu {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 10;
        display: flex;
    }
    
    #menu-container.closed .close-menu {
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1001;
        background: none;
    }
    
    #menuOverlay {
        display: none;
    }
    
    .menu-open-btn {
        display: none;
    }
}

/* Mobile: full screen menu */
@media (max-width: 767px) {
    #menu-container {
        width: 100vw;
    }
    
    #menu-container.open {
        width: 100vw;
    }
    
    #menu-container .close-menu {
        position: absolute;
        top: 12px;
        right: 12px;
        margin-top: 0;
    }
    
    .menu-overlay {
        z-index: 950;
    }
}

/* Menu overlay for mobile */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
}

.menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.page-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main h1 {
    text-align: center;
}

main {
    flex: 1;
    padding: 40px;
    max-width: 1140px;
    margin: 0 auto;
    width: 100%;
}

/* Desktop layout with sidebar offset */
@media (min-width: 768px) {
    body {
        display: flex;
    }
    
    #menu-container {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: var(--sidebar-width);
        transform: none;
        z-index: 1000;
    }
    
    #menu-container.closed {
        width: 0;
        background: transparent;
        overflow: visible;
        box-shadow: none;
        padding: 0;
    }
    
    .page-layout {
        margin-left: var(--sidebar-width);
        flex: 1;
        min-height: 100vh;
        transition: margin-left var(--transition-speed) ease;
    }
    
    #menu-container.closed ~ .page-layout {
        margin-left: 0;
    }
    
    main,
    footer {
        width: 100%;
    }
}

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

footer {
    background-color: var(--menu-footer-color);
    padding: 0;
    width: 100%;
}

footer #footer-bottom {
    background: var(--footer-bottom-color);
}

footer .footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 300px));
    gap: 20px;
    padding: 20px 40px;
    text-align: center;
    justify-content: center;
}

@media (max-width: 768px) {
    footer .footer-grid {
        padding: 20px 24px;
        text-align: center;
    }
}

#footer-bottom {
    background: var(--footer-bottom-color);
    padding: 15px;
    text-align: center;
    font-size: 0.8rem;
}

/* ==========================================================================
   LOGO
   ========================================================================== */

.logo-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    transition: opacity var(--transition-speed);
}

.logo {
    width: 100%;
    max-width: 150px;
    height: auto;
    display: block;
}

/* ==========================================================================
   NAVIGATION COMPONENTS
   ========================================================================== */

.nav-section {
    margin-top: 20px;
}

.nav-section h3 {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-top: 10px;
    white-space: nowrap;
    text-align: center;
}

.nav-link {
    display: block;
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    text-align: center;
    transition: color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

button {
    background: none;
    border: none;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    padding: 8px;
    border-radius: 50%;

}

button:hover {
    background-color: var(--transparent-background);
    color: var(--text-color);
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    border: 1px solid var(--border-color);
    background: var(--transparent-background);
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.icon-btn:hover {
    transform: scale(1.05);
    background: var(--bg-color);
}

.icon-btn:active {
    transform: scale(0.95);
}

button a:hover {
    background-color: var(--transparent-background) !important;
    color: var(--text-color) !important;
}

   .toggle-btn {
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform var(--transition-speed) ease;
}

.toggle-btn:hover {
    transform: scale(1.05);
}

/* Floating button shared by mobile action buttons */
.floating-btn {
    position: fixed;
    width: 50px;
    height: 50px;
    background: var(--transparent-background);
    border: none;
    border-radius: 30%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 999;
    transition: transform var(--transition-speed) ease;
}

.floating-btn:hover {
    transform: scale(1.05);
}

.menu-open-btn {
    top: 20px;
    left: 20px;
    z-index: 1100;
    display: none;
}

.desktop-toggle,
.mobile-toggle {
    display: none;
}

.close-menu {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color var(--transition-speed) ease;
}

.close-menu:hover {
    background-color: rgba(0,0,0,0.05);
}

.close-menu .menu-icon-img {
    width: 24px;
    height: 24px;
}

.menu-icon-img {
    width: 32px;
    height: 32px;
}

/* Icon color adaptation */
@media (prefers-color-scheme: light) {
    .icon-img {
        filter: invert(1);
    }
    .menu-icon-img {
        filter: invert(1);
    }
}

/* Mobile button adjustments */
@media (max-width: 767px) {
    .menu-open-btn {
        top: auto;
        bottom: 20px;
        left: 20px;
        display: flex;
    }
    
    .menu-open-btn.floating-btn {
        position: fixed;
        z-index: 1100;
    }
    
    .menu-open-btn .menu-icon-img {
        width: 32px;
        height: 32px;
    }
}



/* ==========================================================================
   CONTENT
   ========================================================================== */

.content-wrapper {
    max-width: 1140px;
    margin: 0 auto;
    text-align: center;
}

.content-wrapper h1 {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.content-wrapper p {
    line-height: 2;
}

.content-wrapper a {
    color: var(--link-color);
    text-decoration: underline;
}

.content-wrapper a:hover,
.content-wrapper a:focus {
    color: var(--accent-color);
}

/* Scroll to top button */
#scrollTopBtn {
    bottom: 20px;
    right: 20px;
    display: none;
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.left-text {
    text-align: left;
}

.page-header {
    border-bottom: 2px solid currentColor;
    margin-bottom: 2rem;
}

.zoomable {
    cursor: zoom-in;
}

.clickable {
    cursor: pointer;
}

/* Pill utility */
.pill {
    align-items: center;
    background: var(--accent-color-secondary);
    color: var(--pill-color);
    padding: var(--pill-padding-y) var(--pill-padding-x);
    border-radius: var(--pill-radius);
    border: 1px solid var(--pill-border);
    font-size: 0.875rem;
    line-height: 1.3;
    white-space: nowrap;
    justify-self: start;
}

/* Hide empty footer/menu fallback */
footer:empty,
#menu-container:empty {
    display: none !important;
}

/* Image Zoom Lightbox */
.image-zoom-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.image-zoom-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.image-zoom-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-zoom-img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    display: block;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border-radius: 4px;
}

.image-zoom-close {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-color: var(--accent-color);
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .image-zoom-overlay,
    .image-zoom-overlay.is-open {
        transition: none !important;
    }
}