/* SA-Acts — a registry, not a chat tool. Palette grounded in the subject:
   bottle-green + brass evoke a bound statute-book/ledger, not a generic
   dark-SaaS blue. Status colour is semantic and separate from the accent:
   green = in force, brass = amended, brick-red = repealed. */

:root {
  --ground: #f6f4ec;
  --surface: #ffffff;
  --surface-2: #eeece0;
  --line: #ddd9c8;
  --ink: #1b1f16;
  --ink-dim: #5c6152;
  --accent: #96762a;
  --accent-soft: #f1e9d3;
  --in-force: #2f7a4a;
  --in-force-soft: #e3f0e6;
  --repealed: #9c3a30;
  --repealed-soft: #f6e5e3;
  --amended: #96762a;
  --amended-soft: #f1e9d3;
  --shadow: 0 1px 2px rgba(30, 25, 10, 0.05), 0 6px 20px rgba(30, 25, 10, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #10130f;
    --surface: #171b15;
    --surface-2: #1f251c;
    --line: #2b3226;
    --ink: #e8e6dc;
    --ink-dim: #8c9184;
    --accent: #c9a44c;
    --accent-soft: #2a2416;
    --in-force: #4f9d69;
    --in-force-soft: #17281c;
    --repealed: #c96b60;
    --repealed-soft: #2c1a17;
    --amended: #c9a44c;
    --amended-soft: #2a2416;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  --ground: #10130f;
  --surface: #171b15;
  --surface-2: #1f251c;
  --line: #2b3226;
  --ink: #e8e6dc;
  --ink-dim: #8c9184;
  --accent: #c9a44c;
  --accent-soft: #2a2416;
  --in-force: #4f9d69;
  --in-force-soft: #17281c;
  --repealed: #c96b60;
  --repealed-soft: #2c1a17;
  --amended: #c9a44c;
  --amended-soft: #2a2416;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  padding-bottom: 28px;
}
.head__mark {
  font-family: "Spectral", Georgia, serif;
  font-weight: 600;
  font-style: italic;
  font-size: clamp(32px, 5vw, 46px);
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
.head__sub {
  color: var(--ink-dim);
  font-size: 13px;
  max-width: 46ch;
  line-height: 1.6;
}
.head__stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}
.stat { text-align: center; }
.stat b {
  display: block;
  font-family: "Spectral", serif;
  font-weight: 600;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.stat i {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ── Search ─────────────────────────────────────────────────────────── */
.search {
  position: relative;
  margin: 0 auto 8px;
  max-width: 640px;
}
.search input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 15px 18px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.search input:focus { border-color: var(--accent); }
.search__hint {
  text-align: center;
  font-size: 11px;
  color: var(--ink-dim);
  margin: 10px 0 0;
}
.search__hint code {
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10.5px;
}

/* ── Results ────────────────────────────────────────────────────────── */
.section-label {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 32px 0 12px;
}
.results { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.12s;
}
.card:hover { border-color: var(--accent); }
.card__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.card__title {
  font-family: "Spectral", serif;
  font-weight: 600;
  font-size: 16px;
  margin: 0;
}
.card__citation {
  font-size: 11.5px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.card__summary {
  font-size: 12.5px;
  color: var(--ink-dim);
  line-height: 1.6;
  margin: 8px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__provision {
  font-size: 12px;
  line-height: 1.6;
  margin: 8px 0 0;
  color: var(--ink);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  flex: none;
}
.pill--in-force { background: var(--in-force-soft); color: var(--in-force); }
.pill--repealed { background: var(--repealed-soft); color: var(--repealed); }
.pill--amended { background: var(--amended-soft); color: var(--amended); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.empty {
  text-align: center;
  color: var(--ink-dim);
  font-size: 12.5px;
  padding: 40px 0;
}

/* ── Act detail ─────────────────────────────────────────────────────── */
.detail__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-dim);
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
}
.detail__back:hover { color: var(--accent); }
.detail__head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.detail__title {
  font-family: "Spectral", serif;
  font-weight: 600;
  font-size: 26px;
  margin: 0;
  text-wrap: balance;
}
.detail__meta {
  font-size: 12px;
  color: var(--ink-dim);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.detail__summary {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 68ch;
}

.timeline {
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.timeline__item {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.timeline__item:last-child { border-bottom: none; }
.timeline__date {
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  flex: none;
  width: 90px;
}
.timeline__body { flex: 1; }
.timeline__body b { font-weight: 600; }

.provisions { display: flex; flex-direction: column; gap: 14px; }
.provision {
  border-left: 2px solid var(--line);
  padding-left: 14px;
}
.provision__ref {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.provision__title {
  font-family: "Spectral", serif;
  font-weight: 600;
  font-size: 14px;
  margin: 2px 0 6px;
}
.provision__content {
  font-size: 12.5px;
  line-height: 1.7;
}
/* Each logical line is its own block (app.js's formatProvisionText), not a
   \n inside one pre-wrap blob — padding-left on the block, not text-indent,
   is what makes a soft-wrapped continuation hang under its own marker
   instead of resetting to the margin. */
.provision__line {
  margin-bottom: 6px;
}
.provision__line:last-child {
  margin-bottom: 0;
}

.loading { text-align: center; color: var(--ink-dim); font-size: 12px; padding: 30px 0; }

footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--ink-dim);
  margin-top: 60px;
  line-height: 1.7;
}

@media (max-width: 560px) {
  .head__stats { gap: 14px; }
}
