/* natnif Portfolio
   Layout for a persistent client sidebar beside a full-bleed media pane.
   Colour and type inherit from the theme by default; override the custom
   properties below to retune without touching anything else. */

.natnif-shell {
	--natnif-sidebar-width: 264px;
	--natnif-ink: currentColor;
	--natnif-ink-quiet: color-mix(in srgb, currentColor 55%, transparent);
	--natnif-rule: color-mix(in srgb, currentColor 15%, transparent);
	--natnif-backdrop: #000;
	--natnif-gap: 1.75rem;
}

/* ---------- Shell ----------
   Doubled selectors and !important are deliberate. WordPress emits its own
   layout CSS for Group blocks (display:flex, and a content-width clamp on
   children) at the same specificity as a plain class, so source order would
   otherwise decide the winner. These rules have to win outright. */

.natnif-shell.natnif-shell {
	display: grid !important;
	grid-template-columns: var(--natnif-sidebar-width) minmax(0, 1fr);
	gap: 0 !important;
	align-items: start;
	width: 100%;
	max-width: none !important;
	margin-left: 0;
	margin-right: 0;
	padding-left: 0;
	padding-right: 0;
	min-height: 100vh;
	min-height: 100svh;
	box-sizing: border-box;
}

/* Undo the constrained-layout clamp the theme puts on direct children. */
.natnif-shell.natnif-shell > .natnif-sidebar,
.natnif-shell.natnif-shell > .natnif-main {
	max-width: none !important;
	width: auto;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

.natnif-shell .natnif-sidebar {
	position: sticky;
	top: 0;
	height: 100vh;
	height: 100svh;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: var(--natnif-gap);
	border-right: 1px solid var(--natnif-rule);
	box-sizing: border-box;
}

.natnif-shell .natnif-main {
	width: 100%;
	margin: 0;
	padding: 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100svh;
	box-sizing: border-box;
}

/* Block themes constrain their children to a content width. The media pane
   has to opt out of that or it will never reach the viewport edge. */
.natnif-shell .natnif-main > * {
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* ---------- Sidebar navigation ---------- */

.natnif-nav__title {
	margin: 0 0 1.5rem;
	font-size: 1rem;
	font-weight: 500;
}

.natnif-nav__group + .natnif-nav__group {
	margin-top: 1.5rem;
}

.natnif-nav__client {
	margin: 0 0 0.4rem;
	font-size: 0.8125rem;
	font-weight: 400;
	line-height: 1.4;
	color: var(--natnif-ink-quiet);
}

.natnif-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.natnif-nav__item a {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.75rem;
	padding: 0.2rem 0;
	font-size: 0.9375rem;
	line-height: 1.45;
	color: var(--natnif-ink);
	text-decoration: none;
	opacity: 0.7;
	transition: opacity 120ms ease;
}

.natnif-nav__item a:hover,
.natnif-nav__item a:focus-visible {
	opacity: 1;
}

.natnif-nav__item.is-current a {
	opacity: 1;
	text-decoration: underline;
	text-underline-offset: 0.25em;
	text-decoration-thickness: 1px;
}

.natnif-nav__year {
	flex: none;
	font-size: 0.8125rem;
	color: var(--natnif-ink-quiet);
	font-variant-numeric: tabular-nums;
}

/* ---------- Media pane ---------- */

.natnif-media {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--natnif-backdrop);
	min-height: 0;
	width: 100%;
}

.natnif-media__frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
}

.natnif-media--contain .natnif-media__frame {
	max-height: 100%;
	max-width: 100%;
	margin: auto;
}

.natnif-media__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

/* Cover crops the 16:9 source to fill the pane. Expect to lose the edges. */
.natnif-media--cover {
	overflow: hidden;
}

.natnif-media--cover .natnif-media__frame {
	min-width: 100%;
	min-height: 100%;
	aspect-ratio: 16 / 9;
}

.natnif-media__still img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 100vh;
	max-height: 100svh;
	object-fit: contain;
	margin: 0 auto;
}

/* ---------- Credits ---------- */

.natnif-credits {
	flex: 0 0 auto;
	padding: 1.25rem var(--natnif-gap) 1.75rem;
	border-top: 1px solid var(--natnif-rule);
}

.natnif-credits__title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 500;
	line-height: 1.3;
}

.natnif-credits__attribution {
	margin: 0.25rem 0 0;
	font-size: 0.9375rem;
	color: var(--natnif-ink-quiet);
}

.natnif-credits__attribution a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid var(--natnif-rule);
}

.natnif-credits__attribution a:hover {
	color: var(--natnif-ink);
}

.natnif-credits__list {
	margin: 1rem 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 2rem;
	font-size: 0.875rem;
	line-height: 1.5;
}

.natnif-credits__row {
	display: flex;
	gap: 0.4em;
}

.natnif-credits__row dt {
	color: var(--natnif-ink-quiet);
	font-weight: 400;
}

.natnif-credits__row dd {
	margin: 0;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {

	.natnif-shell.natnif-shell {
		grid-template-columns: minmax(0, 1fr);
		min-height: 0;
	}

	.natnif-shell .natnif-sidebar {
		position: static;
		height: auto;
		overflow: visible;
		border-right: 0;
		border-bottom: 1px solid var(--natnif-rule);
		order: 2;
	}

	.natnif-shell .natnif-main {
		order: 1;
		min-height: 0;
	}

	.natnif-media__frame {
		max-height: none;
	}

	.natnif-credits__list {
		gap: 0.25rem 1.25rem;
	}
}

@media (prefers-reduced-motion: reduce) {

	.natnif-nav__item a {
		transition: none;
	}
}
