/* Naloiv Index. Tokens, layout and components. */

/* ---------- Tokens ---------- */
:root {
	--nv-ground: #FBFBF9;
	--nv-ink: #111111;
	--nv-muted: #666660;
	--nv-rule: #DADAD5;
	--nv-tile: #E8E8E4;
	--nv-tile-deep: #D6D6D0;
	--nv-tile-inset: #F3F3F0;
	--nv-tile-inset-line: #C9C9C3;
	--nv-tile-bleed: #CFCFC8;
	--nv-signal: #FF4B1F;
	--nv-on-signal: #111111;
	--nv-label-col: 220px;
	--nv-margin: 48px;
	--nv-max: 1344px;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--nv-ground: #111111;
		--nv-ink: #FBFBF9;
		--nv-muted: #A3A39C;
		--nv-rule: #2E2E2B;
		--nv-tile: #1F1F1D;
		--nv-tile-deep: #2A2A27;
		--nv-tile-inset: #262624;
		--nv-tile-inset-line: #3A3A37;
		--nv-tile-bleed: #34342F;
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--nv-ground: #111111;
	--nv-ink: #FBFBF9;
	--nv-muted: #A3A39C;
	--nv-rule: #2E2E2B;
	--nv-tile: #1F1F1D;
	--nv-tile-deep: #2A2A27;
	--nv-tile-inset: #262624;
	--nv-tile-inset-line: #3A3A37;
	--nv-tile-bleed: #34342F;
	color-scheme: dark;
}

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

body {
	margin: 0;
	background: var(--nv-ground);
	color: var(--nv-ink);
	font-family: "IBM Plex Sans", system-ui, sans-serif;
	font-size: 17px;
	line-height: 1.5;
	font-synthesis: none;
}

b, strong { font-weight: 500; }

.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }
.wp-site-blocks { padding: 0 !important; }

.nv-wrap {
	max-width: var(--nv-max);
	margin: 0 auto;
	padding-left: var(--nv-margin);
	padding-right: var(--nv-margin);
	box-sizing: border-box;
}

hr.nv-rule, hr.wp-block-separator.nv-rule { height: 1px; border: 0; background: var(--nv-rule); color: var(--nv-rule); margin: 0; max-width: none !important; width: 100% !important; }

/* Links: ink, 1px underline, signal fill on hover, ink outline on focus. */
a {
	color: var(--nv-ink);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}
a:hover {
	background: var(--nv-signal);
	color: var(--nv-on-signal);
	text-decoration: none;
}
a:focus-visible,
.nv-invert:focus-visible {
	outline: 2px solid var(--nv-ink);
	outline-offset: 3px;
}
a.nv-plain, .nv-nav a, .wp-block-site-title a { text-decoration: none; }

/* ---------- Rows: label column plus content ---------- */
.nv-row {
	display: grid;
	grid-template-columns: var(--nv-label-col) minmax(0, 1fr);
	gap: 32px;
	align-items: start;
}

/* ---------- Type roles ---------- */
.nv-display { font-size: 72px; line-height: 1; font-weight: 500; letter-spacing: -0.03em; margin: 0; }
.nv-statement { font-size: 44px; line-height: 1.14; font-weight: 500; letter-spacing: -0.02em; margin: 0; max-width: 980px; text-wrap: balance; }
.nv-contact-line { font-size: 38px; line-height: 1.15; font-weight: 500; letter-spacing: -0.02em; margin: 0; max-width: 980px; }
.nv-name-sm { font-size: 20px; line-height: 1.2; font-weight: 500; letter-spacing: -0.01em; margin: 0; }
.nv-year { font-size: 20px; line-height: 1.2; letter-spacing: -0.01em; color: var(--nv-muted); margin: 0; }
.nv-lead { font-size: 19px; line-height: 1.45; color: var(--nv-muted); margin: 0 0 14px; max-width: 760px; }
.nv-cap {
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 12.5px;
	line-height: 1.45;
	font-weight: 400;
	color: var(--nv-muted);
	margin: 0;
}

/* ---------- Header ---------- */
.nv-header { position: relative; padding-top: 28px; }
.nv-header .nv-row { align-items: baseline; }
.wp-block-site-title {
	margin: 0;
	font-size: 18px;
	line-height: 1.2;
	font-weight: 500;
	letter-spacing: -0.01em;
	max-width: 4.6em;
}
.nv-nav {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 32px;
	font-size: 18px;
	letter-spacing: -0.01em;
	padding-right: 120px;
}
.nv-nav a[aria-current="page"] { color: var(--nv-muted); }
.nv-nav a[aria-current="page"]:hover { color: var(--nv-on-signal); }
.nv-invert {
	position: absolute;
	right: var(--nv-margin);
	top: 28px;
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 12.5px;
	line-height: 1;
	color: var(--nv-ink);
	background: transparent;
	border: 1px solid var(--nv-ink);
	border-radius: 0;
	padding: 8px 12px;
	cursor: pointer;
}
.nv-invert:hover {
	background: var(--nv-signal);
	color: var(--nv-on-signal);
	border-color: var(--nv-on-signal);
}
hr.wp-block-separator.nv-header-rule { margin-top: 32px; }

/* ---------- Sections ---------- */
.nv-opening { padding: 48px 0 96px; }
.nv-portrait-fig { display: flex; flex-direction: column; gap: 8px; }
/* Portrait: fills the label column up to 220px. site.js swaps the image for a canvas. */
.nv-portrait { position: relative; width: 100%; max-width: 220px; flex: none; background: #D6D6D0; cursor: crosshair; }
.nv-portrait canvas { position: absolute; inset: 0; }
.nv-portrait img,
.nv-portrait canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.nv-portrait canvas:focus-visible { outline: 2px solid var(--nv-ink); outline-offset: 3px; }
.nv-work-title {
	padding: 28px 0;
	border-top: 1px solid var(--nv-rule);
	border-bottom: 1px solid var(--nv-rule);
}
.nv-project { padding: 44px 0 56px; border-top: 1px solid var(--nv-rule); }
.nv-work-title + .nv-project { border-top: 0; padding-top: 48px; }
.nv-project:last-of-type { padding-bottom: 96px; }
.nv-project-head { margin-bottom: 36px; }
.nv-links { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-bottom: 36px; }
.nv-project-body .nv-cap + .nv-links { margin-top: 16px; }
.nv-index { border-top: 1px solid var(--nv-rule); padding: 44px 0 80px; }
.nv-index-list { display: flex; flex-direction: column; gap: 32px; font-size: 18px; line-height: 1.6; letter-spacing: -0.005em; }
.nv-index-list .nv-cap { margin-bottom: 0; }
.nv-index-list .nv-col { display: flex; flex-direction: column; align-items: flex-start; }
.nv-footer-box { border-top: 1px solid var(--nv-rule); padding: 28px 0 44px; }
.nv-footer .nv-cap { padding-top: 0; }
.nv-footer-meta { display: flex; flex-wrap: wrap; gap: 4px 32px; }
.nv-footer-meta .nv-cap { padding-top: 0; }
/* Catalogue list on the home page: number, project, year. */
.nv-cat { list-style: none; margin: 28px 0 0; padding: 0; border-top: 1px solid var(--nv-rule); max-width: 760px; }
.nv-cat li { display: flex; gap: 16px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--nv-rule); }
.nv-cat .nv-no { flex: 0 0 76px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; line-height: 1.45; color: var(--nv-muted); }
.nv-cat a { font-size: 20px; line-height: 1.2; font-weight: 500; letter-spacing: -0.01em; text-decoration: none; }
.nv-cat .nv-yr { margin-left: auto; color: var(--nv-muted); white-space: nowrap; }
/* Catalogue row preview: the project's image in the label column. */
.nv-row.nv-has-preview { position: relative; }
.nv-preview { position: absolute; left: 0; width: var(--nv-label-col); aspect-ratio: 4 / 3; background: var(--nv-tile); display: flex; align-items: flex-end; pointer-events: none; }
.nv-preview[hidden] { display: none; }
.nv-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nv-preview span { padding: 10px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; line-height: 1.45; color: var(--nv-muted); }
/* Previous and next catalogue numbers at the foot of a case study. */
.nv-page .nv-content > .nv-pn { margin-top: 72px; }
.nv-pn { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--nv-rule); padding-top: 16px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; line-height: 1.45; }
.nv-pn a { text-decoration: none; }
/* Selected text takes the signal colour. */
::selection { background: var(--nv-signal); color: var(--nv-on-signal); }
/* Footer clock: Los Angeles time, the visitor's time, the difference. */
.nv-clock { display: flex; flex-wrap: wrap; gap: 2px 0; min-width: 0; }
.nv-clock span { white-space: nowrap; }
.nv-clock .nv-sep { padding: 0 12px; color: var(--nv-rule); }
.nv-clock b { font-weight: 400; color: var(--nv-ink); }

/* ---------- Tile grid ---------- */
.nv-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
}
.nv-tile {
	aspect-ratio: 4 / 3;
	background: var(--nv-tile);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	margin: 0;
}
.nv-tile--sq { aspect-ratio: 1 / 1; }
.nv-tile--wide { aspect-ratio: 16 / 9; }
.nv-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nv-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nv-grid--1 { grid-template-columns: minmax(0, 1fr); }
.nv-tile--bleed { background: var(--nv-tile-deep); }

/* Real images. Inset sits at 80% on the tile; bleed fills it. */
.nv-tile .wp-block-image,
.nv-tile figure { margin: 0; width: 80%; height: 78%; }
.nv-tile .wp-block-image img,
.nv-tile figure img { width: 100%; height: 100%; object-fit: contain; display: block; }
.nv-tile--bleed .wp-block-image,
.nv-tile--bleed figure { width: 100%; height: 100%; }
/* Bleed images fill the full tile height and overscan slightly, so an image
   wider than the tile cannot come up short and sub-pixel rounding never
   exposes the tile background as a hairline. */
.nv-tile--bleed .wp-block-image img,
.nv-tile--bleed figure img { object-fit: cover; height: 100%; transform: scale(1.006); }
/* Two grids stacked directly: use the grid's own 8px gap between them. */
.nv-grid + .nv-grid { margin-top: 8px; }

/* Placeholders, until images go in. The label paragraph is the placeholder box. */
.nv-tile > .nv-ph-label {
	background: var(--nv-tile-inset);
	box-shadow: inset 0 0 0 1px var(--nv-tile-inset-line);
	display: flex;
	align-items: flex-end;
	padding: 8px;
	box-sizing: border-box;
	width: 80%;
	height: 78%;
	margin: 0;
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 11px;
	line-height: 1.3;
	color: var(--nv-muted);
}
.nv-tile--s70 > .nv-ph-label { width: 70%; height: 70%; }
.nv-tile--s60 > .nv-ph-label { width: 56%; height: 62%; }
.nv-tile--bleed > .nv-ph-label { width: 100%; height: 100%; background: var(--nv-tile-bleed); box-shadow: none; color: var(--nv-ink); }

/* ---------- Inner pages ---------- */
.nv-page { padding-top: 48px; padding-bottom: 96px; }
.nv-page .nv-content > * { max-width: 760px; }
.nv-page .nv-content > .alignwide,
.nv-page .nv-content > .nv-grid,
.nv-page .nv-content > .wp-block-image.alignwide { max-width: none; }
.nv-page .nv-content > * + * { margin-top: 1.1em; }
.nv-page .nv-content > .nv-statement + * { margin-top: 32px; }
.nv-page .nv-content > .nv-grid { margin-top: 28px; }
.nv-page .nv-content h2 { font-size: 28px; margin-top: 2em; }
.nv-page .nv-content h3 { font-size: 20px; margin-top: 1.8em; }
.nv-page .nv-content img { max-width: 100%; height: auto; }
.nv-page .nv-content figcaption,
.nv-page .nv-content .wp-element-caption {
	font-family: "IBM Plex Mono", ui-monospace, monospace;
	font-size: 12.5px;
	line-height: 1.45;
	color: var(--nv-muted);
	margin-top: 8px;
	text-align: left;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	:root { --nv-margin: 24px; --nv-label-col: 160px; }
	.nv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.nv-grid--1 { grid-template-columns: minmax(0, 1fr); }
	.nv-nav { gap: 16px; padding-right: 96px; }
	.nv-display { font-size: 56px; }
	.nv-statement { font-size: 34px; }
	.nv-contact-line { font-size: 30px; }
}

@media (max-width: 640px) {
	.nv-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
	.nv-header .nv-row { gap: 20px; }
	.nv-nav { padding-right: 0; }
	.nv-display { font-size: 44px; }
	.nv-statement { font-size: 28px; line-height: 1.2; }
	.nv-contact-line { font-size: 24px; }
	.nv-opening { padding: 32px 0 64px; }
	.nv-project { padding: 32px 0 40px; }
	.nv-footer .nv-cap { padding-top: 0; }
	.nv-lead { font-size: 17px; }
}

@media (max-width: 640px) {
	.nv-preview { display: none; }
	/* Phones: number in a narrow column, name over year, so no row breaks unevenly. */
	.nv-cat li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 2px 12px; }
	.nv-cat .nv-no { grid-row: 1 / span 2; padding-top: 5px; }
	.nv-cat a, .nv-cat .nv-yr { grid-column: 2; }
	.nv-cat .nv-yr { margin-left: 0; font-size: 15px; }
}

@media (max-width: 560px) {
	.nv-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Travel: a catalogue number and name slide into the case study ---------- */
@media (prefers-reduced-motion: no-preference) {
	@view-transition { navigation: auto; }
	/* The page itself cuts. Only the two marked pieces move. */
	::view-transition-old(root) { display: none; }
	::view-transition-new(root) { animation: none; }
	::view-transition-group(nv-no),
	::view-transition-group(nv-title) { animation-duration: 320ms; animation-timing-function: cubic-bezier(0.2, 0, 0, 1); }
	::view-transition-old(nv-no),
	::view-transition-old(nv-title) { display: none; }
	::view-transition-new(nv-no),
	::view-transition-new(nv-title) { animation: none; height: 100%; width: auto; }
	.nv-travel .nv-page-head .nv-name-sm { view-transition-name: nv-title; width: fit-content; }
	.nv-travel .nv-content .nv-no-lead { view-transition-name: nv-no; }
}
