/*
 * Terrazzo.
 *
 * The paper and the ink are fixed. --accent and --sw1..6 are written inline by
 * inc/enqueue.php from the palette measured off the page's own photographs, so
 * the only colour decision in this file is the decision not to make one.
 */

:root {
	--paper: #faf8f4;
	--matrix: #f2efe9;
	--ink: #23211d;
	--ink-2: #4a4741;
	/* Solved against the darkest ground the slab can produce — a pure black chip
	   at the shader's cap — not against the flat --matrix value. */
	--ink-3: #524e47;
	--rule: rgba(35, 33, 29, 0.16);
	--rule-2: rgba(35, 33, 29, 0.09);
	--sheet: rgba(250, 248, 244, 0.92);

	/* Overwritten per page. Ink, so a page whose palette failed to measure is
	   coherent rather than colourless-but-broken. */
	--accent: #23211d;

	--sans: 'Terrazzo Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--display: 'Terrazzo Display', ui-serif, Georgia, serif;

	--pad: clamp(1.1rem, 4vw, 3.6rem);
	--measure: 34rem;
	--maxw: 80rem;

	--ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::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.18vw, 1.07rem);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.1; font-weight: 500; letter-spacing: -0.02em; }
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 slab  ───────────────────────────────── */

.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 1s 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);
	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-family: var(--display); font-size: clamp(1.1rem, 1.6vw, 1.4rem); font-weight: 500; letter-spacing: -0.02em; }
.mark__what { font-size: 0.76rem; color: var(--ink-3); }

.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(--accent); }

.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);
	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-family: var(--display); 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(12px);
	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, .house, .grid, .grid__more, .listing-top, .single,
.project__top, .project__scheme, .project__body, .plates, .stepper {
	max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad);
}

/*
 * The masthead needs its own ground on the strong slab.
 *
 * Ink on a full-strength terrazzo is unreadable — the chips are high contrast
 * in every direction, so no single text colour works against them. The strip
 * gets the same paper the sample label is on, which also reads correctly:
 * a label and a header card sitting on the stone.
 */
.masthead {
	background: rgb( from var(--paper) r g b / 0.94 );
	backdrop-filter: blur( 6px );
	-webkit-backdrop-filter: blur( 6px );
}

@supports not ( background: rgb( from red r g b / 0.9 ) ) {
	.masthead { background: var(--paper); }
}

/*
 * The hero is a slab with a sample label on it.
 *
 * The ground here is a real terrazzo made from the studio's own measured
 * palette, and it used to be drawn at 18% strength everywhere so that body
 * text could sit on it — which made the theme's whole signature nearly
 * invisible (measured mean saturation 0.148 on the first screen). The slab now
 * runs at full strength through the hero, and the type moves off it into a
 * solid card: the way a material sample is actually presented, with its spec
 * on a label rather than printed onto the stone.
 */
.opening {
	min-height: 88svh;
	display: grid;
	align-items: end;
	padding-block: clamp(4rem, 12vh, 7.5rem) clamp(3rem, 8vh, 5rem);
}

.opening__inner {
	background: var(--paper);
	padding: clamp(1.6rem, 4vw, 3rem) clamp(1.6rem, 4vw, 3.2rem) clamp(1.8rem, 4vw, 2.6rem);
	max-width: 46rem;
	box-shadow: 0 2px 0 rgb(0 0 0 / 0.06), 0 24px 60px -30px rgb(0 0 0 / 0.45);
}

/* The label's own rule, echoing a spec card. */
.opening__inner::before {
	content: "";
	display: block;
	width: 3.2rem; height: 3px;
	background: var(--ink);
	margin-bottom: clamp(1rem, 2.4vh, 1.6rem);
}
.opening__line {
	font-family: var(--display);
	font-size: clamp(2.1rem, 5.6vw, 4.4rem);
	font-weight: 400; letter-spacing: -0.03em; max-width: 16ch;
	margin-bottom: clamp(0.8rem, 2vh, 1.3rem);
}
.opening__sub { max-width: var(--measure); color: var(--ink-2); font-size: clamp(1rem, 1.2vw, 1.12rem); }

/* ─────────────────────────  The palette strip  ──────────────────────── */

/*
 * Each part is as wide as the colour was present in the room. That proportion
 * is the claim the theme makes, so it is drawn to scale rather than as equal
 * boxes with a percentage printed underneath.
 */
.scheme { display: grid; gap: 0.7rem; }
.scheme__bar {
	list-style: none; margin: 0; padding: 0;
	display: flex; height: 3.4rem; overflow: hidden;
}
.scheme__part { flex: var(--w) 1 0; background: var(--c); min-width: 2px; }

.scheme__keys {
	list-style: none; margin: 0; padding: 0;
	display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem;
}
.scheme__key { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--ink-2); }
.scheme__dot { width: 0.7rem; height: 0.7rem; background: var(--c); box-shadow: inset 0 0 0 1px var(--rule-2); }
.scheme__hex { font-family: inherit; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.scheme__pc { color: var(--ink-3); font-variant-numeric: tabular-nums; }

.house { padding-block: clamp(1.6rem, 4vh, 2.6rem) clamp(2rem, 5vh, 3.4rem); }
.house__title { font-size: clamp(1.1rem, 1.9vw, 1.45rem); margin-bottom: 0.5rem; }
.house__note { color: var(--ink-2); max-width: var(--measure); margin-bottom: clamp(1rem, 2.5vh, 1.6rem); }

@media ( min-width: 62rem ) {
	.house { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
	.house__note { margin-bottom: 0; }
}

/* ─────────────────────────  Project grid  ───────────────────────────── */

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
	gap: clamp(1.2rem, 3vw, 2.2rem);
	padding-bottom: clamp(2rem, 5vh, 3.4rem);
}
.card { margin: 0; }
.card__link { display: grid; gap: 0.7rem; text-decoration: none; color: inherit; }
.card__cover { display: block; overflow: hidden; background: var(--matrix); }
.card__cover img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.6s var(--out); }
.card__link:hover .card__cover img { transform: scale(1.02); }
.cover__none { display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--c); }

.card__said { display: grid; gap: 0.2rem; }
.card__name { font-family: var(--display); font-size: clamp(1.05rem, 1.7vw, 1.28rem); }
.card__facts { font-size: 0.8rem; color: var(--ink-3); }

/* The card's own palette, at the foot of the card, to scale. */
.card__scheme { display: flex; height: 0.5rem; overflow: hidden; }
.card__scheme i { flex: var(--w) 1 0; background: var(--c); min-width: 2px; }

.grid__more { padding-bottom: clamp(2.5rem, 6vh, 4rem); }

/* ─────────────────────────  One project  ────────────────────────────── */

.project__top { padding-block: clamp(4.5rem, 12vh, 7.5rem) clamp(1.2rem, 3vh, 2rem); }
.project__title { font-family: var(--display); font-size: clamp(1.9rem, 4.6vw, 3.4rem); font-weight: 400; letter-spacing: -0.03em; max-width: 17ch; }
.project__brief { margin-top: 0.7rem; max-width: var(--measure); color: var(--ink-2); font-size: clamp(1rem, 1.2vw, 1.12rem); }
.project__facts { margin-top: 0.8rem; font-size: 0.82rem; color: var(--ink-3); }

.project__hero { margin: 0 0 clamp(1.6rem, 4vh, 2.6rem); }
.project__hero img { width: 100%; }

.project__scheme { padding-block: clamp(1.4rem, 3.5vh, 2.4rem); border-top: 1px solid var(--rule-2); }
.project__h2 { font-size: clamp(1.05rem, 1.8vw, 1.35rem); margin-bottom: 0.5rem; }
.project__note { color: var(--ink-2); max-width: var(--measure); margin-bottom: clamp(1rem, 2.5vh, 1.5rem); }

@media ( min-width: 62rem ) {
	.project__scheme { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
	.project__note { margin-bottom: 0; }
}

.project__body { padding-block: clamp(1.4rem, 3.5vh, 2.4rem); }

.plates { display: grid; gap: clamp(1rem, 2.5vw, 1.8rem); padding-bottom: clamp(2rem, 5vh, 3.4rem); }
.plate { margin: 0; }
.plate img { width: 100%; }
@media ( min-width: 52rem ) {
	.plates { grid-template-columns: 1fr 1fr; }
	.plate--wide { grid-column: 1 / -1; }
}

.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(--accent); }
.stepper__go--next { margin-left: auto; }

/* ─────────────────────────  Listings & prose  ───────────────────────── */

.listing-top { padding-block: clamp(4.5rem, 12vh, 7.5rem) clamp(1.2rem, 3vh, 2rem); }
.listing-title { font-family: var(--display); font-size: clamp(1.9rem, 4.6vw, 3.4rem); font-weight: 400; letter-spacing: -0.03em; max-width: 17ch; }
.listing-intro { margin-top: 0.7rem; max-width: var(--measure); color: var(--ink-2); }
.listing-empty { color: var(--ink-2); padding-block: 3rem; font-style: italic; }

.single { padding-bottom: clamp(3rem, 8vh, 5rem); }

.prose { max-width: var(--measure); }
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1.05em; }
.prose p { line-height: 1.68; color: var(--ink-2); }
.prose h2 { font-family: var(--display); font-size: clamp(1.2rem, 2vw, 1.6rem); margin-top: 1.8em; color: var(--ink); }
.prose a { color: var(--accent); 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-family: var(--display); 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); }

/* ─────────────────────────  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(--accent); }

.btn {
	display: inline-block; font-size: 0.9rem;
	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: clamp(2rem, 5vh, 3.2rem) auto 0; max-width: var(--maxw); padding-inline: var(--pad); }
.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-family: var(--display); font-size: clamp(1.05rem, 1.8vw, 1.3rem); margin-bottom: 0.4rem; }
.foot__note { color: var(--ink-2); 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(--accent); 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; }
}

/* ─────────────────  Method, range, common, tail  ─────────────────────── */

.method, .range, .common, .tail {
	max-width: var(--maxw); margin-inline: auto;
	padding-inline: var(--pad);
	margin-block: clamp(3.5rem, 10vh, 7rem);
}

.method__head, .range__head, .common__head, .tail__head {
	font-family: var(--display); font-weight: 400;
	font-size: clamp(1.6rem, 3.4vw, 2.6rem); letter-spacing: -0.02em;
	margin: 0;
}
.method__note, .range__note, .common__note, .tail__said {
	margin: 0.7rem 0 0; max-width: 60ch; color: var(--ink-2, inherit);
}

.method__body {
	display: grid; gap: clamp(1.6rem, 4vw, 3rem);
	grid-template-columns: minmax(0, 1fr);
	margin-top: clamp(1.6rem, 4vh, 2.6rem);
}
@media (min-width: 62rem) { .method__body { grid-template-columns: 1.05fr 1fr; align-items: start; } }

.method__shot { margin: 0; }
.method__shot img { display: block; width: 100%; height: auto; }
.method__shot figcaption { margin-top: 0.6rem; font-size: 0.84rem; color: var(--ink-2, inherit); }

.method__steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.method__steps li {
	counter-increment: step; padding: 0.9rem 0 1rem 2.6rem; position: relative;
	border-bottom: 1px solid var(--rule, rgb(0 0 0 / 0.12));
}
.method__steps li::before {
	content: counter(step); position: absolute; left: 0; top: 1rem;
	font-variant-numeric: tabular-nums; font-size: 0.84rem; opacity: 0.55;
}
.method__steps h3 { margin: 0 0 0.25rem; font-size: 1.02rem; font-weight: 600; }
.method__steps p { margin: 0; font-size: 0.92rem; color: var(--ink-2, inherit); }

.method__out {
	display: grid; gap: 2px; margin-top: clamp(1.6rem, 4vh, 2.4rem);
	grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}
.chip { display: block; }
.chip__block { display: block; height: clamp(4rem, 9vh, 6rem); }
.chip__hex {
	display: block; margin-top: 0.5rem;
	font-size: 0.8rem; letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
}
.chip__share { display: block; font-size: 0.78rem; color: var(--ink-2, inherit); }

.range__list { list-style: none; margin: clamp(1.4rem, 3.5vh, 2.2rem) 0 0; padding: 0; }
.range__row {
	display: grid; gap: 0.3rem 1.4rem; align-items: center;
	grid-template-columns: minmax(0, 1fr);
	padding: 0.7rem 0; border-bottom: 1px solid var(--rule, rgb(0 0 0 / 0.12));
}
@media (min-width: 46rem) { .range__row { grid-template-columns: 16rem minmax(0, 1fr); } }
.range__name { color: inherit; text-decoration: none; font-size: 0.98rem; }
.range__name:hover { text-decoration: underline; }
.range__bar { display: flex; height: 2.2rem; overflow: hidden; }
.range__bar i { display: block; }

.common__list { margin: clamp(1.4rem, 3.5vh, 2.2rem) 0 0; }
.common__row {
	display: grid; gap: 0.4rem 1.2rem; align-items: center;
	grid-template-columns: 14rem minmax(0, 1fr) 4rem;
	padding: 0.55rem 0; border-bottom: 1px solid var(--rule, rgb(0 0 0 / 0.12));
}
@media (max-width: 40rem) { .common__row { grid-template-columns: minmax(0, 1fr) 4rem; } }
.common__row dt { font-size: 0.95rem; }
.common__row dd { margin: 0; }
.common__meter { background: rgb(0 0 0 / 0.06); height: 0.7rem; }
@media (max-width: 40rem) { .common__meter { grid-column: 1 / -1; } }
.common__meter i { display: block; height: 100%; width: var(--share); background: var(--ink); }
.common__pct { font-variant-numeric: tabular-nums; text-align: right; font-size: 0.9rem; }
.common__row.is-top dt { font-weight: 600; }

.tail__go {
	display: inline-block; margin-top: 1.4rem; padding: 0.8rem 1.7rem;
	border: 1px solid currentColor; color: inherit; text-decoration: none;
	font-size: 0.86rem; letter-spacing: 0.08em; text-transform: uppercase;
}
.tail__go:hover { background: var(--ink); color: var(--paper); }
