/* ==========================================================================
   TARVA base: tokens, resets and global behaviour.
   Colours, type and spacing live in theme.json; this file only adds the
   behaviour theme.json cannot express.
   ========================================================================== */

:root {
	--tarva-gutter: var(--wp--custom--tarva--gutter);
	--tarva-ease: var(--wp--custom--tarva--easing);
	--tarva-dur-fast: var(--wp--custom--tarva--duration-fast);
	--tarva-dur: var(--wp--custom--tarva--duration);
	--tarva-dur-slow: var(--wp--custom--tarva--duration-slow);
	--tarva-line: var(--wp--custom--tarva--line);
	--tarva-line-strong: var(--wp--custom--tarva--line-strong);
	--tarva-obsidian: var(--wp--preset--color--obsidian);
	--tarva-ivory: var(--wp--preset--color--ivory);
	--tarva-champagne: var(--wp--preset--color--champagne);
	--tarva-stone: var(--wp--preset--color--stone);
	--tarva-serif: var(--wp--preset--font-family--cormorant);
	--tarva-sans: var(--wp--preset--font-family--manrope);
	--tarva-hh: var(--wp--custom--tarva--header-height-mobile);
}

@media (min-width: 1100px) {
	:root {
		--tarva-hh: var(--wp--custom--tarva--header-height);
	}
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--tarva-hh) + 1rem);
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-x: clip;
}

/* Block gap between the header / main / footer wrappers is not wanted. */
.wp-site-blocks > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

::selection {
	background: var(--tarva-champagne);
	color: var(--tarva-obsidian);
}

/* One focus language: a 2px ring in the current text colour. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
	border-radius: 2px;
}

h1, h2, h3, h4 {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

.tarva-meta {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	margin: 0;
}

/* Inner pages: reserve space for the fixed header. */
body:not(.tarva-header-overlay) .wp-site-blocks {
	padding-top: var(--tarva-hh);
}

/* Post lists (index / archive). */
.tarva-post-list {
	display: grid;
	gap: var(--wp--preset--spacing--50);
	padding: 0;
	margin-block-start: var(--wp--preset--spacing--50);
}

.tarva-post-list__item {
	border-top: 1px solid var(--tarva-line-strong);
	padding-top: var(--wp--preset--spacing--30);
}

.tarva-post-list__item .wp-block-post-title {
	margin: 0.5rem 0 0.75rem;
}

.tarva-post-list__item .wp-block-post-title a {
	text-decoration: none;
}

/* Dark surfaces: Obsidian groups and anything flagged by the theme. */
.tarva-surface-dark,
.is-style-obsidian,
.has-obsidian-background-color {
	--tarva-fg: var(--tarva-ivory);
}

/* Reduced motion: remove smooth scrolling, keep every state reachable. */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		animation-delay: 0ms !important;
		transition-duration: 0.001ms !important;
		transition-delay: 0ms !important;
		scroll-behavior: auto !important;
	}
}
