/* ------------------------------------------------------------------ *
 * Open Source Programs - reference-tool design
 *
 * This is a lookup surface, not a landing page. People arrive asking
 * "what can I apply to right now and when does it close?", so density
 * and scan speed beat art direction. Principles: warm neutral canvas,
 * hairline rules instead of card shadows, indigo for the interactive
 * layer and green reserved for real stipend figures, mono for every
 * number and date so amounts align down the column. Color is used to
 * mean something; nothing is tinted for decoration.
 * Light and dark are both first-class.
 * ------------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  --bg:        #fdfcfa;
  --panel:     #ffffff;
  --panel-2:   #f3f2ef;
  --line:      #e3e1db;
  --line-soft: #eeece7;
  --ink:       #1a1a18;
  --ink-2:     #55534d;
  --ink-3:     #6f6c66;

  /* Accent: a saturated indigo that carries the interactive layer (links,
     focus, active filters). Bright enough to actually register, dark enough
     to pass AA as body-size text on the light canvas. */
  --accent:      #4338ca;
  --accent-bg:   #eeecfd;
  --accent-line: #c9c3f5;

  /* Money is the thing people scan for, so real amounts get their own strong
     green. Everything vaguer than a number stays neutral, which keeps the
     color meaningful instead of decorative. */
  --money:     #15803d;
  --money-bg:  #e8f5ec;

  /* Category colors for the tags. Distinct hues so a row's shape is readable
     at a glance rather than a wall of one tint. */
  --t-begin-fg: #a13d0d;  --t-begin-bg: #fdeee2;
  --t-under-fg: #9333ea;  --t-under-bg: #f6ecfe;
  --t-stud-fg:  #0369a1;  --t-stud-bg:  #e6f2fb;

  --warn-fg:   #9a3412;  --warn-bg:   #fdeee6;

  --radius:    10px;
  --radius-sm: 6px;

  --maxw: clamp(960px, 92vw, 1400px);
  --pad:  clamp(16px, 4vw, 44px);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #131316;
    --panel:     #1a1a1e;
    --panel-2:   #212127;
    --line:      #2d2d34;
    --line-soft: #26262c;
    --ink:       #eceaf0;
    --ink-2:     #b0aeb8;
    --ink-3:     #85838d;
    --accent:      #a5b4fc;
    --accent-bg:   #211f3d;
    --accent-line: #3b3671;
    --money:     #4ade80;
    --money-bg:  #14271c;
    --t-begin-fg: #fdba74;  --t-begin-bg: #2e1f14;
    --t-under-fg: #d8b4fe;  --t-under-bg: #281a33;
    --t-stud-fg:  #7dd3fc;  --t-stud-bg:  #14252f;
    --warn-fg:   #fdba74;  --warn-bg:   #2e1d13;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg:#fdfcfa;--panel:#ffffff;--panel-2:#f3f2ef;--line:#e3e1db;--line-soft:#eeece7;
  --ink:#1a1a18;--ink-2:#55534d;--ink-3:#6f6c66;
  --accent:#4338ca;--accent-bg:#eeecfd;--accent-line:#c9c3f5;
  --money:#15803d;--money-bg:#e8f5ec;
  --t-begin-fg:#a13d0d;--t-begin-bg:#fdeee2;
  --t-under-fg:#9333ea;--t-under-bg:#f6ecfe;
  --t-stud-fg:#0369a1;--t-stud-bg:#e6f2fb;
  --warn-fg:#9a3412;--warn-bg:#fdeee6;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:#131316;--panel:#1a1a1e;--panel-2:#212127;--line:#2d2d34;--line-soft:#26262c;
  --ink:#eceaf0;--ink-2:#b0aeb8;--ink-3:#85838d;
  --accent:#a5b4fc;--accent-bg:#211f3d;--accent-line:#3b3671;
  --money:#4ade80;--money-bg:#14271c;
  --t-begin-fg:#fdba74;--t-begin-bg:#2e1f14;
  --t-under-fg:#d8b4fe;--t-under-bg:#281a33;
  --t-stud-fg:#7dd3fc;--t-stud-bg:#14252f;
  --warn-fg:#fdba74;--warn-bg:#2e1d13;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Theme switching.
   Individual elements carry their own hover transitions on color/background.
   Without this, toggling the theme animates each of them over its own
   duration, so the page changes in a visible ripple instead of all at once.
   app.js sets data-switching for one frame around the flip, which forces
   every element to repaint together. */
:root[data-switching] *,
:root[data-switching] *::before,
:root[data-switching] *::after {
  transition: none !important;
}
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* Content links must look like links before you touch them. Anything inside
   running text gets the accent color plus a permanent underline; hover only
   strengthens what is already there. Navigation, buttons and whole-row links
   opt out via .nav / .icon-btn / .brand, where position already signals
   affordance. */
.item-name a,
.event .what a,
.site-foot a,
.row-elig a,
.item-desc a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .15s;
}
.item-name a:hover,
.event .what a:hover,
.site-foot a:hover,
.row-elig a:hover,
.item-desc a:hover {
  text-decoration-color: var(--accent);
}
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  transition: top .15s;
}
.skip-link:focus { top: 8px; }

/* ---------- Header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap {
  display: flex; align-items: center; gap: clamp(10px, 2vw, 22px); height: 64px;
}
.brand { font-weight: 640; font-size: 15px; letter-spacing: -.015em; white-space: nowrap; color: var(--ink); }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav a {
  color: var(--ink-2); font-size: 14px; padding: 7px 11px;
  border-radius: var(--radius-sm); transition: color .15s, background .15s; white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--panel-2); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 560; background: var(--panel-2); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg { width: 16px; height: 16px; }

/* Nav collapses to a scrollable strip rather than a hamburger: there are only
   four destinations and a burger would hide them behind an extra tap. */
@media (max-width: 720px) {
  .site-head .wrap { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .theme-btn { margin-left: auto; }
}

/* ---------- Page head ---------- */
.page-head { padding: clamp(30px, 5.5vw, 58px) 0 clamp(18px, 2.5vw, 26px); }
.page-head h1 {
  margin: 0 0 10px; font-weight: 640;
  font-size: clamp(27px, 4.2vw, 43px); line-height: 1.08; letter-spacing: -.025em;
  max-width: 20ch;
}
.page-head .lede { margin: 0; color: var(--ink-2); max-width: 62ch; font-size: clamp(14.5px, 1.3vw, 16.5px); }
.page-head .lede strong { color: var(--ink); font-weight: 600; }

.updated {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 16px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-3);
}
.updated .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }

/* ---------- Filter bar ---------- */
.filters {
  position: sticky; top: 64px; z-index: 15;
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  margin-bottom: 4px;
}
@media (max-width: 720px) { .filters { position: static; } }
.filters .wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.search {
  flex: 1 1 260px; min-width: 0; position: relative;
  display: flex; align-items: center;
}
.search svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; font: inherit; font-size: 14px;
  padding: 9px 12px 9px 34px;
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px; cursor: pointer;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2);
  transition: color .15s, border-color .15s, background .15s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed="true"] {
  background: var(--accent-bg); color: var(--accent);
  border-color: var(--accent-line); font-weight: 560;
}
.chip:active { transform: scale(.97); }

.result-count { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }

/* Phone filters: search on its own line, chips scroll sideways rather than
   wrapping into a three-row block that pushes the list off-screen. */
@media (max-width: 640px) {
  .filters { padding: 10px 0; }
  .filters .wrap { gap: 8px; }
  .search { flex: 1 1 100%; }
  .chips {
    flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none; padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .result-count { margin-left: 0; }
}

/* ---------- Program list ---------- */
/* Rows, not cards: a shadowed card per program would turn a 20-item list into
   visual noise. A hairline between rows is enough separation. */
/* The list sits on its own panel so the rows read as a contained table rather
   than text bleeding into the page edges. Rows carry their own horizontal
   padding, which also gives the hover tint a visible inset. */
.list {
  margin: 0; padding: 0 clamp(10px, 1.6vw, 20px); list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.row {
  display: grid;
  grid-template-columns: minmax(0, 2.7fr) minmax(0, 1.75fr) minmax(140px, 0.75fr);
  gap: clamp(14px, 2.2vw, 26px);
  padding: 14px clamp(6px, 1vw, 12px);
  border-bottom: 1px solid var(--line-soft);
  align-items: baseline;
  border-radius: var(--radius-sm);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--panel-2); }

.row-main { min-width: 0; }
.row-title {
  display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  margin: 0;
  font-size: 15.5px; font-weight: 600; letter-spacing: -.012em;
  color: var(--ink); line-height: 1.35;
}
/* The program name is the row's primary link. It keeps ink color so the list
   stays scannable as a table of names, but the arrow glyph marks it as
   outbound and hover confirms it. */
.row-title a { color: var(--ink); transition: color .15s; }
.row-title a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.row-title a:hover .ext { color: var(--accent); }
.row-title .ext { width: 12px; height: 12px; color: var(--ink-3); flex: none; align-self: center; transition: color .15s; }
.row-org { margin-top: 1px; font-size: 13px; color: var(--ink-3); }
.row-elig { margin: 5px 0 0; font-size: 13px; color: var(--ink-2); max-width: 52ch; }

.row-when { min-width: 0; font-size: 13.5px; color: var(--ink-2); }
.row-when .when-label { display: none; }
.row-when time, .row-when .when-text {
  font-family: var(--mono); font-size: 12.3px; line-height: 1.45; color: var(--ink-2);
  display: block;
}

.row-pay { min-width: 0; display: flex; flex-direction: column; align-items: flex-end; }

/* A real number gets a green pill; it is what people scan the page for.
   Anything vaguer ("Varies", "Educational stipend provided") is deliberately
   quieter and wraps normally, so a long sentence never masquerades as an
   amount sitting in the money column. */
.row-pay .amount {
  font-family: var(--mono); font-size: 14px; font-weight: 550;
  letter-spacing: -.02em; white-space: nowrap;
  color: var(--money); background: var(--money-bg);
  padding: 3px 9px; border-radius: 5px;
}
.row-pay .amount.is-vague {
  font-family: var(--sans); font-size: 12.5px; font-weight: 400;
  white-space: normal; text-align: right; text-wrap: balance;
  color: var(--ink-3); background: none; padding: 0;
}
.row-pay .pay-note { margin-top: 4px; font-size: 11.5px; color: var(--ink-3); text-align: right; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag {
  font-size: 11.5px; font-weight: 540; letter-spacing: .01em;
  padding: 2px 7px; border-radius: 4px;
  background: var(--panel-2); color: var(--ink-2);
}
.tag.t-beginner-friendly { background: var(--t-begin-bg); color: var(--t-begin-fg); }
.tag.t-underrepresented  { background: var(--t-under-bg);  color: var(--t-under-fg); }
.tag.t-students          { background: var(--t-stud-bg);   color: var(--t-stud-fg); }

.caveat {
  display: flex; gap: 8px; margin-top: 11px; padding: 9px 12px;
  background: var(--warn-bg); border-radius: var(--radius-sm);
  font-size: 12.8px; line-height: 1.45; color: var(--warn-fg); max-width: 62ch;
}
.caveat svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }

.row-pay .pay-label { display: none; }

/* Tablet: drop to two columns, moving money up beside the name so the most
   scanned value stays on the first line. */
@media (max-width: 1000px) and (min-width: 641px) {
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "main pay" "when when";
    gap: 6px clamp(14px, 3vw, 28px);
  }
  .row-main { grid-area: main; }
  .row-pay  { grid-area: pay; }
  .row-when { grid-area: when; margin-top: 4px; }
}

/* Phone: single column. The money moves to a labelled line rather than
   floating right, because right-alignment reads as arbitrary once there is no
   column to align to. */
@media (max-width: 640px) {
  /* Every pixel of width counts on a phone, so the panel chrome goes away and
     the rows run full-bleed inside the page gutter. */
  .list { padding: 0; background: none; border: 0; border-radius: 0; }
  .row { grid-template-columns: 1fr; gap: 8px; padding: 16px 0; border-radius: 0; }
  .row:hover { background: none; }
  .row-title { font-size: 16px; }
  .row-elig { max-width: none; }

  .row-when, .row-pay {
    display: grid; grid-template-columns: 68px minmax(0, 1fr);
    gap: 10px; align-items: baseline;
  }
  .row-pay { align-items: center; }
  .row-when .when-label, .row-pay .pay-label {
    display: block; font-size: 10.5px; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-3); margin: 0;
  }
  .row-pay .amount { justify-self: start; }
  .row-pay .amount.is-vague { text-align: left; }
  .row-pay .pay-note { grid-column: 2; text-align: left; margin-top: 2px; }
  .row-when .when-text { font-size: 12.2px; }
}

/* Empty state for when a filter matches nothing. */
.empty {
  padding: 56px 0; text-align: center; color: var(--ink-2);
}
.empty h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; color: var(--ink); }
.empty p { margin: 0 0 16px; font-size: 14px; }
.empty button {
  font: inherit; font-size: 14px; cursor: pointer;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent-line); background: var(--accent-bg); color: var(--accent);
  font-weight: 560;
}
.empty button:hover { background: color-mix(in srgb, var(--accent-bg) 70%, var(--accent) 12%); }

/* ---------- Sections ---------- */
.section { padding: clamp(34px, 5.5vw, 62px) 0; border-top: 1px solid var(--line); }
.section > .wrap > h2 {
  margin: 0 0 6px; font-size: clamp(20px, 2.6vw, 27px);
  font-weight: 620; letter-spacing: -.02em;
}
.section .section-lede { margin: 0 0 26px; color: var(--ink-2); max-width: 60ch; font-size: 14.5px; }

/* ---------- Timeline ---------- */
.months { display: grid; gap: clamp(20px, 3vw, 30px); }
.month { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: clamp(14px, 3vw, 32px); }
.month > h3 {
  margin: 0; font-size: 14px; font-weight: 600; color: var(--ink);
  position: sticky; top: 82px; align-self: start;
}
.month.is-past > h3 { color: var(--ink-3); }
.month-events { margin: 0; padding: 0; list-style: none; }
.event {
  display: grid; grid-template-columns: minmax(78px, auto) minmax(0, 1fr);
  gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line-soft);
  align-items: baseline;
}
.event:last-child { border-bottom: 0; }
.event .date { font-family: var(--mono); font-size: 12.8px; color: var(--ink-2); white-space: nowrap; }
.event .what { font-size: 14px; color: var(--ink); min-width: 0; }
.event .meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); margin-left: 7px; white-space: nowrap; }
.event.is-approx .date { color: var(--ink-3); }
.event.is-past { opacity: .55; }

@media (max-width: 720px) {
  .month { grid-template-columns: 1fr; gap: 8px; }
  .month > h3 { position: static; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
  .event { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Guide / resources ---------- */
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: clamp(20px, 3.5vw, 44px); align-items: start; }

/* Resource sections vary a lot in length, so a grid strands the last one on a
   half-empty row. Column flow lets them pack tightly instead. */
.cols-flow { columns: 3 260px; column-gap: clamp(24px, 4vw, 52px); }
.cols-flow > * { break-inside: avoid; margin-bottom: 34px; }
.cols-flow h2 { margin-top: 0; }

.stack { margin: 0; padding: 0; list-style: none; }
.stack > li { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.stack > li:last-child { border-bottom: 0; }
.stack .item-name { font-weight: 570; font-size: 14.5px; }
.stack .item-name .ext {
  width: 11px; height: 11px; flex: none;
  margin-left: 3px; vertical-align: baseline;
  opacity: .65;
}
.stack .item-desc { margin-top: 2px; font-size: 13.5px; color: var(--ink-2); }

.lang-block { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.lang-block:last-child { border-bottom: 0; }
.lang-block h3 { margin: 0 0 7px; font-size: 14.5px; font-weight: 600; }
.repo-links { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.repo-links a {
  font-size: 13px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2); transition: color .15s, border-color .15s;
}
.repo-links a:hover { color: var(--accent); border-color: var(--accent-line); }
.label-list { display: flex; flex-wrap: wrap; gap: 5px; }
.code-label {
  font-family: var(--mono); font-size: 11.5px; padding: 3px 7px;
  background: var(--panel-2); color: var(--ink-2); border-radius: 4px;
}

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps > li {
  position: relative; padding: 13px 0 13px 44px;
  border-bottom: 1px solid var(--line-soft); counter-increment: step;
}
.steps > li:last-child { border-bottom: 0; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 13px;
  width: 26px; height: 26px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  background: var(--accent-bg); color: var(--accent); border-radius: 50%;
}
.steps .step-when { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.steps .step-goal { font-size: 14.5px; color: var(--ink); margin-top: 1px; }

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--line); margin-top: clamp(40px, 6vw, 76px);
  padding: clamp(28px, 4vw, 44px) 0;
  color: var(--ink-3); font-size: 13.5px;
}
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: baseline; }
.site-foot .foot-right { margin-left: auto; display: flex; gap: 20px; flex-wrap: wrap; }

.disclaimer {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--ink-2);
  font-size: 13.5px; line-height: 1.5; max-width: 68ch; margin-bottom: 22px;
}
.disclaimer strong { color: var(--ink); font-weight: 600; }

/* ---------- Motion ---------- */
/* There is none beyond hover and focus feedback. This is a page people come to
   read, and a staggered entrance on 22 rows would delay the content they came
   for while adding nothing. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .site-head, .filters, .icon-btn, .skip-link { display: none; }
  .row { break-inside: avoid; }
}
