/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --navy:       #1A2F5C;
  --navy-light: #213868;
  --cream:      #FAF6EE;
  --cream-dim:  #EDE8DC;
  --gold:       #C9A84C;
  --gold-hover: #B8943A;
  --gold-muted: rgba(201, 168, 76, 0.25);
  --text-navy:  #1A2F5C;
  --text-cream: #FAF6EE;
  --text-muted: rgba(250, 246, 238, 0.6);

  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;
  --radius-xl:  999px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.18);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--navy);
  color: var(--text-cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ── Utility Bar ───────────────────────────────────────────── */
.utility-bar {
  background: var(--cream);
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}
.utility-text {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--navy);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
}
.utility-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Brand lockup */
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  height: 48px;
  width: auto;
  margin-right: 4px;
  flex-shrink: 0;
  display: block;
}
.brand-text { display: flex; flex-direction: column; }
.brand-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--cream);
  line-height: 1.1;
}
.brand-subtitle {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 1;
  margin-top: 3px;
}

/* Member chip */
.member-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 8px;
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.member-chip:hover,
.member-chip:focus,
.member-chip[aria-expanded="true"] {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.07);
  outline: none;
}
.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-serif);
}
.member-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.member-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--cream);
  line-height: 1.1;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
  line-height: 1;
  margin-top: 2px;
}
.member-chevron {
  color: var(--cream);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.member-chip[aria-expanded="true"] .member-chevron {
  transform: rotate(180deg);
}

/* Dropdown */
.member-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--navy-light);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  z-index: 200;
}
.member-dropdown.open { display: block; }
.dropdown-item {
  display: block;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cream);
  transition: background 0.12s, color 0.12s;
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--gold-muted); color: var(--gold); }
.dropdown-item--danger:hover { color: #ff6b6b; background: rgba(255, 107, 107, 0.08); }

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 24px 80px;
}
.hero-inner {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Headline */
.hero-headline {
  font-family: var(--font-serif);
  font-size: clamp(38px, 6vw, 56px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--cream);
  margin-bottom: 16px;
  font-style: normal;
}
.headline-gold {
  font-style: italic;
  color: var(--gold);
}

/* Subtitle */
.hero-subtitle {
  font-size: clamp(14px, 2.2vw, 17px);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 560px;
  margin-bottom: 40px;
}

/* ── Search Bar ────────────────────────────────────────────── */
.search-form { width: 100%; }
.search-bar {
  display: flex;
  align-items: center;
  background: var(--cream);
  border: 2px solid var(--navy);
  border-radius: var(--radius-xl);
  padding: 6px 6px 6px 20px;
  gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.search-bar:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-muted), 0 2px 12px rgba(0,0,0,0.15);
}
.search-icon { display: flex; align-items: center; flex-shrink: 0; }
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 16px;
  font-style: italic;
  color: var(--navy);
  outline: none;
  padding: 10px 0;
  min-width: 0;
}
.search-input::placeholder { color: rgba(15, 30, 61, 0.45); }
.search-input:not(:placeholder-shown) { font-style: normal; }
.search-submit {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.search-submit:hover { background: var(--gold-hover); }
.search-submit:active { transform: scale(0.95); }
.search-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Spinner state */
.search-submit.loading {
  pointer-events: none;
}
.search-submit.loading svg {
  display: none;
}
.search-submit.loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--navy);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pills ─────────────────────────────────────────────────── */
.pill-section {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.pill-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pill-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.pill {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--cream);
  padding: 8px 18px;
  border: 1px solid rgba(250, 246, 238, 0.3);
  border-radius: var(--radius-xl);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  cursor: pointer;
}
.pill:hover {
  border-color: var(--gold);
  background: var(--gold-muted);
  color: var(--gold);
}
.pill-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}

/* ── Results Card ──────────────────────────────────────────── */
.results-section {
  margin-top: 40px;
  width: 100%;
  text-align: left;
}
.results-card {
  background: var(--cream);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  box-shadow: var(--shadow-card);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.results-query {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--cream-dim);
}
.results-body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  color: var(--navy);
}

/* Markdown-style content inside results */
.results-body h1,
.results-body h2,
.results-body h3 {
  font-family: var(--font-serif);
  color: var(--gold-hover);
  margin: 20px 0 8px;
}
.results-body h2 { font-size: 20px; }
.results-body h3 { font-size: 17px; }
.results-body p { margin-bottom: 12px; }
.results-body ul,
.results-body ol {
  padding-left: 20px;
  margin-bottom: 12px;
}
.results-body li { margin-bottom: 6px; }
.results-body strong { font-weight: 600; }
.results-body em { font-style: italic; }

/* Streaming cursor */
.results-body .cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--navy);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 0.8s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Error state */
.results-body.error {
  color: #c0392b;
  font-style: italic;
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  border-top: 1px solid rgba(201, 168, 76, 0.15);
  padding: 16px 24px;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}
.footer-nav {
  display: flex;
  gap: 20px;
}
.footer-link {
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.15s;
}
.footer-link:hover { color: var(--gold); }

/* ── Login page button ─────────────────────────────────────── */
/* Higher specificity (button.login-btn) ensures these rules win over the
   login.html <style> block so the button always shows clean, opaque gold. */
button.login-btn {
  background: var(--gold);
}
button.login-btn:disabled {
  opacity: 1;
  cursor: not-allowed;
  color: rgba(26, 47, 92, 0.5); /* dim text only — background stays gold */
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero { padding: 48px 16px 60px; }
  .results-card { padding: 24px 20px; }
  .pill-row { flex-wrap: wrap; gap: 8px; }
  .pill-dot { display: none; }
  .member-info { display: none; }
  .brand-logo { height: 36px; }
  .brand-subtitle { display: none; }
  .utility-text { font-size: 9px; letter-spacing: 0.08em; }
  .footer-inner { flex-direction: column; text-align: center; gap: 8px; }
}

@media (max-width: 400px) {
  .search-bar { padding: 4px 4px 4px 14px; }
  .search-input { font-size: 14px; }
  .search-submit { width: 40px; height: 40px; }
}
