:root {
    --bg-color: #E3E3E3;
    --card-bg: #ffffff;
    --text-color: #e0e0e0;
    --accent-color: #737373;
    --secondary-text: #a0a0a0;
    --header-compact-h: 2.5rem;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
/* Initial state: full-viewport hero, search bar centered */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    z-index: 1000;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2rem;
    transition: height 0.55s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease 0.5s;
}

/* Compact state: 64px fixed top bar */
body.has-results header {
    height: var(--header-compact-h);
    padding: 0;
}

/* ── Search container ─────────────────────────────────────────────────────── */
.search-container {
    width: min(640px, 100%);
    position: relative;
    display: flex;
    align-items: center;
    transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

body.has-results .search-container {
    width: 100%;
    max-width: none;
}

/* ── Search input ─────────────────────────────────────────────────────────── */
#search-input {
    width: 100%;
    padding: 1.4rem 1.8rem;
    padding-right: 3.5rem;
    border-radius: 4rem;
    border: 0;
    background-color: #ffffff;
    color: black;
    font-size: 1rem;
    outline: none;
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    font-weight: 500;
    transition:
        padding 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        font-size 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.15s ease,
        color 0.15s ease 0.5s,
        border-radius 0.5s ease 0.5s,
        padding 0.15s ease;
}

/* Focused hero: invert to black */
#search-input:focus {
    background-color: #000;
    color: white;
}

/* Focused compact: stay white */
body.has-results #search-input:focus {
    background-color: #fff;
    color: black;
}

/* Compact input */
body.has-results #search-input {
    border-radius: 0;
    padding: 0.6rem 1.8rem;
}

/* ── Search button ────────────────────────────────────────────────────────── */
#search-btn {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--secondary-text);
    transition: color 0.25s ease;
}

/* Button turns white when input is focused (black bg) */
.search-container:focus-within #search-btn {
    color: white;
}

#search-btn:hover {
    color: var(--accent-color);
}

/* ── Gallery ──────────────────────────────────────────────────────────────── */
/* Initially invisible, pushed below the full-height hero */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2.5rem;
    min-height: 300px;
    padding: 0 2.5rem 2rem;

    /* Start invisible at the bottom of the 100vh hero */
    margin-top: 100vh;
    opacity: 0;
    pointer-events: none;

    transition:
        margin-top .15s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.15s 0.15s ease;
    /* delay opacity so header collapses first */
}

/* After search: gallery slides into view below compact header */
body.has-results .gallery {
    margin-top: calc(var(--header-compact-h) + 2.5rem);
    opacity: 1;
    pointer-events: auto;
}

/* ── Image cards ──────────────────────────────────────────────────────────── */
.image-card {
    border-radius: 0;
    overflow: visible;
    transition: transform 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.image-card img {
    width: 100%;
    object-fit: contain;
    background-color: transparent;
    display: block;
    max-height: 30rem;
}

.image-info {
    opacity: 0;
    transition: opacity 0.3s;
    height: 1px;
    overflow: visible;
    color: black;
    width: 100%;
    margin-top: 1rem;
    z-index: 1;
}

.image-card:hover .image-info {
    opacity: 1;
}

.score {
    font-size: 0.8rem;
    color: var(--accent-color);
    font-weight: 600;
}

.title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.author {
    font-size: 0.8rem;
    font-style: italic;
}

.placeholder-text {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--secondary-text);
    font-size: 1.2rem;
    margin-top: 3rem;
}

@media (max-width: 600px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0 .5rem 2rem;
    }

    .image-card img {
        height: 200px;
    }

    body.has-results #search-input {
        padding: 0.6rem .5rem;
    }
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background-color: var(--bg-color);
    flex-direction: column;
    animation: fadeIn 0.2s ease;
}

.lightbox.open {
    display: flex;
}

/* Image area: takes most of the vertical space */
.lightbox-img-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 3rem 6rem 1rem;
}

#lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Bottom bar: title left, download right */
.lightbox-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 1.5rem 3rem 2rem;
    gap: 2rem;
    font-size: clamp(0.8rem, 1.5vw, 1.1rem);
    line-height: 1;
}

.lightbox-meta {
    display: flex;
    flex-direction: row;
    gap: 0.6rem;
    max-width: 50%;
    align-items: end;
}

#lightbox-title {
    font-weight: 700;
    color: black;
    text-transform: uppercase;
    flex-shrink: 1;
}

/* Author · museum row */
.lightbox-sub {
    display: flex;
    gap: 2.5rem;
    text-transform: uppercase;
    font-weight: 500;
    color: black;
    align-items: end;
}

/* DOWNLOAD as plain bold text */
.download-btn {
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    color: black;
    white-space: nowrap;
    transition: opacity 0.15s;
    flex-shrink: 0;
    align-self: flex-end;
}

.download-btn:hover {
    opacity: 0.5;
}

/* × close — top right, pure CSS cross */
.lightbox-close {
    /* ── tweak these ── */
    --close-size: 18px;
    --close-thickness: 2px;
    --close-color: black;
    --close-angle: 45deg;
    /* ─────────────── */

    position: fixed;
    top: 1.2rem;
    right: 2rem;
    width: calc(var(--close-size) * 1.414);
    height: calc(var(--close-size) * 1.414);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-close::before,
.lightbox-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--close-size);
    height: var(--close-thickness);
    background: var(--close-color);
    border-radius: 0;
    transform-origin: center;
}

.lightbox-close::before {
    transform: translate(-50%, -50%) rotate(var(--close-angle));
}

.lightbox-close::after {
    transform: translate(-50%, -50%) rotate(calc(var(--close-angle) + 90deg));
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}