/* ==========================================================================
   Real Estate Price Estimator — GitHub Pages theme
   Light, corporate palette shared with the Streamlit dashboard.
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --accent: #0ea5e9;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --surface: #ffffff;
  --background: #f8fafc;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas,
    monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--background);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.7rem; margin: 0 0 8px; }
h3 { font-size: 1.05rem; margin: 0 0 6px; }

code { font-family: var(--mono); font-size: 0.88em; }

/* --- Navigation ---------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { font-weight: 700; font-size: 1rem; }
.nav nav { display: flex; align-items: center; gap: 22px; }
.nav nav a { color: var(--muted); font-weight: 500; font-size: 0.92rem; }
.nav nav a:hover { color: var(--ink); text-decoration: none; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}
.btn-outline {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}
.btn-ghost { padding: 7px 14px; color: var(--ink) !important; border-color: var(--border); }

/* --- Hero ---------------------------------------------------------------- */
.hero {
  background: linear-gradient(120deg, #4f46e5 0%, #6366f1 45%, #0ea5e9 100%);
  color: #fff;
  padding: 72px 24px 84px;
}
.hero-inner { max-width: 900px; margin: 0 auto; text-align: center; }
.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.9;
  margin-bottom: 14px;
}
.hero h1 { font-size: 2.6rem; margin: 0 0 16px; }
.lede { font-size: 1.08rem; opacity: 0.94; max-width: 720px; margin: 0 auto 28px; }
.cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.cta-note { font-size: 0.82rem; opacity: 0.82; margin-top: 18px; }

/* --- KPI strip ----------------------------------------------------------- */
.kpis {
  max-width: 1160px;
  margin: -44px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.kpi-label {
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}
.kpi-value { font-size: 1.75rem; font-weight: 800; margin: 6px 0 2px; }
.kpi-sub { font-size: 0.78rem; color: var(--muted); }

/* --- Layout helpers ------------------------------------------------------ */
.features, .section {
  max-width: 1160px;
  margin: 0 auto;
  padding: 64px 24px 0;
}
.section-lede, .features > p { color: var(--muted); margin-top: 0; }

.grid { display: grid; gap: 18px; margin-top: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* --- Cards --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.card .icon { font-size: 1.5rem; margin-bottom: 8px; }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-top: 18px;
  overflow: hidden;
}
.chart { width: 100%; }
.muted { color: var(--muted); font-size: 0.86rem; margin: 0 0 6px; }

/* --- Table --------------------------------------------------------------- */
.table-wrap {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 20px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; width: 42%; }
tr:last-child th, tr:last-child td { border-bottom: none; }

/* --- Pills & code -------------------------------------------------------- */
.pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.pill {
  background: #eef2ff;
  color: var(--primary-dark);
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.84rem;
  font-weight: 600;
}
.code-card {
  margin-top: 24px;
  background: #0f172a;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.code-title {
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 20px;
  border-bottom: 1px solid #1e293b;
}
.code-card pre { margin: 0; padding: 20px; overflow-x: auto; }
.code-card code { color: #e2e8f0; font-size: 0.86rem; line-height: 1.7; }

/* --- Footer -------------------------------------------------------------- */
.footer {
  max-width: 1160px;
  margin: 72px auto 0;
  padding: 32px 24px 48px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}
.footer p { margin: 4px 0; }

/* --- App shell: pinned sidebar + main panel ------------------------------ */
.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 40px 24px 0;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.app-sidebar {
  position: sticky;
  top: 76px;
  flex: 0 0 280px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.sidebar-brand { font-weight: 700; font-size: 1.05rem; }
.sidebar-hint { font-size: 0.8rem; color: var(--muted); margin: 6px 0 4px; }
.app-sidebar label {
  display: block;
  margin: 16px 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.app-sidebar select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 0.95rem;
}
.app-sidebar select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.sidebar-links { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.btn-sidebar {
  display: block;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.88rem;
}
.btn-sidebar:hover { background: var(--background); text-decoration: none; }
.app-main { flex: 1; min-width: 0; }
.app-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.app-head h2 { margin: 0; font-size: 1.5rem; }
.app-head .muted { font-size: 0.85rem; }
.kpis-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.mini-kpi {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.mini-kpi span:first-child {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.mini-kpi strong { margin: 4px 0 2px; font-size: 1.35rem; color: var(--ink); }
.mini-kpi span:last-child { font-size: 0.74rem; color: var(--muted); }
.explorer-note { margin-top: 16px; font-size: 0.76rem; line-height: 1.5; color: var(--muted); }
.app-main .chart-card { margin-top: 0; margin-bottom: 16px; }
#healthWrap .kpis-row { grid-template-columns: repeat(3, 1fr); }

/* --- Education layer ----------------------------------------------------- */
.summary-card {
  background: linear-gradient(135deg, #eef2ff 0%, #e0f2fe 100%);
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.summary-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3730a3;
  font-weight: 700;
}
.summary-card p { margin: 8px 0 0; color: #1e1b4b; font-size: 0.94rem; line-height: 1.55; }
.temp-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}
.temp-hot { background: #fee2e2; color: #991b1b; }
.temp-warm { background: #fef3c7; color: #92400e; }
.temp-cool { background: #dbeafe; color: #1e40af; }
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 24px;
  margin-top: 8px;
}
.glossary-item { font-size: 0.85rem; color: var(--muted); }
.glossary-item strong { display: block; color: var(--ink); }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1024px) {
  .kpis-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .nav nav a:not(.btn) { display: none; }
  .app-shell { flex-direction: column; }
  .app-sidebar { position: static; width: 100%; flex: 1 1 auto; }
  .kpis-row { grid-template-columns: 1fr; }
  .glossary-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
  .hero { padding: 56px 20px 72px; }
}
