/* ── The archive ────────────────────────────────────────────────────
   An editorial contact-print archive. The photographs sit on warm
   paper sheets; the interface is kept quiet so the light does the work. */

:root {
    --bg: #0c0e0b;
    --bg-deep: #080a07;
    --paper: #e8e4d8;
    --paper-dim: #a9a597;
    --paper-faint: #6e6b5f;
    --ink: #23251f;
    --ink-soft: rgba(35, 37, 31, 0.55);
    --ink-faint: rgba(35, 37, 31, 0.38);
    --moss: #93a97c;
    --moss-deep: #2f3b27;
    --rust: #c2703e;
    --line: rgba(232, 228, 216, 0.13);
    --line-strong: rgba(232, 228, 216, 0.28);
    --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --mono: 'Share Tech Mono', ui-monospace, 'Courier New', monospace;
    --sans: 'Geist', 'Helvetica Neue', Arial, sans-serif;
    --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 800' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='white' stop-opacity='0.42'/%3E%3Cstop offset='0.2' stop-color='white' stop-opacity='0.62'/%3E%3Cstop offset='0.45' stop-color='white' stop-opacity='0.85'/%3E%3C/linearGradient%3E%3Cfilter id='b' x='-20%25' y='-20%25' width='140%25' height='140%25'%3E%3CfeGaussianBlur stdDeviation='16'/%3E%3C/filter%3E%3C/defs%3E%3Crect width='1200' height='800' fill='url(%23g)'/%3E%3Cpath d='M0 90 C 140 55 260 140 400 110 C 540 80 660 35 800 65 C 940 95 1080 150 1200 105 L 1200 800 L 0 800 Z' fill='white' filter='url(%23b)'/%3E%3C/svg%3E");
}

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

html {
    width: 100%;
    min-height: 100%;
    background: var(--bg-deep);
}
html.embedded { background: transparent; }

body {
    width: 100%;
    min-height: 100vh;
    color: var(--paper);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    background: transparent;
}

/* The room the archive sits in. Its top edge is a soft, wavy gradient so the
   page behind it — the ASCII water when the gallery is embedded — shows
   through. The mask is white below the wave and transparent above it. */
.atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(110% 80% at 88% -14%, rgba(147, 169, 124, 0.10), transparent 58%),
        radial-gradient(85% 70% at -12% 112%, rgba(194, 112, 62, 0.07), transparent 60%),
        radial-gradient(120% 100% at 50% 40%, transparent 45%, rgba(0, 0, 0, 0.35) 100%),
        var(--bg);
    -webkit-mask-image: var(--wave);
    mask-image: var(--wave);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

html.embedded .atmosphere {
    background:
        radial-gradient(110% 80% at 88% -14%, rgba(147, 169, 124, 0.10), transparent 58%),
        radial-gradient(85% 70% at -12% 112%, rgba(194, 112, 62, 0.07), transparent 60%),
        radial-gradient(120% 100% at 50% 40%, transparent 45%, rgba(0, 0, 0, 0.30) 100%),
        linear-gradient(180deg, rgba(12, 14, 11, 0.38) 0%, rgba(12, 14, 11, 0.62) 55%, rgba(12, 14, 11, 0.78) 100%);
}

::selection { background: var(--moss); color: var(--bg); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: rgba(232, 228, 216, 0.12); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(232, 228, 216, 0.24); }

/* ── Masthead ─────────────────────────────────────────────────────── */

.masthead {
    position: relative;
    z-index: 2;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.8rem 3rem 0;
}

.masthead-bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--line);
}

.back {
    font-family: var(--mono);
    font-size: 0.58rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--paper-faint);
    text-decoration: none;
    transition: color 0.2s ease;
}
.back:hover { color: var(--paper); }

.eyebrow {
    font-family: var(--mono);
    font-size: 0.52rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

.masthead-main {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    gap: clamp(2rem, 5vw, 6rem);
    align-items: end;
    padding: clamp(2.5rem, 6vw, 5.5rem) 0 clamp(2rem, 4vw, 3.4rem);
}

.masthead h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(4.4rem, 12.5vw, 11.5rem);
    line-height: 0.78;
    letter-spacing: -0.025em;
    color: var(--paper);
    text-wrap: balance;
}
.masthead h1 .the {
    display: block;
    margin-bottom: clamp(0.8rem, 1.6vw, 1.4rem);
    font-family: var(--mono);
    font-size: clamp(0.5rem, 0.75vw, 0.66rem);
    font-weight: 400;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--paper-faint);
}
.masthead h1 em {
    font-style: italic;
    color: var(--paper);
}

.masthead-aside {
    padding-bottom: clamp(0.3rem, 1vw, 0.9rem);
}
.masthead-aside .lede {
    font-family: var(--serif);
    font-size: clamp(1.3rem, 1.9vw, 1.75rem);
    line-height: 1.32;
    color: var(--paper);
    max-width: 30ch;
}
.masthead-aside .note {
    margin-top: 1rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(0.95rem, 1.1vw, 1.08rem);
    line-height: 1.5;
    color: var(--paper-faint);
    max-width: 32ch;
}

.masthead-rule {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.6rem 0 0.9rem;
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 0.5rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

/* ── Index (filters) ──────────────────────────────────────────────── */

.page {
    position: relative;
    z-index: 2;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 3rem 6rem;
}

.index {
    display: grid;
    gap: 0.55rem;
    padding: 1.4rem 0 1.8rem;
    border-bottom: 1px solid var(--line);
}

.index-row {
    display: grid;
    grid-template-columns: 4.2rem minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    min-height: 2rem;
}

.index-key {
    font-family: var(--mono);
    font-size: 0.5rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

.swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.swatch {
    width: 31px;
    height: 18px;
    padding: 0;
    border-radius: 1px;
    border: 1px solid rgba(232, 228, 216, 0.18);
    background: var(--paper-faint);
    cursor: pointer;
    transition: box-shadow 0.18s ease;
}
.swatch:hover,
.swatch:focus-visible {
    box-shadow: 0 0 0 2px rgba(232, 228, 216, 0.2);
    outline: none;
}
.swatch[aria-pressed="true"] {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--paper);
}
.swatch.mono {
    background: linear-gradient(135deg, #171713 0 50%, #e8e4d8 50% 100%);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.7rem;
}

.tag {
    padding: 0;
    border: none;
    background: none;
    font-family: var(--serif);
    font-size: clamp(0.95rem, 1.15vw, 1.1rem);
    line-height: 1.4;
    color: var(--paper-dim);
    cursor: pointer;
    transition: color 0.18s ease;
}
.tag:hover { color: var(--paper); }
.tag[aria-pressed="true"] {
    color: var(--rust);
    box-shadow: inset 0 -1px 0 rgba(194, 112, 62, 0.6);
}
.tag .n {
    margin-left: 0.15em;
    font-family: var(--mono);
    font-size: 0.46rem;
    vertical-align: super;
    color: var(--paper-faint);
}
.tag[aria-pressed="true"] .n { color: rgba(194, 112, 62, 0.7); }

.index-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.35rem;
    padding-left: 5.2rem;
}
#status {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1rem;
    color: var(--paper-faint);
}
#reset {
    padding: 0;
    border: none;
    background: none;
    font-family: var(--mono);
    font-size: 0.5rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--paper-faint);
    cursor: pointer;
    box-shadow: inset 0 -1px 0 rgba(232, 228, 216, 0.22);
    transition: color 0.18s ease, box-shadow 0.18s ease;
}
#reset:hover {
    color: var(--rust);
    box-shadow: inset 0 -1px 0 rgba(194, 112, 62, 0.6);
}

/* ── Contact sheets ───────────────────────────────────────────────── */

#archive {
    padding-top: clamp(2rem, 4vw, 3.2rem);
}

.sheet {
    position: relative;
    max-width: 1180px;
    margin: 0 auto 1.8rem;
    padding: 16px 16px 10px;
    background-color: var(--paper);
    background-image:
        repeating-linear-gradient(90deg, rgba(35, 37, 31, 0.017) 0 1px, transparent 1px 4px),
        repeating-linear-gradient(0deg, rgba(35, 37, 31, 0.012) 0 1px, transparent 1px 5px);
    color: var(--ink);
    box-shadow:
        0 26px 60px rgba(0, 0, 0, 0.42),
        0 2px 0 rgba(255, 255, 255, 0.05) inset;
    opacity: 0;
    transition: opacity 0.7s ease;
}
.sheet.is-in { opacity: 1; }
.sheet.is-empty { display: none; }

.sheet:nth-child(odd) {
    margin-left: 0;
    margin-right: auto;
}
.sheet:nth-child(even) {
    margin-left: 5%;
    margin-right: 0;
}

.sheet-label {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    padding: 0 1px 0.65rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid rgba(35, 37, 31, 0.16);
}
.sheet-no {
    font-family: var(--serif);
    font-size: 2rem;
    line-height: 0.9;
    color: var(--ink);
}
.sheet-title {
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.98rem;
    color: var(--ink-soft);
}
.sheet-meta {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 0.46rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-faint);
    white-space: nowrap;
}

.frames {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 5px;
}

.frame.is-hidden { display: none; }

.frame {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: zoom-in;
}
.frame:focus-visible { outline: none; }

.shot {
    position: relative;
    display: block;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: #151511;
}
.shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.92) contrast(1.015);
    transition: transform 0.65s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.35s ease;
    -webkit-user-drag: none;
    user-select: none;
}
.frame:hover .shot img,
.frame:focus-visible .shot img {
    transform: scale(1.032);
    filter: saturate(1.04) contrast(1.03);
}
.frame:focus-visible .shot {
    outline: 2px solid var(--rust);
    outline-offset: 2px;
}

.frame.is-broken .shot img { display: none; }
.frame.is-broken .shot::after {
    content: 'negative missing';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--mono);
    font-size: 0.46rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(232, 228, 216, 0.35);
}

.frame-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 3px 1px 0;
    font-family: var(--mono);
    font-size: 0.44rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    min-height: 0.85rem;
}
.frame-no { flex: 0 0 auto; }
.frame-tags {
    max-width: 62%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.18s ease;
}
.frame:hover .frame-tags,
.frame:focus-visible .frame-tags { opacity: 1; }

.empty {
    padding: 5rem 1rem;
    text-align: center;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--paper-faint);
}

/* ── Colophon ─────────────────────────────────────────────────────── */

.colophon {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.3rem 3rem 3rem;
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 0.5rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--paper-faint);
}
.colophon-note {
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.95rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--paper-faint);
}
.colophon a {
    color: var(--paper-faint);
    text-decoration: none;
    transition: color 0.2s ease;
}
.colophon a:hover { color: var(--rust); }

/* ── Lightbox ─────────────────────────────────────────────────────── */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(7, 9, 6, 0.965);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
}
.lightbox[hidden] { display: none; }

.lb-backdrop { position: absolute; inset: 0; cursor: zoom-out; }

.lb-figure {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: center;
    gap: clamp(1.2rem, 3vw, 2.6rem);
    width: min(1500px, 94vw);
    height: min(88vh, 980px);
    margin: 0;
}

.lb-stage {
    justify-self: center;
    align-self: center;
    display: grid;
    place-items: center;
    max-width: 100%;
    max-height: 100%;
    padding: 12px;
    background: var(--paper);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.66);
}
.lb-stage img {
    display: block;
    max-width: 100%;
    max-height: calc(88vh - 24px);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #10100d;
}

.lb-label {
    align-self: center;
    max-height: 82vh;
    overflow-y: auto;
    padding: 1.7rem;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55);
    font-family: var(--mono);
    font-size: 0.52rem;
    line-height: 1.6;
    letter-spacing: 0.08em;
}
.lb-frame {
    font-family: var(--serif);
    font-size: 1.7rem;
    line-height: 1.05;
    letter-spacing: 0;
    color: var(--ink);
}
.lb-frame .hash { color: var(--rust); }
.lb-sheet {
    margin-top: 0.35rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--ink-soft);
}
.lb-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.55rem;
    margin-top: 1rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1rem;
    color: rgba(35, 37, 31, 0.72);
}
.lb-tag { padding: 0; border: none; }
.lb-tag:not(:last-child)::after {
    content: ' ·';
    color: var(--rust);
}
.lb-fields {
    display: grid;
    gap: 0.28rem;
    margin-top: 1.1rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(35, 37, 31, 0.16);
    font-size: 0.47rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.lb-fields div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}
.lb-fields b {
    font-weight: 400;
    color: rgba(35, 37, 31, 0.78);
    text-align: right;
}
.lb-palette {
    display: flex;
    gap: 3px;
    margin-top: 1rem;
}
.lb-swatch {
    width: 22px;
    height: 22px;
    border-radius: 1px;
    border: 1px solid rgba(35, 37, 31, 0.18);
}
.lb-caption {
    margin-top: 1rem;
    font-family: var(--serif);
    font-size: 1rem;
    line-height: 1.4;
    color: var(--ink-soft);
}
.lb-link {
    display: inline-block;
    margin-top: 1.2rem;
    font-family: var(--mono);
    font-size: 0.48rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rust);
    text-decoration: none;
    box-shadow: inset 0 -1px 0 rgba(194, 112, 62, 0.45);
    transition: color 0.18s ease, box-shadow 0.18s ease;
}
.lb-link:hover {
    color: var(--ink);
    box-shadow: inset 0 -1px 0 rgba(35, 37, 31, 0.5);
}

.lb-close,
.lb-nav {
    position: absolute;
    z-index: 5;
    display: grid;
    place-items: center;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--paper-dim);
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.lb-close {
    top: 1.1rem;
    right: 1.1rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 0.76rem;
}
.lb-nav {
    top: 50%;
    width: 42px;
    height: 62px;
    transform: translateY(-50%);
    border-radius: 1px;
    font-size: 1.5rem;
    line-height: 1;
    padding-bottom: 4px;
}
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }
.lb-close:hover,
.lb-nav:hover {
    color: var(--paper);
    border-color: var(--line-strong);
    background: rgba(232, 228, 216, 0.06);
}
.lb-nav[disabled] { opacity: 0.25; cursor: default; }

.lb-counter {
    position: absolute;
    z-index: 5;
    left: 1.3rem;
    bottom: 1.1rem;
    font-family: var(--mono);
    font-size: 0.52rem;
    letter-spacing: 0.2em;
    color: var(--paper-faint);
}

body.lb-open { overflow: hidden; }

/* ── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 1100px) {
    .masthead { padding: 1.4rem 2rem 0; }
    .page { padding: 0 2rem 5rem; }
    .colophon { padding: 1.2rem 2rem 2.6rem; }
    .masthead-main { grid-template-columns: minmax(0, 1.2fr) minmax(230px, 0.8fr); }
}

@media (max-width: 900px) {
    .masthead-main {
        grid-template-columns: 1fr;
        gap: 1.6rem;
        padding: 2.4rem 0 1.8rem;
    }
    .masthead-aside { max-width: 46ch; }
    .sheet:nth-child(odd),
    .sheet:nth-child(even) {
        margin-left: 0;
        margin-right: 0;
    }
    .lb-figure {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        width: 100vw;
        height: 100vh;
        gap: 0;
        padding: 3.4rem 0 0;
    }
    .lb-stage { padding: 8px; }
    .lb-stage img { max-height: calc(58vh); }
    .lb-label {
        justify-self: stretch;
        max-height: 34vh;
        margin: 0 1rem 1rem;
        padding: 1.1rem 1.2rem;
    }
    .lb-frame { font-size: 1.35rem; }
    .lb-nav { width: 34px; height: 50px; }
    .lb-prev { left: 0.35rem; }
    .lb-next { right: 0.35rem; }
    .lb-counter { left: 1rem; bottom: auto; top: 1.45rem; }
}

@media (max-width: 720px) {
    .masthead { padding: 1rem 1rem 0; }
    .page { padding: 0 1rem 4rem; }
    .colophon { padding: 1rem 1rem 2.2rem; }
    .eyebrow { display: none; }
    .masthead h1 { font-size: clamp(3.6rem, 18vw, 5.4rem); }
    .masthead-rule { gap: 0.35rem; }
    .index-row { grid-template-columns: 1fr; gap: 0.45rem; }
    .index-foot { padding-left: 0; }
    .swatch { width: 22px; height: 14px; }
    .swatches { gap: 0.35rem; }
    .sheet { padding: 10px 10px 7px; margin-bottom: 1rem; }
    .sheet-no { font-size: 1.55rem; }
    .sheet-title { font-size: 0.86rem; }
    .sheet-meta { font-size: 0.4rem; }
    .frames { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 4px; }
    .frame-tags { display: none; }
    .frame-meta { font-size: 0.4rem; }
    .colophon { justify-content: flex-start; }
    .colophon-note { display: none; }
}

@media (hover: none) {
    .frame-tags { display: none; }
}

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