/* Shared design tokens + base reset. Loaded by every page. */

:root {
  --bg: #faf9f5;
  --bg-elevated: #ffffff;
  --sidebar-bg: #f6f5f0;
  --border: #ece8df;
  --text: #18181a;
  --text-muted: #6b6b65;
  --accent: #b45430;
  --accent-hover: #9c4527;
  --accent-soft: #f3e6dc;
  --accent-contrast: #ffffff;
  --btn-primary-bg: #18181a;
  --btn-primary-bg-hover: #313133;
  --btn-primary-fg: #ffffff;
  --danger: #b3301f;
  --danger-soft: #f8e3de;
  --shadow: 0 1px 1px rgba(20,20,19,0.02), 0 2px 4px rgba(20,20,19,0.02), 0 8px 20px rgba(20,20,19,0.04);
  --shadow-lg: 0 2px 4px rgba(20,20,19,0.03), 0 10px 24px rgba(20,20,19,0.06), 0 24px 48px rgba(20,20,19,0.05);
  --radius: 16px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #16161a;
  --bg-elevated: #1f1f23;
  --sidebar-bg: #1a1a1e;
  --border: #2c2c31;
  --text: #f1f1ee;
  --text-muted: #9c9c96;
  --accent: #e08a5c;
  --accent-hover: #ef9c72;
  --accent-soft: #362820;
  --accent-contrast: #17130f;
  --btn-primary-bg: #f1f1ee;
  --btn-primary-bg-hover: #ffffff;
  --btn-primary-fg: #16161a;
  --danger: #f2836a;
  --danger-soft: #332420;
  --shadow: 0 1px 2px rgba(0,0,0,0.22), 0 4px 10px rgba(0,0,0,0.22), 0 16px 32px rgba(0,0,0,0.18);
  --shadow-lg: 0 2px 6px rgba(0,0,0,0.26), 0 12px 28px rgba(0,0,0,0.32), 0 28px 56px rgba(0,0,0,0.26);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16161a;
    --bg-elevated: #1f1f23;
    --sidebar-bg: #1a1a1e;
    --border: #2c2c31;
    --text: #f1f1ee;
    --text-muted: #9c9c96;
    --accent: #e08a5c;
    --accent-hover: #ef9c72;
    --accent-soft: #362820;
    --accent-contrast: #17130f;
    --btn-primary-bg: #f1f1ee;
    --btn-primary-bg-hover: #ffffff;
    --btn-primary-fg: #16161a;
    --danger: #f2836a;
    --danger-soft: #332420;
    --shadow: 0 1px 2px rgba(0,0,0,0.22), 0 4px 10px rgba(0,0,0,0.22), 0 16px 32px rgba(0,0,0,0.18);
    --shadow-lg: 0 2px 6px rgba(0,0,0,0.26), 0 12px 28px rgba(0,0,0,0.32), 0 28px 56px rgba(0,0,0,0.26);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'cv02', 'cv03', 'cv04';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease;
}

/* Editorial serif, reserved for longer-form prose (marketing copy, notes) —
   sans stays for headings, nav, labels, and all UI chrome. */
.prose {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-optical-sizing: auto;
}

a { color: var(--accent); }

/* Skip link (accessibility) */
.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 12px;
}

/* Visible keyboard focus ring everywhere */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}

/* Icon set */
.icon {
  width: 1.1em;
  height: 1.1em;
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

/* Brand mark: horseshoe (exact logo asset, not re-colored) */
.brand-mark {
  width: 26px;
  height: 31px;
  flex-shrink: 0;
  object-fit: contain;
}

/* Top section tabs — Contacts / Campus Forum / Discover */
.top-tabs {
  display: flex;
  gap: 26px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.top-tab {
  padding: 4px 2px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.top-tab:hover { color: var(--text); }
.top-tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Floating "Ask Forge" chat launcher — bottom-right, on every app page */
.ask-forge-btn {
  position: fixed;
  right: 30px;
  bottom: 34px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.ask-forge-btn:hover {
  transform: scale(1.06);
}
.ask-forge-btn:active {
  transform: scale(0.96);
}

/* A quick "Ask Forge!" nudge that pops up near the launcher on every page
   load, then fades away on its own — pure CSS, no JS needed. */
.ask-forge-greeting {
  position: fixed;
  right: 30px;
  bottom: 108px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  z-index: 79;
  opacity: 0;
  pointer-events: none;
  animation: ask-forge-greeting-pop 3.4s ease forwards;
  animation-delay: 0.5s;
}
@keyframes ask-forge-greeting-pop {
  0% { opacity: 0; transform: translateY(6px); }
  10% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .ask-forge-greeting { display: none; }
}

/* Onboarding walkthrough */
.onboarding-highlight {
  position: relative;
  z-index: 201;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px var(--accent-soft);
}
/* Elements that are already positioned/shaped (e.g. the fixed, circular
   Ask Forge launcher) must keep their own position + radius — the rule
   above is only meant to give static elements a stacking context. */
.ask-forge-btn.onboarding-highlight {
  position: fixed;
  border-radius: 50%;
}

.onboarding-tooltip {
  position: fixed;
  z-index: 202;
  width: 280px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px 18px;
}

.onboarding-persona {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.onboarding-avatar {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.onboarding-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
}

.onboarding-text {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}

.onboarding-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.onboarding-count {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.onboarding-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.onboarding-skip {
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.onboarding-skip:hover { color: var(--text); }

.onboarding-next {
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}
.onboarding-next:hover { color: var(--accent-hover); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 15px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s var(--ease), opacity 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn[hidden] { display: none; }

.btn:active { transform: scale(0.97); }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 12.5px; }
.btn-lg { padding: 14px 26px; font-size: 16px; }

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  box-shadow: var(--shadow);
}
.btn-primary:hover { background: var(--btn-primary-bg-hover); box-shadow: var(--shadow-lg); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); border-color: var(--accent); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-danger:hover { opacity: 0.85; }

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  padding: 0;
  align-self: flex-start;
}
.btn-icon:hover { background: var(--bg); }
