/* ============================================================
   Joel E. Bernardini — Colorado High Country Real Estate
   Shared stylesheet. Alpine evergreen + sunrise gold.
   ============================================================ */

:root {
  /* Type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.85rem, 0.8rem + 0.25vw, 0.95rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.05rem, 1rem + 0.45vw, 1.3rem);
  --text-xl: clamp(1.3rem, 1.1rem + 0.9vw, 1.85rem);
  --text-2xl: clamp(1.6rem, 1.25rem + 1.5vw, 2.4rem);
  --text-3xl: clamp(2rem, 1.2rem + 2.6vw, 3.1rem);

  /* Spacing */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem; --space-24: 6rem; --space-32: 8rem;

  /* Light theme — alpine */
  --color-bg: #f6f5f1;
  --color-surface: #fbfaf7;
  --color-surface-2: #ffffff;
  --color-surface-offset: #eceae3;
  --color-border: #d8d5cc;
  --color-divider: #e3e0d8;
  --color-text: #1c2620;
  --color-text-muted: #5a635c;
  --color-text-faint: #9aa19a;
  --color-text-inverse: #f6f5f1;

  --color-primary: #012169;        /* deep evergreen */
  --color-primary-hover: #011c56;
  --color-primary-active: #001238;
  --color-accent: #c5832b;         /* sunrise gold */
  --color-accent-hover: #a96d1f;

  --radius-sm: 0.375rem; --radius-md: 0.5rem; --radius-lg: 0.75rem; --radius-xl: 1rem; --radius-full: 9999px;
  --transition-interactive: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px rgba(28,38,32,.06);
  --shadow-md: 0 6px 20px rgba(28,38,32,.09);
  --shadow-lg: 0 18px 48px rgba(28,38,32,.14);

  --content-narrow: 680px;
  --content-default: 1000px;
  --content-wide: 1200px;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================================
   DARK THEME — single source of truth (tokens only).
   Header stays deep navy (hardcoded, same as light); surfaces + text invert.
   ============================================================ */
[data-theme='dark'] {
  --color-bg: #081426;
  --color-surface: #0d1d3a;
  --color-surface-2: #113054;
  --color-surface-offset: #12274d;
  --color-border: #2a3d63;
  --color-divider: #22345c;
  --color-text: #e9ecf2;
  --color-text-muted: #a9b4c8;
  --color-text-faint: #6f7d97;
  --color-text-inverse: #eef2f8;   /* LIGHT in dark mode — inverse text only ever sits on the navy/primary card, so keep it readable (fixes the testimonial .quote + data-table cells) */
  --color-primary: #4f8fe0;        /* visible blue for buttons/links on dark (header is hardcoded navy) */
  --color-primary-hover: #6aa0e8;
  --color-primary-active: #3f7ecf;
  --color-accent: #d9a24a;          /* brighter gold for contrast on dark cards */
  --color-accent-hover: #e6b25c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 20px rgba(0,0,0,.5);
  --shadow-lg: 0 18px 48px rgba(0,0,0,.6);
}

/* dark mode re-enabled — see [data-theme=dark] palette above */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: none; text-size-adjust: none;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; scroll-behavior: smooth; scroll-padding-top: 6rem;
}
body {
  min-height: 100dvh; line-height: 1.55; font-family: var(--font-body);
  font-size: var(--text-base); color: var(--color-text); background: var(--color-bg);
}
img, picture, svg { display: block; max-width: 100%; height: auto; }
h1,h2,h3,h4 { font-family: var(--font-display); text-wrap: balance; line-height: 1.12; font-weight: 600; letter-spacing: -0.01em; }
p, li { text-wrap: pretty; }
a { color: inherit; }
::selection { background: color-mix(in oklab, var(--color-primary) 25%, transparent); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
a, button { transition: color var(--transition-interactive), background var(--transition-interactive), border-color var(--transition-interactive), box-shadow var(--transition-interactive); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

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

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--content-default); margin-inline: auto; padding-inline: var(--space-6); }
.wrap--narrow { max-width: var(--content-narrow); }
.wrap--wide { max-width: var(--content-wide); }
section { padding-block: clamp(var(--space-8), 5vw, var(--space-16)); }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--color-divider);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-block: var(--space-3); }
/* The sticky bar needs more room than the 1000px body column, or the full nav
   collides with the logo/phone group (the nav + logo + phone need ~1030px). */
.header .wrap { max-width: var(--content-wide); }
.header__id { flex: none; }   /* logo + phone never shrink into the nav */
.brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--color-text); }
.brand svg { width: 34px; height: 34px; color: var(--color-primary); flex: none; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: var(--text-base); letter-spacing: -0.01em; line-height: 1.1; }
.brand__sub { font-size: var(--text-xs); color: var(--color-text-muted); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.header__nav { display: flex; align-items: center; gap: var(--space-4); }
.header__nav a { font-size: var(--text-sm); text-decoration: none; color: var(--color-text-muted); white-space: nowrap; }
.header__nav a:hover { color: var(--color-primary); }
.theme-toggle { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-full); border: 1px solid var(--color-border); color: var(--color-text-muted); }
.theme-toggle:hover { color: var(--color-primary); border-color: var(--color-primary); }
/* "Areas" dropdown (desktop) */
.nav-dropdown { position: relative; }
.nav-dropdown__btn { display: inline-flex; align-items: center; gap: 4px; font-family: inherit; font-size: var(--text-sm); color: var(--color-text-muted); background: none; border: none; padding: 0; cursor: pointer; white-space: nowrap; }
.nav-dropdown__btn:hover, .nav-dropdown__btn[aria-expanded="true"] { color: var(--color-primary); }
.nav-dropdown__menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 230px; flex-direction: column; gap: 2px; padding: var(--space-2); background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-md); box-shadow: var(--shadow-md); display: none; z-index: 51; }
.nav-dropdown:hover .nav-dropdown__menu, .nav-dropdown:focus-within .nav-dropdown__menu, .nav-dropdown.open .nav-dropdown__menu { display: flex; }
.nav-dropdown__menu a { display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--color-text); white-space: nowrap; }
.nav-dropdown__menu a:hover { background: var(--color-surface-offset); color: var(--color-primary); }
/* Header bar keeps its original sizing — exempt from the global type-scale tightening (stays "wide") */
.brand__name { font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem); }
.brand__sub { font-size: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem); }
.header__nav a, .nav-dropdown__btn, .nav-dropdown__menu a, .header__nav .btn { font-size: clamp(0.875rem, 0.8rem + 0.35vw, 1rem); }
/* Feedback button — site-wide floating CTA (injected by app.js) */
.feedback-fab { position: fixed; right: clamp(12px, 3vw, 24px); bottom: clamp(12px, 3vw, 24px); z-index: 60;
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: var(--radius-full);
  background: var(--color-primary); color: var(--color-text-inverse); font-size: var(--text-sm); font-weight: 600;
  text-decoration: none; box-shadow: var(--shadow-md); white-space: nowrap;
  transition: transform var(--transition-interactive), background var(--transition-interactive); }
.feedback-fab:hover { background: var(--color-primary-hover); transform: translateY(-1px); }
.feedback-fab span:first-child { font-size: 1.05em; }
/* Mobile nav — hamburger + dropdown injected by app.js (built from the nav links) */
.nav-toggle { display: none; }
.mobile-menu { display: none; }
@media (max-width: 1080px) {
  .brand__sub { display: none; }                 /* long franchise sub-line off the mobile bar */
  .nav-dropdown { display: none; }                /* desktop dropdown off; hamburger carries cloned area links */
  .header__nav { gap: var(--space-3); }
  .header__nav a:not(.btn) { display: none; }     /* originals hide; the menu carries clones */
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 11px; order: -1; color: var(--color-text);
  }
  .nav-toggle span { display: block; width: 100%; height: 2px; background: currentColor; border-radius: 2px;
    transition: transform var(--transition-interactive), opacity var(--transition-interactive); }
  .header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  .header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .mobile-menu {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 49;
    flex-direction: column;
    background: var(--color-surface); border-bottom: 1px solid var(--color-divider);
    box-shadow: var(--shadow-md); padding: var(--space-2);
    max-height: calc(100dvh - 64px); overflow-y: auto;   /* never taller than the screen; scrolls internally */
  }
  .header.nav-open .mobile-menu { display: flex; }
  .mobile-menu a {
    display: block; min-height: 44px; padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm); color: var(--color-text); text-decoration: none; border-radius: var(--radius-md);
  }
  .mobile-menu a:hover, .mobile-menu a:active { background: var(--color-surface-offset); color: var(--color-primary); }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; padding: var(--space-3) var(--space-5); border-radius: var(--radius-full); text-decoration: none; white-space: nowrap; }
.btn--primary { background: var(--color-primary); color: var(--color-text-inverse); }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--ghost { border: 1px solid var(--color-border); color: var(--color-text); }
.btn--ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn--accent { background: var(--color-accent); color: #1c1206; }
.btn--accent:hover { background: var(--color-accent-hover); }

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: clamp(var(--space-10), 7vw, var(--space-20)); overflow: hidden; }
.hero__eyebrow { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .12em; color: var(--color-accent); font-weight: 600; margin-bottom: var(--space-5); }
.hero h1 { font-size: var(--text-3xl); max-width: 18ch; margin-bottom: var(--space-4); }
.hero__lede { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 60ch; margin-bottom: var(--space-5); }
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.hero__bg { position: absolute; inset: 0; z-index: -1; opacity: .5; }

/* Full-bleed photo hero (opt-in: .hero--photo + an <img class="hero__photo"> first child) */
.hero--photo { overflow: hidden; }
.hero--photo .hero__photo { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.hero--photo::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(95deg, rgba(8,12,7,.72) 0%, rgba(8,12,7,.46) 42%, rgba(8,12,7,.08) 100%); }
.hero--photo .hero__eyebrow { color: #f0d49a; }
.hero--photo h1 { color: #fff; text-shadow: 0 1px 18px rgba(0,0,0,.35); }
.hero--photo .hero__lede { color: rgba(255,255,255,.92); text-shadow: 0 1px 12px rgba(0,0,0,.3); }
.hero--photo .btn--ghost { color: #fff; border-color: rgba(255,255,255,.5); }
@media (max-width: 640px) { .hero--photo::after { background: linear-gradient(180deg, rgba(8,12,7,.55) 0%, rgba(8,12,7,.70) 100%); } }

/* ---------- Generic ---------- */
.eyebrow { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .12em; color: var(--color-accent); font-weight: 700; }
.section-title { font-size: var(--text-2xl); margin-block: var(--space-2) var(--space-6); }
.lede { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 60ch; }
.prose > * + * { margin-top: var(--space-5); }
.prose p { max-width: 68ch; color: var(--color-text); }
.prose h2 { font-size: var(--text-xl); margin-top: var(--space-12); }
.prose h3 { font-size: var(--text-lg); margin-top: var(--space-8); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: var(--space-6); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-sm); }
.card h3 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.card__tag { font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-accent); }
.card p { color: var(--color-text-muted); font-size: var(--text-base); }
.card ul { list-style: none; margin-top: var(--space-3); display: grid; gap: var(--space-2); }
.card li { position: relative; padding-left: var(--space-5); font-size: var(--text-sm); color: var(--color-text-muted); }
.card li::before { content: ""; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 2px; background: var(--color-primary); transform: rotate(45deg); }

/* ---------- Testimonial ---------- */
.quote { background: var(--color-primary); color: var(--color-text-inverse); border-radius: var(--radius-xl); padding: clamp(var(--space-8), 5vw, var(--space-16)); position: relative; }
[data-theme='dark'] .quote { background: var(--color-surface-2); border: 1px solid var(--color-border); }
.quote blockquote { font-family: var(--font-display); font-size: var(--text-xl); line-height: 1.35; max-width: 38ch; }
/* full-testimonial variant: longer text reads better small + in body font, wider column */
.quote--full blockquote { font-family: var(--font-body); font-size: var(--text-base); line-height: 1.6; max-width: 62ch; }
.quote__mark { font-family: var(--font-display); font-size: 5rem; line-height: 0; opacity: .4; display: block; height: 2.2rem; }
.quote cite { display: block; margin-top: var(--space-6); font-style: normal; font-size: var(--text-sm); opacity: .85; }
.quote cite strong { display: block; font-size: var(--text-base); font-style: normal; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: var(--space-3); }
.faq details { background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: var(--radius-md); overflow: hidden; }
.faq summary { list-style: none; cursor: pointer; padding: var(--space-5) var(--space-6); font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; color: var(--color-accent); font-family: var(--font-body); transition: transform var(--transition-interactive); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 var(--space-6) var(--space-6); color: var(--color-text-muted); }
.faq details > div p { max-width: 70ch; }
.faq details > div p + p { margin-top: var(--space-3); }

/* ---------- CTA band ---------- */
.cta-band { background: var(--color-surface-offset); border-block: 1px solid var(--color-divider); text-align: center; }
.cta-band h2 { font-size: var(--text-2xl); margin-bottom: var(--space-4); }
.cta-band p { color: var(--color-text-muted); max-width: 50ch; margin: 0 auto var(--space-8); }

/* ---------- Footer ---------- */
.footer { background: var(--color-surface); border-top: 1px solid var(--color-divider); padding-block: var(--space-12); font-size: var(--text-sm); }
.footer__grid { display: flex; flex-wrap: wrap; gap: var(--space-8); justify-content: space-between; }
.footer a { color: var(--color-text-muted); text-decoration: none; }
.footer a:hover { color: var(--color-primary); }
.footer__legal { color: var(--color-text-faint); font-size: var(--text-xs); margin-top: var(--space-8); max-width: 80ch; }
.footer__links { display: grid; gap: var(--space-2); }

/* ---------- Comparison table ---------- */
.cmp { overflow-x: auto; border: 1px solid var(--color-divider); border-radius: var(--radius-lg); }
.cmp table { width: 100%; border-collapse: collapse; min-width: 640px; }
.cmp th, .cmp td { text-align: left; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-divider); font-size: var(--text-sm); vertical-align: top; }
.cmp th { background: var(--color-surface-offset); font-family: var(--font-display); font-size: var(--text-base); }
.cmp tr:last-child td { border-bottom: none; }
.cmp td:first-child { font-weight: 600; color: var(--color-text); }

/* ---------- Pills ---------- */
.pills { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-6); }
.pill { font-size: var(--text-xs); font-weight: 600; padding: var(--space-2) var(--space-4); border-radius: var(--radius-full); background: var(--color-surface-offset); border: 1px solid var(--color-divider); color: var(--color-text-muted); }

.meta-note { font-size: var(--text-xs); color: var(--color-text-faint); margin-top: var(--space-6); }

/* ============ Activity pillar pages ============ */
.act-hero{position:relative;padding-block:clamp(var(--space-12),9vw,var(--space-24))}
.act-toc{display:flex;flex-wrap:wrap;gap:var(--space-2);margin-top:var(--space-6)}
.act-toc a{font-size:var(--text-sm);font-weight:600;padding:var(--space-2) var(--space-4);border-radius:var(--radius-full);background:var(--color-surface);border:1px solid var(--color-border);color:var(--color-text);text-decoration:none}
.act-toc a:hover{border-color:var(--color-primary);color:var(--color-primary)}
.act-block{padding-block:clamp(var(--space-10),5vw,var(--space-16));border-top:1px solid var(--color-divider)}
.act-block h2{font-size:var(--text-2xl);margin-bottom:var(--space-3)}
.act-block .lede{margin-bottom:var(--space-6)}
.photo-slot{background:var(--color-surface-offset);border:1px dashed var(--color-border);border-radius:var(--radius-lg);aspect-ratio:16/9;display:grid;place-items:center;color:var(--color-text-faint);font-size:var(--text-sm);text-align:center;padding:var(--space-6);margin:var(--space-6) 0}
.photo-slot span{max-width:32ch}
.act-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:var(--space-4);margin-top:var(--space-6)}
.act-facts .f{background:var(--color-surface);border:1px solid var(--color-divider);border-radius:var(--radius-md);padding:var(--space-5)}
.act-facts .f h4{font-family:var(--font-display);font-size:var(--text-lg);margin-bottom:var(--space-2)}
.act-facts .f p{font-size:var(--text-sm);color:var(--color-text-muted)}
.act-facts .f .tag{font-size:var(--text-xs);font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--color-accent);display:block;margin-top:var(--space-2)}
.act-tip{background:var(--color-surface-offset);border-left:4px solid var(--color-accent);border-radius:var(--radius-md);padding:var(--space-5) var(--space-6);margin-top:var(--space-6);font-size:var(--text-base)}
.act-tip strong{font-family:var(--font-display)}
.act-cross{display:flex;flex-wrap:wrap;gap:var(--space-2);margin-top:var(--space-4)}
.act-cross a{font-size:var(--text-sm);font-weight:600;color:var(--color-primary);text-decoration:none;border-bottom:1px solid var(--color-accent)}

/* ============================================================
   .data-table — redesigned for the "data + read" pattern
   Drop-in replacement for the block in assets/style.css
   Tokens only, dark-mode automatic, mobile card pattern kept.
   ============================================================ */

.data-table-wrap { overflow-x: auto; margin-top: var(--space-5); -webkit-overflow-scrolling: touch; }

.data-table {
  width: 100%;
  table-layout: fixed;   /* columns respect widths; long prose wraps, never widens the table */
  border-collapse: collapse;  /* collapse so percentage widths + padding don't overflow */
  font-size: var(--text-sm);
  text-align: left;
  line-height: 1.5;
}
/* Column sizing: first (area) wider; data columns share the rest. */
.data-table col.col-area { width: 19%; }
.data-table col.col-data { width: 19.9%; }

.data-table caption {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

/* Header */
.data-table thead th {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: 600;
  padding: .7rem .9rem;
  vertical-align: bottom;
  white-space: nowrap;
}
.data-table thead th:first-child { border-top-left-radius: var(--radius-md); }
.data-table thead th:last-child  { border-top-right-radius: var(--radius-md); }
/* numeric headers align right to match cells */
.data-table thead th.num { text-align: right; }

/* Data cells */
.data-table tbody td {
  padding: .65rem .9rem;
  vertical-align: top;
}
.data-table tbody td:first-child {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
/* numeric / short-data columns never wrap */
.data-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* descriptive "number" columns (e.g. "~$2.09M home · ~$863K condo") may wrap */
.data-table .num--wrap { white-space: normal; }

/* --- The "data row" for each town: tight, scannable, no bottom border
       because the read-row sits directly beneath it --- */
.data-table tr.data-row td { border-bottom: 0; padding-bottom: var(--space-2); }

/* --- The "read" row: full-width prose under each town ---
   The cell spans all columns. To stop a long single line from pushing
   the table wider than its container, the prose is constrained by an
   inner block (.read-inner) rather than a fragile max-width:0 hack. */
.data-table tr.read-row td {
  padding: 0 1.25rem .85rem .9rem;  /* extra right padding so prose never kisses the edge */
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.55;
  white-space: normal !important;   /* ensure prose wraps (override any inherited nowrap) */
  word-break: normal;
  overflow-wrap: break-word;        /* wrap long lines inside the cell */
}
.data-table tr.read-row .read-inner {
  display: inline;
}
/* Bound the read text block to the cell width so the longest line
   wraps exactly at the table edge (kills sub-pixel overflow). */
.data-table tr.read-row td > * { max-width: 100%; }
.data-table tr.read-row .read-label {
  display: inline-block;
  font-weight: 600;
  color: var(--color-accent);
  font-size: var(--text-xs);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-right: .5rem;
}

/* Zebra striping applied to the town "group" (data-row + read-row pair) */
.data-table tbody tr.data-row:nth-of-type(odd) td,
.data-table tbody tr.data-row:nth-of-type(odd) + tr.read-row td {
  background: var(--color-surface-offset);
}
/* hover the whole group */
.data-table tbody tr.data-row:hover td,
.data-table tbody tr.data-row:hover + tr.read-row td {
  background: var(--color-surface-2);
}

/* Rounded corners on the true first/last visual rows */
.data-table tbody tr.data-row:first-of-type td:first-child { /* nothing; header owns top */ }
.data-table tbody tr.read-row:last-of-type td:first-child { border-bottom-left-radius: var(--radius-md); }
.data-table tbody tr.read-row:last-of-type td:last-child  { border-bottom-right-radius: var(--radius-md); }
.data-table tbody tr.read-row:last-of-type td { border-bottom: 0; }

/* Outer hairline frame so the table reads as one unit */
.data-table { box-shadow: 0 0 0 1px var(--color-border); border-radius: var(--radius-md); overflow: hidden; }

/* ============================================================
   Simple numeric-only tables (e.g. first-time-buyer limits)
   keep the classic single-row look — no data-row/read-row classes.
   ============================================================ */
.data-table tr:not(.data-row):not(.read-row) td {
  border-bottom: 1px solid var(--color-divider);
}
.data-table tbody tr:not(.data-row):not(.read-row):nth-child(even) td {
  background: var(--color-surface-offset);
}

/* ============================================================
   Mobile: row-as-card. Each town = one card combining its data
   cells (label : value) and the read prose block.
   ============================================================ */
@media (max-width: 640px) {
  .data-table-wrap { overflow: visible; }
  .data-table { box-shadow: none; }
  .data-table caption { font-size: var(--text-base); }
  .data-table thead {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
  }
  .data-table, .data-table tbody { display: block; width: 100%; }

  /* The town data-row becomes the card head + the body of label:value rows */
  .data-table tr.data-row {
    display: block;
    border: 1px solid var(--color-divider);
    border-bottom: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    overflow: hidden;
    margin-top: var(--space-4);
  }
  .data-table tr.read-row {
    display: block;
    border: 1px solid var(--color-divider);
    border-top: 0;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
  }
  .data-table tr.data-row td,
  .data-table tr.read-row td {
    background: transparent !important;
    border-bottom: 1px solid var(--color-divider);
  }
  .data-table tr.data-row td {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: var(--space-4); padding: .55rem .85rem; text-align: right;
  }
  .data-table tr.data-row td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--color-text-muted);
    text-align: left; flex: 0 0 auto;
  }
  /* town name = card header */
  .data-table tr.data-row td:first-child {
    background: var(--color-primary) !important;
    color: var(--color-text-inverse);
    font-size: var(--text-base);
    justify-content: flex-start;
  }
  .data-table tr.data-row td:first-child::before { content: none; }
  .data-table tr.data-row td:last-child { border-bottom: 0; }

  /* read block = full-width footer of the card */
  .data-table tr.read-row td {
    display: block; padding: .7rem .85rem; text-align: left;
    border-bottom: 0; max-width: none;
  }
  .data-table tr.read-row .read-label { display: block; margin-bottom: .2rem; }

  /* simple numeric tables on mobile keep the original card behavior */
  .data-table tr:not(.data-row):not(.read-row) {
    display: block; margin-bottom: var(--space-4);
    border: 1px solid var(--color-divider); border-radius: var(--radius-md); overflow: hidden;
  }
  .data-table tr:not(.data-row):not(.read-row) td {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: var(--space-4); padding: .55rem .85rem; text-align: right;
    background: transparent !important;
  }
  .data-table tr:not(.data-row):not(.read-row) td::before {
    content: attr(data-label); font-weight: 600; color: var(--color-text-muted);
    text-align: left; flex: 0 0 auto;
  }
  .data-table tr:not(.data-row):not(.read-row) td:first-child {
    background: var(--color-primary) !important; color: var(--color-text-inverse);
    font-size: var(--text-base); justify-content: flex-start;
  }
  .data-table tr:not(.data-row):not(.read-row) td:first-child::before { content: none; }
  .data-table tr:not(.data-row):not(.read-row) td:last-child { border-bottom: 0; }
}

/* Operator preference: center-align all column content (desktop view only;
   mobile ≤640px keeps the label:value card layout). */
@media (min-width: 641px) {
  .data-table thead th,
  .data-table .num,
  .data-table tbody td,
  .data-table tbody td:first-child,
  .data-table tr.read-row td { text-align: center; }
}

/* Operator: left-align the first (county/area/program) column only — desktop.
   Read rows and all other data cells stay centered. */
@media (min-width: 641px) {
  .data-table thead th:first-child,
  .data-table tr.data-row td:first-child,
  .data-table tr:not(.data-row):not(.read-row) td:first-child { text-align: left; }
}

/* Operator: left-align the "Typical rent" column (rent-vs-buy tables) — desktop. */
@media (min-width: 641px) {
  .data-table td[data-label="Typical rent"],
  .data-table th.th-rent { text-align: left; }
}

/* Operator: headers must match their column alignment (beats Perplexity's thead th.num=right).
   Numeric headers center with their columns; the Typical rent header goes left with its column. */
@media (min-width: 641px) {
  .data-table thead th.num { text-align: center; }
  .data-table thead th.th-rent { text-align: left; }
}

/* Operator: left-align Typical price + Price-to-rent columns (cells + headers) — desktop. */
@media (min-width: 641px) {
  .data-table td[data-label="Typical price"],
  .data-table td[data-label="Rent or buy?"],
  .data-table thead th.th-left { text-align: left; }
}

/* Operator: "The read" label = top line; prose = line 2 (cell stays centered). */
.data-table tr.read-row .read-label { display: block; margin-right: 0; margin-bottom: .25rem; }

/* Operator: shade the read cell green at ~50% of the header's forest (overrides zebra).
   Text -> --color-text so prose stays readable on the tint (works light + dark via tokens). */
.data-table tr.read-row td {
  background: color-mix(in oklab, var(--color-primary) 50%, var(--color-bg)) !important;
  color: var(--color-text);
}

/* Operator: "The read" label slightly larger + darker gold for legibility on the green tint. */
.data-table tr.read-row .read-label { color: var(--color-accent-hover); font-size: var(--text-sm); }

/* Linked pills (towns feature chips that point to a page) get a clickable affordance. */
a.pill { text-decoration: none; cursor: pointer; }
a.pill:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-surface-2); }


/* ---- Lead capture form (injected by app.js on every page) ---- */
.lead-note{background:var(--color-surface-offset);border-top:1px solid var(--color-border);padding:3rem 0}
.lead-card{max-width:var(--content-narrow);margin:0 auto;padding:0 1.5rem}
.lead-card h2{font-family:var(--font-display);color:var(--color-primary);margin-bottom:.4rem}
.lead-card > p{color:var(--color-text-muted);margin-bottom:1.2rem;font-size:var(--text-base)}
.lead-card a{color:var(--color-accent)}
.lead-form{display:flex;flex-direction:column;gap:.7rem}
.lead-row{display:flex;gap:.7rem}
.lead-row input{flex:1;min-width:0}
.lead-form input,.lead-form textarea{width:100%;background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-md);padding:.7rem .85rem;font-family:var(--font-body);font-size:var(--text-base);color:var(--color-text)}
.lead-form input:focus,.lead-form textarea:focus{outline:none;border-color:var(--color-primary)}
.lead-form .lead-hp{position:absolute!important;left:-9999px;width:1px;height:1px;opacity:0}
.lead-form button{align-self:flex-start;margin-top:.2rem}
.lead-msg{color:var(--color-primary);font-size:var(--text-sm);min-height:1.2rem;margin:0}
@media(max-width:520px){.lead-row{flex-direction:column}}

/* Header: tuck the logo into the left gutter so name/company/phone go flush at the margin (wide screens only) */
/* (CB logo — no negative gutter needed) */

/* ===== CB brand: navy header + footer (Coldwell Banker Blue #012169 as surface) ===== */
.header { background: #012169; }
.header .brand__name { color: #ffffff !important; }
.header .brand__sub { color: rgba(255,255,255,.72) !important; }
.header .brand svg { color: #ffffff; }
.header__id a[href^="tel:"] { color: #ffffff !important; }
.header__nav > a { color: #ffffff; }
.header__nav > a:hover { color: #ffffff; }
.nav-dropdown__btn { color: #ffffff; }
.nav-dropdown__btn:hover, .nav-dropdown__btn[aria-expanded="true"] { color: #ffffff; }
.header .theme-toggle { border-color: rgba(255,255,255,.55); color: #ffffff; }
.header .theme-toggle:hover { color: #ffffff; border-color: #ffffff; }

.footer { background: #012169 !important; border-top: none !important; }
.footer, .footer p, .footer strong, .footer .brand { color: #ffffff !important; }
.footer .brand svg { color: #ffffff !important; }
.footer p, .footer__links a { color: rgba(255,255,255,.82) !important; }
.footer__legal { color: rgba(255,255,255,.58) !important; }
.footer__links a:hover { color: #ffffff !important; }

.header .nav-toggle { color: #ffffff; }

/* ===== CB tables: navy header row, white cells, light-blue grid ===== */
.cmp { border-color: #cfe0f5; }
.cmp th { background: #012169; color: #ffffff; }
.cmp th, .cmp td { border-bottom: 1px solid #d7e6f7; }
.cmp td { background: #ffffff; color: #243447; border-right: 1px solid #eef3fb; }
.cmp td:last-child { border-right: none; }
.cmp td:first-child { color: #012169; }

/* ===== CB framed info fields (navy border) ===== */
.md-stat { border: 1.5px solid #012169; }
.act-facts .f { border: 1.5px solid #012169; }

/* Dark header stays deep navy (the hardcoded .header background), so no override needed.
   Primary buttons use a light blue on dark — keep their label white. */
[data-theme='dark'] .btn--primary { color: #ffffff; }


/* ===== CB residential logo — white on navy header (light), blue on white header (dark) ===== */
.cb-logo{height:26px;width:auto;display:block}
.cb-logo--dark{display:none}  /* header is navy in both themes -> always the white logo */
.footer .cb-logo-footer{height:76px;width:auto;display:block;margin:0 auto .9rem}
@media(max-width:600px){.cb-logo{height:19px}}

/* warm walnut CTA */
.btn--walnut{background:#6f4a3a;border-color:#6f4a3a;color:#fff}
.btn--walnut:hover{background:#5a3b2e;border-color:#5a3b2e;color:#fff}

@media(max-width:560px){ .hdr-phone{display:none} }

/* Coldwell Banker light blue CTA */
.btn--cbblue{background:#418FDE;border-color:#418FDE;color:#fff}
.btn--cbblue:hover{background:#2f6fb8;border-color:#2f6fb8;color:#fff}

/* ---------- Email magnet (soft conversion: free buyer's guide) ---------- */
.magnet { background: var(--color-surface-offset); border-block: 1px solid var(--color-divider); }
.magnet .eyebrow { color: var(--color-accent); }
.magnet h2 { font-size: var(--text-2xl); margin: var(--space-3) 0 var(--space-3); max-width: 20ch; }
.magnet > .wrap > p { color: var(--color-text-muted); max-width: 60ch; margin-bottom: var(--space-5); }
.magnet-form { max-width: 34rem; }
.magnet-row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.magnet-row input[type=email] { flex: 1 1 15rem; min-width: 0; padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2); color: var(--color-text); font: inherit; font-size: var(--text-base); }
.magnet-row input[type=email]:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.magnet-row .btn { flex: 0 0 auto; white-space: nowrap; }
.lead-hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; opacity: 0; }
.magnet-msg { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); min-height: 1.2em; }
.magnet-fine { margin-top: var(--space-3); font-size: var(--text-xs); color: var(--color-text-faint); }
.magnet-done { margin-top: var(--space-3); }
.magnet-done a.btn { text-decoration: none; }
