.archive-gallery {
    --gallery-ink: #0c1a2d;
    --gallery-muted: #627083;
    --gallery-paper: #f3f5f7;
    --gallery-line: rgba(15, 34, 57, .16);
    --gallery-card: #fff;
    --gallery-brass: #d7ad58;
    background: var(--gallery-paper);
    color: var(--gallery-ink);
}

html.dark .archive-gallery {
    --gallery-ink: #edf2f8;
    --gallery-muted: #9eabb9;
    --gallery-paper: #07111d;
    --gallery-line: rgba(218, 229, 240, .15);
    --gallery-card: #0b1826;
    --gallery-brass: #e0ca8d;
}

.archive-gallery__hero {
    position: relative;
    min-height: min(850px, 92vh);
    overflow: hidden;
    isolation: isolate;
    background: #07111d;
    background-color: #07111d !important;
    color: #fff;
}

.archive-gallery__hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: .18;
    background-image:
        linear-gradient(rgba(255,255,255,.14) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.14) 1px, transparent 1px);
    background-size: 74px 74px;
    mask-image: linear-gradient(to right, #000, transparent 63%);
    pointer-events: none;
}

.archive-gallery__hero-media,
.archive-gallery__hero-shade {
    position: absolute;
    inset: 0;
}

.archive-gallery__hero-frame {
    position: absolute;
    overflow: hidden;
    margin: 0;
    background: #142130;
    box-shadow: 0 35px 90px rgba(0, 0, 0, .42);
}

.archive-gallery__hero-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.archive-gallery__hero-frame--primary {
    inset: 0 0 0 42%;
}

.archive-gallery__hero-frame--secondary {
    width: 22%;
    height: 34%;
    right: 4.5%;
    bottom: 5%;
    z-index: 2;
    border: 1px solid rgba(255,255,255,.32);
}

.archive-gallery__hero-frame--tertiary {
    width: 17%;
    height: 25%;
    right: 27.5%;
    top: 19%;
    z-index: 2;
    border: 1px solid rgba(255,255,255,.32);
}

.archive-gallery__hero-shade {
    z-index: 0;
    background: linear-gradient(90deg, #07111d 0%, #07111d 34%, rgba(7,17,29,.76) 53%, rgba(7,17,29,.12) 100%);
}

.archive-gallery__hero-copy {
    position: relative;
    z-index: 3;
    display: flex;
    box-sizing: border-box;
    min-height: min(850px, 92vh);
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: clamp(12rem, 24vh, 16rem) clamp(1.5rem, 7vw, 7rem) 7rem;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.archive-gallery__eyebrow,
.archive-gallery__kicker {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    color: var(--gallery-brass) !important;
    font: 700 .84rem/1.2 "Barlow Condensed", sans-serif;
    letter-spacing: .18em;
}

.archive-gallery__eyebrow::before,
.archive-gallery__kicker::before {
    content: "";
    width: 2.6rem;
    height: 1px;
    background: currentColor;
}

.archive-gallery__hero h1 {
    max-width: 760px;
    margin: 1.5rem 0 1.2rem;
    color: #fff !important;
    font: 800 clamp(3.6rem, 8vw, 8.8rem)/.8 "Barlow Condensed", sans-serif;
    letter-spacing: -.035em;
    text-wrap: balance;
}

.archive-gallery__hero-copy > p {
    max-width: 580px;
    margin: 0;
    color: #c6d0dc !important;
    font-size: clamp(1rem, 1.35vw, 1.22rem);
    line-height: 1.75;
}

.archive-gallery__hero-link {
    display: inline-flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2.4rem;
    padding: .85rem 0;
    border-bottom: 1px solid rgba(224,202,141,.6);
    color: #fff;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.archive-gallery__hero-link span {
    color: var(--gallery-brass) !important;
    font-size: 1.2rem;
}

.archive-gallery__hero-index {
    position: absolute;
    z-index: 4;
    right: clamp(1.5rem, 5vw, 5rem);
    bottom: 2.1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    color: rgba(255,255,255,.8) !important;
    font: 600 .8rem/1 "Barlow Condensed", sans-serif;
    letter-spacing: .16em;
}

.archive-gallery__hero-index i {
    display: block;
    width: 5rem;
    height: 1px;
    background: rgba(255,255,255,.45);
}

.archive-gallery__hero-index span {
    color: inherit !important;
}

.archive-gallery__collection {
    position: relative;
    overflow: hidden;
    padding: clamp(5rem, 8vw, 9rem) clamp(1.25rem, 5vw, 5rem) clamp(6rem, 9vw, 10rem);
    background:
        linear-gradient(var(--gallery-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--gallery-line) 1px, transparent 1px),
        var(--gallery-paper);
    background-size: 72px 72px;
    background-color: var(--gallery-paper) !important;
}

/* Small brass captions need an ink-strength tone on light paper, not hero gold. */
html:not(.dark) .archive-gallery__collection {
    --gallery-brass: #86622c;
}

.archive-gallery__collection::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, var(--gallery-paper) 4%, transparent 42%, var(--gallery-paper) 96%);
    pointer-events: none;
}

.archive-gallery__intro,
.archive-gallery__filters,
.archive-gallery__grid,
.archive-gallery__empty {
    position: relative;
    z-index: 1;
    width: min(1380px, 100%);
    margin-inline: auto;
}

.archive-gallery__intro {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr) auto;
    gap: clamp(2rem, 5vw, 6rem);
    align-items: end;
    padding-bottom: clamp(2.8rem, 5vw, 5rem);
    border-bottom: 1px solid var(--gallery-line);
}

.archive-gallery__intro h2 {
    max-width: 680px;
    margin: 1.2rem 0 0;
    font: 800 clamp(2.8rem, 5.3vw, 5.8rem)/.88 "Barlow Condensed", sans-serif;
    letter-spacing: -.025em;
    text-transform: uppercase;
    color: var(--gallery-ink) !important;
}

.archive-gallery__intro > p {
    margin: 0;
    color: var(--gallery-muted) !important;
    line-height: 1.75;
}

.archive-gallery__count {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 6rem;
}

.archive-gallery__count strong {
    color: var(--gallery-brass);
    font: 800 clamp(3rem, 5vw, 5rem)/.8 "Barlow Condensed", sans-serif;
}

.archive-gallery__count span {
    margin-top: .7rem;
    color: var(--gallery-muted) !important;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.archive-gallery__filters {
    display: flex;
    gap: clamp(1.25rem, 3vw, 3rem);
    margin-top: 2.2rem;
    padding-bottom: 1rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.archive-gallery__filter {
    position: relative;
    flex: 0 0 auto;
    padding: .4rem 0 .75rem;
    border: 0;
    background: transparent;
    color: var(--gallery-muted);
    font-size: .73rem;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    cursor: pointer;
}

.archive-gallery__filter::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--gallery-brass);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .28s ease;
}

.archive-gallery__filter:hover,
.archive-gallery__filter:focus-visible,
.archive-gallery__filter.is-active {
    color: var(--gallery-ink);
}

.archive-gallery__filter.is-active::after {
    transform: scaleX(1);
}

.archive-gallery__grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: clamp(1.15rem, 2vw, 2rem);
    margin-top: clamp(2.5rem, 5vw, 5rem);
}

.archive-gallery__item {
    grid-column: span 4;
    min-width: 0;
}

.archive-gallery__item--featured {
    grid-column: span 6;
}

.archive-gallery__item[hidden] {
    display: none !important;
}

.archive-gallery__open {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: zoom-in;
}

.archive-gallery__image {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #172333;
}

.archive-gallery__item--featured .archive-gallery__image {
    aspect-ratio: 16 / 10;
}

.archive-gallery__image::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255,255,255,.15);
    box-shadow: inset 0 -80px 80px -80px rgba(0,0,0,.7);
    pointer-events: none;
}

.archive-gallery__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .75s cubic-bezier(.2,.75,.2,1), filter .45s ease;
}

.archive-gallery__open:hover .archive-gallery__image img,
.archive-gallery__open:focus-visible .archive-gallery__image img {
    transform: scale(1.035);
    filter: saturate(1.06) contrast(1.03);
}

.archive-gallery__image-index,
.archive-gallery__expand {
    position: absolute;
    z-index: 2;
    color: #fff !important;
    font: 700 .8rem/1 "Barlow Condensed", sans-serif;
    letter-spacing: .12em;
}

.archive-gallery__image-index {
    left: 1rem;
    bottom: 1rem;
}

.archive-gallery__expand {
    top: 1rem;
    right: 1rem;
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    place-items: center;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 50%;
    background: rgba(4,13,23,.38);
    font-size: 1.2rem;
    transition: background .25s ease, color .25s ease, transform .25s ease;
}

.archive-gallery__open:hover .archive-gallery__expand,
.archive-gallery__open:focus-visible .archive-gallery__expand {
    background: var(--gallery-brass);
    color: #07111d;
    transform: rotate(90deg);
}

.archive-gallery__caption {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .5rem;
    padding: 1.15rem 0 1rem;
    border-bottom: 1px solid var(--gallery-line);
}

.archive-gallery__caption > span {
    color: var(--gallery-brass) !important;
    font-size: .63rem;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.archive-gallery__caption strong {
    color: var(--gallery-ink) !important;
    font: 700 clamp(1.25rem, 2vw, 1.75rem)/1.08 "Barlow Condensed", sans-serif;
}

.archive-gallery__empty {
    padding: 5rem 0;
    color: var(--gallery-muted);
    text-align: center;
}

.archive-gallery__dialog {
    width: min(1120px, calc(100% - 2rem));
    max-width: none;
    max-height: calc(100vh - 2rem);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(224,202,141,.38);
    background: #07111d;
    color: #fff;
    box-shadow: 0 45px 120px rgba(0,0,0,.65);
}

.archive-gallery__dialog::backdrop {
    background: rgba(1,7,13,.88);
    backdrop-filter: blur(10px);
}

.archive-gallery__dialog-bar,
.archive-gallery__dialog-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.archive-gallery__dialog-bar p {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
}

.archive-gallery__dialog-bar span {
    color: var(--gallery-brass);
    font-size: .66rem;
    letter-spacing: .12em;
}

.archive-gallery__dialog-bar strong {
    font: 600 1.05rem/1.2 "Barlow Condensed", sans-serif;
}

.archive-gallery__dialog-bar button {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 1.45rem;
    cursor: pointer;
}

.archive-gallery__dialog figure {
    display: grid;
    height: min(72vh, 760px);
    margin: 0;
    place-items: center;
    background: #02070c;
}

.archive-gallery__dialog figure img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.archive-gallery__dialog figcaption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.archive-gallery__dialog-nav {
    border-top: 1px solid rgba(255,255,255,.12);
    border-bottom: 0;
}

.archive-gallery__dialog-nav button {
    border: 0;
    background: transparent;
    color: #d7e0ea;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    cursor: pointer;
}

.archive-gallery__dialog-nav span {
    color: var(--gallery-brass);
    font-size: 1rem;
}

/* Preserve the gallery's photographic palette against legacy global light-mode
   conversion rules, whose selector specificity intentionally covers old pages. */
html:not(.dark) #main-content .archive-gallery__hero {
    background-color: #07111d !important;
}

html:not(.dark) #main-content .archive-gallery__hero h1,
html:not(.dark) #main-content .archive-gallery__hero-link {
    color: #fff !important;
}

html:not(.dark) #main-content .archive-gallery__hero-copy > p {
    color: #c6d0dc !important;
}

html:not(.dark) #main-content .archive-gallery__eyebrow,
html:not(.dark) #main-content .archive-gallery__kicker,
html:not(.dark) #main-content .archive-gallery__hero-link span {
    color: var(--gallery-brass) !important;
}

html:not(.dark) #main-content .archive-gallery__hero-index,
html:not(.dark) #main-content .archive-gallery__hero-index span {
    color: rgba(255,255,255,.8) !important;
}

html:not(.dark) #main-content .archive-gallery__collection {
    background-color: var(--gallery-paper) !important;
}

html:not(.dark) #main-content .archive-gallery__intro h2,
html:not(.dark) #main-content .archive-gallery__caption strong {
    color: var(--gallery-ink) !important;
}

html:not(.dark) #main-content .archive-gallery__intro > p,
html:not(.dark) #main-content .archive-gallery__count span {
    color: var(--gallery-muted) !important;
}

html:not(.dark) #main-content .archive-gallery__image-index,
html:not(.dark) #main-content .archive-gallery__expand {
    color: #fff !important;
}

html:not(.dark) #main-content .archive-gallery__caption > span {
    color: var(--gallery-brass) !important;
}

@media (max-width: 960px) {
    .archive-gallery__hero-frame--primary { inset: 0 0 0 25%; }
    .archive-gallery__hero-frame--tertiary { display: none; }
    .archive-gallery__hero-frame--secondary { width: 29%; }
    .archive-gallery__hero-shade { background: linear-gradient(90deg, #07111d 0%, rgba(7,17,29,.92) 43%, rgba(7,17,29,.28) 100%); }
    .archive-gallery__intro { grid-template-columns: 1fr auto; }
    .archive-gallery__intro > p { grid-column: 1 / -1; max-width: 720px; }
    .archive-gallery__item { grid-column: span 6; }
}

@media (max-width: 640px) {
    .archive-gallery__hero { min-height: 760px; }
    .archive-gallery__hero-frame--primary { inset: 0; opacity: .7; }
    .archive-gallery__hero-frame--secondary { width: 42%; height: 25%; right: 1rem; bottom: 1rem; }
    .archive-gallery__hero-shade { background: linear-gradient(180deg, rgba(7,17,29,.8), rgba(7,17,29,.93) 62%, #07111d); }
    .archive-gallery__hero-copy { min-height: 760px; padding: 12rem 1.25rem 7rem; justify-content: flex-start; }
    .archive-gallery__hero h1 { max-width: 100%; font-size: clamp(2.55rem, 12.8vw, 4rem); }
    .archive-gallery__hero-index { display: none; }
    .archive-gallery__collection { padding-inline: 1rem; background-size: 48px 48px; }
    .archive-gallery__intro { grid-template-columns: 1fr; gap: 1.5rem; }
    .archive-gallery__count { align-items: flex-start; }
    .archive-gallery__item,
    .archive-gallery__item--featured { grid-column: 1 / -1; }
    .archive-gallery__item--featured .archive-gallery__image { aspect-ratio: 4 / 3; }
    .archive-gallery__dialog { width: calc(100% - 1rem); }
    .archive-gallery__dialog figure { height: 64vh; }
    .archive-gallery__dialog-bar strong { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .archive-gallery__image img,
    .archive-gallery__expand { transition: none; }
}
