* {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --gallery-bg: #fafaf8;
    --gallery-text: #1a1a1a;
    --gallery-muted: #666;
    --gallery-border: #e0e0e0;
    --gallery-accent: #f0b970;
    --gallery-hero-bg: linear-gradient(180deg, var(--gallery-bg) 20%, var(--gallery-accent) 100%);
    --gallery-overlay: rgba(0, 0, 0, 0.95);
    --gallery-transition-depth: clamp(5rem, 12vw, 9rem);
}

html {
    scroll-behavior: smooth;
}

html,
body {
    margin: 0;
    min-height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--gallery-bg);
    color: var(--gallery-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

.gallery-page {
    min-height: 100vh;
    overflow-x: hidden;
}

.gallery-hero {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--gallery-hero-bg);
}

.gallery-hero__content {
    display: flex;
    width: min(800px, 100%);
    max-width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.gallery-hero__title {
    margin: 0 0 0.5rem;
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 300;
    letter-spacing: 0;
    line-height: 1.04;
    overflow-wrap: anywhere;
}

.gallery-hero__title-word {
    display: inline-block;
    white-space: nowrap;
}

.gallery-hero__title-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.38em) rotateX(34deg);
    transform-origin: 50% 80%;
    animation: galleryTitleLetterIn 620ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: calc(0.08s + (var(--letter-index) * 0.055s));
    will-change: opacity, transform;
}

.gallery-hero__title-space {
    display: inline-block;
    width: 0.28em;
}

.gallery-hero__subtitle {
    margin-bottom: 3rem;
    color: var(--gallery-muted);
    font-size: 1.125rem;
    letter-spacing: 0.2em;
    opacity: 0;
    text-transform: uppercase;
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
}

.gallery-hero__text {
    max-width: 600px;
    margin: 0 auto 2rem;
    color: var(--gallery-muted);
    font-size: 1.125rem;
    font-weight: 300;
    line-height: 1.8;
    opacity: 0;
    overflow-wrap: break-word;
    animation: fadeInUp 0.8s ease-out 0.6s forwards;
}

.gallery-hero__meta {
    margin-top: 0;
    margin-bottom: 2rem;
    color: var(--gallery-muted);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    opacity: 0;
    text-transform: uppercase;
    overflow-wrap: break-word;
    animation: fadeInUp 0.8s ease-out 0.7s forwards;
}

.gallery-hero__arrow {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    color: var(--gallery-text);
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px);
    animation: galleryArrowIn 460ms ease-out 0.95s forwards;
}

.gallery-hero__arrow svg {
    width: 40px;
    height: 40px;
    animation: galleryArrowFloat 1.5s ease-in-out 1.55s infinite;
}

.gallery-hero__arrow path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: galleryArrowDraw 780ms ease-out 1.05s forwards;
}

.gallery-container {
    position: relative;
    z-index: 1;
    width: min(1400px, 100%);
    margin: 0 auto;
    padding: 4rem 1rem;
    background: var(--gallery-bg);
}

.gallery-grid {
    width: 100%;
    margin: 0;
    scroll-margin-top: 1rem;
    column-count: 4;
    column-gap: 1.5rem;
    animation: fadeIn 1s ease-out;
}

.gallery-item {
    appearance: none;
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 1.5rem;
    padding: 0;
    overflow: hidden;
    break-inside: avoid-column;
    page-break-inside: avoid;
    border: 0;
    border-radius: 2px;
    background: #f5f5f0;
    cursor: zoom-in;
    font: inherit;
    text-align: inherit;
}

@media (min-width: 769px) {
    .gallery-item {
        animation: fadeInUp 0.6s ease-out;
    }

    .gallery-item:nth-child(odd) {
        animation-delay: 0.1s;
    }

    .gallery-item:nth-child(even) {
        animation-delay: 0.2s;
    }
}

.gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    background: #f5f5f0;
}

.gallery-item__overlay {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 1.5rem 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    opacity: 0;
    text-transform: uppercase;
    transition: opacity 180ms ease;
}

.gallery-footer {
    padding: 4rem 2rem;
    border-top: 1px solid var(--gallery-border);
    color: var(--gallery-muted);
    font-size: 0.875rem;
    text-align: center;
}

.gallery-support {
    display: grid;
    width: min(920px, calc(100% - 2rem));
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2rem;
    align-items: center;
    margin: 0 auto 4rem;
    padding: 1.35rem 1.5rem;
    border-top: 1px solid var(--gallery-border);
    border-bottom: 1px solid var(--gallery-border);
}

.gallery-support__copy {
    color: var(--gallery-muted);
}

.gallery-support__eyebrow {
    margin: 0 0 0.35rem;
    color: var(--gallery-text);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.gallery-support h2 {
    margin: 0 0 0.35rem;
    color: var(--gallery-text);
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    font-weight: 400;
    letter-spacing: 0;
}

.gallery-support p {
    margin: 0;
}

.gallery-support__action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.7rem;
}

.gallery-support__fallback {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #66748c;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1;
    text-decoration: none;
}

.gallery-support__fallback:hover,
.gallery-support__fallback:focus-visible {
    background: #566177;
}

.gallery-support--uses-widget .gallery-support__fallback {
    display: none;
}

.gallery-support__widget {
    min-height: 42px;
}

.gallery-floating-support {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 900;
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    border: 1px solid rgba(26, 26, 26, 0.12);
    border-radius: 999px;
    background: rgba(250, 250, 248, 0.72);
    color: var(--gallery-text);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
    backdrop-filter: blur(12px);
}

.gallery-floating-support:hover,
.gallery-floating-support:focus-visible {
    border-color: rgba(26, 26, 26, 0.26);
    background: rgba(250, 250, 248, 0.9);
    outline: none;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--gallery-overlay);
}

.lightbox.is-active {
    display: flex;
}

.lightbox__content {
    display: flex;
    max-width: 92vw;
    max-height: 92vh;
    flex-direction: column;
    align-items: center;
}

.lightbox__image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.lightbox__caption {
    max-width: 640px;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.82);
    text-align: center;
}

.lightbox__title {
    margin: 0 0 0.5rem;
    color: #fff;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.lightbox__description {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 300;
}

.lightbox__button {
    position: absolute;
    z-index: 1001;
    padding: 1rem;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
}

.lightbox__button:hover,
.lightbox__button:focus-visible {
    opacity: 0.72;
}

.lightbox__close {
    top: 1rem;
    right: 1rem;
    font-size: 2.5rem;
}

.lightbox__prev {
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
}

.lightbox__next {
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
}

@media (hover: hover) and (pointer: fine) {
    .gallery-item {
        transition: box-shadow 180ms ease;
    }

    .gallery-item img {
        transition: transform 420ms cubic-bezier(0.4, 0, 0.2, 1);
    }

    .gallery-item:hover {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }

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

    .gallery-item:hover .gallery-item__overlay {
        opacity: 1;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .gallery-grid {
        column-count: 2;
        column-gap: 1rem;
    }

    .gallery-item {
        margin-bottom: 1rem;
    }
}

@media (min-width: 1025px) and (max-width: 1400px) {
    .gallery-grid {
        column-count: 3;
        column-gap: 1.25rem;
    }

    .gallery-item {
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 768px) {
    .gallery-hero {
        min-height: 100vh;
        min-height: 100dvh;
        padding: 1.5rem;
    }

    .gallery-hero__title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .gallery-hero__subtitle {
        margin-bottom: 2rem;
        font-size: 0.875rem;
    }

    .gallery-hero__text {
        max-width: 32ch;
        margin-bottom: 2rem;
        font-size: 1rem;
    }

    .gallery-hero__meta {
        max-width: 32ch;
        margin-right: auto;
        margin-left: auto;
    }

    .gallery-container {
        padding: 2rem 0.5rem;
    }

    .gallery-grid {
        column-count: 1;
        column-gap: 0.5rem;
    }

    .gallery-item {
        margin-bottom: 0.5rem;
    }

    .gallery-item__overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
    }

    .lightbox {
        padding: 1rem;
    }

    .lightbox__image {
        max-height: 72vh;
    }

    .lightbox__button {
        padding: 0.5rem;
        font-size: 1.5rem;
    }

    .lightbox__close {
        top: 0.5rem;
        right: 0.5rem;
        font-size: 2rem;
    }

    .gallery-support {
        width: calc(100% - 1rem);
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
        padding: 1rem;
    }

    .gallery-support__action {
        align-items: flex-start;
    }

    .gallery-floating-support {
        top: 0.75rem;
        right: auto;
        left: 0.75rem;
        min-height: 32px;
        padding: 0 0.65rem;
        font-size: 0.7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

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

@keyframes galleryArrowDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes galleryArrowFloat {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(4px);
    }
    60% {
        transform: translateY(2px);
    }
}

@keyframes galleryTitleLetterIn {
    from {
        opacity: 0;
        transform: translateY(0.38em) rotateX(34deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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