/* Design tokens. These are only the fallbacks: js/theme.js applies the saved theme on top (a test keeps them in sync). */
:root {
  --primary: #3a3aff; --secondary: #0a0f3d; --accent: #b3b8ff;
  --bg: #ffffff; --surface: #ffffff; --section: #f5f6fb; --header-bg: #ffffff; --footer-bg: #f5f6fb; --admin-bg: #f4f5f9;
  --text: #0a0f3d; --muted: #586079; --border: #e2e5f0;
  --btn-bg: #3a3aff; --btn-text: #ffffff; --link: #3a3aff;
  --header-text: var(--text); --footer-text: var(--text);
  --shadow: 0 1px 2px color-mix(in srgb, var(--text) 8%, transparent), 0 4px 14px color-mix(in srgb, var(--text) 5%, transparent);
  --radius: 10px; --danger: #8a1c1c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--link); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); } h2 { font-size: 1.4rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--text); padding: 8px 14px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header / footer */
.notice { background: var(--section); border-bottom: 1px solid var(--border); font-size: .92rem; padding: 8px 0; text-align: center; }
.site-header { background: var(--header-bg); color: var(--header-text); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 38px; width: auto; display: block; }
.nav { display: flex; gap: 6px; align-items: center; }
.nav a { color: var(--header-text); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.nav a[aria-current="page"] { color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); border-radius: 0; }
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--header-text); font: inherit; cursor: pointer; }
.site-footer { background: var(--footer-bg); color: var(--footer-text); border-top: 1px solid var(--border); margin-top: 72px; padding: 36px 0; }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: flex-start; }
.site-footer img { height: 32px; width: auto; }
.site-footer a { color: var(--footer-text); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer small { display: block; margin-top: 20px; opacity: .8; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--btn-bg); color: var(--btn-text); border: 1px solid transparent; border-radius: 8px; padding: 10px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: filter .15s; }
.btn:hover { filter: brightness(.93); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.lg { padding: 13px 24px; font-size: 1.05rem; }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: 14px; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }

/* sections and cards */
.hero { background: var(--section); padding: 64px 0 56px; border-bottom: 1px solid var(--border); }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.hero form { display: flex; gap: 10px; max-width: 640px; margin-top: 24px; }
.section { padding-top: 48px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.card h3 { margin: 0; } .card h3 a { color: var(--text); text-decoration: none; } .card h3 a:hover { color: var(--link); text-decoration: underline; }
.card .meta { font-size: .9rem; color: var(--muted); }
.card .foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .9rem; }
.badge { display: inline-block; background: color-mix(in srgb, var(--accent) 30%, var(--surface)); color: var(--text); border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; width: fit-content; }
.tile { text-decoration: none; color: var(--text); display: block; }
.tile:hover { border-color: var(--primary); }
.tile .count { color: var(--muted); font-size: .9rem; }
.trust { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.page-head { background: var(--section); border-bottom: 1px solid var(--border); padding: 36px 0 28px; }
.page-head p { color: var(--muted); max-width: 720px; margin: 0; }
.prose { max-width: 760px; } .prose ul { padding-left: 1.2em; }

/* opportunities list */
.filters { background: var(--section); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 24px 0 16px; align-items: end; }
.filters .wide { grid-column: span 2; }
.results-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; color: var(--muted); }
.pager { display: flex; justify-content: center; gap: 10px; align-items: center; margin-top: 28px; }

/* states */
.skeleton { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-height: 170px; }
.skeleton i { display: block; height: 12px; border-radius: 6px; margin-bottom: 12px; background: linear-gradient(90deg, var(--border), var(--section), var(--border)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
.skeleton i:first-child { width: 70%; height: 18px; } .skeleton i:nth-child(3) { width: 50%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.state { text-align: center; padding: 56px 16px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.state h3 { margin-bottom: 6px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; z-index: 200; box-shadow: var(--shadow); max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* opportunity page */
.detail { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr) 340px; padding-top: 28px; align-items: start; }
.detail .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.detail aside { position: sticky; top: 88px; }
.facts { display: grid; gap: 12px; margin: 0 0 18px; }
.facts dt { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; font-weight: 600; }
.apply { background: var(--section); border-radius: var(--radius); padding: 16px; }
.apply .btn { width: 100%; }
.disclaimer { font-size: .8rem; color: var(--muted); margin: 10px 0 0; }
.block { margin-bottom: 28px; } .block h2 { margin-bottom: .4em; }
.review { border-top: 1px solid var(--border); padding: 14px 0; }
.stars { letter-spacing: 2px; }
.crumbs { font-size: .9rem; color: var(--muted); }

@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; } .detail aside { position: static; order: -1; }
}
@media (max-width: 720px) {
  .menu-btn { display: inline-block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--header-bg); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: 8px 20px 14px; }
  .nav.open { display: flex; }
  .hero { padding: 40px 0; } .hero form { flex-direction: column; }
  .filters .wide { grid-column: span 1; }
  .brand img { height: 32px; }
}

/* Category tiles never show opportunity counts */
.tile .count { display: none !important; }
