/* =====================================================================
   PhilMaps — site.css
   Implements DESIGN.md §3–§7 for everything EXCEPT the figure-canvas
   interior (.argmap and .am-* live in argmap.css). Consumes the variables
   defined in tokens.css; declares no raw brand colors of its own beyond
   the authentic figure/kbd values the spec fixes.

   Sections:
     1.  @font-face (self-hosted, swap)
     2.  Reset
     3.  Base typography + shell
     4.  Skip link
     5.  Header / nav
     6.  Footer
     7.  Prose
     8.  Buttons
     9.  Cards (path cards, practice cards)
     10. Hint aside (.hint) + kbd
     11. Check quiz card shell (.check)
     12. Callout
     13. Figure frame (.fig) + caption bar (interior is argmap.css)
     14. Home hero + contour motif
     15. Lesson layout (header, rail, prev/next)
     16. Focus / selection
     17. Reduced motion
     18. Print
   ===================================================================== */

/* ---- 1. Fonts ------------------------------------------------------- */
@font-face {
	font-family: 'Literata';
	font-style: normal;
	font-weight: 200 900;
	font-display: swap;
	src: url('/assets/fonts/literata-var.woff2') format('woff2-variations');
}
@font-face {
	font-family: 'Inter';
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url('/assets/fonts/inter-var.woff2') format('woff2-variations');
}
@font-face {
	font-family: 'Noto Sans';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/assets/fonts/noto-sans-400.woff2') format('woff2');
}
@font-face {
	font-family: 'Noto Sans';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('/assets/fonts/noto-sans-700.woff2') format('woff2');
}

/* ---- 2. Reset (modern minimal) ------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}
html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	-moz-tab-size: 4;
	tab-size: 4;
}
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd,
ul,
ol {
	margin: 0;
}
ul[class],
ol[class] {
	padding: 0;
	list-style: none;
}
img,
picture,
svg {
	max-width: 100%;
	display: block;
}
input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}
button {
	background: none;
	border: none;
	cursor: pointer;
}
a {
	color: inherit;
	text-decoration: none;
}
/* the hidden attribute must win over any author display value (e.g. the
 * inline-flex on .fig-action was un-hiding pre-run Undo/Replay buttons) */
[hidden] {
	display: none !important;
}
:target {
	scroll-margin-top: 6rem;
}

/* ---- 3. Base typography + shell ------------------------------------ */
html {
	color-scheme: light dark;
}
body {
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: var(--text-body);
	line-height: var(--leading-body);
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
main {
	flex: 1 0 auto;
}

.shell {
	max-width: var(--shell);
	margin-inline: auto;
	padding-inline: var(--space-4);
	width: 100%;
}
@media (max-width: 480px) {
	.shell {
		padding-inline: var(--space-3);
	}
}

h1,
h2,
h3,
h4 {
	font-family: var(--font-body);
	color: var(--ink-strong);
	letter-spacing: var(--tracking-heading);
	line-height: 1.18;
	font-weight: 600;
	text-wrap: balance;
}
h1 {
	font-size: var(--text-h1);
	font-weight: 620;
	/* Literata display optical size at large sizes */
	font-variation-settings: 'opsz' 40;
	line-height: 1.1;
}
h2 {
	font-size: var(--text-h2);
	font-weight: 580;
	font-variation-settings: 'opsz' 24;
	line-height: 1.2;
}
h3 {
	font-size: var(--text-h3);
	font-weight: 580;
}
.eyebrow {
	font-family: var(--font-ui);
	font-size: 0.78125rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--brand);
	margin-bottom: var(--space-2);
}
.dek {
	font-size: clamp(1.125rem, 1.02rem + 0.35vw, 1.3125rem);
	line-height: 1.5;
	color: var(--muted);
	max-width: 44ch;
	text-wrap: pretty;
}
small,
.text-small {
	font-size: var(--text-small);
}

/* ---- 4. Skip link -------------------------------------------------- */
.skip-link {
	position: absolute;
	left: var(--space-3);
	top: var(--space-3);
	z-index: 100;
	transform: translateY(-160%);
	background: var(--paper-raised);
	color: var(--brand-ink);
	font-family: var(--font-ui);
	font-weight: 600;
	padding: 10px 16px;
	border-radius: var(--radius-ui);
	border: 1px solid var(--hairline-strong);
	box-shadow: var(--shadow-card);
	transition: transform 150ms ease-out;
}
.skip-link:focus {
	transform: translateY(0);
}

/* ---- 5. Header / nav ----------------------------------------------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--paper) 82%, transparent);
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
	backdrop-filter: saturate(1.4) blur(10px);
	border-bottom: 1px solid var(--hairline);
}
.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	min-height: 64px;
}

.wordmark {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
}
.wordmark__mark .glyph,
.wordmark__mark svg {
	width: 26px;
	height: 26px;
}
.wordmark__text {
	display: flex;
	flex-direction: column;
	line-height: 1.05;
}
.wordmark__name {
	font-family: var(--font-ui);
	font-weight: 700;
	font-size: 1.125rem;
	letter-spacing: -0.01em;
	color: var(--ink-strong);
}
.wordmark__sub {
	font-family: var(--font-ui);
	font-weight: 500;
	font-size: 0.6875rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--muted);
}

.primary-nav {
	display: flex;
	align-items: center;
	gap: var(--space-5);
}
.primary-nav__list {
	display: flex;
	align-items: center;
	gap: 4px;
}
.primary-nav__link {
	font-family: var(--font-ui);
	font-weight: 500;
	font-size: 0.9375rem;
	color: var(--ink);
	padding: 8px 12px;
	border-radius: var(--radius-ui);
	position: relative;
	transition: color 150ms ease-out, background-color 150ms ease-out;
}
.primary-nav__link:hover {
	color: var(--brand-ink);
	background: var(--brand-wash);
}
.primary-nav__link.is-current {
	color: var(--brand);
	font-weight: 600;
}
.primary-nav__link.is-current::after {
	content: '';
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 2px;
	height: 2px;
	border-radius: 2px;
	background: var(--brand);
}
.primary-nav__actions {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

.theme-toggle {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: var(--radius-ui);
	color: var(--muted);
	border: 1px solid transparent;
	transition: color 150ms ease-out, background-color 150ms ease-out,
		border-color 150ms ease-out;
}
.theme-toggle:hover {
	color: var(--ink-strong);
	background: var(--brand-wash);
}
.theme-toggle__sun {
	display: block;
}
.theme-toggle__moon {
	display: none;
}
:root[data-theme='dark'] .theme-toggle__sun {
	display: none;
}
:root[data-theme='dark'] .theme-toggle__moon {
	display: block;
}

/* Mobile disclosure toggle — hidden ≥760px */
.nav-toggle {
	display: none;
	align-items: center;
	gap: 8px;
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: 0.875rem;
	color: var(--ink-strong);
	padding: 8px 12px;
	border-radius: var(--radius-ui);
	border: 1px solid var(--hairline-strong);
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	content: '';
	display: block;
	width: 18px;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
	position: relative;
}
.nav-toggle__bars::before {
	position: absolute;
	top: -6px;
}
.nav-toggle__bars::after {
	position: absolute;
	top: 6px;
}

@media (max-width: 759px) {
	.nav-toggle {
		display: inline-flex;
	}
	.primary-nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		background: var(--paper-raised);
		border-bottom: 1px solid var(--hairline);
		box-shadow: var(--shadow-card);
		padding: var(--space-3) var(--space-4) var(--space-4);
		display: none;
	}
	body.nav-open .primary-nav {
		display: flex;
	}
	.primary-nav__list {
		flex-direction: column;
		align-items: stretch;
		gap: 2px;
	}
	.primary-nav__link {
		padding: 12px;
		font-size: 1.0rem;
	}
	.primary-nav__link.is-current::after {
		display: none;
	}
	.primary-nav__actions {
		margin-top: var(--space-3);
		padding-top: var(--space-3);
		border-top: 1px solid var(--hairline);
		justify-content: space-between;
	}
	.nav-cta {
		flex: 1;
		justify-content: center;
		margin-left: var(--space-3);
	}
}

/* ---- 6. Footer ----------------------------------------------------- */
.site-footer {
	margin-top: var(--space-7);
	border-top: 1px solid var(--hairline);
	background: var(--paper-raised);
	padding-block: var(--space-6) var(--space-5);
	font-family: var(--font-ui);
	flex-shrink: 0;
}
.site-footer__inner {
	display: grid;
	grid-template-columns: 1.4fr 0.8fr 1.6fr;
	gap: var(--space-5);
	align-items: start;
}
.site-footer__brand {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}
.site-footer__brand .glyph,
.site-footer__brand svg {
	width: 30px;
	height: 30px;
}
.site-footer__mission {
	font-size: 0.90625rem;
	line-height: 1.55;
	color: var(--muted);
	max-width: 30ch;
}
.site-footer__mission strong {
	color: var(--ink-strong);
	font-weight: 700;
}
.site-footer__heading {
	font-family: var(--font-ui);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: var(--space-3);
}
.site-footer__links ul {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	list-style: none;
	margin: 0;
	padding: 0;
}
.site-footer__links a {
	font-size: 0.90625rem;
	color: var(--ink);
	transition: color 150ms ease-out;
}
.site-footer__links a:hover {
	color: var(--brand-ink);
}
.site-footer__meta {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	font-size: 0.84375rem;
	line-height: 1.55;
	color: var(--muted);
}
.site-footer__meta a {
	color: var(--brand);
	text-decoration: underline;
	text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent);
	text-underline-offset: 2px;
}
.site-footer__meta a:hover {
	color: var(--brand-ink);
}
.site-footer__heritage {
	max-width: 52ch;
}
@media (max-width: 860px) {
	.site-footer__inner {
		grid-template-columns: 1fr 1fr;
	}
	.site-footer__meta {
		grid-column: 1 / -1;
	}
}
@media (max-width: 520px) {
	.site-footer__inner {
		grid-template-columns: 1fr;
	}
}

/* ---- 7. Prose ------------------------------------------------------ */
.prose {
	max-width: var(--measure);
	margin-inline: auto;
}
.prose > * + * {
	margin-top: var(--space-4);
}
.prose h2 {
	margin-top: var(--space-6);
	position: relative;
}
.prose h3 {
	margin-top: var(--space-5);
}
.prose p {
	text-wrap: pretty;
}
.prose a:not(.btn):not(.card):not(.heading-anchor) {
	color: var(--brand);
	text-decoration: underline;
	text-decoration-color: color-mix(in srgb, var(--brand) 45%, transparent);
	text-underline-offset: 2px;
	text-decoration-thickness: 1.5px;
	transition: color 150ms ease-out, text-decoration-color 150ms ease-out;
}
.prose a:not(.btn):not(.card):not(.heading-anchor):hover {
	color: var(--brand-ink);
	text-decoration-color: currentColor;
}
.prose ul,
.prose ol {
	padding-left: 1.4em;
}
.prose ul {
	list-style: disc;
}
.prose ol {
	list-style: decimal;
}
.prose li + li {
	margin-top: var(--space-2);
}
.prose li::marker {
	color: var(--muted);
}
.prose blockquote {
	border-left: 3px solid var(--hairline-strong);
	padding-left: var(--space-4);
	color: var(--muted);
	font-style: italic;
}
.prose hr {
	border: none;
	border-top: 1px solid var(--hairline);
	margin-block: var(--space-6);
}
.prose img {
	border-radius: var(--radius-card);
}
.prose > .fig,
.prose > .figure-wide {
	max-width: var(--measure-wide);
	margin-inline: auto;
}

/* Anchored heading ids (markdown headings get .has-anchor + hover link) */
.heading-anchor {
	position: absolute;
	left: -1.1em;
	top: 0;
	color: var(--brand);
	opacity: 0;
	font-family: var(--font-ui);
	font-weight: 600;
	text-decoration: none;
	transition: opacity 150ms ease-out;
	padding-right: 0.3em;
}
.has-anchor:hover .heading-anchor,
.heading-anchor:focus-visible {
	opacity: 0.7;
}
@media (max-width: 640px) {
	.heading-anchor {
		display: none;
	}
}

/* ---- 8. Buttons ---------------------------------------------------- */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: 0.9375rem;
	line-height: 1;
	padding: 11px 18px;
	border-radius: var(--radius-ui);
	border: 1px solid transparent;
	cursor: pointer;
	transition: background-color 150ms ease-out, color 150ms ease-out,
		border-color 150ms ease-out, transform 150ms ease-out;
	white-space: nowrap;
}
.btn--brand {
	background: var(--brand);
	color: #fff;
}
:root[data-theme='dark'] .btn--brand {
	color: #0d1f16;
}
.btn--brand:hover {
	background: var(--brand-ink);
}
:root[data-theme='dark'] .btn--brand:hover {
	background: var(--brand-ink);
	color: #0d1f16;
}
.btn--brand:active {
	transform: translateY(1px);
}
.btn-quiet {
	background: transparent;
	color: var(--brand);
	border-color: var(--hairline-strong);
}
.btn-quiet:hover {
	background: var(--brand-wash);
	border-color: var(--brand);
	color: var(--brand-ink);
}

/* ---- 9. Cards ------------------------------------------------------ */
.card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: var(--space-4);
}
.card {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	background: var(--paper-raised);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-card);
	padding: var(--space-4);
	box-shadow: var(--shadow-card);
	transition: border-color 200ms ease-out, transform 200ms ease-out,
		box-shadow 200ms ease-out;
	text-decoration: none;
	color: var(--ink);
	height: 100%;
}
a.card:hover {
	border-color: var(--hairline-strong);
	transform: translateY(-2px);
}
.card__eyebrow {
	font-family: var(--font-ui);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--brand);
}
.card__title {
	font-family: var(--font-body);
	font-size: var(--text-h3);
	font-weight: 600;
	color: var(--ink-strong);
	line-height: 1.25;
}
.card__body {
	font-size: 0.9375rem;
	line-height: 1.55;
	color: var(--muted);
}
.card__cta {
	margin-top: auto;
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: 0.90625rem;
	color: var(--brand);
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
a.card:hover .card__cta {
	color: var(--brand-ink);
}

/* Practice card */
.practice-card {
	background: var(--paper-raised);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-card);
	padding: var(--space-4);
	box-shadow: var(--shadow-card);
}
.practice-card__title {
	font-family: var(--font-body);
	font-size: var(--text-h3);
	font-weight: 600;
	color: var(--ink-strong);
	margin-bottom: var(--space-2);
}
.practice-card > details {
	margin-block: var(--space-3);
}
.practice-card > details > summary {
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: 0.875rem;
	color: var(--brand);
	cursor: pointer;
}
.practice-card__passage {
	margin-top: var(--space-3);
	font-size: 0.96875rem;
	line-height: 1.6;
	color: var(--ink);
}
.practice-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
	margin-top: var(--space-4);
}

/* ---- 10. Hint aside (.hint) --------------------------------------- */
.hint {
	background: var(--brand-wash);
	border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
	border-left: 3px solid var(--brand);
	border-radius: var(--radius-ui);
	padding: var(--space-4);
	margin-block: var(--space-4);
}
.hint__label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-ui);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--brand-ink);
	margin-bottom: var(--space-2);
}
:root[data-theme='dark'] .hint__label {
	color: var(--brand);
}
.hint__label .glyph,
.hint__label svg {
	width: 18px;
	height: 18px;
}
.hint__body {
	font-size: 0.96875rem;
	line-height: 1.6;
}
.hint__body > * + * {
	margin-top: var(--space-3);
}
.hint__actions {
	margin-top: var(--space-3);
}

/* Keyboard keycaps — real <kbd>, raised look */
kbd {
	font-family: var(--font-ui);
	font-size: 0.78125rem;
	font-weight: 600;
	line-height: 1;
	display: inline-block;
	min-width: 1.4em;
	text-align: center;
	padding: 3px 6px;
	color: var(--ink-strong);
	background: var(--paper-raised);
	border: 1px solid var(--hairline-strong);
	border-radius: 6px;
	box-shadow: 0 1px 0 var(--hairline-strong), inset 0 -1px 0 rgba(0, 0, 0, 0.04);
	vertical-align: baseline;
}
:root[data-theme='dark'] kbd {
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

/* ---- 11. Check quiz card shell (.check) ---------------------------- */
/* Frame only. Inner behavior + mini-maps supplied by the component agent.
   Class names per ARGMAP-SPEC §10. */
.check {
	background: var(--paper-raised);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-card);
	padding: var(--space-5);
	box-shadow: var(--shadow-card);
	margin-block: var(--space-5);
}
.check__eyebrow {
	font-family: var(--font-ui);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--brand);
	margin-bottom: var(--space-3);
}
.check__question {
	font-family: var(--font-body);
	font-size: var(--text-h3);
	font-weight: 600;
	color: var(--ink-strong);
	margin-bottom: var(--space-3);
}
.check__passage {
	border-left: 3px solid var(--hairline-strong);
	padding: var(--space-2) 0 var(--space-2) var(--space-4);
	color: var(--muted);
	font-style: italic;
	margin-bottom: var(--space-4);
}
/* options stack vertically: real maps are wider than half the prose
 * column, and same-left-edge maps are easier to compare anyway */
.check__options {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-4);
	margin-bottom: var(--space-4);
}
.check__option { min-width: 0; }
/* radio-card: label wraps a mini-map; the argmap.css styles the map itself */
.check__option {
	position: relative;
	display: block;
	border: 1px solid var(--hairline-strong);
	border-radius: var(--radius-card);
	padding: var(--space-3);
	cursor: pointer;
	background: var(--paper);
	transition: border-color 150ms ease-out, background-color 150ms ease-out,
		box-shadow 150ms ease-out;
}
.check__option:hover {
	border-color: var(--brand);
}
.check__option input[type='radio'] {
	position: absolute;
	top: var(--space-3);
	left: var(--space-3);
}
.check__option:has(input:checked) {
	border-color: var(--brand);
	box-shadow: 0 0 0 1px var(--brand);
}
.check__option-label {
	display: block;
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: 0.90625rem;
	color: var(--ink-strong);
	margin-top: var(--space-2);
}
.check__submit {
	/* uses .btn .btn--brand */
}
.check__submit[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}
/* feedback panel */
.check__feedback {
	margin-top: var(--space-4);
	border-radius: var(--radius-ui);
	padding: var(--space-4);
	font-size: 0.96875rem;
	line-height: 1.6;
}
.check__feedback.is-correct {
	background: var(--brand-wash);
	border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
	color: var(--ink);
}
.check__feedback.is-incorrect {
	/* never red-shame: neutral wash */
	background: color-mix(in srgb, var(--muted) 8%, transparent);
	border: 1px solid var(--hairline-strong);
	color: var(--ink);
}
.check__correct-tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--font-ui);
	font-size: 0.78125rem;
	font-weight: 700;
	color: var(--brand-ink);
}
:root[data-theme='dark'] .check__correct-tag {
	color: var(--brand);
}
.check__option.is-correct {
	border-color: var(--brand);
	box-shadow: 0 0 0 1px var(--brand);
}

/* ---- 12. Callout --------------------------------------------------- */
.callout {
	background: var(--paper-raised);
	border: 1px solid var(--hairline);
	border-left: 3px solid var(--hairline-strong);
	border-radius: var(--radius-ui);
	padding: var(--space-4);
	margin-block: var(--space-4);
	font-size: 0.96875rem;
	line-height: 1.6;
	color: var(--muted);
}
.callout strong {
	color: var(--ink-strong);
}

/* ---- 13. Figure frame (.fig) + caption bar ------------------------ */
/* The OUTER figure card + caption bar. The canvas interior (.argmap,
   .am-*) is argmap.css. The stub placeholder box also lives here. */
.fig {
	background: var(--paper-raised);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-card);
	margin-block: var(--space-5);
	overflow: hidden;
	max-width: var(--measure-wide);
	margin-inline: auto;
}
.fig-canvas {
	/* editor's faint dotted grid; argmap.css may override with its own dot
	   tokens, this is the fallback so the frame reads as a canvas even before
	   argmap.css lands */
	background-color: var(--paper-raised);
	background-image: radial-gradient(var(--am-grid-dot, rgba(0, 0, 0, 0.045)) 1px, transparent 1.4px);
	background-size: 18px 18px;
	padding: var(--space-5);
	display: flex;
	justify-content: center;
	overflow-x: auto;
}
.fig-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: 12px var(--space-4);
	border-top: 1px solid var(--hairline);
	background: var(--paper-raised);
	font-family: var(--font-ui);
	flex-wrap: wrap;
}
.fig-caption {
	font-size: var(--text-caption);
	color: var(--muted);
	line-height: 1.4;
}
.fig-caption strong,
.fig-num {
	color: var(--ink-strong);
	font-weight: 700;
	margin-right: 6px;
}
.fig-actions {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}
.fig-action {
	font-family: var(--font-ui);
	font-size: 0.8125rem;
	font-weight: 500;
	color: var(--muted);
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: none;
	border: none;
	padding: 4px 2px;
	cursor: pointer;
	transition: color 150ms ease-out;
	text-decoration: none;
}
.fig-action:hover {
	color: var(--brand-ink);
}

/* Placeholder box the stub shortcodes emit before the plugin lands */
.fig--placeholder {
	display: grid;
	place-items: center;
	min-height: 180px;
	padding: var(--space-5);
	font-family: var(--font-ui);
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--muted);
	background: repeating-linear-gradient(
			-45deg,
			transparent,
			transparent 10px,
			var(--brand-wash) 10px,
			var(--brand-wash) 20px
		),
		var(--paper-raised);
	border: 1px dashed var(--hairline-strong);
}

/* ---- 14. Home hero + contour motif -------------------------------- */
.hero {
	position: relative;
	overflow: hidden;
	padding-block: var(--space-7) var(--space-6);
}
.hero__inner {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-6);
	align-items: center;
}
@media (max-width: 900px) {
	.hero__inner {
		grid-template-columns: 1fr;
		gap: var(--space-5);
	}
}
.hero__headline {
	font-size: var(--text-h1);
	font-weight: 640;
	font-variation-settings: 'opsz' 60;
	line-height: 1.05;
	letter-spacing: -0.02em;
}
.hero__dek {
	margin-top: var(--space-4);
	font-size: clamp(18px, 1.5vw + 13px, 22px);
	line-height: 1.5;
	color: var(--muted);
	max-width: 42ch;
	text-wrap: pretty;
}
.hero__actions {
	margin-top: var(--space-5);
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
}
.hero__figure {
	min-width: 0;
}

/* Contour motif — home hero only, ≤4% opacity, never behind body text.
   Subtle inline-SVG topographic lines as a data URI. */
.contour {
	position: relative;
}
.contour::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	opacity: 0.04;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600' viewBox='0 0 600 600'%3E%3Cg fill='none' stroke='%23212528' stroke-width='1.1'%3E%3Cpath d='M-40 300C80 240 180 360 300 300s220-60 340 0'/%3E%3Cpath d='M-40 340C80 280 180 400 300 340s220-60 340 0'/%3E%3Cpath d='M-40 380C80 320 180 440 300 380s220-60 340 0'/%3E%3Cpath d='M-40 260C80 200 180 320 300 260s220-60 340 0'/%3E%3Cpath d='M-40 220C80 160 180 280 300 220s220-60 340 0'/%3E%3Cpath d='M-40 180C80 120 180 240 300 180s220-60 340 0'/%3E%3Cpath d='M60 420C160 380 240 470 340 430s180-40 260 0'/%3E%3Cpath d='M-40 140C80 80 180 200 300 140s220-60 340 0'/%3E%3C/g%3E%3C/svg%3E");
	background-size: 600px 600px;
	background-position: top right;
	background-repeat: no-repeat;
	-webkit-mask-image: linear-gradient(to bottom, #000, transparent 78%);
	mask-image: linear-gradient(to bottom, #000, transparent 78%);
}
:root[data-theme='dark'] .contour::before {
	opacity: 0.05;
	filter: invert(1);
}

/* Home "what is" strip + heritage + mailing CTA */
.home-strip {
	padding-block: var(--space-6);
	border-top: 1px solid var(--hairline);
}
.home-strip__title {
	margin-bottom: var(--space-4);
}
.paths {
	padding-block: var(--space-6);
}
.paths__title {
	margin-bottom: var(--space-4);
}
.home-cta {
	margin-top: var(--space-5);
	padding: var(--space-5);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-card);
	background: var(--brand-wash);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
}
.home-cta__text {
	max-width: 46ch;
}

/* ---- 15. Lesson layout -------------------------------------------- */
.lesson-header {
	padding-top: var(--space-6);
	padding-bottom: var(--space-4);
	border-bottom: 1px solid var(--hairline);
	margin-bottom: var(--space-5);
	max-width: var(--shell);
}
.lesson-header .lesson-title {
	margin-block: var(--space-2);
}
.lesson-header .dek {
	max-width: 54ch;
	margin-top: var(--space-2);
}
.lesson-meta {
	margin-top: var(--space-3);
	font-family: var(--font-ui);
	font-size: 0.8125rem;
	color: var(--muted);
}
.reading-time::before {
	content: '⏱ ';
}

.toc-details {
	margin-top: var(--space-4);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-ui);
	padding: var(--space-3) var(--space-4);
	max-width: var(--measure);
	font-family: var(--font-ui);
}
.toc-details > summary {
	font-weight: 600;
	font-size: 0.875rem;
	cursor: pointer;
	color: var(--ink-strong);
}
.toc-list {
	margin-top: var(--space-3);
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}
.toc-list a {
	font-size: 0.90625rem;
	color: var(--brand);
}
.toc-list a:hover {
	color: var(--brand-ink);
}

.lesson-grid {
	display: block;
}
.lesson-rail {
	display: none;
}
/* Below the rail breakpoint the lesson header shares the centred prose
 * column, exactly like .page-header — one left edge per page. */
.lesson-header {
	max-width: calc(var(--measure) + 2 * var(--space-4));
	margin-inline: auto;
}

/* Two-column with sticky rail ≥1140px */
@media (min-width: 1140px) {
	/* the header mirrors the grid so the title aligns with the content
	 * column, not with the rail */
	.lesson-header {
		max-width: var(--shell);
		display: grid;
		grid-template-columns: 200px minmax(0, 1fr);
		gap: 0 var(--space-6);
	}
	.lesson-header > * {
		grid-column: 2;
	}
	.lesson-grid {
		display: grid;
		grid-template-columns: 200px minmax(0, 1fr);
		gap: var(--space-6);
		align-items: start;
	}
	.lesson-rail {
		display: block;
		position: sticky;
		top: 88px;
		font-family: var(--font-ui);
		max-height: calc(100vh - 120px);
		overflow-y: auto;
	}
	.toc-details {
		display: none;
	}
	.lesson-prose {
		margin-inline: 0;
	}
}
.lesson-rail__title {
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: var(--space-3);
}
.lesson-rail__list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	border-left: 1px solid var(--hairline);
}
.lesson-rail__list a {
	display: block;
	font-size: 0.84375rem;
	line-height: 1.4;
	color: var(--muted);
	padding: 5px 0 5px var(--space-3);
	margin-left: -1px;
	border-left: 2px solid transparent;
	transition: color 150ms ease-out, border-color 150ms ease-out;
}
.lesson-rail__list a:hover {
	color: var(--ink-strong);
}
.lesson-rail__list a.is-active {
	color: var(--brand);
	border-left-color: var(--brand);
	font-weight: 600;
}

/* Prev/next lesson footer nav */
.prevnext {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-4);
	margin-top: var(--space-6);
	padding-top: var(--space-5);
	border-top: 1px solid var(--hairline);
}
@media (max-width: 560px) {
	.prevnext {
		grid-template-columns: 1fr;
	}
}
.prevnext__link {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--hairline);
	border-radius: var(--radius-card);
	transition: border-color 150ms ease-out, background-color 150ms ease-out;
}
.prevnext__link:hover {
	border-color: var(--hairline-strong);
	background: var(--brand-wash);
}
.prevnext__next {
	text-align: right;
}
.prevnext__dir {
	font-family: var(--font-ui);
	font-size: 0.78125rem;
	font-weight: 600;
	color: var(--brand);
}
.prevnext__title {
	font-family: var(--font-body);
	font-weight: 600;
	color: var(--ink-strong);
}

/* Generic page (contact/software/404) header — constrained to the SAME
 * centred column as .prose so the two share a left edge. */
.page-header {
	max-width: calc(var(--measure) + 2 * var(--space-4));
	margin-inline: auto;
	padding-block: var(--space-6) var(--space-4);
}
.page-header .page-title {
	margin-block: var(--space-2);
}

/* ---- 16. Focus / selection ---------------------------------------- */
:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 2px;
	border-radius: 4px;
}
/* Buttons/links keep tidy radius on focus */
.btn:focus-visible,
.primary-nav__link:focus-visible,
.card:focus-visible {
	outline-offset: 3px;
}
::selection {
	background: color-mix(in srgb, var(--brand) 24%, transparent);
	color: var(--ink-strong);
}

.visually-hidden,
.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;
}

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

/* ---- 18. Print ----------------------------------------------------- */
@media print {
	:root {
		--paper: #fff;
		--paper-raised: #fff;
		--ink: #000;
		--ink-strong: #000;
		--muted: #333;
		--hairline: #bbb;
		--hairline-strong: #999;
		--brand: #1c5e3f;
		--brand-ink: #1c5e3f;
		--brand-wash: transparent;
	}
	html[data-theme='dark'],
	:root[data-theme='dark'] {
		/* force light rendering in print regardless of screen theme */
		--paper: #fff;
		--paper-raised: #fff;
		--ink: #000;
		--ink-strong: #000;
		--am-paper: #fff;
		--am-ink: #4f4f4f;
		--am-border: #707070;
		--am-green: #339966;
		--am-red: #ff0000;
		--am-grid-dot: transparent;
	}
	body {
		background: #fff;
		color: #000;
		font-size: 11pt;
		line-height: 1.5;
	}
	.site-header,
	.nav-toggle,
	.theme-toggle,
	.skip-link,
	.fig-actions,
	.hint__actions,
	.check__submit,
	.home-cta,
	.prevnext,
	.lesson-rail,
	.toc-details,
	.contour::before {
		display: none !important;
	}
	.site-footer {
		margin-top: var(--space-5);
		border-top: 1px solid #999;
		background: #fff;
		font-size: 9pt;
	}
	.site-footer__links,
	.site-footer__because {
		display: none;
	}
	a {
		color: #000;
	}
	.prose a[href^='http']::after {
		content: ' (' attr(href) ')';
		font-size: 8pt;
		color: #555;
		word-break: break-all;
	}
	.fig,
	.card,
	.hint,
	.check,
	.callout,
	.practice-card {
		box-shadow: none;
		border: 1px solid #999;
		break-inside: avoid;
	}
	.fig-canvas {
		background-image: none;
	}
	h1,
	h2,
	h3 {
		break-after: avoid;
	}
	.heading-anchor {
		display: none;
	}
	/* Hints checklist must fit one page */
	.hints-checklist {
		break-inside: avoid;
		page-break-inside: avoid;
		font-size: 10pt;
		line-height: 1.35;
	}
	.hints-checklist li {
		margin-top: 3pt;
	}
}

/* ---- 19. Practice workthrough (guided model solutions) -------------- */
.workthrough {
	margin-top: var(--space-5);
	border-top: 1px solid var(--hairline);
	padding-top: var(--space-4);
}
.workthrough__kicker {
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: var(--text-small);
	color: var(--ink-strong);
}
.workthrough .check {
	margin-top: var(--space-3);
}
.check__option--text {
	display: flex;
	align-items: baseline;
	gap: var(--space-2);
	padding: var(--space-3) var(--space-4);
}
.check__option--text .check__option-label {
	padding-inline-start: 26px;
	font-weight: 500;
}
.solution-reveal {
	margin-top: var(--space-4);
}
.solution-reveal > summary {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	cursor: pointer;
	list-style: none;
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: var(--text-small);
	color: var(--brand);
	border: 1px solid var(--hairline-strong);
	border-radius: var(--radius-ui);
	padding: 0.5rem 1rem;
	background: var(--paper-raised);
	transition: color 150ms ease-out, background-color 150ms ease-out;
}
.solution-reveal > summary::-webkit-details-marker { display: none; }
.solution-reveal > summary::before {
	content: '▸';
	transition: transform 150ms ease-out;
}
.solution-reveal[open] > summary::before { transform: rotate(90deg); }
.solution-reveal > summary:hover {
	color: var(--brand-ink);
	background: var(--brand-wash);
}
.solution-reveal .fig { margin-top: var(--space-4); }
.solution-notes {
	margin-top: var(--space-3);
	font-size: var(--text-small);
	color: var(--muted);
	max-width: var(--measure);
}
.solution-notes a {
	color: var(--brand);
	text-decoration: underline;
}
@media (prefers-reduced-motion: reduce) {
	.solution-reveal > summary::before { transition: none; }
}

/* Figures may break out of the prose column when a map level needs the
 * room (left edge stays put; JS sets the width). */
.fig--breakout {
	max-width: none;
}
