/* Email Template Examples base: fonts, reset, type, components, logo, header, footer, cookie banner.
   Look: "Royal Original" brand book v1.0 (docs/brand/Royal-Original-Brand-Book.pdf). White space, one royal blue,
   light DM Sans headings, colorful email templates do the work. No gradients, glow, blur, textures or stamps.

   Tokens live in styles/tokens.css (loaded first, generated from docs/brand/tokens.json). Use them in every page:
   --color-*  page surface surface-tint surface-raised text text-muted border control-border primary primary-hover
              primary-active on-primary accent link focus success(-bg) warning(-bg) error(-bg) info(-bg)
              disabled-bg disabled-text overlay
   --font-display / --font-body (DM Sans) / --font-mono (IBM Plex Mono, code only)
   --font-size-{role} --font-weight-{role} --line-height-{role} --letter-spacing-{role}
              roles: display h1 h2 h3 h4 lead body small caption label code
   --space-0..10 (0 4 8 12 16 24 32 48 64 96 128)   --radius-pill control card tooltip dropdown toast modal panel canvas
   --shadow-card raised modal   --motion-duration-fast base exit story, --motion-ease
   --page-gutter --grid-columns --grid-gap --section-padding --gallery-columns --blog-columns --panel-padding
   --header-height --page-max, and here: --page-inline (gutter that also caps content at 1600px) */

/* ---------------------------------------------------------------------
 * Fonts: self-hosted, OFL, Latin subset (licenses: fonts/OFL-*.txt).
 * DM Sans is one variable file (weights 300-600, optical size axis kept).
 * ------------------------------------------------------------------ */
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-Variable.woff2') format('woff2'); font-weight: 300 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/IBMPlexMono-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
/* Fallbacks sized to the real fonts (measured from the font files against Arial / Consolas), so the swap moves almost nothing (CLS).
   Light 300 headings are narrower than regular text, so they get their own size-adjust. */
@font-face { font-family: 'DM Sans Fallback'; src: local('Arial'), local('ArialMT'); font-weight: 300; size-adjust: 90.7%; ascent-override: 109.4%; descent-override: 34.2%; line-gap-override: 0%; }
@font-face { font-family: 'DM Sans Fallback'; src: local('Arial'), local('ArialMT'); font-weight: 400 700; size-adjust: 103.2%; ascent-override: 96.1%; descent-override: 30%; line-gap-override: 0%; }
@font-face { font-family: 'IBM Plex Mono Fallback'; src: local('Consolas'); size-adjust: 109.1%; ascent-override: 93.9%; descent-override: 25.2%; line-gap-override: 0%; }

:root {
	/* Side padding that keeps content inside the 1600px page max (book p08). Use it as padding-inline on full-width bands. */
	--page-inline: max(var(--page-gutter), calc((100% - var(--page-max)) / 2 + var(--page-gutter)));
	/* Reading measures (book p07) */
	--measure-hero: 18ch;
	--measure-heading: 22ch;
	--measure-body: 70ch;
	/* Blue bands always pair #1D4ED8 with #FFFFFF (book p04), in both themes. */
	--band-blue: #1D4ED8;
	--on-band-blue: #FFFFFF;
	/* Danger button: error fill + white text (book p13, light theme). */
	--danger-bg: var(--color-error);
	--danger-text: #FFFFFF;
	/* Checkbox tick, colored like on-primary */
	--check-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------------
 * Reset + type (book p07)
 * ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
	font-family: var(--font-body);
	font-size: var(--font-size-body);
	font-weight: var(--font-weight-body);
	line-height: var(--line-height-body);
	color: var(--color-text);
	background: var(--color-page);
	overflow-x: clip;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
/* Email previews keep their own colors and light scheme (their own light/dark toggle is separate). */
iframe { color-scheme: light; }
a { color: var(--color-link); text-decoration-line: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
@media (hover: hover) { a:hover { color: var(--color-primary-hover); text-decoration-thickness: 2px; } }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
b, strong { font-weight: 600; }
h1, h2, h3, h4 { font-family: var(--font-display); text-wrap: balance; overflow-wrap: break-word; }
h1 { font-size: var(--font-size-h1); font-weight: var(--font-weight-h1); line-height: var(--line-height-h1); letter-spacing: var(--letter-spacing-h1); }
h2 { font-size: var(--font-size-h2); font-weight: var(--font-weight-h2); line-height: var(--line-height-h2); letter-spacing: var(--letter-spacing-h2); }
h3 { font-size: var(--font-size-h3); font-weight: var(--font-weight-h3); line-height: var(--line-height-h3); letter-spacing: var(--letter-spacing-h3); }
h4 { font-size: var(--font-size-h4); font-weight: var(--font-weight-h4); line-height: var(--line-height-h4); letter-spacing: var(--letter-spacing-h4); }
p { text-wrap: pretty; }
small { font-size: var(--font-size-small); line-height: var(--line-height-small); }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: var(--font-size-code); line-height: var(--line-height-code); font-weight: 400; }
ul[class], ol[class] { list-style: none; padding: 0; }
::selection { background: var(--color-primary); color: var(--color-on-primary); }

/* Type helpers. Display is for the homepage and major campaign headlines only. */
.t-display { font-size: var(--font-size-display); font-weight: var(--font-weight-display); line-height: var(--line-height-display); letter-spacing: var(--letter-spacing-display); }
.t-h1 { font-size: var(--font-size-h1); font-weight: var(--font-weight-h1); line-height: var(--line-height-h1); letter-spacing: var(--letter-spacing-h1); }
.t-h2 { font-size: var(--font-size-h2); font-weight: var(--font-weight-h2); line-height: var(--line-height-h2); letter-spacing: var(--letter-spacing-h2); }
.t-h3 { font-size: var(--font-size-h3); font-weight: var(--font-weight-h3); line-height: var(--line-height-h3); letter-spacing: var(--letter-spacing-h3); }
.t-h4 { font-size: var(--font-size-h4); font-weight: var(--font-weight-h4); line-height: var(--line-height-h4); letter-spacing: var(--letter-spacing-h4); }
.t-lead { font-size: var(--font-size-lead); font-weight: var(--font-weight-lead); line-height: var(--line-height-lead); }
.t-small { font-size: var(--font-size-small); line-height: var(--line-height-small); }
.t-muted { color: var(--color-text-muted); }
/* Measures (book p07): 18ch centered hero heading, 22ch other headings, 55-75ch body. */
.measure-hero { max-width: var(--measure-hero); }
.measure-heading { max-width: var(--measure-heading); }
.measure-body { max-width: var(--measure-body); }
/* Full-width band with content kept inside the page max. */
.page-wrap { padding-inline: var(--page-inline); }

/* ---------------------------------------------------------------------
 * Focus (book p06, p12): 3px ring, 3px offset, surface halo in the gap so it shows on blue too.
 * ------------------------------------------------------------------ */
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; box-shadow: 0 0 0 3px var(--color-surface); }
/* On royal-blue bands: a white ring on the blue. */
.band--blue :focus-visible { outline-color: var(--on-band-blue); box-shadow: none; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link {
	position: absolute; left: 12px; top: -80px; z-index: 100;
	display: inline-flex; align-items: center; min-height: 48px; padding: 0 20px;
	background: var(--color-primary); color: var(--color-on-primary); border-radius: var(--radius-control);
	font-weight: var(--font-weight-label); text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--color-on-primary); }

/* Icons: Lucide outline, 24px box, 1.75 stroke (set on the svg). Inherit the text color. */
.icon { width: 24px; height: 24px; flex: none; }

/* Royal-blue band: always #1D4ED8 with white text (book p04). */
.band--blue { background: var(--band-blue); color: var(--on-band-blue); }
.band--blue a:not(.btn) { color: var(--on-band-blue); }

/* Old accent word (Fraunces italic in v2): now plain DM Sans in primary blue. */
.accent { font-family: var(--font-display); font-style: normal; color: var(--color-primary); }

/* Small blue label above headings (concept p22). Book: labels stay 16px, no all-caps paragraphs. */
.eyebrow {
	display: inline-block;
	font-family: var(--font-body); font-size: var(--font-size-label); font-weight: var(--font-weight-label);
	line-height: var(--line-height-label); letter-spacing: var(--letter-spacing-label);
	text-transform: uppercase; color: var(--color-primary);
}

/* ---------------------------------------------------------------------
 * Buttons (book p13). Sizes: --sm 44px / default 48px / --lg 56px. Label type, 8px icon gap, 8px radius.
 * Old modifiers keep working: --ghost = secondary, --stamp = primary, --lg = large.
 * Color changes at once; only transform moves (press scale .98).
 * ------------------------------------------------------------------ */
.btn {
	position: relative;
	display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
	min-height: 48px; padding: 0 20px;
	font-family: var(--font-body); font-size: var(--font-size-label); font-weight: var(--font-weight-label);
	line-height: var(--line-height-label); letter-spacing: var(--letter-spacing-label);
	text-decoration: none; text-align: center; white-space: nowrap; cursor: pointer;
	color: var(--color-primary); background: var(--color-surface);
	border: 1px solid var(--color-primary); border-radius: var(--radius-control);
	transition: transform var(--motion-duration-fast) var(--motion-ease);
	-webkit-tap-highlight-color: transparent;
}
.btn .icon { width: 20px; height: 20px; }
.btn:active { transform: scale(.98); }

.btn--primary, .btn--stamp { color: var(--color-on-primary); background: var(--color-primary); border-color: var(--color-primary); }
.btn--primary:active, .btn--stamp:active { background: var(--color-primary-active); border-color: var(--color-primary-active); }

.btn--secondary, .btn--ghost { color: var(--color-primary); background: var(--color-surface); border-color: var(--color-primary); }
.btn--secondary:active, .btn--ghost:active { background: var(--color-info-bg); }

.btn--quiet, .btn--text { color: var(--color-link); background: transparent; border-color: transparent; }
.btn--quiet:active, .btn--text:active { color: var(--color-primary-active); }

.btn--danger { color: var(--danger-text); background: var(--danger-bg); border-color: var(--color-error); }
.btn--danger:active { box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-error); }

@media (hover: hover) {
	.btn:hover { color: var(--color-primary); background: var(--color-surface-tint); }
	.btn--primary:hover, .btn--stamp:hover { color: var(--color-on-primary); background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
	.btn--quiet:hover, .btn--text:hover { color: var(--color-link); background: transparent; text-decoration: underline; text-underline-offset: .2em; }
	.btn--danger:hover { color: var(--danger-text); background: var(--danger-bg); box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-error); }
}

/* Buttons on royal-blue bands (.band--blue): white fill with blue text, or white outline. */
.btn--on-blue { color: var(--band-blue); background: var(--on-band-blue); border-color: var(--on-band-blue); }
.btn--on-blue-outline { color: var(--on-band-blue); background: transparent; border-color: var(--on-band-blue); }
@media (hover: hover) {
	.btn--on-blue:hover { color: var(--color-primary-hover); background: var(--color-surface-tint); border-color: var(--color-surface-tint); }
	.btn--on-blue-outline:hover { color: var(--on-band-blue); background: var(--color-primary-hover); }
}
.btn--on-blue:active { background: var(--color-info-bg); }
.btn--on-blue-outline:active { background: var(--color-primary-active); }

.btn--sm { min-height: 44px; padding: 0 16px; }
.btn--lg { min-height: 56px; padding: 0 24px; }
.btn--block { display: flex; width: 100%; }
.btn--icon { width: 44px; min-height: 44px; padding: 0; }
.btn--icon.btn--lg { width: 56px; }

/* Disabled and loading suppress hover and press (book p12). Loading keeps the variant colors and width. */
.btn:disabled, .btn[aria-disabled="true"], .btn.is-disabled {
	color: var(--color-disabled-text); background: var(--color-disabled-bg); border-color: var(--color-disabled-bg);
	cursor: not-allowed; transform: none; box-shadow: none; text-decoration: none;
}
.btn[aria-busy="true"], .btn.is-loading { cursor: progress; pointer-events: none; transform: none; }

/* 16px spinner for loading states: put <span class="spinner" aria-hidden="true"></span> before the verb. */
.spinner {
	display: inline-block; width: 16px; height: 16px; flex: none;
	border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
	animation: ete-spin .8s linear infinite;
}
@keyframes ete-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------
 * Form fields (book p14): 48px, 12px padding, 8px radius, control-border. Label above, helper below.
 * Markup: <div class="field"><label>..</label><input class="input"><p class="field__hint">..</p></div>
 * ------------------------------------------------------------------ */
.field { display: grid; gap: var(--space-2); align-content: start; }
.field > label, .field__label { font-size: var(--font-size-label); font-weight: var(--font-weight-label); line-height: var(--line-height-label); color: var(--color-text); }
.input, .select, .textarea,
.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), .field select, .field textarea {
	display: block; width: 100%; min-height: 48px; padding: 0 12px;
	font-size: var(--font-size-body); line-height: 1.4; color: var(--color-text);
	background: var(--color-surface); border: 1px solid var(--color-control-border); border-radius: var(--radius-control);
	-webkit-appearance: none; appearance: none;
}
.textarea, .field textarea { min-height: 144px; padding: 12px; resize: vertical; line-height: var(--line-height-body); }
.select, .field select {
	padding-right: 44px; cursor: pointer;
	/* The same chevron as every other menu (Lucide chevron-down). */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-position: right 12px center; background-size: 20px 20px; background-repeat: no-repeat;
}
::placeholder { color: var(--color-text-muted); opacity: 1; }
/* Keyboard users: the sticky header never covers the focused field. */
input, select, textarea, button, summary { scroll-margin-top: calc(var(--header-height) + 16px); }
.admin-bar input, .admin-bar select, .admin-bar textarea, .admin-bar button { scroll-margin-top: calc(var(--header-height) + 48px); }
@media (hover: hover) {
	.input:hover, .select:hover, .textarea:hover,
	.field input:not([type="checkbox"]):not([type="radio"]):hover, .field select:hover, .field textarea:hover { border-color: var(--color-text); }
}
/* Invalid: 2px error border (the inset shadow adds the second pixel, so the field does not move). */
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"], .field [aria-invalid="true"] {
	border-color: var(--color-error); box-shadow: inset 0 0 0 1px var(--color-error);
}
.input[aria-invalid="true"]:focus-visible, .field [aria-invalid="true"]:focus-visible { box-shadow: inset 0 0 0 1px var(--color-error), 0 0 0 3px var(--color-surface); }
.input:disabled, .select:disabled, .textarea:disabled, .field :disabled { color: var(--color-disabled-text); background-color: var(--color-disabled-bg); border-color: var(--color-disabled-bg); cursor: not-allowed; }
.field__hint { font-size: var(--font-size-small); line-height: var(--line-height-small); color: var(--color-text-muted); }
/* Error: ink + icon + text, never color alone (book p12). */
.field__error { display: flex; gap: var(--space-2); align-items: flex-start; font-size: var(--font-size-small); line-height: var(--line-height-small); color: var(--color-error); }
.field__error:not(:empty)::before {
	content: ''; width: 20px; height: 20px; flex: none; margin-top: 1px; background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}
.field__error[hidden] { display: none; }

/* Checkbox: 20px square inside a 44px label target, 2px control-border, checked = primary fill. */
.check { display: inline-flex; align-items: center; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.check input[type="checkbox"], input.checkbox {
	-webkit-appearance: none; appearance: none; flex: none; width: 20px; height: 20px; margin: 0; cursor: pointer;
	background: var(--color-surface) center / 14px no-repeat; border: 2px solid var(--color-control-border); border-radius: 4px;
}
.check input[type="checkbox"]:checked, input.checkbox:checked { background-color: var(--color-primary); background-image: var(--check-tick); border-color: var(--color-primary); }
.check input[type="checkbox"]:disabled, input.checkbox:disabled { background-color: var(--color-disabled-bg); border-color: var(--color-disabled-bg); cursor: not-allowed; }

/* Toggle: 44px target, 40x24 track, 20px thumb. Show the text Off / On next to it.
   Markup: <label class="toggle"><input type="checkbox" role="switch"><span class="toggle__track" aria-hidden="true"></span><span>Off</span></label> */
.toggle { position: relative; display: inline-flex; align-items: center; gap: var(--space-3); min-height: 44px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 40px; height: 24px; margin: 0; cursor: pointer; }
.toggle__track { position: relative; flex: none; width: 40px; height: 24px; border-radius: var(--radius-pill); background: var(--color-control-border); }
.toggle__track::after {
	content: ''; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%;
	background: var(--color-surface); transition: transform var(--motion-duration-fast) var(--motion-ease);
}
.toggle input:checked + .toggle__track { background: var(--color-primary); }
.toggle input:checked + .toggle__track::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle__track { outline: 3px solid var(--color-focus); outline-offset: 3px; box-shadow: 0 0 0 3px var(--color-surface); }
.toggle input:disabled + .toggle__track { background: var(--color-disabled-bg); }

/* ---------------------------------------------------------------------
 * Chips, badges, tabs (book p09, p13, p15)
 * ------------------------------------------------------------------ */
/* Tag (read-only): pill, no border. */
.chip {
	display: inline-flex; align-items: center; gap: var(--space-2);
	padding: 4px 12px; border-radius: var(--radius-pill);
	font-size: var(--font-size-small); line-height: var(--line-height-label); font-weight: 400;
	color: var(--color-text); background: var(--color-surface-tint);
}
/* Filter chip (interactive): 44px, 1px control-border; selected = primary fill. */
a.chip, button.chip, .chip--filter {
	min-height: 44px; padding: 0 16px; text-decoration: none; cursor: pointer;
	background: var(--color-surface); border: 1px solid var(--color-control-border);
	transition: transform var(--motion-duration-fast) var(--motion-ease);
}
a.chip:active, button.chip:active { transform: scale(.98); }
@media (hover: hover) { a.chip:hover, button.chip:hover { color: var(--color-text); border-color: var(--color-text); } }
.chip[aria-pressed="true"], .chip[aria-selected="true"], .chip[aria-current], .chip.is-active,
.chip[aria-pressed="true"]:hover, .chip[aria-current]:hover, .chip.is-active:hover { color: var(--color-on-primary); background: var(--color-primary); border-color: var(--color-primary); }

/* Badge (read-only): 16px text, 4px / 8px padding. Draft muted, Shared info, Coming soon warning. */
.badge {
	display: inline-flex; align-items: center; gap: var(--space-1);
	padding: 4px 8px; border-radius: var(--radius-pill);
	font-size: var(--font-size-small); font-weight: var(--font-weight-label); line-height: var(--line-height-label);
	color: var(--color-text-muted); background: var(--color-disabled-bg);
}
.badge--draft { color: var(--color-text-muted); background: var(--color-disabled-bg); }
.badge--shared, .badge--info { color: var(--color-info); background: var(--color-info-bg); }
.badge--soon, .badge--warning { color: var(--color-warning); background: var(--color-warning-bg); }
.badge--success { color: var(--color-success); background: var(--color-success-bg); }
.badge--error { color: var(--color-error); background: var(--color-error-bg); }
.badge--primary { color: var(--color-on-primary); background: var(--color-primary); }

/* Tabs: 48px, 2px primary underline on the selected tab. Markup: role="tablist" > role="tab" aria-selected. */
.tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--color-border); overflow-x: auto; scrollbar-width: none; }
.tab {
	display: inline-flex; align-items: center; gap: var(--space-2); min-height: 48px; padding: 0 16px;
	font-size: var(--font-size-label); font-weight: var(--font-weight-label); color: var(--color-text-muted);
	background: none; border: 0; border-radius: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
	box-shadow: inset 0 -2px 0 transparent;
}
@media (hover: hover) { .tab:hover { color: var(--color-text); } }
.tab[aria-selected="true"], .tab.is-active, .tab[aria-current] { color: var(--color-primary); box-shadow: inset 0 -2px 0 var(--color-primary); }
.tab:focus-visible { outline-offset: -3px; box-shadow: inset 0 -2px 0 var(--color-primary); }

/* Accordion (book p15): 56px trigger, full row, 18px title, 16px body with 16px bottom space. No height animation.
   Markup: <details class="accordion__item"><summary class="accordion__trigger">..</summary><div class="accordion__body">..</div></details> */
.accordion { border-top: 1px solid var(--color-border); }
.accordion__item { border-bottom: 1px solid var(--color-border); }
.accordion__trigger {
	display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
	min-height: 56px; padding: 12px 0; cursor: pointer; list-style: none;
	font-size: 18px; font-weight: var(--font-weight-label); line-height: 1.35; color: var(--color-text);
}
.accordion__trigger::-webkit-details-marker { display: none; }
.accordion__trigger::after {
	content: ''; flex: none; width: 10px; height: 10px; margin-right: 6px;
	border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor;
	transform: translateY(-3px) rotate(45deg); transition: transform var(--motion-duration-base) var(--motion-ease);
}
.accordion__item[open] > .accordion__trigger::after { transform: translateY(2px) rotate(-135deg); }
.accordion__body { padding-bottom: var(--space-4); color: var(--color-text-muted); }

/* Breadcrumb, one style everywhere (book p13): 16px, 8px gaps, a small chevron, last item plain text. Wraps on phones.
   Links are 44px tall to tap; the list takes the extra height back, so it reads as one line of text. */
.crumbs ol { list-style: none; padding: 0; margin-block: -8px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-2); font-size: var(--font-size-small); line-height: var(--line-height-small); color: var(--color-text-muted); }
.crumbs li { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
.crumbs li + li::before {
	content: ''; flex: none; width: 7px; height: 7px; margin-right: 2px;
	border-right: 1.5px solid currentColor; border-top: 1.5px solid currentColor; transform: rotate(45deg);
}
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; color: var(--color-text-muted); text-decoration: none; }
@media (hover: hover) { .crumbs a:hover { color: var(--color-link); text-decoration: underline; } }
.crumbs [aria-current] { color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(48ch, 60vw); }

/* ---------------------------------------------------------------------
 * Feedback + overlays (book p15): toast, tooltip, modal, skeleton
 * ------------------------------------------------------------------ */
/* Toasts sit above the cookie banner and below dialogs. */
.toast-region { position: fixed; z-index: 1000000; right: var(--space-5); bottom: var(--space-5); left: auto; display: grid; gap: var(--space-3); justify-items: end; pointer-events: none; }
.toast {
	display: flex; align-items: flex-start; gap: var(--space-3);
	width: min(360px, calc(100vw - 24px)); padding: var(--space-4);
	color: var(--color-text); background: var(--color-surface-raised);
	border: 1px solid var(--color-border); border-radius: var(--radius-toast); box-shadow: var(--shadow-raised);
	pointer-events: auto; animation: ete-in var(--motion-duration-base) var(--motion-ease);
}
.toast--success { color: var(--color-success); background: var(--color-success-bg); border-color: transparent; }
.toast--error { color: var(--color-error); background: var(--color-error-bg); border-color: transparent; }
@media (max-width: 767px) { .toast-region { right: 12px; left: 12px; bottom: 12px; justify-items: stretch; } }

/* Tooltip: max 240px, 8px padding, 4px radius. Shows on hover and focus, never holds essential instructions. */
.tooltip, [role="tooltip"].tooltip {
	max-width: 240px; padding: var(--space-2); border-radius: var(--radius-tooltip);
	font-size: var(--font-size-small); line-height: var(--line-height-small);
	color: var(--color-page); background: var(--color-text);
}
.has-tooltip { position: relative; }
.has-tooltip > .tooltip {
	position: absolute; z-index: 70; left: 50%; bottom: calc(100% + 8px); width: max-content;
	opacity: 0; pointer-events: none; transform: translate(-50%, 4px);
	transition: opacity var(--motion-duration-exit) var(--motion-ease), transform var(--motion-duration-exit) var(--motion-ease);
}
.has-tooltip:hover > .tooltip, .has-tooltip:focus-within > .tooltip {
	opacity: 1; transform: translate(-50%, 0);
	transition-duration: var(--motion-duration-base);
}

/* Modal: <dialog class="modal">. 560px max, 32px padding (24px phone), 20px radius, overlay token. */
.modal {
	width: min(560px, calc(100% - 48px)); max-height: calc(100dvh - 48px); margin: auto; padding: var(--space-6);
	color: var(--color-text); background: var(--color-surface-raised);
	border: 0; border-radius: var(--radius-modal); box-shadow: var(--shadow-modal);
}
.modal::backdrop { background: var(--color-overlay); }
.modal[open] { animation: ete-in var(--motion-duration-base) var(--motion-ease); }
.modal__close-form { position: absolute; top: var(--space-3); right: var(--space-3); }
.modal__close { color: var(--color-text); }
.modal__title { font-size: var(--font-size-h4); font-weight: var(--font-weight-h4); line-height: var(--line-height-h4); letter-spacing: var(--letter-spacing-h4); }
.modal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-5); }
@media (max-width: 767px) {
	.modal { padding: var(--space-5); }
	.modal__actions { flex-direction: column-reverse; }
	.modal__actions .btn { width: 100%; }
}

/* Skeleton: static neutral block; add --pulse for an opacity pulse (static with reduced motion). */
.skeleton { display: block; min-height: 16px; border-radius: var(--radius-control); background: var(--color-disabled-bg); }
.skeleton--pulse { animation: ete-pulse var(--motion-duration-story) var(--motion-ease) infinite alternate; }

/* Callouts / inline status (success, error, info, warning) */
.notice { padding: var(--space-4) var(--space-5); border-radius: var(--radius-card); color: var(--color-info); background: var(--color-info-bg); }
.notice--success { color: var(--color-success); background: var(--color-success-bg); }
.notice--error { color: var(--color-error); background: var(--color-error-bg); }
.notice--warning { color: var(--color-warning); background: var(--color-warning-bg); }

/* Menus, modals, toasts enter with opacity 0 to 1 and translateY 8px to 0 (book p11). */
@keyframes ete-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes ete-pulse { from { opacity: 1; } to { opacity: .55; } }

/* ---------------------------------------------------------------------
 * Logo: open-envelope mark from the homepage concept (owner choice over the book's closed rectangle),
 * three flat blues with white seams, + "Email Template / Examples" on two left-aligned lines in DM Sans (David
 * 2026-10-30). The logo never moves: no hover or focus animation, keyboard focus shows the normal focus ring.
 * ------------------------------------------------------------------ */
.site-logo {
	display: inline-flex; align-items: center; gap: 12px; min-height: 44px;
	color: var(--color-text); text-decoration: none;
}
.site-logo:hover { color: var(--color-text); }
.site-header .site-logo { justify-self: start; }
.logo-mark { width: 48px; height: 32px; flex: none; }
.site-logo__word {
	display: grid; justify-items: start;
	font-family: var(--font-display); font-size: 17px; font-weight: 600; line-height: 1.12; letter-spacing: -0.25px;
	white-space: nowrap;
}
/* On royal-blue bands the wordmark turns white. */
.band--blue .site-logo, .site-logo--on-blue { color: #FFFFFF; }
/* Below 280px of room the lockup becomes the icon only; the link keeps its full accessible name. */
@media (max-width: 359px) { .site-header .site-logo__word { display: none; } }

/* ---------------------------------------------------------------------
 * Header (book p16): sticky, opaque surface, 1px bottom border, 80px (64px phone). Logo left, nav centered,
 * account actions right. At 1024px and below the nav moves into a menu panel below the header.
 * ------------------------------------------------------------------ */
.site-header {
	position: sticky; top: 0; z-index: 50;
	display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-4);
	height: var(--header-height); padding-inline: var(--page-inline);
	background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
@media (min-width: 783px) { .admin-bar .site-header { top: 32px; } }
@media (min-width: 601px) and (max-width: 782px) { .admin-bar .site-header { top: 46px; } }

.nav-toggle {
	display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
	color: var(--color-text); background: transparent; border: 1px solid var(--color-control-border); border-radius: var(--radius-control);
	cursor: pointer;
}
@media (hover: hover) { .nav-toggle:hover { border-color: var(--color-text); } }
.nav-toggle .icon { width: 24px; height: 24px; }
.nav-toggle__close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__close { display: block; }
.nav-toggle--nojs { display: none; }

/* Menu panel: fills the viewport below the header. Opacity + 8px rise in 250ms, out in 150ms, no heavy slide. */
.site-nav {
	position: fixed; z-index: 49; left: 0; right: 0; top: var(--header-height); bottom: 0;
	display: flex; flex-direction: column; gap: var(--space-5);
	padding: var(--space-4) var(--page-gutter) var(--space-6);
	overflow-y: auto; overscroll-behavior: contain;
	background: var(--color-surface);
	opacity: 0; transform: translateY(8px); visibility: hidden;
	transition: opacity var(--motion-duration-exit) var(--motion-ease), transform var(--motion-duration-exit) var(--motion-ease), visibility 0s linear var(--motion-duration-exit);
}
.admin-bar .site-nav { top: calc(var(--header-height) + 46px); }
@media (min-width: 783px) { .admin-bar .site-nav { top: calc(var(--header-height) + 32px); } }
.site-nav.is-open, .site-nav:target {
	opacity: 1; transform: none; visibility: visible;
	transition: opacity var(--motion-duration-base) var(--motion-ease), transform var(--motion-duration-base) var(--motion-ease);
}
/* Lock the page on html only: overflow on body too would make body the scroll box, and the sticky header would stay at
   the top of the document, above the screen, when the menu opens after scrolling. */
html:has(body.nav-open) { overflow: hidden; }
/* No JS: the menu button is a link to #site-nav, and :target opens the panel. */
html:not(.js) .nav-toggle:not(.nav-toggle--nojs) { display: none; }
html:not(.js) .nav-toggle--nojs { display: inline-grid; }

.site-nav__list { display: grid; }
.site-nav__list a {
	display: flex; align-items: center; min-height: 56px;
	font-size: var(--font-size-lead); font-weight: 400; color: var(--color-text); text-decoration: none;
	border-bottom: 1px solid var(--color-border);
}
@media (hover: hover) { .site-nav__list a:hover { color: var(--color-primary); } }
/* Current route: primary text + underline. */
.site-nav__list .current-menu-item > a, .site-nav__list a[aria-current="page"] {
	color: var(--color-primary); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px;
}
.site-nav__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.site-nav__actions .btn { min-height: 48px; }
.site-nav__actions .btn--quiet { color: var(--color-primary); border-color: var(--color-primary); }
.site-nav__actions .btn[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.site-nav__actions .site-nav__wl, .site-nav__actions > .btn--primary:has(.icon) { grid-column: 1 / -1; }

@media (min-width: 1025px) {
	.nav-toggle, html:not(.js) .nav-toggle--nojs { display: none; }
	/* Three columns: logo | centered nav | actions. The nav spans the last two through subgrid. */
	.site-header { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--space-6); }
	.site-nav {
		position: static; grid-column: 2 / 4; display: grid; grid-template-columns: subgrid; align-items: center;
		padding: 0; overflow: visible; background: none;
		opacity: 1; transform: none; visibility: visible; transition: none;
	}
	.site-nav__list { display: flex; align-items: center; gap: var(--space-1); }
	.site-nav__list a {
		min-height: 44px; padding: 0 12px; border: 0;
		font-size: var(--font-size-label); font-weight: var(--font-weight-label); line-height: var(--line-height-label);
	}
	.site-nav__actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); }
	.site-nav__actions .btn { min-height: 44px; padding: 0 16px; }
	.site-nav__actions .btn--quiet { color: var(--color-link); border-color: transparent; }
	.site-nav__actions .site-nav__wl { display: none; }
}
/* Logged in, the actions (My templates, Create template, account) are wider than Log in / Sign up: below 1600px the
   account button shows the avatar only, and below 1600px "My templates" lives in the account menu, so the actions
   never run into the centered nav. */
@media (min-width: 1025px) and (max-width: 1599px) {
	.site-nav__actions .acct-menu__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (min-width: 1025px) and (max-width: 1599px) {
	.site-nav__actions .site-nav__my { display: none; }
	/* "Create custom template" is long: the nav gives up exact centering here, so nothing touches. */
	.logged-in .site-header { grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-4); }
/* Five menu links: they stay on one line, with tighter spacing on small laptops. */
@media (min-width: 1025px) {
	.site-nav__list a { white-space: nowrap; }
}
@media (min-width: 1025px) and (max-width: 1199px) {
	.site-nav__list a { padding: 0 8px; }
	.site-nav__actions .btn { padding: 0 12px; }
	.site-header { gap: var(--space-3); }
}

	.logged-in .site-nav__list { justify-self: center; }
}

/* ---------------------------------------------------------------------
 * Footer (book p16): tinted surface, 64px vertical padding (40px phone). Brand + promise, Templates,
 * Company and Legal columns, copyright. Columns stack in reading order on phones.
 * ------------------------------------------------------------------ */
.site-footer { background: var(--color-surface-tint); color: var(--color-text); border-top: 1px solid var(--color-border); }
.site-footer__top {
	display: grid; gap: var(--space-6) var(--grid-gap); grid-template-columns: minmax(0, 1fr);
	padding: 40px var(--page-inline) var(--space-6);
}
.site-footer__brand { display: grid; gap: var(--space-4); align-content: start; justify-items: start; }
.site-footer__brand p { max-width: 40ch; color: var(--color-text-muted); }
.site-footer__title { font-family: var(--font-body); font-size: var(--font-size-label); font-weight: 600; line-height: var(--line-height-label); letter-spacing: 0; color: var(--color-text); margin-bottom: var(--space-2); }
.site-footer__col ul { list-style: none; padding: 0; display: grid; }
.site-footer__col a { display: inline-flex; align-items: center; min-height: 44px; color: var(--color-text-muted); text-decoration: none; }
@media (hover: hover) { .site-footer__col a:hover { color: var(--color-primary); text-decoration: underline; } }
.site-footer__bottom {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4) var(--space-5);
	padding: var(--space-5) var(--page-inline) 40px; border-top: 1px solid var(--color-border);
	font-size: var(--font-size-small); color: var(--color-text-muted);
}
@media (min-width: 560px) {
	.site-footer__top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.site-footer__brand { grid-column: 1 / -1; }
}
@media (min-width: 768px) {
	.site-footer__top { padding-top: var(--space-8); }
	.site-footer__bottom { padding-bottom: var(--space-8); }
}
@media (min-width: 1024px) {
	.site-footer__top { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); }
	.site-footer__brand { grid-column: auto; }
}

/* ---------------------------------------------------------------------
 * Cookie banner (Complianz): a slim bar along the bottom edge. Title "Cookies", one or two short lines, Accept / Deny /
 * Preferences with equal weight. The words are set in functions.php; buttons, categories and consent logic are Complianz's.
 * The page keeps room for the bar, so it never covers a button at the end of a page.
 * The id in each selector beats the plugin CSS that loads after this file.
 * ------------------------------------------------------------------ */
body {
	--cmplz_banner_background_color: var(--color-surface-raised);
	--cmplz_text_color: var(--color-text);
	--cmplz_hyperlink_color: var(--color-link);
	--cmplz_text_font_size: 16px;
	--cmplz_link_font_size: 16px;
	--cmplz_category_body_font_size: 16px;
	--cmplz_title_font_size: 18px;
	--cmplz_slider_active_color: var(--color-primary);
	--cmplz_slider_inactive_color: var(--color-control-border);
	--cmplz_slider_bullet_color: var(--color-surface);
	--cmplz_category_header_always_active_color: var(--color-success);
	--cmplz_category_header_title_color: var(--color-text);
	--cmplz_category_header_active_color: var(--color-primary);
	--cmplz_button_accept_background_color: var(--color-surface);
	--cmplz_button_accept_border_color: var(--color-primary);
	--cmplz_button_accept_text_color: var(--color-primary);
	--cmplz_button_deny_background_color: var(--color-surface);
	--cmplz_button_deny_border_color: var(--color-primary);
	--cmplz_button_deny_text_color: var(--color-primary);
	--cmplz_button_settings_background_color: var(--color-surface);
	--cmplz_button_settings_border_color: var(--color-primary);
	--cmplz_button_settings_text_color: var(--color-primary);
	--cmplz_button_border_radius: 8px;
	--cmplz_banner_border_radius: 0;
}
body:has(#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-show) { padding-bottom: 196px; }
#cmplz-cookiebanner-container .cmplz-cookiebanner {
	left: 0; right: 0; top: auto; bottom: 0; margin: 0; transform: none;
	width: 100%; min-width: 0; max-width: none; max-height: 100svh;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	grid-template-areas: "title title close" "body body body" "docs docs docs" "accept deny prefs";
	gap: var(--space-2); padding: var(--space-3) var(--page-gutter);
	border: 0; border-top: 1px solid var(--color-border); border-radius: 0; box-shadow: var(--shadow-raised);
	background: var(--color-surface-raised); font-family: var(--font-body); color: var(--color-text);
}
#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-show:hover { box-shadow: var(--shadow-raised); }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-header { display: contents; }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-logo,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-divider { display: none; }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-title {
	grid-area: title; display: block; justify-self: start; align-self: center; font-family: var(--font-display); font-size: 18px; font-weight: 500; line-height: 1.3; color: var(--color-text);
}
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close {
	grid-area: close; justify-self: end; align-self: center; display: grid; place-items: center; width: 44px; height: 44px; margin: -8px -10px -8px 0; color: var(--color-text-muted); border-radius: var(--radius-control); cursor: pointer;
}
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close svg { width: 16px; height: 16px; }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-body { grid-area: body; width: 100%; max-width: none; min-width: 0; max-height: 50svh; overflow-y: auto; }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-message { margin: 0; width: auto; max-width: none; font-size: 16px; line-height: var(--line-height-small); color: var(--color-text-muted); }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons { display: contents; }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn {
	height: auto; min-height: 44px; width: 100%; padding: 4px 12px; margin: 0;
	font-family: var(--font-body); font-size: clamp(14px, 3.8vw, var(--font-size-label)); font-weight: var(--font-weight-label); line-height: 1.2; white-space: normal;
	color: var(--color-primary); background: var(--color-surface); border: 1px solid var(--color-primary); border-radius: var(--radius-control);
	box-shadow: none; text-decoration: none;
}
@media (hover: hover) { #cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn:hover { background: var(--color-surface-tint); } }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn:active { background: var(--color-info-bg); }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept { grid-area: accept; }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-deny { grid-area: deny; }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences,
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences { grid-area: prefs; }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-links.cmplz-documents { grid-area: docs; justify-content: flex-start; gap: var(--space-4); margin: 0; }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-links .cmplz-link { color: var(--color-link); font-size: var(--font-size-small); }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category { background: var(--color-surface-tint); border-radius: var(--radius-card); }
#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-categories .cmplz-category .cmplz-description { color: var(--color-text-muted); }
#cmplz-cookiebanner-container .cmplz-cookiebanner :focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; box-shadow: 0 0 0 3px var(--color-surface-raised); }
/* One row from tablet up: title, text, three buttons, X. */
@media (min-width: 768px) {
	body:has(#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-show) { padding-bottom: 88px; }
	#cmplz-cookiebanner-container .cmplz-cookiebanner {
		grid-template-columns: auto minmax(0, 1fr) repeat(3, minmax(96px, auto)) auto;
		grid-template-areas: "title body accept deny prefs close" "title docs accept deny prefs close";
		column-gap: var(--space-3); row-gap: 0; align-items: center; padding: var(--space-2) var(--page-inline);
	}
	#cmplz-cookiebanner-container .cmplz-cookiebanner .cmplz-close { margin: 0 -10px 0 0; }
}

/* Reduced motion: everything is static (spinners still show, but do not spin). */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
