/* ============================================================
   legal-reader.css — AO3-styled law reader
   ============================================================ */

/* --- Reset & base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: #d4d4d4 transparent;
}

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d4d4d4;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: #aaa; }

body {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  color: #2a2a2a;
  background: #fafafa;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: #900; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Header --- */
.lr-header {
  background: #333;
  color: #fff;
  border-bottom: 4px solid #900;
  position: sticky;
  top: 0;
  z-index: 100;
}

.lr-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.lr-site-title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  white-space: nowrap;
  text-decoration: none;
}

.lr-site-title:hover {
  color: #ddd;
  text-decoration: none;
}

.lr-search-wrap {
  flex: 1;
  min-width: 180px;
  max-width: 400px;
}

.lr-search {
  width: 100%;
  padding: 6px 12px;
  border: 1px solid #555;
  border-radius: 3px;
  background: #444;
  color: #fff;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.875rem;
}

.lr-search::placeholder { color: #aaa; }
.lr-search:focus { outline: 2px solid #900; border-color: #900; }

.lr-stats {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.8rem;
  color: #bbb;
  white-space: nowrap;
}

/* --- Main layout --- */
.lr-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: calc(100vh - 120px);
}

/* --- Browse view --- */
.lr-browse {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  padding-top: 20px;
}

/* display:grid above beats the UA [hidden] rule — restate it */
.lr-browse[hidden] {
  display: none;
}

/* --- Sidebar --- */
.lr-sidebar {
  position: sticky;
  top: 70px;
  align-self: start;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.lr-filter-group {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #ddd;
}

.lr-filter-group:last-child { border-bottom: none; }

.lr-filter-heading {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 8px;
}

.lr-sort-select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
  background: #fff;
  color: #333;
}

.lr-filter-list {
  list-style: none;
}

.lr-filter-list li {
  margin-bottom: 4px;
}

.lr-filter-list label {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.lr-filter-list label:hover { color: #900; }

.lr-filter-count {
  color: #999;
  font-size: 0.8rem;
  margin-left: auto;
}

/* --- Tag cloud --- */
.lr-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.lr-tag-filter {
  display: inline-block;
  padding: 2px 8px;
  background: #e8e8e8;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.75rem;
  color: #555;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lr-tag-filter:hover {
  background: #ddd;
  color: #333;
}

.lr-tag-filter.active {
  background: #900;
  color: #fff;
  border-color: #900;
}

/* --- Results info --- */
.lr-results-info {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
  color: #666;
  padding-bottom: 12px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 16px;
}

/* --- Work blurbs (listing) --- */
.lr-work-blurb {
  padding: 16px 0;
  border-bottom: 1px solid #ddd;
}

.lr-work-blurb:last-child { border-bottom: none; }

.lr-blurb-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.lr-blurb-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #900;
  cursor: pointer;
  text-decoration: none;
}

.lr-blurb-title:hover { text-decoration: underline; }

.lr-jurisdiction-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 3px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  vertical-align: middle;
}

.lr-jurisdiction-badge.federal { background: #900; }
.lr-jurisdiction-badge.state { background: #234; }

.lr-blurb-date {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.8rem;
  color: #888;
}

.lr-blurb-tags {
  margin: 6px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.lr-blurb-tag {
  display: inline-block;
  padding: 1px 7px;
  background: #e8e8e8;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.75rem;
  color: #555;
  cursor: pointer;
  text-decoration: none;
}

.lr-blurb-tag:hover {
  background: #ddd;
  color: #333;
  text-decoration: none;
}

.lr-blurb-summary {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.5;
  margin: 6px 0;
}

.lr-blurb-meta {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.78rem;
  color: #888;
  display: flex;
  align-items: center;
  gap: 12px;
}

.lr-blurb-meta a { color: #900; }

.lr-blurb-status {
  display: inline-block;
  padding: 0 6px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.lr-blurb-status.in-force {
  background: #e6f4e6;
  color: #2a7a2a;
  border: 1px solid #b0d4b0;
}

.lr-blurb-status.repealed {
  background: #fde8e8;
  color: #a33;
  border: 1px solid #e0b0b0;
}

.lr-blurb-status.not_yet_in_force {
  background: #fdf3e0;
  color: #96690f;
  border: 1px solid #e3cb96;
}

/* --- Empty state --- */
.lr-empty {
  text-align: center;
  padding: 60px 20px;
  color: #888;
  font-size: 1rem;
}

/* --- Reader view --- */
.lr-reader-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 0;
}

.lr-reader-nav-top,
.lr-reader-nav-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.lr-reader-nav-bottom {
  margin-top: 24px;
  margin-bottom: 0;
  padding-top: 16px;
  border-top: 1px solid #ddd;
}

.lr-back-link {
  color: #900;
  font-weight: 500;
}

.lr-prev-next a {
  color: #900;
  margin-left: 16px;
}

/* --- Work detail (reader) --- */
.lr-work-header {
  border: 1px solid #ccc;
  background: #f4f4f4;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.lr-work-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #2a2a2a;
  line-height: 1.3;
  margin-bottom: 16px;
}

.lr-work-meta-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.lr-work-meta-table th {
  text-align: left;
  font-weight: 600;
  color: #555;
  padding: 4px 12px 4px 0;
  width: 120px;
  vertical-align: top;
  white-space: nowrap;
}

.lr-work-meta-table td {
  padding: 4px 0;
  color: #333;
}

.lr-work-meta-table a { color: #900; }

.lr-work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 12px 0;
}

.lr-work-tags a {
  display: inline-block;
  padding: 2px 8px;
  background: #e8e8e8;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.78rem;
  color: #555;
}

.lr-work-tags a:hover {
  background: #ddd;
  color: #333;
  text-decoration: none;
}

.lr-work-summary-box {
  border: 1px solid #ccc;
  background: #fff;
  padding: 12px 16px;
  margin-top: 12px;
}

.lr-work-summary-label {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 4px;
}

.lr-work-summary-text {
  font-size: 0.95rem;
  color: #333;
  line-height: 1.5;
}

/* --- Version history --- */
.lr-work-versions {
  border: 1px solid #ccc;
  background: #fff;
  padding: 12px 16px;
  margin-top: 12px;
}

.lr-work-versions-label {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 4px;
}

.lr-version-list {
  list-style: none;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
}

.lr-version-list li {
  padding: 2px 0;
}

.lr-version-link {
  color: #900;
}

.lr-version-link.active {
  color: #2a2a2a;
  font-weight: 600;
  text-decoration: none;
  cursor: default;
}

.lr-version-notice {
  border: 1px solid #d6c9a3;
  background: #faf6e9;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
  color: #555;
}

/* --- Work body (reading area) --- */
.lr-work-body {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px;
  line-height: 1.75;
  font-size: 1.05rem;
  color: #2a2a2a;
}

.lr-work-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 28px 0 12px;
  color: #333;
}

.lr-work-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 20px 0 8px;
  color: #444;
}

.lr-work-body p {
  margin: 12px 0;
}

.lr-work-body blockquote {
  border-left: 3px solid #900;
  padding: 8px 16px;
  margin: 16px 0;
  background: #f8f6f4;
  color: #444;
  font-style: italic;
}

.lr-work-body ol,
.lr-work-body ul {
  margin: 12px 0;
  padding-left: 28px;
}

.lr-work-body li {
  margin-bottom: 6px;
}

/* placeholder for when body text not yet loaded from .md */
.lr-work-body-placeholder {
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.9rem;
  border: 1px dashed #ccc;
  border-radius: 4px;
}

.lr-work-body-placeholder a { color: #900; }

/* --- Footer --- */
.lr-footer {
  max-width: 1200px;
  margin: 40px auto 0;
  padding: 16px 20px;
  border-top: 1px solid #ddd;
  text-align: center;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.8rem;
  color: #999;
}

.lr-footer p {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.lr-footer p + p {
  margin-top: 8px;
}

.lr-footer a { color: #a33; }

/* --- Mobile sidebar toggle --- */
.lr-sidebar-toggle {
  display: none;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #900;
  background: none;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 6px 12px;
  cursor: pointer;
  margin-bottom: 12px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .lr-header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  .lr-site-title { text-align: center; }

  .lr-search-wrap {
    max-width: 100%;
  }

  .lr-stats { text-align: center; }

  .lr-main { padding: 0 12px; }

  .lr-browse {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .lr-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    border-bottom: 1px solid #ddd;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .lr-sidebar.collapsed .lr-filter-group { display: none; }
  .lr-sidebar-toggle { display: block; }

  .lr-work-title { font-size: 1.3rem; }

  .lr-work-body { padding: 0; }

  .lr-reader-inner { padding: 16px 0; }

  .lr-work-header { padding: 14px 16px; }
}

@media (max-width: 480px) {
  .lr-blurb-header {
    flex-direction: column;
    gap: 4px;
  }
}
