/*
  ClearLedger: stablecoin integration security
  Direction: editorial long-read meets technical docs.
  Newsreader for display, Inter for reading, JetBrains Mono for labels and code.
  One accent (ledger green). Hairlines instead of boxes. One bold move: the hero headline.
*/

:root {
  --bg: #f6f4ee;
  --surface: #fcfbf8;
  --text: #1b1b18;
  --text-2: #56534c;
  --text-3: #6f6b62;
  --hairline: rgba(27, 27, 24, 0.12);
  --hairline-strong: rgba(27, 27, 24, 0.24);
  --accent: #1d5a43;
  --accent-hover: #164735;
  --accent-ink: #f6f4ee;
  --accent-soft: rgba(29, 90, 67, 0.08);
  --code-bg: #efece4;
  --danger: #9b2c2c;
  --selection: rgba(29, 90, 67, 0.18);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;

  --radius: 6px;
  --max: 1160px;
  --gutter: 24px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121412;
    --surface: #181b19;
    --text: #e8e6df;
    --text-2: #aaa79f;
    --text-3: #8f8c84;
    --hairline: rgba(232, 230, 223, 0.10);
    --hairline-strong: rgba(232, 230, 223, 0.22);
    --accent: #78c3a0;
    --accent-hover: #93d3b4;
    --accent-ink: #0f1311;
    --accent-soft: rgba(120, 195, 160, 0.10);
    --code-bg: #1c201d;
    --danger: #e08a8a;
    --selection: rgba(120, 195, 160, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121412;
  --surface: #181b19;
  --text: #e8e6df;
  --text-2: #aaa79f;
  --text-3: #8f8c84;
  --hairline: rgba(232, 230, 223, 0.10);
  --hairline-strong: rgba(232, 230, 223, 0.22);
  --accent: #78c3a0;
  --accent-hover: #93d3b4;
  --accent-ink: #0f1311;
  --accent-soft: rgba(120, 195, 160, 0.10);
  --code-bg: #1c201d;
  --danger: #e08a8a;
  --selection: rgba(120, 195, 160, 0.25);
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--selection);
}

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

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: var(--hairline-strong);
  transition: text-decoration-color 160ms var(--ease), color 160ms var(--ease);
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
}

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.86em;
}

.skip {
  position: absolute;
  left: var(--s-4);
  top: -48px;
  padding: var(--s-2) var(--s-4);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  z-index: 100;
  text-decoration: none;
}

.skip:focus {
  top: var(--s-4);
}

.wrap {
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Type primitives ---------- */

.label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.label--accent {
  color: var(--accent);
}

.display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(52px, 9.2vw, 112px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-optical-sizing: auto;
  text-wrap: balance;
}

.display em {
  font-style: italic;
  color: var(--accent);
}

.h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 4.2vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.lede {
  font-size: clamp(18px, 1.6vw, 21px);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 62ch;
}

.muted {
  color: var(--text-2);
}

.small {
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--hairline);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  height: 68px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  text-decoration: none;
}

.brand__name {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.brand__tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--s-6);
}

.nav a {
  font-size: 15px;
  color: var(--text-2);
  text-decoration: none;
}

.nav a:hover {
  color: var(--text);
}

.nav .btn {
  color: var(--accent-ink);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-5);
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
}

.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--hairline-strong);
}

.btn--ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn--sm {
  min-height: 38px;
  padding: 0 var(--s-4);
  font-size: 14px;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.arrow-link {
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.arrow-link::after {
  content: "\00a0→";
  display: inline-block;
  transition: transform 160ms var(--ease);
}

.arrow-link:hover::after {
  transform: translateX(3px);
}

/* ---------- Hero ---------- */

.hero {
  padding: var(--s-9) 0 var(--s-9);
}

.hero .label {
  margin-bottom: var(--s-6);
}

.hero .display {
  max-width: 11ch;
}

.hero__body {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--s-7);
  align-items: end;
  margin-top: var(--s-7);
  padding-top: var(--s-6);
  border-top: 1px solid var(--hairline);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-5);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-6);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.hero__meta span::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: var(--s-2);
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 2px;
}

/* ---------- Sections ---------- */

.section {
  padding: var(--s-10) 0;
  border-top: 1px solid var(--hairline);
}

.section__grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: var(--s-7);
}

.section__head .label {
  margin-bottom: var(--s-4);
}

.section__head .h2 + p {
  margin-top: var(--s-5);
}

.section__head--sticky {
  position: sticky;
  top: 108px;
  align-self: start;
}

/* ---------- Failure-mode ledger ---------- */

.ledger {
  list-style: none;
  counter-reset: ledger;
  border-top: 1px solid var(--hairline-strong);
}

.ledger li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: var(--s-4);
  padding: var(--s-5) 0;
  border-bottom: 1px solid var(--hairline);
}

.ledger__no {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.9;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.ledger h3 {
  margin-bottom: var(--s-1);
}

.ledger p {
  font-size: 16px;
  color: var(--text-2);
  max-width: 64ch;
}

.ledger-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-6);
}

/* ---------- Offer ---------- */

.facts {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  border-top: 1px solid var(--hairline-strong);
}

.facts dt,
.facts dd {
  padding: var(--s-5) 0;
  border-bottom: 1px solid var(--hairline);
}

.facts dt {
  padding-top: calc(var(--s-5) + 4px);
}

.facts dd {
  margin: 0;
  color: var(--text-2);
}

.facts dd strong {
  color: var(--text);
  font-weight: 600;
}

.facts ul {
  list-style: none;
}

.facts li {
  position: relative;
  padding-left: var(--s-5);
}

.facts li + li {
  margin-top: var(--s-2);
}

.facts li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.78em;
  width: 10px;
  height: 1px;
  background: var(--text-3);
}

.engagements {
  width: 100%;
  margin-top: var(--s-8);
  border-collapse: collapse;
  font-size: 16px;
}

.engagements caption {
  text-align: left;
  padding-bottom: var(--s-4);
}

.engagements th,
.engagements td {
  text-align: left;
  vertical-align: top;
  padding: var(--s-4) var(--s-4) var(--s-4) 0;
  border-bottom: 1px solid var(--hairline);
}

.engagements thead th {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom-color: var(--hairline-strong);
}

.engagements tbody th {
  font-weight: 600;
  width: 34%;
}

.engagements td {
  color: var(--text-2);
}

.engagements .num {
  text-align: right;
  padding-right: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.engagements .is-core th::after {
  content: "Most teams start here";
  display: block;
  margin-top: var(--s-1);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.fineprint {
  margin-top: var(--s-4);
  font-size: 14px;
  color: var(--text-3);
}

/* Sample finding: the report, previewed */

.finding {
  margin-top: var(--s-8);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font-size: 15px;
}

.finding__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--hairline);
}

.finding__body {
  padding: var(--s-5);
}

.finding__title {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: var(--s-4);
}

.finding__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
  padding: var(--s-4) 0;
  margin-bottom: var(--s-4);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.finding__meta dd {
  margin: var(--s-1) 0 0;
  font-weight: 500;
}

.sev {
  color: var(--danger);
}

.finding p + p {
  margin-top: var(--s-3);
}

.finding p {
  color: var(--text-2);
  max-width: 70ch;
}

.finding b {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Process ---------- */

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-6);
  margin-top: var(--s-8);
}

.steps li {
  padding-top: var(--s-4);
  border-top: 1px solid var(--hairline-strong);
}

.steps .label {
  display: block;
  margin-bottom: var(--s-3);
}

.steps .h3 {
  margin-bottom: var(--s-2);
}

.steps p {
  font-size: 15px;
  color: var(--text-2);
}

/* ---------- Fit ---------- */

.fit {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-7);
}

.fit ul {
  list-style: none;
  border-top: 1px solid var(--hairline-strong);
}

.fit li {
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-2);
}

.fit li strong {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.fit .label {
  display: block;
  margin-bottom: var(--s-4);
}

/* ---------- Research list ---------- */

.posts {
  list-style: none;
  border-top: 1px solid var(--hairline-strong);
}

.post {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-2) var(--s-6);
  padding: var(--s-6) 0;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
}

.post__title {
  font-family: var(--serif);
  font-size: clamp(24px, 2.6vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  transition: color 160ms var(--ease);
}

.post:hover .post__title {
  color: var(--accent);
}

.post__dek {
  grid-column: 1;
  color: var(--text-2);
  max-width: 62ch;
}

.post__meta {
  grid-column: 2;
  grid-row: 1 / span 2;
  text-align: right;
  white-space: nowrap;
}

/* ---------- About ---------- */

.about p + p {
  margin-top: var(--s-4);
}

.about p {
  max-width: 62ch;
}

.about__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-6);
}

/* ---------- FAQ ---------- */

.faq {
  border-top: 1px solid var(--hairline-strong);
}

.faq details {
  border-bottom: 1px solid var(--hairline);
}

.faq summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5) 0;
  cursor: pointer;
  font-weight: 600;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-family: var(--mono);
  font-weight: 400;
  color: var(--text-3);
  transition: transform 200ms var(--ease);
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details p {
  padding-bottom: var(--s-5);
  color: var(--text-2);
  max-width: 66ch;
}

/* ---------- Contact ---------- */

.contact {
  padding-bottom: var(--s-10);
}

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.field--full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 14px;
  font-weight: 500;
}

.field label .opt {
  font-weight: 400;
  color: var(--text-3);
}

.input {
  width: 100%;
  min-height: 46px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: 400 16px/1.4 var(--sans);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.input::placeholder {
  color: var(--text-3);
}

.input:hover {
  border-color: var(--text-3);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select.input {
  appearance: none;
  padding-right: var(--s-7);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 22px) 20px, calc(100% - 17px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

textarea.input {
  min-height: 140px;
  resize: vertical;
}

.form__foot {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-5);
}

.form__status {
  grid-column: 1 / -1;
  font-size: 15px;
  min-height: 1.5em;
}

.form__status.is-ok {
  color: var(--accent);
}

.form__status.is-err {
  color: var(--danger);
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact__aside {
  margin-top: var(--s-6);
}

.contact__aside p + p {
  margin-top: var(--s-3);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: var(--s-7) 0 var(--s-8);
  font-size: 14px;
  color: var(--text-3);
}

.site-footer .wrap {
  display: grid;
  grid-template-columns: minmax(0, 4fr) repeat(2, minmax(0, 2fr)) minmax(0, 4fr);
  gap: var(--s-6);
}

.site-footer .label {
  display: block;
  margin-bottom: var(--s-3);
}

.site-footer ul {
  list-style: none;
}

.site-footer li + li {
  margin-top: var(--s-2);
}

.site-footer a {
  text-decoration: none;
  color: var(--text-2);
}

.site-footer a:hover {
  color: var(--text);
}

.site-footer .brand__name {
  display: block;
  color: var(--text);
  margin-bottom: var(--s-2);
}

/* ---------- Article ---------- */

.article-head {
  padding: var(--s-9) 0 var(--s-7);
}

.article-head .label {
  margin-bottom: var(--s-5);
}

.article-head h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  max-width: 18ch;
  text-wrap: balance;
}

.article-head .lede {
  margin-top: var(--s-5);
}

.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--hairline);
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 7fr) minmax(0, 2fr);
  gap: var(--s-7);
  padding-bottom: var(--s-10);
}

.toc {
  position: sticky;
  top: 108px;
  align-self: start;
  font-size: 14px;
}

.toc .label {
  display: block;
  margin-bottom: var(--s-3);
}

.toc ol {
  list-style: none;
  border-left: 1px solid var(--hairline);
}

.toc li a {
  display: block;
  padding: 5px 0 5px var(--s-4);
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--text-2);
  text-decoration: none;
  line-height: 1.4;
}

.toc li a:hover {
  color: var(--text);
}

.toc li a.is-active {
  color: var(--text);
  border-left-color: var(--accent);
}

.prose {
  max-width: 68ch;
}

.prose > * + * {
  margin-top: var(--s-4);
}

.prose h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-top: var(--s-8);
  scroll-margin-top: 100px;
}

.prose h2 .no {
  display: block;
  margin-bottom: var(--s-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.prose h3 {
  font-size: 17px;
  font-weight: 600;
  margin-top: var(--s-6);
}

.prose p,
.prose li {
  color: var(--text);
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: var(--s-2);
}

.prose li::marker {
  color: var(--text-3);
}

.prose :not(pre) > code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--code-bg);
  font-size: 0.84em;
}

.prose pre {
  margin-top: var(--s-5);
  margin-bottom: var(--s-5);
  padding: var(--s-5);
  overflow-x: auto;
  background: var(--code-bg);
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.65;
  tab-size: 2;
}

.prose .c {
  color: var(--text-3);
}

.callout {
  padding: var(--s-4) 0 var(--s-4) var(--s-5);
  border-left: 2px solid var(--accent);
}

.callout p {
  color: var(--text-2);
}

.callout .label {
  display: block;
  margin-bottom: var(--s-1);
}

.checklist {
  list-style: none;
  padding-left: 0 !important;
  border-top: 1px solid var(--hairline-strong);
}

.checklist li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-3) 0;
  margin: 0 !important;
  border-bottom: 1px solid var(--hairline);
}

.checklist li::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-top: 5px;
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
}

.article-cta {
  margin-top: var(--s-9);
  padding-top: var(--s-6);
  border-top: 1px solid var(--hairline-strong);
}

.article-cta .h2 {
  font-size: 34px;
  max-width: 20ch;
}

.article-cta p {
  margin-top: var(--s-4);
  color: var(--text-2);
}

.article-cta .hero__actions {
  margin-top: var(--s-5);
}

.aside-tools {
  position: sticky;
  top: 108px;
  align-self: start;
  font-size: 14px;
}

.aside-tools .label {
  display: block;
  margin-bottom: var(--s-3);
}

.aside-tools button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.aside-tools p + p {
  margin-top: var(--s-3);
}

/* ---------- Simple pages ---------- */

.plain {
  padding: var(--s-10) 0;
  min-height: 60vh;
}

.plain .display {
  font-size: clamp(48px, 7vw, 88px);
}

.plain p {
  margin-top: var(--s-5);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 420ms var(--ease), transform 420ms var(--ease);
  }

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

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

  * {
    transition: none !important;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1040px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc,
  .aside-tools {
    position: static;
  }

  .aside-tools {
    display: none;
  }

  .toc ol {
    columns: 2;
    column-gap: var(--s-6);
  }
}

@media (max-width: 900px) {
  .nav a:not(.btn) {
    display: none;
  }

  .hero__body,
  .section__grid,
  .fit {
    grid-template-columns: minmax(0, 1fr);
  }

  .section__head--sticky {
    position: static;
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer .wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  :root {
    --gutter: 16px;
  }

  body {
    font-size: 16px;
  }

  .brand__tag {
    display: none;
  }

  .hero {
    padding: var(--s-8) 0 var(--s-8);
  }

  .section {
    padding: var(--s-9) 0;
  }

  .steps,
  .form {
    grid-template-columns: minmax(0, 1fr);
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .facts dt {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .facts dd {
    padding-top: var(--s-2);
  }

  .finding__meta {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .engagements thead {
    display: none;
  }

  .engagements tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: var(--s-4) 0;
    border-bottom: 1px solid var(--hairline);
  }

  .engagements th,
  .engagements td {
    padding: 0;
    border: 0;
  }

  .engagements tbody th {
    width: auto;
  }

  .engagements td:not(.num) {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: var(--s-2);
  }

  .engagements .num {
    grid-column: 2;
    grid-row: 1;
  }

  .post {
    grid-template-columns: minmax(0, 1fr);
  }

  .post__meta {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
  }

  .toc ol {
    columns: 1;
  }

  .site-footer .wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Print (the guide doubles as a checklist) ---------- */

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --text: #111;
    --text-2: #333;
    --text-3: #555;
    --code-bg: #f3f3f3;
  }

  body {
    font-size: 11pt;
  }

  .site-header,
  .site-footer,
  .toc,
  .aside-tools,
  .article-cta .hero__actions,
  .skip {
    display: none !important;
  }

  .article-layout {
    display: block;
  }

  .article-head {
    padding-top: 0;
  }

  .prose {
    max-width: none;
  }

  .prose h2 {
    break-after: avoid;
  }

  .prose pre,
  .checklist li {
    break-inside: avoid;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Code must read literally: no "===" → "≡" ligatures. */
code,
pre {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

.prose :not(pre) > code {
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .ledger li {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: var(--s-3);
  }
}

/* Article extras: breadcrumb, deep-dive links, related reading */
.crumb {
  color: inherit;
  text-decoration: none;
}

.crumb:hover {
  text-decoration: underline;
}

a.label {
  text-decoration: none;
}

a.label:hover {
  color: var(--accent);
}

.prose .deep {
  margin-top: var(--s-5);
  font-size: 15px;
}

.related {
  margin-top: var(--s-9);
}

.related .label {
  margin-bottom: var(--s-4);
}

.prose .related .posts {
  list-style: none;
  padding-left: 0;
}

.prose .related li + li {
  margin-top: 0;
}

.related .post {
  padding: var(--s-5) 0;
}

.related .post__title {
  font-size: 22px;
}

.related .post__dek {
  font-size: 15px;
}

.prose .engagements {
  margin-top: var(--s-5);
  font-size: 15px;
}
