/* ==========================================================================
   On Fig — onfig.org
   A philanthropic platform. Design system.
   ========================================================================== */

/* ---------- Fonts (self-hosted, no external requests) ---------- */
@font-face {
  font-family: 'Newsreader';
  src: url('fonts/newsreader-latin-standard-normal.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('fonts/newsreader-latin-standard-italic.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('fonts/figtree-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('fonts/figtree-latin-wght-italic.woff2') format('woff2-variations');
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --fig:        #7E1F26;   /* burgundy — primary */
  --fig-lift:   #8E2A31;   /* burgundy, lifted (hover) */
  --fig-deep:   #5F161C;   /* burgundy, deep */
  --clay:       #8E3B22;   /* terracotta — secondary action */
  --gold:       #75551B;   /* bronze — eyebrows, rules */
  --ink:        #3B342C;   /* warm charcoal — body text */
  --ink-soft:   #625A4F;   /* secondary text */
  --ink-faint:  #6E665A;   /* labels, meta */
  --paper:      #FBF7EF;   /* page */
  --paper-pure: #FFFFFF;   /* cards on beige */
  --sand:       #EFE7D9;   /* beige panel */
  --sand-deep:  #E6DCCB;   /* beige panel, pressed */
  --rule:       #DCD3C4;   /* hairline */
  --rule-soft:  #E8E0D2;   /* hairline, quieter */

  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --sans:  'Figtree', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --wrap: 1120px;
  --gut: clamp(1.25rem, 5vw, 2.5rem);
  --bay: clamp(4rem, 9vw, 7.5rem);   /* vertical section rhythm */

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.62;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }

::selection { background: var(--fig); color: #fff; }

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

/* ---------- Layout primitives ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gut);
}
.bay { padding-block: var(--bay); }
.rule-top { border-top: 1px solid var(--rule); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--fig); color: #fff; padding: 0.75rem 1.25rem;
  font: 600 0.8125rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Type ---------- */
.eyebrow {
  display: flex; align-items: center; gap: 0.9rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
}
.eyebrow::before {
  content: '';
  width: 2.15rem; height: 1px;
  background: currentColor;
  flex: none;
  opacity: 0.85;
}
.eyebrow.no-rule::before { display: none; }
.eyebrow.faint { color: var(--ink-faint); font-weight: 500; }

.display {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--fig);
  line-height: 1.04;
  letter-spacing: -0.018em;
  font-size: clamp(2.6rem, 1.3rem + 5.4vw, 4.6rem);
  font-variation-settings: 'opsz' 36;
  text-wrap: balance;
}
/* On narrow screens let the display headline reflow naturally */
@media (max-width: 560px) { .display br, .h2 br { display: none; } }
.h2 {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--fig);
  line-height: 1.1;
  letter-spacing: -0.014em;
  font-size: clamp(2rem, 1.2rem + 3vw, 3.1rem);
  font-variation-settings: 'opsz' 28;
}
.h3 {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--fig);
  line-height: 1.16;
  letter-spacing: -0.01em;
  font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.85rem);
  font-variation-settings: 'opsz' 20;
}
.lede {
  font-size: clamp(1.075rem, 1rem + 0.42vw, 1.28rem);
  line-height: 1.6;
  color: var(--ink);
  max-width: 34ch;
  text-wrap: pretty;
}
.prose p + p { margin-top: 1.15em; }
.prose { color: var(--ink); max-width: 62ch; text-wrap: pretty; }
.measure { max-width: 46ch; }
.dek { color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 1.02rem 1.65rem;
  font-family: var(--sans);
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.145em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--fig);
  background: var(--fig);
  color: #fff;
  cursor: pointer;
  transition: background 0.22s var(--ease), color 0.22s var(--ease),
              border-color 0.22s var(--ease), transform 0.22s var(--ease);
}
.btn:hover { background: var(--fig-lift); border-color: var(--fig-lift); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--ghost { background: transparent; color: var(--fig); border-color: var(--rule); }
.btn--ghost:hover { background: transparent; color: var(--fig-lift); border-color: var(--fig); }

.btn--clay { background: var(--clay); border-color: var(--clay); }
.btn--clay:hover { background: #9E452A; border-color: #9E452A; }

.btn-row {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
}
@media (max-width: 560px) {
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn { width: 100%; }
}

/* Text link with arrow */
.tlink {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.775rem; font-weight: 600;
  letter-spacing: 0.135em; text-transform: uppercase;
  color: var(--fig); text-decoration: none;
  padding-bottom: 2px;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.32s var(--ease), color 0.2s var(--ease);
}
.tlink .arw { transition: transform 0.28s var(--ease); }
.tlink:hover { background-size: 100% 1px; }
.tlink:hover .arw { transform: translateX(4px); }

/* ---------- Header ---------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 247, 239, 0.88);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.masthead.is-stuck { border-bottom-color: var(--rule); }
.masthead__in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.35rem;
}
.wordmark {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 1.3rem + 0.7vw, 1.85rem);
  color: var(--fig);
  text-decoration: none;
  letter-spacing: -0.012em;
  line-height: 1;
  font-variation-settings: 'opsz' 24;
}
.wordmark:hover { color: var(--fig-lift); }

.nav { display: flex; align-items: center; gap: clamp(1.1rem, 2.6vw, 2.1rem); }
.nav a {
  font-size: 0.735rem; font-weight: 600;
  letter-spacing: 0.155em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  transition: color 0.2s var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--fig); }

.navtoggle {
  display: none;
  background: none; border: 1px solid var(--rule);
  padding: 0.55rem 0.85rem;
  font: 600 0.7rem/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink); cursor: pointer;
}
@media (max-width: 720px) {
  .navtoggle { display: block; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper);
    border-block: 1px solid var(--rule);
    padding: 0.5rem var(--gut) 1.25rem;
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding-block: 0.85rem; width: 100%; border-bottom: 1px solid var(--rule-soft); }
  .nav a:last-child { border-bottom: 0; }
}

/* ---------- Photo frames ---------- */
.ph {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--sand);
  isolation: isolate;
}
.ph img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 1.1s var(--ease), opacity 0.6s var(--ease);
  opacity: 0;
}
.ph img.is-ready { opacity: 1; }
.ph--zoom:hover img { transform: scale(1.032); }

/* Graceful fallback if a photo fails to load: a warm woven texture, never a broken icon */
.ph.is-fallback { background:
    repeating-linear-gradient(135deg, var(--sand) 0 9px, var(--sand-deep) 9px 18px); }
.ph.is-fallback img { display: none; }
.ph.is-fallback::after {
  content: attr(data-fallback);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem; text-align: center;
  font: 500 0.72rem/1.7 var(--sans);
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-faint);
}
.ph.on-fig.is-fallback { background:
    repeating-linear-gradient(135deg, var(--fig) 0 9px, var(--fig-lift) 9px 18px); }
.ph.on-fig.is-fallback::after { color: rgba(255,255,255,0.74); }

/* Brand panel — a partner's mark in their own world, contained rather than cropped */
.ph--brand {
  background: #F2F0EC;
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.ph--brand img {
  width: auto;
  height: auto;
  max-width: min(58%, 15rem);
  max-height: 78%;
  object-fit: contain;
  opacity: 1;
}
.ph--brand.is-fallback { background: #F2F0EC; }
.ph--brand.is-fallback::after { content: attr(data-fallback); color: var(--ink-faint); }

.ratio-hero  { aspect-ratio: 21 / 9; }
.ratio-wide  { aspect-ratio: 16 / 9; }
.ratio-4x3   { aspect-ratio: 4 / 3; }
.ratio-sq    { aspect-ratio: 1 / 1; }
.ratio-tall  { aspect-ratio: 4 / 5; }
@media (max-width: 640px) { .ratio-hero { aspect-ratio: 3 / 2; } }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(2.5rem, 5vw, 4.25rem); }
.hero__copy { max-width: 40rem; }
.hero .display { margin-top: 1.5rem; }
.hero .lede { margin-top: 1.6rem; max-width: 36.5ch; }
.hero .btn-row { margin-top: 2.35rem; }
.hero__photo { margin-top: clamp(2.75rem, 6vw, 4.5rem); }

/* ---------- Section head ---------- */
.sechead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.sechead__note {
  font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.19em; text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Initiatives grid ---------- */
.initiatives {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 860px) { .initiatives { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--rule);
  background: var(--paper-pure);
  display: flex; flex-direction: column;
}
.card__body { padding: clamp(1.5rem, 3vw, 2rem); }
.card--feature { background: var(--paper-pure); }
.card--feature .card__body { padding-block: clamp(1.75rem, 3vw, 2.25rem); }

.card__meta {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.185em; text-transform: uppercase;
  color: var(--gold);
  display: flex; align-items: center; gap: 0.6rem;
}
.card__meta .dot { color: var(--rule); }
.card__meta .live { color: var(--fig); display: inline-flex; align-items: center; gap: 0.4rem; }
.card__meta .live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--fig);
  box-shadow: 0 0 0 0 rgba(126, 31, 38, 0.5);
  animation: pulse 2.6s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(126, 31, 38, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(126, 31, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(126, 31, 38, 0); }
}
@media (prefers-reduced-motion: reduce) { .card__meta .live::before { animation: none; } }

.card__meta--plain { color: var(--ink-faint); font-weight: 500; }

.card__title { margin-top: 0.8rem; }
.card__title .sub {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.66em;
  color: var(--ink-soft);
  margin-top: 0.18em;
  letter-spacing: 0;
}
.card p { margin-top: 0.95rem; color: var(--ink); }
.card .tlink { margin-top: 1.4rem; }

.card--sand { background: var(--sand); border-color: var(--sand-deep); }
.card--sand .note {
  margin-top: 1.2rem;
  font: 500 0.7rem/1.6 var(--sans);
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-faint);
}
.col-stack { display: grid; gap: 1.5rem; align-content: start; }

/* ---------- Support grid ---------- */
.support {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--rule);
  border-right: 0; border-bottom: 0;
  margin-top: clamp(2rem, 4vw, 2.75rem);
}
@media (max-width: 800px) { .support { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .support { grid-template-columns: 1fr; } }
@media (max-width: 460px) {
  .support__cell { min-height: 0; gap: 1.1rem; padding-block: 1.25rem 1.4rem; }
}

.support__cell {
  background: var(--sand);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: clamp(1.35rem, 2.6vw, 1.9rem);
  min-height: 9.5rem;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 1.6rem;
  transition: background 0.28s var(--ease);
}
.support__cell:hover { background: var(--sand-deep); }
.support__num {
  font-size: 0.7rem; font-weight: 500;
  letter-spacing: 0.19em;
  color: var(--ink-faint);
}
.support__name {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1rem + 0.65vw, 1.42rem);
  line-height: 1.18;
  color: var(--fig);
  letter-spacing: -0.008em;
  font-variation-settings: 'opsz' 18;
  text-wrap: balance;
}
.support__cell--fig { background: var(--fig); border-right-color: var(--fig); border-bottom-color: var(--fig); }
.support__cell--fig:hover { background: var(--fig-lift); }
.support__cell--fig .support__num { color: rgba(255,255,255,0.74); }
.support__cell--fig .support__name { color: #fff; }

/* ---------- Give what you've got ---------- */
.give {
  display: grid;
  grid-template-columns: 0.95fr 1.15fr;
  gap: clamp(2rem, 6vw, 4.5rem);
  align-items: start;
}
@media (max-width: 860px) { .give { grid-template-columns: 1fr; } }

.give__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: clamp(1.25rem, 3vw, 2.5rem);
}
@media (max-width: 520px) { .give__list { grid-template-columns: 1fr; } }
.give__list li {
  border-top: 1px solid var(--rule);
  padding-block: 1.05rem 1.15rem;
  font-size: 0.985rem;
  line-height: 1.5;
  color: var(--ink);
}
.give__list li.accent { color: var(--fig); }

/* ---------- Story block ---------- */
.story {
  background: var(--fig);
  color: #fff;
}
.story__in {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(2rem, 6vw, 4.5rem);
  align-items: center;
  padding-block: clamp(3rem, 6vw, 4.75rem);
}
@media (max-width: 800px) { .story__in { grid-template-columns: 1fr; } }
.story .eyebrow { color: rgba(255,255,255,0.72); }
.story .h2 { color: #fff; }
.story p { color: rgba(255,255,255,0.86); }
.story .prose p + p { margin-top: 1.1em; }
.story .h2 + .prose { margin-top: 1.5rem; }
.story .tlink { color: #fff; margin-top: 1.75rem; }

/* ---------- Closing CTA ---------- */
.closer { text-align: center; }
.closer .display { font-size: clamp(2.4rem, 1.1rem + 5.6vw, 4.35rem); }
.closer p { margin-top: 1.1rem; font-size: clamp(1.05rem, 1rem + 0.35vw, 1.2rem); color: var(--ink-soft); }
.closer .btn-row { margin-top: 2.35rem; justify-content: center; }

/* ---------- Form ---------- */
.formwrap {
  max-width: 40rem;
  margin-top: clamp(2rem, 4vw, 3rem);
  text-align: left;
}
.field { margin-bottom: 1.35rem; }
.field label {
  display: block;
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}
.field input, .field textarea, .field select {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-pure);
  border: 1px solid var(--rule);
  padding: 0.85rem 0.95rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { min-height: 8.5rem; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--fig);
  box-shadow: 0 0 0 3px rgba(126, 31, 38, 0.09);
}
.field__hint { font-size: 0.83rem; color: var(--ink-faint); margin-top: 0.45rem; }
.hp { position: absolute; left: -9999px; }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--rule); }
.foot__in {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  padding-block: clamp(3rem, 5vw, 4rem) clamp(2rem, 4vw, 3rem);
}
@media (max-width: 760px) { .foot__in { grid-template-columns: 1fr 1fr; } .foot__brand { grid-column: 1 / -1; } }
.foot__brand p { margin-top: 1.1rem; font-size: 0.925rem; color: var(--ink-soft); max-width: 32ch; }
.foot .foot__h {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.19em; text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.1rem;
}
.foot li { margin-bottom: 0.7rem; }
.foot li a { font-size: 0.95rem; text-decoration: none; color: var(--ink); transition: color 0.2s var(--ease); }
.foot li a:hover { color: var(--fig); }
.foot__meta {
  border-top: 1px solid var(--rule-soft);
  padding-block: 1.5rem 2.5rem;
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; justify-content: space-between;
  font-size: 0.83rem; color: var(--ink-faint);
}

/* ---------- Reveal on scroll ---------- */
.rise { opacity: 0; transform: translateY(18px); }
.rise.is-in { opacity: 1; transform: none; transition: opacity 0.75s var(--ease), transform 0.75s var(--ease); }
@media (prefers-reduced-motion: reduce) {
  .rise { opacity: 1 !important; transform: none !important; transition: none !important; }
  .ph img { transition: none; }
}
.no-js .rise { opacity: 1; transform: none; }
.no-js .ph img { opacity: 1; }

/* ---------- Utilities ---------- */
.stack-sm > * + * { margin-top: 0.9rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.75rem; }
.center { text-align: center; }
.vh {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
