@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

:root {
    --bg-color: #FFFFFF;
    --text-color: #000000;
    --font-serif: 'Lora', serif;
    --font-sans: 'Inter', sans-serif;
    --sidebar-width: 280px;
    --spacing-xl: 100px;
    --spacing-lg: 60px;
    --spacing-md: 30px;
    --spacing-sm: 15px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow: hidden;
    /* Prevent body scroll, use container scroll */
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.5;
}

/* Sidebar Layout */
.layout-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
}

aside#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    padding: var(--spacing-md);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-right: 1px solid transparent;
    /* Keeping it clean like Eric's */
}

aside#sidebar h1 {
    margin-bottom: var(--spacing-lg);
}

/* Thumbnails Grid */
.thumbnails-grid {
    display: none;
    /* Hidden by default */
    width: 100%;
    padding: 0 var(--spacing-lg) var(--spacing-lg);
    /* Top padding set via JS */
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-content: flex-start;
    overflow-y: auto;
    height: 100vh;
}

.thumbnail-item {
    cursor: pointer;
    height: 150px;
    /* Fixed height for rows */
    overflow: hidden;
}

.thumbnail-item img {
    height: 100%;
    width: auto;
    display: block;
    object-fit: contain;
    transition: transform 0.4s ease, filter 0.3s ease;
}

.thumbnail-item:hover img {
    transform: scale(1.05);
    filter: brightness(0.6);
}

.view-toggle-btn {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: none;
    border: 1px solid #000;
    padding: 8px 12px;
    cursor: pointer;
    margin-top: var(--spacing-md);
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: #000;
    color: #fff;
}

aside#sidebar .logo-link {
    display: block;
    width: 140px;
    /* Enlarged more as requested */
    height: auto;
    margin-bottom: var(--spacing-lg);
}

aside#sidebar .logo-link img {
    width: 100%;
    height: auto;
    filter: invert(0);
}

nav section {
    margin-bottom: var(--spacing-md);
}

nav h3 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--spacing-sm);
    color: #888;
}

nav ul {
    list-style: none;
}

nav ul li {
    margin-bottom: 8px;
    font-size: 0.85rem;
}

nav ul li a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

nav ul li a:hover {
    color: #e55a3d;
    /* Orange hover color */
    opacity: 1;
}

nav ul li a.active {
    color: #e55a3d;
    /* Orange active color */
    font-style: normal;
}

/* Gallery Controls (Top Center) */
.gallery-controls {
    position: fixed;
    top: var(--spacing-md);
    left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width)) / 2);
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 120px;
    /* Generous gap to match screenshot */
    font-size: 0.85rem;
    color: #888;
}

.thumbnail-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
}

.thumbnail-toggle:hover {
    color: #000;
}

.thumbnail-toggle svg {
    stroke: currentColor;
}

.gallery-nav {
    display: flex;
    align-items: center;
    gap: 30px;
    transition: opacity 0.2s ease;
}

.nav-btn {
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
    font-size: 1rem;
    letter-spacing: -2px;
}

.nav-btn:hover {
    color: #000;
}

.image-counter {
    min-width: 60px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Main Content Area */
main#content {
    flex-grow: 1;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    align-items: center;
    background: var(--bg-color);
    padding-left: 0;
    /* Remove padding to allow full frame */
}

/* Horizontal Gallery */
.horizontal-scroll-wrapper {
    display: flex;
    align-items: center;
    height: 100%;
}

.cover-pane {
    width: calc(100vw - var(--sidebar-width));
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.cover-pane img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.cover-pane img.active {
    opacity: 1;
    z-index: 10;
}

.gallery-pane {
    flex-shrink: 0;
    height: 75vh;
    margin-right: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.gallery-pane img {
    height: 100%;
    width: auto;
    display: block;
    object-fit: contain;
}

.gallery-pane .caption {
    margin-top: 12px;
    color: #888;
    font-size: 0.65rem;
    text-align: center;
}

/* Project Text Pane */
.text-pane {
    flex-shrink: 0;
    width: 400px;
    margin-right: var(--spacing-xl);
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.7;
}

.text-pane p {
    margin-bottom: 1.7em;
}

.text-pane p:last-child {
    margin-bottom: 0;
}

.text-pane h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    font-style: italic;
}

/* Story Pane for Aelafat */
.story-pane {
    flex-shrink: 0;
    width: 380px;
    margin-right: var(--spacing-xl);
    font-family: var(--font-serif);
    font-size: 0.85rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 75vh;
    max-height: 75vh;
    overflow-y: auto;
    padding-right: var(--spacing-md);
}

.story-pane p {
    margin-bottom: 1.6em;
}

.story-pane p:last-child {
    margin-bottom: 0;
}

.story-pane::-webkit-scrollbar {
    width: 4px;
}

.story-pane::-webkit-scrollbar-track {
    background: transparent;
}

.story-pane::-webkit-scrollbar-thumb {
    background: #d4d4d4;
    border-radius: 4px;
}

.story-pane::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* About Two Column */
.about-wrapper {
    display: flex;
    gap: var(--spacing-xl);
    padding-right: var(--spacing-xl);
    width: auto;
    margin-right: auto;
}

.bio-column {
    width: 300px;
    flex-shrink: 0;
}

.cv-column {
    width: 450px;
    flex-shrink: 0;
}

.cv-column h2 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    font-weight: 500;
}

.cv-column h2:first-child {
    margin-top: 0;
}

.cv-column ul {
    list-style: none;
    padding: 0;
    margin-bottom: var(--spacing-md);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* About Accordion / Expandable */
details.about-section>summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    user-select: none;
    border-bottom: 1px solid #eee;
    padding-bottom: var(--spacing-sm);
}

details.about-section>summary::-webkit-details-marker {
    display: none;
}

details.about-section>summary h2 {
    margin: 0;
    transition: color 0.2s ease;
}

details.about-section>summary:hover h2 {
    color: #e55a3d;
}

details.about-section>summary::before {
    content: '›';
    margin-right: 10px;
    font-size: 1.5rem;
    font-weight: 300;
    display: inline-block;
    transition: transform 0.2s ease;
    color: #888;
}

details.about-section[open]>summary::before {
    transform: rotate(90deg);
}

details.about-section h3 {
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
}

.portrait-small {
    width: 100%;
    object-fit: cover;
    object-position: top;
    margin-bottom: var(--spacing-md);
}

.ig-link {
    display: inline-block;
    margin-top: var(--spacing-md);
    font-size: 0.85rem;
    color: #e55a3d;
    text-decoration: none;
}

.ig-link:hover {
    text-decoration: underline;
}

/* About Scroll Box */
.about-scroll-box {
    width: 480px;
    max-height: 75vh;
    padding-right: var(--spacing-md);
    margin-right: var(--spacing-xl);
    flex-shrink: 0;
    overflow-y: auto;
}

.about-scroll-box.cv-box {
    width: max-content;
    padding-right: var(--spacing-xl);
}

.about-scroll-box.cv-box li {
    white-space: nowrap;
}

.cv-content h3 {
    margin-top: var(--spacing-md) !important;
    margin-bottom: var(--spacing-md) !important;
}

.cv-content h3:first-child {
    margin-top: 0 !important;
}

.cv-content ul.meta {
    margin-bottom: var(--spacing-md) !important;
}

.top-align-track {
    align-items: flex-start !important;
}

.about-scroll-box::-webkit-scrollbar {
    width: 4px;
}

.about-scroll-box::-webkit-scrollbar-track {
    background: transparent;
}

.about-scroll-box::-webkit-scrollbar-thumb {
    background: #d4d4d4;
    border-radius: 4px;
}

.about-scroll-box::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Experiments Expandable Menu */
.expandable-list {
    display: none;
}

.expandable-section.open .expandable-list {
    display: block;
}

.expand-toggle {
    cursor: pointer;
    position: relative;
}

.expand-toggle::before {
    content: '›';
    position: absolute;
    left: -12px;
    font-size: 1.1em;
    transition: transform 0.2s;
}

.expandable-section.open .expand-toggle::before {
    transform: rotate(90deg);
}


/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
/* Responsive Mobile Rebuild */
.mobile-menu-toggle {
    display: none;
    width: 25px;
    height: 18px;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    position: absolute;
    top: 25px;
    right: 20px;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #000000;
    /* Hardcode black so it never inherits a light color accidentally */
    border-radius: 2px;
}

@media (max-width: 900px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .layout-wrapper {
        flex-direction: column;
        height: auto;
        /* Allow layout wrapper to grow */
    }

    aside#sidebar {
        flex-direction: row;
        align-items: center;
        width: 100%;
        height: 70px;
        /* Fixed mobile header height */
        padding: 15px 20px;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        background: var(--bg-color);
        border-bottom: 1px solid #eee;
        border-right: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    aside#sidebar .logo-link {
        width: 60px;
        /* Scaled down logo to fit tighter mobile header */
        margin-bottom: 0;
    }

    aside#sidebar nav {
        display: none;
        /* Hidden by default behind hamburger */
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(255, 255, 255, 0.98);
        padding: var(--spacing-lg) var(--spacing-md);
        overflow-y: auto;
    }

    aside#sidebar.menu-open nav {
        display: block;
    }

    /* Change main content to vertical stack */
    main#content {
        height: auto;
        /* Let content dictate height */
        overflow: visible;
        /* Let the body handle the scrolling */
        padding: 70px var(--spacing-md) var(--spacing-xl) var(--spacing-md);
        /* Add padding around */
        display: block;
        /* Remove flex center */
    }

    .horizontal-scroll-wrapper {
        flex-direction: column;
        align-items: center;
        /* Center items in the column */
        height: auto;
        /* Let it grow vertically */
        gap: var(--spacing-lg);
        /* Add gap between stacked items */
        padding-top: var(--spacing-lg);
    }

    /* Resize panes for mobile vertical geometry */
    .gallery-pane {
        height: auto;
        /* Let image dictate height */
        width: 100%;
        /* Full width of container */
        margin-right: 0;
    }

    .gallery-pane img {
        width: 100%;
        /* Image takes full width */
        height: auto;
        /* Maintain aspect ratio */
    }

    .text-pane {
        width: 100%;
        box-sizing: border-box;
        /* Force padding inside the 100% width limit */
        margin-right: 0;
        margin-bottom: var(--spacing-md);
        padding: 0 var(--spacing-md);
        /* Restore explicit side padding */
        font-size: 0.9rem;
    }

    .text-pane h2 {
        text-align: center;
    }

    .story-pane {
        width: 100%;
        box-sizing: border-box;
        /* Force padding inside the 100% width limit */
        height: auto;
        /* Let text flow */
        max-height: none;
        /* Remove height constraint */
        margin-right: 0;
        margin-bottom: var(--spacing-md);
        overflow-y: visible;
        /* Remove internal scrollbar */
        padding: 0 var(--spacing-md);
        /* Restore explicit side padding */
    }

    .cover-pane {
        width: 100vw;
        height: calc(100vh - 70px);
        /* Keep cover full height */
        margin-left: calc(-1 * var(--spacing-md));
        /* Negate wrapper padding so cover touches edges */
    }

    /* Clean up Gallery Controls - Hide entirely on Mobile */
    .gallery-controls {
        display: none !important;
    }

    .thumbnail-toggle svg {
        display: none;
        /* Too complex for small UI element */
    }

    .thumbnail-toggle {
        font-size: 0.65rem;
    }

    /* Keep Bio/CV/Contact logic stacking vertically */
    .horizontal-scroll-wrapper.top-align-track {
        flex-direction: column;
        align-items: flex-start !important;
        padding: var(--spacing-md) 0;
        /* Remove side padding to match text blocks */
        gap: var(--spacing-md);
        height: auto;
    }

    .horizontal-scroll-wrapper.top-align-track .about-scroll-box {
        width: 100%;
        padding-right: 0;
        margin-right: 0;
        max-height: none !important;
        overflow-y: visible;
    }

    .about-wrapper {
        flex-direction: column;
        gap: var(--spacing-md);
        padding-right: 0;
        width: 100%;
    }

    .bio-column,
    .cv-column {
        width: 100%;
    }

    /* Scale Down Lightbox Elements */
    .lightbox-prev,
    .lightbox-next {
        font-size: 1.5rem;
        padding: 15px;
    }

    .lightbox-close {
        top: 15px;
        right: 15px;
    }
}

/* Lightbox */
#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#lightbox-img {
    max-width: 95vw;
    max-height: 90vh;
    height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2rem;
    cursor: pointer;
    color: #888;
}

.lightbox-close:hover {
    color: #000;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    cursor: pointer;
    color: #bbb;
    padding: 20px;
    user-select: none;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    color: #000;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

#lightbox-caption {
    position: absolute;
    bottom: 30px;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    color: #666;
    letter-spacing: 0.05em;
}