/*
 * Halide.
 *
 * Paper by default, because photographs are usually best on it, with a dark
 * room available from the Customizer for work that wants it. The palette is
 * near-neutral on purpose: anything with a hue in it competes with the pictures.
 */

:root {
	--paper: #f4f2ef;
	--paper-2: #eae7e2;
	--ink: #16161a;
	--ink-2: #43423f;
	/* Solved against the darkest paper the grain produces (233,231,229), not
	   against the flat --paper value: the emulsion darkens the ground under the
	   text and #6d6b66 came out at 4.32 there. */
	--ink-3: #686661;
	--rule: rgba(22, 22, 26, 0.14);
	--rule-2: rgba(22, 22, 26, 0.08);
	--sheet-solid: rgba(244, 242, 239, 0.96);

	--sans: 'Halide Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--text: 'Halide Text', ui-serif, Georgia, serif;

	--pad: clamp(1.1rem, 4vw, 3.4rem);
	--measure: 34rem;
	--maxw: 84rem;

	--ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--out: cubic-bezier(0.16, 1, 0.3, 1);
}

/*
 * The dark room. The same design with the two ends of the scale exchanged, so
 * every rule below keeps working and nothing needs a second definition.
 */
body.is-darkroom {
	--paper: #131315;
	--paper-2: #1c1c1f;
	--ink: #f0eeea;
	--ink-2: #c3c0ba;
	--ink-3: #918e88;
	--rule: rgba(240, 238, 234, 0.16);
	--rule-2: rgba(240, 238, 234, 0.09);
	--sheet-solid: rgba(19, 19, 21, 0.96);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media ( prefers-reduced-motion: reduce ) { html { scroll-behavior: auto; } }
html.is-locked { overflow: hidden; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--sans);
	font-size: clamp(0.98rem, 0.95rem + 0.16vw, 1.06rem);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 600; line-height: 1.12; margin: 0; letter-spacing: -0.022em; }
p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

.sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 3px;
}

.skip {
	position: absolute; left: 0.6rem; top: -4rem; z-index: 200;
	background: var(--ink); color: var(--paper);
	padding: 0.6em 1em; text-decoration: none;
	transition: top 0.2s var(--ease);
}
.skip:focus { top: 0.6rem; }

/* ─────────────────────────  The emulsion  ───────────────────────────── */

.ground { position: fixed; inset: 0; z-index: 0; pointer-events: none; contain: strict; }
.ground__canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s var(--ease); }
.ground__canvas.is-ready { opacity: 1; }

.masthead, .site-main, .site-footer { position: relative; z-index: 1; }
.masthead { z-index: 60; }
.drawer { z-index: 70; }

/* ─────────────────────────  Masthead  ───────────────────────────────── */

.masthead { position: sticky; top: 0; transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease); }
.masthead.is-settled {
	background: var(--sheet-solid);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	box-shadow: 0 1px 0 var(--rule-2);
}
.masthead__inner {
	max-width: var(--maxw); margin-inline: auto;
	padding: clamp(0.8rem, 2vh, 1.2rem) var(--pad);
	display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.mark { text-decoration: none; display: grid; gap: 0.05rem; }
.mark__name { font-size: clamp(1.05rem, 1.5vw, 1.3rem); font-weight: 600; letter-spacing: -0.03em; }
.mark__what { font-size: 0.76rem; color: var(--ink-3); letter-spacing: 0.02em; }

.nav { display: none; }
@media ( min-width: 58rem ) {
	.nav { display: flex; gap: clamp(1rem, 2vw, 1.9rem); align-items: baseline; }
	.drawer-toggle { display: none; }
}
.nav a {
	font-size: 0.9rem; text-decoration: none; color: var(--ink-2);
	padding-bottom: 0.2em; border-bottom: 1px solid transparent;
	transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-color: var(--ink); }

.drawer-toggle {
	appearance: none; background: transparent; border: 0; padding: 0.6rem;
	cursor: pointer; display: grid; gap: 5px; margin-right: -0.6rem;
}
.drawer-toggle i { display: block; width: 24px; height: 1.5px; background: var(--ink); }

.drawer {
	position: fixed; inset: 0; background: var(--sheet-solid);
	backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
	display: grid; place-content: center; gap: 1.1rem; text-align: center;
	opacity: 0; visibility: hidden;
	transition: opacity 0.4s var(--ease), visibility 0.4s;
}
.drawer.is-open { opacity: 1; visibility: visible; }
.drawer a { font-size: clamp(1.3rem, 5vw, 1.9rem); text-decoration: none; }
.drawer__close {
	position: absolute; top: 1rem; right: 1rem;
	appearance: none; background: transparent; border: 0; cursor: pointer;
	font-size: 0.85rem; color: var(--ink-2); padding: 0.7rem;
}

/* ─────────────────────────  Reveals  ────────────────────────────────── */

.js [data-reveal] {
	opacity: 0; transform: translateY(10px);
	transition: opacity 0.7s var(--out), transform 0.7s var(--out);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }
@media ( prefers-reduced-motion: reduce ) {
	.js [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ─────────────────────────  Sections  ───────────────────────────────── */

.opening, .work, .sets, .listing-top, .single, .plateframe, .stepper {
	max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad);
}

/*
 * The opening is a sheet in a darkroom, so its type reverses out.
 *
 * The grain runs at full strength here and nowhere else; the rest of the site
 * is paper with body text on it and keeps the reading strength. See
 * grain.glsl.js for why there have to be two.
 */
.opening {
	min-height: 92svh;
	display: grid;
	align-items: end;
	padding-block: clamp(4rem, 12vh, 7.5rem) clamp(3rem, 8vh, 5rem);
	color: #f4f0e8;
}
.opening a { color: inherit; }
/* Every descendant. The sub-line and the small print carry their own ink
   tokens and would otherwise stay dark on a dark sheet. */
/* Placed again below, after the paper-side rules, so it actually wins. */

/* The masthead sits on the sheet too. */
.has-hero .masthead:not(.is-settled),
.has-hero .masthead:not(.is-settled) * { color: #f4f0e8; }
.opening__line {
	font-size: clamp(2rem, 5vw, 3.9rem);
	letter-spacing: -0.035em; max-width: 18ch;
	margin-bottom: clamp(0.8rem, 2vh, 1.3rem);
}
.opening__sub { max-width: var(--measure); color: var(--ink-2); font-family: var(--text); font-size: clamp(1rem, 1.2vw, 1.13rem); line-height: 1.62; }

.work { padding-bottom: clamp(2.5rem, 6vh, 4.5rem); }
.work__more { margin-top: clamp(1.6rem, 4vh, 2.4rem); }

/* ─────────────────────────  Justified plate  ────────────────────────── */

/*
 * Row widths and frame proportions come from the server, computed from the real
 * pixel dimensions of the files. The --ar on each frame is what reserves the
 * space, so nothing moves as the images arrive.
 */
.plate { display: grid; gap: 14px; }
.plate__row { display: flex; gap: 14px; align-items: flex-start; }

.frame {
	margin: 0;
	flex: 0 0 auto;
	width: var(--pct);
	position: relative;
}
.frame__link { display: block; text-decoration: none; color: inherit; }
.frame__img {
	width: 100%;
	aspect-ratio: var(--ar);
	object-fit: cover;      /* never triggered: the box already has the file's ratio */
	background: var(--paper-2);
	transition: opacity 0.4s var(--ease);
}
.frame__link:hover .frame__img { opacity: 0.9; }

.frame__cap {
	display: grid; gap: 0.1rem;
	padding-top: 0.5rem;
	opacity: 0;
	transition: opacity 0.3s var(--ease);
}
.frame__link:hover .frame__cap,
.frame__link:focus-visible .frame__cap { opacity: 1; }
.frame__title { font-size: 0.82rem; font-weight: 500; }
.frame__exp { font-size: 0.74rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/*
 * On a phone the rows are abandoned entirely. A justified row of five frames
 * scaled to 390px makes every photograph 70 pixels tall, which is no way to
 * look at anything.
 */
@media ( max-width: 44rem ) {
	.plate__row { display: block; }
	.frame { width: 100% !important; margin-bottom: 14px; }
	.frame__cap { opacity: 1; }
}

/* ─────────────────────────  Filters  ────────────────────────────────── */

.sift { margin-top: clamp(1.4rem, 3.5vh, 2.2rem); display: grid; gap: 1rem; }
.sift__set { display: grid; gap: 0.5rem; }
.sift__label {
	font-size: 0.72rem; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-3);
}
.sift__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.sift__pill {
	display: inline-flex; align-items: baseline; gap: 0.4rem;
	font-size: 0.83rem; text-decoration: none; color: var(--ink-2);
	border: 1px solid var(--rule); padding: 0.4em 0.8em;
	transition: border-color 0.3s var(--ease), color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.sift__pill:hover { border-color: var(--ink); color: var(--ink); }
.sift__pill.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.sift__n { font-size: 0.72rem; opacity: 0.65; font-variant-numeric: tabular-nums; }
.sift__now { font-size: 0.86rem; color: var(--ink-2); }
.sift__clear { margin-left: 0.6rem; color: var(--ink-3); }

/* ─────────────────────────  Series  ─────────────────────────────────── */

.sets { padding-block: clamp(2rem, 5vh, 3.5rem); border-top: 1px solid var(--rule-2); }
.sets__title { font-size: clamp(1.15rem, 2vw, 1.5rem); margin-bottom: clamp(1rem, 2.5vh, 1.6rem); }
.sets__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.setcard__link {
	display: grid; gap: 0.35rem; text-decoration: none;
	padding: clamp(1rem, 2.4vw, 1.5rem);
	border: 1px solid var(--rule-2);
	transition: border-color 0.35s var(--ease);
}
.setcard__link:hover { border-color: var(--ink); }
.setcard__name { font-size: clamp(1rem, 1.6vw, 1.2rem); }
.setcard__note { color: var(--ink-2); font-family: var(--text); font-size: 0.95rem; }
.setcard__n { font-size: 0.76rem; color: var(--ink-3); }

/* ─────────────────────────  Listings  ───────────────────────────────── */

.listing-top { padding-block: clamp(4.5rem, 13vh, 8rem) clamp(1.2rem, 3vh, 2rem); }
.listing-title { font-size: clamp(1.9rem, 4.6vw, 3.4rem); letter-spacing: -0.032em; max-width: 18ch; }
.listing-intro { margin-top: clamp(0.7rem, 2vh, 1.2rem); max-width: var(--measure); color: var(--ink-2); font-family: var(--text); }
.listing-empty { color: var(--ink-2); padding-block: 3rem; font-style: italic; }

.single { padding-bottom: clamp(3rem, 8vh, 5rem); }

.prose { max-width: var(--measure); font-family: var(--text); }
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1.05em; }
.prose p { line-height: 1.68; color: var(--ink-2); }
.prose h2 { font-family: var(--sans); font-size: clamp(1.2rem, 2vw, 1.6rem); margin-top: 1.8em; color: var(--ink); }
.prose a { color: var(--ink); text-underline-offset: 0.18em; }
.prose ul, .prose ol { padding-inline-start: 1.3em; color: var(--ink-2); }
.prose li + li { margin-top: 0.35em; }

.notes { display: grid; }
.note { padding-block: clamp(1rem, 2.5vh, 1.6rem); border-top: 1px solid var(--rule-2); }
.note:first-child { border-top: 0; }
.note__link { text-decoration: none; display: grid; gap: 0.3rem; }
.note__name { font-size: clamp(1.05rem, 1.7vw, 1.3rem); }
.note__sub { color: var(--ink-2); }
.note__when { font-size: 0.76rem; color: var(--ink-3); }

/* ─────────────────────────  One photograph  ─────────────────────────── */

.plateframe { padding-block: clamp(4.5rem, 12vh, 7.5rem) clamp(1.5rem, 4vh, 2.5rem); }
.plateframe__fig { margin: 0 0 clamp(1.4rem, 3.5vh, 2.2rem); }
.plateframe__img { width: 100%; height: auto; max-height: 78vh; object-fit: contain; }
.plateframe__title { font-size: clamp(1.5rem, 3vw, 2.3rem); margin-bottom: 0.4rem; }
.plateframe__where { color: var(--ink-2); font-family: var(--text); font-size: 1.05rem; }
.plateframe__note { color: var(--ink-2); font-family: var(--text); margin-top: 0.5rem; max-width: var(--measure); }
.plateframe__series { margin-top: 1.2rem; font-size: 0.86rem; color: var(--ink-3); }
.plateframe__series a { color: var(--ink); }

@media ( min-width: 62rem ) {
	.plateframe { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
	.plateframe__fig { grid-row: 1 / 3; margin-bottom: 0; }
}

/* The camera block. Tabular figures, because it is a column of numbers. */
.plateau { margin: clamp(1.4rem, 3.5vh, 2rem) 0 0; display: grid; gap: 0; border-top: 1px solid var(--rule-2); }
.plateau__row {
	display: grid; grid-template-columns: 8.5rem minmax(0, 1fr);
	gap: 1rem; padding-block: 0.5rem;
	border-bottom: 1px solid var(--rule-2);
}
.plateau dt { font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); align-self: center; }
.plateau dd { margin: 0; font-size: 0.94rem; font-variant-numeric: tabular-nums; }

.sideways { margin-top: clamp(1.4rem, 3.5vh, 2rem); display: grid; gap: 0.5rem; }
.sideways__label { font-size: 0.72rem; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-3); }
.sideways__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }

.stepper { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: clamp(3rem, 8vh, 5rem); }
.stepper__go { font-size: 0.88rem; text-decoration: none; color: var(--ink-2); border-bottom: 1px solid var(--rule); padding-bottom: 0.15em; }
.stepper__go:hover { color: var(--ink); border-color: var(--ink); }
.stepper__go--next { margin-left: auto; }

.exp { font-size: 0.8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ─────────────────────────  Bits  ───────────────────────────────────── */

.more { font-size: 0.9rem; text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 0.15em; transition: border-color 0.35s var(--ease); }
.more:hover { border-color: var(--ink); }

.btn {
	display: inline-block; font-size: 0.9rem; font-weight: 500;
	padding: 0.7em 1.5em; text-decoration: none;
	background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
}

.hunt { display: flex; gap: 0.5rem; flex-wrap: wrap; max-width: 30rem; }
.hunt__field {
	flex: 1 1 13rem; min-width: 0; font: inherit; color: var(--ink);
	background: transparent; border: 1px solid var(--rule); padding: 0.6em 0.9em;
}
.hunt__go {
	font: inherit; font-size: 0.9rem; cursor: pointer;
	background: var(--ink); color: var(--paper); border: 1px solid var(--ink); padding: 0.6em 1.3em;
}

.pager { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: clamp(2rem, 5vh, 3.2rem); }
.pager .page-numbers {
	display: inline-grid; place-items: center; min-width: 2.5rem; padding: 0.45rem 0.7rem;
	font-size: 0.86rem; text-decoration: none; border: 1px solid var(--rule); color: var(--ink-2);
}
.pager .page-numbers.current { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ─────────────────────────  Footer  ─────────────────────────────────── */

.site-footer {
	margin-top: clamp(2.5rem, 7vh, 5rem);
	border-top: 1px solid var(--rule-2);
	padding-block: clamp(2.2rem, 6vh, 3.6rem) clamp(1.4rem, 4vh, 2.2rem);
}
.site-footer__inner {
	max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad);
	display: grid; gap: clamp(1.2rem, 3vh, 2rem);
}
.foot__head { font-size: clamp(1.05rem, 1.8vw, 1.3rem); margin-bottom: 0.4rem; }
.foot__note { color: var(--ink-2); font-family: var(--text); max-width: 34ch; }
.foot__nav { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; align-content: start; }
.foot__nav a { font-size: 0.88rem; color: var(--ink-2); text-decoration: none; border-bottom: 1px solid transparent; }
.foot__nav a:hover { border-color: var(--ink); color: var(--ink); }
.foot__fine { font-size: 0.76rem; color: var(--ink-3); }

@media ( min-width: 62rem ) {
	.site-footer__inner { grid-template-columns: 1.4fr 1fr; align-items: start; }
	.foot__fine { grid-column: 1 / -1; }
}

/* ── The darkroom reversal, last so it wins on equal specificity ───────── */

/*
 * These have to sit at the end of the file. The paper-side rules for the same
 * selectors are defined later in the document than the hero block, and at equal
 * specificity the last one wins — so declaring the reversal up with the hero
 * left the sub-line dark grey on a dark sheet at 1.23:1.
 */
.has-hero .opening,
.has-hero .opening * { color: #f4f0e8; }
.has-hero .opening__sub { opacity: 0.92; }

/* ─────────────────────────  Kit and emulsion  ────────────────────────── */

.kit, .emulsion {
	max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad);
	margin-block: clamp(3.5rem, 10vh, 7rem);
}
.kit__head, .emulsion__head {
	font-size: clamp(1.5rem, 3.2vw, 2.4rem); letter-spacing: -0.03em; margin: 0;
}
.kit__note { margin: 0.7rem 0 0; max-width: 62ch; color: var(--ink-2); }
.kit__sub {
	font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
	color: var(--ink-2); margin: 0 0 0.8rem;
}
.kit__bands { margin-top: clamp(1.6rem, 4vh, 2.6rem); }
.kit__list { margin: 0; }
.kit__row {
	display: grid; gap: 0.4rem 1.2rem; align-items: center;
	grid-template-columns: 17rem minmax(0, 1fr) 3.5rem;
	padding: 0.5rem 0; border-bottom: 1px solid var(--rule);
}
@media (max-width: 40rem) { .kit__row { grid-template-columns: minmax(0,1fr) 3.5rem; } }
.kit__row dt { font-size: 0.94rem; }
.kit__row dd { margin: 0; }
.kit__meter { background: rgb(0 0 0 / 0.07); height: 0.62rem; }
@media (max-width: 40rem) { .kit__meter { grid-column: 1 / -1; } }
.kit__meter i { display: block; height: 100%; width: var(--share); background: var(--ink); }
.kit__n { font-variant-numeric: tabular-nums; text-align: right; font-size: 0.88rem; }

.kit__bodies {
	display: grid; gap: clamp(1.4rem, 4vw, 3rem);
	grid-template-columns: minmax(0, 1fr); margin-top: clamp(1.8rem, 4vh, 2.8rem);
}
/* auto-fit, so a set of files with no lens data does not leave a hole where
   the lens column would have been. */
@media (min-width: 46rem) { .kit__bodies { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); } }
.kit__plain { list-style: none; margin: 0; padding: 0; }
.kit__plain li {
	display: flex; justify-content: space-between; gap: 1rem;
	padding: 0.45rem 0; border-bottom: 1px solid var(--rule); font-size: 0.92rem;
}
.kit__plain b { font-weight: 400; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.kit__caveat { margin-top: 1.4rem; font-size: 0.86rem; color: var(--ink-2); max-width: 64ch; }

.emulsion__in { max-width: 62ch; }
.emulsion__in p { margin: 0.8rem 0 0; }
