:root {
    --bg-color: #F5F5F7;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --accent-blue: #0071E3;

    /* Glass Frame Config */
    --glass-bg: #FFFFFF;
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow:
        0 4px 24px rgba(0, 0, 0, 0.04),
        0 12px 48px rgba(0, 0, 0, 0.06);
}

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

a {
    text-decoration: none;
    color: inherit;
}

html {
    scroll-behavior: smooth;
    background-color: #F8F8FA;
    /* Match base gradient color for overscroll consistency */
    height: 100%;
    /* Ensure full height */
    overflow-x: hidden;
}

body {
    background-color: transparent;
    /* Allow mesh to show */
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    line-height: 1.4;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
    min-height: 100%;
    /* Ensure body covers html */
}

/* 1. AMBIENT LIVING LIGHT BACKGROUND */
/* 1. DYNAMIC GLASS MESH GRADIENT */
body::before {
    content: '';
    position: fixed;
    /* Center the oversized background */
    top: -10%;
    left: -10%;
    /* Extend off screen to prevent cut-off */
    width: 120%;
    height: 120vh;
    height: 120dvh;
    /* Ensure no scrollbars */
    z-index: -2;
    background-color: #F8F8FA;
    /* Base Color */

    /* STATIC GLASS MESH GRADIENT */
    background-image:
        radial-gradient(at 0% 0%, rgba(180, 210, 255, 0.5) 0%, transparent 50%),
        radial-gradient(at 100% 0%, rgba(220, 200, 255, 0.4) 0%, transparent 50%),
        radial-gradient(at 100% 100%, rgba(180, 255, 230, 0.4) 0%, transparent 50%),
        radial-gradient(at 0% 100%, rgba(255, 220, 200, 0.4) 0%, transparent 50%);

    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;

    /* Important for mobile - keeps it fixed without scroll issues */
    will-change: transform;
    pointer-events: none;
    /* Ensure no interaction */
    opacity: 1;
}

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

figure {
    margin: 0;
    padding: 0;
    display: block;
}

figcaption {
    display: none;
    /* Fallback if sr-only fails */
}

/* Override display:none for sr-only if needed, but for now strict hiding is safer given user reaction */
.gallery-item figcaption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

img {
    display: block;
    width: 100%;
    height: auto;
}

/* Optimize off-screen gallery images (but not slideshow) */
.gallery-item {
    content-visibility: auto;
    contain-intrinsic-size: 1px 300px;
    /* Estimate height to prevent scrollbar jumping */
}

.gallery-item img {
    /* removed auto content-visibility from img as it's better on the container */
    display: block;
    width: 100%;
    height: auto;
}

/* PROGRESSIVE IMAGE LOADING - Simple Fade-in (GPU optimized) */
.gallery-item img {
    opacity: 1;
    will-change: opacity;
    /* Prevent CLS by reserving space with aspect-ratio */
    aspect-ratio: var(--img-aspect, 1.5);
    object-fit: cover;
    background: #f0f0f0;
}

.gallery-item img.loaded {
    aspect-ratio: auto;
    /* Allow natural aspect once loaded */
    object-fit: contain;
    background: transparent;
}

/* NAV - Frosted Glass */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: center;

    /* Hide backdrop-filter edge artifacts */
    overflow: hidden;

    /* Clean, straight glass border */
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);

    /* Entrance Animation */
    animation: fadeDown 0.5s ease-out forwards;
}

/* Glass effect layer - behind text */
.main-nav::before {
    content: '';
    position: absolute;
    top: -20px;
    /* Extend upward to hide filter distortion edge */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;

    /* LIQUID GLASS EFFECT - Apple style */
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px) saturate(180%);
    -webkit-backdrop-filter: blur(4px) saturate(180%);
    filter: url(#liquid-glass);
}

@keyframes fadeDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-weight: 600;
    font-size: 17px;
    /* Increased from 14px */
    color: var(--text-primary);
    display: flex;
    gap: 6px;
    align-items: center;
    opacity: 1;
    /* Removed opacity for more impact */
    transition: color 0.6s ease, text-shadow 0.6s ease;
}

.nav-brand img {
    height: 38px;
    /* Larger as requested */
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 28px;
    list-style: none;
}

.nav-menu li {
    display: flex;
    align-items: center;
}

.nav-menu a {
    font-size: 12px;
    color: var(--text-secondary);
    transition: color 0.6s ease, text-shadow 0.6s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--text-primary);
}

/* Adaptive nav text colors - maintains hierarchy */
.nav-brand.nav-text-light {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Secondary nav links get softer white to maintain hierarchy */
.nav-menu a.nav-text-light {
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 0, 0, 0.3);
}

.nav-menu a.nav-text-light:hover,
.nav-menu a.nav-text-light.active {
    color: #fff;
}

/* Nav Icons (social links) - Flex container for key alignment */
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 17px;
    /* Match icon size */
}

.nav-icon svg {
    width: 17px;
    height: 17px;
    margin-top: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.nav-icon:hover svg {
    opacity: 1;
}

.nav-icon.nav-text-light svg {
    fill: rgba(255, 255, 255, 0.95);
}

/* Mobile Instagram - hidden on desktop, shown on mobile */
.mobile-instagram {
    display: none;
}

/* Light mode for mobile elements (when scrolled on light backgrounds) */
.mobile-menu-btn.nav-text-light {
    color: rgba(255, 255, 255, 0.95);
}

.mobile-instagram.nav-text-light {
    color: rgba(255, 255, 255, 0.95);
}

/* PAGE */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 24px 100px;
}

.page-header {
    text-align: center;
    margin-bottom: 80px;
}

/* 2. HEADER ENTRANCE ANIMATIONS */
.page-title {
    font-size: 56px;
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 12px;

    /* Staggered Entrance */
    opacity: 0;
    animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

.page-subtitle {
    font-size: 21px;
    line-height: 1.4;
    font-weight: 400;
    color: var(--text-secondary);

    /* Staggered Entrance */
    opacity: 0;
    animation: fadeSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

@keyframes fadeSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* FILTER BAR */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
}

.filter-btn.active {
    color: #fff;
    background: var(--text-primary);
}

/* LAYOUT */
.masonry-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.masonry-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
    min-width: 0;
}

/* APPLE "LIQUID GLASS" FRAME */

.gallery-item {
    position: relative;
    cursor: pointer;
    border-radius: 18px;
    contain: layout style;
    padding: 12px;

    /* Clean straight glass border (matching nav) */
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.08),
        0 8px 32px rgba(0, 0, 0, 0.06),
        0 16px 48px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.15);

    /* Start invisible, fade in with image */
    opacity: 0;
    transform: translateY(8px);

    /* Quick, smooth fade-in */
    transition:
        transform 0.25s ease-out,
        opacity 0.25s ease-out,
        box-shadow 0.3s ease,
        border-color 0.3s ease;

    overflow: hidden;
    z-index: 1;
    /* Establish stacking context */

    /* Default Refraction Position (Center) */
    --rx: 50%;
    --ry: 50%;
}

/* LIQUID GLASS BACKGROUND LAYER */
.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 18px;

    /* LIQUID GLASS EFFECT - Apple style */
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px) saturate(180%);
    -webkit-backdrop-filter: blur(4px) saturate(180%);
    filter: url(#liquid-glass);
}

/* 
   DYNAMIC REFRACTION LAYER 
   - Replaces the static top sheen with a dynamic radial flare 
   - Uses --rx and --ry updated by JS
*/
.gallery-item::before {
    content: '';
    position: absolute;
    inset: 0;

    /* REFINED REFRACTION:
       - Lower opacity (0.25) for subtlety
       - Larger spread (70%) for "satisfying" smoothness
    */
    background: radial-gradient(circle at var(--rx) var(--ry),
            rgba(255, 255, 255, 0.25) 0%,
            rgba(255, 255, 255, 0.0) 70%);

    opacity: 0;
    transition: opacity 0.5s ease;
    /* Slower fade for smoothness */
    pointer-events: none;
    z-index: 20;
    mix-blend-mode: overlay;
}

/* Reveal refraction on hover */
.gallery-item:hover::before {
    opacity: 1;
}

/* Interaction State Class */
.gallery-item.interactive {
    transition: none !important;
    z-index: 10;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

.gallery-item img {
    border-radius: 10px;
    display: block;
    filter: saturate(1.02);
    will-change: transform;
}

.gallery-item.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .masonry-wrapper {
        gap: 20px;
    }

    .masonry-column {
        gap: 20px;
    }

    .page-title {
        font-size: 40px;
    }
}

@media (max-width: 600px) {
    .masonry-wrapper {
        flex-direction: column;
    }

    .masonry-column {
        width: 100%;
    }
}

/* LIGHTBOX */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(40px);
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
    animation: fadeUp 0.3s ease;
}

.lightbox-content {
    /* FIX: Constrain by viewport but allow natural aspect ratio */
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;

    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.close {
    position: absolute;
    top: 24px;
    right: 32px;
    width: 36px;
    height: 36px;
    background: rgba(230, 230, 235, 0.8);
    border-radius: 50%;
    color: #1D1D1F;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.close:hover {
    background: #e5e5ea;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

footer {
    text-align: center;
    padding: 80px 24px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========================================= */
/* CONTACT FORM */
/* ========================================= */

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    text-align: left;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    transition: all 0.2s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386868B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-btn {
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--text-primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.submit-btn:active {
    transform: translateY(0);
}

/* ========================================= */
/* CTA BUTTON GROUP */
/* ========================================= */

.cta-group {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 32px 0;
}

.cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.cta-btn--primary {
    color: #fff;
    background: var(--text-primary);
}

.cta-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.cta-btn--secondary {
    color: var(--text-primary);
    background: transparent;
    border: 1.5px solid var(--text-primary);
}

.cta-btn--secondary:hover {
    background: var(--text-primary);
    color: #fff;
    transform: translateY(-2px);
}

/* ========================================= */
/* CINEMATIC STICKY STACK ("THE DECK") */
/* ========================================= */

body:has(.slideshow-container) {
    overflow-y: auto;
    overflow-x: hidden;
    background: #000;
    /* Black background to eliminate gaps */
}

body:has(.slideshow-container)::before {
    display: none;
    /* Hide gradient background on slideshow */
}

.slideshow-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 300;
    height: 52px;

    /* GLASS EFFECT - Same as main nav */
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);

    /* Smooth hide/show transition */
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.slideshow-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px) saturate(180%);
    -webkit-backdrop-filter: blur(4px) saturate(180%);
}

.slideshow-nav.nav-hidden {
    transform: translateY(-100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.slideshow-nav .nav-brand,
.slideshow-nav .nav-menu a {
    /* Default to white text for black background */
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.slideshow-nav .nav-menu a:hover,
.slideshow-nav .nav-menu a.active {
    color: #fff;
}

/* Dark mode - dark text for light backgrounds */
.slideshow-nav.nav-dark-mode .nav-brand,
.slideshow-nav.nav-dark-mode .nav-menu a {
    color: var(--text-primary);
    text-shadow: none;
}

.slideshow-nav.nav-dark-mode .nav-menu a:hover,
.slideshow-nav.nav-dark-mode .nav-menu a.active {
    color: var(--text-primary);
}

.slideshow-container {
    width: 100%;
    /* Add top padding to start content below nav */
    padding-top: 52px;
}

.stack-item {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: transparent;
    will-change: transform;
    margin: 0;
    padding: 0;
}

/* LANDSCAPE: Full width, seamless */
.stack-item.landscape {
    height: auto;
}

.stack-item.landscape img {
    width: 100%;
    height: auto;
    display: block;
}

/* PORTRAIT: Full width, seamless */
.stack-item.portrait {
    height: auto;
}

.stack-item.portrait img {
    width: 100%;
    height: auto;
    display: block;
}

/* Base img styles */
.stack-item img {
    display: block;
    will-change: transform, filter;
    transform: translateZ(0);
}

/* ========================================= */
/* SLIDESHOW PLAY/PAUSE CONTROLS */
/* ========================================= */

.slideshow-control-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 150;
    width: 56px;
    height: 56px;
    padding: 0;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.slideshow-control-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.slideshow-control-btn svg {
    width: 28px;
    height: 28px;
}

.slideshow-control-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ========================================= */
/* MOBILE NAVIGATION */
/* ========================================= */

.mobile-nav-overlay {
    display: none;
    /* Hidden by default on desktop */
}

.mobile-menu-btn {
    display: none;
    /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    z-index: 201;
    /* Must be above overlay (200) */
    padding: 10px;
    color: var(--text-primary);
    /* Ensure icon inherits correct color */
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-primary);
    stroke-width: 2;
    stroke-linecap: round;
}

/* Mobile Breakpoint */
@media (max-width: 768px) {

    /* Black bar above nav to match phone status bar */
    .main-nav::after {
        content: '';
        position: absolute;
        top: -100px;
        left: 0;
        right: 0;
        height: 100px;
        background: #000;
        z-index: -1;
    }

    .nav-container {
        padding: 0 20px;
    }

    .mobile-menu-btn {
        display: block;
    }

    /* Hide original menu in navbar to allow overlay replacement */
    .nav-menu {
        display: none;
    }

    /* Mobile nav layout: brand on left, instagram + hamburger on right */
    .nav-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Show mobile Instagram icon - positioned to left of hamburger */
    .mobile-instagram {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        margin-right: 0;
        padding: 10px 4px 10px 10px;
        /* Less padding on right to get closer to hamburger */
        /* Match hamburger padding */
        color: var(--text-secondary);
        transition: color 0.2s ease;
        order: 1;
    }

    .mobile-instagram:hover {
        color: var(--text-primary);
    }

    .mobile-instagram svg {
        width: 18px;
        height: 18px;
        margin-top: -2px;
        /* Align vertically with hamburger lines */
    }

    /* Hamburger stays on right */
    .mobile-menu-btn {
        order: 2;
    }

    /* NEW Root-Level Glass Overlay */
    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(253, 253, 255, 0.98);
        padding-top: 60px;
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);

        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 40px;

        /* Hidden state */
        opacity: 0;
        pointer-events: none;
        transform: scale(0.95);
        transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
        will-change: transform, opacity;
        z-index: 200;
    }

    /* Active State */
    .mobile-nav-overlay.active {
        opacity: 1;
        pointer-events: all;
        transform: scale(1);
    }

    .mobile-nav-overlay ul {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 32px;
        text-align: center;
    }

    .mobile-nav-overlay a {
        font-size: 28px;
        font-weight: 500;
        color: var(--text-primary);
        text-decoration: none;
        display: block;
    }

    /* Larger Instagram icon in mobile overlay */
    .mobile-nav-overlay .nav-icon svg {
        width: 32px;
        height: 32px;
    }
}