/**
 * ThemeOcean — shared front-end layer.
 *
 * This is the ONLY stylesheet that loads on every page, and it stays small on
 * purpose. Before adding anything here, check in this order:
 *
 *   1. Can theme.json express it?            → put it in theme.json
 *   2. Does it belong to one core block?     → assets/css/blocks/<block>.css
 *   3. Is it a named look for a block?       → a block style, section 4 below
 *   4. Is it motion?                         → section 5 below
 *
 * Never use raw values. Every colour, size, radius, duration and easing curve
 * below resolves to a design token. See docs/developer/DESIGN-SYSTEM.md.
 *
 * Contents
 *   1. Dark colour scheme
 *   2. Base and accessibility
 *   3. Layout utilities
 *   4. Block styles
 *   5. Motion
 *   6. Colour-scheme toggle
 *   7. Reduced motion
 */

/* ============================================================
   1. DARK COLOUR SCHEME
   ------------------------------------------------------------
   The light palette lives in theme.json, so a buyer edits it in
   Styles → Colors like any other theme. Dark mode re-points the
   same preset variables inside a scoped selector, which means
   every block, pattern and core style follows automatically —
   nothing here targets a component by name.

   To restyle dark mode, change the values in this block only.
   ============================================================ */

:root[data-scheme="dark"] {
	--wp--preset--color--primary: #35d6e5;
	--wp--preset--color--secondary: #7de9f2;
	--wp--preset--color--accent: #22c3d6;
	--wp--preset--color--background: #0a0f13;
	--wp--preset--color--surface: #111820;
	--wp--preset--color--surface-alt: #18212b;
	--wp--preset--color--text: #dbe3e9;
	--wp--preset--color--text-muted: #8a98a4;
	--wp--preset--color--heading: #f2f6f8;
	--wp--preset--color--border: #24303b;
	--wp--preset--color--light: #f2f4f1;
	--wp--preset--color--dark: #05090c;
	--wp--preset--color--success: #4bbd8b;
	--wp--preset--color--warning: #d79a3a;
	--wp--preset--color--error: #e2705c;

	--wp--preset--gradient--deep-current: linear-gradient(135deg, #07474e 0%, #0c6f78 55%, #35d6e5 100%);
	--wp--preset--gradient--surface-fade: linear-gradient(180deg, #18212b 0%, rgba(24, 33, 43, 0) 100%);
	--wp--preset--gradient--night-tide: linear-gradient(160deg, #05090c 0%, #07474e 100%);

	/* Shadows read as light on dark surfaces, so they lean on depth, not ink. */
	--wp--preset--shadow--xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
	--wp--preset--shadow--sm: 0 2px 8px -2px rgba(0, 0, 0, 0.5);
	--wp--preset--shadow--md: 0 12px 28px -12px rgba(0, 0, 0, 0.65);
	--wp--preset--shadow--lg: 0 28px 60px -28px rgba(0, 0, 0, 0.8);

	--wp--custom--overlay--scrim: rgba(3, 6, 8, 0.66);
	--wp--custom--overlay--tint: rgba(53, 214, 229, 0.1);
}

/* Primary buttons flip their label colour with the scheme. */
:root[data-scheme="dark"] .wp-element-button,
:root[data-scheme="dark"] .wp-block-button__link {
	color: var(--wp--preset--color--dark);
}

/*
 * …but only the filled ones. Transparent buttons keep a foreground colour of
 * their own: inverting them paints dark ink onto a dark page, and the control
 * disappears completely. The colour-scheme toggle is the worst case — it is
 * the very control you need in order to get back.
 */
:root[data-scheme="dark"] .wp-block-button.is-style-outline-soft .wp-block-button__link,
:root[data-scheme="dark"] .wp-block-button.is-style-link-arrow .wp-block-button__link {
	color: var(--wp--preset--color--primary);
}

:root[data-scheme="dark"] .wp-block-button.is-style-icon .wp-block-button__link,
:root[data-scheme="dark"] .to-scheme-toggle__button {
	color: var(--wp--preset--color--heading);
}

/* ============================================================
   2. BASE AND ACCESSIBILITY
   ============================================================ */

/*
 * A display:grid/flex rule anywhere beats the browser's own
 * [hidden] { display: none }, and the "hidden" element stays visible.
 */
[hidden] {
	display: none !important;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Anchors and skip links must not land under the sticky header. */
	scroll-padding-top: calc(var(--wp--custom--header--height) + var(--wp--preset--spacing--30));
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: hidden;
	text-underline-offset: 0.18em;
}

::selection {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--light);
}

/*
 * Focus ring. Visible, but it hugs the control instead of boxing in whole
 * paragraphs — an outline around a full text block reads as a layout bug.
 */
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
	border-radius: var(--wp--custom--radius--xs);
}

/*
 * Type roles.
 * Google Sans carries running text — articles, tables, descriptions. Roboto
 * takes the small print: captions, footnotes, meta lines. It holds up better
 * at 13px than a display-oriented face does, and the change of voice makes
 * small text read as a different layer rather than as shrunken body copy.
 * Mono labels override this below, which is why they come later in the file.
 */
.has-x-small-font-size,
.has-small-font-size,
.wp-block-post-date,
.wp-block-post-author-name {
	font-family: var(--wp--preset--font-family--ui);
}

/* Long unbroken words (URLs, German compounds) must never widen the page. */
:where(h1, h2, h3, h4, h5, h6, p, li, dt, dd, figcaption) {
	overflow-wrap: break-word;
}

/*
 * A flex item will not shrink below its content's minimum width, so one wide
 * table or one long word inside a Column pushes that column out of the layout.
 * `min-width: 0` restores normal shrinking; the content then wraps or scrolls
 * inside its own box, which is what every block here is set up to do.
 */
.wp-block-column,
.wp-block-group.is-layout-flex > * {
	min-width: 0;
}

/* Media never overflows its column, whatever the buyer uploads. */
:where(img, svg, video, iframe, embed, object) {
	max-width: 100%;
	height: auto;
}

.skip-link:focus {
	z-index: 100000;
}

/* Screen-reader-only text, for labels the design does not show. */
.to-sr-only:not(:focus):not(:active) {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ============================================================
   3. LAYOUT UTILITIES
   ------------------------------------------------------------
   Applied through the block editor's "Additional CSS class(es)"
   field, so a user reaches them without code. Documented in
   docs/developer/COMPONENTS.md.
   ============================================================ */

/* Content column narrower than the default, for lead paragraphs. */
.to-measure {
	max-width: var(--wp--custom--width--measure);
}

/*
 * Keeps a sidebar column in view while the article scrolls past it. The offset
 * clears the sticky header, and the rule is dropped on narrow screens where the
 * column is stacked and sticking would pin it over the content.
 */
@media (min-width: 782px) {
	.to-sticky {
		position: sticky;
		top: calc(var(--wp--custom--header--height) + var(--wp--preset--spacing--30));
	}
}

/* Sticky header shell. Used by every header variant. */
.to-header {
	position: sticky;
	top: 0;
	z-index: 40;
	transition: transform var(--wp--custom--duration--base) var(--wp--custom--ease--out),
		background-color var(--wp--custom--duration--base) var(--wp--custom--ease--base),
		border-color var(--wp--custom--duration--base) var(--wp--custom--ease--base);
}

/*
 * The solid state appears once the page has scrolled. backdrop-filter is
 * deliberately NOT part of the transition and is dropped entirely while the
 * mobile menu is open: a filtered ancestor becomes the containing block for
 * position:fixed descendants, which traps a full-screen overlay inside the
 * header's box and makes the menu open in two visible jumps.
 */
.to-header.is-solid {
	background-color: color-mix(in srgb, var(--wp--preset--color--background) 82%, transparent);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border-bottom: var(--wp--custom--stroke--hairline) solid var(--wp--preset--color--border);
}

.to-header.is-hidden {
	transform: translateY(-100%);
}

body.to-nav-open .to-header,
.to-header:has(.wp-block-navigation__responsive-container.is-menu-open) {
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

/* Lift on hover, for cards that link somewhere. */
.to-lift {
	transition: transform var(--wp--custom--duration--base) var(--wp--custom--ease--out),
		box-shadow var(--wp--custom--duration--base) var(--wp--custom--ease--base);
}

.to-lift:hover {
	transform: translateY(-4px);
	box-shadow: var(--wp--preset--shadow--md);
}

/* Slow zoom of the image inside a hovered card. */
.to-zoom-media :where(img) {
	transition: transform var(--wp--custom--duration--slow) var(--wp--custom--ease--out);
	will-change: transform;
}

.to-zoom-media:hover :where(img) {
	transform: scale(1.04);
}

/*
 * Hero media that must not push the first action below the fold.
 * 1280x720 laptops are still everywhere, and checking only viewport *width*
 * is how a hero ends up with its call to action off-screen.
 */
.to-fit-screen :where(img) {
	max-height: min(72svh, 42rem);
	width: 100%;
	object-fit: cover;
}

@media (min-width: 782px) and (max-height: 820px) {
	.to-fit-screen :where(img) {
		max-height: 58svh;
	}
}

/* Media that must keep its shape regardless of the uploaded file. */
.to-ratio-square :where(img) {
	aspect-ratio: 1 / 1;
	object-fit: cover;
	width: 100%;
}

.to-ratio-wide :where(img) {
	aspect-ratio: 16 / 9;
	object-fit: cover;
	width: 100%;
}

.to-ratio-portrait :where(img) {
	aspect-ratio: 4 / 5;
	object-fit: cover;
	width: 100%;
}

/*
 * Content icons. They are <img> elements, so they cannot inherit currentColor —
 * the files ship in a mid-teal that reads on both schemes, and dark mode simply
 * lifts them. Swapping an icon for your own artwork needs no CSS change.
 */
.to-icon img {
	transition: filter var(--wp--custom--duration--base) var(--wp--custom--ease--base);
}

:root[data-scheme="dark"] .to-icon img {
	filter: brightness(1.45) saturate(1.1);
}

/*
 * Collapse a decorated wrapper when the block inside it produced nothing —
 * a post with no tags, or the newest post, which has no "next" link. Without
 * this the page shows a rule with empty space under it, which reads as a bug.
 */
.to-hide-if-empty:not(:has(*)),
.to-hide-if-empty:has(> .wp-block-post-terms:empty:only-child) {
	display: none;
}

/* A hairline that separates stacked rows without a Separator block. */
.to-rows > :where(*) + :where(*) {
	border-top: var(--wp--custom--stroke--hairline) solid var(--wp--preset--color--border);
}

/* ============================================================
   4. BLOCK STYLES
   ------------------------------------------------------------
   Every class here is registered in inc/block-styles.php and
   appears in the block's Styles tab. One look, one place.
   ============================================================ */

/* --- Group ------------------------------------------------- */

.wp-block-group.is-style-card {
	background-color: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--radius--card);
	padding: var(--wp--preset--spacing--40);
	box-shadow: var(--wp--preset--shadow--sm);
}

.wp-block-group.is-style-card-outline {
	background-color: transparent;
	border: var(--wp--custom--stroke--base) solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--card);
	padding: var(--wp--preset--spacing--40);
}

.wp-block-group.is-style-panel {
	background-color: var(--wp--preset--color--surface-alt);
	border-radius: var(--wp--custom--radius--lg);
	padding: var(--wp--preset--spacing--50);
}

.wp-block-group.is-style-rule-top {
	border-top: var(--wp--custom--stroke--base) solid var(--wp--preset--color--border);
	padding-top: var(--wp--preset--spacing--30);
}

/* --- Columns ----------------------------------------------- */

@media (min-width: 782px) {
	.wp-block-columns.is-style-divided > .wp-block-column + .wp-block-column {
		border-inline-start: var(--wp--custom--stroke--hairline) solid var(--wp--preset--color--border);
		padding-inline-start: var(--wp--preset--spacing--40);
	}
}

/* --- Image ------------------------------------------------- */

.wp-block-image.is-style-square :where(img) {
	border-radius: 0;
}

.wp-block-image.is-style-framed :where(img) {
	border: var(--wp--custom--stroke--base) solid var(--wp--preset--color--border);
	padding: var(--wp--preset--spacing--20);
	background-color: var(--wp--preset--color--surface);
}

/* --- Buttons ----------------------------------------------- */

.wp-block-button.is-style-outline-soft .wp-block-button__link {
	background-color: transparent;
	color: var(--wp--preset--color--heading);
	border-color: var(--wp--preset--color--border);
}

.wp-block-button.is-style-outline-soft .wp-block-button__link:hover,
.wp-block-button.is-style-outline-soft .wp-block-button__link:focus-visible {
	background-color: var(--wp--preset--color--heading);
	color: var(--wp--preset--color--background);
	border-color: var(--wp--preset--color--heading);
}

.wp-block-button.is-style-link-arrow .wp-block-button__link {
	background-color: transparent;
	border-color: transparent;
	color: var(--wp--preset--color--primary);
	padding-inline: 0;
	padding-block: var(--wp--preset--spacing--10);
	position: relative;
}

.wp-block-button.is-style-link-arrow .wp-block-button__link::after {
	content: "\2192";
	display: inline-block;
	margin-inline-start: 0.6em;
	transition: transform var(--wp--custom--duration--base) var(--wp--custom--ease--out);
}

.wp-block-button.is-style-link-arrow .wp-block-button__link:hover::after {
	transform: translateX(0.3em);
}

.wp-block-button.is-style-icon .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* 44px minimum touch target. */
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding: 0;
	background-color: transparent;
	border-color: var(--wp--preset--color--border);
	color: var(--wp--preset--color--heading);
}

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

/* --- Lists ------------------------------------------------- */

.wp-block-list.is-style-checks {
	list-style: none;
	padding-inline-start: 0;
}

.wp-block-list.is-style-checks > li {
	position: relative;
	padding-inline-start: 1.5em;
	margin-block-end: var(--wp--preset--spacing--20);
}

.wp-block-list.is-style-checks > li::before {
	content: "";
	position: absolute;
	inset-inline-start: 0.15em;
	inset-block-start: 0.5em;
	/* Smaller and finer: a tick should mark the line, not compete with it. */
	width: 0.62em;
	height: 0.34em;
	border-inline-start: var(--wp--custom--stroke--base) solid var(--wp--preset--color--primary);
	border-block-end: var(--wp--custom--stroke--base) solid var(--wp--preset--color--primary);
	transform: rotate(-45deg);
}

.wp-block-list.is-style-plain-rows {
	list-style: none;
	padding-inline-start: 0;
}

.wp-block-list.is-style-plain-rows > li {
	padding-block: var(--wp--preset--spacing--30);
	border-block-end: var(--wp--custom--stroke--hairline) solid var(--wp--preset--color--border);
}

/* --- Separator --------------------------------------------- */

.wp-block-separator.is-style-hairline {
	border: 0;
	border-top: var(--wp--custom--stroke--hairline) solid var(--wp--preset--color--border);
	opacity: 1;
	width: 100%;
	max-width: none;
}

/* --- Headings and paragraphs ------------------------------- */

.wp-block-heading.is-style-eyebrow {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-muted);
	line-height: 1.4;
}

.wp-block-heading.is-style-outlined {
	color: transparent;
	-webkit-text-stroke: 1px var(--wp--preset--color--heading);
}

.wp-block-paragraph.is-style-lead {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.5;
	color: var(--wp--preset--color--text);
	max-width: var(--wp--custom--width--measure);
}

.wp-block-paragraph.is-style-mono-label {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-muted);
}

/*
 * Muted text on a dark ground.
 * `text-muted` is tuned for the page background; on a dark section it lands
 * dark-on-dark and the label disappears. Deriving the colour from `light`
 * keeps it quiet without hard-coding a second grey — and it follows every
 * style variation and both colour schemes automatically.
 */
.has-dark-background-color .wp-block-paragraph.is-style-mono-label,
.is-style-section-dark .wp-block-paragraph.is-style-mono-label,
.wp-block-cover .wp-block-paragraph.is-style-mono-label,
.has-dark-background-color .wp-block-heading.is-style-eyebrow,
.is-style-section-dark .wp-block-heading.is-style-eyebrow,
.wp-block-cover .wp-block-heading.is-style-eyebrow {
	color: color-mix(in srgb, var(--wp--preset--color--light) 66%, transparent);
}

/* --- Post terms -------------------------------------------- */

.wp-block-post-terms.is-style-pills a {
	display: inline-block;
	padding: 0.35em 0.9em;
	border: var(--wp--custom--stroke--hairline) solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	text-decoration: none;
	color: var(--wp--preset--color--text-muted);
	transition: color var(--wp--custom--duration--quick) var(--wp--custom--ease--base),
		border-color var(--wp--custom--duration--quick) var(--wp--custom--ease--base);
}

.wp-block-post-terms.is-style-pills a:hover {
	color: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
	text-decoration: none;
}

/* ============================================================
   5. MOTION
   ------------------------------------------------------------
   Four movements exist in this theme and no more: reveal, media
   clip reveal, parallax and marquee. Adding a fifth effect that
   appears once is how a page starts looking cheap.

   Elements are hidden ONLY while scripting is available
   (html.js). If motion.js never runs, everything is simply
   visible — a blank page below the fold is not an option.
   ============================================================ */

html.js .to-reveal {
	opacity: 0;
	transform: translateY(30px);
}

.to-reveal {
	transition: opacity var(--wp--custom--duration--reveal) var(--wp--custom--ease--out),
		transform var(--wp--custom--duration--reveal) var(--wp--custom--ease--out);
	transition-delay: var(--to-delay, 0ms);
}

html.js .to-reveal.is-in {
	opacity: 1;
	transform: none;
}

/* Word-by-word. motion.js wraps each word; the stagger is pure CSS. */
html.js .to-reveal-words .to-word {
	opacity: 0;
	transform: translateY(24px);
}

.to-reveal-words .to-word {
	display: inline-block;
	transition: opacity var(--wp--custom--duration--slow) var(--wp--custom--ease--out),
		transform var(--wp--custom--duration--slow) var(--wp--custom--ease--out);
	transition-delay: calc(var(--to-i, 0) * 32ms);
}

html.js .to-reveal-words.is-in .to-word {
	opacity: 1;
	transform: none;
}

/*
 * Media does not fade in, it opens. This single effect is the biggest
 * difference between an ordinary page and an expensive-looking one.
 */
html.js .to-reveal-media {
	clip-path: inset(8% round var(--wp--custom--radius--image));
	transition: clip-path 1.3s var(--wp--custom--ease--elastic);
}

html.js .to-reveal-media.is-in {
	clip-path: inset(0 round var(--wp--custom--radius--image));
}

/*
 * Parallax. motion.js writes the offset; CSS owns the transform.
 * The frame must clip: the image is scaled up so it has room to drift, and on
 * a full-width image that overhang would otherwise widen the page. clip-path
 * on the reveal is not enough — it hides the overflow without removing it from
 * the scrollable area.
 */
.to-parallax {
	overflow: hidden;
}

.to-parallax :where(img) {
	transform: translate3d(0, var(--to-parallax-y, 0), 0) scale(1.12);
	will-change: transform;
}

/* Counters keep their box while the number grows, so nothing reflows. */
.to-count {
	font-variant-numeric: tabular-nums;
}

/*
 * Marquee. One set of items is authored; motion.js clones it until the track is
 * wider than two viewports — two copies leave a visible gap on wide monitors.
 */
.to-marquee {
	overflow: hidden;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
	mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.to-marquee__track {
	display: flex;
	width: max-content;
	will-change: transform;
	animation: to-marquee-slide var(--to-marquee-duration, 40s) linear infinite;
}

.to-marquee:hover .to-marquee__track {
	animation-play-state: paused;
}

.to-marquee__set {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--50);
	padding-inline-end: var(--wp--preset--spacing--50);
	flex: 0 0 auto;
}

/*
 * Block spacing gives every child after the first a top margin. On the track
 * that pushes each cloned set a few pixels below the original, and the ticker
 * reads as two misaligned rows at every seam. Specificity has to beat core's
 * `.wp-block-group.is-layout-flow > :not(:first-child)`, hence three classes.
 */
.to-marquee .to-marquee__track > .to-marquee__set,
.to-marquee .to-marquee__set > * {
	margin-block: 0;
}

@keyframes to-marquee-slide {
	from {
		transform: translate3d(0, 0, 0);
	}

	to {
		transform: translate3d(calc(-1 * var(--to-marquee-width, 50%)), 0, 0);
	}
}

/*
 * Escape hatch. motion.js sets this class on <html> when it decides not to
 * animate at all — reduced motion, or a browser without IntersectionObserver.
 * The `js` class itself stays, because other controls (the scheme toggle) do
 * still work and must not disappear along with the animations.
 */
html.to-no-motion .to-reveal,
html.to-no-motion .to-reveal-words .to-word {
	opacity: 1 !important;
	transform: none !important;
}

html.to-no-motion .to-reveal-media {
	clip-path: none !important;
}

/*
 * Article body.
 *
 * The container is as wide as everything else on the page, so the left edge of
 * the prose lines up with the breadcrumbs, the title, the author panel and the
 * related posts — a single vertical spine down the page.
 *
 * Line length is still controlled, but by capping the text blocks rather than
 * by centring a narrow column: centring is what made the body copy start
 * 190px to the right of its own heading.
 */
.to-article > p,
.to-article > h1,
.to-article > h2,
.to-article > h3,
.to-article > h4,
.to-article > h5,
.to-article > h6,
.to-article > ul,
.to-article > ol,
.to-article > .wp-block-quote,
.to-article > .wp-block-pullquote,
.to-article > .wp-block-list {
	max-width: var(--wp--custom--width--measure);
	/*
	 * Core centres every child of a constrained layout with
	 * `margin-left: auto !important`. Overriding that needs !important too —
	 * there is no specificity that beats it. Scoped to .to-article, so it
	 * cannot leak into any other constrained container.
	 */
	margin-inline-start: 0 !important;
	margin-inline-end: 0 !important;
}

/* Media and anything explicitly wide keep the full width. */
.to-article > .alignwide,
.to-article > .alignfull,
.to-article > .wp-block-image,
.to-article > .wp-block-gallery,
.to-article > .wp-block-embed,
.to-article > .wp-block-table {
	max-width: none;
	margin-inline-start: 0 !important;
}

/*
 * Meta separator.
 *
 * Note for anyone editing the palette: a colour whose slug is `border`
 * generates the class `has-border-color`, which WordPress *also* uses to mean
 * "this block has a border colour set" — applying it to text draws a visible
 * frame. Use `text-muted` for separators; the `border` colour is for borders.
 */
.to-meta-dot {
	opacity: 0.6;
}

/* ------------------------------------------------------------
   Design-token samples
   ------------------------------------------------------------
   Used by the style guide and the palette previews.

   These exist as classes rather than as block attributes on
   purpose. Expressing a swatch through `style.layout.flexSize`
   or `style.shadow` makes the editor rewrite the markup on
   load, and every sample turns into "this block contains
   unexpected or invalid content". A class carries the same
   information and the editor leaves it alone.
   ------------------------------------------------------------ */

.to-swatch {
	min-height: 4rem;
	border-radius: var(--wp--custom--radius--sm);
	border: var(--wp--custom--stroke--hairline) solid var(--wp--preset--color--border);
}

/* Palette strip: equal columns, no gaps, one rounded outline. */
.to-swatch-strip {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--sm);
}

.to-swatch-strip > * {
	min-height: 3.5rem;
}

/*
 * Each swatch is an empty block. Inside a grid an empty constrained group
 * collapses to zero width, so the strip renders as a blank line — the cell has
 * to be told to fill its column explicitly.
 */
.to-swatch-strip > .to-swatch-cell {
	width: 100%;
	min-width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
}

/* Spacing scale: bar width equals the step it demonstrates. */
.to-scale-bar {
	min-height: 0.5rem;
	background-color: var(--wp--preset--color--primary);
	border-radius: var(--wp--custom--radius--xs);
	flex: 0 0 auto;
}

.to-scale-bar.is-10 { inline-size: var(--wp--preset--spacing--10); }
.to-scale-bar.is-20 { inline-size: var(--wp--preset--spacing--20); }
.to-scale-bar.is-30 { inline-size: var(--wp--preset--spacing--30); }
.to-scale-bar.is-40 { inline-size: var(--wp--preset--spacing--40); }
.to-scale-bar.is-50 { inline-size: var(--wp--preset--spacing--50); }
.to-scale-bar.is-60 { inline-size: var(--wp--preset--spacing--60); }
.to-scale-bar.is-70 { inline-size: var(--wp--preset--spacing--70); }
.to-scale-bar.is-80 { inline-size: var(--wp--preset--spacing--80); }

/* Radius and shadow samples. */
.to-sample {
	inline-size: 4.5rem;
	min-height: 4rem;
	flex: 0 0 auto;
	background-color: var(--wp--preset--color--surface-alt);
}

.to-sample.is-radius-sm   { border-radius: var(--wp--custom--radius--sm); }
.to-sample.is-radius-md   { border-radius: var(--wp--custom--radius--md); }
.to-sample.is-radius-lg   { border-radius: var(--wp--custom--radius--lg); }
.to-sample.is-radius-xl   { border-radius: var(--wp--custom--radius--xl); }
.to-sample.is-radius-pill { border-radius: var(--wp--custom--radius--pill); }

.to-sample.is-shadow {
	background-color: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--radius--md);
}

.to-sample.is-shadow-xs { box-shadow: var(--wp--preset--shadow--xs); }
.to-sample.is-shadow-sm { box-shadow: var(--wp--preset--shadow--sm); }
.to-sample.is-shadow-md { box-shadow: var(--wp--preset--shadow--md); }
.to-sample.is-shadow-lg { box-shadow: var(--wp--preset--shadow--lg); }

/* ------------------------------------------------------------
   Breadcrumbs
   ------------------------------------------------------------ */

/*
 * The trail sits on the same line as the logo, on every template.
 *
 * It is pinned to the theme's full width — the same 100rem shell the header
 * uses — rather than to whatever column it was dropped into. Two earlier
 * attempts got this wrong in opposite directions: inheriting the column
 * indented it on templates that constrain their main to 82rem, and removing
 * the cap entirely sent it past the logo on screens wider than the shell.
 * Note this is NOT the global wide size, which is 82rem here.
 */
.wp-block-group.to-breadcrumbs {
	max-width: var(--wp--custom--width--full);
	margin-inline: auto;
}

.to-breadcrumbs__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: var(--wp--preset--font-family--ui);
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--text-muted);
}

.to-breadcrumbs__item {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
}

/* Separator drawn in CSS so it is never read aloud as content. */
.to-breadcrumbs__item + .to-breadcrumbs__item::before {
	content: "";
	width: 0.35em;
	height: 0.35em;
	border-top: var(--wp--custom--stroke--hairline) solid currentColor;
	border-right: var(--wp--custom--stroke--hairline) solid currentColor;
	transform: rotate(45deg);
	opacity: 0.6;
	flex: 0 0 auto;
}

.to-breadcrumbs__list a {
	color: inherit;
	text-decoration: none;
}

.to-breadcrumbs__list a:hover {
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
}

.to-breadcrumbs__list [aria-current="page"] {
	color: var(--wp--preset--color--heading);
}

/* ------------------------------------------------------------
   Carousel
   ------------------------------------------------------------
   A native scroll container: swipe, trackpad and keyboard work
   before a single line of JavaScript runs, and with scripting
   unavailable it degrades to a plain horizontal scroller rather
   than to nothing. motion.js adds the arrows and the seamless
   loop on top.
   ------------------------------------------------------------ */

.to-carousel {
	position: relative;
	/*
	 * A slide cut off by a hard edge reads as broken layout. Fading it out says
	 * "there is more this way" instead. The mask is transparent-to-opaque, so
	 * it works over any section background without knowing its colour — no
	 * gradient-to-background-colour to keep in sync with the palette.
	 */
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
	mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
}

.to-carousel__track {
	display: flex;
	gap: var(--wp--preset--spacing--40);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	padding-block-end: var(--wp--preset--spacing--20);
	/* Pointer dragging is added by motion.js; this is the affordance for it. */
	cursor: grab;
}

.to-carousel__track.is-dragging {
	cursor: grabbing;
	scroll-snap-type: none;
	/* Text selection while dragging turns a swipe into a highlight. */
	user-select: none;
}

.to-carousel__track.is-dragging * {
	pointer-events: none;
}

.to-carousel__track::-webkit-scrollbar {
	display: none;
}

.to-carousel__track > * {
	flex: 0 0 clamp(17rem, 78vw, 24rem);
	scroll-snap-align: start;
	margin-block: 0;
}

@media (min-width: 782px) {
	.to-carousel__track > * {
		flex-basis: clamp(20rem, 30vw, 26rem);
	}
}

/* Arrows are injected by motion.js, so they never exist without behaviour. */
.to-carousel__nav {
	display: flex;
	gap: var(--wp--preset--spacing--20);
	justify-content: flex-end;
	margin-block-start: var(--wp--preset--spacing--30);
}

.to-carousel__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	background-color: transparent;
	color: var(--wp--preset--color--heading);
	border: var(--wp--custom--stroke--base) solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	cursor: pointer;
	transition: color var(--wp--custom--duration--quick) var(--wp--custom--ease--base),
		border-color var(--wp--custom--duration--quick) var(--wp--custom--ease--base);
}

.to-carousel__button:hover {
	color: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
}

.to-carousel__button svg {
	width: 1.1rem;
	height: 1.1rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* On a dark section the arrows follow the inverted foreground. */
.has-dark-background-color .to-carousel__button,
.is-style-section-dark .to-carousel__button {
	color: var(--wp--preset--color--light);
	border-color: color-mix(in srgb, var(--wp--preset--color--light) 30%, transparent);
}

/* ============================================================
   6. COLOUR-SCHEME TOGGLE
   ============================================================ */

/* A control that cannot work should not be offered. */
html:not(.js) .to-scheme-toggle {
	display: none;
}

.to-scheme-toggle__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding: 0;
	background-color: transparent;
	color: var(--wp--preset--color--heading);
	border: var(--wp--custom--stroke--base) solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	cursor: pointer;
	transition: color var(--wp--custom--duration--quick) var(--wp--custom--ease--base),
		border-color var(--wp--custom--duration--quick) var(--wp--custom--ease--base);
}

.to-scheme-toggle__button:hover {
	color: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
}

.to-scheme-toggle__icon {
	display: none;
	line-height: 0;
}

.to-scheme-toggle__icon svg {
	width: 1.15rem;
	height: 1.15rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Show the icon for the scheme the button switches TO. */
:root[data-scheme="light"] .to-scheme-toggle__icon--moon,
:root[data-scheme="dark"] .to-scheme-toggle__icon--sun {
	display: inline-block;
}

/* ============================================================
   7. REDUCED MOTION
   ------------------------------------------------------------
   Not a courtesy. For some visitors this is the difference
   between a usable page and a headache.
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

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

	html.js .to-reveal,
	html.js .to-reveal-words .to-word {
		opacity: 1 !important;
		transform: none !important;
	}

	html.js .to-reveal-media {
		clip-path: none !important;
	}

	.to-parallax :where(img) {
		transform: none !important;
	}

	.to-marquee__track {
		animation: none !important;
	}
}


/* ------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------
   Widget groups need separation to read as separate lists —
   without it the whole column looks like one long ragged list.
   ------------------------------------------------------------ */

.wp-block-template-part .to-sidebar > * + *,
.to-sidebar > * + * {
	border-block-start: var(--wp--custom--stroke--hairline) solid var(--wp--preset--color--border);
	padding-block-start: var(--wp--preset--spacing--40);
}

.to-sidebar ul {
	list-style: none;
	padding-inline-start: 0;
	margin: 0;
}

.to-sidebar li {
	padding-block: 0.3em;
}

/* Category and archive counts recede behind the link they belong to. */
.to-sidebar .wp-block-categories li,
.to-sidebar .wp-block-archives li {
	color: var(--wp--preset--color--text-muted);
	font-size: var(--wp--preset--font-size--small);
}

/* Recent posts: title and date as one unit, not two loose lines. */
.to-sidebar .wp-block-latest-posts__list li {
	padding-block: var(--wp--preset--spacing--20);
}

.to-sidebar .wp-block-latest-posts__post-date {
	display: block;
	margin-block-start: 0.15em;
	font-family: var(--wp--preset--font-family--ui);
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--text-muted);
}

/* Tag cloud reuses the pill treatment from post terms. */
.to-sidebar .wp-block-tag-cloud a {
	display: inline-block;
	margin: 0 0.25em 0.45em 0;
	padding: 0.3em 0.75em;
	border: var(--wp--custom--stroke--hairline) solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	font-size: var(--wp--preset--font-size--x-small) !important;
	text-decoration: none;
	color: var(--wp--preset--color--text-muted);
	transition: color var(--wp--custom--duration--quick) var(--wp--custom--ease--base),
		border-color var(--wp--custom--duration--quick) var(--wp--custom--ease--base);
}

.to-sidebar .wp-block-tag-cloud a:hover {
	color: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
}

/* ============================================================
   POST NAVIGATION CARDS
   ------------------------------------------------------------
   Previous / next links rendered as pills carrying the
   neighbour's own image, blurred past recognition. The blur is
   the point: it reads as "somewhere else to go", carries the
   colour of that project, and never competes with the work
   above it. Markup comes from inc/post-navigation.php.
   ============================================================ */

.to-nav-card {
	position: relative;
	isolation: isolate;
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	max-width: min(100%, 34rem);
	padding: 1.9em 2.4em;
	border-radius: var(--wp--custom--radius--pill);
	/*
	 * No clip-path here on purpose: it would also clip the focus outline, which
	 * keyboard users need to see. The blurred image is clipped one level down,
	 * by .to-nav-card__frame.
	 */
	overflow: hidden;
	text-decoration: none;
	transition: transform var(--wp--custom--duration--base) var(--wp--custom--ease--out),
		box-shadow var(--wp--custom--duration--base) var(--wp--custom--ease--out);
}

/*
 * The label sits above the media layer. Uppercase and tracked out because at
 * this size a project title has to read as a destination, not as body text.
 */
.to-nav-card__label {
	position: relative;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	gap: 0.7em;
	font-family: var(--wp--preset--font-family--ui);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1.2;
	transition: transform var(--wp--custom--duration--base) var(--wp--custom--ease--out);
}

/*
 * The frame does the clipping and nothing else — see inc/post-navigation.php
 * for why the blur cannot be clipped by the card itself.
 */
.to-nav-card__frame {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--pill);
	/*
	 * Promote the frame itself. The blurred child is composited on its own
	 * layer, and a clip that lives only on a non-composited ancestor is not
	 * applied to it — the blurred rectangle then shows past the rounded corners.
	 * Giving the frame a layer of its own puts the rounded clip on the
	 * compositor, where the child can be clipped by it.
	 */
	transform: translateZ(0);
	isolation: isolate;
}

/*
 * scale(1.35) is not decoration: a blurred background sampled at its own size
 * shows translucent edges where the blur kernel runs past the element, and the
 * overscan hides them. Keep it above ~1.25 if the blur radius grows.
 */
.to-nav-card__media {
	position: absolute;
	inset: 0;
	background-position: center;
	background-size: cover;
	filter: blur(18px) saturate(1.35);
	transform: scale(1.35);
	transition: transform var(--wp--custom--duration--slow) var(--wp--custom--ease--out),
		filter var(--wp--custom--duration--slow) var(--wp--custom--ease--out);
	will-change: transform;
}

/*
 * Scrim: the neighbour's image can be any brightness, the label cannot.
 *
 * It lives inside the frame as a real element, not as a pseudo-element of the
 * card. As ::after on the card it painted past the rounded corners — a grey
 * rectangle around the pill — because the card's rounded overflow did not clip
 * it. Inside the frame, which clips its children, it follows the pill exactly.
 */
.to-nav-card__scrim {
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, rgba(10, 15, 19, 0.78), rgba(10, 15, 19, 0.42));
	transition: opacity var(--wp--custom--duration--base) var(--wp--custom--ease--base);
}

.to-nav-card--image .to-nav-card__label,
.to-nav-card--image .to-nav-card__label * {
	color: var(--wp--preset--color--light);
}

/*
 * No image: a neutral pill that still belongs to the page. Built from the
 * theme's own tokens, so it follows the active style variation and both
 * schemes instead of hard-coding a grey.
 */
.to-nav-card--plain {
	/*
	 * Mixed towards the dark end, not the surface: white type on a light grey
	 * pill measures about 3:1, which fails at this size. These stops keep the
	 * label above 6:1 in both schemes while still reading as neutral rather
	 * than as a second brand colour.
	 */
	background: linear-gradient(100deg,
		color-mix(in srgb, var(--wp--preset--color--text-muted) 80%, var(--wp--preset--color--dark)),
		color-mix(in srgb, var(--wp--preset--color--text-muted) 96%, var(--wp--preset--color--dark)));
}

.to-nav-card--plain .to-nav-card__label,
.to-nav-card--plain .to-nav-card__label * {
	color: var(--wp--preset--color--light);
}

:root[data-scheme="dark"] .to-nav-card--plain {
	background: linear-gradient(100deg,
		color-mix(in srgb, var(--wp--preset--color--text-muted) 55%, var(--wp--preset--color--dark)),
		color-mix(in srgb, var(--wp--preset--color--text-muted) 72%, var(--wp--preset--color--dark)));
}

/* The arrow core prints belongs to the label, and leads the movement. */
.to-nav-card .wp-block-post-navigation-link__arrow-previous,
.to-nav-card .wp-block-post-navigation-link__arrow-next {
	display: inline-block;
	transition: transform var(--wp--custom--duration--base) var(--wp--custom--ease--elastic);
}

/* Hover: the image drifts and opens up, the label leans towards its direction. */
.to-nav-card:hover .to-nav-card__media,
.to-nav-card:focus-visible .to-nav-card__media {
	transform: scale(1.55) rotate(2.5deg);
	filter: blur(22px) saturate(1.6);
}

.to-nav-card:hover,
.to-nav-card:focus-visible {
	transform: translateY(-2px);
	box-shadow: var(--wp--custom--shadow--md, 0 14px 34px rgba(10, 15, 19, 0.22));
}

.to-nav-card:hover .to-nav-card__scrim,
.to-nav-card:focus-visible .to-nav-card__scrim {
	opacity: 0.85;
}

.to-nav-card--next:hover .wp-block-post-navigation-link__arrow-next,
.to-nav-card--next:focus-visible .wp-block-post-navigation-link__arrow-next {
	transform: translateX(0.35em);
}

.to-nav-card--previous:hover .wp-block-post-navigation-link__arrow-previous,
.to-nav-card--previous:focus-visible .wp-block-post-navigation-link__arrow-previous {
	transform: translateX(-0.35em);
}

.to-nav-card--next:hover .to-nav-card__label,
.to-nav-card--next:focus-visible .to-nav-card__label {
	transform: translateX(0.15em);
}

.to-nav-card--previous:hover .to-nav-card__label,
.to-nav-card--previous:focus-visible .to-nav-card__label {
	transform: translateX(-0.15em);
}

.to-nav-card:focus-visible {
	outline: var(--wp--custom--stroke--thick) solid var(--wp--preset--color--accent);
	outline-offset: 3px;
}

/*
 * On narrow screens the two cards stack, and a pill that only fits half its
 * title is worse than a full-width one.
 */
@media (max-width: 781px) {
	.to-nav-card {
		max-width: 100%;
		width: 100%;
		justify-content: center;
		text-align: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.to-nav-card:hover .to-nav-card__media,
	.to-nav-card:focus-visible .to-nav-card__media {
		transform: scale(1.35);
		filter: blur(18px) saturate(1.35);
	}

	.to-nav-card:hover,
	.to-nav-card:focus-visible {
		transform: none;
	}
}
