/**
 * Mara Wonder — design system.
 *
 * Single source of truth for colour, type, spacing, motion and focus.
 * Everything else in the theme, the plugin and Elementor inherits from here,
 * so a brand change is edited once in this file.
 *
 * Contrast note: every colour pairing below was measured against WCAG 2.1.
 * The ratios are recorded next to each token. Do not introduce a pairing
 * that is not listed here without measuring it first.
 */

/* ==========================================================================
   1. Fonts — self-hosted, latin subset (covers English, Italian, Spanish)
   ========================================================================== */

@font-face {
	font-family: "Fredoka";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/fredoka-600.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
		U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Nunito";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/nunito-400.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
		U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Nunito";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/nunito-700.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
		U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Poiret One";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/poiret-400.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
		U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   2. Tokens
   ========================================================================== */

:root {
	/* --- Brand palette. Exact values from the character style guide. ----- */
	--numo-tan: #d69e72;    /* character body, primary accent — surface only */
	--numo-sky: #8bd4e3;    /* skies, calm backgrounds — surface only */
	--numo-rose: #f5c2c7;   /* soft details, gentle emotion — surface only */
	--numo-red: #e63946;    /* errors and strong states — surface and border */
	--numo-green: #a1cd7c;  /* meadows, nature — surface only */
	--numo-paper: #fffdf7;  /* page ground, warm white */
	--numo-ink: #3a2e28;    /* text and linework, dark brown — never pure black */

	/* Derived: #e63946 reaches only 4.10:1 on paper, which fails AA for body
	   text. This darker sibling reaches 5.38:1 and carries small error text. */
	--numo-red-deep: #c4303c;

	/* --- Semantic roles. Use these in components, not the raw palette. ---
	   Text is ALWAYS ink. Measured against every brand surface:
	     ink on paper 12.89:1 · on rose 8.38:1 · on sky 7.88:1
	     ink on green  7.21:1 · on tan  5.62:1 · on red  3.15:1 (large only)
	   The brand hues are surfaces, never letterforms: as text on paper they
	   land between 1.54:1 and 2.30:1. */
	--color-text: var(--numo-ink);
	--color-text-muted: #6b5a50;      /* 6.44:1 on paper — AA for body text */
	--color-bg: var(--numo-paper);
	--color-surface-warm: var(--numo-tan);
	--color-surface-cool: var(--numo-sky);
	--color-surface-soft: var(--numo-rose);
	--color-surface-leaf: var(--numo-green);
	--color-error-text: var(--numo-red-deep);
	--color-error-edge: var(--numo-red);

	/* Primary action. Tan ground with ink label = 5.62:1.
	   White on tan would be 2.30:1, so the label is never white. */
	--color-action-bg: var(--numo-tan);
	--color-action-text: var(--numo-ink);
	--color-action-bg-hover: #c78d5f;   /* ink on hover state 4.62:1 — AA */

	/* Focus ring is ink: tan (2.30:1), sky (1.64:1) and green (1.79:1) all
	   fall short of the 3:1 that non-text indicators require. */
	--color-focus: var(--numo-ink);

	--color-hairline: #e8ded0;

	/* --- Type ------------------------------------------------------------ */
	--font-display: "Fredoka", "Trebuchet MS", "Avenir Next", sans-serif;
	--font-body: "Nunito", "Avenir Next", "Segoe UI", system-ui, sans-serif;

	/* The signature. Poiret One ships a single weight and its strokes are
	   thin by design: use it large, for the name and for signature moments.
	   Never for a button label, never below the display sizes. */
	--font-signature: "Poiret One", "Didot", "Bodoni 72", serif;

	--weight-display: 600;
	--weight-body: 400;
	--weight-body-bold: 700;

	/* Type scale — fluid between 375px and 1440px viewports. */
	--step-small: clamp(0.8438rem, 0.8107rem + 0.1408vw, 0.9375rem);
	--step-0: clamp(1rem, 0.956rem + 0.1878vw, 1.125rem);
	--step-1: clamp(1.25rem, 1.162rem + 0.3756vw, 1.5rem);
	--step-2: clamp(1.5rem, 1.324rem + 0.7512vw, 2rem);
	--step-3: clamp(1.812rem, 1.482rem + 1.408vw, 2.75rem);
	--step-4: clamp(2.188rem, 1.637rem + 2.347vw, 3.75rem);
	--step-5: clamp(2.625rem, 1.789rem + 3.568vw, 5rem);

	--leading-tight: 1.15;
	--leading-snug: 1.35;
	--leading-body: 1.65;
	--tracking-display: -0.01em;

	/* Spacing scale — same fluid range, so rhythm scales with type. */
	--space-3xs: clamp(0.25rem, 0.228rem + 0.0939vw, 0.3125rem);
	--space-2xs: clamp(0.5rem, 0.456rem + 0.1878vw, 0.625rem);
	--space-xs: clamp(0.75rem, 0.684rem + 0.2817vw, 0.9375rem);
	--space-s: clamp(1rem, 0.912rem + 0.3756vw, 1.25rem);
	--space-m: clamp(1.5rem, 1.368rem + 0.5634vw, 1.875rem);
	--space-l: clamp(2rem, 1.824rem + 0.7512vw, 2.5rem);
	--space-xl: clamp(3rem, 2.736rem + 1.127vw, 3.75rem);
	--space-2xl: clamp(4rem, 3.648rem + 1.502vw, 5rem);
	--space-3xl: clamp(6rem, 5.472rem + 2.254vw, 7.5rem);

	/* --- Form ------------------------------------------------------------ */
	--radius-s: 0.5rem;
	--radius-m: 1rem;
	--radius-l: 1.75rem;
	--radius-pill: 999px;

	--measure: 34rem;          /* readable line length for body copy */
	--wrap: 68rem;             /* outer content width */
	--tap-target: 2.75rem;     /* 44px — minimum comfortable touch size */

	--shadow-soft: 0 2px 4px rgba(58, 46, 40, 0.06),
		0 8px 20px rgba(58, 46, 40, 0.08);

	/* --- Motion ----------------------------------------------------------- */
	--ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
	--duration-quick: 160ms;
	--duration-calm: 320ms;

	/* Colouring reveal. Scaled by the widget, overridden per instance. */
	--reveal-draw: 900ms;      /* outline drawing itself */
	--reveal-fill: 700ms;      /* colour washing in */
	--reveal-stagger: 55ms;    /* gap between successive shapes */
}

/* ==========================================================================
   3. Reset — minimal, only what a child theme genuinely needs to correct
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background-color: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--step-0);
	font-weight: var(--weight-body);
	line-height: var(--leading-body);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
	margin: 0 0 var(--space-s);
	font-family: var(--font-display);
	font-weight: var(--weight-display);
	line-height: var(--leading-tight);
	letter-spacing: var(--tracking-display);
	text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p {
	margin: 0 0 var(--space-s);
	text-wrap: pretty;
}

p, li {
	max-width: var(--measure);
}

img, svg, video {
	display: block;
	max-width: 100%;
	height: auto;
}

a {
	color: inherit;
	text-decoration-thickness: 0.08em;
	text-underline-offset: 0.18em;
}

button, input, select, textarea {
	font: inherit;
	color: inherit;
}

/* ==========================================================================
   4. Focus — visible on every interactive element, on every surface
   ========================================================================== */

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

/* Older engines without :focus-visible still get a ring rather than nothing. */
@supports not selector(:focus-visible) {
	:where(a, button, input, select, textarea, summary, [tabindex]):focus {
		outline: 3px solid var(--color-focus);
		outline-offset: 3px;
	}
}

/* On the two darkest surfaces an ink ring would disappear; invert it. */
:where(.numo-on-ink, .numo-on-red) :focus-visible {
	outline-color: var(--numo-paper);
}

/* ==========================================================================
   5. Reduced motion — the brief requires this everywhere, so it lives here
      rather than being re-declared by each component.
   ========================================================================== */

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

/* ==========================================================================
   6. Small shared utilities
   ========================================================================== */

.numo-wrap {
	width: min(100% - (2 * var(--space-m)), var(--wrap));
	margin-inline: auto;
}

/*
 * The wordmark. Lettering is outlined in the SVG, so Poiret One is never
 * loaded as a webfont — the signature costs zero kilobytes. The paths inherit
 * currentColor, so the logo is ink on paper by default and can be flipped to
 * paper on a full-bleed surface without a second file.
 */
.numo-logo {
	display: block;
	width: auto;
	height: 2.5rem;
	color: var(--numo-ink);
}

.numo-on-ink .numo-logo,
.numo-on-red .numo-logo {
	color: var(--numo-paper);
}

/*
 * Lifts the readable-measure cap. Body copy is held to --measure because a
 * line much past 70 characters is measurably harder to read. Some blocks are
 * meant to run the full width of their container anyway — a lede under a
 * hero, an editorial pull quote. Those get this class, and their type size
 * should go up to match: wide and small is the combination to avoid.
 */
.numo-wide,
.numo-wide p,
.numo-wide li {
	max-width: none;
}

.numo-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.numo-skip-link {
	position: absolute;
	left: var(--space-s);
	top: -4rem;
	z-index: 100;
	padding: var(--space-2xs) var(--space-s);
	background-color: var(--numo-paper);
	color: var(--numo-ink);
	border-radius: var(--radius-s);
	transition: top var(--duration-quick) var(--ease-soft);
}

.numo-skip-link:focus {
	top: var(--space-s);
}

/* ==========================================================================
   The signature in the header
   ==========================================================================
   The parent theme prints the site name as text, which the design system then
   sets in Fredoka. But the name is not a word to be typeset — it is the
   wordmark, drawn in Poiret One and already outlined in mara-logo.svg.

   The text stays in the document, so a screen reader still announces
   "Mara Wonder"; it is the mark that is shown. The SVG is used as a mask and
   painted with a brand colour, so the wordmark inherits ink and can be
   inverted on a dark surface — one file, both cases.

   Guarded by @supports: where masking is unavailable the plain text shows
   instead, which is plainer but never invisible.
   ========================================================================== */

@supports (mask-image: url("x.svg")) or (-webkit-mask-image: url("x.svg")) {

	.site-title a {
		display: block;
		width: clamp(8.5rem, 26vw, 13rem);
		aspect-ratio: 20609 / 4167;   /* the wordmark's own proportions */
		background-color: var(--numo-ink);
		-webkit-mask: url("../img/mara-logo.svg") no-repeat center / contain;
		mask: url("../img/mara-logo.svg") no-repeat center / contain;
		font-size: 0;
		color: transparent;
		text-decoration: none;
	}

	.site-title a:focus-visible {
		outline-offset: 6px;
	}

	.numo-on-ink .site-title a {
		background-color: var(--numo-paper);
	}
}
