/**
 * RJER Creative — supplemental styles.
 *
 * theme.json owns the tokens (colour, type, spacing). This file covers what
 * theme.json can't: block style variations, pattern layouts, motion, texture,
 * and the hand-drawn marks (assets/img) used as CSS masks.
 */

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

:root {
	--rjer-ease: var(--wp--custom--transition, 220ms cubic-bezier(0.2, 0.7, 0.2, 1));
	--rjer-radius-sm: var(--wp--custom--radius--small, 6px);
	--rjer-radius-md: var(--wp--custom--radius--medium, 14px);
	--rjer-radius-lg: var(--wp--custom--radius--large, 28px);
	--rjer-radius-wobble: var(--wp--custom--radius--wobble, 255px 18px 225px 18px / 18px 225px 18px 255px);
	--rjer-header-h: 4.5rem;
	--rjer-rule: rgba(46, 42, 40, 0.5);
	--rjer-rule-on-dark: rgba(247, 243, 232, 0.4);

	/* Hand-drawn marks from assets/img, used as masks so they take any colour. */
	/* line1 with preserveAspectRatio="none", so it stretches to any width. */
	--rjer-mark-line: url("../img/line1-stretch.svg");
	--rjer-mark-squiggle: url("../img/www-black.svg");
	--rjer-mark-star: url("../img/star-black.svg");
	--rjer-mark-arrow: url("../img/curly-arrow-up-right-black.svg");
	--rjer-mark-question: url("../img/question-mark-black.svg");

	/* Halftone dots, echoing the shading in the illustrations. */
	--rjer-halftone: radial-gradient(circle, rgba(46, 42, 40, 0.2) 1px, transparent 1.5px) 0 0 / 7px 7px;
}

html {
	scroll-padding-top: calc(var(--rjer-header-h) + 1rem);
}

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

/*
 * Paper grain: a fixed layer of fine ink speckle over everything, so flat
 * colour reads as printed paper. Purely decorative and never clickable.
 */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 9999;
	pointer-events: none;
	opacity: 0.7;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.16 0 0 0 0 0.15 0 0 0 1.6 -0.86'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	background-size: 240px 240px;
}

/* Tilted bands and doodles may poke past the edges; clip without making a scroll container. */
.wp-site-blocks {
	overflow-x: clip;
}

/* Sections sit flush: header, main and footer manage their own padding. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

::selection {
	background: var(--wp--preset--color--tea-300);
	color: var(--wp--preset--color--ink);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--bud);
	outline-offset: 3px;
	border-radius: 2px;
}

/* Fraunces: soften the terminals a touch for a warmer, inkier feel. */
h1, h2, h3, h4, h5,
.wp-block-site-title,
.wp-block-post-title {
	text-wrap: balance;
}

/* Fraunces headings and quotes: soften the terminals for a warmer, inkier feel. */
h1, h2, h3, h4, h5,
.wp-block-site-title,
.wp-block-post-title,
.wp-block-quote,
.wp-block-pullquote,
.wp-block-details summary,
.has-fraunces-font-family {
	font-variation-settings: "SOFT" 100, "WONK" 1;
}

p,
li {
	text-wrap: pretty;
}

/*
 * Italic emphasis inside headings becomes the brand accent: tea-coloured Louise.
 * Louise is upright-only and has a small x-height, so drop the faux italic and
 * nudge it up to hold its own beside bold Satoshi.
 */
:where(h1, h2, h3, .is-style-display) :where(em, i) {
	color: var(--wp--preset--color--tea-700);
	font-family: var(--wp--preset--font-family--louise);
	font-style: normal;
	font-weight: 700;
	font-size: 1.12em;
	letter-spacing: 0;
	line-height: 0;
	/* Louise ships one weight; let the browser synthesise the bold. */
	font-synthesis: weight;
}

/* The hero headline and footer sign-off keep Louise at its natural weight. */
:where(.rjer-hero-title, .rjer-footer-sign) :where(em, i) {
	font-weight: 400;
}

.has-louise-font-family {
	font-style: normal;
	font-weight: 400;
	letter-spacing: 0;
}

/* Links in running text: a soft tea underline that deepens on hover. */
:where(.wp-block-post-content, .entry-content, .wp-block-paragraph, p, li) a:where(:not(.wp-element-button)) {
	text-decoration-color: var(--wp--preset--color--tea-700);
	text-decoration-style: wavy;
	text-decoration-thickness: 0.06em;
	text-underline-offset: 0.25em;
	transition: color var(--rjer-ease), text-decoration-color var(--rjer-ease);
}

:where(.wp-block-post-content, .entry-content, p, li) a:where(:not(.wp-element-button)):hover {
	text-decoration-color: var(--wp--preset--color--bud);
}

.wp-element-button,
.wp-block-button__link {
	transition: background-color var(--rjer-ease), color var(--rjer-ease), border-color var(--rjer-ease), transform var(--rjer-ease), box-shadow var(--rjer-ease);
}

.wp-block-button:not(.is-style-arrow) > .wp-block-button__link:hover,
.wp-block-button:not(.is-style-arrow) > .wp-block-button__link:focus-visible {
	transform: translate(-1px, -1px) rotate(-1.5deg);
	box-shadow: var(--wp--preset--shadow--lift);
}

.wp-block-button:not(.is-style-arrow) > .wp-block-button__link:active {
	transform: translate(3px, 4px);
	box-shadow: 0 0 0 0 var(--wp--preset--color--ink);
}

/* ------------------------------------------------------------------ *
 * Block style variations (registered in functions.php)
 *
 * Colour, type, spacing and borders live in theme.json under
 * styles.blocks.*.variations so they're editable in Styles → Blocks.
 * Only hover states, pseudo-elements, masks and motion live here.
 * ------------------------------------------------------------------ */

/* Button: Outline and Tea both land on marigold, like a highlighter swipe. */
.wp-block-button.is-style-outline > .wp-block-button__link:hover,
.wp-block-button.is-style-outline > .wp-block-button__link:focus,
.wp-block-button.is-style-tea > .wp-block-button__link:hover,
.wp-block-button.is-style-tea > .wp-block-button__link:focus {
	background: var(--wp--preset--color--marigold);
	border-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ink);
}

/* Button: Text Arrow — a hand-drawn curly arrow and a scribbled underline. */
.wp-block-button.is-style-arrow > .wp-block-button__link {
	position: relative;
}

.wp-block-button.is-style-arrow > .wp-block-button__link::before {
	content: "";
	position: absolute;
	left: 0;
	right: 1.6em;
	bottom: -2px;
	height: 5px;
	background: currentColor;
	-webkit-mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
}

.wp-block-button.is-style-arrow > .wp-block-button__link::after {
	content: "";
	display: inline-block;
	inline-size: 0.8em;
	block-size: 1.05em;
	margin-left: 0.6em;
	vertical-align: -0.1em;
	background: currentColor;
	-webkit-mask: var(--rjer-mark-arrow) center / contain no-repeat;
	mask: var(--rjer-mark-arrow) center / contain no-repeat;
	transition: transform var(--rjer-ease);
}

.wp-block-button.is-style-arrow > .wp-block-button__link:hover {
	background: transparent;
	border-color: transparent;
	color: var(--wp--preset--color--bud);
}

.wp-block-button.is-style-arrow > .wp-block-button__link:hover::after {
	transform: translate(3px, -3px) rotate(8deg);
}

/* Heading: Display */
.is-style-display {
	font-variation-settings: "SOFT" 100, "WONK" 0;
}

/* Group: Card */
.wp-block-group.is-style-card {
	transition: transform var(--rjer-ease), box-shadow var(--rjer-ease), border-color var(--rjer-ease);
}

.wp-block-group.is-style-card:hover {
	transform: translate(-2px, -3px) rotate(-0.6deg);
	box-shadow: var(--wp--preset--shadow--lift);
}

/* Image: Arch */
.wp-block-image.is-style-arch img {
	aspect-ratio: 4 / 5;
	object-fit: cover;
}

/*
 * Arch (studio intro): halftone tea panel with an illustration standing in it.
 *
 * The lightbulb breaks out over the top of the arch. The same SVG is drawn
 * twice at exactly the same size and spot: inside the arch (clipped by it)
 * with the bulb cut away, and on top of the arch showing only the bulb. The
 * two clip polygons share an edge that runs through empty space between the
 * bulb and the hair, so the join is invisible.
 */
.rjer-arch-frame {
	--rjer-arch-art: 92%;
	--rjer-arch-border: 2px;
	/* Bulb outline, as % of the illustration's box. */
	--rjer-bulb: 59.6% 0, 100% 0, 100% 34.7%, 69.3% 34.7%, 67.4% 29.3%, 59.6% 27.4%;
	position: relative;
	max-width: 440px;
	/* Room for the bulb above the arch. */
	padding-top: 18%;
}

.rjer-arch {
	position: relative;
	aspect-ratio: 4 / 5;
	border: var(--rjer-arch-border) solid var(--wp--preset--color--ink);
	border-radius: 999px 999px 22px 10px / 999px 999px 10px 26px;
	box-shadow: var(--wp--preset--shadow--lift);
	overflow: hidden;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.rjer-arch > .wp-block-image,
.rjer-arch-frame > .rjer-arch-pop {
	margin: 0;
	width: var(--rjer-arch-art);
}

.rjer-arch > .wp-block-image img,
.rjer-arch-frame > .rjer-arch-pop img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 0;
}

/* Everything but the bulb, inside the arch. */
.rjer-arch > .wp-block-image img {
	clip-path: polygon(0 0, 59.6% 0, 59.6% 27.4%, 67.4% 29.3%, 69.3% 34.7%, 100% 34.7%, 100% 100%, 0 100%);
}

/* Only the bulb, laid over the arch at the same size and position. */
.rjer-arch-frame > .rjer-arch-pop {
	position: absolute;
	bottom: var(--rjer-arch-border);
	left: 50%;
	width: calc((100% - 2 * var(--rjer-arch-border)) * 0.92);
	transform: translateX(-50%);
	pointer-events: none;
}

.rjer-arch-frame > .rjer-arch-pop img {
	clip-path: polygon(var(--rjer-bulb));
}

/* List: Ruled */
.wp-block-list.is-style-ruled {
	list-style: none;
}

.wp-block-list.is-style-ruled > li {
	position: relative;
	padding-block: 0.85em;
	margin: 0;
}

.wp-block-list.is-style-ruled > li::after,
.wp-block-list.is-style-ruled > li:first-child::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 4px;
	background: var(--rjer-rule);
	-webkit-mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
}

.wp-block-list.is-style-ruled > li:first-child::before {
	top: 0;
	bottom: auto;
	transform: scaleX(-1);
}

.wp-block-list.is-style-ruled > li:nth-child(even)::after {
	transform: scaleX(-1);
}

/* Separator: default — a single hand-drawn pen line instead of a ruled border. */
.wp-block-separator:not(.is-style-squiggle):not(.is-style-dots) {
	border: 0;
	height: 5px;
	background-color: currentColor;
	-webkit-mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
}

/* Separator: Squiggle — three brush squiggles; the background colour (theme.json) shows through. */
.wp-block-separator.is-style-squiggle {
	border: 0;
	height: 14px;
	max-width: 96px;
	margin-inline: 0;
	-webkit-mask: var(--rjer-mark-squiggle) left center / contain no-repeat;
	mask: var(--rjer-mark-squiggle) left center / contain no-repeat;
}

.wp-block-separator.is-style-squiggle.aligncenter,
.has-text-align-center > .wp-block-separator.is-style-squiggle {
	margin-inline: auto;
}

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

.rjer-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: color-mix(in srgb, var(--wp--preset--color--base) 82%, transparent);
	-webkit-backdrop-filter: saturate(1.4) blur(14px);
	backdrop-filter: saturate(1.4) blur(14px);
}

/* A hand-drawn line under the header instead of a hairline border. */
.rjer-header::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -2px;
	height: 5px;
	background: var(--rjer-rule);
	-webkit-mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	pointer-events: none;
}

.admin-bar .rjer-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar .rjer-header {
		top: 0;
	}
}

.rjer-header-bar {
	min-height: var(--rjer-header-h);
}

.rjer-brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

/*
 * Fallback brand dot. The Site Logo block renders nothing on the front end
 * when no logo is set, so the dot only appears then (and in the editor the
 * block's upload placeholder takes its place).
 */
.rjer-brand:not(:has(.wp-block-site-logo))::before {
	content: "";
	inline-size: 1rem;
	block-size: 1.3rem;
	background: var(--wp--preset--color--tea-700);
	-webkit-mask: var(--rjer-mark-star) center / contain no-repeat;
	mask: var(--rjer-mark-star) center / contain no-repeat;
	flex: none;
}

/* Extra specificity: the Buttons block's flex layout class would otherwise win. */
@media (max-width: 600px) {
	.rjer-header .rjer-header-cta {
		display: none;
	}
}

.rjer-header .wp-block-navigation-item__content {
	position: relative;
	padding-block: 0.25rem;
}

.rjer-header .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -4px;
	height: 5px;
	background: var(--wp--preset--color--tea-700);
	-webkit-mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	/* "Draw" the line left to right. */
	clip-path: inset(0 100% 0 0);
	transition: clip-path 320ms ease-out;
}

.rjer-header .wp-block-navigation-item__content:hover::after,
.rjer-header .current-menu-item > .wp-block-navigation-item__content::after {
	clip-path: inset(0 0 0 0);
}

.rjer-header .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--base);
	padding: var(--wp--preset--spacing--60);
}

.rjer-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	font-family: var(--wp--preset--font-family--fraunces);
	font-weight: 480;
	font-size: var(--wp--preset--font-size--x-large);
}

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

.rjer-hero {
	position: relative;
	overflow: clip;
	isolation: isolate;
}

.rjer-hero-title {
	text-wrap: wrap;
}

/* Illustration column, with a few doodles scattered around it. */
.rjer-hero-art {
	position: relative;
}

.rjer-hero-art .wp-block-image {
	margin: 0;
}

.rjer-hero-art img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 0;
}

.rjer-hero-art::before,
.rjer-hero-art::after {
	content: "";
	position: absolute;
	pointer-events: none;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

/* A marigold star by the pencil… */
.rjer-hero-art::before {
	inline-size: clamp(2rem, 4vw, 3.25rem);
	aspect-ratio: 15 / 19.5;
	top: 4%;
	right: 6%;
	background: var(--wp--preset--color--marigold);
	-webkit-mask-image: var(--rjer-mark-star);
	mask-image: var(--rjer-mark-star);
	transform: rotate(12deg);
	animation: rjer-wiggle 3.2s ease-in-out infinite;
}

/* …and a curly arrow pointing back at the buttons. */
.rjer-hero-art::after {
	inline-size: clamp(2.5rem, 5vw, 4.5rem);
	aspect-ratio: 28.8 / 37.5;
	bottom: 6%;
	left: -6%;
	background: var(--wp--preset--color--bud);
	-webkit-mask-image: url("../img/curly-arrow-down-left-black.svg");
	mask-image: url("../img/curly-arrow-down-left-black.svg");
}

@keyframes rjer-wiggle {
	0%, 100% { transform: rotate(12deg) scale(1); }
	50% { transform: rotate(-6deg) scale(1.08); }
}

@media (max-width: 781px) {
	.rjer-hero-art {
		max-width: 340px;
		margin-inline: auto;
	}

	.rjer-hero-art::after {
		display: none;
	}
}

.rjer-hero-meta {
	position: relative;
	padding-top: var(--wp--preset--spacing--50);
}

.rjer-hero-meta::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 5px;
	background: var(--rjer-rule);
	-webkit-mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
}

/* Little hand-drawn stars between the hero labels (green beside a green label). */
.rjer-hero-meta > p {
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.rjer-hero-meta > p.has-bud-color::before {
	background: var(--wp--preset--color--bud);
}

.rjer-hero-meta > p::before {
	content: "";
	inline-size: 0.7em;
	block-size: 0.9em;
	flex: none;
	background: var(--wp--preset--color--tea-700);
	-webkit-mask: var(--rjer-mark-star) center / contain no-repeat;
	mask: var(--rjer-mark-star) center / contain no-repeat;
}

/* ------------------------------------------------------------------ *
 * Ticker — a slow, endless band of capabilities
 * ------------------------------------------------------------------ */

.rjer-ticker {
	overflow: hidden;
	transform: rotate(-1deg) scaleX(1.02);
	margin-block: var(--wp--preset--spacing--40);
	border-block: 2px solid var(--wp--preset--color--ink);
	white-space: nowrap;
}

/*
 * The track's flex layout and gap come from the block (Block Spacing is
 * editable). A zero-width trailing item adds one more gap at the end, so the
 * -50% shift lands exactly on the duplicate set whatever the gap is.
 */
.rjer-ticker > .wp-block-group,
.rjer-ticker-track {
	width: max-content;
	animation: rjer-ticker 38s linear infinite;
}

.rjer-ticker > .wp-block-group::after,
.rjer-ticker-track::after {
	content: "";
}

.rjer-ticker p {
	white-space: nowrap;
}

.rjer-ticker p {
	display: flex;
	align-items: center;
}

.rjer-ticker p::after {
	content: "";
	inline-size: 0.7em;
	block-size: 0.9em;
	margin-left: var(--wp--preset--spacing--60);
	background: var(--wp--preset--color--tea-700);
	-webkit-mask: var(--rjer-mark-star) center / contain no-repeat;
	mask: var(--rjer-mark-star) center / contain no-repeat;
}

.rjer-ticker p:nth-child(3n + 2)::after {
	background: var(--wp--preset--color--bud);
	transform: rotate(18deg);
}

.rjer-ticker p:nth-child(3n)::after {
	background: var(--wp--preset--color--ink);
	transform: rotate(-12deg);
}

@keyframes rjer-ticker {
	to { transform: translateX(-50%); }
}

/* ------------------------------------------------------------------ *
 * Services
 * ------------------------------------------------------------------ */

.rjer-services .rjer-service-index {
	font-family: var(--wp--preset--font-family--louise);
	font-size: 2.25rem !important;
	line-height: 1;
	color: var(--wp--preset--color--tea-700);
}

/* Cards sit slightly askew, like notes pinned to a board. */
@media (min-width: 782px) {
	.rjer-services .wp-block-column:nth-child(1) .is-style-card { rotate: -0.8deg; }
	.rjer-services .wp-block-column:nth-child(2) .is-style-card { rotate: 0.6deg; translate: 0 0.75rem; }
	.rjer-services .wp-block-column:nth-child(3) .is-style-card { rotate: -0.3deg; }
}

.rjer-services .is-style-card {
	height: 100%;
	display: flex;
	flex-direction: column;
}

.rjer-services .is-style-card > :last-child {
	margin-top: auto;
}

/* ------------------------------------------------------------------ *
 * Process — numbered steps
 * ------------------------------------------------------------------ */

.rjer-process {
	counter-reset: rjer-step;
}

.rjer-step {
	counter-increment: rjer-step;
	position: relative;
	padding-top: var(--wp--preset--spacing--50);
}

.rjer-step::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 5px;
	background: var(--rjer-rule-on-dark);
	-webkit-mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
}

.rjer-step::before {
	content: counter(rjer-step, decimal-leading-zero);
	display: block;
	font-family: var(--wp--preset--font-family--louise);
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 400;
	line-height: 1;
	color: var(--wp--preset--color--tea-500);
	margin-bottom: var(--wp--preset--spacing--40);
}

/* ------------------------------------------------------------------ *
 * Work / post cards
 * ------------------------------------------------------------------ */

.rjer-card {
	height: 100%;
}

.rjer-card .wp-block-post-featured-image {
	overflow: hidden;
	margin-bottom: var(--wp--preset--spacing--40);
	border-radius: var(--rjer-radius-md);
	transition: transform var(--rjer-ease), box-shadow var(--rjer-ease);
}

.rjer-card:hover .wp-block-post-featured-image {
	transform: rotate(-0.8deg);
	box-shadow: var(--wp--preset--shadow--lift);
}

.rjer-card .wp-block-post-featured-image img {
	transition: transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.rjer-card:hover .wp-block-post-featured-image img {
	transform: scale(1.04);
}

.rjer-card .wp-block-post-title a {
	/* A marigold highlighter stroke swiped under the title on hover. */
	background-image: linear-gradient(100deg, transparent 0.4em, var(--wp--preset--color--marigold) 0.5em, var(--wp--preset--color--marigold) calc(100% - 0.4em), transparent calc(100% - 0.3em));
	background-size: 0 0.45em;
	background-position: 0 85%;
	background-repeat: no-repeat;
	transition: background-size var(--rjer-ease);
}

.rjer-card:hover .wp-block-post-title a {
	background-size: 100% 0.45em;
}

/* Work grid: let every other card drop for a looser, open-canvas rhythm. */
@media (min-width: 782px) {
	.rjer-work-grid > li:nth-child(even) {
		margin-top: var(--wp--preset--spacing--80);
	}
}

/* Journal list rows */
.rjer-journal-row {
	position: relative;
	padding-block: var(--wp--preset--spacing--50);
	padding-inline: var(--wp--preset--spacing--30);
	border-radius: var(--rjer-radius-md);
	transition: background var(--rjer-ease);
}

.rjer-journal-row::before,
.rjer-journal-list > li:last-child .rjer-journal-row::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 5px;
	background: var(--rjer-rule);
	-webkit-mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
}

.rjer-journal-list > li:last-child .rjer-journal-row::after {
	top: auto;
	bottom: 0;
	transform: scaleX(-1);
}

.rjer-journal-row:hover {
	background: var(--rjer-halftone), var(--wp--preset--color--bud-wash);
}

/* Illustration under the journal intro. */
.rjer-journal-art {
	max-width: 280px;
}

.rjer-journal-art img {
	border-radius: 0;
}

/* ------------------------------------------------------------------ *
 * Testimonial
 * ------------------------------------------------------------------ */

.rjer-testimonial .wp-block-quote {
	border: 0;
	padding: 0;
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1.3;
}

.rjer-testimonial .wp-block-quote::before {
	content: "“";
	display: block;
	font-family: var(--wp--preset--font-family--louise);
	font-size: 7rem;
	line-height: 0.6;
	color: var(--wp--preset--color--ink);
	margin-bottom: 0.25rem;
}

.rjer-testimonial {
	rotate: -0.6deg;
}

.rjer-testimonial > * {
	rotate: 0.6deg;
}

/* ------------------------------------------------------------------ *
 * FAQ
 * ------------------------------------------------------------------ */

.wp-block-details summary {
	font-family: var(--wp--preset--font-family--fraunces);
	font-weight: 480;
	letter-spacing: -0.01em;
	font-size: var(--wp--preset--font-size--large);
	cursor: pointer;
	list-style: none;
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	align-items: baseline;
}

.wp-block-details summary::-webkit-details-marker {
	display: none;
}

.wp-block-details summary::after {
	content: "+";
	font-family: var(--wp--preset--font-family--louise);
	font-size: 1.5em;
	line-height: 0.6;
	font-weight: 400;
	color: var(--wp--preset--color--bud);
	transition: transform var(--rjer-ease);
}

.wp-block-details[open] summary::after {
	transform: rotate(45deg);
}

.wp-block-details {
	position: relative;
	border-bottom: 0 !important;
}

.wp-block-details::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 5px;
	background: var(--rjer-rule);
	-webkit-mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
	mask: var(--rjer-mark-line) center / 100% 100% no-repeat;
}

.wp-block-details:nth-of-type(even)::after {
	transform: scaleX(-1);
}

/* A scribbled question mark beside the FAQ heading. */
.rjer-faq-title::after {
	content: "";
	display: inline-block;
	inline-size: 0.5em;
	block-size: 0.85em;
	margin-left: 0.2em;
	vertical-align: -0.05em;
	background: var(--wp--preset--color--tea-700);
	-webkit-mask: var(--rjer-mark-question) center / contain no-repeat;
	mask: var(--rjer-mark-question) center / contain no-repeat;
	rotate: 10deg;
}

.wp-block-details > :not(summary) {
	color: var(--wp--preset--color--bark);
}

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

.rjer-footer a:where(:not(.wp-element-button)) {
	color: inherit;
	text-decoration: none;
}

.rjer-footer a:where(:not(.wp-element-button)):hover {
	color: var(--wp--preset--color--tea-300);
}

.rjer-footer .wp-block-navigation {
	flex-direction: column;
	align-items: flex-start;
}

.rjer-footer-sign {
	line-height: 0.92;
}

.rjer-footer-sign em {
	color: var(--wp--preset--color--tea-500);
}

/* The waving hand next to the sign-off; the text keeps clear of it. */
.rjer-footer-wave {
	position: relative;
}

@media (min-width: 782px) {
	.rjer-footer-wave {
		padding-right: clamp(6rem, 16vw, 13rem);
	}
}

.rjer-footer-wave::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	inline-size: clamp(5rem, 14vw, 11rem);
	aspect-ratio: 484 / 453;
	background: var(--wp--preset--color--tea-300);
	-webkit-mask: url("../img/right-hand-wave-black.svg") center / contain no-repeat;
	mask: url("../img/right-hand-wave-black.svg") center / contain no-repeat;
	transform-origin: 70% 90%;
	animation: rjer-wave 2.8s ease-in-out infinite;
	pointer-events: none;
}

@keyframes rjer-wave {
	0%, 60%, 100% { transform: rotate(0deg); }
	10%, 30% { transform: rotate(14deg); }
	20%, 40% { transform: rotate(-8deg); }
}

@media (max-width: 781px) {
	.rjer-footer-wave::after {
		inline-size: 4.5rem;
		top: -1.5rem;
	}
}

/* ------------------------------------------------------------------ *
 * Single posts & pages
 * ------------------------------------------------------------------ */

.rjer-single-header .wp-block-post-title {
	max-width: 18ch;
}

.wp-block-post-content > .wp-block-heading {
	margin-top: var(--wp--preset--spacing--70);
}

.wp-block-query-pagination .page-numbers.current {
	background: var(--wp--preset--color--umber);
	color: var(--wp--preset--color--base);
	border-radius: var(--rjer-radius-wobble);
	padding: 0.2em 0.65em;
}

/* Search form */
.wp-block-search__input {
	border: 2px solid var(--wp--preset--color--ink);
	border-radius: var(--rjer-radius-wobble);
	background: var(--wp--preset--color--surface);
	padding: 0.75em 1.2em;
	color: var(--wp--preset--color--ink);
}

.wp-block-search__button {
	margin-left: 0.5rem;
}

/* Form fields (contact forms from plugins inherit this) */
:where(input[type="text"], input[type="email"], input[type="url"], input[type="tel"], textarea, select) {
	font-family: var(--wp--preset--font-family--satoshi);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--surface);
	border: 2px solid var(--wp--preset--color--ink);
	border-radius: var(--rjer-radius-sm);
	padding: 0.8em 1em;
}

/* Dark sections: keep headings and links legible on ink/umber/bark. */
:is(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) :where(h1, h2, h3, h4, h5, h6, .wp-block-heading):where(:not(.has-text-color)) {
	color: var(--wp--preset--color--base);
}

:is(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) :where(h1, h2, h3) :where(em, i) {
	color: var(--wp--preset--color--tea-300);
}

:is(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) .is-style-eyebrow:where(:not(.has-text-color)) {
	color: var(--wp--preset--color--tea-300);
}

:where(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) a:where(:not(.wp-element-button)) {
	color: var(--wp--preset--color--base);
}

/* Default buttons stay marigold on dark backgrounds; the ink outline would vanish, so match it. */
:where(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) .wp-block-button:not(.is-style-tea):not(.is-style-arrow):not(.is-style-outline) > .wp-block-button__link {
	border-color: var(--wp--preset--color--marigold);
}

:where(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) .wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--base);
}

:where(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) .wp-block-button:not(.is-style-arrow) > .wp-block-button__link {
	box-shadow: 3px 4px 0 0 var(--wp--preset--color--tea-500);
}

:where(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) .wp-block-button:not(.is-style-arrow) > .wp-block-button__link:hover {
	background: var(--wp--preset--color--marigold);
	border-color: var(--wp--preset--color--marigold);
	color: var(--wp--preset--color--ink);
	box-shadow: 6px 7px 0 0 var(--wp--preset--color--tea-500);
}

/*
 * Tea buttons on dark backgrounds keep the ink outline like every other
 * button, with a marigold shadow so it doesn't blend into the button; the
 * fill and shadow swap on hover.
 */
:where(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) .wp-block-button.is-style-tea > .wp-block-button__link {
	border-color: var(--wp--preset--color--ink);
	box-shadow: 3px 4px 0 0 var(--wp--preset--color--marigold);
}

:where(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) .wp-block-button.is-style-tea > .wp-block-button__link:hover,
:where(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) .wp-block-button.is-style-tea > .wp-block-button__link:focus {
	background: var(--wp--preset--color--marigold);
	border-color: var(--wp--preset--color--ink);
	box-shadow: 6px 7px 0 0 var(--wp--preset--color--tea-500);
}

/* Default buttons hover to tea (marigold is already their resting colour). */
:where(.has-ink-background-color, .has-umber-background-color, .has-bark-background-color, .has-dusk-gradient-background) .wp-block-button:not(.is-style-tea):not(.is-style-arrow):not(.is-style-outline) > .wp-block-button__link:hover {
	background: var(--wp--preset--color--tea-500);
	border-color: var(--wp--preset--color--tea-500);
	box-shadow: 6px 7px 0 0 var(--wp--preset--color--marigold);
}

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

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

	.rjer-ticker {
		white-space: normal;
	}

	.rjer-ticker > .wp-block-group,
	.rjer-ticker-track {
		flex-wrap: wrap;
		width: auto;
	}
}

@media print {
	body::before {
		display: none;
	}
}
