/* UX simplification layer - 2026-06-27.
   Goal: calmer colors, less visual weight, fewer large blocks. */

:root {
  --ink: #2d3338;
  --text: #3d4349;
  --muted: #747c84;
  --line: #e1e6ea;
  --hairline: #eef1f3;
  --paper: #ffffff;
  --bg: #f8f9fa;
  --panel: #ffffff;
  --accent: #5f737d;
  --accent-dark: #465960;
  --accent-soft: #f3f6f7;
  --blue: #5f737d;
  --green: #556f61;
  --gold: #9a8048;
  --mark: #fff2c4;
  --focus: #7d99a4;
  --shadow: 0 8px 20px rgba(45, 51, 56, .06);
}

body {
  background: var(--bg);
  color: var(--text);
}

a,
.toplinks a,
.quick-searches button,
.active-filters button,
.facet-list button,
#reset,
.social-keywords button,
.pagination button,
.rank,
.passage-link span,
.passage-note,
.kicker,
.kicker.dark,
.source-icon,
.badge,
.court-badge,
.decision-link:hover,
.brand strong em {
  color: var(--text);
}

.brand strong em,
.searchbar button,
button[type="submit"],
.pagination button[aria-current="page"] {
  color: #fff;
}

.brand strong em {
  background: transparent;
  color: var(--accent);
}

.topbar {
  background: rgba(248, 249, 250, .96);
  border-bottom-color: var(--hairline);
  padding-bottom: 10px;
}

.toplinks a {
  font-weight: 520;
}

.case-finder {
  background: var(--paper);
  border-color: var(--line);
  box-shadow: none;
  gap: 14px;
  grid-template-columns: minmax(180px, .42fr) minmax(420px, 1.58fr);
  margin: 12px 0 8px;
  padding: 14px 16px;
}

.kicker,
.kicker.dark {
  font-weight: 580;
  letter-spacing: .05em;
}

h1,
.hero-title {
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 650;
  line-height: 1.16;
  max-width: 360px;
}

.searchbar {
  border-color: var(--line);
  box-shadow: none;
  padding: 4px;
}

.searchbar input {
  min-height: 40px;
}

.searchbar button {
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 620;
  min-height: 40px;
}

.searchbar button:hover {
  background: var(--accent-dark);
}

.search-help {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.quick-searches {
  gap: 6px;
  margin-top: 8px;
}

.quick-searches button:nth-of-type(n+6) {
  display: none;
}

.quick-searches button,
.active-filters button,
.facet-list button,
#reset,
.social-keywords button {
  background: #f8f9fa;
  border-color: var(--line);
  color: #525960;
  font-size: 12px;
  font-weight: 520;
  min-height: 28px;
  padding: 0 10px;
}

.quick-searches button:hover,
.active-filters button:hover,
#reset:hover,
.facet-list button:hover,
.social-keywords button:hover,
.stats button:hover,
.source-shortcut:hover {
  background: var(--accent-soft);
  border-color: #d6dde1;
  color: var(--ink);
}

.stats {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}

.stats div,
.stats button {
  align-items: baseline;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--muted);
  display: inline-flex;
  gap: 4px;
  min-height: 28px;
  padding: 2px 6px;
  width: auto;
}

.stats strong {
  color: #555d64;
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 620;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.topic-board {
  background: transparent;
  border: 0;
  margin: 4px 0 10px;
  padding: 0;
}

.topic-board-head {
  justify-content: flex-end;
}

.topic-board-head > div:first-child {
  display: none;
}

.topic-actions {
  gap: 6px;
}

.guided-toggle,
.filter-toggle,
.advanced-toggle {
  background: #fff;
  border-color: var(--line);
  color: #4f575e;
  font-size: 13px;
  font-weight: 560;
  min-height: 32px;
  padding: 0 10px;
}

.guided-toggle:hover,
.filter-toggle:hover,
.advanced-toggle:hover {
  background: var(--accent-soft);
  border-color: #d6dde1;
  color: var(--ink);
}

.topic-groups {
  gap: 6px;
  grid-template-columns: 1fr;
  margin-top: 8px;
}

.topic-group {
  background: #fff;
  border-color: var(--hairline);
  padding: 6px;
}

.topic-group h3 {
  color: #4f575e;
  font-weight: 620;
}

.workspace {
  gap: 12px;
}

.sidebar {
  box-shadow: none;
  max-height: calc(100vh - 20px);
  padding: 12px;
}

.sidebar h2,
.head h2 {
  font-size: 18px;
  font-weight: 650;
}

.sidebar:not(.show-advanced) .insights,
.sidebar:not(.show-advanced) .lawyer-panel {
  display: none;
}

.filters {
  gap: 8px;
}

.filters label {
  font-weight: 580;
}

.filters input,
.filters select {
  min-height: 36px;
}

.head {
  margin-bottom: 6px;
}

.head p,
.result-meta,
.meta-line {
  color: var(--muted);
  font-size: 13px;
}

.results {
  gap: 8px;
}

.decision-card {
  border-color: var(--line);
  box-shadow: none;
  gap: 7px;
  padding: 12px 14px;
}

.decision-card:hover {
  border-color: #cfd7dc;
  box-shadow: 0 8px 18px rgba(45, 51, 56, .06);
  transform: none;
}

.decision-link {
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.26;
}

.rank {
  color: var(--muted);
  font-weight: 500;
}

.badges,
.block,
.keywords,
.detail-section {
  padding-left: 34px;
}

.badge,
.court-badge {
  background: #f8f9fa;
  border-color: var(--line);
  color: #5e646b;
  font-weight: 520;
}

.badge.neutral,
.court-badge,
.active-filters button,
.source-icon {
  background: #f8f9fa;
  color: #5e646b;
}

.block h3,
.keywords h3,
.detail-section h3,
.detail-section h2 {
  color: #858c93;
  font-weight: 600;
  letter-spacing: .04em;
}

.block p,
.keywords p,
.detail-section p,
.keywords a,
.keyword-line a {
  color: #4d5359;
}

.excerpt {
  border-left-color: var(--line);
}

.passage-link:hover {
  background: #f8f9fa;
}

.pagination {
  margin: 4px 0 8px;
}

.pagination button {
  background: #fff;
  border-color: var(--line);
  color: #4f575e;
  font-weight: 560;
}

.pagination button[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
}

/* Decision results: denser scan, fewer labels, neutral color. */
.results .decision-card {
  gap: 5px;
  padding: 10px 12px;
}

.results .decision-topline {
  align-items: center;
  gap: 8px;
}

.results .decision-link {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 590;
  line-height: 1.28;
}

.results .rank {
  flex: 0 0 26px;
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.results .court-badge {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  padding: 0;
}

.results .badges,
.results .block,
.results .keywords {
  gap: 2px;
  padding-left: 34px;
}

.results .keywords h3,
.results .excerpt-block h3,
.results .summary-block h3 {
  display: none;
}

.results .keywords p,
.results .excerpt-block p,
.results .summary-block p {
  color: #5b6268;
  font-size: 12.5px;
  line-height: 1.35;
  margin: 0;
}

.results .keywords p {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  display: -webkit-box;
  overflow: hidden;
}

.results .keywords a,
.results .keyword-line a {
  color: #50575d;
  text-decoration: none;
}

.results .excerpt-block p,
.results .summary-block p {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  display: -webkit-box;
  overflow: hidden;
}

/* Decision detail pages: reading mode first, search controls secondary. */
main:has(article.detail) > .case-finder,
main:has(article.detail) > .stats,
main:has(article.detail) > .topic-board {
  display: none;
}

main:has(article.detail) .workspace {
  grid-template-columns: 1fr;
  margin-top: 12px;
}

main:has(article.detail) .sidebar {
  display: none;
}

article.detail {
  border-color: var(--line);
  box-shadow: none;
  gap: 12px;
  padding: 14px 16px;
}

article.detail .back {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

article.detail .back:hover {
  color: var(--ink);
  text-decoration: underline;
}

article.detail h1 {
  color: var(--ink);
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(21px, 2vw, 27px);
  font-weight: 630;
  line-height: 1.2;
  margin: 0;
  max-width: 980px;
}

article.detail > .badges {
  gap: 5px;
  padding-left: 0;
}

article.detail > .badges .badge,
article.detail > .badges .court-badge {
  background: #f8f9fa;
  color: #5d646a;
}

article.detail .detail-section {
  gap: 6px;
  padding-left: 0;
}

article.detail .detail-section h2,
article.detail .section-heading-row h2 {
  color: #4c5359;
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 630;
  line-height: 1.2;
  margin: 0;
}

article.detail .keyword-line {
  color: #5b6268;
  font-size: 13px;
  line-height: 1.45;
}

article.detail .keyword-line a {
  color: #4e555b;
  text-decoration: none;
}

article.detail .facts {
  background: #fafbfc;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  gap: 6px 16px;
  grid-template-columns: minmax(140px, 210px) 1fr;
  padding: 10px 12px;
}

article.detail .facts dt {
  color: #747c84;
  font-size: 12px;
  font-weight: 600;
}

article.detail .facts dd {
  color: #3f464c;
  font-size: 13px;
}

article.detail .decision-tools {
  background: #fbfcfd;
  box-shadow: none;
  gap: 8px;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  padding: 8px;
  position: sticky;
  top: 8px;
}

article.detail .decision-search-field {
  font-size: 11px;
  font-weight: 600;
}

article.detail .decision-search-field input {
  min-height: 34px;
}

article.detail .decision-tool-buttons .icon-button {
  background: #fff;
  border-color: var(--line);
  color: #4f575e;
  min-height: 34px;
  width: 34px;
}

article.detail .full-text {
  background: #fff;
  border-color: var(--line);
  color: #30353a;
  font: 14.5px/1.64 Georgia, "Times New Roman", serif;
  padding: 16px 18px;
}

article.detail .full-text p {
  margin: 0 0 11px;
}

@media (max-width: 720px) {
  main {
    padding-top: 6px;
  }

  .topbar {
    padding-bottom: 8px;
  }

  .case-finder {
    gap: 10px;
    grid-template-columns: 1fr;
    margin: 8px 0;
    padding: 12px;
  }

  .finder-copy,
  .finder-tools,
  .searchbar,
  .quick-searches {
    width: 100%;
  }

  h1,
  .hero-title {
    font-size: 21px;
    max-width: none;
  }

  .searchbar button {
    min-height: 38px;
  }

  .quick-searches {
    gap: 6px;
  }

  .quick-searches button:nth-of-type(n+5) {
    display: none;
  }

  .stats {
    display: none;
  }

  .topic-board {
    margin: 2px 0 8px;
  }

  .topic-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .guided-toggle,
  .filter-toggle {
    width: 100%;
  }

  .decision-card {
    padding: 10px 11px;
  }

  .decision-link {
    font-size: 14px;
  }

  .badges,
  .block,
  .keywords {
    padding-left: 0;
  }

  .decision-card .badges {
    display: none;
  }

  .decision-card .keywords p,
  .decision-card .keyword-line {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
  }

  .decision-card .block h3,
  .decision-card .keywords h3 {
    display: none;
  }

  .pager-jump {
    display: none;
  }

  .results .decision-card {
    min-height: 0;
    padding: 9px 10px;
  }

  .results .decision-link {
    font-size: 13.5px;
  }

  .results .court-badge {
    display: none;
  }

  .results .keywords,
  .results .block {
    padding-left: 0;
  }

  .results .excerpt-block p,
  .results .summary-block p {
    -webkit-line-clamp: 2;
  }

  article.detail {
    padding: 12px;
  }

  article.detail h1 {
    font-size: 20px;
  }

  article.detail .decision-tools {
    grid-template-columns: 1fr;
    position: static;
  }

  article.detail .facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  article.detail .facts dd {
    margin-bottom: 7px;
  }

  article.detail .full-text {
    border-left: 0;
    border-right: 0;
    font-size: 14px;
    margin-left: -12px;
    margin-right: -12px;
    padding: 14px 12px;
  }
}

/* Compact results header: corpus summary, actions and page controls stay in one scanning area. */
.overview-strip {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 4px 0 8px;
}

.overview-strip .stats,
.overview-strip .topic-board {
  margin: 0;
}

.overview-strip .stats {
  min-width: 0;
}

.overview-strip .topic-board {
  justify-self: end;
  min-width: max-content;
}

.overview-strip .topic-board:not(.guided-collapsed) {
  grid-column: 1 / -1;
  justify-self: stretch;
  min-width: 0;
}

.content .head {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 8px 12px;
  grid-template-columns: auto minmax(160px, 1fr);
  margin-bottom: 6px;
  padding: 8px 10px 8px 12px;
}

.content .head.has-pagination {
  grid-template-columns: auto minmax(180px, 1fr) auto;
}

.content .head h2 {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.15;
}

.content .head #meta {
  color: var(--muted);
  font-size: 13px;
  justify-self: end;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content .head .pagination-top {
  flex-wrap: nowrap;
  gap: 4px;
  justify-content: flex-end;
  margin: 0;
  max-width: 100%;
  padding: 0;
}

.content .head .pagination-top .pager-jump,
.content .head .pagination-top .pager-summary {
  display: none;
}

.content .head .pagination-top button {
  min-height: 30px;
}

.content .head .pagination-top .pager-arrow,
.content .head .pagination-top .pager-number {
  min-width: 30px;
}

main:has(article.detail) > .overview-strip {
  display: none;
}

@media (max-width: 980px) {
  .content .head.has-pagination {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .content .head .pagination-top {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  html,
  body {
    overflow-x: clip;
  }

  main,
  .case-finder,
  .workspace,
  .content,
  .results,
  .decision-card,
  .overview-strip,
  .topic-board,
  .topic-actions,
  .content .head {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
  }

  main {
    margin-left: 0;
    margin-right: 0;
    overflow-x: hidden;
    padding-left: 10px;
    padding-right: 10px;
    width: auto;
  }

  .case-finder {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
    width: 100%;
  }

  .case-finder h1,
  .hero-title {
    max-width: none;
    overflow-wrap: anywhere;
  }

  .searchbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .searchbar input,
  .searchbar button,
  .guided-toggle,
  .filter-toggle {
    min-width: 0;
    width: 100%;
  }

  .overview-strip {
    display: block;
    margin: 2px 0 8px;
  }

  .overview-strip .stats {
    display: none;
  }

  .overview-strip .topic-board {
    min-width: 0;
  }

  .content .head,
  .content .head.has-pagination {
    grid-template-columns: 1fr;
    padding: 9px 10px;
  }

  .content .head #meta {
    justify-self: start;
    white-space: normal;
  }

  .content .head .pagination-top {
    overflow-x: auto;
    padding-bottom: 2px;
    width: 100%;
  }

  .decision-link,
  .passage-link,
  .block p,
  .keywords p,
  .keyword-line {
    overflow-wrap: anywhere;
  }
}
