/* ==========================================================================
   Clearview Skylights: tokens, reset, type, prose, buttons, layout.
   Art direction: an architect's sketchbook of the sky. Graphite on lilac paper,
   broken by deep aubergine night bands. One accent: rose.
   ========================================================================== */
:root {
	--paper: #EBEAF1; --paper-2: #E3E2EB; --card: #FFFFFF;
	--ink: #23222B; --ink-soft: #4A4854; --rule: #D3D2D8;
	--night: #1B1823; --night-2: #13101C; --night-rule: #3A3344;
	--ivory: #F3EEE6; --ivory-soft: #CFC7D2;
	--rose: #D8929F; --rose-deep: #A2465E; --rose-on-dark: #E7A9B6;
	--sky: #D9DCEC;

	--f-display: "Zodiak", "Iowan Old Style", Georgia, serif;
	--f-body: "General Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--f-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

	--s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
	--pad-sec: clamp(56px, 7vw, 96px);
	--w-prose: 68ch; --w-std: 1180px; --w-wide: 1320px;
	--gutter: clamp(16px, 4vw, 40px);
	--hdr: 64px;
	--radius: 2px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--hdr) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 17px; line-height: 1.7; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--rose-deep); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--rose-deep); outline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 500; line-height: 1.1; letter-spacing: -0.01em; margin: 0; color: inherit; }
h1 em, h2 em, h3 em, .quote__title em { font-style: italic; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 200; background: var(--rose); color: var(--night); padding: 10px 16px; font-weight: 600; }
.skip:focus { left: 8px; }

/* Layout */
.wrap { width: 100%; max-width: calc(var(--w-std) + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }
.wrap--wide { max-width: calc(var(--w-wide) + 2 * var(--gutter)); }
.wrap--prose { max-width: calc(var(--w-prose) + 2 * var(--gutter)); }
.site-main { display: block; }
.site-main:focus { outline: none; }

/* Section furniture */
.sec-no { display: flex; align-items: center; gap: 12px; font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.06em; color: var(--rose-deep); margin-bottom: var(--s3); }
.sec-no::after { content: ""; width: 28px; height: 1px; background: currentColor; }
.sec-title { font-size: clamp(2rem, 3.2vw, 2.75rem); margin-bottom: var(--s6); max-width: 22ch; }
.eyebrow { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rose-deep); margin-bottom: var(--s3); }
.more { margin-top: var(--s6); }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; text-decoration: none; color: var(--rose-deep); }
.link-arrow:hover { color: var(--ink); gap: 12px; }
.link-arrow .ico { transition: transform .15s; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 22px; border: 1px solid transparent; border-radius: var(--radius); font-family: var(--f-body); font-weight: 600; font-size: 13.5px; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s, transform .15s; }
.btn--rose { background: var(--rose); color: var(--night); }
.btn--rose:hover { background: var(--rose-on-dark); color: var(--night); }
.btn--outline-light { border-color: var(--ivory); color: var(--ivory); background: transparent; }
.btn--outline-light:hover { background: var(--ivory); color: var(--night); }
.btn--outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn--outline:hover { background: var(--ink); color: var(--paper); }
.btn--ghost { border-color: var(--night-rule); color: var(--ivory); background: transparent; }
.btn--sm { min-height: 42px; padding: 9px 18px; font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* Dark grounds: ONE class carries every correction, and outranks band rules (§7c.3). */
.on-dark, .on-dark.on-dark { background: var(--night); color: var(--ivory); }
.on-dark .sec-no, .on-dark .eyebrow { color: var(--rose); }
.on-dark a:not(.btn) { color: var(--rose-on-dark); }
.on-dark a:not(.btn):hover { color: var(--ivory); }
.on-dark :focus-visible { outline-color: var(--rose); }
.on-dark .link-arrow { color: var(--rose-on-dark); }

/* Prose */
.prose { max-width: var(--w-prose); }
.prose > * + *, .prose > section > * + * { margin-top: 1.1em; }
.prose h2 { font-size: clamp(1.6rem, 2.4vw, 2rem); margin-top: 1.8em; }
.prose h3 { font-size: clamp(1.25rem, 1.8vw, 1.45rem); margin-top: 1.6em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--rose-deep); }
.prose strong { font-weight: 600; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--rose); font-family: var(--f-display); font-size: 1.3rem; line-height: 1.4; }
.prose .note, .prose aside.note { margin: 1.6em 0; padding: 20px 22px; background: var(--card); border: 1px solid var(--rule); border-left: 3px solid var(--rose); font-size: 16px; }
.prose .note--sun { border-left-color: var(--rose-deep); background: var(--paper-2); }

/* Tables: always fit, never scroll. Stack as cards on phones. */
.table-wrap { margin: 1.6em 0; }
.prose table, .table-wrap table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--rule); font-size: 15.5px; line-height: 1.5; }
.table-wrap th, .table-wrap td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.table-wrap thead th { font-family: var(--f-mono); font-weight: 500; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); background: var(--paper-2); }
@media (max-width: 640px) {
	.table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }
	.table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
	.table-wrap tr { border-bottom: 1px solid var(--rule); padding: 6px 0; }
	.table-wrap td { display: grid; grid-template-columns: minmax(0, 9.5em) minmax(0, 1fr); gap: 12px; border: 0; padding: 6px 14px; }
	.table-wrap td::before { content: attr(data-label); font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); padding-top: 3px; }
}

/* Figures */
.plate { margin: var(--s7) auto; max-width: 100%; }
.plate img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: center 40%; border: 1px solid var(--rule); }
.plate figcaption { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; }
.plate--wide img { aspect-ratio: 21 / 9; }
.diagram { margin: var(--s7) 0; padding: var(--s5); background: var(--card); border: 1px solid var(--rule); }
.diagram svg { width: 100%; height: auto; }
.diagram figcaption { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-soft); margin-top: var(--s3); }

/* Motion: hidden starting states only under .js-motion (§7c.6), only when motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
	.js-motion [data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity .4s ease-out, transform .4s ease-out; }
	.js-motion [data-reveal].is-in { opacity: 1; transform: none; }
}
