/* nibraun.de: own styles on top of Fuge. Rules: fuge/DESIGN.md.
   Colors and sizes come from css/fuge/tokens.css, building blocks from base.css and app.css. */

/* ==================== Base ==================== */
html {
	-webkit-text-size-adjust: 100%;
	scrollbar-gutter: stable;
	scroll-padding-top: 64px;
}
body {
	display: flex;
	flex-direction: column;
	min-height: 100svh;
}
/* Building blocks set their own display, which would otherwise win over the hidden attribute. */
[hidden] {
	display: none !important;
}
img {
	display: block;
	max-width: 100%;
	height: auto;
}
address {
	font-style: normal;
}
a,
button {
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}
.skip-link {
	position: fixed;
	top: 12px;
	left: 12px;
	z-index: 10;
	padding: 8px 14px;
	border-radius: var(--r-full);
	background: var(--text);
	color: var(--bg);
	font-size: var(--fs-sm);
	font-weight: 500;
	transform: translateY(-200%);
}
.skip-link:focus {
	transform: none;
}
.segments svg {
	width: 14px;
	height: 14px;
}
.icon-btn:disabled {
	opacity: 0.55;
	pointer-events: none;
}
.list-row svg {
	width: 16px;
	height: 16px;
	color: var(--muted);
}
/* Cards that are links as a whole react like the other controls. */
a.card {
	color: var(--text);
	transition: box-shadow var(--fast);
}
a.card:active {
	box-shadow: inset 0 0 0 999px var(--press);
	transition-duration: 0s;
}
@media (hover: hover) {
	a.card:hover {
		box-shadow: inset 0 0 0 999px var(--press);
		text-decoration: none;
		transition-duration: 0s;
	}
}

/* ==================== Frame ==================== */
.page {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 24px;
	width: 100%;
}
.site-header {
	position: sticky;
	top: 0;
	z-index: 5;
	border-bottom: 1px solid var(--line);
	background: var(--bg);
}
.site-header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 8px 24px;
}
.header-controls {
	display: flex;
	align-items: center;
	gap: 8px;
}
.segments.language-switch > * {
	padding: 0 9px;
}
/* The toggle shows the current scheme: sun in light, moon in dark. */
.theme-toggle svg + svg {
	display: none;
}
[data-theme='dark'] .theme-toggle svg {
	display: none;
}
[data-theme='dark'] .theme-toggle svg + svg {
	display: block;
}
.site-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 24px;
	color: var(--muted);
	font-size: var(--fs-sm);
}
.footer-legal {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
}
.footer-legal a {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
}
.footer-legal [aria-current='page'] {
	color: var(--text);
}
@media (max-width: 720px) {
	.site-header-inner {
		padding: 8px 16px;
	}
	.site-nav {
		flex: 1;
		min-width: 0;
	}
}
/* Three labels with icons no longer fit next to the controls. */
@media (max-width: 419px) {
	.site-nav svg {
		display: none;
	}
}
/* Fingers get a larger target than the 26 px and 32 px controls show. */
@media (pointer: coarse) {
	.site-header .segments > *,
	.icon-btn {
		position: relative;
	}
	.site-header .segments > *::after {
		content: '';
		position: absolute;
		inset: -9px 0;
	}
	.icon-btn::after {
		content: '';
		position: absolute;
		inset: -6px;
	}
}

/* ==================== Home ==================== */
.home-main {
	flex: 1;
}
.home-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.home-card-image {
	display: block;
	aspect-ratio: 3 / 2;
	margin-bottom: 6px;
	overflow: hidden;
	border-radius: var(--r-sm);
	background: var(--raised);
}
.home-card-image .cover,
.home-card-image picture,
.home-card-placeholder {
	display: block;
	width: 100%;
	height: 100%;
}
.home-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
/* A screenshot shows whole; a photo may fill the frame. */
.home-card-image .cover-screenshot img {
	object-fit: contain;
}
.home-card-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-size: var(--fs-xl);
	font-weight: 500;
	letter-spacing: -0.01em;
}
.home-card-heading svg {
	width: 20px;
	height: 20px;
	color: var(--muted);
}

/* ==================== Work ==================== */
.index {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 24px;
}
.lead {
	max-width: 70ch;
	margin: 16px 0 8px;
	font-size: var(--fs-xl);
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: -0.01em;
	text-wrap: pretty;
}
.section-title {
	margin-bottom: 12px;
	font-size: var(--fs-lg);
}
.project-list {
	padding: 0;
	list-style: none;
}
.project-card {
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.project-shot {
	display: block;
	cursor: zoom-in;
}
.cover {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 3 / 2;
	border-radius: var(--r-sm);
	background: var(--raised);
	color: var(--muted);
	font-size: var(--fs-xl);
	font-weight: 500;
}
.cover.cover-screenshot {
	display: block;
	aspect-ratio: auto;
	background: none;
}
.cover-screenshot img {
	width: 100%;
}
.project-title {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}
.project-title a {
	color: inherit;
}
@media (min-width: 721px) {
	.project-card.wide {
		display: grid;
		grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
		gap: 24px;
		align-items: start;
	}
}
.timeline > div {
	display: flex;
	flex-direction: row-reverse;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}
.timeline dt {
	white-space: nowrap;
}
.timeline dd .sub {
	display: block;
}
/* Rows carry their own 12 px inset; the list moves out so their text lines up with the card title. */
.contact-links {
	margin: 0 -12px -8px;
	padding: 0;
	list-style: none;
}

/* ==================== Project details ==================== */
html.project-dialog-open,
.project-dialog-open body {
	overflow: hidden;
}
/* The padding sits on the shell: a click on the dialog element itself then always means the backdrop. */
dialog.modal.project-dialog {
	width: min(1120px, calc(100vw - 32px));
	padding: 0;
	overscroll-behavior: contain;
}
.project-dialog-shell {
	padding: 18px 22px;
}
.project-screens {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
/* The height cap keeps caption and links on screen without scrolling the dialog. */
.project-screens-stage {
	display: grid;
	aspect-ratio: 12 / 7;
	max-height: max(200px, calc(100dvh - 300px));
	border-radius: var(--r-sm);
	background: var(--raised);
}
.project-slide {
	display: flex;
	grid-area: 1 / 1;
	min-width: 0;
	min-height: 0;
}
.project-slide .cover {
	width: 100%;
	height: 100%;
}
.project-slide img {
	height: 100%;
	object-fit: contain;
}
.project-screens-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
}
.project-screens-status {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px 12px;
	font-size: var(--fs-sm);
}

/* ==================== Legal ==================== */
.legal-main,
.not-found-main {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
	width: 100%;
	max-width: 76ch;
	overflow-wrap: anywhere;
}
.not-found-main {
	justify-content: center;
}
.legal-main h1 {
	hyphens: auto;
}
.legal-text {
	align-self: stretch;
}
.legal-section h2 {
	margin-bottom: 8px;
	font-size: var(--fs-lg);
}
.legal-section p + p,
.legal-section address + p {
	margin-top: 12px;
}

/* ==================== Photography ==================== */
.photos-main {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.gallery-back {
	align-self: flex-start;
}
.photos-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.photos-description {
	min-width: 0;
	max-width: 60ch;
	color: var(--muted);
}
.photo-projects {
	padding: 0;
	list-style: none;
}
/* The link fills its grid cell, so the cards of a row are equally high. */
.photo-projects > li {
	display: grid;
}
.photo-project {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.photo-project img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: var(--r-sm);
}
.photo-project-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.photo-project-head h2 {
	font-size: var(--fs-lg);
}
.photo-project-head svg {
	width: 16px;
	height: 16px;
	color: var(--muted);
}
.photo-sequence {
	display: flex;
	flex-direction: column;
	gap: 24px;
	margin-block: 12px;
}
.photo-sequence img {
	width: 100%;
}
.photo-sequence figcaption {
	margin-top: 8px;
	color: var(--muted);
	font-size: var(--fs-sm);
}
.photo-open {
	display: block;
}
.photo-open:focus-visible {
	outline-offset: -3px;
}
.photo-open[aria-haspopup='dialog'] {
	cursor: zoom-in;
}
/* Phones only get the sequence view. */
.segments.view-switch {
	display: none;
}
.segments.view-switch > * {
	padding: 0 9px;
}
.segments.view-switch svg {
	width: 16px;
	height: 16px;
}
@media (max-width: 720px) {
	/* On phones photos bleed to the viewport edges while text keeps the column. */
	.photo-open {
		width: calc(100% + 32px);
		margin-inline: -16px;
	}
}
/*
 * Justified grid: each figure grows in proportion to its aspect ratio (--ratio,
 * set by the gallery script), so rows fill the width without cropping.
 * The width-based row cap keeps several photos together even on tall tablets.
 * The ::after spacer keeps the last row from stretching.
 * The grid bleeds to the body edges; cqw excludes the scrollbar gutter, unlike vw.
 */
@media (min-width: 721px) {
	/* Portrait shots would outgrow the screen; contain keeps the box width, so nothing shifts on load. */
	.photo-sequence img {
		max-height: calc(100svh - 80px);
		object-fit: contain;
	}
	.segments.view-switch {
		display: inline-flex;
		flex: none;
		margin-left: auto;
	}
	[data-gallery-view='grid'] body {
		container-type: inline-size;
	}
	[data-gallery-view='grid'] .photo-sequence {
		--row: 40vh;
		flex-direction: row;
		flex-wrap: wrap;
		gap: 4px;
		width: calc(100cqw - 8px);
		margin-inline: calc(50% - 50cqw + 4px);
	}
	[data-gallery-view='grid'] .photo-sequence::after {
		content: '';
		flex-grow: 10;
	}
	[data-gallery-view='grid'] .photo-sequence figure {
		flex: var(--ratio, 1.5) 1 calc(var(--ratio, 1.5) * min(var(--row), 24cqw));
		min-width: 0;
	}
	[data-gallery-view='grid'] .photo-sequence img {
		max-height: none;
	}
	[data-gallery-view='grid'] .photo-sequence figcaption {
		display: none;
	}
}
@media (min-width: 721px) and (max-aspect-ratio: 1/1) {
	[data-gallery-view='grid'] .photo-sequence {
		--row: 30vh;
	}
}
@media (min-width: 721px) and (max-height: 480px) {
	[data-gallery-view='grid'] .photo-sequence {
		--row: 80vh;
	}
}

/* ==================== Lightbox ==================== */
html.lightbox-open,
.lightbox-open body {
	overflow: hidden;
}
.lightbox {
	display: none;
	position: fixed;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 12px;
	padding-top: max(12px, env(safe-area-inset-top));
	padding-bottom: max(12px, env(safe-area-inset-bottom));
	border: 0;
	background: var(--bg);
	color: var(--text);
	overflow: hidden;
	cursor: zoom-out;
}
.lightbox[open] {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	gap: 8px;
}
.lightbox::backdrop {
	background: var(--bg);
}
.lightbox-header,
.lightbox-footer,
.lightbox-error {
	cursor: default;
}
.lightbox-header {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
}
.lightbox-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	min-height: 0;
}
.lightbox-stage picture:not([hidden]) {
	display: contents;
}
.lightbox-stage img {
	width: auto;
	max-height: 100%;
	object-fit: contain;
	cursor: pointer;
}
.lightbox-error {
	max-width: 40ch;
	text-align: center;
}
.lightbox-footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}
.lightbox-navigation {
	display: flex;
	align-items: center;
	gap: 16px;
}
.lightbox-counter {
	min-width: 7ch;
	text-align: center;
}
.lightbox-caption,
.lightbox-hint {
	max-width: 70ch;
	color: var(--muted);
	font-size: var(--fs-sm);
	text-align: center;
}
.lightbox-caption {
	max-height: 4.5em;
	overflow: auto;
}
@media (min-width: 721px) {
	.lightbox {
		padding: 24px;
	}
	.lightbox[open] {
		gap: 12px;
	}
}
