/* ==========================================================================
   Fonts — Playfair Display & Tex Gyre Adventor
   ========================================================================== */
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/playfair/PlayfairDisplay-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/playfair/PlayfairDisplay-Bold.woff2') format('woff2');
}

@font-face {
    font-family: 'Tex Gyre Adventor';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/gyreadventor/texgyreadventor-regular-webfont.woff') format('woff');
}
@font-face {
    font-family: 'Tex Gyre Adventor';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/gyreadventor/texgyreadventor-bold-webfont.woff') format('woff');
}

/* ==========================================================================
   Reset & Variables
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --color-black: #000;
    --color-white: #fff;
    --color-text: #333;
    --color-pink: #ff99c0;
    --color-green: #3d9179;
    --color-copy-light: #feffd7;
    --header-height: 64px;
    --transition-fast: 200ms ease;
    --transition-medium: 400ms ease;
    --font-serif: 'Playfair Display', 'Times New Roman', serif;
    --font-sans: 'Tex Gyre Adventor', 'Futura', 'Century Gothic', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-white);
    pointer-events: none; /* Re-enabled on interactive sections below */
}

h1, h2, h3, p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.is-italic { font-style: italic; }

/* ==========================================================================
   Shared Layout & Structural Groupings
   ========================================================================== */
.site-header,
.site-footer,
#about,
#contact,
#lightbox-dialog,
.project-detail,
.page--interior {
    pointer-events: auto;
}

/* Base section layers */
.about,
.contact,
.site-footer,
.project-not-found,
.project-detail {
    position: relative;
    z-index: 1;
}

/* 1200px Containers */
.site-header__inner,
.about__inner,
.site-footer__inner,
.project-detail__inner {
    max-width: 1200px;
    margin: 0 auto;
}

/* 600px Containers */
.contact__inner,
.project-not-found__inner {
    max-width: 600px;
    margin: 0 auto;
}

/* Shared Grid Layouts */
.about__inner,
.project-detail__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
}
.about__inner { align-items: center; }
.project-detail__inner { align-items: start; }

/* Shared Section Headings */
.about__text h2,
.contact__inner h2 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 32px;
   
}

.project-not-found h1 {
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Shared Text Links */
.project-not-found__back,
.project-detail__description a,
.project-detail__back a {
    border-bottom: 1px solid var(--color-text);
}
.project-detail__description a:hover,
.project-detail__back a:hover {
    opacity: 0.7;
}

/* ==========================================================================
   Header & Nav
   ========================================================================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 100;
    color: var(--color-copy-light);
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.site-header[data-state="light"] {
    color: var(--color-text);
}

.site-header--solid,
.site-header--solid[data-state="light"] {
    background: var(--color-pink);
    color: var(--color-copy-light);
    border-bottom: 1px solid #3d9179;
}

.site-header__inner {
    height: 100%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-header__logo {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 34px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.site-nav__list {
    display: flex;
    align-items: center;
    gap: 28px;
}

.site-nav__item--dropdown { position: relative; }

.site-nav__link {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 8px 0;
}

.site-nav__dropdown-toggle { display: inline-flex; align-items: center; }

.site-nav__dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    padding: 12px 0;
    margin-top: 8px;
    background: var(--color-green);
    color: var(--color-copy-light);
    border: none;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast);
}

.site-nav__item--dropdown.is-open .site-nav__dropdown {
    opacity: 1;
    visibility: visible;
}

.site-nav__dropdown-link {
    display: block;
    padding: 6px 20px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--color-copy-light);
}

.site-nav__dropdown-link:hover {
    background: var(--color-copy-light);
    color: var(--color-green);
}

.site-nav__dropdown-empty {
    padding: 6px 20px;
    font-size: 14px;
    opacity: 0.6;
}

.site-nav__item--social {
    display: flex;
    align-items: center;
    margin-left: 12px;
}

.site-nav__social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.site-nav__social-icon {
    display: block;
    width: auto;
    height: 16px;
    max-width: 34px;
    object-fit: contain;
}

.site-header__hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    z-index: 101;
}

.site-header__hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: currentColor;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.site-header__hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header__hamburger.is-active span:nth-child(2) { opacity: 0; }
.site-header__hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   Splash Section (Maintained)
   ========================================================================== */
.splash {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: transparent;
    pointer-events: none;
}

.splash__canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    display: block;
    background: var(--color-pink);
    pointer-events: auto;
}

.splash__fallback {
    position: relative;
    z-index: 1;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    padding: calc(var(--header-height) + 24px) 24px 24px;
    overflow-y: auto;
    color: var(--color-copy-light);
    pointer-events: auto;
}

.splash__fallback[hidden] { display: none; }
.splash__fallback-empty { grid-column: 1 / -1; text-align: center; opacity: 0.7; }

.splash__fallback-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 8px;
    transition: border-color var(--transition-fast);
}

.splash__fallback-item:hover { border-color: var(--color-white); }

.splash__fallback-item img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #111;
}

.splash__fallback-caption {
    font-size: 12px;
    letter-spacing: 0.02em;
}

.splash-filter {
    position: absolute;
    right: 24px;
    bottom: 24px;
    z-index: 50;
    color: var(--color-copy-light);
    pointer-events: auto;
}

@media (max-width: 780px) {
    .splash-filter {
        bottom: auto;
        top: calc(100vmin - 52px);
    }
}

.splash-filter__toggle {
    border: none;
    padding: 10px 18px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--color-green);
    color: var(--color-copy-light);
    border-radius: 8px;
}

.splash-filter__panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    min-width: 220px;
    padding: 16px;
    background: var(--color-green);
    border-radius: 8px;
}

.splash-filter__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    margin: 0 0 10px;
    color: var(--color-copy-light);
}

.splash-filter__options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.splash-filter__option {
    border: none;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--color-pink);
    color: var(--color-copy-light);
    border-radius: 6px;
    transition: opacity var(--transition-fast);
}

.splash-filter__option.is-active { opacity: 0.6; }

.splash-filter__reset {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 4px 8px;
    border: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: var(--color-copy-light);
    color: var(--color-pink);
    border-radius: 6px;
    transition: opacity var(--transition-fast);
}

.splash-filter__reset:hover { opacity: 0.8; }

/* ==========================================================================
   About Section
   ========================================================================== */
.about {
    background: #feffd7;
    color: var(--color-text);
    padding: 80px 24px 0 24px;
}

.about__model {
    align-self: stretch;
    width: 100%;
    min-height: 220px;
    position: relative;
    overflow: hidden;
}

.about__text {
    padding-bottom: 40px;
}
#avatar-canvas {
    display: block;
    width: 100%;
    height: 100%;
}


/* ==========================================================================
   Contact & Footer
   ========================================================================== */
.contact {
    background: var(--color-green);
    color: var(--color-copy-light);
    padding: 100px 24px;
    text-align: center;
}

.contact__email {
    font-size: 16px;
    border-bottom: 1px solid var(--color-copy-light);
}

.site-footer {
    background: var(--color-pink);
    color: var(--color-copy-light);
    padding: 24px;
    font-size: 16px;
}

.site-footer__inner { text-align: right; }

.site-footer--dark {
    background: var(--color-green);
    color: var(--color-copy-light);
}

/* ==========================================================================
   Interior Pages
   ========================================================================== */
.page--interior {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.page--interior main { flex: 1; }

.project-detail__header-strip {
    height: var(--header-height);
    background: var(--color-green);
}

.project-not-found {
    background: var(--color-white);
    padding: 120px 24px;
    text-align: center;
}

.project-not-found__back {
    display: inline-block;
    margin-top: 16px;
}

.project-detail {
    background: var(--color-white);
    padding: 60px 24px 100px;
}

/* --- Left Column: Media --- */
.project-detail__media {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.project-detail__embeds {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.project-detail__embed-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.project-detail__embed-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.project-detail__audio { display: flex; flex-direction: column; gap: 20px; }
.project-detail__audio-track { display: flex; flex-direction: column; gap: 6px; }

.project-detail__audio-title {
    font-size: 12px;
    letter-spacing: 0.03em;
    margin: 0;
}

.project-detail__audio-player {
    width: 100%;
    height: 36px;
    border: 1px solid var(--color-text);
    border-radius: 0;
    background: var(--color-white);
}

.project-detail__gallery { display: flex; flex-direction: column; gap: 12px; }

.project-detail__gallery-item {
    display: block;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    transition: border-color var(--transition-fast);
    cursor: pointer;
}

.project-detail__gallery-item:hover { border-color: var(--color-text); }

.project-detail__gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #f5f5f5;
}

.project-detail__gallery-caption { display: none; }
.project-detail__no-media { font-size: 13px; opacity: 0.6; margin: 0; }

/* --- Right Column: Metadata & Text --- */
.project-detail__info { display: flex; flex-direction: column; gap: 4px; }

.project-detail__title {
    font-family: var(--font-serif);
    font-weight: 800;
    font-size: 32px;
    line-height: 1.2;
    letter-spacing: 0.02em;
    margin: 0 0 2px;
}

.project-detail__short-desc { font-size: 14px; line-height: 1.4; margin: 0; }
.project-detail__year { font-size: 13px; letter-spacing: 0.03em; opacity: 0.7; margin: 0 0 4px; }

.project-detail__divider {
    border: none;
    border-bottom: 1px dotted var(--color-text);
    margin: 12px 0;
}

.project-detail__description { font-size: 15px; line-height: 1.6; }
.project-detail__description p { margin: 0 0 1.4em; }
.project-detail__description p:last-child { margin-bottom: 0; }
.project-detail__description em, .project-detail__description i { font-style: italic; }
.project-detail__description strong, .project-detail__description b { font-weight: 700; }
.project-detail__back { margin-top: 24px; font-size: 13px; }

/* ==========================================================================
   Related Projects
   ========================================================================== */
.related-projects {
    background: var(--color-green);
    color: var(--color-copy-light);
    padding: 80px 24px;
}

.related-projects__inner {
    max-width: 1200px;
    margin: 0 auto;
}

.related-projects__heading {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 28px;
    letter-spacing: 0.02em;
    text-align: center;
    margin: 0 0 40px;
}

.related-projects__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.related-projects__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: opacity var(--transition-fast);
}

.related-projects__item:hover {
    opacity: 0.8;
}

.related-projects__thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(254, 255, 215, 0.3);
}

.related-projects__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Spritesheet: show only the first frame by scaling image width
   to sprite_cols × container width; overflow:hidden clips the rest */
.related-projects__thumb--spritesheet img {
    width: calc(var(--sprite-cols, 3) * 100%);
    max-width: none;
    height: auto;
    object-fit: unset;
    object-position: 0 0;
}

.related-projects__title {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    margin: 0;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */
.lightbox {
    border: none;
    padding: 0;
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    color: var(--color-white);
}

.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.92); }

.lightbox__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 48px;
}

.lightbox__close {
    position: absolute;
    top: 16px;
    right: 24px;
    font-size: 32px;
    line-height: 1;
    color: var(--color-white);
    z-index: 10;
    padding: 8px;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.lightbox__close:hover { opacity: 1; }

.lightbox__image {
    display: block;
    max-width: 100%;
    max-height: calc(100% - 48px);
    object-fit: contain;
    cursor: pointer;
}

.lightbox__caption {
    position: absolute;
    bottom: 16px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 18px;
    color: var(--color-white);
    opacity: 0.8;
    padding: 0 24px;
    pointer-events: none;
}

/* ==========================================================================
   Responsive (Unified Media Query)
   ========================================================================== */
@media (max-width: 780px) {
    /* Mobile: square WebGL canvas. */
    #webgl-canvas {
        width: 100vmin !important;
        height: 100vmin !important;
    }

    .site-header__inner { padding: 0 16px; }

    .site-header__hamburger { display: flex; }

    .site-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: min(384px, 96vw);
        height: 100vh;
        padding: calc(var(--header-height) + 16px) 24px 24px;
        background: #3d9179;
        color: #feffd7;
        transform: translateX(100%);
        transition: transform var(--transition-medium);
        z-index: 99;
    }

    .site-nav.is-open { transform: translateX(0); }

    .site-nav__list {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        font-size: 18.9px;
    }

    .site-nav__link {
        font-size: 18.9px;
    }

    .site-nav__dropdown {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        display: none;
        background: transparent;
        color: inherit;
        border: none;
        margin: 8px 0 0;
        padding: 0 0 0 12px;
    }

    .site-nav__item--dropdown.is-open .site-nav__dropdown { display: block; }

    .site-nav__dropdown-link {
        font-size: 18.9px;
    }

    .site-nav__dropdown-link:hover {
        background: transparent;
        color: #feffd7;
        opacity: 0.7;
    }

    .site-nav__dropdown-empty {
        font-size: 18.9px;
    }

    /* Social icons horizontal row in mobile nav */
    .site-nav__item--social {
        display: inline-flex;
        margin-left: 0;
        margin-right: 16px;
    }

    /* About adjustments */
    .about__inner {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    .about__inner .about__model { order: -1; }

    /* Project Detail adjustments */
    .project-detail { padding: 40px 16px 80px; }
    .project-detail__inner { grid-template-columns: 1fr; gap: 40px; }
    .project-detail__title { font-size: 30px; }
    .project-detail__short-desc { font-size: 21px; }
    .project-detail__year { font-size: 19.5px; }
    .project-detail__description { font-size: 18.2px; }

    /* Related Projects — stack vertically on mobile */
    .related-projects { padding: 60px 16px; }
    .related-projects__heading { font-size: 22px; margin: 0 0 28px; }
    .related-projects__grid { grid-template-columns: 1fr; gap: 24px; }
    .related-projects__title { font-size: 14px; }

    /* Lightbox adjustments */
    .lightbox__inner { padding: 24px; }
    .lightbox__close { top: 8px; right: 12px; font-size: 28px; }
}