/* ============================================================
   DreamReach design tokens
   Palette: white background with dark green typography
   ============================================================ */
:root {
  --bg: #FFFFFF;
  --bg-deep: #F0F7F4;
  --surface: rgba(28, 124, 85, 0.06);
  --surface-soft: rgba(28, 124, 85, 0.10);
  --border: rgba(28, 124, 85, 0.20);
  --text: #14523B;
  --text-muted: rgba(20, 82, 59, 0.80);
  --accent: #1C7C55;
  --accent-soft: rgba(28, 124, 85, 0.12);
  --accent-strong: #0F3928;
  --shadow: rgba(0, 0, 0, 0.08);
  --radius: 10px;
  --error: #C0392B;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: inherit; }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  color: var(--text);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
  margin: 0;
}

.wordmark span { color: var(--accent); }

.tagline {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* ---------- Hero ---------- */
.hero {
  background-image: linear-gradient(rgba(28, 124, 85, 0.56), rgba(21, 89, 67, 0.56)), url('https://i.pinimg.com/736x/b6/9c/96/b69c968afe0144bd672d0f2a51b7a4fe.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  color: #FFF;
  padding: 3.5rem 1.5rem 4rem;
  position: relative;
  overflow: hidden;
  min-height: 72vh;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(19, 69, 50, 0.14);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.hero__inner { max-width: 880px; margin: 0 auto; position: relative; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 0.75rem;
  max-width: 18ch;
  color: #FFFFFF;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

.hero p.lede {
  font-size: 1.05rem;
  color: #FFFFFF;
  max-width: 52ch;
  margin: 0 0 2rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.stage-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 640px;
}

.stage {
  border-left: 2px solid var(--accent);
  padding-left: 0.85rem;
}

.stage__num {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.8rem;
  display: block;
  margin-bottom: 0.2rem;
}

.stage__label {
  font-size: 0.9rem;
  color: var(--paper);
}

.hero .stage, .hero .stage__num {
  color: rgba(255, 255, 255, 0.95);
}

/* ---------- Controls ---------- */
.controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.tab-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}

.tab-btn--active {
  background: var(--accent);
  color: #FFFFFF;
}

.filter-bar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.filter-bar input#search-input { flex: 1 1 240px; }

/* ---------- Saved-tab action bar (export/print) ---------- */
.saved-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.65rem;
}

.action-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}

.action-btn:hover {
  background: var(--surface-soft);
}

/* ---------- Custom dropdown (replaces native <select>) ---------- */
.custom-select {
  position: relative;
  min-width: 170px;
}

.custom-select__button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.custom-select__button:hover {
  background: var(--surface-soft);
}

.custom-select__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select__arrow {
  font-size: 0.7rem;
  opacity: 0.85;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.custom-select__button[aria-expanded="true"] .custom-select__arrow {
  transform: rotate(180deg);
}

.custom-select__list {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 30;
  min-width: 100%;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: #FFFFFF;
  border: 1px solid rgba(28, 124, 85, 0.18);
  border-radius: var(--radius);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22);
}

.custom-select__option {
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.88rem;
  color: #174F3A;
  cursor: pointer;
  white-space: nowrap;
}

.custom-select__option.is-active,
.custom-select__option:hover {
  background: rgba(28, 124, 85, 0.12);
  color: #0F3928;
}

.custom-select__option[aria-selected="true"] {
  font-weight: 600;
  background: rgba(28, 124, 85, 0.08);
}

.results-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

/* ---------- Results grid ---------- */
main {
  padding: 1.5rem;
  max-width: 1180px;
  margin: 0 auto;
  background: transparent;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  background: #1C7C55;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: #FFFFFF;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

.badge--internship { background: rgba(255,255,255,0.18); color: #FFFFFF; }
.badge--job { background: rgba(255,255,255,0.16); color: #FFFFFF; }
.badge--scholarship { background: rgba(255,255,255,0.15); color: #FFFFFF; }

.save-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.40);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  color: #FFFFFF;
}

.save-btn--active {
  border-color: #FFFFFF;
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.18);
}

.card__title {
  font-family: var(--font-display);
  font-size: 1.17rem;
  margin: 0;
  line-height: 1.2;
  color: #FFFFFF;
}

.card__org {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.card__summary {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.80);
  margin: 0;
}

.card__meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem 0.8rem;
  margin: 0.2rem 0;
  font-size: 0.78rem;
}

.card__meta div { display: flex; flex-direction: column; }
.card__meta dt { font-family: var(--font-mono); color: rgba(255, 255, 255, 0.60); font-size: 0.68rem; text-transform: uppercase; }
.card__meta dd { margin: 0; color: rgba(255, 255, 255, 0.90); }

.card__cta {
  margin-top: auto;
  align-self: flex-start;
  font-weight: 600;
  text-decoration: none;
  color: #FFFFFF;
  border-bottom: 1px solid rgba(255, 255, 255, 0.50);
  padding-bottom: 1px;
}

.card__cta:hover { color: rgba(255,255,255,0.80); border-color: rgba(255,255,255,0.80); }

/* ---------- States ---------- */
.state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.state--error { color: var(--error); }

.retry-btn {
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(28,124,85,0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 0.75rem;
  animation: spin 0.8s linear infinite;
  filter: none;
}

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

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.site-footer {
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.site-footer a { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .stage-strip { grid-template-columns: 1fr; }
  .results-count { margin-left: 0; }
}

/* ---------- Accessibility ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.custom-select__option.is-active {
  outline: 2px solid rgba(28, 124, 85, 0.55);
  outline-offset: -2px;
}

/* ---------- Print (used by the Saved tab's "Print list" button) ---------- */
@media print {
  .site-header, .hero, .controls, .site-footer, .save-btn { display: none !important; }
  body { background: #FFFFFF; color: #000000; }
  main { box-shadow: none; padding: 0; }
  .grid { display: block; }
  .card { break-inside: avoid; border: 1px solid #999; margin-bottom: 0.75rem; color: #000; box-shadow: none; }
  .card__title, .card__org, .badge { color: #000; }
  .card__cta { color: #000; }
  .card__cta::after { content: " (" attr(href) ")"; font-size: 0.75rem; word-break: break-all; }
}
