/*
	Site v2 — illustrated editorial-magazine direction.
	Source of truth: design_spec.md + design_example.html (approved reference).
	Supersedes assets/css/site.css (the earlier minimal-grotesk direction),
	which is left in place only for comparison during the transition.
*/

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500&family=Caveat:wght@500&display=swap');

:root {
	color-scheme: light dark;
	--ink: light-dark(#10151b, #f3f6f9);
	--ink-soft: light-dark(#3a4652, #7c8994);
	--paper: light-dark(#f4f7fa, #11161c);
	--paper-2: light-dark(#ffffff, #19212a);
	--line: light-dark(#b9c6d1, #33404b);
	--blue: light-dark(#234cff, #6e8cff);
	--orange: light-dark(#ff5a22, #ff7447);
	--yellow: #ffd44a;
	--yellow-ink: #10151b;
	--quiet: light-dark(#566472, #a6b3bf);

	--nav-height: 62px;
	--dur: 160ms;
}

@media (prefers-reduced-motion: reduce) {
	:root { --dur: 0ms; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	color: var(--ink);
	background-color: color-mix(in srgb, var(--paper) 88%, var(--line) 12%);
	font-family: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
	font-size: 17px;
	line-height: 1.5;
}

button, a { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }

:focus-visible {
	outline: 2px solid var(--blue);
	outline-offset: 2px;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--ink);
	color: var(--paper);
	padding: 12px 20px;
	z-index: 100;
}

.skip-link:focus {
	left: 12px;
	top: 12px;
}

/* ---------------------------------------------------------------- */
/* Page frame — cap width so the layout doesn't stretch full-bleed   */
/* ---------------------------------------------------------------- */

.kf-page {
	position: relative;
	max-width: 1280px;
	margin: 28px auto;
	border: 1px solid var(--ink-soft);
	box-shadow: 6px 6px 0 var(--ink-soft);
	background: var(--paper);
}

.kf-page::before {
	content: "";
	position: absolute;
	inset: -4px;
	border: 2px solid var(--ink-soft);
	filter: url(#ink-wobble);
	pointer-events: none;
	z-index: 5;
}

@media (max-width: 900px) {
	.kf-page {
		margin: 0;
		border: 0;
		border-bottom: 1px solid var(--line);
		box-shadow: none;
	}

	.kf-page::before {
		display: none;
	}

	body {
		background: var(--paper);
	}
}

/* ---------------------------------------------------------------- */
/* Top nav                                                            */
/* ---------------------------------------------------------------- */

.kf-top {
	height: var(--nav-height);
	display: grid;
	grid-template-columns: auto 1fr auto auto auto;
	align-items: center;
	gap: 24px;
	padding: 0 28px;
	border-bottom: 1px solid var(--line);
	background: var(--paper);
}

.kf-name {
	font-weight: 500;
	letter-spacing: -0.03em;
	text-decoration: none;
	color: var(--ink);
	white-space: nowrap;
}

.kf-name span { color: var(--blue); }

.kf-nav {
	display: flex;
	gap: 24px;
	font-size: 13px;
}

.kf-nav a {
	color: var(--quiet);
	text-decoration: none;
}

.kf-nav a[aria-current="page"] { color: var(--ink); }

.kf-location {
	color: var(--quiet);
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
	white-space: nowrap;
}

.kf-social { display: flex; align-items: center; gap: 14px; }
.kf-social a { display: flex; color: var(--quiet); }
.kf-social a:hover, .kf-social a:focus-visible { color: var(--blue); }
.kf-social svg { width: 17px; height: 17px; }

.kf-menu-trigger {
	display: none;
	width: 36px;
	height: 36px;
	align-items: center;
	justify-content: center;
	background: none;
	border: 1px solid var(--line);
}

.kf-mobile-menu {
	display: none;
}

@media (max-width: 760px) {
	.kf-top { grid-template-columns: 1fr auto; padding: 0 18px; }
	.kf-nav, .kf-location, .kf-social--header { display: none; }
	.kf-menu-trigger { display: flex; }

	.kf-mobile-menu {
		display: block;
		max-height: 0;
		overflow: hidden;
		border-bottom: 1px solid var(--line);
		background: var(--paper);
		transition: max-height var(--dur) ease;
	}

	.kf-mobile-menu[data-open] { max-height: 380px; }

	.kf-mobile-menu a {
		display: block;
		padding: 14px 18px;
		text-decoration: none;
		color: var(--ink);
		border-bottom: 1px solid var(--line);
		min-height: 44px;
	}

	.kf-mobile-menu a:last-child { border-bottom: 0; }

	.kf-mobile-menu .kf-social--mobile {
		display: flex;
		justify-content: center;
		gap: 28px;
		padding: 18px;
	}

	.kf-mobile-menu .kf-social--mobile a {
		display: flex;
		padding: 0;
		border-bottom: 0;
		min-height: 0;
		color: var(--quiet);
	}

	.kf-mobile-menu .kf-social--mobile svg { width: 22px; height: 22px; }
}

/* ---------------------------------------------------------------- */
/* Hero                                                               */
/* ---------------------------------------------------------------- */

.kf-hero {
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr);
	border-bottom: 1px solid var(--line);
}

.kf-intro {
	padding: 50px 38px 44px 28px;
	position: relative;
	background: var(--paper-2);
}

.kf-eyebrow {
	display: flex;
	gap: 10px;
	align-items: center;
	color: var(--quiet);
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-transform: uppercase;
	letter-spacing: .08em;
	margin-bottom: 30px;
}

.kf-mark { width: 32px; height: 3px; background: var(--orange); display: inline-block; }

h1.kf-headline {
	max-width: 790px;
	font-size: clamp(48px, 7.4vw, 92px);
	line-height: .93;
	letter-spacing: -.072em;
	font-weight: 500;
}

h1.kf-headline em { color: var(--blue); font-style: normal; }

.kf-deck {
	margin-top: 34px;
	max-width: 620px;
	font-size: 18px;
	line-height: 1.48;
	letter-spacing: -.018em;
}

.kf-deck strong { font-weight: 500; }

.kf-side {
	display: grid;
	grid-template-rows: auto 1fr auto;
	border-left: 1px solid var(--line);
	background: var(--yellow);
	color: var(--yellow-ink);
	padding: 28px;
	position: relative;
}

.kf-side-label {
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-transform: uppercase;
	letter-spacing: .08em;
	opacity: .66;
	margin-bottom: 22px;
	position: relative;
	z-index: 6;
}

.kf-portrait {
	align-self: center;
	margin-top: 10px;
	width: min(270px, 88%);
	aspect-ratio: 1 / 1;
	justify-self: center;
	position: relative;
	background: var(--paper);
	overflow: visible;
	transform: rotate(1.8deg);
	box-shadow: 8px 8px 0 var(--yellow-ink);
}

.kf-portrait img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center bottom;
	display: block;
	filter: saturate(.96) contrast(1.03);
}

.kf-portrait::after {
	content: "";
	position: absolute;
	inset: 0;
	box-shadow: inset 0 0 0 2px var(--yellow-ink);
	pointer-events: none;
}

.kf-crosshair {
	position: absolute;
	width: 28px;
	height: 28px;
	right: -9px;
	bottom: -9px;
	background: var(--orange);
	z-index: 2;
}

.kf-scribble {
	position: absolute;
	left: -36px;
	top: 38%;
	width: 70px;
	height: 25px;
	border-top: 4px solid var(--orange);
	border-radius: 50%;
	transform: rotate(-18deg);
	z-index: 3;
}

.kf-scribble::before, .kf-scribble::after {
	content: "";
	position: absolute;
	width: 64px;
	border-top: 3px solid var(--orange);
	top: 6px;
	left: 5px;
	border-radius: 50%;
}

.kf-scribble::after { top: 14px; left: 1px; }

.kf-note {
	position: absolute;
	z-index: 4;
	right: 18px;
	top: 72px;
	font-family: "Caveat", cursive;
	font-weight: 500;
	font-size: 23px;
	line-height: 1;
	transform: rotate(5deg);
	max-width: 110px;
	color: var(--yellow-ink);
	-webkit-text-stroke: 5px var(--paper);
	paint-order: stroke fill;
	text-shadow:
		0 0 3px var(--paper),
		0 0 3px var(--paper),
		0 0 3px var(--paper);
}

.kf-note::after {
	content: "";
	display: block;
	width: 42px;
	height: 18px;
	border-bottom: 3px solid var(--yellow-ink);
	border-radius: 50%;
	transform: rotate(-12deg);
}

.kf-side-copy {
	font-size: 16px;
	line-height: 1.45;
	max-width: 290px;
	background: var(--paper);
	color: var(--ink);
	border: 2px solid var(--yellow-ink);
	padding: 13px 14px;
	transform: rotate(-1.2deg);
}

.kf-side-copy span {
	display: block;
	opacity: .7;
	margin-top: 8px;
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------------------------------------------------------------- */
/* Portrait block: reusable comic-style single-image treatment for   */
/* a lead photo — rotated frame with a coloured ink-shadow, a         */
/* handwritten aside (reuses .kf-scribble) and a rotated caption box. */
/* Pair with style="--portrait-accent: var(--blue)" etc. on the       */
/* block; falls back to --ink. Used on About's portrait and on each   */
/* Work case study's lead image.                                      */
/* ---------------------------------------------------------------- */

.kf-portrait-block {
	max-width: 420px;
	margin: 36px auto 0;
	position: relative;
}

.kf-portrait-frame {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: var(--paper-2);
	border: 1px solid var(--line);
	box-shadow: 8px 8px 0 var(--portrait-accent, var(--ink));
	overflow: hidden;
	transform: rotate(-1.5deg);
}

.kf-portrait-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

.kf-portrait-caption {
	position: relative;
	margin: 24px 0 0 24px;
	max-width: calc(100% - 24px);
	background: var(--paper);
	color: var(--ink);
	border: 1px solid var(--ink);
	box-shadow: 4px 4px 0 var(--ink);
	padding: 9px 14px;
	transform: rotate(1deg);
}

.kf-portrait-caption b { display: block; font-size: 16px; font-weight: 500; letter-spacing: -.01em; }

.kf-portrait-caption span {
	display: block;
	margin-top: 2px;
	font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--quiet);
	text-transform: uppercase;
	letter-spacing: .05em;
}

.kf-portrait-note {
	position: absolute;
	z-index: 4;
	right: 4px;
	top: -18px;
	font-family: "Caveat", cursive;
	font-weight: 500;
	font-size: 22px;
	line-height: 1.05;
	transform: rotate(6deg);
	max-width: 150px;
	text-align: right;
	color: var(--portrait-accent, var(--ink));
	-webkit-text-stroke: 5px var(--paper);
	paint-order: stroke fill;
	text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 3px var(--paper);
	pointer-events: none;
}

@media (max-width: 480px) {
	.kf-portrait-note { font-size: 19px; max-width: 120px; }
}

/* ---------------------------------------------------------------- */
/* Lens switcher                                                      */
/* ---------------------------------------------------------------- */

.kf-switcher {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 16px 28px;
	border-bottom: 1px solid var(--line);
	background: var(--paper);
}

.kf-switcher span {
	color: var(--quiet);
	margin-right: 12px;
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.kf-switcher button {
	border: 1px solid var(--line);
	background: transparent;
	color: var(--quiet);
	min-height: 38px;
	padding: 0 16px;
	cursor: pointer;
}

.kf-switcher button[aria-pressed="true"] {
	background: var(--ink);
	color: var(--paper);
	border-color: var(--ink);
}

/* ---------------------------------------------------------------- */
/* Indexed rows                                                       */
/* ---------------------------------------------------------------- */

.kf-projects { background: var(--paper-2); }

.kf-row {
	min-height: 92px;
	display: grid;
	grid-template-columns: 68px minmax(180px, .65fr) minmax(300px, 1.35fr) auto;
	align-items: center;
	gap: 20px;
	padding: 18px 28px;
	border-bottom: 1px solid var(--line);
	text-decoration: none;
	color: inherit;
	transition: background var(--dur) ease, color var(--dur) ease;
}

.kf-row:hover, .kf-row:focus-visible {
	background: color-mix(in srgb, var(--blue) 12%, var(--paper-2) 88%);
	color: var(--ink);
}

.kf-num {
	color: var(--quiet);
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
	transition: color var(--dur) ease;
}

.kf-title { font-size: 24px; font-weight: 500; letter-spacing: -.035em; }
.kf-desc { font-size: 14px; line-height: 1.45; }

.kf-meta {
	color: var(--quiet);
	font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-align: right;
	transition: color var(--dur) ease;
}

.kf-row[hidden] { display: none; }

/* ---------------------------------------------------------------- */
/* Panels: comic-panel cards for Work / Lab / Notes                   */
/* Colour comes from --panel-accent set inline per card, e.g.         */
/* style="--panel-accent: var(--orange)"                              */
/* ---------------------------------------------------------------- */

.kf-panel-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 28px 24px;
	padding: 40px 32px 48px;
	background: var(--paper-2);
	border-bottom: 1px solid var(--line);
}

.kf-panel-grid--two-col { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 900px) {
	.kf-panel-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
	.kf-panel-grid, .kf-panel-grid--two-col {
		grid-template-columns: 1fr;
		padding: 28px 18px 36px;
		gap: 36px 0;
	}
}

.kf-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--paper);
	border: 1px solid var(--line);
	border-top: 6px solid var(--panel-accent, var(--ink));
	box-shadow: 6px 6px 0 var(--ink);
	padding: 20px 20px 18px;
	text-decoration: none;
	color: inherit;
	transition: transform var(--dur) ease, box-shadow var(--dur) ease;
}

.kf-panel:hover, .kf-panel:focus-visible {
	transform: translate(-3px, -3px);
	box-shadow: 9px 9px 0 var(--ink);
}

@media (max-width: 640px) {
	.kf-panel { box-shadow: 5px 5px 0 var(--ink); }
	.kf-panel:hover, .kf-panel:focus-visible { transform: none; box-shadow: 5px 5px 0 var(--ink); }
}

.kf-panel__num {
	font: 700 32px "Bricolage Grotesque", sans-serif;
	color: color-mix(in srgb, var(--panel-accent, var(--quiet)) 55%, var(--ink) 45%);
	letter-spacing: -.02em;
	line-height: 1;
	margin-bottom: 10px;
}

.kf-panel__title {
	font-size: 21px;
	font-weight: 500;
	letter-spacing: -.02em;
	line-height: 1.18;
	margin-bottom: 10px;
}

.kf-panel__desc {
	font-size: 14px;
	line-height: 1.5;
	color: var(--ink);
	flex: 1;
}

.kf-panel__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px 10px;
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--line);
	font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--quiet);
}

.kf-stamp {
	display: inline-block;
	padding: 2px 9px;
	font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-transform: uppercase;
	letter-spacing: .05em;
	border: 1.5px solid var(--stamp-color, var(--quiet));
	color: var(--stamp-text, color-mix(in srgb, var(--stamp-color, var(--quiet)) 60%, var(--ink) 40%));
	background: var(--paper);
	transform: rotate(-4deg);
}

.kf-panel .kf-aside {
	display: block;
	margin: 6px 0 0;
}

/* ---------------------------------------------------------------- */
/* Footer                                                             */
/* ---------------------------------------------------------------- */

.kf-foot {
	display: flex;
	justify-content: space-between;
	gap: 20px;
	align-items: center;
	padding: 24px 28px;
	font-size: 13px;
	color: var(--quiet);
	background: var(--paper);
}

.kf-foot b { color: var(--ink); font-weight: 500; }

.kf-foot-links a {
	color: var(--quiet);
	text-decoration: none;
}

.kf-foot-links a:hover { color: var(--ink); }

.kf-foot-links .sep { margin: 0 8px; color: var(--line); }

/* ---------------------------------------------------------------- */
/* Now strip                                                          */
/* ---------------------------------------------------------------- */

.kf-now {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
	background: var(--paper);
	font-size: 14px;
}

.kf-now-item {
	position: relative;
	padding: 21px 22px 18px;
	border-left: 1px solid var(--line);
}

.kf-now-item:first-child {
	border-left: 0;
}

.kf-now-item::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
}

.kf-now-item:nth-child(1)::before,
.kf-now-item:nth-child(2)::before {
	background: var(--blue);
}

.kf-now-item:nth-child(3)::before,
.kf-now-item:nth-child(4)::before {
	background: var(--orange);
}

.kf-now dt {
	display: flex;
	align-items: center;
	gap: 7px;
	color: var(--quiet);
	font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-transform: uppercase;
	letter-spacing: .06em;
	margin-bottom: 7px;
}

.kf-now dt::before {
	content: "";
	width: 6px;
	height: 6px;
	flex-shrink: 0;
	background: var(--quiet);
	transform: rotate(45deg);
}

.kf-now-item:nth-child(1) dt::before,
.kf-now-item:nth-child(2) dt::before {
	background: var(--blue);
}

.kf-now-item:nth-child(3) dt::before,
.kf-now-item:nth-child(4) dt::before {
	background: var(--orange);
}

.kf-now dd {
	margin: 0;
	line-height: 1.4;
}

@media (max-width: 900px) {
	.kf-now {
		grid-template-columns: repeat(2, 1fr);
	}
	.kf-now-item:nth-child(2n+1) {
		border-left: 0;
	}
	.kf-now-item:nth-child(n+3) {
		border-top: 1px solid var(--line);
	}
}

@media (max-width: 500px) {
	.kf-now {
		grid-template-columns: 1fr;
	}
	.kf-now-item {
		border-left: 0 !important;
		border-top: 1px solid var(--line);
	}
	.kf-now-item:first-child {
		border-top: 0;
	}
}

/* ---------------------------------------------------------------- */
/* Responsive (from approved reference)                               */
/* ---------------------------------------------------------------- */

@media (max-width: 760px) {
	.kf-hero { grid-template-columns: 1fr; }
	.kf-intro { padding: 38px 18px 34px; }
	h1.kf-headline { font-size: clamp(48px, 15vw, 68px); }
	.kf-side {
		border-left: 0;
		min-height: 280px;
		grid-template-columns: 1fr 1fr;
		grid-template-rows: auto 1fr;
	}
	.kf-side-copy { align-self: end; }
	.kf-portrait { grid-row: 1 / 3; grid-column: 2; width: 150px; }
	.kf-note { display: none; }
	.kf-switcher { padding: 14px 18px; }
	.kf-row { grid-template-columns: 38px 1fr auto; padding: 18px; gap: 10px; }
	.kf-desc { grid-column: 2 / 4; }
	.kf-meta { grid-column: 3; grid-row: 1; }
	.kf-foot { padding: 22px 18px; align-items: flex-start; flex-direction: column; }
}

/* ================================================================== */
/* Interior-page components (Work / Lab / Notes / Elsewhere / About)  */
/* ================================================================== */

/* ---------------------------------------------------------------- */
/* Page masthead                                                      */
/* ---------------------------------------------------------------- */

.kf-page-head {
	padding: 50px 38px 40px 28px;
	background: var(--paper-2);
	border-bottom: 1px solid var(--line);
}

.kf-page-head h1 {
	max-width: 780px;
	font-size: clamp(38px, 5.2vw, 64px);
	line-height: .98;
	letter-spacing: -.045em;
	font-weight: 500;
}

.kf-page-head .kf-deck {
	margin-top: 22px;
	max-width: 640px;
}

@media (max-width: 760px) {
	.kf-page-head { padding: 34px 18px 30px; }
}

/* ---------------------------------------------------------------- */
/* Handwritten asides (Caveat)                                        */
/* ---------------------------------------------------------------- */

.kf-aside {
	font-family: "Caveat", cursive;
	font-size: 20px;
	color: var(--ink-soft, var(--quiet));
	transform: rotate(-2deg);
	display: inline-block;
	margin-left: 10px;
}

/* ---------------------------------------------------------------- */
/* Comic strip: a row of equal square panels, like panels in a comic  */
/* strip. Reusable across pages — just repeat .kf-comic-panel inside  */
/* .kf-comic-page, any number of them. Each panel takes a background  */
/* photo/illustration via inline style="--panel-art: url(...)";       */
/* .kf-comic-panel__icon is the placeholder shown until real artwork  */
/* exists.                                                             */
/* IMPORTANT: use a root-relative path (/images/...) in --panel-art,  */
/* not a page-relative one (../images/...) — a url() stored in a      */
/* custom property resolves against the stylesheet that consumes it   */
/* via var() (this file), not the HTML page that set the property.    */
/* Panels are square (aspect-ratio 1/1) to match square source art    */
/* without harsh cropping — don't reintroduce wide/tall spans here.   */
/* ---------------------------------------------------------------- */

.kf-comic-page {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 8px;
	width: min(760px, 100% - 56px);
	margin: 40px auto 0;
	padding: 8px;
	background: var(--ink);
}

/* Pick the modifier that divides your panel count evenly (4 panels   */
/* -> --4, 10 panels -> --5 for 2 clean rows, etc.) rather than        */
/* relying on auto-fit, which leaves an awkward gap on an uneven       */
/* final row. Both breakpoints below must stay in sync with any new   */
/* modifier you add.                                                   */
/* Roomy variant: for strips whose captions are large relative to the  */
/* default 760px cap (e.g. a hub page with only 4-5 panels total),     */
/* where the caption box would otherwise cover most of the artwork.    */
.kf-comic-page--roomy { width: min(1040px, 100% - 56px); }

.kf-comic-page--3 { grid-template-columns: repeat(3, 1fr); }
.kf-comic-page--4 { grid-template-columns: repeat(4, 1fr); }
.kf-comic-page--5 { grid-template-columns: repeat(5, 1fr); }

.kf-comic-panel {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	text-decoration: none;
	background-color: var(--panel-color, var(--ink-soft));
	background-image: var(--panel-art, none);
	background-size: cover;
	background-position: center;
	transition: transform var(--dur) ease;
}

.kf-comic-panel:hover, .kf-comic-panel:focus-visible {
	transform: scale(1.02);
	z-index: 1;
}

@media (max-width: 600px) {
	.kf-comic-page,
	.kf-comic-page--4,
	.kf-comic-page--5 {
		grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	}
}

/* Strip variant: alternating text/image panels (Work, Lab) read in       */
/* strict order, so force a single column at mobile width instead of the  */
/* generic auto-fit above — two narrow side-by-side cells isn't enough    */
/* room for a title + description and clips the text.                    */
@media (max-width: 600px) {
	.kf-comic-page--strip { grid-template-columns: 1fr; }
}

/* Mosaic variant: real comic pages mix panel sizes for rhythm. Use     */
/* this only where every image is a screenshot/photo you cropped       */
/* yourself (you control the framing) — NOT for square AI-generated    */
/* art, which still wants the plain square .kf-comic-page above so      */
/* cover-cropping can't cut off part of the illustration.               */
/* Row height is NOT hardcoded — it self-derives from column width via */
/* aspect-ratio (a span-2 "wide" panel at 2/1 naturally lands at the    */
/* same height as a normal 1/1 panel next to it; a span-2 "tall" panel */
/* at 1/2 naturally lands as tall as two stacked normal rows). A fixed  */
/* pixel grid-auto-rows would fight the actual column width and crop   */
/* every "normal" panel into a squashed rectangle — don't reintroduce  */
/* one here.                                                            */
.kf-comic-page--mosaic {
	grid-template-columns: repeat(4, 1fr);
	grid-auto-flow: dense;
}

.kf-comic-panel--wide { grid-column: span 2; aspect-ratio: 2 / 1; }
.kf-comic-panel--tall { grid-row: span 2; aspect-ratio: 1 / 2; }
.kf-comic-panel--big { grid-column: span 2; grid-row: span 2; aspect-ratio: 1 / 1; }

@media (max-width: 760px) {
	.kf-comic-page--mosaic { grid-template-columns: repeat(2, 1fr); }
	.kf-comic-panel--wide { grid-column: span 2; aspect-ratio: 2 / 1; }
	.kf-comic-panel--big { grid-column: span 2; grid-row: span 2; aspect-ratio: 1 / 1; }
}

@media (max-width: 480px) {
	.kf-comic-page--mosaic { grid-template-columns: 1fr; }
	.kf-comic-panel--wide, .kf-comic-panel--tall, .kf-comic-panel--big {
		grid-column: span 1; grid-row: span 1; aspect-ratio: 1 / 1;
	}
}

/* Narrative box: a plain comic caption panel for mosaics — use these   */
/* to fill a leftover grid gap, or just scatter a few through a strip   */
/* to narrate rather than only show. Plain <div>, not a link.           */
.kf-comic-panel--text {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--paper);
	border: 2px solid var(--ink);
	padding: 18px;
	text-align: center;
	cursor: default;
}

.kf-comic-panel--text:hover, .kf-comic-panel--text:focus-visible { transform: none; }

.kf-comic-panel--text p {
	font-family: "Caveat", cursive;
	font-size: 22px;
	line-height: 1.35;
	color: var(--ink);
	max-width: 22ch;
}

.kf-comic-panel--text:nth-of-type(odd) p { transform: rotate(-1.5deg); }
.kf-comic-panel--text:nth-of-type(even) p { transform: rotate(1deg); }

/* Description box: a readable text panel woven into the strip for      */
/* pages whose panels are real case studies, not asides — reuses the    */
/* .kf-panel__num/title/desc typography rather than the handwritten     */
/* Caveat font the narrative --text variant above uses.                 */
.kf-comic-panel--desc {
	display: flex;
	flex-direction: column;
	justify-content: center;
	aspect-ratio: auto;
	min-height: 220px;
	overflow: visible;
	background: var(--paper);
	border: 2px solid var(--ink);
	padding: 26px 24px;
	text-decoration: none;
	color: inherit;
}

.kf-comic-panel--desc .kf-panel__num { margin-bottom: 8px; }
.kf-comic-panel--desc .kf-panel__title { margin-bottom: 8px; }
.kf-comic-panel--desc .kf-aside { display: block; margin: 10px 0 0; }

/* Shape variants: hand-assign one of these per text box (cycle through  */
/* them) so the caption boxes read as clipped/pasted comic captions      */
/* rather than plain uniform rectangles — a notched corner plus a touch  */
/* of rotation. Each variant restates its own rotation in :hover because */
/* transform is a single property and the base .kf-comic-panel:hover     */
/* scale rule would otherwise overwrite the tilt instead of combining.   */
.kf-shape-a { clip-path: polygon(0 0, 100% 0, 100% 90%, 88% 100%, 0 100%); transform: rotate(-0.8deg); }
.kf-shape-a:hover, .kf-shape-a:focus-visible { transform: rotate(-0.8deg) scale(1.03); }

.kf-shape-b { clip-path: polygon(10% 0, 100% 0, 100% 100%, 0 100%, 0 10%); transform: rotate(0.6deg); }
.kf-shape-b:hover, .kf-shape-b:focus-visible { transform: rotate(0.6deg) scale(1.03); }

.kf-shape-c { clip-path: polygon(0 0, 88% 0, 100% 12%, 100% 100%, 0 100%); transform: rotate(-0.5deg); }
.kf-shape-c:hover, .kf-shape-c:focus-visible { transform: rotate(-0.5deg) scale(1.03); }

.kf-shape-d { clip-path: polygon(0 0, 100% 0, 100% 100%, 12% 100%, 0 88%); transform: rotate(0.8deg); }
.kf-shape-d:hover, .kf-shape-d:focus-visible { transform: rotate(0.8deg) scale(1.03); }

.kf-comic-panel__icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--panel-icon, var(--paper));
	opacity: .85;
}

.kf-comic-panel[style*="--panel-art"] .kf-comic-panel__icon { display: none; }

.kf-comic-panel__icon svg {
	width: 25%;
	height: 25%;
	min-width: 40px;
	min-height: 40px;
	max-width: 72px;
	max-height: 72px;
}

.kf-comic-panel__caption {
	position: absolute;
	left: 12px;
	bottom: 12px;
	max-width: calc(100% - 24px);
	background: var(--paper);
	color: var(--ink);
	border: 1px solid var(--ink);
	box-shadow: 4px 4px 0 var(--ink);
	padding: 7px 12px;
	transform: rotate(-1deg);
}

.kf-comic-panel__caption b {
	display: block;
	font-size: 15px;
	font-weight: 500;
	letter-spacing: -.01em;
}

.kf-comic-panel__caption span {
	display: block;
	margin-top: 2px;
	font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--quiet);
	text-transform: uppercase;
	letter-spacing: .05em;
}

@media (max-width: 760px) {
	.kf-comic-page { margin: 30px 18px 0; }
}

.kf-comic-also {
	margin: 20px 28px 0;
	padding-bottom: 36px;
	font-size: 13px;
	color: var(--quiet);
}

.kf-comic-also a { color: var(--ink); }

@media (max-width: 760px) {
	.kf-comic-also { margin: 18px 18px 0; }
}

/* ---------------------------------------------------------------- */
/* Elsewhere: asymmetric image-led sequence                           */
/* ---------------------------------------------------------------- */

.kf-gallery-key {
	margin: 0;
	padding: 0 28px;
	font-size: 13px;
	color: var(--quiet);
}

.kf-gallery-key .kf-ext-badge {
	color: var(--ink);
	padding: 1px 6px;
	border: 1px solid var(--line);
}

.kf-gallery {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 24px;
	padding: 40px 28px;
}

.kf-gallery-key + .kf-gallery { padding-top: 16px; }

.kf-plate {
	grid-column: span 3;
	text-decoration: none;
	color: inherit;
}

.kf-plate--wide { grid-column: span 4; }
.kf-plate--narrow { grid-column: span 2; }

.kf-plate__frame {
	position: relative;
	aspect-ratio: 4 / 3;
	background: var(--paper-2);
	border: 1px dashed var(--line);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--quiet);
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-transform: uppercase;
	letter-spacing: .05em;
	text-align: center;
	padding: 20px;
	overflow: hidden;
}

/* Destination badges: what clicking this actually does.               */
/* .kf-plate__badge overlays a thumbnail; .kf-ext-badge sits inline in  */
/* a panel/row meta line. Both share the same icon + label markup.      */

.kf-ext-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.kf-ext-badge svg { width: 10px; height: 10px; flex-shrink: 0; }

.kf-plate__badge {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	padding: 3px 8px;
	background: color-mix(in srgb, var(--ink) 80%, transparent 20%);
	color: var(--paper);
	pointer-events: none;
}

.kf-plate__frame img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.kf-plate__frame:has(img) {
	padding: 0;
	border-style: solid;
	border-color: var(--ink);
}

a.kf-plate__frame.kf-plate--zoom { cursor: zoom-in; }

.kf-plate--wide .kf-plate__frame { aspect-ratio: 16 / 9; }

.kf-plate__cap {
	margin-top: 12px;
}

.kf-plate__title {
	font-size: 19px;
	font-weight: 500;
}

.kf-plate__desc {
	margin-top: 4px;
	font-size: 14px;
	color: var(--quiet);
	max-width: 46ch;
}

@media (max-width: 760px) {
	.kf-gallery-key { padding: 0 18px; }
	.kf-gallery { grid-template-columns: 1fr; padding: 30px 18px; gap: 30px; }
	.kf-plate, .kf-plate--wide, .kf-plate--narrow { grid-column: span 1; }
}

/* ---------------------------------------------------------------- */
/* Shared: quiet reference list (patents, service, links)             */
/* ---------------------------------------------------------------- */

.kf-quiet-section {
	padding: 34px 28px 44px;
	border-top: 1px solid var(--line);
	background: var(--paper-2);
}

.kf-quiet-section h2 {
	font-size: 22px;
	font-weight: 500;
	margin-bottom: 18px;
}

.kf-ref-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.kf-ref-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--line);
}

.kf-ref-row:last-child {
	border-bottom: 0;
	padding-bottom: 0;
}

.kf-ref-row a {
	color: var(--ink);
	text-decoration: underline;
	text-decoration-color: var(--line);
	text-underline-offset: 3px;
}

.kf-ref-row a:hover {
	text-decoration-color: var(--ink);
}

.kf-ref-row__meta {
	font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--quiet);
	text-transform: uppercase;
	letter-spacing: .05em;
}

.kf-ref-row__icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	align-self: center;
	color: var(--quiet);
}

@media (max-width: 760px) {
	.kf-quiet-section { padding: 28px 18px 34px; }
}

/* ================================================================== */
/* Detail templates: case study / experiment / article / story        */
/* ================================================================== */

/* ---------------------------------------------------------------- */
/* Case-study masthead                                                */
/* ---------------------------------------------------------------- */

.kf-case-head {
	padding: 54px 38px 46px 28px;
	background: color-mix(in srgb, var(--case-accent, var(--blue)) 16%, var(--paper-2) 84%);
	border-bottom: 1px solid var(--line);
}

.kf-case-head .kf-num {
	font: 500 15px ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--case-accent, var(--blue));
	margin-bottom: 10px;
}

.kf-case-head h1 {
	max-width: 820px;
	font-size: clamp(32px, 4.6vw, 54px);
	line-height: 1.02;
	letter-spacing: -.03em;
	font-weight: 500;
}

.kf-case-head .kf-thesis {
	margin-top: 18px;
	max-width: 640px;
	font-size: 19px;
	color: var(--ink);
	line-height: 1.5;
}

.kf-case-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin-top: 22px;
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--quiet);
	text-transform: uppercase;
	letter-spacing: .05em;
}

@media (max-width: 700px) {
	.kf-case-head { padding: 36px 18px 32px; }
}

/* ---------------------------------------------------------------- */
/* Article prose (shared by case study body / notes / lab / stories)  */
/* ---------------------------------------------------------------- */

.kf-article {
	max-width: 720px;
	margin: 0 auto;
	padding: 46px 28px 20px;
}

.kf-article .kf-standfirst {
	font-size: 19px;
	line-height: 1.5;
	color: var(--ink);
	margin-bottom: 8px;
}

.kf-article .kf-article-meta {
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--quiet);
	text-transform: uppercase;
	letter-spacing: .05em;
	margin-bottom: 30px;
	display: block;
}

.kf-article h2 {
	font-size: 24px;
	font-weight: 500;
	letter-spacing: -.02em;
	margin: 38px 0 14px;
}

.kf-article h2:first-of-type {
	margin-top: 6px;
}

.kf-article p {
	margin: 0 0 18px;
	line-height: 1.7;
	color: var(--ink);
}

.kf-article ul, .kf-article ol {
	margin: 0 0 18px;
	padding-left: 22px;
	line-height: 1.7;
}

.kf-article li { margin-bottom: 6px; }

.kf-article a {
	color: var(--ink);
	text-decoration: underline;
	text-decoration-color: var(--line);
	text-underline-offset: 3px;
}

.kf-article a:hover { text-decoration-color: var(--ink); }

.kf-pullquote {
	margin: 34px 0;
	padding: 4px 0 4px 22px;
	border-left: 3px solid var(--case-accent, var(--blue));
	font-size: 22px;
	line-height: 1.4;
	letter-spacing: -.01em;
	font-weight: 500;
	max-width: 60ch;
}

.kf-callout {
	border: 1px solid var(--ink);
	background: var(--paper-2);
	padding: 18px 20px;
	margin: 30px 0;
	font-size: 15px;
	line-height: 1.6;
	color: var(--ink-soft, var(--ink));
}

.kf-callout strong { color: var(--ink); }

@media (max-width: 700px) {
	.kf-article { padding: 34px 18px 10px; }
}

/* ---------------------------------------------------------------- */
/* Experiment template                                                */
/* ---------------------------------------------------------------- */

.kf-hypothesis {
	background: var(--yellow);
	color: var(--yellow-ink);
	padding: 26px 28px;
	margin: 0 0 8px;
}

.kf-hypothesis .kf-num {
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-transform: uppercase;
	letter-spacing: .05em;
	opacity: .7;
	margin-bottom: 10px;
}

.kf-hypothesis p {
	font-size: 19px;
	line-height: 1.5;
	max-width: 640px;
}

.kf-status-line {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	padding: 16px 28px;
	border-bottom: 1px solid var(--line);
	background: var(--paper);
	font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--quiet);
	text-transform: uppercase;
	letter-spacing: .05em;
}

/* ---------------------------------------------------------------- */
/* Process image sequence                                             */
/* ---------------------------------------------------------------- */

.kf-process {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	padding: 10px 28px 10px;
	max-width: 900px;
	margin: 0 auto;
}

.kf-process .kf-plate__frame {
	aspect-ratio: 1 / 1;
}

@media (max-width: 700px) {
	.kf-process { grid-template-columns: repeat(2, 1fr); padding: 10px 18px; }
}

/* ---------------------------------------------------------------- */
/* Previous / next navigation                                         */
/* ---------------------------------------------------------------- */

.kf-prevnext {
	display: flex;
	border-bottom: 1px solid var(--line);
	background: var(--paper-2);
}

.kf-prevnext a {
	flex: 1;
	padding: 18px 28px;
	text-decoration: none;
	color: inherit;
	transition: background var(--dur) ease;
}

.kf-prevnext a:hover {
	background: color-mix(in srgb, var(--blue) 8%, var(--paper-2) 92%);
}

.kf-prevnext a + a {
	border-left: 1px solid var(--line);
	text-align: right;
}

.kf-prevnext a:only-child {
	flex: 0 1 auto;
	margin-right: auto;
	text-align: left;
}

.kf-prevnext .kf-prevnext-label {
	display: block;
	font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
	color: var(--quiet);
	text-transform: uppercase;
	letter-spacing: .05em;
	margin-bottom: 6px;
}

.kf-prevnext .kf-prevnext-title {
	font-size: 17px;
	font-weight: 500;
}

@media (max-width: 600px) {
	.kf-prevnext { flex-direction: column; }
	.kf-prevnext a + a { border-left: 0; border-top: 1px solid var(--line); text-align: left; }
}

/* ---------------------------------------------------------------- */
/* Story opener (pottery / training / photography)                    */
/* ---------------------------------------------------------------- */

.kf-story-opener {
	padding: 0;
}

.kf-story-opener .kf-plate__frame {
	aspect-ratio: 21 / 9;
	border-radius: 0;
}

.kf-story-head {
	padding: 40px 28px 10px;
	max-width: 720px;
	margin: 0 auto;
}

.kf-story-head h1 {
	font-size: clamp(30px, 4.4vw, 46px);
	letter-spacing: -.03em;
	line-height: 1.05;
	font-weight: 500;
}

.kf-story-head .kf-standfirst {
	margin-top: 14px;
	font-size: 18px;
	color: var(--quiet);
	line-height: 1.5;
}

/* ---------------------------------------------------------------- */
/* Embed cards: live third-party 3D viewers (Sketchfab), inline        */
/* ---------------------------------------------------------------- */

.kf-embed-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 24px;
	padding: 28px 28px 8px;
}

.kf-embed-card {
	background: var(--paper-2);
	border: 1px solid var(--line);
}

.kf-embed-card__frame {
	position: relative;
	aspect-ratio: 4 / 3;
	background: var(--ink-soft);
}

.kf-embed-card__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.kf-embed-card__cap {
	padding: 14px 16px 16px;
}

.kf-embed-card__title {
	font-size: 16px;
	font-weight: 500;
	letter-spacing: -.01em;
	margin-bottom: 6px;
}

.kf-embed-card__desc {
	font-size: 13px;
	line-height: 1.5;
	color: var(--quiet);
}

.kf-embed-card__meta {
	margin-top: 10px;
	font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--quiet);
}

@media (max-width: 640px) {
	.kf-embed-grid { padding: 24px 18px 4px; gap: 20px; }
}

/* ---------------------------------------------------------------- */
/* Lightbox: same-site photos enlarge in place instead of navigating  */
/* ---------------------------------------------------------------- */

.kf-lightbox {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: none;
	align-items: center;
	justify-content: center;
	background: color-mix(in srgb, var(--ink) 90%, transparent 10%);
	padding: 56px 24px;
}

.kf-lightbox[data-open] { display: flex; }

.kf-lightbox img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	box-shadow: 0 0 0 1px var(--line);
}

.kf-lightbox__close {
	position: absolute;
	top: 18px;
	right: 18px;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--paper);
	border: 1px solid var(--ink);
	color: var(--ink);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

@media (max-width: 640px) {
	.kf-lightbox { padding: 72px 16px 24px; }
}
