/* Green Home Rights — design system (§14)
   Palette: deep forest #18392B, evergreen #2F5D46, light sage #DCE8DD, warm paper #F7F4EC,
   white #FFFFFF, charcoal #202823, muted slate #5A6760, source blue #245C7A,
   warm gold #B88A3B, alert red #9B3B34, border #D3D9D4. WCAG 2.2 AA contrast required. */

:root {
  --forest: #18392B;
  --evergreen: #2F5D46;
  --sage: #DCE8DD;
  --paper: #F7F4EC;
  --white: #FFFFFF;
  --ink: #202823;
  --muted: #5A6760;
  --source: #245C7A;
  --gold: #8A6A2A;      /* dark enough for white text at AA (4.5:1) */
  --gold-soft: #B88A3B; /* decorative accents only */
  --alert: #9B3B34;
  --line: #D3D9D4;
  --radius: 12px;
  --max: 1200px;
  --article: 760px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}
h1, h2, h3, h4 { font-family: Georgia, "Source Serif 4", Cambria, "Times New Roman", serif; line-height: 1.15; color: var(--forest); }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -0.02em; margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 2.2rem 0 0.8rem; }
h3 { font-size: 1.22rem; margin: 1.6rem 0 0.5rem; }
p { margin: 0 0 1.1rem; }
a { color: var(--source); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
img { max-width: 100%; height: auto; }
ul, ol { margin: 0 0 1.1rem; }
li { margin-bottom: 0.35rem; }

.sr-only {
  position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden;
}
.skip {
  position: absolute; left: -9999px; top: 1rem; z-index: 20;
  background: var(--white); padding: 0.7rem 1rem; border: 2px solid var(--gold); border-radius: 8px;
}
.skip:focus { left: 1rem; }

.wrap { width: min(var(--max), calc(100% - 2rem)); margin-inline: auto; }
.article-col { max-width: var(--article); }

/* ---------- header ---------- */
.site-head { background: rgba(255, 253, 248, 0.97); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.nav { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding-block: 0.5rem; }
.brand { color: var(--forest); font-weight: 850; text-decoration: none; font-size: 1.1rem; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 1.2rem; }
.nav-links a { color: var(--muted); font-size: 0.95rem; font-weight: 650; text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--forest); text-decoration: underline; text-underline-offset: 0.3em; }
.nav-utils { display: flex; align-items: center; gap: 0.8rem; }
.search-form { display: flex; }
.search-input {
  width: 190px; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: 8px 0 0 8px;
  background: var(--white); font-size: 0.95rem;
}
.search-submit {
  padding: 0.45rem 0.8rem; border: 1px solid var(--evergreen); border-left: 0;
  border-radius: 0 8px 8px 0; background: var(--evergreen); color: var(--white); font-weight: 700; cursor: pointer;
}
.mobile-nav { display: none; }
.mobile-nav summary { cursor: pointer; border: 1px solid var(--line); border-radius: 8px; padding: 0.45rem 0.8rem; font-weight: 700; }
.mobile-menu { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.5rem 1rem 1rem; border-top: 1px solid var(--line); }
.mobile-menu a { padding: 0.55rem 0; color: var(--ink); text-decoration: none; font-weight: 650; border-bottom: 1px solid var(--line); min-height: 24px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: 0.7rem 1.15rem; border-radius: var(--radius); border: 0;
  background: var(--evergreen); color: var(--white); font-weight: 750; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--forest); }
.btn-small { min-height: 40px; padding: 0.5rem 0.9rem; font-size: 0.92rem; }
.btn-secondary { background: var(--white); color: var(--evergreen); border: 2px solid var(--evergreen); }
.btn-secondary:hover { background: var(--sage); }

/* ---------- breadcrumbs ---------- */
.crumbs { padding-top: 1rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; font-size: 0.9rem; }
.crumbs li + li::before { content: "›"; margin-right: 0.4rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--source); text-decoration: underline; }

/* ---------- hero ---------- */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 2.5rem; }
.hero .eyebrow { color: var(--evergreen); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; margin: 0 0 0.9rem; }
.hero h1 { max-width: 14ch; }
.hero .lede { font-size: 1.15rem; color: #405249; max-width: 60ch; }

/* ---------- sections ---------- */
.section { padding: clamp(2rem, 5vw, 4rem) 0; }
.section-alt { background: var(--white); border-block: 1px solid var(--line); }
.section h2 { margin-top: 0; }
.section-intro { color: var(--muted); max-width: 60ch; }

/* ---------- cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; margin-top: 1.4rem; }
.guide-card, .state-card, .topic-card, .tool-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.4rem;
}
.guide-card h3, .state-card h3, .topic-card h3 { margin: 0; font-size: 1.1rem; }
.guide-card h3 a, .state-card h3 a, .topic-card h3 a { color: var(--forest); text-decoration: none; }
.guide-card h3 a:hover { color: var(--source); text-decoration: underline; }
.card-answer { color: var(--muted); font-size: 0.97rem; margin: 0; }
.card-meta { color: var(--muted); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.9rem; margin: 0.4rem 0 0; }
.card-meta a { color: var(--muted); }
.changed-badge { color: var(--gold); font-weight: 750; }

/* ---------- trust strip ---------- */
.trust-strip { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem 1.8rem; margin: 0; padding: 1.1rem 1.2rem; background: var(--sage); border-radius: var(--radius); }
.trust-strip a { color: var(--forest); font-weight: 700; font-size: 0.92rem; }

/* ---------- guide page ---------- */
.page-head { padding: clamp(1.8rem, 4vw, 3rem) 0 0.4rem; }
.page-head .label { color: var(--evergreen); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.prose { max-width: var(--article); }
.prose p { margin-bottom: 1.15rem; }
.prose ul, .prose ol { max-width: var(--article); }
.prose a { text-decoration: underline; }
.direct-answer {
  background: var(--sage); border-left: 5px solid var(--evergreen); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.2rem 1.4rem; margin: 1.4rem 0;
}
.direct-answer p { margin: 0 0 0.6rem; font-size: 1.06rem; font-weight: 600; }
.da-meta { font-weight: 400 !important; font-size: 0.88rem !important; color: #3c5246; display: flex; flex-wrap: wrap; gap: 1rem; }
.scope-box {
  background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 1rem 1.3rem; margin: 0 0 1.6rem;
  font-size: 0.97rem; color: #3c443e;
}
.authority-stack { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin: 1.8rem 0; }
.authority-stack ol { margin: 0.6rem 0 0.4rem; padding-left: 1.4rem; }
.authority-stack .note { color: var(--muted); font-size: 0.88rem; margin: 0.6rem 0 0; }
.source-table-wrap { margin: 2rem 0; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.source-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 0.95rem; }
.source-table th, .source-table td { border: 1px solid var(--line); padding: 0.6rem 0.8rem; text-align: left; vertical-align: top; }
.source-table th { background: var(--forest); color: var(--white); font-weight: 700; }
.source-table tr:nth-child(even) td { background: #fbfaf5; }
.source-table a { word-break: break-word; }
.freshness-panel { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 0 var(--radius) var(--radius) 0; padding: 1rem 1.3rem; margin: 1.8rem 0; }
.freshness-panel .note { color: var(--muted); font-size: 0.88rem; }
.review-badge { background: var(--gold); color: var(--white); font-size: 0.8rem; font-weight: 750; padding: 0.25rem 0.7rem; border-radius: 999px; }
.changelog, .faq, .related { margin: 1.8rem 0; }
.faq details { border: 1px solid var(--line); border-radius: 8px; background: var(--white); margin-bottom: 0.6rem; padding: 0.4rem 0.9rem; }
.faq summary { cursor: pointer; font-weight: 700; color: var(--forest); padding: 0.4rem 0; }
.disclaimer-panel { background: #f6ecea; border-left: 4px solid var(--alert); border-radius: 0 var(--radius) var(--radius) 0; padding: 1rem 1.3rem; margin: 2rem 0; font-size: 0.95rem; }
.correction-link { margin: 1.4rem 0 0; font-size: 0.92rem; }
.related-list { columns: 2 280px; column-gap: 2rem; }
.related-list li { break-inside: avoid; }

/* ---------- alert banner ---------- */
.material-alert { background: #fbf3e3; border: 1px solid var(--gold); border-left: 5px solid var(--gold); border-radius: 0 var(--radius) var(--radius) 0; padding: 1rem 1.3rem; margin: 1.4rem 0; }
.material-alert h2 { margin: 0 0 0.4rem; font-size: 1.05rem; color: #6b511f; }

/* ---------- finder ---------- */
.finder { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; margin: 1.6rem 0; }
.finder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.finder label { display: block; font-weight: 700; font-size: 0.92rem; margin-bottom: 0.35rem; color: var(--forest); }
.finder select, .finder input[type="text"] { width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 0.97rem; }
.finder .btn { margin-top: 1.1rem; }
.finder-note { color: var(--muted); font-size: 0.85rem; margin: 0.8rem 0 0; }
.finder-results { margin-top: 1.2rem; }
.finder-results .guide-card { margin-bottom: 0.8rem; }

/* ---------- filter panel ---------- */
.filter-panel { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: end; margin: 1.2rem 0; }
.filter-panel label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.88rem; font-weight: 700; color: var(--forest); }
.filter-panel select { padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.active-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.8rem 0; font-size: 0.9rem; }
.active-filters .chip { background: var(--sage); border-radius: 999px; padding: 0.25rem 0.8rem; font-weight: 650; }
.active-filters .chip a { color: var(--forest); text-decoration: none; }
.filter-summary { color: var(--muted); font-size: 0.92rem; }
.empty-state { background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted); }
.empty-state a { font-weight: 700; }

/* ---------- tables (hubs) ---------- */
.matrix-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 0.92rem; }
.matrix-table th, .matrix-table td { border: 1px solid var(--line); padding: 0.5rem 0.7rem; text-align: left; vertical-align: top; }
.matrix-table th { background: var(--forest); color: var(--white); }
.matrix-table .cell-complete { background: #e7f0e9; }
.matrix-table .cell-review { background: #fbf3e3; }

/* ---------- forms ---------- */
.form-field { margin-bottom: 1.1rem; }
.form-field label { display: block; font-weight: 700; margin-bottom: 0.3rem; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; max-width: 560px; padding: 0.55rem 0.7rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--white); font: inherit;
}
.form-field .hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
.form-errors { background: #f6ecea; border: 1px solid var(--alert); border-radius: 8px; padding: 0.9rem 1.1rem; margin-bottom: 1.2rem; color: #6e2a25; }
.form-status { min-height: 1.5rem; font-weight: 700; margin-top: 0.8rem; }
.form-error { color: #8b211b; }
.trusted-form { margin-top: 1.8rem; padding: 1.3rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.trusted-form h2 { margin-top: 0; }
.trusted-form label span { font-weight: 400; color: var(--muted); }
.trusted-form button:disabled { opacity: .65; cursor: wait; }
.form-success { background: #e7f0e9; border: 1px solid var(--evergreen); border-radius: 8px; padding: 0.9rem 1.1rem; margin-bottom: 1.2rem; }
.field-error { border-color: var(--alert) !important; }
.error-text { color: var(--alert); font-size: 0.88rem; }

/* ---------- glossary ---------- */
.term-list { columns: 3 220px; column-gap: 2rem; }
.term-list li { break-inside: avoid; }
.term-def { margin-bottom: 1.6rem; }
.term-def h2 { margin-bottom: 0.3rem; }

/* ---------- tools ---------- */
.tool-shell { max-width: var(--article); }
.packet-summary, .checklist-output { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-top: 1.4rem; }
.packet-summary h2 { margin-top: 0; font-size: 1.3rem; }
.checklist-output ul { list-style: none; padding: 0; }
.checklist-output li { display: flex; gap: 0.7rem; align-items: baseline; padding: 0.35rem 0; border-bottom: 1px dashed var(--line); }
.source-dir .source-group { margin: 1rem 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.source-dir .source-group summary { cursor: pointer; padding: 0.8rem 1rem; color: var(--forest); font-weight: 750; }
.source-dir .source-table-wrap { margin: 0; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.source-dir .source-table-wrap:focus { outline: 3px solid var(--gold); outline-offset: -3px; }
.source-dir .source-table { min-width: 46rem; }
.source-dir table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 0.92rem; }
.source-dir th, .source-dir td { border: 1px solid var(--line); padding: 0.5rem 0.7rem; text-align: left; }
.directory-help { color: var(--muted); font-size: 0.92rem; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); background: var(--forest); color: #d9e4dd; margin-top: 3rem; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.6rem; padding: 2.2rem 0 1.4rem; }
.foot-grid strong { color: var(--white); font-size: 0.95rem; }
.foot-grid p { margin: 0.5rem 0 0; font-size: 0.9rem; }
.foot-grid a { color: #cfe0d6; display: inline-block; padding: 3px 0; }
.foot-grid a:focus-visible { outline-color: var(--gold); }
.foot-statement { border-top: 1px solid rgba(255, 255, 255, 0.15); padding: 1.2rem 0 1.6rem; font-size: 0.88rem; color: #b9c9bf; }

/* ---------- misc ---------- */
.notice { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 1.4rem 0; }
.notice h2 { margin-top: 0; }
.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-top: 1.4rem; }
.coverage-note { color: var(--muted); font-size: 0.88rem; }
.pagination { display: flex; gap: 0.5rem; margin-top: 1.4rem; }
.pagination a, .pagination span { padding: 0.4rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--white); text-decoration: none; }
.pagination span[aria-current="page"] { background: var(--evergreen); color: var(--white); border-color: var(--evergreen); }
.no-print { }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .mobile-nav { display: block; margin: 0 1rem 0.8rem; }
  .search-input { width: 130px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .nav { gap: 0.8rem; }
  .nav-utils { flex-wrap: wrap; }
  .nav-utils .btn-small { display: none; }
  .search-form { order: 3; width: 100%; }
  .search-input { flex: 1; width: auto; }
  .card-grid { grid-template-columns: 1fr; }
  .term-list { columns: 1; }
  .hero h1 { max-width: 12ch; }
  .related-list { columns: 1; }
}

/* ---------- print ---------- */
.honeypot{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden;opacity:0;pointer-events:none}
@media print {
  .site-head, .site-foot, .crumbs, .no-print, .print-controls, .finder, .filter-panel,
  .search-form, .mobile-nav, .correction-link { display: none !important; }
  body { background: var(--white); font-size: 12pt; }
  .wrap { width: 100%; }
  .direct-answer, .scope-box, .disclaimer-panel, .freshness-panel { break-inside: avoid; }
  a { color: var(--ink); text-decoration: none; }
  .source-table td a { word-break: break-all; }
}

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