/**
 * Atelier Canvas front-end styles.
 *
 * Canvas geometry is expressed in canvas units: 1 unit = 1cqw, one percent
 * of the canvas width. Each element receives its values as custom
 * properties from the generated layout stylesheet.
 */

/* Fonts (self-hosted, SIL Open Font License) ------------------------------ */

@font-face {
	font-family: "Bodoni Moda Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 400 900;
	src: url("../fonts/bodoni-moda-latin-standard-normal.woff2") format("woff2-variations");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Bodoni Moda Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 400 900;
	src: url("../fonts/bodoni-moda-latin-ext-standard-normal.woff2") format("woff2-variations");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "Instrument Sans Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 400 700;
	font-stretch: 75% 100%;
	src: url("../fonts/instrument-sans-latin-standard-normal.woff2") format("woff2-variations");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Instrument Sans Variable";
	font-style: normal;
	font-display: swap;
	font-weight: 400 700;
	font-stretch: 75% 100%;
	src: url("../fonts/instrument-sans-latin-ext-standard-normal.woff2") format("woff2-variations");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Tokens ------------------------------------------------------------------ */

:root {
	--at-paper: #fff;
	--at-ink: #000;
	--at-graphite: #5a5d60;
	--at-fixer: #d5d7d9;
	--at-font-display: "Bodoni Moda Variable", "Bodoni 72", didot, "Times New Roman", serif;
	--at-font-text: "Instrument Sans Variable", "Helvetica Neue", arial, sans-serif;
	--at-gutter: clamp(1rem, 3vw, 3rem);
	--at-stage-max: 100rem;
}

/* Base -------------------------------------------------------------------- */

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

html {
	-webkit-text-size-adjust: 100%; /* stylelint-disable-line property-no-vendor-prefix -- Still required by iOS Safari. */
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--at-paper);
	color: var(--at-ink);
	font-family: var(--at-font-text);
	font-size: 1rem;
	line-height: 1.6;
}

img {
	max-width: 100%;
	height: auto;
}

a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

a:hover {
	text-decoration-thickness: 2px;
}

:focus-visible {
	outline: 2px solid var(--at-ink);
	outline-offset: 3px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
	word-wrap: normal !important;
}

.skip-link:focus {
	z-index: 100000;
	top: 0.5rem;
	left: 0.5rem;
	width: auto;
	height: auto;
	padding: 0.75rem 1rem;
	margin: 0;
	clip: auto;
	background: var(--at-ink);
	color: var(--at-paper);
	white-space: normal;
}

/* Site header and footer -------------------------------------------------- */

.site-header {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 2rem;
	align-items: baseline;
	justify-content: space-between;
	max-width: var(--at-stage-max);
	margin: 0 auto;
	padding: 1.75rem var(--at-gutter) 1.5rem;
}

.site-branding {
	display: flex;
	flex-wrap: wrap;
	gap: 0 1rem;
	align-items: baseline;
}

.site-title {
	margin: 0;
	font-family: var(--at-font-display);
	font-size: 1.5rem;
	font-style: normal;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.site-title a {
	text-decoration: none;
}

.site-tagline {
	margin: 0;
	color: var(--at-graphite);
	font-size: 0.875rem;
}

.site-nav__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9375rem;
}

.site-nav__list a {
	text-decoration: none;
}

.site-nav__list a:hover,
.site-nav__list .current-menu-item > a {
	text-decoration: underline;
}

.site-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 2rem;
	justify-content: space-between;
	max-width: var(--at-stage-max);
	margin: 0 auto;
	padding: 2rem var(--at-gutter) 2.5rem;
	color: var(--at-graphite);
	font-size: 0.875rem;
}

.site-footer p {
	margin: 0;
}

/* Canvas ------------------------------------------------------------------ */

.site-main--canvas {
	padding-bottom: 3rem;
}

.at-stage {
	container-type: inline-size;
	max-width: var(--at-stage-max);
	margin: 0 auto;
	padding-inline: var(--at-gutter);
}

.at-canvas {
	--at-canvas-h: 60;

	position: relative;
	height: calc(var(--at-canvas-h) * 1cqw);
}

.at-item {
	--at-x: 0;
	--at-y: 0;
	--at-w: 20;
	--at-h: 20;
	--at-z: 1;
	--at-border-width: 0;
	--at-border-style: solid;
	--at-border-color: #000;
	--at-padding: 0;
	--at-mat-color: #fff;
	--at-radius: 0;
	--at-fit: cover;
	--at-focus: center;
	--at-opacity: 100;
	--at-rotate: 0;
	--at-font-size: 20;
	--at-text-align: left;
	--at-color: #000;
	--at-line-weight: 1;
	--at-line-style: solid;

	position: absolute;
	top: calc(var(--at-y) * 1cqw);
	left: calc(var(--at-x) * 1cqw);
	z-index: var(--at-z);
	width: calc(var(--at-w) * 1cqw);
	height: calc(var(--at-h) * 1cqw);
	margin: 0;
	padding: calc(var(--at-padding) * 1px);
	overflow: hidden;
	border: calc(var(--at-border-width) * 1px) var(--at-border-style) var(--at-border-color);
	border-radius: calc(var(--at-radius) * 1%);
	background: var(--at-mat-color);
	opacity: calc(var(--at-opacity) / 100);
	transform: rotate(calc(var(--at-rotate) * 1deg));
}

/* Letter boxes and dividers size their contents from their own box. */
.at-item--placeholder,
.at-item--divider {
	container-type: size;
}

.at-item__link,
.at-item__media,
.at-item__letter {
	display: block;
	width: 100%;
	height: 100%;
}

.at-item__media {
	max-width: none;
	object-fit: var(--at-fit);
	object-position: var(--at-focus);
}

.at-item__link:focus-visible {
	outline-offset: -4px;
}

/* Letter boxes: the placeholders for photos still to come. */
.at-item__letter {
	display: grid;
	place-items: center;
	overflow: hidden;
	font-family: var(--at-font-display);
	font-size: min(72cqh, 80cqw);
	font-weight: 400;
	line-height: 1;
	text-align: center;
	user-select: none;
}

.at-item__letter--pair {
	font-size: min(60cqh, 44cqw);
	letter-spacing: -0.03em;
}

.at-tone-dark .at-item__letter {
	background: var(--at-ink);
	color: var(--at-paper);
}

.at-tone-light .at-item__letter {
	background: var(--at-paper);
	color: var(--at-ink);
	box-shadow: inset 0 0 0 1px var(--at-ink);
}

.at-item__caption {
	position: absolute;
	inset: auto calc(var(--at-padding) * 1px) calc(var(--at-padding) * 1px);
	padding: 1.5rem 0.75rem 0.5rem;
	background: linear-gradient(to bottom, rgb(0 0 0 / 0%), rgb(0 0 0 / 60%));
	color: var(--at-paper);
	font-size: 0.8125rem;
	line-height: 1.4;
	pointer-events: none;
}

/* Text, dividers and buttons ------------------------------------------- */

.at-item--text,
.at-item--button {
	/* Sizes are given in px at the full 1600px canvas and scale with it. */
	--at-text-min: 1rem;

	overflow: visible;
	color: var(--at-color);
	font-size: max(var(--at-text-min), calc(var(--at-font-size) * 0.0625cqw));
}

.at-item--text,
.at-item--divider,
.at-item--button {
	background: transparent;
}

.at-item--text.at-background-mat {
	background: var(--at-mat-color);
}

.at-item__text {
	margin: 0;
	font-size: inherit;
	line-height: 1.55;
	text-align: var(--at-text-align);
	overflow-wrap: break-word;
}

.at-text-role-heading {
	--at-text-min: 1.75rem;
}

.at-text-role-heading .at-item__text {
	line-height: 1.1;
	letter-spacing: -0.01em;
}

.at-text-role-small {
	--at-text-min: 0.8125rem;
}

.at-text-role-small .at-item__text {
	line-height: 1.45;
}

.at-font-display {
	font-family: var(--at-font-display);
}

.at-font-text {
	font-family: var(--at-font-text);
}

.at-font-weight-regular {
	font-weight: 400;
}

.at-font-weight-medium {
	font-weight: 500;
}

.at-font-weight-bold {
	font-weight: 700;
}

.at-item__text-link {
	color: inherit;
}

.at-item__line {
	position: absolute;
	top: 50%;
	left: 0;
	width: 100%;
	height: 0;
	margin: 0;
	border: 0;
	border-top: calc(var(--at-line-weight) * 1px) var(--at-line-style) var(--at-color);
	transform: translateY(-50%);
}

/* A box taller than it is wide holds a vertical line. */
@container (orientation: portrait) {

	.at-item__line {
		top: 0;
		left: 50%;
		width: 0;
		height: 100%;
		border-top: 0;
		border-left: calc(var(--at-line-weight) * 1px) var(--at-line-style) var(--at-color);
		transform: translateX(-50%);
	}
}

.at-item__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 0.5em 1.25em;
	border: 1px solid var(--at-color);
	border-radius: calc(var(--at-radius) * 1%);
	font-size: inherit;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
}

.at-button-style-filled .at-item__button {
	background: var(--at-color);
	color: var(--at-paper);
}

.at-button-style-outline .at-item__button {
	background: transparent;
	color: var(--at-color);
}

.at-button-style-underline .at-item__button {
	border-color: transparent;
	background: transparent;
	color: var(--at-color);
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

a.at-item__button:hover {
	opacity: 0.85;
}

/* Shadows */
.at-shadow-soft {
	box-shadow: 0 0.375rem 1.25rem rgb(0 0 0 / 18%);
}

.at-shadow-deep {
	box-shadow: 0 1.5rem 3rem -0.5rem rgb(0 0 0 / 38%);
}

.at-shadow-offset {
	box-shadow: 0.625rem 0.625rem 0 var(--at-ink);
}

/* Photo tones */
.at-filter-grayscale .at-item__media {
	filter: grayscale(1);
}

.at-filter-contrast .at-item__media {
	filter: grayscale(1) contrast(1.45);
}

.at-filter-sepia .at-item__media {
	filter: sepia(0.8);
}

.at-filter-fade .at-item__media {
	filter: contrast(0.85) brightness(1.08) saturate(0.7);
}

/* Small screens: stack elements in reading order at full width. */
@media (max-width: 40em) {

	body:not(.at-editing) .at-canvas {
		display: flex;
		flex-direction: column;
		gap: 1rem;
		height: auto;
	}

	body:not(.at-editing) .at-item {
		position: relative;
		top: auto;
		left: auto;
		z-index: auto;
		width: 100%;
		height: auto;
		aspect-ratio: var(--at-w) / var(--at-h);
		transform: none;
	}

	body:not(.at-editing) .at-item--text {
		aspect-ratio: auto;
	}

	body:not(.at-editing) .at-item--divider {
		height: 1.5rem;
		aspect-ratio: auto;
	}

	body:not(.at-editing) .at-item--button {
		align-self: flex-start;
		width: auto;
		aspect-ratio: auto;
	}

	body:not(.at-editing) .at-item--button .at-item__button {
		padding: 0.75em 1.5em;
	}
}

/* Lightbox (CSS only, opened with :target) -------------------------------- */

.at-lightbox {
	display: none;
}

.at-lightbox:target {
	position: fixed;
	z-index: 100000;
	inset: 0;
	display: grid;
	grid-template-rows: 1fr auto;
	place-items: center;
	gap: 0.75rem;
	padding: 3.5rem var(--at-gutter) 1.5rem;
	background: rgb(0 0 0 / 94%);
	color: var(--at-paper);
	animation: at-lightbox-in 180ms ease-out;
}

.at-lightbox__backdrop {
	position: absolute;
	inset: 0;
}

.at-lightbox__media {
	position: relative;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: calc(100vh - 7rem);
	object-fit: contain;
}

.at-lightbox__caption {
	position: relative;
	margin: 0;
	font-size: 0.875rem;
}

.at-lightbox__close {
	position: absolute;
	top: 1rem;
	right: var(--at-gutter);
	color: var(--at-paper);
	font-size: 0.9375rem;
}

.at-lightbox :focus-visible {
	outline-color: var(--at-paper);
}

@keyframes at-lightbox-in {

	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

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

	.at-lightbox:target {
		animation: none;
	}
}

/* Regular content (posts, pages, archives) -------------------------------- */

.site-main--content {
	max-width: 42rem;
	margin: 0 auto;
	padding: 2rem var(--at-gutter) 5rem;
}

.page-title,
.entry-title {
	margin: 0 0 1.5rem;
	font-family: var(--at-font-display);
	font-size: clamp(1.75rem, 4vw, 2.25rem);
	font-weight: 500;
	line-height: 1.15;
}

.entry + .entry {
	margin-top: 4rem;
}

.entry-title a {
	text-decoration: none;
}

.entry-media {
	margin: 0 0 1.5rem;
}

.entry-content {
	font-size: 1.0625rem;
	line-height: 1.65;
}

.entry-content h2,
.entry-content h3 {
	margin: 2.5rem 0 1rem;
	font-family: var(--at-font-display);
	font-weight: 500;
	line-height: 1.2;
}

.entry-content h2 {
	font-size: 1.5rem;
}

.entry-content h3 {
	font-size: 1.3125rem;
}

.entry-content figure {
	margin: 2rem 0;
}

.entry-content figcaption,
.wp-caption-text {
	color: var(--at-graphite);
	font-size: 0.875rem;
}

.alignwide,
.alignfull {
	max-width: none;
}

.search-form {
	display: flex;
	gap: 0.5rem;
}

.search-form input[type="search"],
.post-password-form input[type="password"] {
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--at-ink);
	font: inherit;
}

.search-form button,
.search-form input[type="submit"],
.post-password-form input[type="submit"] {
	padding: 0.5rem 1rem;
	border: 1px solid var(--at-ink);
	background: var(--at-ink);
	color: var(--at-paper);
	font: inherit;
	cursor: pointer;
}

.post-password-form {
	max-width: 32rem;
	margin: 3rem auto;
	padding-inline: var(--at-gutter);
}

.pagination .nav-links {
	display: flex;
	gap: 1rem;
	margin-top: 3rem;
}
