/*
Theme Name: heiko-saxo
Theme URI:
Author: Claus Ernst
Author URI:
Description: Heiko-Saxo-Website
Requires at least: 7.1
Tested up to: 7.1
Requires PHP: 5.7
Version: 0.6.5
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: heiko-saxo
*/

:root {
	--gutter: clamp(1.25rem, 4vw, 7rem);
	--header-height: 5rem;
	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--light-70: color-mix(in srgb, var(--wp--preset--color--light) 70%, transparent);
	--light-55: color-mix(in srgb, var(--wp--preset--color--light) 55%, transparent);
	--hairline: color-mix(in srgb, var(--wp--preset--color--light) 14%, transparent);
}

html {
	background-color: #0a0a0a;
	color-scheme: dark;
	scrollbar-gutter: stable;
}

.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
}

/* Sections run edge to edge, so the block gap between them would expose the
   page background as a stripe. */
.wp-site-blocks > * + *,
.wp-site-blocks > main > * + * {
	margin-block-start: 0;
}

.wp-site-blocks > footer {
	margin-top: auto;
}

:where(a, button, input, textarea, select, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--gold);
	outline-offset: 4px;
}

/* ---------------------------------------------------------------- Header */

.wp-site-blocks > header {
	position: fixed;
	inset-inline: 0;
	top: 0;
	z-index: 100;
	background-color: rgba(10, 10, 10, 0.18);
	backdrop-filter: blur(14px) saturate(140%);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
	border-bottom: 1px solid transparent;
	transition: background-color 0.5s var(--ease), border-color 0.5s var(--ease);
}

.site-header__inner {
	padding-inline: var(--gutter);
	padding-block: clamp(0.85rem, 1.7vw, 1.5rem);
	transition: padding-block 0.5s var(--ease);
}

body.is-scrolled > .wp-site-blocks > header {
	background-color: rgba(10, 10, 10, 0.78);
	border-bottom-color: var(--hairline);
}

body.is-scrolled .site-header__inner {
	padding-block: clamp(0.6rem, 1.1vw, 1rem);
}

.wordmark {
	margin: 0;
	font-size: clamp(1.15rem, 1.25vw, 1.6rem);
	line-height: 0.95;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--wp--preset--color--gold);
	/* Gruppo ships a single weight, so the strokes are thickened with an
	   outline rather than left to the browser's faux bold. */
	-webkit-text-stroke: 0.022em currentColor;
}

.wordmark a {
	display: inline-block;
	color: inherit;
	transition: color 0.4s var(--ease);
}

.wordmark a:hover {
	color: var(--wp--preset--color--light);
}

/* Non-front templates sit below the fixed header. */

body:not(.home) .wp-site-blocks > main {
	padding-top: calc(var(--header-height) + clamp(2rem, 5vw, 5rem));
	padding-inline: var(--gutter);
}

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

.wp-block-cover.hero {
	min-height: 88svh;
	padding: 0;
	padding-block: calc(var(--header-height) + clamp(2rem, 6vw, 6rem)) clamp(3rem, 7vw, 6.5rem);
	padding-inline: var(--gutter);
	align-items: flex-end;
}

/* The hero photograph is already dark (mean luminance ~35/255), so the scrim
   only needs enough weight to carry the text in the lower left corner. */
.wp-block-cover.hero > .wp-block-cover__background.has-background-dim {
	opacity: 1;
	background-color: transparent;
	background-image:
		linear-gradient(180deg, rgba(10, 10, 10, 0.45) 0%, rgba(10, 10, 10, 0) 26%),
		radial-gradient(
			130% 110% at -10% 110%,
			rgba(10, 10, 10, 0.95) 0%,
			rgba(10, 10, 10, 0.85) 30%,
			rgba(10, 10, 10, 0.6) 55%,
			rgba(10, 10, 10, 0.2) 78%,
			rgba(10, 10, 10, 0) 100%
		);
}

/* The inner container is a flex item sized from its content, which inline-size
   containment hides. An explicit basis keeps it full width. */
.hero .wp-block-cover__inner-container {
	/* "Golden Hearts" measures 8.57em in Gruppo, so 11.2cqi keeps the headline
	   on two lines down to the narrowest phones without a breakpoint. */
	--hero-title-size: min(var(--wp--preset--font-size--display), 11.2cqi);
	--hero-gap: max(1.1rem, calc(var(--hero-title-size) * 0.3));
	flex-basis: 100%;
	container-type: inline-size;
}

/* Trimmed leading turns the margin below into the actual optical distance, so
   label, headline, rule and credo sit on four equal gaps. */
.hero .wp-block-cover__inner-container > * {
	text-box: trim-both cap alphabetic;
}

.hero .wp-block-cover__inner-container > * + * {
	margin-block-start: var(--hero-gap);
}

/* Gruppo's capital G sits 0.053em inside its advance width, so the label needs
   the same offset to align with the headline stem below it. */
.hero .hero__label {
	margin-inline-start: calc(var(--hero-title-size) * 0.053);
}

.hero .hero__title {
	font-size: var(--hero-title-size);
	text-transform: uppercase;
	letter-spacing: 0.005em;
	line-height: 0.92;
}

/* Vertical scroll marker, decorative only. */

.hero::before,
.hero::after {
	position: absolute;
	right: calc(var(--gutter) * 0.6);
	z-index: 2;
	pointer-events: none;
}

.hero::after {
	content: "Scroll";
	bottom: clamp(2rem, 6vw, 4.5rem);
	writing-mode: vertical-rl;
	font-size: 0.6875rem;
	font-weight: 500;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	color: var(--light-55);
}

/* The vertical word measures 3.8rem, so the rule clears it with a small gap. */
.hero::before {
	content: "";
	bottom: calc(clamp(2rem, 6vw, 4.5rem) + 4.7rem);
	width: 1px;
	height: clamp(2.5rem, 6vw, 4rem);
	background-color: var(--wp--preset--color--gold);
}

@media (max-width: 46rem) {
	.hero::before,
	.hero::after {
		display: none;
	}
}

/* ------------------------------------------------------- Editorial block */

.editorial {
	padding-inline: var(--gutter);
	padding-block: clamp(4.5rem, 9vw, 11rem);
}

.editorial__grid {
	gap: clamp(2.5rem, 5vw, 7rem);
	align-items: start;
}

/* Both columns start on the same optical line: the leading above the first
   line is trimmed, so the columns align by cap height, not by line box. */
.editorial__aside > :first-child,
.editorial__copy > :first-child {
	text-box: trim-start cap alphabetic;
}

.editorial__aside {
	container-type: inline-size;
}

.editorial__aside > * + * {
	margin-block-start: clamp(1.5rem, 2.5vw, 2.5rem);
}

/* Sized against the column, not the viewport, so long words never break. */
.editorial .statement {
	font-size: clamp(1.75rem, 11.5cqi, 5.5rem);
	text-transform: uppercase;
	line-height: 1.12;
	letter-spacing: 0.01em;
}

.editorial__copy > * + * {
	margin-block-start: clamp(1.1rem, 1.6vw, 1.75rem);
}

.editorial__copy p {
	max-width: 64ch;
}

.editorial__copy > .arrow-link {
	margin-block-start: clamp(2rem, 3.5vw, 3.75rem);
}

/* -------------------------------------------------------- Featured works */

.featured {
	padding-block-start: clamp(4rem, 8vw, 9rem);
}

.featured__intro {
	padding-inline: var(--gutter);
	padding-block-end: clamp(2.5rem, 5vw, 4.5rem);
	container-type: inline-size;
}

.featured__intro > * + * {
	margin-block-start: clamp(1.25rem, 2.2vw, 2.25rem);
}

.featured__eyebrow {
	display: flex;
	align-items: center;
	gap: clamp(1rem, 2vw, 1.75rem);
}

.featured__eyebrow::after {
	content: "";
	width: clamp(2.5rem, 5vw, 4.5rem);
	height: 1px;
	background-color: var(--wp--preset--color--gold);
}

/* "Created to Inspire." measures 12.5em in Gruppo, so 8cqi holds the statement
   to two lines from the narrowest phone up to ultra-wide screens. */
.featured__title {
	font-size: min(var(--wp--preset--font-size--x-large), 8cqi);
	text-transform: uppercase;
	line-height: 1.1;
	letter-spacing: 0.01em;
}

/* The row runs edge to edge; the single pixel gap lets the section background
   through as a hairline seam between the frames. */
.featured__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1px;
}

/* Only divisors of four keep the band even, so the column count steps from one
   to two to the full row and never leaves a single work stranded. */
@media (min-width: 40rem) {
	.featured__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 64rem) {
	.featured__grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.featured__grid > * {
	margin-block-start: 0;
}

.work-card__media {
	margin: 0;
	overflow: clip;
}

.work-card__media img {
	display: block;
	width: 100%;
	aspect-ratio: 1.1;
	object-fit: cover;
	transition: transform 0.9s var(--ease);
}

.work-card:hover .work-card__media img {
	transform: scale(1.04);
}

.work-card__label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-block-start: 0;
	padding-block: clamp(1rem, 1.8vw, 1.5rem);
	padding-inline: clamp(1rem, 1.6vw, 1.75rem);
	border-block-end: 1px solid var(--hairline);
	font-weight: 500;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

.work-card__label::after {
	content: "";
	flex: none;
	width: clamp(1.75rem, 3vw, 3rem);
	height: 1px;
	background-color: var(--wp--preset--color--gold);
	transition: width 0.5s var(--ease);
}

.work-card:hover .work-card__label::after {
	width: clamp(2.5rem, 4.5vw, 4.5rem);
}

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

.site-footer {
	padding-inline: var(--gutter);
	padding-block: clamp(4.5rem, 8vw, 10rem) clamp(2rem, 3vw, 3.5rem);
	container-type: inline-size;
}

.site-footer > * + * {
	margin-block-start: clamp(1.5rem, 3vw, 3rem);
}

.footer__title {
	margin: 0;
	font-size: min(var(--wp--preset--font-size--x-large), 11.2cqi);
	line-height: 1.05;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.footer__heart {
	margin-block-start: clamp(0.6rem, 1.2vw, 1.1rem);
}

/* Large enough for the HSW monogram inside the crest to stay legible. */
.footer__heart img {
	display: block;
	width: calc(var(--wp--preset--font-size--small) * 10.6);
	height: auto;
}

.footer__meta {
	margin-block-start: clamp(4.5rem, 8vw, 7.5rem);
	gap: clamp(2rem, 4vw, 6rem);
}

/* The three blocks need 546px side by side. Below that the flex wrap would
   strand the contact block on its own line, so they stack as a set. */
@media (max-width: 40rem) {
	.footer__meta {
		flex-direction: column;
	}
}

.footer__block > * + * {
	margin-block-start: 0.7rem;
}

.footer__block p:not(.eyebrow) {
	color: var(--light-70);
}

.footer__legal {
	margin-block-start: clamp(2.5rem, 5vw, 5rem);
	color: var(--light-55);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* ------------------------------------------------------ Shared utilities */

.eyebrow {
	margin: 0;
	font-weight: 500;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--light-70);
}

.eyebrow.has-gold-color {
	color: var(--wp--preset--color--gold);
	letter-spacing: 0.24em;
}

.editorial .eyebrow {
	color: var(--wp--preset--color--muted);
}

.wp-block-separator.rule-gold {
	border: 0;
	border-top: 1px solid var(--wp--preset--color--gold);
	opacity: 0.55;
}

.wp-block-separator.rule-gold:not(.is-style-wide):not(.is-style-dots) {
	width: clamp(3rem, 6vw, 6rem);
	max-width: none;
	margin-inline: 0;
}

.arrow-link {
	font-weight: 500;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

.arrow-link a {
	display: inline-flex;
	align-items: center;
	gap: clamp(1rem, 2vw, 1.75rem);
}

.arrow-link a::after {
	content: "";
	width: clamp(2.5rem, 5vw, 4.5rem);
	height: 1px;
	background-color: var(--wp--preset--color--gold);
	transition: width 0.5s var(--ease);
}

.arrow-link a:hover::after {
	width: clamp(3.5rem, 7vw, 6.5rem);
}

/* ---------------------------------------------------------------- Motion */

.hero .wp-block-cover__inner-container > * {
	animation: rise 1.1s var(--ease) both;
}

.hero .wp-block-cover__inner-container > *:nth-child(1) {
	animation-delay: 0.15s;
}

.hero .wp-block-cover__inner-container > *:nth-child(2) {
	animation-delay: 0.28s;
}

.hero .wp-block-cover__inner-container > *:nth-child(3) {
	animation-delay: 0.44s;
}

.hero .wp-block-cover__inner-container > *:nth-child(4) {
	animation-delay: 0.54s;
}

.wp-block-cover.hero img.wp-block-cover__image-background {
	animation: settle 2.6s var(--ease) both;
}

@keyframes rise {
	from {
		opacity: 0;
		transform: translateY(1.75rem);
	}
}

@keyframes settle {
	from {
		transform: scale(1.07);
	}
}

.has-js .reveal {
	opacity: 0;
	transform: translateY(1.75rem);
	transition:
		opacity 0.9s var(--ease),
		transform 0.9s var(--ease);
}

.has-js .reveal.is-revealed {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}

	.has-js .reveal {
		opacity: 1;
		transform: none;
	}
}
