/* CSS Custom Properties for easier theming */
:root {
    --bg: #ffffff;
    --text: #000000;
    --accent-bg: rgba(0,0,0,0.05);
    --button-active-bg: #ffffff;
    --transition-fast: 180ms;
    --transition-slow: 420ms;
    --font-stack: Helvetica, Arial, sans-serif;
    --pad-h: 44px;
    /* Dynamic viewport unit fallback (updated via JS for mobile Chrome UI collapse) */
    --vh: 1vh;
}

body {
    margin: 0px; /* Remove extra margin */
    font-family: Helvetica, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Space between logo and button */
    align-items: center;
    height: calc(var(--vh) * 100); /* Accurate visual viewport height on mobile */
    min-height: 100dvh; /* Modern browsers dynamic viewport */
    background-color: #ffffff;
    overflow: hidden;
    position: relative; /* Ensure stacking context for z-index */
}

/* Fade in rest of site content once loader completes */
body > :not(#site-loader) { opacity: 0; transition: opacity 560ms ease; }
body.site-fade-in > :not(#site-loader) { opacity: 1; }

.logo {
    font-size: 11px; /* reverted from 22px */
    line-height: 1.2;
    text-transform: uppercase;
    font-weight: 400; /* match other text */
    letter-spacing: 0;
    color: #fff; /* white works best with difference for inversion */
    mix-blend-mode: difference;
    text-align: center;
    margin-top: 44px;
    cursor: pointer;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

.image-stack {
    position: absolute; /* Allow the images to scroll behind other elements */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; /* Full viewport height */
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory; /* Enable snap scrolling on mobile/tablet */
    scroll-behavior: auto; /* custom JS animation controls easing */
    z-index: 1; /* Place the image stack behind the logo and buttons */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.image-stack.no-snap { scroll-snap-type: none; }

.image-stack::-webkit-scrollbar { display: none; }

/* Cursor states for scroll navigation in selected-work and overview modes */
.image-stack.scroll-nav-top { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><text x="10" y="15" font-size="16" text-anchor="middle" fill="black">↑</text></svg>') 10 10, auto; }
.image-stack.scroll-nav-bottom { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><text x="10" y="15" font-size="16" text-anchor="middle" fill="black">↓</text></svg>') 10 10, auto; }

.image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column; /* Stack image and caption vertically */
    justify-content: center;
    align-items: center;
    scroll-snap-align: start; /* Snap to the start of each section */
}

.image-container img {
    max-width: 80%;
    max-height: 70%;
    object-fit: contain; /* Ensure the image fits within the container */
        opacity: 0;
        transform: translateY(4px);
        transition: opacity var(--transition-slow) ease, transform var(--transition-slow) ease;
        will-change: opacity, transform;
}

/* Make images visible once loaded (class added by JS) */
.image-container img.is-loaded {
    opacity: 1;
    transform: translateY(0);
}

.caption {
    position: relative; /* Position relative to the image */
    margin-top: 8px; /* Add 2px gap below the image */
    text-align: center;
    font-size: 10px;
    color: #000;
    opacity: 0; /* Initially hidden */
    transition: opacity 0.3s ease; /* Smooth fade-in effect */
}

/* Show the caption only when hovering over the image */
.image-container img:hover + .caption {
    opacity: 1; /* Show caption on hover */
}

.button-container {
    display: flex; /* Flexbox for centering */
    justify-content: center; /* Center the buttons horizontally */
    align-items: center;
    width: auto;
    padding: 3px;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.05); /* restore previous color */
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px); /* 4px background blur */
    margin-bottom: 30px;
    position: absolute; /* Position the button container above the image stack */
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    z-index: 10; /* Ensure the buttons are above the images */
}

/* Sliding active pill indicator */
.nav-indicator {
    position: absolute;
    top: 3px;
    left: 3px; /* will be updated via JS */
    height: calc(100% - 6px);
    width: 0;
    background: #fff;
    border-radius: 0;
    z-index: 0; /* behind buttons, above container background */
    transition: left 340ms cubic-bezier(.65,0,.41,1), width 220ms ease;
    will-change: left, width;
    pointer-events: none;
}

/* Overlay open: disable blending for readability on white background */
/* removed overlay-open blend override */

/* Text hover fade (25% reduction) */
.button { transition: opacity 160ms ease; }
.button:hover { opacity: 0.75; }
.button.active, .button.active:hover { opacity: 1; }


.button-container .button { position: relative; z-index: 1; }

.button {
    text-decoration: none;
    color: #000;
    font-size: 11px;
    font-weight: 400;
    text-align: center;
    display: flex;
    width: 72px;
    height: 18px;
    padding: 5px 18px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-radius: 0;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}

/* Remove click flash */
.button:active { background: transparent; }

.button.active { background: transparent; color: #000; }

.overlay {
    position: fixed;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.98); /* 98% opacity */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure the overlay is below the logo */
    visibility: hidden; /* Initially hidden */
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.visible {
    visibility: visible;
    opacity: 1;
}

.overlay-content {
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center everything */
    align-items: center; /* Center horizontally */
    width: 100%;
    height: 100%;
    padding: 44px;
    color: #000000;
    text-align: left;
    font-size: 11px;
    font-weight: regular;
    box-sizing: border-box;
}

.overlay-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 44px;
}

.overlay-bottom {
    text-align: center;
    position: absolute;
    bottom: 44px;
    left: 0;
    right: 0;
}

.bottom-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.bottom-column {
    text-align: center;
}

.bottom-note {
    margin-top: 8px;
    text-align: center;
}

.column {
    flex: 1;
    padding: 10px;
    max-width: 380px;
    width: 100%;
    text-align: center;
}
/* 4px gap below overlay section titles */
.overlay .section-title { display: inline-block; margin-bottom: 4px; }
/* Neutral link styling inside overlay */
.overlay a { color: inherit; text-decoration: none; }
.overlay a:visited { color: inherit; }
.overlay a:hover, .overlay a:active, .overlay a:focus { color: inherit; text-decoration: none; outline: none; }

/* Remove default blue focus ring when column is programmatically focused; keep a subtle outline for keyboard navigation */
.overlay .column:focus,
.overlay .column:focus-visible,
.overlay .column:active {
    outline: none !important;
    box-shadow: none !important;
}
/* Remove iOS tap highlight */
.overlay .column { -webkit-tap-highlight-color: transparent; }

.grid-view {
    display: grid !important;
    grid-template-columns: repeat(8, minmax(130px, 1fr)); /* default mobile/tablet baseline */
        gap: 36px;
    width: 100vw;
    box-sizing: border-box;
    padding-left: 44px;
    padding-right: 44px;
    padding-top: 136px;
    padding-bottom: 44px;
    height: 100%; /* constrain to viewport so it can scroll internally */
    overflow-y: auto;
    background: #fff;
    justify-items: center;
    align-items: start;
    scroll-snap-type: none !important; /* disable snapping in grid */
}

/* Desktop: exactly 7 columns */
@media (min-width: 1024px) {
    .grid-view {
        grid-template-columns: repeat(7, 1fr);
    }
}

.grid-view .image-container {
    height: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* centered as before */
    scroll-snap-align: unset;
        padding-top: 4px;
        padding-bottom: 8px;
}
/* Overview grid: no randomized scale/offset; centered items */

/* Camera roll two-up side-by-side mode (golden ratio) */
.camera-roll-mode .pair-section { display:flex; flex-direction:column; justify-content:center; align-items:center; min-height: 100vh; }
.camera-roll-mode .pair-section .pair { display:flex; flex-direction:row; gap:32px; justify-content:center; align-items:center; width:100%; padding: 0 44px; box-sizing: border-box; position: relative; }
.camera-roll-mode .pair-section .pair-item { display:flex; flex-direction:column; align-items:center; justify-content:center; }
.camera-roll-mode .pair-section .pair-item img { width:100%; height:auto; object-fit:contain; max-height: 38vh; }
/* When both images are portrait, make companion smaller for variety */
.camera-roll-mode .pair-section.both-portrait .pair-item.companion { flex: 0 0 28%; }
.camera-roll-mode .pair-section.both-portrait .pair-item.companion img { max-height: 32vh; }
/* Feature vs companion sizing */
.camera-roll-mode .pair-section .pair-item.feature { flex: 0 0 52%; }
.camera-roll-mode .pair-section .pair-item.companion { flex: 0 0 32%; }
/* Feature anchors: left/right edge; companion remains centered */
.camera-roll-mode .pair-section.feature-left .pair .pair-item.feature { align-self: center; margin-right: auto; }
.camera-roll-mode .pair-section.feature-left .pair .pair-item.companion { margin: 0 auto; }
.camera-roll-mode .pair-section.feature-right .pair .pair-item.feature { align-self: center; margin-left: auto; }
.camera-roll-mode .pair-section.feature-right .pair .pair-item.companion { margin: 0 auto; }
/* Companion vertical alignment cycle */
.camera-roll-mode .pair-section .pair-item.companion.align-top { align-self: flex-start; }
.camera-roll-mode .pair-section .pair-item.companion.align-center { align-self: center; }
.camera-roll-mode .pair-section .pair-item.companion.align-bottom { align-self: flex-end; }
/* Captions hidden by default in camera roll; shown on hover */
.camera-roll-mode .pair-section .caption { opacity: 0; }
.camera-roll-mode .pair-section .pair-item img:hover + .caption { opacity: 1; }

/* Single-image occasional sections */
.camera-roll-mode .single-section { display:flex; flex-direction:column; justify-content:center; align-items:center; min-height: 100vh; }
.camera-roll-mode .single-section .single { width:100%; padding: 0 44px; box-sizing: border-box; }
.camera-roll-mode .single-section .single .single-item { max-width: 52%; margin: 0 auto; display:flex; flex-direction:column; align-items:center; }
.camera-roll-mode .single-section.single-left .single .single-item { margin-left: 0; margin-right: auto; }
.camera-roll-mode .single-section.single-right .single .single-item { margin-left: auto; margin-right: 0; }
.camera-roll-mode .single-section .single .single-item img { width:100%; height:auto; object-fit:contain; max-height: 48vh; }
.camera-roll-mode .single-section .caption { opacity:0; }
.camera-roll-mode .single-section .single .single-item img:hover + .caption { opacity:1; }

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

/* Responsive adjustments */
@media (max-width: 920px) {
    .overlay-top { flex-direction:column; gap:28px; }
    .overlay-content { padding-top:80px; }
    .grid-view { grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); padding:120px 28px 32px; gap:24px; }
    .image-container img { max-width:90%; max-height:60%; }
    .logo { top:2px; }
}

@media (max-width: 520px) {
    .grid-view { grid-template-columns: repeat(auto-fill, minmax(100px,1fr)); padding:100px 20px 28px; gap:20px; }
    .button-container { bottom:6px; }
    .button { padding:5px 14px; }
    /* Mobile overlay adjustments */
    .overlay-content { padding: 20px; }
    .overlay-top { gap: 28px; }
    .overlay-bottom { bottom: 20px; }
    /* Mobile: stack camera roll pair images vertically */
    .camera-roll-mode .pair-section { display:flex; flex-direction:column; justify-content:center; min-height:100vh; }
    .camera-roll-mode .pair-section .pair { flex-direction: column; gap: 32px; width:100%; padding: 0 20px; }
    .camera-roll-mode .pair-section .pair .pair-item:last-child { margin-bottom: 4px; }
    /* Use align classes for subtle horizontal offsets */
    .camera-roll-mode .pair-section.feature-left .pair { align-items:flex-start; }
    .camera-roll-mode .pair-section.feature-right .pair { align-items:flex-end; }
    /* Slightly reduce image width & ensure block layout for consistent offsets */
    .camera-roll-mode .pair-section .pair-item img { max-width:72%; max-height:36vh; display:block; }
    /* Single on mobile: centered with smaller size */
    .camera-roll-mode .single-section { min-height: 100vh; }
    .camera-roll-mode .single-section .single { padding: 0 20px; }
    .camera-roll-mode .single-section .single .single-item { max-width: 72%; margin: 0 auto; }
    .camera-roll-mode .single-section .single .single-item img { max-height: 42vh; }
}

/* ------------------------------------------- */
/* Site Loader (stacking images)               */
/* ------------------------------------------- */
#site-loader {
    position: fixed;
    inset: 0;
    background: #ffffff; /* keep white for clean flashless load */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    transition: opacity 520ms ease; /* fade-out timing synced with JS remove */
    pointer-events: none; /* prevent interaction */
}

#site-loader.fade-out { opacity: 0; }

#site-loader .stack {
    position: relative;
    width: min(58vmin, 420px);
    height: min(58vmin, 420px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#site-loader .stack img {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Centered; no entrance scale animation */
    transform: translate(-50%, -50%) scale(1);
    max-width: 100%;
        max-width: 84%;
    opacity: 0; /* hidden until revealed */
    filter: brightness(0.92) contrast(1.04);
    /* No transform transition since we don't change scale */
    transition: none;
    will-change: auto;

    /* (moved grid portrait/landscape sizing out of loader scope below) */
    object-fit: contain;
}

/* Grid portrait/landscape sizing for better centering */
/* Portrait/landscape tuning retained */
.grid-view .image-container img.portrait { max-width: 66%; }
.grid-view .image-container img.landscape { max-width: 88%; }

/* Slight lift-in when becoming visible */
#site-loader .stack img.visible {
    opacity: 1; /* instant show */
    transform: translate(-50%, -50%) scale(1); /* identical */
}

/* Alternating orientation presentation for loader images */
#site-loader .stack img.landscape { width: 72%; height: auto; }
#site-loader .stack img.portrait { height: 72%; width: auto; }

/* Pointer cursor for clickable overview grid items */
.grid-view .image-container { cursor: pointer; }

@media (max-width: 600px) {
    #site-loader .stack { width: 64vmin; height: 64vmin; }
}

