/* ============================================================
   Dimi's Photography Portfolio — Dark Theme (Responsive)
   ============================================================ */

:root {
    --bg: #0a0a0a;
    --bg-elevated: #111111;
    --border: #1a1a1a;
    --border-hover: #2a2a2a;
    --text-primary: #f0f0f0;
    --text-secondary: #888;
    --text-muted: #444;
    --accent: #ffffff;
    --accent-dim: rgba(255,255,255,0.1);
    --radius: 8px;
    --transition: 0.2s ease;

    /* Touch target minimum */
    --touch-min: 44px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    /* Prevent horizontal scroll */
    overflow-x: hidden;
    width: 100%;
}

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Prevent horizontal scroll */
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* ============================================================
   Header
   ============================================================ */

.header {
    padding: 2rem 2rem 0;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: opacity var(--transition);
    /* Touch-friendly */
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
}

.logo:hover {
    opacity: 0.7;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 300;
    white-space: nowrap;
}

/* ============================================================
   Hamburger Button (mobile only)
   ============================================================ */

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: var(--touch-min);
    height: var(--touch-min);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 200;
    -webkit-tap-highlight-color: transparent;
    border-radius: 4px;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

/* Hamburger open state animation */
.hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   Trip Navigation
   ============================================================ */

.trip-nav {
    padding: 2rem 2rem 1.5rem;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition), max-height 0.35s ease, padding 0.35s ease;
}

.trip-nav.scrolled {
    border-bottom-color: var(--border);
}

.trip-nav ul {
    max-width: 1400px;
    margin: 0 auto;
    list-style: none;
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.trip-nav a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    border-radius: 100px;
    transition: all var(--transition);
    white-space: nowrap;
    /* Touch-friendly */
    min-height: var(--touch-min);
}

.trip-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.trip-nav a.active {
    color: var(--bg);
    background: var(--accent);
    font-weight: 500;
}

.trip-nav a .count {
    font-size: 0.7rem;
    color: inherit;
    opacity: 0.6;
    font-weight: 400;
}

/* ============================================================
   Gallery / Masonry
   ============================================================ */

.gallery {
    flex: 1;
    padding: 0 1rem 4rem;
}

.masonry {
    max-width: 1400px;
    margin: 0 auto;
    /* Desktop: 3+ columns */
    columns: 4 280px;
    column-gap: 1rem;
}

/* Large desktop: stretch to fill */
@media (min-width: 1600px) {
    .masonry {
        columns: 5 280px;
    }
}

/* Desktop: 3 columns */
@media (max-width: 1200px) {
    .masonry {
        columns: 3 240px;
    }
}

/* Tablet: 2 columns */
@media (max-width: 900px) {
    .masonry {
        columns: 2 220px;
        column-gap: 0.75rem;
    }

    .header {
        padding: 1.5rem 1.25rem 0;
    }

    .trip-nav {
        padding: 1.25rem 1.25rem 1rem;
    }

    .gallery {
        padding: 0 0.75rem 3rem;
    }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
    .masonry {
        columns: 1;
        column-gap: 0;
    }

    .header {
        padding: 1rem 1rem 0;
    }

    .trip-nav {
        padding: 0.75rem 1rem 0.75rem;
    }

    .gallery {
        padding: 0 0.75rem 2.5rem;
    }

    .header-inner {
        align-items: center;
    }

    .logo {
        font-size: 1.35rem;
    }

    .subtitle {
        font-size: 0.78rem;
    }
}

.masonry-item {
    display: block;
    break-inside: avoid;
    margin-bottom: 1rem;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-elevated);
    transition: transform var(--transition), box-shadow var(--transition);
    /* Touch-friendly: ensure tappable */
    min-height: var(--touch-min);
}

.masonry-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

/* Disable hover lift on touch devices */
@media (hover: none) {
    .masonry-item:hover {
        transform: none;
        box-shadow: none;
    }
}

.masonry-item img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s ease, opacity 0.5s ease;
}

.masonry-item:hover img {
    transform: scale(1.03);
}

@media (hover: none) {
    .masonry-item:hover img {
        transform: none;
    }
}

/* Lazy loading fade-in */
.masonry-item img {
    opacity: 0;
}

.masonry-item img.loaded {
    opacity: 1;
}

/* Overlay on hover */
.item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 50%);
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.masonry-item:hover .item-overlay {
    opacity: 1;
}

/* Always show overlay on touch devices */
@media (hover: none) {
    .item-overlay {
        opacity: 0.85;
        background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 70%);
    }
}

.item-trip {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Touch action for swipe */
    touch-action: pan-y pinch-zoom;
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transition: opacity 0.2s ease;
    /* Prevent image dragging */
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-content img.switching {
    opacity: 0.4;
}

.lightbox-caption {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 1rem;
    font-weight: 300;
    text-align: center;
}

.lightbox-counter {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 300;
}

/* Navigation buttons — all touch-friendly (min 44px) */
.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    z-index: 1001;
    width: var(--touch-min);
    height: var(--touch-min);
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color var(--transition), background var(--transition);
    padding: 0;
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
}

.lightbox-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    z-index: 1001;
    width: 56px;
    height: 56px;
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), background var(--transition);
    padding: 0;
    font-weight: 100;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

/* Mobile lightbox adjustments */
@media (max-width: 640px) {
    .lightbox-content {
        max-width: 96vw;
        max-height: 90vh;
    }

    .lightbox-content img {
        max-width: 96vw;
        max-height: 75vh;
    }

    .lightbox-prev,
    .lightbox-next {
        width: var(--touch-min);
        height: var(--touch-min);
        font-size: 1.5rem;
        background: rgba(255,255,255,0.12);
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }

    .lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
        font-size: 1.5rem;
        background: rgba(255,255,255,0.12);
    }

    .lightbox-caption {
        font-size: 0.8rem;
        margin-top: 0.75rem;
    }

    .lightbox-counter {
        bottom: 1.25rem;
        font-size: 0.75rem;
    }
}

/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 6rem 2rem;
    max-width: 480px;
    margin: 0 auto;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h2 {
    font-weight: 300;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.empty-state .coming-soon {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

@media (max-width: 640px) {
    .empty-state {
        padding: 3rem 1.25rem;
    }

    .empty-icon {
        font-size: 3rem;
    }

    .empty-state h2 {
        font-size: 1.3rem;
    }

    .empty-state p {
        font-size: 0.9rem;
    }
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .footer {
        padding: 1.25rem 1rem;
    }

    .footer p {
        font-size: 0.75rem;
    }
}

/* ============================================================
   Mobile Navigation Overlay (hamburger menu)
   ============================================================ */

@media (max-width: 640px) {
    .hamburger {
        display: flex;
    }

    .trip-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(10,10,10,0.97);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 150;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        border-bottom: none;
    }

    .trip-nav.open {
        opacity: 1;
        visibility: visible;
    }

    .trip-nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .trip-nav a {
        font-size: 1.25rem;
        padding: 0.75rem 1.5rem;
        min-height: 56px;
    }

    .trip-nav a .count {
        font-size: 0.85rem;
        opacity: 0.5;
    }
}

/* ============================================================
   Animations
   ============================================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.masonry-item {
    animation: fadeInUp 0.5s ease both;
}

.masonry-item:nth-child(1) { animation-delay: 0.05s; }
.masonry-item:nth-child(2) { animation-delay: 0.1s; }
.masonry-item:nth-child(3) { animation-delay: 0.15s; }
.masonry-item:nth-child(4) { animation-delay: 0.2s; }
.masonry-item:nth-child(5) { animation-delay: 0.25s; }
.masonry-item:nth-child(6) { animation-delay: 0.3s; }
.masonry-item:nth-child(7) { animation-delay: 0.35s; }
.masonry-item:nth-child(8) { animation-delay: 0.4s; }
.masonry-item:nth-child(9) { animation-delay: 0.45s; }
.masonry-item:nth-child(10) { animation-delay: 0.5s; }

/* Disable fade animation on mobile for faster rendering */
@media (max-width: 640px) {
    .masonry-item {
        animation: none;
        opacity: 1;
    }
}

/* ============================================================
   Scrollbar styling
   ============================================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a;
}

/* ============================================================
   Selection
   ============================================================ */

::selection {
    background: rgba(255,255,255,0.15);
    color: #fff;
}
