:root {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --accent-color: #00adb5;
    --card-bg: #1e1e1e;
    --nav-bg: rgba(18, 18, 18, 0.65); 
    --container-bg: rgba(18, 18, 18, 0.95); 
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --header-height: 85px; 
}

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

/* Master Canvas Engine - Backdrops cycle here to prevent layout clipping layers */
body {
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    
    /* Native Background Engine Parameters */
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: fixed; 
    transition: background-image 1.2s ease-in-out;
}

/* Header Component */
header {
    background-color: var(--nav-bg);
    padding: 0 2rem; 
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative; 
    z-index: 99999;       
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.logo-area h1 {
    font-size: 1.8rem;
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.9);
}

.logo-area .subtitle {
    font-size: 0.9rem;
    color: #cccccc;
    font-style: italic;
    margin-top: 0.2rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* Navigation Layout Engine */
#main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

#main-nav li {
    position: relative;
}

#main-nav a, #main-nav span {
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    padding: 0.5rem 0;
    display: block;
    transition: color 0.2s;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

#main-nav a:hover, #main-nav span:hover {
    color: var(--accent-color);
}

/* Submenu Dropdown Popups (Desktop Only) */
#main-nav li ul {
    display: none;
    position: absolute;
    top: 100%;
    right: 0; 
    background-color: var(--card-bg);
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.6);
    border-radius: 4px;
    padding: 0.5rem 0;
    flex-direction: column;
    gap: 0;
    z-index: 100000; 
}

#main-nav li ul ul {
    right: 100%; 
    top: 0;
}

#main-nav li:hover > ul {
    display: flex; 
}

#main-nav li ul li a, #main-nav li ul li span {
    padding: 0.6rem 1.2rem;
    text-shadow: none;
    white-space: nowrap; 
}

#main-nav li ul li a:hover, #main-nav li ul li span:hover {
    background-color: #2a2a2a;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.8rem;
    cursor: pointer;
}

/* Core Content Window Shell (Desktop Only) */
main {
    flex: 1;
    padding: 0;
    max-width: 1400px;
    width: calc(100% - 4rem);
    
    position: fixed; 
    top: 120px; 
    left: 50%;
    transform: translateX(-50%);
    
    height: calc(100vh - 160px);
    z-index: 5000; 
    overflow-y: auto; 
    pointer-events: none; 
    -webkit-overflow-scrolling: touch; 
}

/* Interactive Inner Framework Views */
#welcome-view, #gallery-view, #frame-view {
    pointer-events: auto;
}

/* Integrated Compact Instruction Box */
#welcome-view {
    max-width: 420px;
    width: 100%;
    margin: 0;
    
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    
    padding: 1.25rem;
    background-color: var(--container-bg);
    border-radius: 6px;
    border: 1px solid #2d2d2d;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    text-align: left;
    z-index: 5001;

    /* SMOOTH FADE TRANSITION PROPERTY */
    transition: opacity 1s ease-in-out, transform 1s ease-in-out;
}

/* AUTOMATED TIMER HELPER CLASS */
.fade-out {
    opacity: 0 !important;
    transform: translateY(20px); 
    pointer-events: none;        
}

#welcome-view h2 {
    font-size: 1.15rem;
    margin-bottom: 0.4rem;
    color: #fff;
}

#welcome-view p {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #bbb;
}

/* Interactive Presentation Shell Elements */
#frame-view {
    width: 100%;
    height: 100%; 
    background-color: var(--container-bg);
    border-radius: 8px;
    border: 1px solid #2d2d2d;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#content-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #121212; 
}

#gallery-view {
    width: 100%;
    min-height: 100%;
    background-color: var(--container-bg);
    border-radius: 8px;
    border: 1px solid #2d2d2d;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.hidden {
    display: none !important;
}

/* Fluid Adaptive Gallery Grid Layout */
#gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.gallery-card {
    background-color: var(--card-bg);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.5);
}

.gallery-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

/* Fullscreen Lightbox Modal Structure */
#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 200000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lightbox-img {
    max-width: 92%;
    max-height: 92%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--accent-color);
}

/* Mobile & Tablet Responsiveness Breakdown (Up to Wide Tablet Breakpoint) */
@media (max-width: 1366px) {
    header {
        position: relative;
        padding: 1.2rem 1.5rem;
        height: auto;
        z-index: 99999;
    }

    .menu-toggle {
        display: block;
    }

    #main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #121212;
        border-bottom: 1px solid #2d2d2d;
        z-index: 100000;
    }

    #main-nav.active {
        display: block;
    }

    #main-nav ul {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    #main-nav li a, #main-nav li span {
        padding: 0.8rem 1.5rem;
        border-bottom: 1px solid #1e1e1e;
        width: 100%;
        display: block;
    }

    /* MOBILE & TABLET NAVIGATION STACKING DEFINITION */
    #main-nav li ul {
        display: block !important; 
        position: static !important;
        box-shadow: none !important;
        padding-left: 1.5rem !important;
        background-color: rgba(255, 255, 255, 0.03) !important;
        border-radius: 0;
    }
    
    #main-nav li ul ul {
        position: static !important;
        padding-left: 1rem !important;
    }

    /* TOUCH DEVICE RELATIVE CANVAS SCROLLING PARAMETERS */
    main {
        width: calc(100% - 2rem);
        margin: 0 auto;
        position: relative; 
        top: 20px;
        left: 0;
        transform: none;
        height: auto; 
        min-height: calc(100vh - 140px);
        z-index: 5000;
        pointer-events: auto; 
    }

    #welcome-view {
        position: fixed;
        bottom: 1rem;
        right: 50%;
        transform: translateX(50%);
        width: calc(100% - 2rem);
        margin: 0 auto;
        padding: 1rem;
        z-index: 5001;
    }
    
    #gallery-view, #frame-view {
        padding: 1.5rem;
        min-height: auto !important;
        height: auto !important;
    }
}