/**
 * Global rules that theme.json cannot express: focus ring, sticky header,
 * line heights for type presets, motion. Loaded on the front end and in
 * the editor. Values come from theme.json presets only.
 */

/* Focus: always a 2px ring at 2px offset (design system › States). */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--focus);
	outline-offset: var(--wp--custom--focus--offset);
}

:where(.is-style-deep) :where(a, button, input, select, textarea, summary):focus-visible {
	outline-color: var(--wp--preset--color--brand-sun);
}

body {
	-webkit-font-smoothing: antialiased;
}

/* The italic emphasis in page titles is navy ("Kuljemme rinnallasi."). */
h1 em {
	color: var(--wp--preset--color--brand-navy);
}

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

/* Floating, sticky header (the pill nav). */
header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0);
	z-index: 50;
}

/* Overline: small uppercase kicker (paragraphs and headings). */
.is-style-overline {
	color: var(--wp--preset--color--brand-olive);
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--overline);
	font-weight: 700;
	letter-spacing: 0.14em;
	line-height: var(--wp--custom--line-height--overline);
	text-transform: uppercase;
}

/* brand-olive fails on the deep band; use the muted on-deep ink there. */
.is-style-deep .is-style-overline {
	color: var(--wp--preset--color--ink-on-deep-muted);
}

/* Header: brand lockup; on small screens the booking button sits
   before the menu button. The logo link is a block so it does not sit
   on the text baseline (which pushed the logo above centre), and it
   never shrinks (flex squeezed it to zero width on phones). */
.wisusti-header__brand .wp-block-image a,
.wisusti-header__brand img {
	display: block;
}

.wisusti-header__brand .wp-block-image {
	flex-shrink: 0;
}

.wisusti-header .is-style-wordmark a {
	color: inherit;
	text-decoration: none;
}

@media (max-width: 959px) {

	.wisusti-header__actions .wp-block-navigation {
		order: 2;
	}
}

@media (max-width: 479px) {

	.wisusti-header .is-style-wordmark {
		font-size: 12px;
	}

	/* Phones show the wordmark only; it links to the front page. */
	.wisusti-header__brand .wp-block-image {
		display: none;
	}
}

/* Footer: links without underline until hover, hairline above legal. */
.wisusti-footer :is(.wp-block-navigation .wp-block-navigation-item__content, .wisusti-footer__contact a) {
	color: var(--wp--preset--color--ink-on-deep-muted);
	text-decoration: none;
}

.wisusti-footer :is(.wp-block-navigation .wp-block-navigation-item__content, .wisusti-footer__contact a):hover {
	color: var(--wp--preset--color--ink-on-deep);
	text-decoration: underline;
}

.wisusti-footer__contact {
	display: grid;
	gap: var(--wp--preset--spacing--2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.wisusti-footer .wisusti-footer__legal {
	margin-top: var(--wp--preset--spacing--7);
	padding-top: var(--wp--preset--spacing--5);
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--ink-on-deep) 18%, transparent);
}

/* Sections stack edge to edge: no block gap between full-width bands,
   or between header, main and footer. */
.wp-site-blocks > main,
.wp-site-blocks > footer,
:where(.wp-block-post-content, main) > .alignfull {
	margin-block-start: 0;
}

:where(.wp-block-post-content, main) > .alignfull {
	margin-block-end: 0;
}

/* Line heights that go with each type preset (tokens.json › type). */
.has-display-font-size {
	line-height: var(--wp--custom--line-height--display);
	letter-spacing: -0.01em;
}

.has-title-font-size {
	line-height: var(--wp--custom--line-height--title);
}

.has-heading-font-size {
	line-height: var(--wp--custom--line-height--heading);
}

.has-subheading-font-size {
	line-height: var(--wp--custom--line-height--subheading);
}

.has-card-font-size {
	line-height: var(--wp--custom--line-height--card);
}

.has-quote-font-size {
	line-height: var(--wp--custom--line-height--quote);
}

.has-lead-font-size {
	line-height: var(--wp--custom--line-height--lead);
}

.has-body-sm-font-size {
	line-height: var(--wp--custom--line-height--body-sm);
}

.has-overline-font-size {
	line-height: var(--wp--custom--line-height--overline);
}

.has-numeral-font-size,
.has-numeral-xl-font-size {
	line-height: 1;
}

/* Running text never runs wider than 68 characters. */
:where(.wp-block-post-content, .entry-content) > p {
	max-width: min(68ch, 100%);
}

/* Buttons: tap target and colour transition. */
.wp-element-button,
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--wp--preset--spacing--2);
	min-height: var(--wp--custom--button--min-height);
	box-sizing: border-box;
	transition:
		background-color var(--wp--custom--transition),
		border-color var(--wp--custom--transition),
		color var(--wp--custom--transition);
}

/* Cards that are links or hold one lift slightly on hover. */
.is-style-card {
	transition:
		transform var(--wp--custom--transition),
		box-shadow var(--wp--custom--transition);
}

.is-style-card:has(a:hover) {
	transform: translateY(var(--wp--custom--lift));
	box-shadow: var(--wp--preset--shadow--soft);
}

/* Images in rounded panels clip their corners. */
.wp-block-image.has-custom-border img,
.wp-block-post-featured-image {
	overflow: hidden;
}

/* Sticky column inside a section (Meistä › Meidän polkumme). */
@media (min-width: 782px) {

	.wisusti-sticky {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 120px);
	}
}

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

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	.is-style-card:has(a:hover) {
		transform: none;
	}
}

@media (prefers-reduced-motion: no-preference) {

	html {
		scroll-behavior: smooth;
	}
}

/* Card links sit at the bottom of their card. */
.wisusti-card-link {
	margin-top: auto !important;
	font-weight: 600;
}

.wisusti-card-link a {
	text-underline-offset: 4px;
}

/* Grids of cards stretch every card to the row height. */
.is-layout-grid > .is-style-card {
	height: 100%;
	box-sizing: border-box;
}

/* Pelinestot: card grid lines up with the text column, not the numeral. */
@media (min-width: 782px) {

	.wisusti-method-cards {
		padding-left: calc(120px + var(--wp--preset--spacing--7));
	}
}

/* Article body: slightly larger reading size, airy headings and quotes. */
.wisusti-prose {
	font-size: var(--wp--preset--font-size--lead);
	line-height: 1.68;
}

.wisusti-prose > h2 {
	margin-top: var(--wp--preset--spacing--7);
	font-size: clamp(26px, 1.4rem + 0.8vw, 32px);
}

.wisusti-prose > .wp-block-quote {
	margin-block: var(--wp--preset--spacing--7);
}

/* Header booking button stays on one line on small phones. */
.wisusti-header__actions .wp-block-button__link {
	white-space: nowrap;
}

@media (max-width: 479px) {

	.wisusti-header__actions > .wp-block-buttons .wp-block-button__link {
		min-height: var(--wp--custom--tap-target);
		padding-right: var(--wp--preset--spacing--4);
		padding-left: var(--wp--preset--spacing--4);
	}
}

/* WordPress puts the border radius on the <img>, not the figure, so the
   placeholder background would show past the rounded corners. */
.wp-block-post-featured-image:has(img) {
	background-color: transparent;
}

/* Featured images inherit the rounded corners of their wrapper. */
.wp-block-post-featured-image :where(a, img) {
	border-radius: inherit;
}
