:root {
  --bg: #f5f5f0;
  --paper: #fbfbf7;
  --ink: #171816;
  --muted: #72736d;
  --line: #d9dad2;
  --accent: #315a49;
  --accent-soft: #e8eee9;
  --max: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { width: min(var(--max), calc(100% - 48px)); margin-inline: auto; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, white 8%);
}
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border: 1px solid var(--ink);
  font-size: 9px; letter-spacing: .08em;
}
.brand-muted { color: var(--muted); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 28px; font-size: 14px; color: var(--muted); }
.nav a { transition: color .18s ease, background .18s ease, border-color .18s ease; }
.nav a:hover { color: var(--ink); }
.nav-cta { padding: 9px 13px; border: 1px solid var(--ink); color: var(--ink) !important; }
.nav-cta:hover { background: var(--ink); color: white !important; }
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.nav-search-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.search-kbd {
  font-size: 10px;
  background: var(--accent-soft);
  color: var(--ink);
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0;
  font-family: inherit;
}

.hero { padding: 100px 0 88px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .15em; }
h1, h2, p { margin-top: 0; }
h1 {
  margin: 18px 0 24px;
  max-width: 900px;
  font-size: clamp(58px, 9vw, 108px);
  line-height: .96;
  letter-spacing: -.065em;
  font-weight: 800;
}
h1 em, h2 em { font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -.05em; }
.hero-copy { max-width: 720px; font-size: 18px; color: var(--muted); }
.hero-actions { display: flex; align-items: center; gap: 22px; margin-top: 34px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; gap: 14px; padding: 13px 17px; font-size: 13px; font-weight: 800; letter-spacing: -.01em; border: 1px solid var(--ink); transition: transform .18s ease, background .18s ease, color .18s ease; }
.button:hover { transform: translateY(-2px); }
.button-dark { background: var(--ink); color: white; }
.button-dark:hover { background: var(--accent); border-color: var(--accent); }
.text-link { color: var(--muted); font-size: 13px; }
.text-link span { color: var(--ink); margin-left: 5px; }
.hero-rule { width: min(520px, 90%); border-top: 1px solid var(--line); margin: 58px 0 15px; }
.hero-note { display: flex; gap: 18px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .09em; }
.hero-note span:first-child { color: var(--accent); font-weight: 800; }

.section { padding: 88px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 50px; margin-bottom: 36px; }
.section-head h2 { margin: 8px 0 0; font-size: clamp(34px, 4vw, 52px); line-height: 1.02; letter-spacing: -.045em; }
.section-head > p { max-width: 380px; margin-bottom: 3px; color: var(--muted); font-size: 14px; }

.subject-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.subject-card {
  min-height: 180px; padding: 22px 22px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto;
  background: transparent; transition: background .18s ease, transform .18s ease;
}
.subject-card:hover { background: var(--paper); transform: translateY(-2px); }
.subject-number, .resource-index { font-size: 11px; color: var(--accent); font-weight: 800; letter-spacing: .08em; }
.subject-name { grid-column: 1 / -1; align-self: center; font-size: 28px; letter-spacing: -.04em; font-weight: 700; }
.subject-arrow { justify-self: end; align-self: end; font-size: 20px; color: var(--muted); }
.subject-card-muted { background: var(--accent-soft); }

.resource-list { border-top: 1px solid var(--line); }
.resource-row { display: grid; grid-template-columns: 56px 1fr 40px; gap: 18px; align-items: center; padding: 25px 0; border-bottom: 1px solid var(--line); transition: padding .18s ease; }
.resource-row:hover { padding-left: 10px; }
.resource-title { font-size: 20px; font-weight: 750; letter-spacing: -.025em; }
.resource-desc { color: var(--muted); font-size: 14px; margin-top: 3px; }
.resource-arrow { justify-self: end; color: var(--muted); font-size: 18px; }

.support { margin-top: 88px; padding: 54px; background: var(--ink); color: white; display: grid; grid-template-columns: 1.15fr .85fr; gap: 70px; align-items: center; }
.support .eyebrow { color: #9cc0ad; }
.support h2 { margin: 12px 0 20px; font-size: clamp(42px, 5.5vw, 68px); line-height: .97; letter-spacing: -.055em; }
.support-copy p { max-width: 620px; margin: 0; color: rgba(255,255,255,.68); font-size: 15px; }
.support-card { padding: 28px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.045); }
.support-card-label { font-size: 10px; letter-spacing: .16em; font-weight: 800; color: #9cc0ad; margin-bottom: 22px; }
.support-card p { margin: 0 0 24px; font-size: 19px; line-height: 1.35; letter-spacing: -.025em; }
.support-card-note { color: rgba(255,255,255,.52); font-size: 11px; line-height: 1.5; }
.about { padding: 120px 0 125px; border-top: 1px solid var(--line); }
.about-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 80px; margin-top: 20px; }
.about h2 { margin: 0; font-size: clamp(46px, 6vw, 76px); line-height: .96; letter-spacing: -.06em; }
.about p { color: var(--muted); font-size: 16px; max-width: 500px; }
.about p + p { margin-top: 18px; }

.site-footer { border-top: 1px solid var(--line); }
.footer-inner { min-height: 115px; display: flex; justify-content: space-between; align-items: center; gap: 30px; }
.footer-brand { font-weight: 800; letter-spacing: -.02em; }
.footer-brand span { color: var(--muted); }
.site-footer p, .footer-right { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

/* --- Hero Search Box --- */
.hero-search-wrap {
  margin-top: 36px;
  max-width: 680px;
}
.hero-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 4px 18px -4px rgba(23, 24, 22, 0.05);
  transition: border-color .18s ease, box-shadow .18s ease;
  cursor: pointer;
}
.hero-search-box:hover,
.hero-search-box:focus-within {
  border-color: var(--ink);
  box-shadow: 0 6px 24px -4px rgba(23, 24, 22, 0.09);
}
.hero-search-icon {
  color: var(--muted);
  flex-shrink: 0;
}
.hero-search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  padding: 10px 0;
  outline: none;
  cursor: pointer;
}
.hero-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.hero-search-kbd {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--accent-soft);
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  white-space: nowrap;
}
.hero-search-suggestions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.suggestions-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
  color: var(--accent);
  margin-right: 4px;
}
.search-chip {
  border: 1px solid var(--line);
  background: transparent;
  padding: 5px 12px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s ease;
}
.search-chip:hover {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
  transform: translateY(-1px);
}

/* --- Search Modal & Backdrop --- */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(23, 24, 22, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 80px 20px 40px;
  overflow-y: auto;
}
.search-modal-backdrop[hidden] {
  display: none !important;
}
.search-modal-card {
  background: var(--paper);
  border: 1px solid var(--line);
  width: 100%;
  max-width: 680px;
  box-shadow: 0 25px 50px -12px rgba(23, 24, 22, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: searchModalEnter .2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes searchModalEnter {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.search-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.search-modal-icon {
  color: var(--muted);
  flex-shrink: 0;
}
.search-modal-input {
  flex: 1;
  font-size: 17px;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--ink);
  outline: none;
}
.search-clear-btn {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 8px;
  transition: color .15s ease;
}
.search-clear-btn:hover {
  color: var(--ink);
}
.search-close-btn {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s ease;
}
.search-close-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.search-suggestions {
  padding: 20px 22px 22px;
  border-bottom: 1px solid var(--line);
}
.suggestions-header {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  color: var(--accent);
  margin-bottom: 12px;
}
.search-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.search-results-list {
  max-height: 380px;
  overflow-y: auto;
}
.search-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  text-decoration: none;
  color: inherit;
  transition: background .12s ease;
}
.search-result-row:last-child {
  border-bottom: none;
}
.search-result-row:hover,
.search-result-row.is-selected {
  background: var(--accent-soft);
}
.search-result-meta {
  flex: 1;
  min-width: 0;
}
.search-category-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--accent);
  margin-bottom: 3px;
}
.search-result-title {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -.02em;
  margin: 0 0 3px 0;
}
.search-result-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-arrow {
  font-size: 16px;
  color: var(--muted);
  transition: transform .12s ease, color .12s ease;
  flex-shrink: 0;
}
.search-result-row:hover .search-result-arrow,
.search-result-row.is-selected .search-result-arrow {
  transform: translateX(3px);
  color: var(--accent);
}
.search-highlight {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--ink);
  font-weight: 700;
  padding: 0 2px;
  border-radius: 2px;
}
.search-no-results {
  padding: 42px 24px;
  text-align: center;
}
.no-results-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}
.no-results-desc {
  font-size: 14px;
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto 22px;
  line-height: 1.5;
}
.no-results-actions {
  display: flex;
  justify-content: center;
}
.no-results-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.search-modal-footer {
  padding: 12px 22px;
  background: color-mix(in srgb, var(--bg) 85%, white 15%);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.search-shortcuts-guide {
  display: flex;
  gap: 14px;
  align-items: center;
}
.search-shortcuts-guide kbd {
  font-family: inherit;
  font-size: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--ink);
}
.search-footer-support-link {
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color .15s ease;
}
.search-footer-support-link:hover {
  color: var(--ink);
}

@media (max-width: 800px) {
  .section-head, .about-grid, .support { grid-template-columns: 1fr; display: grid; gap: 20px; }
  .support { padding: 38px 28px; }
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .about { padding-top: 90px; padding-bottom: 90px; }
}

@media (max-width: 620px) {
  .wrap { width: min(100% - 30px, var(--max)); }
  .header-inner { min-height: 68px; }
  .nav { gap: 12px; font-size: 12px; }
  .nav-search-btn { padding: 6px 9px; font-size: 12px; gap: 5px; }
  .nav-search-btn .search-kbd { display: none; }
  .hero { padding: 72px 0 70px; }
  h1 { font-size: clamp(50px, 15vw, 76px); }
  .hero-copy { font-size: 16px; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 14px; }
  .hero-search-kbd { display: none; }
  .hero-search-wrap { margin-top: 28px; }
  .search-modal-backdrop { padding: 24px 12px; }
  .search-modal-header { padding: 14px 16px; gap: 10px; }
  .search-modal-input { font-size: 16px; }
  .search-result-row { padding: 12px 16px; }
  .search-shortcuts-guide { display: none; }
  .search-suggestions { padding: 16px 16px 18px; }
  .subject-grid { grid-template-columns: 1fr; }
  .subject-card { min-height: 145px; }
  .resource-row { grid-template-columns: 38px 1fr 24px; gap: 10px; }
  .resource-title { font-size: 18px; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; padding: 25px 0; }
}
