:root {
  --teal-300: #5eead4;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --bg: #0e1117;
  --surface: #181c27;
  --border: #2c2f42;
  --text: #dde1e7;
  --text-muted: #8b8fa3;
  --chip: #1e2232;
  --radius: 14px;
  --header-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}

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

html, body { background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100%; }

body.directory {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: #4a9d7c; text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(14, 17, 23, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}

.brand img { width: 72px; height: auto; display: block; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
  padding: 6px 2px;
}

.site-nav a:hover,
.site-nav a.is-active { color: var(--text); text-decoration: none; }

.site-nav a.nav-chat {
  color: #0d1117;
  background: var(--teal-600);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.site-nav a.nav-chat:hover { background: var(--teal-700); color: #fff; }

#nav-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}
#nav-auth img {
  display: block;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.hero { margin-bottom: 28px; }
.hero h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 10px; }
.hero p { color: var(--text-muted); font-size: 1.05rem; max-width: 640px; line-height: 1.6; }
.hero-meta { margin-top: 10px; font-size: 0.85rem; color: var(--text-muted); }

.ask-bar { margin-bottom: 16px; }
.ask-bar form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.ask-bar input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
}
.ask-bar input:focus {
  outline: 2px solid var(--teal-600);
  outline-offset: 1px;
}
.ask-bar button {
  background: var(--teal-600);
  color: #0d1117;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.ask-bar button:hover { background: var(--teal-700); color: #fff; }
.counts-line {
  margin: 0 0 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 10px;
  margin: 20px 0 28px;
}

.home-map-search {
  margin-top: 48px;
  margin-bottom: 8px;
}

.home-map-search .filters {
  margin: 0 0 16px;
}

.filters input,
.filters select {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

.filters button,
.btn {
  display: inline-block;
  background: var(--teal-600);
  color: #0d1117;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.filters button:hover,
.btn:hover { background: var(--teal-700); color: #fff; text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.map-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 32px;
}

#directory-map { height: 440px; min-height: 440px; width: 100%; background: #151924; }
.home-browse-programs { margin-top: 16px; }
.map-caption {
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 28px 0 14px;
}

.section-head h2 { font-size: 1.25rem; }
.muted { color: var(--text-muted); }

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

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.card:hover { border-color: var(--teal-600); text-decoration: none; }

.card-photo {
  height: 110px;
  background:
    linear-gradient(135deg, #1a2e23 0%, #181c27 60%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.02) 10px, rgba(255,255,255,0.02) 20px);
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.card-photo.has-photo {
  padding: 0;
  align-items: stretch;
  background: #151924;
}

.card-photo.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body { padding: 14px 16px 16px; }
.card-body h3 { font-size: 1.05rem; margin-bottom: 6px; }
.card-body p { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  background: var(--chip);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
}

.article h1 { font-size: 1.8rem; margin-bottom: 8px; }
.article .lede { color: var(--text-muted); margin-bottom: 18px; }
.article h2 { font-size: 1.2rem; margin: 28px 0 10px; }
.article h3 { font-size: 1.05rem; margin: 20px 0 8px; color: #b0b4c0; }
.article p, .article li { color: #b0b4c0; line-height: 1.7; font-size: 0.95rem; }
.article p { margin: 12px 0; }
.article ul, .article ol { margin: 8px 0 8px 20px; }
.article table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.9rem; }
.article th, .article td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.article blockquote {
  border-left: 3px solid var(--teal-600);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-muted);
}

.meta-card, .side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.meta-card dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; }
.meta-card dt { color: var(--text-muted); font-size: 0.8rem; }
.meta-card dd { font-size: 0.95rem; }
.side-card h2 { font-size: 0.95rem; margin-bottom: 10px; }
.side-card ul { list-style: none; }
.side-card li { margin-bottom: 8px; }

.photo-ph {
  height: 160px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  background: linear-gradient(135deg, #1a2e23, #181c27);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  overflow: hidden;
}

.photo-ph.has-photo {
  padding: 0;
  background: #151924;
}

.photo-ph.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.site-footer {
  border-top: 1px solid #21262d;
  padding: 1.5rem 20px;
  text-align: center;
  color: #7d8590;
  font-size: 0.8rem;
}

.site-footer a { color: #7d8590; margin: 0 0.6rem; }

.empty { color: var(--text-muted); padding: 12px 0; }

@media (max-width: 800px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.55rem; }
}
