/* =========================================================================
   Robin Hamann - Photography Portfolio
   Cinematic, Apple-inspired aesthetics
   ========================================================================= */

/* --- Variables --- */
:root {
    --bg-color: #000000;
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --glass-bg: rgba(20, 20, 20, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);

    --transition-fast: 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    --transition-smooth: 0.6s cubic-bezier(0.16, 1, 0.3, 1);

    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 8rem;
    --header-height: 80px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    display: block;
}

ul {
    list-style: none;
}

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

button {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

/* --- Typography --- */
h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 500;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

h2 {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 500;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* --- Utilities --- */
.page-padding {
    padding-top: calc(var(--header-height) + var(--spacing-lg));
}

/* Reveal Animations */
.reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-up.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-text {
    opacity: 0;
    animation: fadeUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Header / Nav --- */
header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    z-index: 100;
    transition: all var(--transition-smooth);
    border-radius: 40px;
}

.header-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    padding: 0 2.5rem;
    max-width: none;
    margin: 0;
}

/* Apple Liquid-Glass Effect */
header.scrolled {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.logo {
    position: fixed;
    top: 35px;
    left: var(--spacing-md);
    z-index: 102;
    /* Above header */
}

.logo img {
    height: 44px;
    /* Adjust height based on how it looks */
    width: auto;
    display: block;
    /* Inverts the black logo to make it pure white in dark mode */
    filter: invert(1) brightness(100%);
    transition: opacity var(--transition-fast);
}

.logo:hover img {
    opacity: 0.8;
}

.nav-links {
    display: flex;
    gap: var(--spacing-md);
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-primary);
    opacity: 0.8;
    transition: opacity var(--transition-fast);
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    opacity: 1;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--text-primary);
    transition: width var(--transition-fast);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 20px;
    z-index: 101;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s linear;
    transform-origin: 1px;
}

.mobile-menu-toggle.open span:nth-child(1) {
    transform: rotate(45deg);
}

.mobile-menu-toggle.open span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.open span:nth-child(3) {
    transform: rotate(-45deg);
}

.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
    z-index: 99;
}

.mobile-nav.open {
    opacity: 1;
    pointer-events: all;
}

.mobile-nav ul {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.mobile-nav a {
    font-size: 2rem;
    font-weight: 500;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    /* for parallax */
    background-size: cover;
    background-position: center;
    z-index: -1;
    opacity: 0.6;
    transform: translateZ(0);
    /* Hardware accel */
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-color) 100%);
    z-index: -1;
}

.hero-content {
    z-index: 1;
}

/* Mouse scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.7;
}

.mouse {
    width: 26px;
    height: 40px;
    border: 2px solid var(--text-primary);
    border-radius: 13px;
    position: relative;
}

.mouse::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: var(--text-primary);
    border-radius: 2px;
    animation: scroll 1.5s infinite;
}

@keyframes scroll {
    0% {
        transform: translate(-50%, 0);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, 15px);
        opacity: 0;
    }
}

/* --- Gallery Sections (Horizontal Scroll) --- */
.horizontal-scroll-section {
    position: relative;
    width: 100%;
}

.sticky-wrapper {
    position: sticky;
    top: 0;
    height: 100vh;
    /* Takes full viewport */
    width: 100%;
    overflow: hidden;
    /* Prevent horizontal scrollbars */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-header {
    position: absolute;
    top: var(--header-height);
    /* Calculate exact space between header and images (taking 400px min-height into account) */
    height: calc(50vh - max(30vh, 200px) - var(--header-height));
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 10;
}

.gallery-grid {
    display: flex;
    flex-direction: row;
    align-items: center;
    /* Prevent stretching */
    gap: var(--spacing-md);
    padding: 0 5vw;
    /* Add padding layout to start left-aligned and end correctly */
    width: max-content;
    will-change: transform;
}

.gallery-item {
    height: 60vh;
    min-height: 400px;
    width: auto;
    flex: 0 0 auto;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.gallery-item img {
    height: 100%;
    width: auto;
    object-fit: cover;
    transform: scale(1);
    transition: transform var(--transition-smooth);
}

.gallery-item:hover img {
    transform: scale(1.02);
}

/* --- About Page --- */
.about-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
}

@media (min-width: 768px) {
    .about-container {
        flex-direction: row;
        align-items: center;
        gap: var(--spacing-xl);
    }

    .about-image {
        flex: 1;
    }

    .about-text {
        flex: 1;
    }
}

.about-image img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.about-text h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: var(--spacing-md);
}

.about-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.about-text p.contact-email {
    margin-top: var(--spacing-md);
    color: var(--text-primary);
}

.about-text a {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    z-index: 1001;
    transition: transform 0.2s;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 30px;
    color: white;
    padding: 20px;
    z-index: 1001;
    transition: opacity 0.2s;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    /* Header & Nav */
    .nav-links {
        display: none;
    }

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

    .header-container {
        padding: 0 1.5rem;
        height: 50px;
    }

    header {
        top: 15px;
    }

    .logo {
        top: 25px;
        /* Alignment with mobile header */
        left: 20px;
    }

    .logo img {
        height: 30px;
        /* Scaled down logo for mobile */
    }

    /* Section Header and Layout */
    .section-header {
        position: relative;
        top: auto;
        height: auto;
        margin-bottom: var(--spacing-md);
    }

    .gallery-grid {
        width: 100%;
        padding: 0 20px;
        gap: var(--spacing-sm);
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    
    .gallery-grid::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .gallery-item {
        height: 55svh;
        min-height: 300px;
        max-width: 85vw;
        scroll-snap-align: center;
    }

    .gallery-item img {
        object-fit: cover;
    }

    .horizontal-scroll-section {
        padding: var(--spacing-lg) 0;
        height: auto;
    }

    .sticky-wrapper {
        position: relative;
        height: auto;
        display: block;
    }

    .hero {
        height: 100svh;
    }

    /* Navigation & Lightbox */
    .lightbox-prev,
    .lightbox-next {
        display: none;
        /* Already handled by swipe */
    }

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

    /* About Container Layout */
    .about-container {
        padding: var(--spacing-sm) 20px;
    }
}