/* Documentary Funding Database
   Palette and type follow seanpeoples.me: cream, deep green, sage;
   Libre Baskerville for display, Almarai for text. */

:root {
  --cream: #F2F0E9;
  --paper: #FAF9F5;
  --ink: #223F37;
  --ink-hover: #17302A;
  --ink-80: rgba(34, 63, 55, .82);
  --ink-60: rgba(34, 63, 55, .64);
  --line: rgba(34, 63, 55, .14);
  --line-strong: rgba(34, 63, 55, .32);
  --sage: #A8B8AC;
  --sage-soft: #DFE5DF;
  --ochre: #8E531F;
  --ochre-soft: #F1E2CE;
  --serif: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --sans: 'Almarai', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --radius: 4px;
  --max: 1240px;
  --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 20px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { font-family: var(--sans); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--cream); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px); }
.narrow { max-width: 760px; }
.muted { color: var(--ink-60); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; }
.skip { position: absolute; left: -10000px; top: 12px; z-index: 100; background: var(--ink); color: var(--cream); padding: 10px 14px; }
.skip:focus { left: 12px; }

.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 18px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--ink); color: var(--cream); border: 1px solid var(--ink); border-radius: var(--radius); padding: 13px 20px; font: 700 15px/1 var(--sans); text-decoration: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-sm { padding: 10px 14px; font-size: 14px; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--cream); }
.btn-light { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.btn-light:hover { background: #fff; border-color: #fff; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--ink-60); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--ink); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(242, 240, 233, .94); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: var(--header-h); }
.brand { display: flex; align-items: baseline; gap: 14px; text-decoration: none; min-width: 0; }
.brand-name { font-family: var(--serif); font-size: 19px; white-space: nowrap; }
.brand-sub { font-size: 13px; color: var(--ink-60); padding-left: 14px; border-left: 1px solid var(--line-strong); white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav-links { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.nav-links a { text-decoration: none; padding: 4px 0; border-bottom: 1px solid transparent; }
.nav-links a:hover, .nav-links a[aria-current="page"] { border-bottom-color: var(--ink); }
.menu-toggle { display: none; background: none; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 9px 12px; font: 700 14px/1 var(--sans); color: var(--ink); cursor: pointer; }

@media (max-width: 1060px) { .brand-sub { display: none; } }
@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .nav { gap: 10px; }
  .nav-links { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px clamp(20px, 4vw, 48px) 20px; background: var(--cream); border-bottom: 1px solid var(--line); font-size: 17px; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 8px 0; }
}

/* Hero */
.hero { padding: clamp(20px, 3vw, 40px) 0 0; }
/* Full title-card image. The height cap trims only the top and bottom edges, so the centered title text is never cut. */
.hero-banner { width: 100%; height: auto; max-height: min(64vh, 660px); object-fit: cover; object-position: center; border-radius: var(--radius); background: var(--ink); }
.hero-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 48px; margin-top: clamp(28px, 4vw, 44px); }
.hero-intro .lede { margin-top: 0; }
.hero-intro .hero-actions { margin-top: 0; flex: none; }
@media (max-width: 860px) { .hero-intro { flex-direction: column; align-items: flex-start; } }
.page-title { font-family: var(--serif); font-weight: 400; font-size: clamp(38px, 5.4vw, 66px); line-height: 1.06; letter-spacing: -.02em; }
.lede { font-size: clamp(17px, 1.5vw, 20px); line-height: 1.55; color: var(--ink-80); max-width: 56ch; margin-top: 24px; }
.hero-actions, .page-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: clamp(40px, 6vw, 72px); border-top: 1px solid var(--ink); }
.stat { padding: 18px 20px 0 0; display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.stat dd { font-family: var(--serif); font-size: clamp(28px, 3.2vw, 40px); line-height: 1.1; }
.stat dt { font-size: 13px; color: var(--ink-60); margin-top: 6px; }
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 12px; }
}

/* Closing soon */
.soon { padding: clamp(48px, 6vw, 72px) 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 2.4vw, 28px); }
.soon-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.soon-card { display: flex; flex-direction: column; height: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; text-decoration: none; transition: border-color .15s, transform .15s; }
.soon-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.soon-when { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ochre); }
.soon-name { font-family: var(--serif); font-size: 17px; line-height: 1.32; margin: 10px 0 8px; }
.soon-meta { font-size: 13px; color: var(--ink-60); margin-top: auto; }

/* Database layout */
.db { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: clamp(32px, 4vw, 56px); align-items: start; padding-top: clamp(48px, 6vw, 72px); padding-bottom: 96px; }
.filters { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; padding: 2px 8px 8px 2px; scrollbar-width: thin; }
.filters-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 14px; }
.filters-head h2 { font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.fgroup { border: 0; border-top: 1px solid var(--line); padding: 16px 0; }
legend.flabel { float: left; width: 100%; }
legend.flabel + * { clear: both; }
.flabel { display: block; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 10px; padding: 0; }
.input, .select { width: 100%; font: 15px/1.4 var(--sans); color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 11px 12px; transition: border-color .15s; }
.input::placeholder { color: var(--ink-60); }
.input:focus, .select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; 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 1.5l5 5 5-5' fill='none' stroke='%23223F37' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.seg { display: flex; border: 1px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.seg button { flex: 1; background: transparent; border: 0; padding: 9px 4px; font: 700 13px/1.2 var(--sans); color: var(--ink); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.checks { display: flex; flex-direction: column; gap: 1px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 4px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); flex: none; cursor: pointer; }
.check .n { margin-left: auto; font-size: 12px; color: var(--ink-60); }
#intl-wrap { margin-top: 10px; font-size: 13px; }
.checks:not(.all) .extra { display: none; }
.more-toggle { margin-top: 8px; }
.hint { font-size: 12px; color: var(--ink-60); margin-top: 8px; font-weight: 400; }

/* Search and sort toolbar: always visible, pinned under the header while you scroll the results. */
.toolbar { position: sticky; top: var(--header-h); z-index: 20; display: flex; align-items: center; gap: 12px 16px; padding: 14px 0; background: var(--cream); border-bottom: 1px solid var(--ink); }
.toolbar.stuck { box-shadow: 0 10px 18px -14px rgba(34, 63, 55, .45); }
.search-box { position: relative; flex: 1 1 auto; min-width: 0; }
.search-box .input { height: 48px; padding-left: 44px; font-size: 16px; background: var(--paper); }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-60); pointer-events: none; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.sort { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-60); }
.sort .select { width: auto; height: 48px; padding: 0 34px 0 12px; font-size: 14px; color: var(--ink); }
.filters-toggle { display: none; height: 48px; }
.filters-done { display: none; width: 100%; margin-top: 8px; }
.count { font-size: 15px; margin: 18px 0 16px; scroll-margin-top: calc(var(--header-h) + var(--toolbar-h, 80px) + 8px); }
.count strong { font-family: var(--serif); font-weight: 400; font-size: 24px; margin-right: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:not(:empty) { margin-bottom: 20px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--sage-soft); border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; font: 13px/1.3 var(--sans); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip::after { content: "\00D7"; font-size: 16px; line-height: 1; }

@media (max-width: 900px) {
  /* Stack as: results bar (with the Filters button), filter panel, then the list. */
  .db { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
  .results { display: contents; }
  .filters { position: static; max-height: none; overflow: visible; padding: 0 0 8px; margin-bottom: 8px; }
  .filters:not(.open) { display: none; }
  .filters-toggle { display: inline-flex; }
  .filters-done { display: inline-flex; }
  .toolbar { order: -1; flex-wrap: wrap; padding: 12px 0; }
  .search-box { flex-basis: 100%; }
  .toolbar-actions { flex: 1 1 100%; }
  .toolbar-actions .sort { flex: 1; }
  .toolbar-actions .sort .select { width: 100%; }
  .sort-label { display: none; }
  .filters.open { padding-top: 16px; }
}

/* Opportunity cards */
.list { display: flex; flex-direction: column; gap: 14px; }
.opp { scroll-margin-top: calc(var(--header-h) + var(--toolbar-h, 80px) + 16px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 2.4vw, 28px); transition: border-color .15s; }
.opp:hover { border-color: var(--line-strong); }
.opp.flash { animation: flash 2.2s ease; }
@keyframes flash { 0%, 45% { box-shadow: 0 0 0 3px var(--sage); border-color: var(--ink); } 100% { box-shadow: 0 0 0 0 transparent; } }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.badge { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; line-height: 1.2; padding: 4px 8px; border-radius: 3px; border: 1px solid var(--line-strong); }
.badge.open { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.badge.closed { color: var(--ink-60); border-color: var(--line); }
.badge.soon { background: var(--ochre-soft); border-color: transparent; color: var(--ochre); }
.badge.rolling { background: var(--sage-soft); border-color: transparent; }
.opp-name { font-family: var(--serif); font-weight: 400; font-size: clamp(19px, 1.8vw, 22px); line-height: 1.3; letter-spacing: -.005em; }
.opp-org { font-size: 14px; color: var(--ink-60); margin-top: 4px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 24px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.facts dt { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-60); margin-bottom: 3px; }
.facts dd { font-size: 15px; line-height: 1.45; }
.more { margin-top: 16px; }
.more summary { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "+"; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1px solid var(--line-strong); border-radius: 50%; font-weight: 400; font-size: 14px; line-height: 1; }
.more[open] summary::before { content: "\2212"; }
.more-body { padding-top: 12px; font-size: 15px; color: var(--ink-80); max-width: 74ch; }
.more-body p + p { margin-top: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { font-size: 12px; background: var(--cream); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 20px; }
.empty { padding: 48px 24px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty p + p { margin-top: 10px; }
.empty .opp-name { margin-bottom: 4px; }
.load-more { display: flex; justify-content: center; margin-top: 28px; }
.suggest-note { margin-top: 36px; font-size: 14px; color: var(--ink-60); text-align: center; }

/* Signup band */
.signup { position: relative; background: var(--ink); color: var(--cream); padding: clamp(56px, 7vw, 88px) 0; overflow: hidden; }
.signup::before { content: ""; position: absolute; inset: 0; background: url("hero.jpg") center / cover no-repeat; opacity: .16; mix-blend-mode: luminosity; pointer-events: none; }
.signup .wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
.signup h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 3vw, 38px); line-height: 1.2; letter-spacing: -.01em; max-width: 20ch; }
.signup p { color: rgba(242, 240, 233, .8); margin-top: 14px; max-width: 48ch; }
.signup .eyebrow { color: var(--sage); margin: 0 0 14px; }
.signup-form .row { display: flex; gap: 10px; }
.signup-form .input { background: rgba(242, 240, 233, .06); border-color: rgba(242, 240, 233, .45); color: var(--cream); font-size: 16px; }
.signup-form .input::placeholder { color: rgba(242, 240, 233, .55); }
.signup-form .input:focus { border-color: var(--cream); box-shadow: 0 0 0 1px var(--cream); }
.signup-form :focus-visible { outline-color: var(--cream); }
.fine { font-size: 12px; color: rgba(242, 240, 233, .62) !important; margin-top: 10px !important; }
.form-success { font-family: var(--serif); font-size: 19px; line-height: 1.45; }
.signup .form-success { color: var(--cream); margin: 0; }
form.sent .form-fields { display: none; }
@media (max-width: 800px) {
  .signup .wrap { grid-template-columns: 1fr; }
  .signup-form .row { flex-direction: column; }
}

/* Footer */
.site-footer { padding: 36px 0 44px; font-size: 14px; color: var(--ink-60); }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: baseline; gap: 16px 32px; flex-wrap: wrap; }
.site-footer p { max-width: 62ch; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer nav a { text-decoration: none; }
.site-footer nav a:hover { text-decoration: underline; }

/* Content pages */
.page { padding: clamp(56px, 8vw, 104px) 0 clamp(72px, 9vw, 120px); }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.page-grid > div:first-child { position: sticky; top: calc(var(--header-h) + 32px); }
.page-title { font-size: clamp(34px, 4.2vw, 52px); }
.page-intro { font-size: 17px; color: var(--ink-80); margin-top: 20px; max-width: 44ch; }
.prose { font-size: 17px; line-height: 1.7; max-width: 66ch; }
.prose .lede { margin-top: 0; font-size: 20px; }
.prose h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.3; margin: 44px 0 14px; }
.prose p + p, .prose ul { margin-top: 14px; }
.prose ul { padding-left: 20px; }
.prose li + li { margin-top: 8px; }
.prose li::marker { color: var(--sage); }
.form { max-width: 680px; }
.form .form-fields { display: grid; gap: 20px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.field .hint { display: inline; margin: 0; }
textarea.input { resize: vertical; min-height: 130px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form .form-success { padding: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.form .form-success p + p { margin-top: 12px; font-family: var(--sans); font-size: 15px; }
@media (max-width: 860px) {
  .page-grid { grid-template-columns: 1fr; }
  .page-grid > div:first-child { position: static; }
  .two { grid-template-columns: 1fr; }
}
