/*
Theme Name: STR Law Map
Theme URI: https://strlawmap.com
Author: STR Law Map
Description: Custom block theme for STR Law Map — an authoritative civic-reference atlas of U.S. short-term-rental regulations. Place-Atlas homepage (geography is the spine: coverage stat band + US state-chip legend + browse-by-state tile hub) and a jurisdiction-dossier entry (records header, cited-and-dated chips, sticky verification rail). Data-table-driven, no external fonts or page builders. Warm-paper + atlas-blue palette, serif headings. Wave-2 layout rebuild.
Version: 2.1.0
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: strlawmap
*/

/* ==========================================================================
   STR Law Map — theme stylesheet (rebuild marker: slm-atlas-v2 / wave2)
   All design tokens live in theme.json; this file carries the components
   theme.json cannot express (badges, tables, hero motif, dark mode).
   Zero external requests.
   ========================================================================== */

:root {
  --slm-hero-band: #1d4e7a;
  --slm-hero-band-2: #163f66;
  --slm-verified-bg: #e6f2ea;
  --slm-verified-fg: #14663c;
  --slm-restricted-bg: #f6e7dc;
  --slm-restricted-fg: #8f4113;
  --slm-shadow: 0 1px 2px rgba(20, 41, 63, .06);
  --slm-shadow-hover: 0 8px 22px rgba(20, 41, 63, .12);
  --slm-radius: 10px;
}

/* ---- Base rhythm & readability --------------------------------------- */
body { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
:where(p, li) { max-width: 72ch; }
main :where(h2) { margin-top: 2.4rem; }
main :where(h3) { margin-top: 1.8rem; }

/* Accessible focus + tap targets (Trust checklist) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
.wp-block-search__input:focus-visible,
.wp-block-search__button:focus-visible {
  outline: 3px solid var(--wp--preset--color--teal);
  outline-offset: 2px;
  border-radius: 4px;
}
.wp-block-navigation a,
.wp-block-search__button,
.wp-block-button__link { min-height: 44px; display: inline-flex; align-items: center; }

/* ---- Header ----------------------------------------------------------- */
.slm-header { position: relative; z-index: 20; }
.slm-wordmark { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.slm-wordmark:hover { text-decoration: none; }
.slm-wordmark svg { flex: 0 0 auto; display: block; }
.slm-wordmark-text {
  font-family: var(--wp--preset--font-family--serif);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -.01em;
  color: var(--wp--preset--color--atlas-blue);
  line-height: 1;
}
.slm-wordmark-text b { color: var(--wp--preset--color--teal); font-weight: 700; }
.slm-header .wp-block-navigation { font-weight: 600; }
.slm-header .wp-block-search { margin: 0; }
.slm-header .wp-block-search__input {
  border: 1px solid var(--wp--preset--color--border);
  background: var(--wp--preset--color--surface);
  color: var(--wp--preset--color--ink);
  border-radius: 8px; padding: .5rem .7rem; font-size: .9rem; min-width: 12ch;
}
.slm-header .wp-block-search__button { border-radius: 8px; }

/* ---- Hero: the atlas coordinate grid (signature element) -------------- */
.slm-hero {
  position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.055) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.055) 0 1px, transparent 1px 46px),
    linear-gradient(160deg, var(--slm-hero-band) 0%, var(--slm-hero-band-2) 100%);
  color: #fff;
  overflow: hidden;
}
.slm-hero::after { /* corner meridian arc, subtle atlas cue */
  content: ""; position: absolute; right: -120px; top: -120px;
  width: 320px; height: 320px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 0 0 34px rgba(255,255,255,.05);
  pointer-events: none;
}
.slm-hero :where(h1, h2, p) { color: #fff; position: relative; }
.slm-hero .slm-hero-sub { color: #dbe6f1; }
.slm-hero .wp-block-search { max-width: 620px; margin-inline: auto; }
.slm-hero .wp-block-search__input {
  border: 1px solid rgba(255,255,255,.35);
  background: #fff; color: var(--wp--preset--color--ink);
  border-radius: 10px 0 0 10px; padding: 1rem 1.1rem; font-size: 1.06rem;
}
.slm-hero .wp-block-search__input::placeholder { color: #6a7683; font-family: var(--wp--preset--font-family--mono); font-size: .95rem; }
.slm-hero .wp-block-search__button {
  border-radius: 0 10px 10px 0; padding-inline: 1.3rem; font-size: 1.02rem;
  background: var(--wp--preset--color--teal);
}
.slm-hero .wp-block-search__button:hover { background: #0b626b; }

/* ---- Trust micro-stat bar (home) ------------------------------------- */
.slm-statbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--wp--preset--color--border); border: 1px solid var(--wp--preset--color--border);
  border-radius: var(--slm-radius); overflow: hidden; margin-top: -1.6rem; position: relative; z-index: 5;
  box-shadow: var(--slm-shadow); }
.slm-statbar > * { background: var(--wp--preset--color--surface); padding: 1.1rem 1.15rem; margin: 0; }
.slm-stat-num { font-family: var(--wp--preset--font-family--mono); font-weight: 700; font-size: 1.25rem;
  color: var(--wp--preset--color--atlas-blue); display: block; line-height: 1.1; }
.slm-stat-label { font-size: .82rem; color: var(--wp--preset--color--muted); display: block; margin-top: .25rem; }

/* ---- Cards (entry grid) ---------------------------------------------- */
.slm-card,
.wp-block-group.slm-card {
  background: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--preset--color--border);
  border-radius: var(--slm-radius);
  box-shadow: var(--slm-shadow);
  transition: box-shadow .16s ease, transform .16s ease;
}
.slm-card:hover { box-shadow: var(--slm-shadow-hover); transform: translateY(-2px); }

/* ---- Trust masthead (single) ----------------------------------------- */
.slm-masthead {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem;
  padding: .7rem 0; margin: .5rem 0 1.6rem;
  border-top: 1px solid var(--wp--preset--color--border);
  border-bottom: 1px solid var(--wp--preset--color--border);
  font-size: .88rem; color: var(--wp--preset--color--muted);
}
.slm-masthead strong { color: var(--wp--preset--color--ink); font-weight: 600; }
.slm-masthead .slm-mono, .slm-masthead time { font-family: var(--wp--preset--font-family--mono); color: var(--wp--preset--color--ink); }
.slm-masthead .slm-dot { color: var(--wp--preset--color--border); }

/* ---- Breadcrumbs ------------------------------------------------------ */
.slm-breadcrumbs { font-size: .84rem; color: var(--wp--preset--color--muted); }
.slm-breadcrumbs a { color: var(--wp--preset--color--teal); }

/* ---- Verdict / status badges (content-facing classes — DO NOT rename) - */
.slm-badge {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .18em .7em; border-radius: 999px;
  font-size: .78rem; font-weight: 700; line-height: 1.5; letter-spacing: .01em;
  font-family: var(--wp--preset--font-family--mono);
  vertical-align: middle;
}
.slm-badge::before { font-family: var(--wp--preset--font-family--sans); font-weight: 900; }
.slm-badge--verified, .slm-badge--yes { background: var(--slm-verified-bg); color: var(--slm-verified-fg); }
.slm-badge--restricted, .slm-badge--no { background: var(--slm-restricted-bg); color: var(--slm-restricted-fg); }
.slm-badge--verified::before, .slm-badge--yes::before { content: "\2713"; }      /* check */
.slm-badge--restricted::before, .slm-badge--no::before { content: "\2715"; }     /* cross */

/* ---- Data tables ------------------------------------------------------ */
/* Style both real table blocks AND bare <table> elements authored inside
   post content (city pages use raw tables), so every data grid gets the
   full civic-record treatment. */
.wp-block-table { overflow-x: auto; }
.wp-block-table table,
.entry-content table,
.wp-block-post-content table {
  border-collapse: collapse; width: 100%; background: var(--wp--preset--color--surface);
  font-size: .95rem; margin: 1.4rem 0;
}
.wp-block-table th, .wp-block-table td,
.entry-content th, .entry-content td,
.wp-block-post-content th, .wp-block-post-content td {
  padding: .7rem .9rem; border: 1px solid var(--wp--preset--color--border); vertical-align: top; text-align: left;
}
.wp-block-table thead th, .wp-block-table th[scope="col"],
.entry-content thead th, .wp-block-post-content thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--wp--preset--color--ink); color: #fff; font-weight: 700;
}
.wp-block-table tbody th,
.entry-content tbody th, .wp-block-post-content tbody th {
  background: var(--wp--preset--color--wash); color: var(--wp--preset--color--ink); font-weight: 600;
}
.wp-block-table.is-style-stripes tbody tr:nth-child(odd) td,
.entry-content tbody tr:nth-child(odd) td,
.wp-block-post-content tbody tr:nth-child(odd) td { background: var(--wp--preset--color--paper); }
/* First data column reads as the row label */
.entry-content tbody td:first-child,
.wp-block-post-content tbody td:first-child { font-weight: 600; color: var(--wp--preset--color--ink); }
.wp-block-table td :where(code) { background: none; }

/* ---- Sources section (styled, proud — top trust component) ----------- */
.slm-sources, .wp-block-list.slm-sources { }
h2#sources + *, h2:where([id*="source"]) { }
.slm-sources-block {
  background: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--preset--color--border);
  border-left: 4px solid var(--wp--preset--color--teal);
  border-radius: var(--slm-radius);
  padding: 1.1rem 1.3rem;
}
.slm-sources-block ol, .slm-sources-block ul { margin: 0; }
.slm-sources-block li { margin: .35rem 0; font-size: .92rem; }

/* ---- FAQ (details) ---------------------------------------------------- */
.wp-block-details {
  border: 1px solid var(--wp--preset--color--border);
  border-radius: 8px; padding: .3rem 1rem; background: var(--wp--preset--color--surface);
}
.wp-block-details + .wp-block-details { margin-top: .7rem; }
.wp-block-details summary { cursor: pointer; font-weight: 600; padding: .75rem 0; color: var(--wp--preset--color--atlas-blue); }
.wp-block-details[open] summary { border-bottom: 1px solid var(--wp--preset--color--border); margin-bottom: .5rem; }

/* ---- Disclaimer strip (YMYL) ----------------------------------------- */
.slm-disclaimer {
  font-size: .84rem; color: var(--wp--preset--color--muted);
  border-top: 1px solid var(--wp--preset--color--border);
  padding-top: 1rem; margin-top: 2.5rem;
}

/* ---- Footer ----------------------------------------------------------- */
.slm-footer { background: var(--wp--preset--color--ink) !important; color: #d8e0e8 !important; }
.slm-footer :where(p, li, a) { color: #d8e0e8; }
.slm-footer a { text-decoration: none; }
.slm-footer a:hover { text-decoration: underline; color: #fff; }
.slm-footer .slm-foot-title { font-family: var(--wp--preset--font-family--serif); font-weight: 700; font-size: 1.25rem; color: #fff; }
.slm-footer .slm-foot-head { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #9fb4c8; }
.slm-footer ul { list-style: none; padding-left: 0; }
.slm-footer li { margin: .3rem 0; }
.slm-foot-word svg circle,
.slm-foot-word svg path { stroke: #6fa0cc; }

/* ==========================================================================
   WAVE 2 — Place-Atlas homepage (geography is the spine) + jurisdiction
   dossier entry. Architecture-level components; palette/type unchanged.
   ========================================================================== */

/* ---- Homepage brand band (compact; search demoted to the header) ------ */
.slm-atlas-band { padding-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--60); }
.slm-atlas-band .slm-hero-sub code { background: rgba(255,255,255,.14); border-radius: 4px; padding: .06em .3em; }

/* ---- Coverage stat band ("N cities · N states · sourced · reviewed") --- */
.slm-coverage {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--wp--preset--color--border);
  border: 1px solid var(--wp--preset--color--border);
  border-radius: var(--slm-radius); overflow: hidden;
  box-shadow: var(--slm-shadow); margin-top: -1.7rem; position: relative; z-index: 5;
}
.slm-coverage > * { background: var(--wp--preset--color--surface); padding: 1.05rem 1.15rem; margin: 0; }
.slm-cov-num { font-family: var(--wp--preset--font-family--mono); font-weight: 700; font-size: 1.3rem;
  color: var(--wp--preset--color--atlas-blue); display: block; line-height: 1.1; }
.slm-cov-label { font-size: .8rem; color: var(--wp--preset--color--muted); display: block; margin-top: .28rem; }

/* ---- US coverage legend strip — the atlas motif (CSS state chips) ------ */
.slm-legend-label { font-size: .82rem; color: var(--wp--preset--color--muted); margin: 0 0 .5rem; }
.slm-statemap { display: flex; flex-wrap: wrap; gap: .32rem; align-items: center; }
.slm-statemap .slm-st, .slm-statemap a.slm-st {
  font-family: var(--wp--preset--font-family--mono); font-size: .72rem; font-weight: 700;
  letter-spacing: .03em; padding: .32em .5em; border-radius: 5px; line-height: 1;
  background: var(--wp--preset--color--wash); color: var(--wp--preset--color--muted);
  border: 1px solid var(--wp--preset--color--border); text-decoration: none;
}
.slm-statemap a.slm-st--on {
  background: var(--wp--preset--color--atlas-blue); color: #fff; border-color: var(--wp--preset--color--atlas-blue);
}
.slm-statemap a.slm-st--on:hover { background: var(--wp--preset--color--ink); text-decoration: none; }

/* ---- Browse-by-state tile grid (the geographic spine) ----------------- */
.slm-state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 1.25rem; }
.slm-state-tile {
  background: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--preset--color--border);
  border-top: 3px solid var(--wp--preset--color--atlas-blue);
  border-radius: var(--slm-radius); padding: 1rem 1.2rem 1.1rem;
  box-shadow: var(--slm-shadow); scroll-margin-top: 1.5rem;
}
.slm-state-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; }
.slm-state-name { font-family: var(--wp--preset--font-family--serif); font-weight: 700; font-size: 1.18rem;
  color: var(--wp--preset--color--atlas-blue); line-height: 1.15; }
.slm-state-abbr { font-family: var(--wp--preset--font-family--mono); font-size: .72rem; font-weight: 700;
  color: var(--wp--preset--color--muted); border: 1px solid var(--wp--preset--color--border);
  border-radius: 5px; padding: .18em .45em; flex: 0 0 auto; }
.slm-city-list { list-style: none; padding: 0; margin: 0; }
.slm-city-list li { margin: 0; }
.slm-city-link { display: flex; align-items: center; gap: .5rem; padding: .45rem 0;
  border-top: 1px solid var(--wp--preset--color--border); color: var(--wp--preset--color--ink);
  text-decoration: none; font-weight: 600; font-size: .98rem; }
.slm-city-list li:first-child .slm-city-link { border-top: 0; }
.slm-city-link::before { content: "\2713"; color: var(--wp--preset--color--verified); font-weight: 900; font-size: .82em; }
.slm-city-link:hover { color: var(--wp--preset--color--teal); text-decoration: none; }
.slm-city-link:hover .slm-city-name { text-decoration: underline; }

/* ---- Jurisdiction dossier (single entry) ------------------------------ */
.slm-dossier { border-bottom: 1px solid var(--wp--preset--color--border); padding-bottom: 1.1rem; margin-bottom: 1.7rem; }
.slm-dossier-eyebrow {
  font-family: var(--wp--preset--font-family--mono) !important; font-size: .74rem !important; font-weight: 700;
  text-transform: uppercase; letter-spacing: .11em; color: var(--wp--preset--color--teal); margin: 0 0 .35rem;
}
.slm-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .95rem; }
.slm-chip {
  display: inline-flex; align-items: center; gap: .35em;
  font-size: .8rem; padding: .32em .72em; border-radius: 999px; line-height: 1.5;
  background: var(--wp--preset--color--surface); border: 1px solid var(--wp--preset--color--border);
  color: var(--wp--preset--color--muted);
}
.slm-chip strong { color: var(--wp--preset--color--ink); font-weight: 600; }
.slm-chip.wp-block-post-terms a { color: var(--wp--preset--color--muted); text-decoration: none; }
.slm-chip--verified { background: var(--slm-verified-bg); color: var(--slm-verified-fg); border-color: transparent; }
.slm-chip--verified .slm-chip-date, .slm-chip--verified p { color: var(--slm-verified-fg); font-family: var(--wp--preset--font-family--mono); font-weight: 700; margin: 0; font-size: .8rem; }
.slm-chip--verified::before { content: "\2713"; font-weight: 900; }
.slm-chip--src::before { content: "\00A7"; font-weight: 700; color: var(--wp--preset--color--teal); }

.slm-dossier-layout { display: grid; grid-template-columns: minmax(0, 1fr) 258px; gap: 2.6rem; align-items: start; }
.slm-dossier-main { min-width: 0; }
.slm-rail { position: sticky; top: 1.5rem; align-self: start; }
.slm-rail-card {
  background: var(--wp--preset--color--surface); border: 1px solid var(--wp--preset--color--border);
  border-left: 3px solid var(--wp--preset--color--teal); border-radius: var(--slm-radius); padding: 1rem 1.1rem;
}
.slm-rail-card + .slm-rail-card { margin-top: 1rem; }
.slm-rail-head {
  font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--wp--preset--color--atlas-blue); margin: 0 0 .5rem; font-family: var(--wp--preset--font-family--sans);
}
.slm-rail-card p { font-size: .86rem; color: var(--wp--preset--color--muted); margin: .5rem 0 0; line-height: 1.55; }
.slm-rail-card p:first-of-type { margin-top: 0; }
.slm-rail-card p a { font-weight: 600; }

/* ---- Rules-at-a-glance card (dossier pattern for the content engine) --- */
.slm-glance { background: var(--wp--preset--color--surface); border: 1px solid var(--wp--preset--color--border);
  border-radius: var(--slm-radius); box-shadow: var(--slm-shadow); overflow: hidden; margin: 1.6rem 0; }
.slm-glance-head { background: var(--wp--preset--color--ink); color: #fff; font-weight: 700;
  font-family: var(--wp--preset--font-family--sans); font-size: .82rem; text-transform: uppercase;
  letter-spacing: .06em; padding: .6rem 1rem; }
.slm-glance-row { display: grid; grid-template-columns: 12rem 1fr; gap: .5rem 1rem;
  padding: .7rem 1rem; border-top: 1px solid var(--wp--preset--color--border); }
.slm-glance-row:nth-child(odd) { background: var(--wp--preset--color--paper); }
.slm-glance-key { font-weight: 600; color: var(--wp--preset--color--ink); }
.slm-glance-val { color: var(--wp--preset--color--ink); }
.slm-glance-val .slm-mono { font-family: var(--wp--preset--font-family--mono); }

/* ---- Micro-interactions ---------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 900px) {
  .slm-dossier-layout { grid-template-columns: 1fr; gap: 1.6rem; }
  .slm-rail { position: static; }
  .slm-coverage { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .slm-statbar { grid-template-columns: 1fr; }
  .slm-coverage { grid-template-columns: 1fr; }
  .slm-glance-row { grid-template-columns: 1fr; gap: .15rem .5rem; }
  .slm-hero .wp-block-search__input { border-radius: 10px 0 0 10px; }
  /* let wide data tables scroll horizontally on phones */
  .entry-content table,
  .wp-block-post-content table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ==========================================================================
   Dark mode — remap the token custom properties; hue kept, luminance lifted
   to AA. Hero + footer keep their own deep bands (set above / below).
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --wp--preset--color--paper: #0f1c28;
    --wp--preset--color--surface: #17293b;
    --wp--preset--color--ink: #e9eef3;
    --wp--preset--color--wash: #1e3245;
    --wp--preset--color--border: #2c435a;
    --wp--preset--color--atlas-blue: #7fb0dd;
    --wp--preset--color--teal: #46b9c4;
    --wp--preset--color--verified: #52c184;
    --wp--preset--color--restricted: #e39258;
    --wp--preset--color--muted: #a3b4c4;
    --slm-hero-band: #143a5c;
    --slm-hero-band-2: #0e2b45;
    --slm-verified-bg: #123324;
    --slm-verified-fg: #7ddaa6;
    --slm-restricted-bg: #3a2415;
    --slm-restricted-fg: #eaa877;
    --slm-shadow: 0 1px 2px rgba(0,0,0,.4);
    --slm-shadow-hover: 0 8px 22px rgba(0,0,0,.5);
  }
  .slm-footer { background: #0a1622 !important; }
  .wp-block-table thead th, .wp-block-table th[scope="col"] { background: #0a1622; }
  /* Wave-2: keep atlas-blue chips/tiles readable on dark (white text needs a deep bg) */
  .slm-statemap a.slm-st--on { background: #1d4e7a; border-color: #1d4e7a; }
  .slm-statemap a.slm-st--on:hover { background: #0a1622; }
  .slm-glance-head { background: #0a1622; }
  .slm-hero .wp-block-search__input { background: #0f1c28; color: var(--wp--preset--color--ink); border-color: rgba(255,255,255,.25); }
  .slm-hero .wp-block-search__input::placeholder { color: #8a97a4; }
}

/* Manual dark toggle parity (if a data-theme attr is ever set) */
:root[data-theme="dark"] { color-scheme: dark; }
