/* Shared result cards for legislation, judgments and the DOF. */
.mley-results, .mley-search-suggestions {
  --result-accent: #145b60;
  --result-ink: #16383e;
  --result-muted: #546d72;
  --result-border: #d5e3e2;
  --result-tint: #f3f8f7;
  --result-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--result-ink);
  font-family: var(--result-font);
}

:root[data-theme="dark"] :is(.mley-results, .mley-search-suggestions) {
  --result-accent: #95d5ce;
  --result-ink: #e4f3f1;
  --result-muted: #b3c8cb;
  --result-border: #355256;
  --result-tint: #1c3238;
}

body[data-page-kind] .mley-results :is(h2, h3, .mley-oaj-results-summary, .mley-cjf-pagination) {
  font-family: var(--result-font);
  color: var(--result-ink);
}
body[data-page-kind] .mley-results :is(h2, [data-legislation-section] > h3) {
  font-size: 1.1rem;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
}
body[data-page-kind] .mley-results .mley-oaj-results-summary {
  color: var(--result-muted);
  font-size: .8rem;
}

body[data-page-kind] .mley-results .mley-results-list,
body[data-page-kind] .mley-search-suggestions__source ul {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 0;
  overflow: visible;
  border-radius: 0;
  list-style: none;
}

body[data-page-kind] .mley-results-list > .list-group-item,
body[data-page-kind] .mley-search-suggestions__source li {
  min-width: 0;
  margin: 0;
  padding: clamp(1.1rem, 2vw, 1.5rem);
  border: 1px solid var(--result-border);
  border-radius: 18px;
  background: var(--bg-surface);
  color: var(--result-ink);
  box-shadow: 0 3px 12px rgba(22, 56, 62, .035);
  font: .9rem/1.65 var(--result-font);
  overflow-wrap: anywhere;
}

body[data-page-kind] .mley-results-list > .mley-cjf-selected {
  border-color: var(--result-accent);
  background: var(--result-tint);
  box-shadow: inset 3px 0 var(--result-accent);
}

body[data-page-kind] .mley-results :is(.mley-result-title, .mley-oaj-result-exp),
body[data-page-kind] .mley-search-suggestions__source li > :is(a, span) {
  display: block;
  margin: 0;
  color: var(--result-ink);
  font: 650 1.1rem/1.5 var(--result-font);
  letter-spacing: -.015em;
}
body[data-page-kind] .mley-results :is(.mley-oaj-result-exp a, .mley-result-link),
body[data-page-kind] .mley-search-suggestions__source li > a {
  color: var(--result-accent);
  text-decoration: none;
}
body[data-page-kind] .mley-results :is(.mley-oaj-result-exp a, .mley-result-link):hover,
body[data-page-kind] .mley-search-suggestions__source li > a:hover {
  text-decoration: underline;
  text-underline-offset: .2em;
}
body[data-page-kind] .mley-results .mley-result-link:hover { text-decoration: none; }
body[data-page-kind] .mley-result-link:hover .mley-result-title { color: var(--result-accent); text-decoration: underline; text-underline-offset: .2em; }

body[data-page-kind] .mley-results :is(.mley-cjf-authority, .mley-result-law, .mley-oaj-result-chips),
body[data-page-kind] .mley-search-suggestions__source small {
  display: block;
  margin: .55rem 0 0;
  color: var(--result-muted);
  font: .8rem/1.65 var(--result-font);
}
body[data-page-kind] .mley-results .mley-oaj-result-chips { display: flex; gap: .4rem 0; }
body[data-page-kind] .mley-results .mley-oaj-result-block { margin-top: 1rem; }
body[data-page-kind] .mley-results .mley-oaj-result-block > span { color: var(--result-muted); font-size: .66rem; letter-spacing: .08em; }
body[data-page-kind] .mley-results :is(.mley-oaj-result-block p, .mley-result-excerpt) { color: var(--result-ink); font: .9rem/1.7 var(--result-font); }
body[data-page-kind] .mley-results .mley-result-excerpt { display: block; margin-top: .8rem; }
body[data-page-kind] .mley-results .mley-oaj-expand { min-height: 44px; color: var(--result-accent); font-family: var(--result-font); }

body[data-page-kind] .mley-results :is(.mley-oaj-card-footer, .mley-oaj-result-footer, .mley-result-pdf) {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--result-border);
}
body[data-page-kind] .mley-results .mley-oaj-card-footer { justify-content: flex-start; gap: .6rem; }
body[data-page-kind] .mley-results .mley-oaj-details { margin-left: auto; color: var(--result-muted); }
body[data-page-kind] .mley-results .mley-oaj-details summary { padding-block: .65rem; }
body[data-page-kind] .mley-results .mley-oaj-result-authority { color: var(--result-muted); font-size: .75rem; line-height: 1.65; }
body[data-page-kind] .mley-results .mley-oaj-result-authority strong { font-weight: 600; }
body[data-page-kind] .mley-results .dof-actions { justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

/* Higher specificity preserves these controls when the reader loads legacy CSS. */
body[data-page-kind] .mley-results :is(.mley-results-list, .mley-cjf-pagination, .dof-pagination) .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 44px;
  padding: .6rem .95rem;
  border: 1px solid var(--result-border) !important;
  border-radius: 10px !important;
  background: var(--bg-surface) !important;
  color: var(--result-accent) !important;
  box-shadow: none;
  font: 600 .8rem/1.5 var(--result-font);
  text-decoration: none;
  white-space: normal;
}
body[data-page-kind] .mley-results .mley-results-list :is(.btn-primary, .mley-cjf-document-link) {
  border-color: var(--result-accent) !important;
  background: var(--result-accent) !important;
  color: var(--bg-surface) !important;
}
body[data-page-kind] .mley-results .mley-oaj-result-actions .mley-oaj-result-save { min-width: 0; }
body[data-page-kind] .mley-results .mley-oaj-result-actions .mley-oaj-result-minimize { padding: 0; font-size: 1.4rem; }
body[data-page-kind] .mley-results :is(.mley-results-list, .mley-cjf-pagination, .dof-pagination) .btn:hover:not(:disabled) { border-color: var(--result-accent) !important; filter: brightness(.96); }
body[data-page-kind] :is(.mley-results, .mley-search-suggestions) :is(a, button, summary):focus-visible { outline: 2px solid var(--result-accent); outline-offset: 3px; }

/* Home keeps source groups, with the same cards within each group. */
body[data-page-kind="home"] .mley-home-search-results.mley-results { margin: 1.75rem 0 0; padding-top: 1.5rem; border-color: var(--result-border); gap: .75rem; }
body[data-page-kind] .mley-results .mley-result-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; }
body[data-page-kind] .mley-results .mley-result-labels { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .65rem; }
body[data-page-kind] .mley-result-labels :is(.badge, .mley-result-source) { margin: 0 !important; padding: .25rem .5rem; border: 1px solid var(--result-border); border-radius: 6px; background: var(--result-tint); color: var(--result-muted); font: 500 .7rem/1.4 var(--result-font); white-space: normal; }
body[data-page-kind] .mley-results .mley-result-pdf { font-size: .8rem; line-height: 1.7; }
body[data-page-kind] .mley-results .mley-result-pdf a { display: inline-block; padding-block: .5rem; color: var(--result-accent); }
body[data-page-kind] .mley-search-suggestions__source { padding: 1rem 0 0; border: 0; border-top: 1px solid var(--result-border); border-radius: 0; background: transparent; font-family: var(--result-font); }
body[data-page-kind] .mley-search-suggestions__source h3 { color: var(--result-ink); font: 650 .95rem/1.5 var(--result-font); }
body[data-page-kind] .mley-search-suggestions__source p { color: var(--result-muted); font-size: .8rem; }
body[data-page-kind] .mley-search-suggestions__source ul { margin: 1rem 0 .4rem; gap: .75rem; }
body[data-page-kind] .mley-search-suggestions__source li > :is(a, span) { font-size: 1rem; }
body[data-page-kind] .mley-search-suggestions__source > a { min-height: 44px; color: var(--result-accent); font-weight: 600; }
body[data-page-kind] .mley-search-suggestions__sources { gap: 1.5rem; }

/* DOF results do not need a second panel around their individual cards. */
body[data-page-kind="dof"] .dof-results.mley-results { margin-top: 1.75rem; padding: 0; border: 0; border-radius: 0; background: transparent; }
body[data-page-kind="dof"] .dof-results > .mley-oaj-results-summary { margin: .35rem 0 1.1rem; }
body[data-page-kind="dof"] .dof-group > h2 { margin-bottom: .8rem; color: var(--result-muted); font-size: .85rem; }
body[data-page-kind="dof"] .dof-pagination { align-items: center; gap: .75rem; padding-top: 1rem; color: var(--result-muted); font: .8rem/1.5 var(--result-font); }

@container oaj-search-main (max-width: 540px) {
  body[data-page-kind] .mley-results .mley-oaj-result-heading { flex-wrap: wrap; }
  body[data-page-kind] .mley-results .mley-oaj-result-actions { margin-left: auto; }
  body[data-page-kind] .mley-results .mley-oaj-card-footer .mley-cjf-document-link { width: 100%; }
}
@media (max-width: 575px) {
  body[data-page-kind="dof"] .dof-results.mley-results { margin-inline: .75rem; }
  body[data-page-kind] .mley-results-list > .list-group-item,
  body[data-page-kind] .mley-search-suggestions__source li { padding: 1rem; border-radius: 14px; }
  body[data-page-kind] .mley-results :is(.mley-result-title, .mley-oaj-result-exp) { font-size: 1rem; }
  body[data-page-kind] .mley-results .dof-actions .btn { flex: 1 1 8rem; width: auto; }
}
