/* HonestER — visual identity v2
   Display: Fraunces (warm, editorial serif — humanizes a clinical subject)
   Body/UI: Inter
   Signature motif: a pulse/heartbeat line used as a section divider and hero accent
   Palette: sage core + deep pine for contrast + warm bone background
*/

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sage: #6E8A5E;
  --sage-dark: #4F6B42;
  --pine: #22301C;
  --sage-light: #C7D1B9;
  --sage-wash: #EAF0E4;
  --bg: #FAF9F4;
  --white: #FFFFFF;
  --text: #22301C;
  --text-secondary: #5C6B53;
  --text-muted: #8A9280;
  --border: #E1E4D6;
  --amber-wash: #FBF3E4;
  --amber-text: #9C6B1F;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(34,48,28,0.06);
  --shadow-md: 0 8px 24px rgba(34,48,28,0.08);
  --shadow-lg: 0 20px 50px rgba(34,48,28,0.14);
  --font-display: 'Fraunces', Georgia, serif;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sage-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: 15px; }
:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ── Header ─────────────────────────────────────────────── */
header.site-header {
  background: rgba(250,249,244,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
header.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-family: var(--font-display); font-size: 23px; font-weight: 600; letter-spacing: -0.01em; color: var(--pine); }
.logo .er { color: var(--sage); }
nav.main-nav { display: flex; align-items: center; gap: 10px; }
nav.main-nav a.nav-link { font-size: 14px; color: var(--text-secondary); padding: 8px 12px; border-radius: 999px; font-weight: 500; }
nav.main-nav a.nav-link:hover { background: var(--sage-wash); text-decoration: none; color: var(--pine); }
.btn-report {
  background: var(--pine);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.btn-report:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none; background: var(--sage-dark); }

/* ── Disclaimer banner ──────────────────────────────────── */
.disclaimer-banner {
  background: var(--amber-wash);
  border-bottom: 1px solid #EFDFC0;
  color: var(--amber-text);
  font-size: 13px;
  padding: 10px 20px;
  text-align: center;
}
.disclaimer-banner strong { font-weight: 700; }
.disclaimer-banner a { color: var(--amber-text); text-decoration: underline; }

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 56px 0 28px;
  overflow: hidden;
}
.hero-pulse {
  display: block;
  width: 100%;
  max-width: 420px;
  height: 44px;
  margin: 4px 0 18px;
  opacity: 0.85;
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sage-dark);
  background: var(--sage-wash);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  color: var(--pine);
  max-width: 620px;
}
.hero p.lede {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 0 24px;
  line-height: 1.55;
}

/* ── Stats ──────────────────────────────────────────────── */
.stats-section { padding: 8px 0 40px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow-sm);
}
.stat-number {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--pine);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-label { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.stats-source { font-size: 11.5px; color: var(--text-muted); margin-top: 10px; text-align: right; }

.chart-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.chart-panel-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--pine); margin: 0 0 4px; }
.chart-panel-sub { font-size: 12.5px; color: var(--text-muted); margin: 0 0 14px; }

/* ── Section divider (signature pulse motif) ───────────────*/
.pulse-divider { display: block; width: 100%; height: 28px; margin: 8px 0 24px; opacity: 0.5; }

/* ── Buttons / inputs generic ───────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--sage-light);
  background: var(--white);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); background: var(--sage-dark); }
.btn.block { width: 100%; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.field input, .field select {
  width: 100%;
  height: 44px;
  border: 1.5px solid var(--sage-light);
  border-radius: var(--radius);
  padding: 0 14px;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px var(--sage-wash); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Custom time picker (AM/PM, not military time) */
.time-picker { display: grid; grid-template-columns: 1fr 1fr 74px; gap: 6px; }
.time-picker select { padding: 0 8px; text-align: center; }

/* ── Cards ──────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }

/* ── Home page ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1.5px solid var(--sage-light);
  border-radius: 999px;
  padding: 0 18px;
  height: 52px;
  margin: 0 0 20px;
  box-shadow: var(--shadow-sm);
}
.search-bar i { color: var(--sage); font-size: 18px; }
.search-bar input { border: none; outline: none; flex: 1; height: 100%; font-size: 15px; background: transparent; color: var(--text); }
#map { height: 320px; border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.section-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--pine); margin: 0 0 14px; }
.facility-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; }
.facility-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.facility-card:hover { border-color: var(--sage-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.facility-name { font-weight: 600; font-size: 15.5px; margin: 0 0 3px; color: var(--pine); }
.facility-meta { font-size: 12.5px; color: var(--text-secondary); margin: 0; }
.wait-badge { background: var(--sage-wash); color: var(--sage-dark); font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.wait-badge.long { background: var(--pine); color: #fff; }
.wait-sub { font-size: 11px; color: var(--text-muted); text-align: right; margin-top: 4px; }

/* ── Report form ────────────────────────────────────────── */
.form-shell { max-width: 580px; margin: 32px auto; }
.form-shell h1.page-title { font-family: var(--font-display); font-size: 26px; color: var(--pine); margin: 0 0 4px; }
.privacy-note { font-size: 12.5px; color: var(--text-muted); text-align: center; margin-top: 16px; }
.stars { display: flex; gap: 6px; cursor: pointer; }
.stars i { font-size: 28px; color: var(--sage-light); transition: color 0.1s ease, transform 0.1s ease; }
.stars i.filled { color: #E3A63E; }
.stars i:hover { transform: scale(1.15); }
.staff-row { display: grid; grid-template-columns: 1fr 110px 28px; gap: 8px; align-items: center; margin-bottom: 10px; }
.staff-row .stars i { font-size: 20px; }
.add-staff-btn { font-size: 13.5px; color: var(--sage-dark); background: var(--sage-wash); border: none; border-radius: var(--radius); padding: 12px; width: 100%; cursor: pointer; font-weight: 600; }
.remove-staff { color: var(--text-muted); cursor: pointer; background: none; border: none; }
.error-text { color: #B8492E; font-size: 12.5px; margin-top: 6px; display: none; }
.error-text.show { display: block; }
#confirmation { display: none; text-align: center; padding: 48px 20px; }
#confirmation i { font-size: 44px; color: var(--sage); }

/* ── Facility detail ────────────────────────────────────── */
.facility-header { padding: 32px 0 8px; }
.facility-header h1 { font-family: var(--font-display); margin: 0 0 6px; font-size: 28px; color: var(--pine); }
.rating-summary { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 14px; }
.chart-card { margin: 16px 0; }
.staff-list-item { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.staff-list-item:last-child { border-bottom: none; }

/* ── About page ─────────────────────────────────────────── */
.about-content { max-width: 640px; margin: 32px auto; line-height: 1.7; }
.about-content h1 { font-family: var(--font-display); font-size: 30px; color: var(--pine); }
.about-content h2 { font-family: var(--font-display); font-size: 19px; margin-top: 30px; color: var(--pine); }

/* ── Emergency safety banner ────────────────────────────── */
.emergency-banner {
  background: #FDECEA;
  border: 1px solid #F3C6C0;
  color: #8A2E20;
  font-size: 13.5px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  margin: 0 0 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.emergency-banner i { font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.emergency-banner strong { font-weight: 700; }

/* ── Footer ─────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 22px 0 44px; font-size: 12.5px; color: var(--text-muted); text-align: center; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeUp 0.5s ease both; }

/* Scroll-reveal: JS toggles .in-view; starts hidden so it doesn't flash before JS runs */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* Animated heartbeat trace — the dash animates along the path continuously */
.hero-pulse path, .hero-pulse polyline {
  stroke-dasharray: 12 8;
  animation: dash 3.2s linear infinite;
}
@keyframes dash { to { stroke-dashoffset: -400; } }

/* Live indicator: a small pulsing dot next to freshly-reported wait times */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
  margin-right: 5px;
  position: relative;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--sage);
  opacity: 0.6;
  animation: livePulse 1.8s ease-out infinite;
}
@keyframes livePulse {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-pulse path, .hero-pulse polyline, .live-dot::after { animation: none; }
  .reveal { transition: none; opacity: 1; transform: none; }
}

/* Skeleton loading placeholders */
.skeleton { background: linear-gradient(90deg, var(--border) 25%, var(--sage-wash) 50%, var(--border) 75%); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 78px; margin-bottom: 10px; }
.skeleton-map { height: 320px; border-radius: var(--radius-lg); }

/* Share button */
.share-btn {
  background: none;
  border: 1px solid var(--sage-light);
  color: var(--sage-dark);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.share-btn:hover { background: var(--sage-wash); }

/* Homepage triage explainer */
.triage-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 16px 0 8px; }
.triage-step { text-align: center; padding: 4px; }
.triage-step i { font-size: 26px; color: var(--sage); margin-bottom: 8px; display: block; }
.triage-step p { font-size: 12.5px; color: var(--text-secondary); margin: 0; line-height: 1.4; }
.weekly-counter { text-align: center; font-size: 13px; color: var(--text-secondary); margin: 18px 0 4px; }
.weekly-counter strong { color: var(--pine); font-size: 15px; }

@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .triage-steps { grid-template-columns: 1fr; }
  nav.main-nav a.nav-link { display: none; }
}

/* ── Language toggle ────────────────────────────────────── */
.lang-toggle-btn {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sage-dark);
  background: var(--sage-wash);
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  letter-spacing: 0.03em;
}
.lang-toggle-btn:hover { background: var(--sage-light); }

/* ── Confidence tier dots ───────────────────────────────── */
.conf-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; position: relative; }
.conf-dot.dot-high { background: var(--sage); }
.conf-dot.dot-high::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--sage); opacity: 0.6; animation: livePulse 1.8s ease-out infinite; }
.conf-dot.dot-moderate { background: #C99A3E; }
.conf-dot.dot-limited { background: #C99A3E; opacity: 0.55; }
.conf-dot.dot-none { background: var(--text-muted); }
@media (prefers-reduced-motion: reduce) { .conf-dot.dot-high::after { animation: none; } }

/* ── Freshness badge ────────────────────────────────────── */
.freshness-badge {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.freshness-badge i { font-size: 12px; color: var(--sage); }

/* ── Province filter / browse ───────────────────────────── */
.province-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.province-chip {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}
.province-chip:hover { border-color: var(--sage-light); }
.province-chip.active { background: var(--pine); color: #fff; border-color: var(--pine); }
.province-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0 40px;
}
.province-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
  font-weight: 600;
  color: var(--pine);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.province-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.province-card .count { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); margin-top: 4px; }

/* ── Admin / moderation queue ───────────────────────────── */
.admin-login { max-width: 360px; margin: 60px auto; }
.mod-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.mod-item:last-child { border-bottom: none; }
.mod-actions { display: flex; gap: 8px; }
.mod-actions button { border: none; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.mod-approve { background: var(--sage-wash); color: var(--sage-dark); }
.mod-reject { background: #FBEAE4; color: #B8492E; }
