/* Brand tokens: paper, ink, yellow (figures only). Fraunces for editorial, Inter Tight for UI. */
:root {
  --paper: #F2F2EC;
  --ink: #16170F;
  --yellow: #FFED00;
  --muted: #5B5C52;
  --rule: #D5D5CA;
  --surface: #FAFAF5;
  --red: #9C2A12;
  --green: #2E5E1E;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 10; }
.skip:focus { left: 8px; }

/* Figures: the one place yellow appears */
mark.fig {
  background: var(--yellow);
  color: var(--ink);
  padding: .04em .22em;
  font-weight: 600;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  font-variant-numeric: tabular-nums;
}

/* Header */
.site-head { border-bottom: 1.5px solid var(--ink); }
.site-head__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 68px; }
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 23px;
  letter-spacing: -.015em;
  text-decoration: none;
  font-variation-settings: 'opsz' 48;
}
.site-head nav { display: flex; gap: 28px; font-size: 15px; font-weight: 500; }
.site-head nav a { text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-head nav a:hover, .site-head nav a[aria-current] { border-bottom-color: var(--ink); }

/* Hero */
.hero { padding-top: clamp(48px, 9vw, 104px); padding-bottom: clamp(36px, 6vw, 64px); }
.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(42px, 7.2vw, 88px);
  line-height: .98;
  letter-spacing: -.032em;
  font-variation-settings: 'opsz' 144;
  max-width: 15ch;
  margin: 0 0 28px;
}
.hero__lede { font-size: clamp(18px, 1.6vw, 20px); color: var(--muted); max-width: 54ch; margin: 0; }
.hero__live { font-size: 18px; margin: 28px 0 0; }
.hero__live mark.fig { font-size: 1.15em; }

/* Filters */
.directory { padding-bottom: 96px; }
.filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: end;
  padding: 22px;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13.5px; font-weight: 600; }
.field input, .field select {
  font: 400 16px/1.3 var(--sans);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #A9AA9E;
  border-radius: 6px;
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2316170F' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.filters__actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 20px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 15px/1 var(--sans);
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: 6px;
  padding: 14px 20px; min-height: 46px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: #2D2E24; }
.btn--block { width: 100%; }
.link-quiet { font-size: 15px; color: var(--muted); }

/* Status tabs + sort */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 36px 0 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a {
  text-decoration: none; font-size: 15px; font-weight: 500;
  padding: 8px 14px; border-radius: 999px; border: 1px solid transparent;
}
.tabs a:hover { border-color: var(--rule); }
.tabs a[aria-current] { background: var(--ink); color: var(--paper); }
.tabs__n { opacity: .6; font-variant-numeric: tabular-nums; margin-left: 2px; }
.sort { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.sort select {
  font: 500 14px var(--sans); color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px;
}

/* Grant list: a ledger, not a card grid */
.list-head {
  display: grid; grid-template-columns: minmax(0, 1fr) 14rem 12rem; gap: 32px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 0 0 10px; border-bottom: 2px solid var(--ink);
}
.grant-list { list-style: none; margin: 0; padding: 0; }
.related .grant-list { border-top: 2px solid var(--ink); }
.grant-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 14rem 12rem; gap: 32px;
  padding: 24px 0; border-bottom: 1px solid var(--rule); align-items: start;
}
.grant-row h3 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(21px, 2.1vw, 25px); line-height: 1.2; letter-spacing: -.012em;
  margin: 0 0 6px; font-variation-settings: 'opsz' 36;
}
.grant-row h3 a { text-decoration: none; }
.grant-row h3 a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; }
.grant-row__by { margin: 0; color: var(--muted); font-size: 15px; }
.grant-row__tags { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.grant-row__tags span { font-size: 12.5px; font-weight: 500; padding: 3px 9px; border: 1px solid var(--rule); border-radius: 999px; }
.grant-row__amount { font-size: 18px; padding-top: 3px; }
.grant-row__deadline { display: flex; flex-direction: column; gap: 2px; padding-top: 3px; font-size: 15px; }
.deadline { font-weight: 600; }
.deadline__note { font-size: 14px; color: var(--muted); }
.deadline__note--closing { color: var(--red); font-weight: 600; }
.grant-row--closed { opacity: .58; }

.empty { padding: 56px 0; border-top: 2px solid var(--ink); }
.empty__title { font-family: var(--serif); font-size: 26px; margin: 0 0 8px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 24px; padding: 36px 0 0; font-size: 15px; }
.pager a { font-weight: 600; }

/* Grant page */
.grant-page {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px 72px;
  grid-template-areas: "head facts" "body facts";
  padding-top: 40px; padding-bottom: 72px;
}
.grant-page__head { grid-area: head; }
.facts { grid-area: facts; }
.grant-page__body { grid-area: body; min-width: 0; }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 20px; }
.grant-page h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(34px, 4.6vw, 58px); line-height: 1.03; letter-spacing: -.026em;
  font-variation-settings: 'opsz' 144; margin: 0 0 20px; max-width: 20ch;
}
.grant-page__lede { font-size: 20px; line-height: 1.5; color: var(--muted); margin: 0; max-width: 58ch; }
.facts {
  position: sticky; top: 24px; align-self: start;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 10px; padding: 24px;
}
.facts dl { margin: 0 0 20px; }
.facts dl > div { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.facts dl > div:first-child { padding-top: 0; }
.facts dt { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.facts dd { margin: 0; font-size: 16px; }
.facts dd .deadline__note { display: block; margin-top: 2px; }
.facts__amount dd { font-size: 24px; font-family: var(--serif); }
.facts__amount mark.fig { font-weight: 600; }
.facts__closed { margin: 0; font-weight: 600; color: var(--red); }
.facts__updated { font-size: 13px; color: var(--muted); margin: 16px 0 0; }
.share { display: flex; gap: 8px; margin-top: 12px; }
.share__btn {
  flex: 1; text-align: center; font: 500 14px/1.2 var(--sans); color: var(--ink);
  background: transparent; border: 1px solid var(--rule); border-radius: 6px;
  padding: 10px 8px; cursor: pointer; text-decoration: none;
}
.share__btn:hover { border-color: var(--ink); }
.notice { background: var(--surface); border-left: 3px solid var(--red); padding: 14px 18px; margin: 0 0 28px; font-size: 16px; }
.cover { margin: 0 0 32px; }
.cover img { border-radius: 8px; width: 100%; }
.draft-bar { background: var(--ink); color: var(--paper); text-align: center; padding: 10px 16px; font-size: 14px; }

/* Article text */
.prose { font-family: var(--serif); font-size: 19px; line-height: 1.72; max-width: 66ch; font-variation-settings: 'opsz' 14; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.1em; }
.prose h2 {
  font-size: 28px; line-height: 1.2; font-weight: 600; letter-spacing: -.015em;
  margin: 1.9em 0 .55em; font-variation-settings: 'opsz' 48;
}
.prose h3 { font-size: 22px; line-height: 1.3; font-weight: 600; margin: 1.6em 0 .4em; }
.prose h4 { font-family: var(--sans); font-size: 17px; margin: 1.4em 0 .3em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin: .35em 0; padding-left: .2em; }
.prose ol li::marker { font-family: var(--sans); font-weight: 600; font-size: .85em; }
.prose strong { font-weight: 650; }
.prose a { text-decoration-color: rgba(22, 23, 15, .4); }
.prose blockquote { margin: 1.4em 0; padding: 0 0 0 20px; border-left: 2px solid var(--ink); font-style: italic; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82em; background: var(--surface); padding: .1em .35em; border-radius: 3px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.2em 0; }
.disclaimer { font-size: 14px; color: var(--muted); max-width: 66ch; margin: 40px 0 0; padding-top: 20px; border-top: 1px solid var(--rule); }

.related { padding-bottom: 96px; }
.related h2 { font-family: var(--serif); font-weight: 500; font-size: 30px; letter-spacing: -.015em; margin: 0 0 16px; }

.page { padding-top: 56px; padding-bottom: 96px; }
.page h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(36px, 5vw, 60px); letter-spacing: -.026em; line-height: 1.04; margin: 0 0 32px; }
.notfound { padding: 96px 24px; }
.notfound h1 { font-family: var(--serif); font-weight: 500; font-size: 48px; margin: 0 0 12px; }

/* Footer */
.site-foot { border-top: 1.5px solid var(--ink); padding: 40px 0 28px; font-size: 15px; }
.site-foot__inner { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.site-foot__name { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.site-foot__note { color: var(--muted); max-width: 52ch; margin: 0; }
.site-foot__links { display: flex; flex-direction: column; gap: 8px; }
.site-foot__base { color: var(--muted); font-size: 13px; margin-top: 32px; }

/* Responsive */
@media (max-width: 980px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .field--search { grid-column: 1 / -1; }
  .grant-page { grid-template-columns: 1fr; grid-template-areas: "head" "facts" "body"; }
  .facts { position: static; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .site-head nav { gap: 18px; }
  .filters { padding: 16px; gap: 12px; }
  .list-head { display: none; }
  .grant-list { border-top: 2px solid var(--ink); }
  .grant-row { grid-template-columns: 1fr auto; gap: 10px 16px; padding: 20px 0; }
  .grant-row__main { grid-column: 1 / -1; }
  .grant-row__amount { padding-top: 0; }
  .grant-row__deadline { text-align: right; padding-top: 0; }
  .prose { font-size: 18px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 340px) {
  .filters { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
