/* ========================================
   COLLECTION PAGE
======================================== */

.collection-hero {
    padding: 11rem 0 5rem;
    background: linear-gradient(180deg, var(--blend-0) 0%, var(--blend-1) 100%);
}

.collection-hero h1 {
    max-width: none;
    font-size: clamp(3.5rem, 8vw, 7rem);
    line-height: .95;
}

.collection-hero p {
    max-width: 560px;
}

/* ========================================
   FILTERS
======================================== */

.gallery {
    padding-top: 3rem;
    background: linear-gradient(180deg, var(--blend-1) 0%, var(--blend-3) 100%);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.filter {
    padding: .6rem 1.5rem;
    border: 1px solid rgba(58, 46, 40, .45);
    border-radius: 999px;
    background: transparent;
    font: inherit;
    font-size: .85rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--deep-espresso);
    cursor: pointer;
    transition: background .3s ease, color .3s ease;
}

.filter:hover {
    background: rgba(255, 255, 255, .5);
}

.filter[aria-pressed="true"] {
    border-color: var(--deep-espresso);
    background: var(--deep-espresso);
    color: var(--coconut-cream);
}

.filter:focus-visible {
    outline: 2px solid var(--antique-wood);
    outline-offset: 3px;
}

.filters__count {
    margin: 1.25rem 0 2rem;
    font-size: .9rem;
    color: var(--label);
}

/* ========================================
   GRID: masonry columns, images keep their own shape
======================================== */

.gallery__grid {
    columns: 3 18rem;
    column-gap: 1.5rem;
}

.tile {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 1.5rem;
    padding: 0;
    border: 0;
    border-radius: 18px;
    overflow: hidden;
    background: var(--soft-linen);
    cursor: zoom-in;
    break-inside: avoid;
}

.tile[hidden] {
    display: none;
}

.tile img {
    display: block;
    width: 100%;
    height: auto;
    filter: sepia(.12) saturate(.94);
    transition: transform .9s ease, filter .9s ease;
}

.tile:hover img,
.tile:focus-visible img {
    transform: scale(1.05);
    filter: sepia(0) saturate(1.05);
}

.tile:focus-visible {
    outline: 2px solid var(--antique-wood);
    outline-offset: 3px;
}

.tile__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2.5rem 1.25rem 1rem;
    background: linear-gradient(180deg, rgba(58, 46, 40, 0), rgba(58, 46, 40, .75));
    color: #fff;
    font-size: .8rem;
    letter-spacing: .16em;
    text-align: left;
    text-transform: uppercase;
    transform: translateY(100%);
    transition: transform .5s ease;
}

.tile:hover .tile__caption,
.tile:focus-visible .tile__caption {
    transform: none;
}

/* Tiles rise into place as they scroll in; browsers without
   scroll-driven animation just show them */
@keyframes tile-in {
    from { opacity: 0; transform: translateY(2.5rem) scale(.96); }
    to   { opacity: 1; transform: none; }
}

@supports (animation-timeline: view()) {
    .tile {
        animation: tile-in linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 45%;
    }
}

/* Filtering: tiles glide to their new places (View Transitions) */
::view-transition-group(*) {
    animation-duration: .6s;
    animation-timing-function: cubic-bezier(.65, 0, .25, 1);
}

/* ========================================
   LIGHTBOX
======================================== */

.lightbox {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    padding: 4rem 5rem;
    border: 0;
    background: transparent;
    color: var(--ivory-lace);
}

.lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox::backdrop {
    background: rgba(25, 20, 18, .94);
}

.lightbox figure {
    margin: 0;
    text-align: center;
}

.lightbox img {
    display: block;
    max-width: min(90vw, 1200px);
    max-height: 78vh;
    margin: 0 auto;
    border-radius: 12px;
}

.lightbox figcaption {
    margin-top: 1rem;
    font-size: .85rem;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.lightbox button {
    border: 0;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background .3s ease;
}

.lightbox button:hover {
    background: rgba(255, 255, 255, .28);
}

.lightbox button:focus-visible {
    outline: 2px solid var(--honey-oatmilk);
    outline-offset: 3px;
}

.lightbox__close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    width: 52px;
    height: 52px;
    margin-top: -26px;
    border-radius: 50%;
}

.lightbox__prev { left: 1.25rem; }
.lightbox__next { right: 1.25rem; }

/* ========================================
   CALL TO ACTION   (oat latte, meets the footer)
======================================== */

.collection-cta {
    padding: 7rem 0;
    background: linear-gradient(180deg, var(--blend-3) 0%, var(--blend-4) 100%);
    text-align: center;
}

.collection-cta h2 {
    margin-bottom: 2rem;
}

@media (max-width: 991.98px) {
    .collection-hero { padding: 9rem 0 3.5rem; }
    .gallery__grid { columns: 2 14rem; column-gap: 1rem; }
    .tile { margin-bottom: 1rem; }
    .lightbox { padding: 4.5rem 1rem 3rem; }
}

@media (max-width: 575.98px) {
    .gallery__grid { columns: 1; }
}

/* ========================================
   TOUCH AND MOBILE FIXES
======================================== */

.filter { min-height: 44px; }
.lightbox img { width: auto; height: auto; }

/* Phones have no hover, so captions stay visible */
@media (hover: none) {
    .tile__caption { transform: none; }
    .tile:hover img { transform: none; }
}

@supports (height: 100dvh) {
    .lightbox { height: 100dvh; max-height: 100dvh; }
}

@media (max-width: 575.98px) {
    .filters { gap: .5rem; }
    .filter { padding: .55rem 1.1rem; }
}
