/* ==========================================================================
   asipfellowship.com
   ========================================================================== */

:root {
  /* Ink + ground */
  --color-bg: #FBFAF8;
  --color-text: #201E1D;
  --color-divider: #201E1D;

  /* Accent ramp. Light tints (100-400) are used for marks drawn ON the
     accent background; 700 is the accessible pairing for small text on ground. */
  --color-accent-100: #FDE8E3;
  --color-accent-200: #FAC8BD;
  --color-accent-300: #F69884;
  --color-accent-400: #F26B51;
  --color-accent: #EC3013;
  --color-accent-700: #B0230C;

  /* Neutrals */
  --color-neutral-100: #F1EFEB;
  --color-neutral-800: #4A4643;

  /* Derived text tones. Concrete values rather than color-mix() so they clear
     4.5:1 against the ground. */
  --color-text-70: #4B4845;
  --color-text-55: #6B6966;

  --font-heading: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --maxw: 1080px;
  --pad: 48px;
  --rule: 2px;
  --header-h: 58px; /* measured at runtime by app.js */
}

/* --------------------------------------------------------------------------
   Reset + base
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 800;
  margin: 0;
}

p { margin: 0; }

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

canvas { display: block; }

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

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

/* Anchor offset tracks the real sticky-header height (set by app.js). */
section[id] { scroll-margin-top: var(--anchor-offset, 72px); }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent-700);
}

.label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-55);
}

.rule-b { border-bottom: var(--rule) solid var(--color-divider); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  padding: 13px 20px;
  border: var(--rule) solid var(--color-text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

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

.btn--secondary {
  background: var(--color-bg);
  color: var(--color-text);
}
.btn--secondary:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn--block { width: 100%; }

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */

.field { display: grid; gap: 7px; }

.field > label,
.field > .field__legend {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.input {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-bg);
  border: var(--rule) solid var(--color-text);
  border-radius: 0;
  padding: 10px 12px;
  min-height: 42px;
  width: 100%;
  appearance: none;
}
.input::placeholder { color: var(--color-text-55); }
.input:focus-visible { outline-offset: 0; }

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

fieldset.field {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.field__legend { padding: 0; }

/* justify-self keeps the control at its content width inside the grid field. */
.seg {
  display: inline-flex;
  justify-self: start;
  border: var(--rule) solid var(--color-text);
}

.seg-opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.seg-opt + .seg-opt { border-left: var(--rule) solid var(--color-text); }
.seg-opt input { accent-color: var(--color-accent); margin: 0; }
.seg-opt:has(input:checked) { background: var(--color-accent-100); }

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-error {
  border: var(--rule) solid var(--color-accent);
  background: var(--color-accent-100);
  color: var(--color-accent-700);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
}

.form-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-55);
}

.form-pending {
  border: var(--rule) solid var(--color-divider);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-70);
}

.form-pending a { color: var(--color-accent-700); }

[hidden] { display: none !important; }

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

.site-header {
  display: flex;
  align-items: baseline;
  gap: 32px;
  padding: 16px var(--pad);
  border-bottom: var(--rule) solid var(--color-divider);
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 10;
}

.site-header__mark {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: inherit;
}

.site-header__tag {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: auto;
}

.site-nav { display: flex; gap: 24px; font-size: 13px; }
.site-nav a { color: inherit; text-decoration: none; }
.site-nav a:hover { color: var(--color-accent); }
.site-nav a.is-cta { color: var(--color-accent); font-weight: 800; }
.site-nav a.is-cta:hover { color: var(--color-accent-700); }

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

.hero {
  position: relative;
  min-height: calc(100svh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 64px;
  padding: 88px var(--pad) 64px;
  border-bottom: var(--rule) solid var(--color-divider);
  overflow: hidden;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__top,
.hero__bottom {
  position: relative;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
}

.hero__top { pointer-events: none; }
.hero__top .eyebrow { margin-bottom: 28px; }

.hero__title {
  font-size: clamp(46px, 8.6vw, 132px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.hero__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 64px;
  flex-wrap: wrap;
}

.hero__lede {
  font-size: 19px;
  line-height: 1.45;
  max-width: 44ch;
  margin-bottom: 28px;
  text-wrap: pretty;
}

.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero__meta {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-55);
  padding-bottom: 6px;
}

/* --------------------------------------------------------------------------
   Marquees
   -------------------------------------------------------------------------- */

.ticker {
  border-bottom: var(--rule) solid var(--color-divider);
  overflow: hidden;
  padding: 14px 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-neutral-800);
  white-space: nowrap;
}

.marquee { display: flex; width: max-content; will-change: transform; }
.marquee--slow { animation: asipTicker 30s linear infinite; }
.marquee--fast { animation: asipTicker 24s linear infinite; }

.marquee__half {
  display: inline-flex;
  align-items: center;
  gap: 40px;
  padding-right: 40px;
}

.marquee__dot { color: var(--color-accent); font-size: 7px; }

@keyframes asipTicker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.logos { overflow: hidden; white-space: nowrap; padding: 6px 0; }
.logos .marquee__half { gap: 56px; padding-right: 56px; }
.logos__name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  opacity: 0.75;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Shared grid: edge cells sit flush to the container, dividers between
   -------------------------------------------------------------------------- */

.grid { display: grid; }

.grid > * { padding: 28px 32px 32px; }
.grid > :first-child { padding-left: 0; }
.grid > :last-child { padding-right: 0; }

.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--3 > :not(:nth-child(3n+1)) { border-left: var(--rule) solid var(--color-divider); }
.grid--3 > :nth-child(n+4) { border-top: var(--rule) solid var(--color-divider); }
.grid--3 > :nth-child(3n+1) { padding-left: 0; }
.grid--3 > :nth-child(3n) { padding-right: 0; }

/* --------------------------------------------------------------------------
   Terms strip
   -------------------------------------------------------------------------- */

.terms { border-bottom: var(--rule) solid var(--color-divider); }
.terms .grid > * { padding-top: 36px; padding-bottom: 36px; }

.stat__label { margin-bottom: 10px; }
.stat__value {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(28px, 3.2vw, 36px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat__note { font-size: 12px; color: var(--color-text-55); margin-top: 6px; }

/* --------------------------------------------------------------------------
   Mission
   -------------------------------------------------------------------------- */

.mission {
  padding: 80px 0;
  border-bottom: var(--rule) solid var(--color-divider);
}

.mission__inner {
  display: grid;
  gap: 24px;
  max-width: 82ch;
  margin: 0 auto;
  text-align: center;
}

.mission__kicker {
  font-style: italic;
  font-size: clamp(26px, 3.4vw, 34px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.mission__inner p {
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.5;
  text-wrap: pretty;
}

.mission__hl { color: var(--color-accent-700); }

/* --------------------------------------------------------------------------
   Research agenda
   -------------------------------------------------------------------------- */

.research { border-bottom: var(--rule) solid var(--color-divider); }

.research__head {
  padding: 64px var(--pad) 36px;
  text-align: center;
}

.research__head p {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 24ch;
  margin: 0 auto;
}

.research .grid { padding-bottom: 8px; }

.card__num {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 12px;
  color: var(--color-accent);
  margin-bottom: 16px;
}
.card h3 {
  font-size: 22px;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
.card p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-70);
}

/* --------------------------------------------------------------------------
   Poster / why now
   -------------------------------------------------------------------------- */

.poster {
  position: relative;
  background: var(--color-accent);
  color: var(--color-bg);
  padding: 104px var(--pad);
  overflow: hidden;
}

.poster__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.poster__inner {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  pointer-events: none;
}

.poster__eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 28px;
}

.poster__title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(30px, 5.2vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   Program timeline
   -------------------------------------------------------------------------- */

.program {
  padding: 72px 0 88px;
  border-bottom: var(--rule) solid var(--color-divider);
}

.program .eyebrow { margin-bottom: 40px; }

.program__flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 32px;
  align-items: start;
}

.step .label { margin-bottom: 14px; }
.step h3 {
  font-size: clamp(24px, 3vw, 30px);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.step p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text-70);
  max-width: 34ch;
}

.program__arrow {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 30px;
  color: var(--color-accent);
  padding-top: 30px;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Split sections (Who should apply / Who runs it)
   -------------------------------------------------------------------------- */

.split {
  padding: 80px 0;
  border-bottom: var(--rule) solid var(--color-divider);
}

.split__inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 64px;
}

.split h2 {
  font-size: clamp(28px, 3.4vw, 34px);
  letter-spacing: -0.02em;
}

.split__lede {
  font-size: 17px;
  line-height: 1.55;
  max-width: 62ch;
  margin-bottom: 28px;
}

.split__body { min-width: 0; }

/* 2x2 card grid — 2px gap over the divider colour draws the hairlines */
.cards-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--rule);
  background: var(--color-divider);
}

.cards-2 > * { background: var(--color-bg); padding: 28px; }
.cards-2 > :nth-child(odd) { padding-left: 0; }
.cards-2 > :nth-child(even) { padding-right: 0; }

.cards-2 h3 {
  font-size: clamp(19px, 2.2vw, 22px);
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}
.cards-2 p {
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text-70);
}

.backers { border-top: var(--rule) solid var(--color-divider); padding-top: 20px; }
.backers .label { margin-bottom: 16px; }
.backers__note { font-size: 12px; color: var(--color-text-55); margin-top: 12px; }

/* --------------------------------------------------------------------------
   Apply
   -------------------------------------------------------------------------- */

.apply {
  padding: 88px 0 104px;
  background: var(--color-neutral-100);
}

.apply__inner {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 72px;
}

.apply .eyebrow { margin-bottom: 20px; }

.apply h2 {
  font-size: clamp(38px, 5.4vw, 54px);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.apply__deadline {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-accent-700);
  margin-bottom: 16px;
}

.apply__note {
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text-70);
  max-width: 36ch;
  margin-bottom: 36px;
}

.spec { border-top: var(--rule) solid var(--color-divider); font-size: 14px; }
.spec__row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0;
  border-bottom: var(--rule) solid var(--color-divider);
}
.spec__row dt { color: var(--color-text-55); }
.spec__row dd { font-weight: 700; margin: 0; text-align: right; }

.apply__panel {
  border: var(--rule) solid var(--color-text);
  background: var(--color-bg);
  padding: 36px;
  min-width: 0;
}

.apply__form { display: grid; gap: 20px; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.success {
  border: var(--rule) solid var(--color-accent);
  padding: 32px;
}
.success h3 { font-size: 24px; margin-bottom: 8px; }
.success p { font-size: 15px; color: var(--color-text-70); }

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

.site-footer { border-top: var(--rule) solid var(--color-divider); }

.site-footer__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 48px;
  padding: 64px var(--pad) 0;
  flex-wrap: wrap;
}

.site-footer__mark {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(84px, 16vw, 240px);
  letter-spacing: -0.05em;
  line-height: 1;
  margin-left: -0.02em;
  margin-bottom: -0.18em;
  padding-right: 0.12em;
}

.site-footer__nav {
  display: grid;
  gap: 10px;
  font-size: 13px;
  padding-bottom: 10px;
  justify-items: start;
}
.site-footer__nav a { color: inherit; text-decoration: none; }
.site-footer__nav a:hover { color: var(--color-accent); }
.site-footer__nav a.is-cta { color: var(--color-accent); font-weight: 800; }

.site-footer__meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 48px;
  padding: 20px var(--pad) 28px;
  font-size: 12px;
  color: var(--color-text-55);
  border-top: var(--rule) solid var(--color-divider);
}
.site-footer__meta > :first-child { margin-right: auto; }
.site-footer__meta a { color: inherit; text-decoration: underline; }

/* --------------------------------------------------------------------------
   Simple document pages (privacy, 404)
   -------------------------------------------------------------------------- */

.doc { padding: 72px 0 96px; }
.doc__inner { max-width: 68ch; }
.doc h1 { font-size: clamp(34px, 6vw, 54px); letter-spacing: -0.03em; margin-bottom: 12px; }
.doc h2 { font-size: 20px; letter-spacing: -0.01em; margin: 40px 0 10px; }
.doc p, .doc li { font-size: 16px; line-height: 1.6; color: var(--color-text-70); }
.doc p + p { margin-top: 14px; }
.doc ul { padding-left: 20px; margin: 10px 0; }
.doc li + li { margin-top: 6px; }
.doc__updated { font-size: 13px; color: var(--color-text-55); }
.doc p.doc__cta { margin-top: 28px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  :root { --pad: 32px; }

  .split__inner { gap: 40px; }
  .apply__inner { gap: 40px; }
  .program__flow { gap: 24px; }
}

@media (max-width: 900px) {
  .hero__title { white-space: normal; }

  /* Collapse every multi-column grid to a single stack, and convert the
     vertical dividers into horizontal rules. */
  .grid--3,
  .split__inner,
  .apply__inner,
  .cards-2,
  .program__flow {
    grid-template-columns: 1fr;
  }

  .grid > *,
  .grid--3 > :nth-child(3n+1),
  .grid--3 > :nth-child(3n) {
    padding: 28px 0;
  }
  /* Selectors must match the specificity of the desktop rules they undo. */
  .grid--3 > :not(:nth-child(3n+1)) { border-left: 0; }
  .grid--3 > :nth-child(n+2) { border-top: var(--rule) solid var(--color-divider); }
  .grid--3 > :nth-child(1) { border-top: 0; }

  .terms .grid > * { padding-top: 28px; padding-bottom: 28px; }

  .cards-2 > *,
  .cards-2 > :nth-child(odd),
  .cards-2 > :nth-child(even) {
    padding: 24px 0;
  }

  .program__arrow { display: none; }
  .program__flow { gap: 40px; }
  .step p { max-width: none; }

  .split { padding: 56px 0; }
  .mission { padding: 56px 0; }
  .research__head { padding-top: 48px; padding-bottom: 24px; }
  .poster { padding: 72px var(--pad); }
  .program { padding: 56px 0 64px; }
  .apply { padding: 64px 0 72px; }

  .apply__panel { padding: 24px; }
  .apply__note { max-width: none; }
}

@media (max-width: 640px) {
  :root { --pad: 20px; }

  .site-header {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    padding: 12px var(--pad);
  }
  .site-header__tag {
    order: 3;
    flex-basis: 100%;
    font-size: 10px;
    letter-spacing: 0.06em;
    margin-right: 0;
    color: var(--color-text-55);
  }
  .site-nav { gap: 16px; margin-left: auto; }

  .hero { padding: 56px var(--pad) 48px; gap: 48px; }
  .hero__top .eyebrow { margin-bottom: 18px; }
  .hero__bottom { gap: 32px; }
  .hero__lede { font-size: 17px; }
  .hero__actions .btn { flex: 1 1 auto; }

  .pair { grid-template-columns: 1fr; }

  .seg { width: 100%; justify-self: stretch; }
  .seg-opt { flex: 1 1 0; justify-content: center; padding: 12px 10px; }

  .apply__panel { padding: 20px; }
  .success { padding: 24px; }

  .site-footer__top { padding-top: 48px; gap: 24px; }
  .site-footer__nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 18px;
    padding-bottom: 0;
  }
  .site-footer__meta { margin-top: 32px; gap: 8px 20px; }
  .site-footer__meta > :first-child { flex-basis: 100%; margin-right: 0; }
}

/* --------------------------------------------------------------------------
   Reduced motion — hold the marquees still; app.js paints one static
   canvas frame instead of animating.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee { animation: none; }
  .btn { transition: none; }
}
