/* ============================================================================
   LoneStarLower — content-page vocabulary (Task 4, P0.5)
   ----------------------------------------------------------------------------
   These patterns do not exist in the demo — it's a single-field app screen.
   The neighborhood template is 800+ words with tables, figures, and
   hierarchy (DESIGN_SYSTEM.md §6). Tokens only, same rule as components.css.

   NULL-STATE CONTRACT (DESIGN_SYSTEM.md §6, "does not exist yet" table +
   the rules immediately below it) — this is a template-authoring rule, not
   just a style, and it binds whatever templating engine P1a picks:

     1. A missing value REMOVES ITS COMPONENT ENTIRELY. Never render an empty
        stat, a dash, or "N/A" — it looks broken and gives an
        appraiser-skeptical homeowner a reason to distrust every other number
        on the page.
     2. A section with fewer than two populated stats does not render at all.
     3. The page must stay visually coherent at both extremes — the
        three-data-point minimum-viable page and the fully-populated maximum
        must both look deliberate, not like a template that broke. See
        shared/preview/ for both rendered side by side.
     4. This composes with seo/gates/check_data_density.py (built later, in
        P4) — a page falling below six data points is quarantined, not
        published thin. That gate doesn't exist yet; the contract here is
        what it will enforce against.

   None of the components below have a CSS "empty state" to style, on
   purpose — the correct empty state is DOM absence, so there is nothing to
   theme. What follows is only ever rendered with real data.
============================================================================ */

@import url("./tokens.css");

/* ---------------------------------------------------------------------------
   Stat callout — the workhorse of every neighborhood page. Large mono
   numeral, mono label, attribution attached (never a bare number).
--------------------------------------------------------------------------- */
.lsl-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0;
}
.lsl-stat {
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.lsl-stat--accent {
  background: var(--accent-soft);
  border-color: var(--brand-primary);
}
.lsl-stat__value {
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  font-size: var(--text-2xl);
  color: var(--ink-primary);
  letter-spacing: var(--tracking-tighter);
  line-height: 1;
}
.lsl-stat--accent .lsl-stat__value { color: var(--brand-primary); }
.lsl-stat__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-secondary);
  margin-top: var(--space-2);
  line-height: var(--leading-normal);
}
.lsl-stat__source {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin-top: var(--space-2);
}

/* ---------------------------------------------------------------------------
   Data table — comparison grids, value distributions. Degrades to stacked
   cards under 480px via the data-label pattern; NEVER horizontal scroll
   (DESIGN_SYSTEM.md §6). Works with plain HTML <table>, no JS.
--------------------------------------------------------------------------- */
.lsl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.lsl-table caption {
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin-bottom: var(--space-2);
}
.lsl-table th, .lsl-table td {
  padding: var(--space-2) var(--space-3);
  text-align: right;
  border-bottom: 1px solid var(--border-default);
}
.lsl-table th:first-child, .lsl-table td:first-child { text-align: left; }
.lsl-table thead th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--ink-muted);
  font-weight: var(--weight-regular);
  border-bottom: 2px solid var(--border-strong);
}
.lsl-table tbody tr:nth-child(even) { background: var(--surface-sunken); }
.lsl-table td.is-figure { font-family: var(--font-mono); font-weight: var(--weight-bold); }

@media (max-width: 480px) {
  .lsl-table thead { display: none; }
  .lsl-table, .lsl-table tbody, .lsl-table tr, .lsl-table td { display: block; width: 100%; }
  .lsl-table tr {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-raised);
  }
  .lsl-table tbody tr:nth-child(even) { background: var(--surface-raised); }
  .lsl-table td {
    display: flex;
    justify-content: space-between;
    text-align: right;
    border-bottom: 1px solid var(--border-default);
    padding: var(--space-2) 0;
  }
  .lsl-table td:last-child { border-bottom: none; }
  .lsl-table td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--ink-muted);
    text-align: left;
  }
}

/* ---------------------------------------------------------------------------
   Source attribution block — designed with presence, per §3: "Source: HCAD,
   data as of 12 Aug 2026" is simultaneously DTPA hygiene and the single
   strongest differentiator against competitors who show numbers with no
   provenance. Never inline grey 11px text under a table.
--------------------------------------------------------------------------- */
.lsl-attribution {
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-sunken);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--attribution-fg);
  margin: var(--space-4) 0;
}
.lsl-attribution__source { font-weight: var(--weight-bold); color: var(--ink-secondary); }
.lsl-attribution a { color: var(--brand-primary); }

/* ---------------------------------------------------------------------------
   Distribution display — value spread within a neighborhood. Inline SVG
   only, no charting library (a JS chart lib is a Core Web Vitals cost that
   can't be justified 250 times over — DESIGN_SYSTEM.md §6). The SVG markup
   itself is generated per-page by the export pipeline (P6, later); this is
   the CSS shell + a worked example in shared/preview/.
--------------------------------------------------------------------------- */
.lsl-distribution { margin: var(--space-4) 0; }
.lsl-distribution svg { width: 100%; height: auto; display: block; }
.lsl-distribution__track { stroke: var(--border-strong); stroke-width: 2; }
.lsl-distribution__range { stroke: var(--brand-primary); stroke-width: 4; stroke-linecap: round; }
.lsl-distribution__marker { fill: var(--ink-primary); }
.lsl-distribution__label {
  font: var(--weight-regular) 11px var(--font-mono);
  fill: var(--ink-muted);
}
.lsl-distribution__caption {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-muted);
  margin-top: var(--space-2);
}

/* ---------------------------------------------------------------------------
   FAQ block — native <details>, styled, no JS. Carries FAQPage JSON-LD
   (the JSON-LD <script> is a per-page companion, not styled here — see
   shared/preview/index.html for the worked pattern of question text
   matching the JSON-LD exactly, which schema validation requires).
--------------------------------------------------------------------------- */
.lsl-faq { margin: var(--space-5) 0; }
.lsl-faq__item {
  border-bottom: 1px solid var(--border-default);
}
.lsl-faq__item summary {
  padding: var(--space-3) 0;
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
}
.lsl-faq__item summary::-webkit-details-marker { display: none; }
.lsl-faq__item summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--brand-primary);
  font-size: var(--text-lg);
  flex-shrink: 0;
  transition: transform var(--motion-base) var(--motion-ease);
}
.lsl-faq__item[open] summary::after { transform: rotate(45deg); }
.lsl-faq__answer {
  padding: 0 0 var(--space-4);
  color: var(--ink-secondary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

/* ---------------------------------------------------------------------------
   Site chrome — page shell (added P1a). Not in DESIGN_SYSTEM.md §6's
   original table (stat/table/attribution/distribution/FAQ/prose) because
   that table was written before site/ existed as an actual project — every
   page site/ renders (root, guides, county hubs, neighborhood pages) needs
   a header/wordmark/footer, so this lives in the shared package rather
   than being invented once inline in one page and drifting from the next.
   Tokens only, same rule as everything else in this file.
--------------------------------------------------------------------------- */
.lsl-page {
  max-width: 72ch;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}
.lsl-site-header {
  margin-bottom: var(--space-6);
}
.lsl-wordmark {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  color: var(--ink-primary);
  text-decoration: none;
  letter-spacing: var(--tracking-tight);
}
.lsl-wordmark-accent {
  color: var(--brand-primary);
}
.lsl-hero {
  margin-bottom: var(--space-6);
}
.lsl-site-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-default);
}
