/* =========================================================================
   Three Thirteen · Applied Psychology Studio
   main.css: tokens, base, layout, header, footer, components
   ========================================================================= */

/* ---------- Fonts ---------- */
@font-face { font-family: "Heros"; src: url(../fonts/heros-regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Heros"; src: url(../fonts/heros-bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Heros"; src: url(../fonts/heros-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Heros"; src: url(../fonts/heros-bolditalic.woff2) format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url(../fonts/newsreader.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url(../fonts/newsreader-italic.woff2) format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Nastaliq"; src: url(../fonts/nastaliq-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nastaliq"; src: url(../fonts/nastaliq-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --white: #ffffff;
  --paper: #f5f4f0;
  --paper-2: #edece6;
  --line: #e3e1da;
  --line-2: #cfccc3;
  --ink: #15201a;
  --ink-2: #2c3631;
  --muted: #5d6761;
  --faint: #6b736e;
  --forest: #1e4a34;
  --forest-2: #24583e;
  --forest-deep: #133524;
  --on-forest: #d3e1d7;
  --on-forest-muted: #9db7a5;
  --sage: #e3ebe4;
  --sage-2: #d2dfd5;
  --red: #c4262e;

  --sans: "Helvetica Neue", "Heros", Helvetica, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --urdu: "Nastaliq", "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;

  --gutter: clamp(20px, 4vw, 48px);
  --max: 1320px;
  --utility-h: 36px;
  --mast-h: 76px;
  --head-h: calc(var(--utility-h) + var(--mast-h));
  --section: clamp(72px, 9vw, 128px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--mast-h) + 64px); }
html, body { overflow-x: clip; }
body { font-family: var(--sans); font-size: 17px; line-height: 1.6; color: var(--ink); background: var(--white); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
ul[class], ol[class] { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 3px; }
.on-forest :focus-visible, .site-footer :focus-visible, .drawer :focus-visible { outline-color: #fff; }
::selection { background: var(--sage-2); color: var(--ink); }
.skip { position: absolute; left: 12px; top: -60px; background: var(--forest); color: #fff; padding: 10px 16px; z-index: 100; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-weight: 700; color: var(--ink); text-wrap: balance; }
.display { font-size: clamp(42px, 5.6vw, 88px); line-height: .98; letter-spacing: -.035em; }
.h1 { font-size: clamp(38px, 4.6vw, 68px); line-height: 1.02; letter-spacing: -.032em; }
.h2 { font-size: clamp(30px, 3.4vw, 50px); line-height: 1.06; letter-spacing: -.026em; }
.h3 { font-size: clamp(21px, 1.7vw, 25px); line-height: 1.2; letter-spacing: -.015em; }
.h4 { font-size: 18px; line-height: 1.3; letter-spacing: -.01em; }
.lede { font-size: clamp(18px, 1.45vw, 21px); line-height: 1.55; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: 14.5px; }
.serif { font-family: var(--serif); font-style: italic; font-weight: 340; letter-spacing: -.005em; }
.quote { font-family: var(--serif); font-style: italic; font-weight: 320; font-size: clamp(24px, 2.4vw, 36px); line-height: 1.28; letter-spacing: -.01em; color: var(--ink); text-wrap: pretty; }
.quote--sm { font-size: clamp(19px, 1.5vw, 22px); line-height: 1.4; }
.prose p + p { margin-top: 1em; }
.prose p { text-wrap: pretty; }
.prose--lead > p:first-child { font-size: clamp(19px, 1.5vw, 22px); line-height: 1.5; color: var(--ink); }
.urdu { font-family: var(--urdu); direction: rtl; line-height: 2.1; font-weight: 400; }

.label { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); line-height: 1.3; }
.label b { color: var(--ink); font-weight: 700; letter-spacing: .12em; }
.label--rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.on-forest .label { color: var(--on-forest-muted); }
.on-forest .label b { color: #fff; }
.on-forest .label--rule::after { background: rgba(255,255,255,.16); }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--forest); }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section); }
.section--tight { padding-block: clamp(56px, 6vw, 88px); }
.section + .section:not(.section--paper):not(.section--forest):not(.section--flush) { border-top: 1px solid var(--line); }
.section--paper { background: var(--paper); }
.section--forest { background: var(--forest); color: var(--on-forest); }
.section--forest h2, .section--forest h3 { color: #fff; }
.section-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px clamp(32px, 6vw, 96px); align-items: end; margin-bottom: clamp(40px, 5vw, 64px); }
.section-head .label { margin-bottom: 22px; }
.section-head p { color: var(--muted); max-width: 52ch; }
.section-head--stack { grid-template-columns: 1fr; }
.row { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 24px clamp(32px, 6vw, 96px); }
.row + .row { margin-top: clamp(48px, 6vw, 80px); }
.row__aside .label { margin-bottom: 16px; }
.row__aside .h3 { max-width: 20ch; }
.row .prose { font-size: 18px; }
.stack > * + * { margin-top: var(--stack, 16px); }

/* ---------- Motifs ---------- */
.motif { width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.js .motif:not(.is-live) { opacity: 0; }
.js .motif.is-live { opacity: 1; transition: opacity .3s; }
@media (prefers-reduced-motion: reduce) { .js .motif:not(.is-live) { opacity: 1; } }
.motif circle { fill: var(--forest); transition: fill .3s; }
.motif circle.red { fill: var(--red); }
.motif .links line { stroke: var(--forest); stroke-width: .18; opacity: .4; transition: opacity .4s; }
.on-forest .motif circle { fill: #e4ede6; }
.on-forest .motif circle.red { fill: #ff5a5f; }
.on-forest .motif .links line { stroke: #e4ede6; }
.dotrule { width: 100%; height: auto; display: block; }
.dotrule circle { fill: currentColor; }
.dotrule circle.red { fill: var(--red); }

/* ---------- Buttons & links ---------- */
.btn { --b: var(--forest); display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 12px 22px; background: var(--b); color: #fff; border: 1px solid var(--b); font-size: 15px; font-weight: 700; letter-spacing: .005em; text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s, color .2s; white-space: nowrap; }
.btn:hover { --b: var(--forest-deep); }
.btn .arr { transition: transform .25s var(--ease); }
.btn:hover .arr { transform: translateX(3px); }
.btn--line { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--line:hover { background: var(--ink); color: #fff; }
.btn--light { --b: #fff; color: var(--forest-deep); }
.btn--light:hover { --b: var(--sage); }
.btn--ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn--ghost-light:hover { background: rgba(255,255,255,.08); border-color: #fff; }
.btn--sm { min-height: 40px; padding: 8px 16px; font-size: 14px; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }

.arrow-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--forest); text-decoration: none; }
.arrow-link .arr { transition: transform .25s var(--ease); }
.arrow-link:hover .arr { transform: translateX(4px); }
.arrow-link:hover { color: var(--forest-deep); }
.on-forest .arrow-link { color: #fff; }
.text-link { color: var(--forest); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--sage-2); transition: text-decoration-color .2s; }
.text-link:hover { text-decoration-color: currentColor; }

.chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; background: var(--sage); color: var(--forest); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; line-height: 1.3; text-decoration: none; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip--plain::before { display: none; }
.chip--line { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); }
.chip--status { background: var(--paper); color: var(--ink-2); }
.chip--status::before { background: var(--forest); }
.chip--red::before { background: var(--red); }
a.chip:hover { background: var(--sage-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Header ---------- */
.utility { background: var(--forest-deep); color: var(--on-forest); font-size: 12.5px; height: var(--utility-h); position: relative; z-index: 41; }
.utility .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.utility a { color: #fff; text-decoration: none; }
.utility a:hover { text-decoration: underline; text-underline-offset: 3px; }
.utility__left { display: flex; gap: 22px; align-items: center; white-space: nowrap; overflow: hidden; }
.utility__left span + span::before { content: "·"; margin-right: 22px; color: var(--on-forest-muted); }
.utility__right { display: flex; gap: 22px; align-items: center; white-space: nowrap; }
.crisis-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.crisis-link::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(196,38,46,.25); }

.masthead { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.97); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent; transition: border-color .25s, box-shadow .25s; }
.masthead.is-stuck { border-bottom-color: var(--line); }
.masthead__bar { height: var(--mast-h); display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex: none; }
.brand__mark { width: 38px; height: 38px; flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.brand__desc { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; margin-top: 3px; }

.nav { margin-left: auto; height: 100%; }
.nav__list { display: flex; align-items: stretch; height: 100%; gap: 2px; }
.nav__item { display: flex; align-items: center; }
.nav__link { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; font-size: 15px; font-weight: 400; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; position: relative; }
.nav__link::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--forest); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
.nav__link:hover::after, .nav__link[aria-expanded="true"]::after, .nav__link.is-current::after { transform: scaleX(1); }
.nav__link.is-current { color: var(--forest); font-weight: 700; }
.nav__caret { width: 9px; height: 9px; transition: transform .25s; }
.nav__link[aria-expanded="true"] .nav__caret { transform: rotate(180deg); }
.masthead__cta { margin-left: 10px; }

/* Mega panels */
.panel { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); box-shadow: 0 30px 60px -30px rgba(21,32,26,.18); opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .22s, transform .28s var(--ease), visibility 0s .28s; }
.panel.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity .22s, transform .28s var(--ease); }
.panel__inner { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: 48px; padding-block: 40px 44px; }
.panel__intro .h3 { margin: 14px 0 10px; }
.panel__intro p { color: var(--muted); font-size: 15px; max-width: 30ch; }
.panel__intro .arrow-link { margin-top: 18px; font-size: 14px; }
.panel__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.panel__grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel__link { display: grid; grid-template-columns: 1fr auto; align-content: start; gap: 4px 16px; padding: 16px 18px 18px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); position: relative; }
.panel__grid > .panel__link:not(:nth-child(3n+1)) { padding-left: 18px; border-left: 1px solid var(--line); }
.panel__grid--2 > .panel__link:not(:nth-child(3n+1)) { padding-left: 0; border-left: 0; }
.panel__grid--2 > .panel__link:nth-child(2n) { padding-left: 18px; border-left: 1px solid var(--line); }
.panel__link b { font-size: 16px; letter-spacing: -.01em; }
.panel__link small { grid-column: 1; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.panel__link .num { grid-row: 1; grid-column: 2; font-size: 12px; color: var(--faint); letter-spacing: .08em; }
.panel__link:hover b { color: var(--forest); }
.panel__link .mini { grid-row: 1 / span 2; grid-column: 2; width: 46px; height: 46px; opacity: .9; }
.panel__link--pillar { grid-template-columns: 1fr 46px; align-items: center; }
.panel__intro p.h3 { color: var(--ink); font-size: 22px; font-weight: 700; max-width: none; }
.drawer ul { list-style: none; padding-left: 0; }
.panel__link--pillar .sdg { display: block; white-space: nowrap; font-size: 11px; letter-spacing: .1em; color: var(--faint); text-transform: uppercase; margin-top: 2px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--forest); color: var(--on-forest); font-size: 15px; }
.site-footer a { color: var(--on-forest); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.footer__rule { color: rgba(255,255,255,.5); padding-top: 56px; }
.footer__top { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 48px clamp(40px, 7vw, 120px); padding-block: 56px 56px; border-bottom: 1px solid rgba(255,255,255,.14); }
.footer__statement { font-size: clamp(24px, 2.3vw, 34px); line-height: 1.2; letter-spacing: -.02em; color: #fff; font-weight: 700; max-width: 22ch; }
.footer__statement em { font-family: var(--serif); font-weight: 320; font-style: italic; color: var(--on-forest); letter-spacing: -.01em; }
.newsletter label { display: block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--on-forest-muted); margin-bottom: 12px; }
.newsletter__row { display: flex; border: 1px solid rgba(255,255,255,.35); }
.newsletter input { flex: 1; min-width: 0; background: transparent; border: 0; padding: 14px 16px; color: #fff; font-size: 16px; }
.newsletter input::placeholder { color: var(--on-forest-muted); }
.newsletter input:focus { outline: none; }
.newsletter__row:focus-within { border-color: #fff; }
.newsletter button { background: #fff; color: var(--forest-deep); border: 0; padding: 0 20px; font-weight: 700; cursor: pointer; }
.newsletter button:hover { background: var(--sage); }
.newsletter p { margin-top: 12px; font-size: 13.5px; color: var(--on-forest-muted); }
.footer__dl { display: inline-flex; gap: 10px; align-items: center; margin-top: 26px; font-weight: 700; color: #fff !important; }
.footer__cols { display: grid; grid-template-columns: minmax(0, 4fr) repeat(3, minmax(0, 2.6fr)); gap: 40px; padding-block: 48px; }
.footer__cols h2 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--on-forest-muted); font-weight: 400; margin-bottom: 16px; }
.footer__cols li + li { margin-top: 9px; }
.footer__brand p { max-width: 36ch; }
.footer__contact { margin-top: 20px; display: grid; gap: 4px; }
.footer__contact span { color: var(--on-forest-muted); }
.socials { display: flex; gap: 8px; margin-top: 22px; }
.socials a { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.28); transition: background .2s, border-color .2s; }
.socials a:hover { background: rgba(255,255,255,.1); border-color: #fff; text-decoration: none; }
.socials svg { width: 16px; height: 16px; fill: currentColor; }
.footer__bottom { border-top: 1px solid rgba(255,255,255,.14); padding-block: 22px 28px; display: flex; justify-content: space-between; gap: 16px 32px; flex-wrap: wrap; font-size: 13px; color: var(--on-forest-muted); }
.footer__bottom .crisis-link { color: #fff; }

/* ---------- Page heads ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--forest); text-decoration: underline; text-underline-offset: 3px; }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-2); }
.page-head { padding-block: clamp(48px, 6vw, 88px) clamp(56px, 7vw, 104px); border-bottom: 1px solid var(--line); }
.page-head__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 40px clamp(40px, 7vw, 120px); align-items: center; }
.page-head .label { margin-bottom: 24px; }
.page-head h1 { max-width: 17ch; }
.page-head .lede { margin-top: 26px; max-width: 54ch; }
.page-head .btns { margin-top: 32px; }
.page-head__art { width: 100%; max-width: 380px; justify-self: end; }
.page-head__meta { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); max-width: 640px; }
.page-head__meta b { color: var(--ink); display: block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 2px; }

/* Pillar head */
.pillar-head { padding-block: clamp(40px, 5vw, 72px) clamp(56px, 7vw, 96px); border-bottom: 1px solid var(--line); }
.pillar-head__grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 40px clamp(40px, 6vw, 96px); align-items: center; }
.pillar-head .urdu { font-size: clamp(64px, 8.4vw, 124px); color: var(--forest); text-align: left; line-height: 2; margin: -.45em 0 .1em; }
.pillar-head .names { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; font-size: clamp(20px, 1.7vw, 24px); font-weight: 700; letter-spacing: -.015em; }
.pillar-head .names span { font-weight: 400; color: var(--muted); }
.pillar-head .names span::before { content: "·"; margin-right: 12px; color: var(--line-2); }
.pillar-head h1 { margin: 14px 0 22px; max-width: 15ch; }
.pillar-head .tagline { margin-top: 32px; padding-top: 26px; border-top: 1px solid var(--line); max-width: 30ch; }
.pillar-head__art { max-width: 520px; justify-self: end; width: 100%; }

/* In-page subnav */
.subnav { position: sticky; top: var(--mast-h); z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.subnav__list { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.subnav__list::-webkit-scrollbar { display: none; }
.subnav a { display: block; padding: 15px 12px; font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .2s, border-color .2s; }
.subnav a:first-child { padding-left: 0; }
.subnav a:hover { color: var(--ink); }
.subnav a.is-active { color: var(--forest); border-bottom-color: var(--forest); font-weight: 700; }

/* ---------- Components ---------- */
/* Numbered list grid (What we do, values, outcomes) */
.numlist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); counter-reset: n; }
.numlist--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.numlist > li { counter-increment: n; align-content: start; padding: 18px 20px 20px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; align-items: baseline; }
.numlist > li::before { content: counter(n, decimal-leading-zero); font-size: 12px; color: var(--forest); font-weight: 700; letter-spacing: .06em; }
.numlist > li > * { grid-column: 2; }
.numlist b { font-size: 17px; letter-spacing: -.01em; }
.numlist p { color: var(--muted); font-size: 15px; margin-top: 4px; }

/* Results chain */
.chain { display: grid; grid-template-columns: repeat(var(--steps, 3), minmax(0, 1fr)); gap: 0; position: relative; }
.chain__step { position: relative; padding: 0 clamp(20px, 2.4vw, 36px) 0 0; }
.chain__step + .chain__step { padding-left: clamp(20px, 2.4vw, 36px); border-left: 1px solid var(--line-2); }
.chain__top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.chain__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--forest); flex: none; position: relative; }
.chain__step:last-child .chain__dot { background: var(--red); }
.chain__name { font-weight: 700; font-size: 20px; letter-spacing: -.015em; }
.chain__when { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-left: auto; }
.chain__line { position: absolute; top: 7px; left: 24px; right: 0; height: 1px; background: repeating-linear-gradient(90deg, var(--line-2) 0 3px, transparent 3px 7px); }
.chain__step + .chain__step .chain__line { left: calc(clamp(20px, 2.4vw, 36px) + 24px); }
.chain__step:last-child .chain__line { display: none; }
.chain__top { position: relative; z-index: 1; }
.chain__top .chain__name, .chain__top .chain__when { background: inherit; }
.chain p { color: var(--ink-2); font-size: 16px; }
.section--paper .chain__step + .chain__step { border-color: var(--line-2); }

/* Generic cards */
.cards { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 24px; }
.card { min-width: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); padding: 26px 26px 24px; text-decoration: none; color: var(--ink); position: relative; transition: border-color .25s, transform .35s var(--ease), box-shadow .35s; }
a.card:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: 0 18px 40px -26px rgba(21,32,26,.3); }
.card .kicker { margin-bottom: 12px; }
.card h3 { margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 15px; }
.card__foot { margin-top: auto; padding-top: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.arrow-link { white-space: nowrap; }
.card__art { width: 64px; height: 64px; margin-bottom: 18px; }
.section--paper .card { border-color: transparent; }

/* Post cards */
.posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; }
.post-card { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.post-card__art { aspect-ratio: 16 / 10; background: var(--paper); display: grid; place-items: center; overflow: hidden; margin-bottom: 18px; position: relative; transition: background .3s; }
.section--paper .post-card__art { background: #fff; }
.post-card__art .motif { width: 56%; }
.post-card .chips { margin-bottom: 12px; }
.post-card h3 { font-size: 21px; line-height: 1.25; letter-spacing: -.015em; transition: color .2s; }
.post-card:hover h3 { color: var(--forest); }
.post-card p { color: var(--muted); font-size: 15px; margin-top: 8px; }
.post-card__meta { margin-top: 14px; font-size: 13px; color: var(--faint); }
.empty { border: 1px dashed var(--line-2); padding: 36px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }

/* Accordions */
.acc { border-top: 1px solid var(--ink); }
.acc details { border-bottom: 1px solid var(--line); }
.acc details.is-animating { overflow: hidden; }
.acc summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto 32px; gap: 16px; align-items: center; padding: 20px 0; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary:hover .acc__title { color: var(--forest); }
.acc__num { font-size: 12px; color: var(--faint); letter-spacing: .08em; }
.acc__title { font-size: clamp(18px, 1.5vw, 21px); font-weight: 700; letter-spacing: -.015em; transition: color .2s; }
.acc__title small { display: block; font-weight: 400; color: var(--muted); font-size: 14.5px; letter-spacing: 0; margin-top: 2px; }
.acc__name { font-family: var(--serif); font-style: italic; font-weight: 340; font-size: 1.1em; color: var(--forest); margin-right: 6px; }
.acc__icon { width: 32px; height: 32px; border: 1px solid var(--line-2); display: grid; place-items: center; transition: transform .3s var(--ease), background .2s; }
.acc__icon::before { content: "+"; font-size: 18px; line-height: 1; }
.acc details[open]:not(.is-closing) .acc__icon { transform: rotate(45deg); background: var(--sage); border-color: var(--sage); }
.acc__body { display: grid; grid-template-columns: 52px minmax(0, 7fr) minmax(0, 4fr); gap: 16px 40px; padding: 0 0 32px; }
.acc__body > * { grid-column: 2; }
.acc__body > aside { grid-column: 3; grid-row: 1 / span 3; }
.acc__body dl { display: grid; gap: 16px; font-size: 14.5px; }
.acc__body dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 4px; }
.acc__body dd { margin: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.stat { padding: 26px 24px 0 0; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line-2); }
.stat__n { font-size: clamp(48px, 5.6vw, 88px); line-height: 1; letter-spacing: -.045em; font-weight: 400; color: var(--ink); }
.stat__n sup { font-size: .42em; vertical-align: top; margin-left: 2px; letter-spacing: 0; position: relative; top: .25em; }
.stat__l { margin-top: 12px; font-size: 15px; color: var(--muted); max-width: 20ch; }

/* Definition rows (resources, tiers) */
.defs { border-top: 1px solid var(--ink); }
.defs > div { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); gap: 16px 40px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.defs dt { font-weight: 700; font-size: 15px; }
.defs dt small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 4px; }
.defs dd { margin: 0; color: var(--ink-2); }
.defs ul { padding-left: 0; list-style: none; display: grid; gap: 10px; }
.defs ul li { display: grid; grid-template-columns: 18px 1fr; }
.defs ul li::before { content: "→"; color: var(--forest); }

/* Doc list */
.docs { border-top: 1px solid var(--ink); }
.doc { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.doc__icon { width: 44px; height: 54px; border: 1px solid var(--line-2); position: relative; background: #fff; }
.doc__icon::before { content: ""; position: absolute; right: -1px; top: -1px; border-style: solid; border-width: 0 12px 12px 0; border-color: transparent var(--paper) var(--line-2) transparent; }
.doc__icon::after { content: ""; position: absolute; left: 9px; right: 9px; top: 20px; height: 18px; background: repeating-linear-gradient(var(--line-2) 0 1px, transparent 1px 5px); }
.doc b { display: block; font-size: 17px; letter-spacing: -.01em; }
.doc small { color: var(--muted); font-size: 14px; }
a.doc:hover b { color: var(--forest); }

/* Notice */
.notice { display: grid; grid-template-columns: 14px 1fr; gap: 14px; padding: 18px 20px; background: var(--paper); border-left: 3px solid var(--red); font-size: 15px; }
.notice::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-top: 7px; }
.notice a { color: var(--ink); font-weight: 700; }

/* Pager (prev / next) */
.pager { display: grid; grid-template-columns: 1fr 1fr; }
.pager a { display: block; padding: 36px 0; text-decoration: none; color: var(--ink); border-top: 1px solid var(--line); }
.pager a + a { text-align: right; border-left: 1px solid var(--line); padding-left: 24px; }
.pager a:first-child { padding-right: 24px; }
.pager small { display: block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.pager b { font-size: clamp(20px, 2vw, 28px); letter-spacing: -.02em; transition: color .2s; }
.pager span { display: block; color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.pager a:hover b { color: var(--forest); }

/* CTA band */
.band { background: var(--forest); color: var(--on-forest); position: relative; overflow: hidden; }
.band__inner { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 40px clamp(40px, 7vw, 120px); align-items: center; padding-block: clamp(64px, 8vw, 112px); }
.band h2 { color: #fff; font-size: clamp(28px, 3vw, 46px); line-height: 1.1; letter-spacing: -.025em; max-width: 22ch; }
.band p { margin-top: 18px; max-width: 56ch; }
.band .btns { margin-top: 34px; }
.band__art { width: 100%; max-width: 360px; justify-self: end; opacity: .9; }
.band__art .motif circle { fill: #cfe0d4; }
.band__art .motif circle.red { fill: #ff5a5f; }

/* Forms */
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; font-weight: 700; }
.field label span { color: var(--muted); font-weight: 400; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line-2); background: #fff; padding: 13px 14px; font-size: 16px; border-radius: 0; transition: border-color .2s, box-shadow .2s; appearance: none; -webkit-appearance: none; }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2315201a' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.field textarea { min-height: 160px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px var(--sage); }
.field .err { color: var(--red); font-size: 13.5px; display: none; }
.field.is-invalid input, .field.is-invalid textarea, .field.is-invalid select { border-color: var(--red); }
.field.is-invalid .err { display: block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid .full { grid-column: 1 / -1; }

/* Reveal motion */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .nav__link { padding: 0 9px; font-size: 14.5px; }
  .nav__link::after { left: 9px; right: 9px; }
  .brand__desc { display: none; }
  .utility__hide-md { display: none; }
}
@media (max-width: 1023px) {
  .nav, .masthead__cta, .panel { display: none; }
    .section-head, .row, .page-head__grid, .pillar-head__grid, .band__inner, .footer__top { grid-template-columns: 1fr; }
  .page-head__art, .pillar-head__art { justify-self: start; max-width: 300px; }
  .pillar-head__art { order: -1; max-width: 240px; }
  .band__art { justify-self: start; max-width: 220px; order: -1; }
  .numlist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer__cols { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { margin-top: 28px; border-top: 1px solid var(--line-2); }
  .chain { grid-template-columns: 1fr; gap: 28px; }
  .chain__step + .chain__step { padding-left: 0; border-left: 0; padding-top: 28px; border-top: 1px solid var(--line-2); }
  .chain__line { display: none; }
  .acc__body { grid-template-columns: 52px 1fr; }
  .acc__body > aside { grid-column: 2; grid-row: auto; }
  .row__aside .h3 { max-width: none; }
}
@media (max-width: 680px) {
  body { font-size: 16.5px; }
  .chip { white-space: normal; }
  .pillar-head .tagline { font-size: 22px; }
  .utility__left { display: none; }
  .utility .wrap { justify-content: center; }
  .numlist, .numlist--2, .posts, .cards, .footer__cols { grid-template-columns: 1fr; }
  .numlist > li { padding-right: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .defs > div { grid-template-columns: 1fr; gap: 8px; }
  .acc summary { grid-template-columns: 36px minmax(0, 1fr) 32px; }
  .acc summary .chips { display: none; }
  .acc__body { grid-template-columns: 1fr; }
  .acc__body > *, .acc__body > aside { grid-column: 1; }
  .pager { grid-template-columns: 1fr; }
  .pager a + a { text-align: left; border-left: 0; border-top: 1px solid var(--line); }
  .doc { grid-template-columns: 36px 1fr; }
  .doc .chip, .doc .arrow-link { grid-column: 2; justify-self: start; }
  .doc__icon { width: 36px; height: 44px; }
  .doc__icon::after { top: 16px; left: 7px; right: 7px; height: 14px; }
  .footer__bottom { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
