:root {
    --color-bg: #ffffff;
    --color-text: #000000;
    --color-accent: #000000;
    --color-overlay: rgba(0, 0, 0, 0.8);
    --font-primary: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-hero: 'Rubik Broken Fax', sans-serif;
    --font-section: 'Rubik Maze', sans-serif;
    --font-project: 'Rubik Spray Paint', sans-serif;
    --font-gallery: 'Rubik Spray Paint', sans-serif;
    --font-nav: 'Rubik Glitch', sans-serif;
    --font-contact: 'Workbench', sans-serif;
    --font-about: 'Rubik Microbe', sans-serif;
    --font-series: 'Teko', sans-serif;
    --font-series-controls: 'Teko', sans-serif;
    --font-music: 'Rubik 80s Fade', sans-serif;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Safe area and viewport utilities */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --viewport-height-dynamic: 100dvh;
    --viewport-height-fallback: 100vh;
}

/* Screen reader only - visually hidden but accessible to assistive tech */
.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;
}

/* Skip to main content link - visible only on focus for keyboard users */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text);
    color: var(--color-bg);
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 4px 4px;
    z-index: 10001;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease-in-out;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid var(--color-bg);
    outline-offset: 2px;
}

/* Reduced Motion - Global overrides */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: transparent;
    }
    
    .hero-video-container video {
        display: none;
    }
    
    .hero-video-container {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    }
}

/* Loading States */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    min-height: 300px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-text);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Loading spinner overlay - always perfectly centered */
.loading-spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    backdrop-filter: blur(1px);
}

.loading-spinner-overlay .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Video modal spinner - dark background */
.modal:has(.video-image-modal) .loading-spinner-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.modal:has(.video-image-modal) .loading-spinner-overlay .loading-spinner {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
}

/* Legacy support - remove old image-load-spinner */
.image-load-spinner {
    display: none !important;
}

.loading-container p {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

/* Error States */
.error-state,
.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    color: #666;
    font-size: 1rem;
}

.error-state {
    color: #ff4444;
}

.container-error {
    padding: 3rem 2rem;
    text-align: center;
    color: #666;
}

.container-error .btn-primary {
    background: var(--color-text);
    color: var(--color-bg);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 1rem;
    transition: var(--transition);
}

.container-error .btn-primary:hover {
    opacity: 0.8;
}

/* Error message notification */
.error-message {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    /* Hide scrollbars */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Hide Webkit scrollbars (Chrome, Safari, Edge) */
html::-webkit-scrollbar {
    display: none;
}

body {
    padding-bottom: 4rem;
    font-family: var(--font-primary);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto;
    font-weight: 400;
}

/* Mobile safe area adjustments */
@supports (padding: max(0px)) {
    body {
        padding-bottom: max(4rem, env(safe-area-inset-bottom));
    }
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: #8a2be2;
}

/* Keep scrollbar hidden only for modal */
.modal {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.modal::-webkit-scrollbar {
    display: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: transparent;
    transition: var(--transition);
}

.nav-logo {
    font-size: 1.25rem;
    text-decoration: none;
    color: #ffffff;
    line-height: 1;
    position: fixed;
    top: var(--spacing-sm);
    left: 50%;
    transform: translateX(-50%) translateY(0.1em);
    z-index: 1002;
    display: block;
    cursor: pointer;
    pointer-events: auto;
    transition: color var(--transition);
    padding: 0.25rem;
    min-width: 1.5rem;
    min-height: 1.5rem;
}

.nav-logo::before {
    content: '♻';
    display: inline-block;
    transform-origin: center;
    pointer-events: none;
}

.nav-logo:hover::before {
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.nav.scrolled .nav-logo {
    color: var(--color-text);
    left: var(--spacing-md);
    transform: translateX(0) translateY(0.1em);
    transition: color var(--transition);
}

.nav.scrolled .nav-logo::before {
    content: '↑';
    animation: none;
}

.nav-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    list-style: none;
    gap: 0;
    position: fixed;
    top: var(--spacing-sm);
    right: var(--spacing-md);
    bottom: max(var(--spacing-sm), env(safe-area-inset-bottom, 1rem));
    left: var(--spacing-md);
    z-index: 1001;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.nav-menu li {
    pointer-events: auto;
    transition: none !important;
}

.nav-menu li:nth-child(1) {
    /* VIDEO - top left normally, bottom left when arrow is showing */
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    justify-self: start;
}

.nav.scrolled .nav-menu li:nth-child(1)[data-section="video"] {
    /* VIDEO moves to bottom left when scrolled and arrow is showing */
    grid-row: 2;
    align-self: end;
}

.nav-menu li:nth-child(2) {
    /* MUSIC - bottom left normally */
    grid-column: 1;
    grid-row: 2;
    align-self: end;
    justify-self: start;
}

.nav-menu li:nth-child(3) {
    /* GALLERY - bottom right */
    grid-column: 2;
    grid-row: 2;
    align-self: end;
    justify-self: end;
}

.nav-menu li:nth-child(4) {
    /* ABOUT - top right */
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-self: end;
}

.nav-link {
    text-decoration: none;
    color: #ffffff;
    font-size: 0.9rem;
    font-family: 'Climate Crisis', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color var(--transition);
    position: relative;
}

.nav.scrolled .nav-link {
    color: var(--color-text);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #ffffff;
    transition: var(--transition);
}

.nav.scrolled .nav-link::after {
    background: var(--color-text);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: #ffffff;
    transition: var(--transition);
}

.nav.scrolled .nav-toggle span {
    background: var(--color-text);
}

.hero {
    min-height: var(--viewport-height-dynamic, var(--viewport-height-fallback)); /* Dynamic viewport height with fallback */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-xl) var(--spacing-md);
    position: relative;
    text-align: center;
    overflow: hidden;
}

.hero-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background: #000000; /* Hide white gaps between videos */
}

.hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}

.hero-content {
    max-width: 1200px;
    position: relative;
    z-index: 2;
}

.hero-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    letter-spacing: 0.15em;
    line-height: 1;
    margin-bottom: 0.5rem; /* Reduced from 2rem to 0.5rem for tighter spacing */
    text-align: center;
    font-family: var(--font-hero);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease 0.3s forwards;
    color: #ffffff;
}

.hero-title-top {
    font-size: clamp(0.8rem, 3vw, 2.5rem);
    display: block;
    letter-spacing: 0.15em;
    margin-bottom: -0.2em;
    font-family: var(--font-nav);
    color: #ffffff;
}

.hero-title-bottom {
    font-size: clamp(4rem, 15vw, 14rem);
    display: block;
    letter-spacing: 0.15em;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: 500;
    max-width: 600px;
    margin: -0.5em auto 0;
    opacity: 0;
    animation: fadeIn 1s ease 0.8s forwards;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-family: var(--font-primary);
    color: #ffffff;
}

.hero-scroll {
    position: absolute;
    bottom: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    opacity: 0;
    animation: fadeIn 1s ease 1.2s forwards;
    z-index: 2;
    color: #ffffff;
}

.hero-scroll .scroll-text {
    font-family: var(--font-contact);
    font-size: 1rem;
}

.hero-scroll .scroll-plus {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 300;
    animation: bounce 2s infinite;
    line-height: 1;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes iridescent {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        filter: hue-rotate(var(--initial-hue, 0deg));
    }
    33% {
        transform: translate(-45%, -55%) rotate(120deg) scale(1.1);
        filter: hue-rotate(calc(var(--initial-hue, 0deg) + 120deg));
    }
    66% {
        transform: translate(-55%, -45%) rotate(240deg) scale(0.9);
        filter: hue-rotate(calc(var(--initial-hue, 0deg) + 240deg));
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1);
        filter: hue-rotate(calc(var(--initial-hue, 0deg) + 360deg));
    }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

.section-title {
    font-size: clamp(2rem, 6vw, 6rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    margin-bottom: var(--spacing-md);
    text-align: center;
    text-transform: uppercase;
    font-family: var(--font-section);
}

.gallery-title {
    font-family: var(--font-gallery);
}

.contact-title {
    font-family: var(--font-contact);
}

.about-title {
    font-family: var(--font-about);
}

.section-title.music-title {
    font-family: var(--font-music);
    font-size: clamp(2rem, 6vw, 6rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    margin-bottom: var(--spacing-md);
    text-align: center;
    text-transform: uppercase;
}

.content-tabs {
    padding: var(--spacing-sm) 0;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 999;
    opacity: 1;
    transition: opacity 0.05s ease;
}

.content-tabs.hidden {
    opacity: 0;
    pointer-events: none;
}

.content-tabs .container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.content-tab {
    background: transparent;
    border: none;
    color: var(--color-text);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    transition: var(--transition);
    font-family: var(--font-primary);
    font-weight: 500;
}

.content-tab:hover {
    opacity: 0.7;
}

.content-tab.active {
    font-weight: 700;
    border-bottom: 2px solid var(--color-text);
}

.tab-separator {
    color: var(--color-text);
    opacity: 0.5;
    font-size: 1rem;
}

.content-section {
    display: none;
    padding: 3rem 0;
}

.content-section.active {
    display: block;
}

.projects {
    padding: 3rem 0;
}

.sound {
    padding: 3rem 0;
}

.artist-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.125rem;
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
    max-width: 100%;
}

.artist-filter {
    background: none;
    border: none;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
    font-family: inherit;
    margin: 0 0.0625rem;
}

.artist-filter:hover {
    color: #666;
}

.artist-filter.active {
    color: var(--color-text);
    font-weight: 600;
}

/* Showreel - click-to-load YouTube facade at the top of VIDEO */
.showreel {
    margin: 0 auto var(--spacing-lg);
    max-width: 1200px;
}

.showreel-player {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
    color: #fff;
    cursor: pointer;
}

.showreel-poster,
.showreel-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.showreel-poster {
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), filter var(--transition);
    filter: brightness(0.85);
}

.showreel-play {
    position: absolute;
    left: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1rem, 3vw, 2rem);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.4rem;
    background: #fff;
    color: #000;
    font-family: var(--font-primary);
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    line-height: 1;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.showreel-player:hover .showreel-poster,
.showreel-player:focus-visible .showreel-poster {
    transform: scale(1.03);
    filter: brightness(1);
}

.showreel-player:hover .showreel-play,
.showreel-player:focus-visible .showreel-play {
    background: #000;
    color: #fff;
    box-shadow: inset 0 0 0 1.5px #fff;
}

.showreel-player:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 4px;
}

.showreel-player.is-playing {
    cursor: default;
}

.showreel-player.is-playing .showreel-poster,
.showreel-player.is-playing .showreel-play {
    display: none;
}

.showreel-caption {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .showreel {
        margin-bottom: var(--spacing-md);
    }
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-md);
    margin-top: 0;
    margin-bottom: 0;
    padding-bottom: 0;
    grid-auto-rows: min-content;
    will-change: min-height;
}

.projects-grid .project-card {
    animation: fadeInCard 0.3s ease-out forwards;
}

@keyframes fadeInCard {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Video section grid - match expanded state spacing */
#video .projects-grid {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Center single card - when there's exactly 1 project-card (ignoring bio section) */
.projects-grid.single-card {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Center 2 cards - when there are exactly 2 project-cards (ignoring bio section) */
.projects-grid.two-cards {
    grid-template-columns: repeat(2, 1fr);
    max-width: calc(2 * 400px + var(--spacing-sm));
    margin-left: auto;
    margin-right: auto;
    gap: var(--spacing-sm);
}

/* Video section: infinite scroll - all cards visible */
/* Removed .expanded class logic - cards now load progressively via IntersectionObserver */

.project-card {
    cursor: pointer;
    transition: var(--transition);
}

@media (prefers-reduced-motion: no-preference) {
    .project-card:not(.visible) {
        opacity: 0;
        transform: translateY(30px);
    }
}

.project-card.visible {
    animation: fadeInUp 0.6s ease forwards;
}

.project-card.visible:nth-child(1) { animation-delay: 0.1s; }
.project-card.visible:nth-child(2) { animation-delay: 0.2s; }
.project-card.visible:nth-child(3) { animation-delay: 0.3s; }
.project-card.visible:nth-child(4) { animation-delay: 0.4s; }
.project-card.visible:nth-child(5) { animation-delay: 0.5s; }
.project-card.visible:nth-child(6) { animation-delay: 0.6s; }
.project-card.visible:nth-child(7) { animation-delay: 0.7s; }
.project-card.visible:nth-child(8) { animation-delay: 0.8s; }
.project-card.visible:nth-child(9) { animation-delay: 0.9s; }
.project-card.visible:nth-child(10) { animation-delay: 1.0s; }
.project-card.visible:nth-child(11) { animation-delay: 1.1s; }
.project-card.visible:nth-child(12) { animation-delay: 1.2s; }

.project-image {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background: #f5f5f5;
}

.project-image img,
.project-image video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.project-video-thumb {
    pointer-events: none; /* Click goes through to card */
}

.project-image .gif-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.project-image .gif-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* GIF animation is handled by resetting the src on hover in setupVideoGifs() */

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    overflow: hidden;
    z-index: 20;
}

.project-overlay::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 30% 30%, rgba(138, 43, 226, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(59, 130, 246, 0.035) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.03) 0%, transparent 60%),
        radial-gradient(circle at 20% 80%, rgba(34, 211, 238, 0.035) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    background-blend-mode: screen, overlay, color-dodge, screen, overlay;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    transform-origin: center center;
}

.project-type {
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.875rem;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
    font-weight: 400;
    font-family: var(--font-project);
}

.project-card:hover .project-overlay::before {
    opacity: 1;
    animation: iridescent 20s ease-in-out infinite;
}

.project-card:hover .project-type {
    opacity: 1;
    transform: translateY(0);
    color: var(--color-text);
    position: relative;
    z-index: 21;
}

.project-card[data-type="video"] .project-type,
.project-card[data-type="sound"] .project-type {
    display: none;
}

.project-info {
    padding: var(--spacing-sm) 0;
}

.project-title {
    font-size: 1.25rem;
    font-weight: 400;

    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-project);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-description {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

.music-preview {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    overflow: hidden;
    opacity: 0;
    transition: height 0.4s ease, opacity 0.3s ease;
    z-index: 15;
    pointer-events: none;
    margin: 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
}

.project-card[data-type="sound"]:hover .music-preview,
.project-card[data-type="sound"].preview-active .music-preview {
    height: 140px;
    opacity: 1;
    pointer-events: auto;
}

.music-preview iframe {
    width: 100%;
    border: 0;
    height: 120px;
    display: block;
    margin: 0;
    padding: 0;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.show-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0;
    padding: 0;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    transition: opacity 0.3s ease, top 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-primary);
    position: relative;
    top: calc(var(--spacing-md) * -1.5);
}

.show-more-btn.expanded {
    top: var(--spacing-md);
}

/* Video section: infinite scroll (no show-more button needed) */
#video .show-more-btn {
    display: none !important;
}

/* Past shows button - ensure it's visible and properly styled, override show-more-btn */
.shows-more-btn {
    margin-top: var(--spacing-sm) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    position: static !important;
    top: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: auto !important;
    height: auto !important;
}

.shows-more-btn.expanded {
    top: auto;
}

.show-more-btn .show-more-text {
    display: none;
}

.show-more-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.show-more-btn:hover {
    opacity: 0.6;
}

.show-more-arrow {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.show-more-btn.expanded .show-more-arrow {
    transform: rotate(180deg);
}


.gallery {
    padding: 3rem 0;
}


.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-sm);
    margin-top: 0;
}

.gallery-item {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
    opacity: 1;
    transform: scale(1);
    transition: var(--transition);
}

@media (prefers-reduced-motion: no-preference) {
    .gallery-item {
        opacity: 0;
        transform: scale(0.9);
    }
    
    .gallery-item.visible {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-item.series-representative {
    position: relative;
}

.series-info {
    position: absolute;
    bottom: var(--spacing-xs);
    right: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    z-index: 2;
    cursor: pointer;
    font-family: var(--font-series-controls);
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    transition: var(--transition);
}

.series-count {
    position: absolute;
    top: var(--spacing-xs);
    left: var(--spacing-xs);
    pointer-events: auto;
    color: white;
    z-index: 2;
    font-family: var(--font-series-controls);
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    cursor: pointer;
}

.series-title {
    position: absolute;
    top: var(--spacing-xs);
    right: var(--spacing-xs);
    pointer-events: auto;
    color: white;
    z-index: 2;
    font-family: var(--font-series);
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    cursor: pointer;
}

.series-toggle {
    pointer-events: none;
    font-size: 1.5rem;
    line-height: 1;
    color: white;
    font-family: var(--font-primary);
    font-weight: 300;
}

.gallery-item.series-item {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 769px) {
    .nav-link {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .series-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

.about {
    padding: 3rem 0;
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.about.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-lg);
}

.about-text {
    font-size: 1.125rem;
    line-height: 1.8;
}

.about-text p {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.about-intro {
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    line-height: 1.4;
}

.about-intro br {
    line-height: 1.2;
}

.about-shows h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-project);
    font-weight: 400;
}

.about-contact {
    margin-top: 2rem;
}

.about-contact h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: var(--font-contact);
    font-weight: 400;
}

.about-contact .contact-intro {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.about-contact .contact-info {
    margin-top: 0.25rem;
}

.shows-list {
    list-style: none;
    font-size: 0.9rem;
    line-height: 2;
}

.shows-list li {
    margin-bottom: var(--spacing-xs);
    padding-left: var(--spacing-sm);
    position: relative;
}

.shows-list li::before {
    content: '—';
    position: absolute;
    left: 0;
}

.shows-list-hidden {
    display: none;
}

.shows-list.expanded .shows-list-hidden {
    display: list-item;
}


.shows-more-btn:hover {
    background: transparent;
    color: var(--color-text);
    opacity: 0.6;
}

.contact {
    padding: 3rem 0;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.contact-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-intro {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
}

.contact-link {
    font-size: 1.5rem;
    color: var(--color-text);
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
    position: relative;
}

.contact-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-text);
    transition: var(--transition);
}

.contact-link:hover::after {
    width: 100%;
}

.contact-link:hover {
    opacity: 1;
}

.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: #ffffff;
    align-items: flex-start;
    justify-content: center;
    padding: var(--spacing-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.modal:not(:has(.video-image-modal)) {
    background: #ffffff;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal::-webkit-scrollbar {
    display: none;
}

.modal {
    -ms-overflow-style: none;
    scrollbar-width: none;
}


.modal-content {
    background: transparent;
    max-width: 1200px;
    width: 100%;
    overflow: visible;
    position: relative;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin: auto;
    pointer-events: auto;
}

/* Black background for modal content in video modals */
.modal:has(.video-image-modal) .modal-content {
    background: #000000;
}

.modal.active .modal-content {
    opacity: 1;
    transform: scale(1);
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #000;
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    opacity: 0.7;
}

.music-content.has-poster {
    display: flex;
    gap: var(--spacing-lg);
    align-items: stretch;
}

.video-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.video-poster {
    width: 55%;
    max-width: 55%;
    height: 100%;
    flex-shrink: 0;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.video-poster:hover {
    opacity: 0.95;
}

.video-player {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    max-width: 1400px;
}

.video-content-wrapper .music-header {
    flex-shrink: 0;
}

.video-bottom-section {
    display: flex;
    flex-direction: column;
    margin-top: auto;
    gap: var(--spacing-md);
}

.video-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    place-items: center;
}

/* For galleries with images, use flexbox to ensure consistent 3-per-row layout on mobile */
.video-gallery {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.video-gallery .video-gallery-image {
    flex: 0 0 calc(33.333% - var(--spacing-sm) * 2);
    max-width: 180px;
}

/* Override for very small screens to ensure 2 images per row */
@media (max-width: 480px) {
    .video-gallery .video-gallery-image {
        flex: 0 0 140px;
        max-width: 140px;
    }
}

/* Center gallery when no poster */
.music-content:not(.has-poster) .video-gallery {
    justify-items: center;
    max-width: 600px;
    margin: 0 auto;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(var(--spacing-sm) * 0.25);
    justify-content: center;
}

/* Modal galleries (with posters) - ensure proper grid layout */
.music-content.has-poster .video-gallery {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    place-items: center;
    width: 100%;
}

/* Add small gap between description and YouTube embed for videos without poster */
.music-content:not(.has-poster) .music-description {
    margin-bottom: var(--spacing-sm);
}

.video-gallery-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.3s ease;
    border-radius: 4px;
    background: #000000;
}

.video-gallery-image:hover {
    opacity: 0.95;
}

@media (max-width: 768px) {
    /* Force sound albums to stack vertically on mobile */
    #sound .projects-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .music-content.has-poster {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .video-poster {
        width: 100%;
        max-width: 100%;
    }
    
    .music-header-top {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
    }

    /* Ensure title and meta are centered on mobile for all modal types */
    .music-title,
    .music-meta,
    .music-meta div {
        text-align: center;
    }

    /* Reduce modal title size on mobile to prevent centering issues - only in modals, not section title */
    .modal .music-title {
        font-size: clamp(1.5rem, 4vw, 3rem) !important; /* Smaller on mobile */
    }

    /* Keep description left-aligned for better readability */
    .music-description {
        text-align: left;
    }
    
    .video-links {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .video-links .video-link:first-child {
        margin-right: auto;
    }

    .video-links .video-link:last-child {
        margin-left: auto;
    }
    
    .video-gallery {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-xs);
    }
    
    .video-player {
        max-width: 100%;
    }
}

.modal:has(.video-content-wrapper) {
    background: #000000;
}

.modal:has(.video-content-wrapper) .modal-close {
    color: #ffffff;
}

.modal:has(.video-content-wrapper) .music-content {
    color: #ffffff;
}

.modal:has(.video-content-wrapper) .music-title,
.modal:has(.sound-page) .music-title {
    font-family: var(--font-gallery) !important; /* Use graffiti font for modal titles */
}

.modal:has(.video-content-wrapper) .music-title {
    color: #ffffff;
}

.modal:has(.video-content-wrapper) .music-description {
    color: #ffffff;
}

.modal:has(.video-content-wrapper) .music-description a {
    color: #ffffff;
}

.modal:has(.video-content-wrapper) .music-description a:hover {
    color: #8a2be2;
}

.music-content {
    padding: var(--spacing-lg);
    max-width: 1600px;
    margin: 0 auto;
}

.music-content.sound-page {
    max-width: 1200px;
    background: #ffffff;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.music-cover-image-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto var(--spacing-md) auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.music-cover-image {
    width: 100%;
    height: auto;
    max-width: 600px;
    object-fit: contain;
    border-radius: 4px;
}

.music-header {
    margin-bottom: 0;
}

.music-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-md);
}

/* Share button - positioned at top-left of modal, next to close button (absolute positioning) */
.share-btn {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    padding: 0;
    opacity: 1;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 2001; /* Above modal (z-index: 2000) */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn:hover {
    opacity: 1;
}

.share-btn:active {
    transform: scale(0.95);
}

.share-btn.share-success {
    opacity: 1;
}

/* Video modal share button - white on dark background */
.video-content-wrapper .share-btn,
.modal:has(.video-content-wrapper) .share-btn {
    color: #ffffff;
}

/* Image modal share button - white on dark background */
.modal:has(.image-modal-content) .share-btn {
    color: #ffffff;
}

/* Sound page share button - BLACK on white background */
.modal:has(.sound-page) .share-btn {
    color: #000000;
}

.music-meta {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0;
}

.music-description {
    line-height: 1.8;
    margin-bottom: 0;
}

.music-description p + p {
    margin-top: var(--spacing-sm);
}

.music-description a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.music-description a:hover {
    color: #8a2be2;
}

.video-links {
    text-align: right;
    flex-shrink: 0;
    line-height: 1;
}

.video-link {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.9rem;
    display: block;
    line-height: 1;
    margin: 0;
}

.video-link + .video-link {
    margin-top: 0.25rem;
}

.video-link:hover {
    color: #8a2be2;
}

.music-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    width: 100%;
}

.music-link {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--color-text);
    text-decoration: none;
    color: var(--color-text);
    transition: var(--transition);
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.music-link:hover {
    background: var(--color-text);
    color: var(--color-bg);
}

.bandcamp-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 0;
    margin-top: var(--spacing-sm);
}

.bandcamp-player {
    width: 100%;
    max-width: 700px;
    border: 0;
    height: 350px;
}

.music-video-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: var(--spacing-sm);
}

.music-video-wrapper .video-player {
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    height: auto;
    border: none;
}

.merch-gallery-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: var(--spacing-sm);
}

.merch-gallery-wrapper .video-gallery {
    max-width: 700px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    justify-items: center;
}

.merch-gallery-wrapper .video-gallery:has(img:only-child) {
    grid-template-columns: 1fr;
    max-width: calc((700px - 2 * var(--spacing-sm)) / 3);
}

.merch-gallery-wrapper .video-gallery:has(img:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
    max-width: calc((700px - var(--spacing-sm)) / 3 * 2);
    justify-content: center;
}

/* Bio Section */
.bio-section {
    margin-top: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: center;
}

.bio-description {
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.bio-images-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
}

.bio-image-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 200px;
    width: 100%;
}

.bio-image {
    width: 100%;
    height: auto;
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bio-image:hover {
    opacity: 0.8;
}

/* Artist Bio Section (in sound section grid) */
.artist-bio-section {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--color-border);
}

.artist-bio-description {
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.artist-bio-images-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
}

.artist-bio-image-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 280px;
    width: 100%;
}

.artist-bio-image {
    width: 100%;
    height: auto;
    max-width: 280px;
    max-height: 280px;
    object-fit: contain;
    border-radius: 4px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.artist-bio-image:hover {
    opacity: 0.8;
}

.image-modal-content {
    padding: 2rem;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    gap: 0.75rem;
}

/* Black background for image modal content in video modals */
.modal:has(.video-image-modal) .image-modal-content {
    background: #000000;
}


.image-modal-content.video-image-modal::before {
    background: #000000 !important;
}

.modal:has(.video-image-modal) {
    background: #000000;
}

.modal:has(.video-image-modal) .modal-close {
    color: #ffffff;
}

.modal:has(.video-image-modal) .image-modal-controls {
    background: rgba(0, 0, 0, 0.9);
}

.modal:has(.video-image-modal) .image-modal-title {
    color: #ffffff;
}

.modal:has(.video-image-modal) .modal-nav {
    color: #ffffff;
}

.modal:has(.video-image-modal) .zoom-control {
    color: #ffffff;
    border-color: #ffffff;
}

.modal:has(.video-image-modal) .zoom-control:hover {
    background: #ffffff;
    color: #000000;
}

.modal:has(.video-image-modal) .zoom-level {
    color: #ffffff;
}

.image-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 70%);
    pointer-events: none;
    z-index: 1;
}

.zoom-container {
    position: relative;
    width: auto; /* Will be set dynamically based on image aspect ratio */
    height: auto; /* Will be set dynamically based on image aspect ratio */
    max-width: 90vw;
    max-height: 80vh;
    min-width: 300px;
    min-height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

/* Black background for zoom container in video modals */
.modal:has(.video-image-modal) .zoom-container {
    background: #000000;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    border: none;
    outline: none;
    box-shadow: none;
    transition: transform 0.1s ease-out;
    user-select: none;
    object-fit: contain;
    -webkit-user-drag: none;
}

/* Prevent bio images from being scaled beyond their natural size to avoid pixelation */
.image-modal-content img[src*="bio"] {
    object-fit: scale-down; /* Prevents scaling beyond natural size */
    image-rendering: -webkit-optimize-contrast; /* Better rendering for scaled images */
    image-rendering: crisp-edges;
}

/* Black background for video modal images to prevent white flash during loading */
.modal:has(.video-image-modal) .image-modal-content img {
    background: #000000;
}

.image-modal-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    position: relative;
    z-index: 3;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0.5rem;
    margin-bottom: -0.5rem;
    margin-top: 0;
}

.zoom-buttons-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.zoom-level {
    text-align: center;
    margin: 0;
}

.zoom-control {
    background: transparent;
    border: 1px solid var(--color-text);
    color: var(--color-text);
    font-size: 0.875rem;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-primary);
    line-height: 1;
    padding: 0;
}

.zoom-control:hover {
    background: var(--color-text);
    color: var(--color-bg);
}

.zoom-level {
    font-size: 0.7rem;
    color: var(--color-text);
    font-family: var(--font-primary);
    min-width: 2.5rem;
    text-align: center;
}

.image-modal-title {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    width: 100%;
}

.image-modal-title span {
    flex: 1;
    text-align: center;
    line-height: 1.6;
    max-width: calc(100% - 4rem); /* Reserve space for arrows */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.image-modal-title .modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.image-modal-title .modal-nav-prev {
    left: var(--spacing-md);
}

.image-modal-title .modal-nav-next {
    right: var(--spacing-md);
}

.modal-nav {
    background: transparent;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--color-text);
    font-weight: 300;
    line-height: 1;
    padding: 0;
    width: auto;
    height: 1.6em;
    flex-shrink: 0;
    margin: 0;
    transform: translateY(-0.15em);
}

.modal-nav:hover {
    opacity: 0.6;
}

@media (max-width: 768px) {
    .modal-nav {
        font-size: 2rem;
    }

    .show-more-btn {
        position: static !important;
        margin: var(--spacing-xl) 0 0 0 !important;
        top: auto !important;
    }

    .show-more-btn.expanded {
        margin: calc(var(--spacing-xl) * 2) 0 0 0 !important;
    }

    /* Override video section specific styles on mobile */
    #video .show-more-btn {
        margin: var(--spacing-xl) 0 0 0 !important;
        top: auto !important;
    }

    #video .show-more-btn.expanded {
        margin: calc(var(--spacing-xl) * 2) 0 0 0 !important;
        top: auto !important;
    }

    .artist-filters {
        gap: 0.0625rem;
    }

    .artist-filter {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
        margin: 0 0.0625rem;
    }

    /* Make past shows more compact on mobile */
    .about-shows h3 {
        font-size: 1.2rem;
        margin-bottom: var(--spacing-sm);
    }

    .shows-list {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .shows-list li {
        margin-bottom: 0.5rem;
        padding-left: 0.75rem;
    }

    .shows-list li::before {
        font-size: 0.9em;
    }

    .shows-more-btn {
        margin-top: var(--spacing-sm) !important;
    }

    .shows-more-btn.expanded {
        margin-top: calc(var(--spacing-sm) * 1.5) !important;
    }
}

.footer {
    background: #000000;
    color: #ffffff;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    z-index: 100;
    pointer-events: none;
    display: inline-block;
    border-radius: 0.5rem 0.5rem 0 0;
    white-space: nowrap;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.footer.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

@media (max-width: 768px) {
    /* Add bottom padding for mobile browsers */
    html {
        padding-bottom: env(safe-area-inset-bottom);
    }

    body {
        padding-bottom: max(4rem, 1.5rem + env(safe-area-inset-bottom));
    }

    /* Ensure main content also has bottom padding */
    main {
        padding-bottom: max(4rem, 1.5rem + env(safe-area-inset-bottom));
    }

    /* Adjust nav-menu to account for safe area - use calc to ensure proper spacing */
    .nav-menu {
        bottom: calc(var(--spacing-xs) + env(safe-area-inset-bottom));
        /* Use dynamic viewport height to handle browser navigation bar changes */
        height: calc(100dvh - 2 * var(--spacing-xs) - env(safe-area-inset-bottom));
    }

    .nav-logo {
        font-size: 1rem;
        top: var(--spacing-xs);
        left: 50%;
        transform: translateX(-50%) translateY(0.1em);
    }

    .nav.scrolled .nav-logo {
        left: var(--spacing-xs);
        transform: translateX(0) translateY(0.1em);
    }

    .nav-menu {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        position: fixed;
        top: var(--spacing-xs);
        right: var(--spacing-xs);
        /* Position above navigation bar with safe area awareness */
        bottom: calc(var(--spacing-xs) + var(--safe-area-inset-bottom));
        left: var(--spacing-xs);
        /* Use dynamic viewport height with fallback for older browsers */
        height: calc(var(--viewport-height-dynamic) - 2 * var(--spacing-xs) - var(--safe-area-inset-bottom));
        /* Ensure minimum height and prevent negative values */
        min-height: calc(var(--viewport-height-fallback) - 2 * var(--spacing-xs));
        pointer-events: none;
        background: transparent;
        padding: 0;
        border: none;
        transform: none;
        margin: 0;
    }

    .nav-menu.active {
        transform: none;
    }

    .nav-menu li {
        font-size: 0.85rem;
    }

    .nav-menu li:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
        align-self: start;
        justify-self: start;
    }

    .nav-menu li:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
        align-self: end;
        justify-self: start;
    }

    .nav-menu li:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
        align-self: end;
        justify-self: end;
    }

    .nav-menu li:nth-child(4) {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        justify-self: end;
    }

    /* Ensure scrolled state maintains consistent positioning */
    .nav.scrolled .nav-menu {
        /* Same safe area handling as normal state */
        bottom: calc(var(--spacing-xs) + var(--safe-area-inset-bottom));
        height: calc(var(--viewport-height-dynamic) - 2 * var(--spacing-xs) - var(--safe-area-inset-bottom));
        min-height: calc(var(--viewport-height-fallback) - 2 * var(--spacing-xs));
    }

    /* Fix scrolled state positioning on mobile to prevent overlap */
    .nav.scrolled .nav-menu li:nth-child(1)[data-section="video"] {
        /* VIDEO moves to bottom left when scrolled, but ensure proper spacing */
        grid-row: 2;
        align-self: end;
        justify-self: start;
    }

    .nav.scrolled .nav-menu li:nth-child(2) {
        /* MUSIC adjusts position when VIDEO moves to bottom row */
        grid-column: 2;
        grid-row: 2;
        align-self: end;
        justify-self: start;
    }

    /* Fallback for browsers that don't support dynamic viewport height */
    @supports not (height: 100dvh) {
        .nav-menu {
            height: calc(var(--viewport-height-fallback) - 2 * var(--spacing-xs) - var(--safe-area-inset-bottom));
        }

        .nav.scrolled .nav-menu {
            height: calc(var(--viewport-height-fallback) - 2 * var(--spacing-xs) - var(--safe-area-inset-bottom));
        }

        .hero {
            min-height: var(--viewport-height-fallback);
        }
    }

    .nav-toggle {
        display: none;
    }

    .hero {
        min-height: calc(var(--viewport-height-dynamic) - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
        /* Ensure content is centered within the usable viewport area */
        padding: var(--spacing-xl) calc(var(--spacing-sm) + 30px);
        /* Account for safe area insets to prevent content from being cut off */
        padding-top: calc(var(--spacing-xl) + var(--safe-area-inset-top));
        padding-bottom: calc(var(--spacing-xl) + var(--safe-area-inset-bottom));
    }

    .hero-title {
        white-space: normal;
        word-break: keep-all;
    }

    .hero-subtitle {
        font-size: clamp(0.65rem, 2vw, 0.85rem); /* Even smaller on mobile */
        padding: 0 var(--spacing-sm);
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--spacing-xs);
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .section-title,
    .section-title.music-title,
    .music-title,
    .gallery-title,
    .about-title {
        font-size: clamp(2.5rem, 12vw, 6rem);
        font-weight: 400;
        letter-spacing: 0.15em;
        margin-bottom: var(--spacing-md);
        text-align: center;
        text-transform: uppercase;
    }
    
    /* Rubik 80s Fade font appears thinner, so increase size for visual consistency */
    .section-title.music-title {
        font-size: clamp(2.5rem, 10vw, 5rem);
    }

    .container {
        padding: 0 calc(var(--spacing-sm) + 30px);
        margin-top: 60px;
        margin-bottom: 60px;
    }

    .hero {
        padding: 60px calc(var(--spacing-sm) + 30px);
    }

    .projects,
    .sound,
    .gallery,
    .about,
    .content-section {
        padding: 60px calc(var(--spacing-sm) + 30px);
    }

    .project-card {
        min-height: 200px;
    }

    .project-overlay {
        padding: var(--spacing-sm);
    }

    .project-title {
        font-size: clamp(1rem, 4vw, 1.5rem);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .project-description {
        font-size: clamp(0.7rem, 2.8vw, 0.9rem);
    }

    .image-modal-content {
        padding: var(--spacing-sm);
    }

    .zoom-container {
        height: 60vh;
    }

    .image-modal-content img {
        max-width: 100%;
        max-height: 100%;
    }

    .image-modal-controls {
        gap: 0.25rem;
        padding: 0.4rem;
    }

    .zoom-control {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.75rem;
    }

    .zoom-level {
        font-size: 0.65rem;
        min-width: 2rem;
    }

    .image-modal-title {
        font-size: clamp(0.875rem, 3vw, 1rem);
        padding: 0 var(--spacing-sm);
    }

    .image-modal-title span {
        max-width: calc(100% - 3rem); /* Smaller space for mobile arrows */
    }

    .modal-nav {
        font-size: 1.5rem;
    }

    .series-count,
    .series-title {
        font-size: 0.75rem;
    }

    /* Move series count to bottom left on mobile to avoid collision with title */
    .series-count {
        top: auto;
        bottom: var(--spacing-xs);
        left: var(--spacing-xs);
    }

    .series-toggle {
        font-size: 1rem;
    }


    .about-text {
        font-size: 1rem;
    }

    .about-text p {
        font-size: 1rem;
    }

    .about-intro {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-xl: 3rem;
        --spacing-lg: 2rem;
    }

    /* Add bottom padding for mobile browsers */
    body {
        padding-bottom: max(4rem, 2rem + env(safe-area-inset-bottom));
    }

    .nav-logo {
        font-size: 0.875rem;
        left: 50%;
        transform: translateX(-50%) translateY(0.1em);
    }

    .nav-menu {
        min-height: 100px;
    }

    .nav-menu li {
        font-size: 0.75rem;
    }

    .hero {
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .hero-title-top {
        font-size: clamp(0.7rem, 2.5vw, 2rem);
    }

    .hero-title-bottom {
        font-size: clamp(3rem, 12vw, 10rem);
    }

    .projects,
    .sound,
    .gallery,
    .about {
        padding: var(--spacing-lg) 0;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .project-card {
        min-height: 180px;
    }

    .section-title,
    .section-title.music-title,
    .music-title,
    .gallery-title,
    .about-title {
        font-size: clamp(2.25rem, 10vw, 5rem);
        font-weight: 400;
        letter-spacing: 0.15em;
        margin-bottom: var(--spacing-md);
        text-align: center;
        text-transform: uppercase;
    }
    
    /* Rubik 80s Fade font appears thinner, so increase size for visual consistency */
    .section-title.music-title {
        font-size: clamp(2.25rem, 9vw, 4rem);
    }

    .container {
        padding: 0 calc(var(--spacing-xs) + 25px);
        margin-top: 50px;
        margin-bottom: 50px;
    }

    .hero {
        padding: 50px calc(var(--spacing-sm) + 25px);
    }

    .projects,
    .sound,
    .gallery,
    .about,
    .content-section {
        padding: 50px calc(var(--spacing-xs) + 25px);
    }

    .image-modal-content img {
        max-height: 60vh;
    }

    .modal-nav {
        font-size: 1.25rem;
    }

    .footer {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
        padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
    }

    /* Even more compact past shows on very small screens */
    .about-shows h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    .shows-list {
        font-size: 0.75rem;
        line-height: 1.3;
    }

    .shows-list li {
        margin-bottom: 0.4rem;
        padding-left: 0.6rem;
    }
}

/* Progressive image loading with blur effect */
.image-modal-content .modal-image {
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-modal-content .modal-image.loading {
    opacity: 0.7;
    transform: scale(0.98);
}

/* Keep video modal images fully opaque during loading to prevent white flash */
.modal:has(.video-image-modal) .image-modal-content .modal-image.loading {
    opacity: 1;
}

.image-modal-content .modal-image.loaded {
    opacity: 1;
    transform: scale(1);
}

