/* ============================================================================
   CloseConnect styles
   Colors come from data/school.js and are injected as CSS variables at runtime
   (see app.js). The fallbacks below keep things sane if a value is missing.
   ============================================================================ */

:root {
  --primary: #0a3a66;
  --accent: #2b6cb0;
  --accent-soft: #e9f1f9;
  --bg: #f1efe6;
  --card: #ffffff;
  --text: #232a31;
  --muted: #5f6b78;
  --border: #ece8e1;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.03), 0 10px 30px rgba(20, 30, 45, 0.05);
  --shadow-hover: 0 2px 4px rgba(20, 30, 45, 0.05), 0 16px 40px rgba(20, 30, 45, 0.10);
  --maxw: 1000px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---- Header ---- */
.site-header {
  background:
    radial-gradient(1200px 460px at 50% -12%, var(--accent-soft) 0%, rgba(233,241,249,0) 62%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 60px 0 58px;
  text-align: center;
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.brand-mark { width: 52px; height: 52px; display: block; }
.brand-wordmark { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.brand-logo {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  line-height: 1;
}
.brand-logo img { height: 30px; display: block; }
.brand-school {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.hero-title {
  font-family: "Playfair Display", Georgia, serif;
  margin: 0 auto 14px;
  font-size: clamp(1.4rem, 4.4vw, 2.6rem);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--primary);
  max-width: none;
  white-space: nowrap;
}
.hero-intro {
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 52ch;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 6px;
  margin: 36px auto 20px;
  background: #f0ede7;
  padding: 5px;
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(20, 30, 45, 0.12);
}
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Controls ---- */
.controls { margin-bottom: 18px; }
.search-wrap {
  position: relative;
  margin-bottom: 16px;
}
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.search {
  width: 100%;
  padding: 15px 56px 15px 46px;
  font-size: 1rem;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.search::placeholder { color: #9aa0a8; }
.search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Sleek send button inside the search bar (Claude-style, USD blue) */
.send-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 0.15s, transform 0.06s;
}
.send-btn svg { width: 20px; height: 20px; }
.send-btn:hover { filter: brightness(1.15); }
.send-btn:active { transform: translateY(-50%) scale(0.94); }
.send-btn:disabled { opacity: 0.45; cursor: default; }
.send-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.search-hint {
  margin: -4px 0 16px;
  color: var(--muted);
  font-size: 0.86rem;
}
.search-hint strong { color: var(--accent); font-weight: 700; }

/* AI advisor answer panel */
.advisor {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--card) 100%);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 0 0 20px;
  box-shadow: var(--shadow);
}
.advisor-head { margin-bottom: 8px; }
.advisor-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: 4px 11px;
  border-radius: 999px;
}
.advisor-badge--muted { background: var(--muted); }
.advisor-answer {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text);
}
.advisor-note { margin: 0; color: var(--muted); font-size: 0.95rem; }
.advisor-loading {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}
.advisor-loading::after {
  content: "";
  display: inline-block;
  width: 1em;
  text-align: left;
  animation: cc-dots 1.2s steps(4, end) infinite;
}
@keyframes cc-dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

/* Animated blue sun loader (shown while the advisor thinks):
   the rays rotate continuously while the center bullseye gently pulses. */
.advisor-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
}
.advisor-spinner svg {
  width: 64px;
  height: 64px;
  color: #003b70; /* crisp USD navy */
  animation: cc-sun-spin 2.9s linear infinite;
}
@keyframes cc-sun-spin {
  0%   { transform: rotate(0deg)   scale(1); }
  25%  { transform: rotate(90deg)  scale(1.1); }
  50%  { transform: rotate(180deg) scale(1); }
  75%  { transform: rotate(270deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .advisor-spinner svg { animation: cc-sun-breathe 2s ease-in-out infinite; }
  @keyframes cc-sun-breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
}

/* "More info" expander on cards */
.card-more {
  align-self: flex-start;
  margin: 0 0 12px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.card-more:hover { text-decoration: underline; }
.card-details {
  margin: 0 0 14px;
  padding-left: 12px;
  border-left: 2px solid var(--accent-soft);
}
.card-details-text {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}
.card-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-sublink {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.card-sublink:hover { text-decoration: underline; }

/* Per-card feedback row */
.card-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.fb-q { font-size: 0.8rem; color: var(--muted); margin-right: 2px; }
.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.12s;
}
.fb-btn .fb-ico { width: 16px; height: 16px; display: block; }
.fb-btn--down .fb-ico { transform: rotate(180deg); }
.fb-btn:hover { transform: translateY(-1px); }
.fb-btn--up:hover { color: #2f8f5b; border-color: #2f8f5b; background: #eef7f1; }
.fb-btn--down:hover { color: #b0546b; border-color: #b0546b; background: #fbeef1; }
.fb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fb-report {
  margin-left: auto;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  text-decoration: underline;
}
.fb-report:hover { color: var(--accent); }
.fb-thanks { font-size: 0.82rem; color: var(--accent); font-weight: 600; }

/* Upcoming deadlines & events */
.events-box {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  margin: 0 0 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.events-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
}
.events-summary::-webkit-details-marker { display: none; }
.events-summary-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}
.events-chevron {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: transform 0.2s ease;
}
.events-box[open] .events-chevron { transform: rotate(180deg); }
.events-box[open] .events-summary { border-bottom: 1px solid var(--border); }
.events-sub {
  margin: 0;
  padding: 12px 18px 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.events-list { padding: 6px 18px 12px; }
.event-row {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.event-row:last-child { border-bottom: 0; }
.event-when {
  flex: none;
  width: 160px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}
a.event-when:hover { text-decoration: underline; }
.event-body { flex: 1; min-width: 0; }
.event-title {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.98rem;
}
a.event-title:hover { color: var(--accent); text-decoration: underline; }
.event-note { margin: 3px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.event-find {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
  font-style: italic;
}
.events-disclaimer {
  margin: 0;
  padding: 10px 18px 16px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  border-top: 1px solid var(--border);
}
@media (max-width: 560px) {
  .event-row { flex-direction: column; gap: 2px; }
  .event-when { width: auto; }
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 15px 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.chip-ico { display: inline-flex; }
.chip-ico svg { width: 15px; height: 15px; display: block; }
.card-tag .tag-ico { display: inline-flex; }
.card-tag .tag-ico svg { width: 13px; height: 13px; display: block; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Result count ---- */
.result-count {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 18px;
}

/* ---- Results grid ---- */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
  margin-bottom: 52px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
/* Subtle category accent down the left edge */
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #dfe6ee;
}
.card-top {
  margin-bottom: 8px;
}
.card-name {
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.24;
  letter-spacing: -0.005em;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
/* ---- Category color system (soft, cohesive tints) ---- */
.card-tag[data-cat="academic"]        { background: #eef2fb; color: #3b4a86; }
.card-tag[data-cat="research"]        { background: #e6f1f4; color: #1c6b78; }
.card-tag[data-cat="community"]       { background: #eaf5ee; color: #3c7350; }
.card-tag[data-cat="entrepreneurship"]{ background: #fbf1e6; color: #96601f; }
.card-tag[data-cat="career"]          { background: #eef0fb; color: #474d90; }
.card-tag[data-cat="wellness"]        { background: #e7f4f1; color: #2f7365; }
.card-tag[data-cat="general"]         { background: #f0efec; color: #5f6b78; }
.card-tag[data-cat="engineering"]     { background: #eef1f4; color: #46545f; }
.card-tag[data-cat="alumni"]          { background: #f3eefb; color: #6b4a8f; }
.card-tag[data-cat="competitions"]    { background: #fbeef1; color: #97425c; }
/* Chips show a soft category tint border on hover; active stays accent for clarity */
.chip[data-cat="academic"]:hover        { border-color: #3b4a86; color: #3b4a86; }
.chip[data-cat="research"]:hover        { border-color: #1c6b78; color: #1c6b78; }
.chip[data-cat="community"]:hover       { border-color: #3c7350; color: #3c7350; }
.chip[data-cat="entrepreneurship"]:hover{ border-color: #96601f; color: #96601f; }
.chip[data-cat="career"]:hover          { border-color: #474d90; color: #474d90; }
.chip[data-cat="wellness"]:hover        { border-color: #2f7365; color: #2f7365; }
.chip[data-cat="engineering"]:hover     { border-color: #46545f; color: #46545f; }
.chip[data-cat="alumni"]:hover          { border-color: #6b4a8f; color: #6b4a8f; }
.chip[data-cat="competitions"]:hover    { border-color: #97425c; color: #97425c; }
.card-why {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.why-label { font-weight: 600; color: var(--primary); }
.why-chip {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
}

.card-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
.card-meta {
  margin: 0 0 14px;
  color: #8a919b;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-foot {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-link {
  color: var(--accent);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.card-link:hover { text-decoration: underline; }
.card-link svg { width: 14px; height: 14px; }
.verify-flag {
  font-size: 0.74rem;
  color: #a3731a;
  background: #fdf4e3;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 600;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-title { font-size: 1.15rem; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.empty-sub { margin: 0 0 20px; }
.btn-clear {
  border: 1px solid var(--accent);
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  font-family: var(--sans);
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
}
.btn-clear:hover { background: var(--accent-soft); }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 30px 0 48px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}
.footer-affil { margin: 8px 0 0; color: var(--muted); font-size: 0.8rem; opacity: 0.9; }
.footer-links { margin: 8px 0 0; }
.footer-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .container { padding: 0 18px; }
  .hero-title { font-size: 1.85rem; }
  .hero-intro { font-size: 1rem; }
  .results { grid-template-columns: 1fr; }
  .site-header { padding: 30px 0 32px; }
  .tabs { width: 100%; }
  .tab { flex: 1; text-align: center; padding: 10px 10px; }
}
