/* PublicLaws.org — mobile-first, SEO-friendly styles */

:root {
  --color-bg: #ffffff;
  --color-surface: #f7f9fc;
  --color-text: #1a202c;
  --color-muted: #4a5568;
  --color-primary: #0f2b46;
  --color-primary-light: #1a4574;
  --color-accent: #d97706;
  --color-accent-hover: #b45309;
  --color-border: #e2e8f0;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-heading: Georgia, 'Times New Roman', 'Nimbus Roman', serif;
  --font-heading: 'Merriweather', Georgia, serif;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --max-width: 1100px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  font-size: 16px;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.25;
  margin: 1.5rem 0 0.75rem;
  color: var(--color-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

a {
  color: var(--color-primary-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover { color: var(--color-accent); }

p { margin: 0 0 1rem; }

img { max-width: 100%; height: auto; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus { top: 0; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #1a4574; outline-offset: 2px; }
.site-header a:focus-visible, .hero a:focus-visible { outline-color: #fbbf24; }

/* Header */
.site-header {
  background: var(--color-primary);
  color: #fff;
  border-bottom: 4px solid var(--color-accent);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
}

.brand:hover { color: #fff; }

.brand-logo {
  height: 2.5rem;
  width: auto;
  border-radius: 0;
  object-fit: contain;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--color-accent);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.section-pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border, #e2e8f0);
}
.section-pagination a {
  color: var(--color-primary, #0f2b46);
  font-weight: 600;
  text-decoration: none;
}
.section-pagination a:hover { text-decoration: underline; }
.main-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
}

.main-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  display: inline-block;
  padding: 0.5rem 0.25rem;
}

.main-nav a:hover { text-decoration: underline; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; align-items: center; }
.site-header nav a { color: #fff; text-decoration: none; font-weight: 500; font-size: 0.95rem; display: inline-block; padding: 0.5rem 0.25rem; }
.site-header nav a:hover { text-decoration: underline; }

.header-search {
  display: flex;
  gap: 0.25rem;
}

.header-search input {
  padding: 0.4rem 0.6rem;
  border: none;
  border-radius: var(--radius) 0 0 var(--radius);
  min-width: 160px;
}

.header-search button {
  background: #9a3412; /* darkened amber: 5.7:1 on white for AAA-adjacent contrast */
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  font-weight: 600;
}

.header-search button:hover { background: #7c2d12; }

/* Search page form (main input) */
article form[role="search"] {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}
article form[role="search"] input[type="search"] {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  line-height: 1.4;
  color: #1a1a1a;
  background: #fff;
  border: 2px solid var(--color-primary-light);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
article form[role="search"] input[type="search"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}
article form[role="search"] button {
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
}

/* Search results */
#search-results ul.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#search-results .card {
  margin-bottom: 0.75rem;
}
#search-results p {
  color: #555;
}

/* Breadcrumb */
.breadcrumb {
  background: var(--color-surface);
  padding: 0.75rem 1rem;
  margin: 0;
  list-style: none;
  font-size: 0.9rem;
}

.breadcrumb ol, nav.breadcrumb ol { list-style: none; margin: 0; padding: 0; }
.breadcrumb li { display: inline; }
.breadcrumb li:not(:last-child)::after {
  content: '›';
  margin: 0 0.5rem;
  color: var(--color-muted);
}

.breadcrumb a { color: var(--color-muted); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* Main */
main {
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  min-height: 60vh;
}

.disclaimer {
  background: #fffbeb;
  border-left: 4px solid var(--color-accent);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #78350f;
  margin-bottom: 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  padding: 2.5rem 1rem;
  margin: 0 -1rem 2rem;
  border-radius: 0 0 var(--radius) var(--radius);
}

.hero-content { max-width: var(--max-width); margin: 0 auto; }

.hero h1 {
  color: #fff;
  margin-top: 0;
  font-size: 2.25rem;
}

.hero .lead {
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
  max-width: 700px;
  color: #e8eef5;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: var(--color-primary-light);
  color: #fff;
}
.btn:hover { background: var(--color-primary); color: #fff; }

.btn-primary {
  background: #9a3412; /* darkened amber: 5.7:1 on white */
  color: #fff;
}

.btn-primary:hover { background: #7c2d12; color: #fff; }

.btn-secondary {
  background: var(--color-primary-light);
  color: #fff;
}

.btn-secondary:hover { background: var(--color-primary); color: #fff; }

/* Cards */
.card-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 1rem 0;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.08); }

.card a {
  display: block;
  padding: 1rem;
  color: inherit;
  text-decoration: none;
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--color-primary);
}

.card p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* CTA box */
.cta-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 2rem 0;
}

.cta-box h2 { margin-top: 0; font-size: 1.25rem; }

/* FAQ */
.faq-section { margin: 2rem 0; }

.faq-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary h3 {
  display: inline;
  margin: 0;
  font-size: 1rem;
  color: var(--color-text);
  font-family: var(--font-body);
}
.faq-item summary::before { content: '+ '; color: var(--color-accent); font-weight: 700; }
.faq-item[open] summary::before { content: '\2212 '; }
.faq-item > h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--color-primary);
  font-family: var(--font-body);
}
.faq-item p { margin: 0; }

.faq-answer { margin-top: 0.75rem; }

/* Sources */
.sources {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.95rem;
}

/* Related section */
.related-section {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--color-surface);
  border-radius: var(--radius);
}

.related-section ul { columns: 2; }

/* Footer */
.site-footer {
  background: var(--color-primary);
  color: #cbd5e1;
  padding: 2rem 0 1rem;
  margin-top: 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.footer-grid strong { color: #fff; }

.footer-grid ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.footer-grid a { color: #cbd5e1; text-decoration: none; }
.footer-grid a:hover { color: #fff; text-decoration: underline; }

.footer-bottom {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.9rem;
}

/* Forms */
.contact-form label {
  display: block;
  margin: 0.75rem 0 0.25rem;
  font-weight: 600;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  max-width: 500px;
  padding: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
}

.contact-form button { margin-top: 1rem; }

/* Utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.lead { font-size: 1.15rem; color: var(--color-muted); }

/* Statute text */
.statute-text {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
  font-family: var(--font-heading);
  line-height: 1.7;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.statute-text h2 {
  font-size: 1.15rem;
  margin-top: 0;
}

.statute-text p {
  margin-bottom: 0.75rem;
}

.statute-text .note-body,
.statute-text .note-head {
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.statute-text table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1rem 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.statute-text th,
.statute-text td {
  border: 1px solid var(--color-border);
  padding: 0.5rem;
  text-align: left;
}

/* Mobile */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .main-nav ul { gap: 0.75rem; }
  .header-search { width: 100%; }
  .header-search input { flex: 1; }
  .hero h1 { font-size: 1.75rem; }
  h1 { font-size: 1.6rem; }
  .related-section ul { columns: 1; }
  .site-header nav, .main-nav ul { gap: 0.25rem 1rem; }
  .statute-text { padding: 1rem; }
  .hero { padding: 2rem 1rem; }
}

.affiliate-promo { background: var(--color-surface); border-top: 1px solid var(--color-border); padding: 2rem 0; margin-top: 2rem; }
.affiliate-promo h2 { margin-top: 0; font-size: 1.25rem; }
.affiliate-disclosure { margin-top: .5rem; opacity: .75; font-size: .85rem; }

/* Counts */
.count { color: #666; font-weight: 400; font-size: 0.9rem; }

/* Template classes emitted by build.js / worker (previously unstyled) */
.brand-text { font-weight: 700; }
.section { margin: 2rem 0; }
article.legislation { min-width: 0; }
.article-body { line-height: 1.7; overflow-x: auto; }
.statute-list { margin: 0.5rem 0 1.5rem; padding-left: 1.25rem; }
.statute-list li { margin-bottom: 0.35rem; }
.data-table { display: block; width: 100%; max-width: 100%; overflow-x: auto; margin: 1rem 0; font-size: 0.9rem; background: #fff; border-collapse: collapse; }
.data-table th, .data-table td { border: 1px solid var(--color-border); padding: 0.5rem; text-align: left; }
.data-table th { background: var(--color-surface); }
.footer-grid p { margin: 0.5rem 0 0; font-size: 0.95rem; }

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

/* Print: statute pages print cleanly */
@media print {
  .site-header, .site-footer, .affiliate-promo, .header-search, .breadcrumb, .related-section, .cta-box, .section-pagination, .skip-link { display: none !important; }
  body { font-size: 12pt; line-height: 1.5; color: #000; }
  main, .container { padding: 0; max-width: none; min-height: auto; }
  .hero { margin: 0 0 1rem; padding: 0; background: none; color: #000; }
  .hero h1, h1, h2, h3 { color: #000; }
  .hero .lead, .lead { color: #000; }
  .statute-text { background: none; border: 1px solid #999; padding: 0.5rem; }
  a { color: #000; }
  .sources a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}
.faq-item h3 { margin: 0 0 0.35rem; font-size: 1.05rem; color: var(--color-primary, #0f2b46); }
.faq-item p { margin: 0; color: #333; }
.count { color: #666; font-weight: 400; font-size: 0.9rem; }


/* Tool widget (calculators/estimators) */
.tool-widget { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem; margin: 1.5rem 0; }
.tool-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1rem 0 0; }
.tool-field { display: flex; flex-direction: column; gap: 0.25rem; }
.tool-field label { font-weight: 600; font-size: 0.95rem; }
.tool-field input, .tool-field select { padding: 0.55rem 0.7rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 1rem; background: #fff; width: 100%; }
.tool-field input:focus, .tool-field select:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18); }
.field-help { color: var(--color-muted); font-size: 0.8rem; }
.tool-output { margin-top: 1rem; padding: 1rem; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); }
.tool-total { font-size: 1.05rem; margin: 0 0 0.5rem; }
.tool-total strong { color: var(--color-primary); font-size: 1.35rem; }
.tool-output ul { margin: 0.5rem 0; padding-left: 1.2rem; }
.tool-output li { margin: 0.2rem 0; }
.tool-note { color: var(--color-muted); font-size: 0.85rem; margin: 0.75rem 0 0; }