/* ==========================================================================
   GALLERY + LIGHTBOX
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GALLERY PAGE LAYOUT
   -------------------------------------------------------------------------- */
.gallery-page {
    padding-top: var(--nav-height);
    position: relative;
    isolation: isolate;
}

/* Ambient atmosphere — soft brass-tinted radial wash + subtle ink wash that
   moves with scroll-parallax. Replaces the "floating on plain white" feel. */
.gallery-page::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 12% 8%, rgba(184, 149, 106, 0.08) 0%, rgba(184, 149, 106, 0) 60%),
        radial-gradient(ellipse 70% 60% at 92% 32%, rgba(11, 12, 14, 0.06) 0%, rgba(11, 12, 14, 0) 65%),
        radial-gradient(ellipse 90% 40% at 50% 100%, rgba(184, 149, 106, 0.05) 0%, rgba(184, 149, 106, 0) 55%);
}
/* Whisper-fine grain texture for depth — pure CSS, no asset needed */
.gallery-page::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
    background-image: radial-gradient(circle at 1px 1px, rgba(11, 12, 14, 0.04) 1px, transparent 1.2px);
    background-size: 3px 3px;
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,1) 8%, rgba(0,0,0,1) 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,1) 8%, rgba(0,0,0,1) 92%, transparent 100%);
}

.gallery-page-head {
    padding: clamp(4rem, 9vw, 7rem) var(--gutter) clamp(2.5rem, 5vw, 4rem);
    max-width: var(--container-wide);
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: var(--space-6);
    border-bottom: 1px solid var(--rule);
}

.gallery-page-head .eyebrow {
    margin-bottom: var(--space-3);
}

.gallery-page-head h1 {
    font-size: clamp(3rem, 7vw, 5.5rem);
    line-height: 0.92;
    letter-spacing: -0.025em;
}
.gallery-page-head h1 em { font-style: italic; color: var(--accent-deep); }

.gallery-page-head .description {
    max-width: 42ch;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-top: var(--space-3);
}

.gallery-page-meta {
    text-align: right;
    font-family: var(--font-mono);
    font-size: var(--t-caption);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1.5;
}
.gallery-page-meta strong {
    display: block;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: 0.2em;
}

@media (max-width: 640px) {
    .gallery-page-head { grid-template-columns: 1fr; }
    .gallery-page-meta { text-align: left; }
}

/* --------------------------------------------------------------------------
   2. MASONRY
   CSS Grid + per-item aspect-ratio. Every gallery <img> has explicit
   width/height attributes (added by scripts/fix_gallery_images.py), so the
   browser knows each tile's intrinsic aspect ratio at first paint. We use
   `grid-auto-flow: dense` to pack items efficiently. No JS reflows. No
   layout shift. No "blank space above tiles" — every cell starts at its
   row track and the picture wrapper has `aspect-ratio` baked in.
   -------------------------------------------------------------------------- */
.gallery-masonry {
    --cols: 3;
    --gap: clamp(0.75rem, 1.4vw, 1.25rem);
    /* Vertical spacing is intentionally larger than horizontal — gives the
       grid more breathing room and stops tall portraits from feeling
       cramped against the next tile. JS bakes --vgap-px into each item's
       row-span so the spacing actually pushes the next item down (margins
       and row-gap don't visibly separate items in this grid; row-gap would
       also multiply through every row track inside a tall span). */
    --vgap: clamp(2rem, 3.6vw, 3.25rem);
    display: grid;
    grid-template-columns: repeat(var(--cols), 1fr);
    grid-auto-rows: 1px;
    grid-auto-flow: row dense;
    row-gap: 0;
    column-gap: var(--gap);
    align-items: start;
    max-width: var(--container-wide);
    margin: clamp(2.5rem, 5vw, 4rem) auto;
    padding-inline: var(--gutter);
}

@media (max-width: 1100px) { .gallery-masonry { --cols: 2; } }
@media (max-width: 640px)  { .gallery-masonry { --cols: 1; } }

.gallery-item {
    /* JS sets --row-span from each image's intrinsic aspect ratio +
       --vgap. Default (260) gives a sensible placeholder before JS runs. */
    grid-row-end: span var(--row-span, 260);
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-card);
    cursor: zoom-in;
    background: var(--ink-90);
    display: block;
    box-shadow: 0 16px 38px -28px rgba(11, 12, 14, 0.30);
    transition: box-shadow 0.4s var(--ease-out-quart),
                transform 0.4s var(--ease-out-quart);
}
.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 28px 60px -24px rgba(11, 12, 14, 0.42);
}
@media (prefers-reduced-motion: reduce) {
    .gallery-item { transition: none; }
    .gallery-item:hover { transform: none; }
}

.gallery-item picture {
    display: block;
    width: 100%;
    height: 100%;
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.9s var(--ease-out-quart);
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(11,12,14,0.32), rgba(11,12,14,0) 40%);
    opacity: 0;
    transition: opacity var(--d-2);
    pointer-events: none;
}

.gallery-item:hover img { transform: scale(1.04); }
.gallery-item:hover::after { opacity: 1; }

.gallery-item-num {
    position: absolute;
    top: 0.6rem;
    left: 0.8rem;
    font-family: var(--font-mono);
    font-size: var(--t-caption);
    letter-spacing: 0.05em;
    color: rgba(245,242,236,0.0);
    transition: color var(--d-2);
    pointer-events: none;
    z-index: 1;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}
.gallery-item:hover .gallery-item-num { color: rgba(245,242,236,0.9); }

/* --------------------------------------------------------------------------
   3. GALLERY FILTERS (optional, for future)
   -------------------------------------------------------------------------- */
.gallery-filters {
    max-width: var(--container-wide);
    margin: clamp(1.5rem, 3vw, 2.5rem) auto 0;
    padding-inline: var(--gutter);
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}
.filter-pill {
    padding: 0.55rem 1rem;
    border: 1px solid var(--rule);
    background: transparent;
    border-radius: var(--radius-pill);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--d-1), color var(--d-1), border-color var(--d-1);
}
.filter-pill:hover { color: var(--text); border-color: var(--text); }
.filter-pill.is-active {
    background: var(--ink-10);
    color: var(--bg);
    border-color: var(--ink-10);
}

/* --------------------------------------------------------------------------
   4. LIGHTBOX
   -------------------------------------------------------------------------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(11, 12, 14, 0.96);
    opacity: 0;
    transition: opacity var(--d-2);
}

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

.lightbox-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    color: rgba(245,242,236,0.78);
    font-family: var(--font-mono);
    font-size: var(--t-caption);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lightbox-counter {
    font-family: var(--font-mono);
}
.lightbox-counter .num {
    color: var(--accent-soft);
}

.lightbox-close {
    position: relative;
    width: 36px; height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(245,242,236,0.78);
    transition: color var(--d-1), transform var(--d-2) var(--ease-out-expo);
}
.lightbox-close::before, .lightbox-close::after {
    content: '';
    position: absolute;
    width: 18px; height: 1px;
    background: currentColor;
}
.lightbox-close::before { transform: rotate(45deg); }
.lightbox-close::after  { transform: rotate(-45deg); }
.lightbox-close:hover { color: #F5F2EC; transform: rotate(90deg); }

.lightbox-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-inline: clamp(1rem, 4vw, 4rem);
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.985);
    transition: opacity var(--d-2) var(--ease-out-quart),
                transform var(--d-3) var(--ease-out-expo);
}
.lightbox-image.is-loaded {
    opacity: 1;
    transform: scale(1);
}

.lightbox-spinner {
    position: absolute;
    width: 28px; height: 28px;
    border: 1px solid rgba(245,242,236,0.18);
    border-top-color: var(--accent-soft);
    border-radius: 50%;
    animation: lbSpin 0.9s linear infinite;
}
@keyframes lbSpin { to { transform: rotate(360deg); } }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px; height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(245,242,236,0.78);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    transition: background var(--d-1), border-color var(--d-1), color var(--d-1);
}
.lightbox-nav::before {
    content: '';
    width: 9px; height: 9px;
    border-top: 1px solid currentColor;
    border-right: 1px solid currentColor;
}
.lightbox-prev { left: 1.5rem; }
.lightbox-prev::before { transform: rotate(-135deg) translate(-2px, -2px); }
.lightbox-next { right: 1.5rem; }
.lightbox-next::before { transform: rotate(45deg) translate(-2px, -2px); }

.lightbox-nav:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--accent-soft);
    color: #F5F2EC;
}

.lightbox-cap {
    padding: 1.25rem 1.5rem 1.5rem;
    color: rgba(245,242,236,0.62);
    font-family: var(--font-mono);
    font-size: var(--t-caption);
    letter-spacing: 0.05em;
    text-align: center;
    min-height: 3rem;
}

@media (max-width: 640px) {
    .lightbox-nav { width: 44px; height: 44px; }
    .lightbox-prev { left: 0.75rem; }
    .lightbox-next { right: 0.75rem; }
    .lightbox-frame { padding-inline: 0.5rem; }
}

/* --------------------------------------------------------------------------
   5. PRINTS PAGE STYLES
   -------------------------------------------------------------------------- */
.prints-grid {
    max-width: var(--container);
    margin: 0 auto;
    padding: clamp(2rem, 4vw, 3rem) var(--gutter) clamp(5rem, 10vw, 9rem);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

.print-card {
    background: transparent;
}
.print-card-image {
    aspect-ratio: 4/5;
    overflow: hidden;
    background: var(--ink-90);
    border-radius: var(--radius-card);
    margin-bottom: var(--space-4);
}
.print-card-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 1.2s var(--ease-out-expo);
}
.print-card:hover .print-card-image img { transform: scale(1.04); }

.print-card-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
}
.print-card h3 {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.5rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
}
.print-card .price {
    font-family: var(--font-mono);
    font-size: var(--t-caption);
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   6. PRINTS PAGE — info rows + Stieglitz pull-quote
   -------------------------------------------------------------------------- */
.prints-info {
    padding: clamp(3rem, 7vw, 6rem) var(--gutter);
}
.prints-info-inner {
    max-width: var(--container-narrow);
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    gap: clamp(2.5rem, 5vw, 4.5rem);
}

.prints-info-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: start;
    padding-bottom: clamp(2rem, 4vw, 3rem);
    border-bottom: 1px solid var(--rule);
}
.prints-info-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.prints-info-label .eyebrow {
    color: var(--text-muted);
}

.prints-info-body h2 {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(1.875rem, 3.4vw, 2.75rem);
    line-height: 1.05;
    letter-spacing: -0.012em;
    margin-bottom: var(--space-5);
}
.prints-info-body h2 em {
    font-style: italic;
    color: var(--accent-deep);
}
.prints-info-body p {
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--text-soft);
    max-width: 56ch;
    margin-bottom: var(--space-5);
}
.prints-info-body .link-underline {
    color: var(--text);
}

.prints-quote {
    padding: clamp(4rem, 9vw, 8rem) var(--gutter) clamp(5rem, 11vw, 9rem);
    text-align: center;
    background: var(--bg-muted);
    border-top: 1px solid var(--rule);
}
.prints-quote figure {
    max-width: 760px;
    margin-inline: auto;
}
.prints-quote blockquote {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.5rem, 3vw, 2.375rem);
    line-height: 1.35;
    letter-spacing: -0.005em;
    color: var(--text);
    margin-bottom: var(--space-5);
}
.prints-quote figcaption {
    font-family: var(--font-mono);
    font-size: var(--t-caption);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

@media (max-width: 720px) {
    .prints-info-row { grid-template-columns: 1fr; gap: var(--space-4); }
    .prints-info-label .eyebrow { margin-bottom: var(--space-2); }
}

/* --------------------------------------------------------------------------
   7. REAL ESTATE PAGE — section heads, video features, deliverables, CTA
   -------------------------------------------------------------------------- */
.re-section-head {
    max-width: var(--container-wide);
    margin: 0 auto;
    padding: clamp(3rem, 7vw, 6rem) var(--gutter) clamp(1.5rem, 3vw, 2.5rem);
}
.re-section-head .eyebrow {
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}
.re-section-head h2 {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.25rem, 5vw, 3.75rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
    max-width: 18ch;
}
.re-section-head h2 em {
    font-style: italic;
    color: var(--accent-deep);
}

/* Video intro spacer */
.re-video-intro {
    border-top: 1px solid var(--rule);
    margin-top: clamp(3rem, 6vw, 5rem);
}
.re-video-intro-inner .re-section-head { padding-top: clamp(4rem, 8vw, 7rem); }

/* Alternating video + text feature row */
.re-video-feature {
    padding: clamp(1.5rem, 3vw, 2.5rem) var(--gutter) clamp(2.5rem, 5vw, 4rem);
}
.re-video-feature-inner {
    max-width: var(--container-wide);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}
.re-video-feature--reverse .re-video-feature-inner {
    grid-template-columns: 1.15fr 0.85fr;
}
.re-video-feature--reverse .re-video-text {
    order: 2;
}
.re-video-feature--reverse .re-video-frame {
    order: 1;
}

.re-video-text .eyebrow {
    margin-bottom: var(--space-3);
}
.re-video-text h3 {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(1.875rem, 3.6vw, 2.875rem);
    line-height: 1.04;
    letter-spacing: -0.018em;
    margin-bottom: var(--space-5);
}
.re-video-text h3 em {
    font-style: italic;
    color: var(--accent-deep);
}
.re-video-text p {
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--text-soft);
    max-width: 50ch;
}

.re-video-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--ink-90);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
}
.re-video-frame video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* Vertical 9:16 (mobile-shot tour) — narrower, capped, centered in its column. */
.re-video-frame--vertical {
    aspect-ratio: 9 / 16;
    width: 100%;
    max-width: 360px;
    margin-inline: auto;
    background: #000;
}
.re-video-frame--vertical video {
    object-fit: contain;
}
/* Re-balance the row so a vertical frame doesn't get a giant column reserved for it. */
.re-video-feature--vertical .re-video-feature-inner {
    grid-template-columns: 1fr 0.6fr;
    align-items: center;
}
.re-video-feature--vertical.re-video-feature--reverse .re-video-feature-inner {
    grid-template-columns: 0.6fr 1fr;
}

@media (max-width: 880px) {
    .re-video-feature--vertical .re-video-feature-inner,
    .re-video-feature--vertical.re-video-feature--reverse .re-video-feature-inner {
        grid-template-columns: 1fr;
    }
    .re-video-frame--vertical { max-width: 320px; }
}

@media (max-width: 880px) {
    .re-video-feature-inner,
    .re-video-feature--reverse .re-video-feature-inner {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
    .re-video-feature--reverse .re-video-text  { order: 0; }
    .re-video-feature--reverse .re-video-frame { order: 0; }
}

/* Deliverables — six-card grid */
.re-deliverables {
    background: var(--bg-muted);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding-bottom: clamp(4rem, 8vw, 7rem);
    margin-top: clamp(3rem, 6vw, 5rem);
}
.re-deliverables-inner {
    max-width: var(--container-wide);
    margin: 0 auto;
}
.re-deliverables .re-section-head {
    padding: clamp(4rem, 8vw, 7rem) var(--gutter) clamp(2rem, 4vw, 3rem);
    margin: 0;
}

.re-deliverables-grid {
    list-style: none;
    margin: 0;
    padding: 0 var(--gutter);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.5rem, 2.5vw, 2.5rem);
}

.re-deliverable {
    padding: clamp(1.5rem, 2.5vw, 2.25rem);
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: var(--radius-card);
    transition: transform var(--d-2) var(--ease-out-quart), box-shadow var(--d-2);
}
.re-deliverable:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}

.re-deliverable .num {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--t-caption);
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: var(--space-4);
}
.re-deliverable h4 {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.4rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: var(--space-3);
}
.re-deliverable p {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
}

@media (max-width: 1024px) {
    .re-deliverables-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .re-deliverables-grid { grid-template-columns: 1fr; }
}

/* Get-a-quote CTA */
.re-cta {
    padding: clamp(5rem, 10vw, 9rem) var(--gutter);
    text-align: center;
}
.re-cta-inner {
    max-width: 720px;
    margin: 0 auto;
}
.re-cta h2 {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.025em;
    margin: var(--space-4) 0 var(--space-5);
}
.re-cta h2 em {
    font-style: italic;
    color: var(--accent-deep);
}
.re-cta p {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text-soft);
    max-width: 56ch;
    margin: 0 auto var(--space-7);
}
.re-cta-buttons {
    display: inline-flex;
    align-items: center;
    gap: var(--space-6);
    flex-wrap: wrap;
    justify-content: center;
}
