/* CB Condos HOA — Shared Styles */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy:       #1B2A4A;
  --steel:      #2E5D8E;
  --steel-lt:   #4478B0;
  --sky:        #D4E9F7;
  --sky-lt:     #EBF4FB;
  --accent:     #C8872A;
  --accent-lt:  #F5E6C8;
  --mid:        #4A5568;
  --light:      #F7F9FB;
  --border:     #CBD5E0;
  --white:      #FFFFFF;
  --pass:       #166534;
  --pass-bg:    #D1FAE5;
  --fail:       #991B1B;
  --fail-bg:    #FEE2E2;
  --pend:       #92400E;
  --pend-bg:    #FEF3C7;
  --shadow-sm:  0 1px 3px rgba(27,42,74,.08);
  --shadow-md:  0 4px 16px rgba(27,42,74,.12);
  --shadow-lg:  0 8px 32px rgba(27,42,74,.16);
  --radius:     6px;
  --radius-lg:  12px;
  --font-head:  'Playfair Display', Georgia, serif;
  --font-body:  'Source Serif 4', Georgia, serif;
  --font-mono:  'JetBrains Mono', monospace;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--light);
  color: #1a1a2e;
  line-height: 1.65;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 64px;
}

.site-logo {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--white);
  text-decoration: none;
  white-space: nowrap;
}
.site-logo span { color: var(--accent); }

.site-nav {
  display: flex;
  gap: .25rem;
  flex: 1;
}

.site-nav a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 300;
  padding: .35rem .75rem;
  border-radius: var(--radius);
  transition: all .18s;
  letter-spacing: .01em;
}

.site-nav a:hover, .site-nav a.active {
  color: var(--white);
  background: rgba(255,255,255,.12);
}

.header-right {
  margin-left: auto;
  display: flex;
  gap: .5rem;
  align-items: center;
}

.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.page-title {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .4rem;
}
.page-subtitle {
  color: var(--mid);
  font-size: .95rem;
  font-weight: 300;
  margin-bottom: 2rem;
}

/* ── Gate screen ─────────────────────────────────────────────────────────── */
#gate-screen {
  position: fixed; inset: 0;
  background: linear-gradient(145deg, var(--navy) 0%, #0d1a33 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.gate-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 3rem 3.5rem;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  text-align: center;
  animation: gateIn .4s ease-out;
}
@keyframes gateIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gate-logo {
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--navy);
  font-weight: 700;
  margin-bottom: .3rem;
}
.gate-sub {
  font-size: .85rem;
  color: var(--mid);
  margin-bottom: 2rem;
  font-weight: 300;
}

.gate-box label {
  display: block;
  text-align: left;
  font-size: .85rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: .5rem;
}

.gate-box input[type="password"],
.gate-box input[type="text"] {
  width: 100%;
  padding: .75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color .18s;
  letter-spacing: .08em;
  text-align: center;
}
.gate-box input:focus { border-color: var(--steel); }
.gate-error {
  color: var(--fail);
  font-size: .85rem;
  margin-top: .5rem;
  min-height: 1.2em;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: .01em;
}
.btn-primary   { background: var(--steel); color: var(--white); }
.btn-primary:hover { background: var(--navy); }
.btn-secondary { background: var(--sky); color: var(--navy); }
.btn-secondary:hover { background: #c5ddf0; }
.btn-accent    { background: var(--accent); color: var(--white); }
.btn-accent:hover { background: #a86e1e; }
.btn-ghost     { background: transparent; color: var(--mid); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--sky-lt); color: var(--navy); border-color: var(--steel-lt); }
.btn-danger    { background: var(--fail-bg); color: var(--fail); border: 1.5px solid #fca5a5; }
.btn-danger:hover { background: #fecaca; }
.btn-sm        { padding: .35rem .8rem; font-size: .82rem; }
.btn-lg        { padding: .85rem 1.75rem; font-size: 1rem; }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ── Search bar ──────────────────────────────────────────────────────────── */
.search-wrap {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem .6rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s;
  margin-bottom: 2rem;
}
.search-wrap:focus-within {
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(46,93,142,.1);
}
.search-wrap svg { color: var(--mid); flex-shrink: 0; }
.search-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 1rem;
  background: transparent;
  color: #1a1a2e;
}
.search-wrap input::placeholder { color: #aab; }

/* ── Result cards ────────────────────────────────────────────────────────── */
.results-list { display: flex; flex-direction: column; gap: 1rem; }

.result-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: all .18s;
  text-decoration: none;
  color: inherit;
}
.result-card:hover {
  border-color: var(--steel-lt);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.result-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-minutes { background: var(--sky); color: var(--steel); }
.icon-vote    { background: var(--accent-lt); color: var(--accent); }

.result-card-body { flex: 1; min-width: 0; }
.result-card-meta {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .3rem;
  flex-wrap: wrap;
}
.result-card-date {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--mid);
  font-weight: 500;
}
.result-card-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .3rem;
}
.result-card-snippet {
  font-size: .9rem;
  color: var(--mid);
  font-weight: 300;
  line-height: 1.55;
}
.result-card-snippet mark {
  background: var(--accent-lt);
  color: var(--accent);
  border-radius: 2px;
  padding: 0 2px;
}
.extracted-text mark {
  background: #FFF3CD;
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
  outline: none;
  transition: outline .2s;
}
.extracted-text mark:first-of-type {
  outline: 2px solid var(--accent);
}
.result-card-actions {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex-shrink: 0;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--font-body);
}
.badge-approved { background: var(--pass-bg); color: var(--pass); }
.badge-pending  { background: var(--pend-bg); color: var(--pend); }
.badge-draft    { background: var(--sky); color: var(--steel); }
.badge-passed   { background: var(--pass-bg); color: var(--pass); }
.badge-failed   { background: var(--fail-bg); color: var(--fail); }
.badge-tabled   { background: var(--sky); color: var(--steel); }
.badge-minutes  { background: var(--sky); color: var(--steel); }
.badge-vote     { background: var(--accent-lt); color: var(--accent); }

/* ── Empty / loading states ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--mid);
}
.empty-state svg { margin-bottom: 1rem; opacity: .4; }
.empty-state p { font-size: .95rem; font-weight: 300; }

.loading-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--steel);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 3rem;
  color: var(--mid);
  font-size: .9rem;
}

/* ── Vote tally display ──────────────────────────────────────────────────── */
.vote-tally {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .4rem;
}
.tally-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}
.tally-yes    { background: var(--pass-bg); color: var(--pass); }
.tally-no     { background: var(--fail-bg); color: var(--fail); }
.tally-abstain{ background: var(--sky); color: var(--steel); }
.tally-absent { background: #f3f4f6; color: #6b7280; }

/* ── Castings grid ───────────────────────────────────────────────────────── */
.castings-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .75rem;
}
.casting-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .7rem;
  border-radius: var(--radius);
  font-size: .8rem;
  border: 1.5px solid transparent;
}
.casting-chip.yes     { background: var(--pass-bg); color: var(--pass); border-color: #86efac; }
.casting-chip.no      { background: var(--fail-bg); color: var(--fail); border-color: #fca5a5; }
.casting-chip.abstain { background: var(--sky); color: var(--steel); border-color: var(--border); }
.casting-chip.absent  { background: #f9fafb; color: #9ca3af; border-color: #e5e7eb; }
.casting-chip .dot    { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1.5px solid var(--border); margin: 1.5rem 0; }
.text-muted { color: var(--mid); font-weight: 300; }
.mono { font-family: var(--font-mono); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .header-inner { gap: .75rem; }
  .main-content { padding: 1.5rem 1rem 3rem; }
  .site-nav a   { padding: .3rem .5rem; font-size: .82rem; }
  .result-card  { flex-direction: column; gap: .75rem; }
  .result-card-actions { flex-direction: row; }
  .gate-box     { padding: 2rem 1.5rem; }
}
