/* Shared SERP chrome follows the home page; file rows and media grids stay separate. */
.serp-page {
  --default-color: #263747;
  --heading-color: #182b3b;
  --accent-color: #28658b;
  --surface-color: #ffffff;
  --heading-font: "Raleway", sans-serif;
  --serp-muted: #596b79;
  --serp-line: #dbe3e9;
  --serp-tint: #f3f7fa;
  --serp-document-width: 60rem;
  --serp-result-title-size: 1.375rem;
  --serp-result-body-size: 1rem;
  --serp-result-detail-size: 0.9375rem;
  --serp-toolbar-height: 2rem;
  --serp-skip-layer: 10;
  font-variant-numeric: tabular-nums;
}
.serp-page .container { max-width: 74rem; }
.serp-page a:focus-visible,
.serp-page button:focus-visible,
.serp-page summary:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 4px;
}
.serp-skip-link {
  position: fixed;
  z-index: var(--serp-skip-layer);
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: 0.4rem;
  background: var(--heading-color);
  color: #ffffff;
  transform: translateY(-200%);
}
.serp-skip-link:focus { transform: translateY(0); color: #ffffff; }

.serp-main .search-results-header {
  padding: 1.6rem 0 1.3rem;
  border-bottom: 1px solid var(--serp-line);
  background: radial-gradient(ellipse at 95% 0%, #eaf2f8, transparent 65%), #f9fbfc;
}
.serp-search-row,
.serp-heading-row,
.serp-tabpanel .nav-tabs,
.serp-panel > .serp-status-bar,
.serp-panel > .pdf-sponsoring-shell,
.serp-document-empty,
.serp-document-pagination {
  max-width: var(--serp-document-width);
}
.serp-search-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2.75rem;
}
.serp-home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  color: var(--heading-color);
  font-family: var(--heading-font);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.045em;
  text-decoration: none;
  white-space: nowrap;
}
.serp-home-link:hover { color: var(--accent-color); }
.serp-logo { width: 2.25rem; height: 2.25rem; object-fit: contain; }
.serp-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
}
.serp-heading {
  margin: 0;
  color: var(--heading-color);
  font-size: clamp(1rem, 1.7vw, 1.3rem);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.025em;
  text-wrap: pretty;
}
.serp-preferred-source {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.45rem;
  min-height: 2.75rem;
  color: var(--serp-muted);
  font-size: 0.78rem;
  text-decoration: none;
}
.serp-preferred-source:hover { color: var(--accent-color); text-decoration: underline; text-underline-offset: 0.2em; }
.serp-page .serp-results-section { padding: 0 0 3.5rem; }
.serp-tabs-shell { padding: 0; background: var(--surface-color); }
.serp-tabpanel .nav-tabs {
  flex-wrap: nowrap;
  gap: 1.6rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--serp-line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.serp-tabpanel .nav-tabs::-webkit-scrollbar { display: none; }
.serp-tabpanel .nav-tabs > li { flex: 0 0 auto; }
.serp-tabpanel .nav-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.85rem 0.1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: inset 0 -2px transparent;
  color: var(--serp-muted);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 180ms ease, box-shadow 180ms ease;
}
.serp-tabpanel .nav-tabs a:hover { color: var(--accent-color); box-shadow: inset 0 -2px #bdcdd9; }
.serp-tabpanel .nav-tabs a.active,
.serp-tabpanel .nav-tabs .active > a,
.serp-tabpanel .nav-tabs .selected > a {
  background: transparent;
  color: var(--accent-color);
  box-shadow: inset 0 -2px var(--accent-color);
}
.serp-tabpanel .nav-tabs a:focus-visible { outline-offset: -4px; }

/* Status and format controls retain their existing Wicket behavior. */
.serp-status-bar { margin-bottom: 1rem; }
.serp-status-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: start; gap: 0.75rem; }
.serp-status-statline { display: flex; align-items: center; min-height: var(--serp-toolbar-height); color: var(--serp-muted); font-size: 0.85rem; line-height: 1.6; }
.serp-status-controls { display: contents; }
.serp-status-contentguard { grid-column: 2; grid-row: 1; width: 17rem; max-width: 100%; min-width: 0; }
.serp-status-row .host-collapse-toggle { grid-column: 3; grid-row: 1; }
.serp-guard-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--serp-line); border-radius: 0.4rem; overflow: hidden; }
.serp-guard-option { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: calc(var(--serp-toolbar-height) - 2px); padding: 0.3rem 0.65rem; background: #ffffff; color: var(--default-color); font-size: 0.8rem; line-height: 1.25; text-transform: capitalize; text-decoration: none; transition: background-color 180ms ease, color 180ms ease; }
.serp-guard-option + .serp-guard-option { border-inline-start: 1px solid var(--serp-line); }
.serp-guard-option:hover { background: var(--serp-tint); color: var(--accent-color); }
.serp-guard-option.is-active { background: #e7eff5; color: var(--accent-color); font-weight: 500; box-shadow: inset 0 -2px var(--accent-color); }
.serp-page .serp-guard-option:focus-visible { position: relative; outline-offset: -3px; }
.serp-guard-explanation { margin: 0.35rem 0 0; color: var(--serp-muted); font-size: 0.72rem; line-height: 1.45; }
.serp-page .host-collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--serp-toolbar-height);
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--serp-line);
  border-radius: 0.4rem;
  background: #ffffff;
  color: var(--default-color);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.25;
}
@media (pointer: coarse) {
  .serp-page { --serp-toolbar-height: 2.75rem; }
}
.serp-page .host-collapse-toggle:hover { background: var(--serp-tint); color: var(--accent-color); border-color: #bdcdd9; }
.serp-page .host-collapse-toggle.active { background: #e7eff5; color: #234e6a; border-color: #bdcdd9; }
.serp-status-dym:not(:empty) { margin-top: 0.65rem; }
.serp-subcat-chip {
  min-height: 2.25rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--serp-line);
  border-radius: 0.35rem !important;
  background: #ffffff;
  color: var(--serp-muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}
.serp-subcat-chip:hover { border-color: #9ab6c9; background: #eaf1f6; color: var(--accent-color); }
.serp-subcat-chip.is-active,
.serp-subcat-chip.active { border-color: var(--accent-color); background: var(--accent-color); color: #ffffff; }
.serp-subcat-chip:active { transform: translateY(1px); }

/* Preserve the existing layouts of non-document result tabs. */
.result-item { position: relative; background: #ffffff; border: 1px solid #dee2e6; box-shadow: 0 0.125rem 0.25rem #183b5410; padding: 1rem; border-radius: 0.5rem; }
@media (min-width: 992px) {
  .result-item { background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; border-radius: 0 !important; }
}

.serp-document-panel { max-width: var(--serp-document-width); }
.serp-document-filters {
  margin-bottom: 0.5rem;
  border: 1px solid var(--serp-line);
  border-radius: 0.55rem;
  background: #fbfcfd;
}
.serp-document-filters summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  list-style: none;
  cursor: pointer;
}
.serp-document-filters summary::-webkit-details-marker { display: none; }
.serp-filter-label { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--heading-color); font-size: 0.85rem; font-weight: 500; }
.serp-filter-selection { color: var(--accent-color); font-size: 0.8rem; line-height: 1.6; overflow-wrap: anywhere; }
.serp-filter-chevron { color: var(--serp-muted); font-size: 0.8rem; transition: transform 180ms ease; }
.serp-document-filters[open] { background: var(--serp-tint); }
.serp-document-filters[open] .serp-filter-chevron { transform: rotate(180deg); }
.serp-document-filters .serp-subcat-cloud { margin: 0 !important; padding: 0 1rem 1rem; }
.serp-document-filters summary:hover { background: #edf3f7; border-radius: 0.55rem; }
.serp-document-list { margin: 0; }
.serp-page .serp-document-results { padding: 0; }
.serp-document-panel .serp-document-item { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.serp-document-result {
  position: relative;
  min-width: 0;
  padding: 1.3rem 0 1.5rem;
  border-bottom: 1px solid #e5ebf0;
  font-family: var(--default-font);
}
/* Three type roles distinguish filenames, reading copy, and supporting details. */
.serp-result-sitename,
.serp-result-source-path,
.serp-result-location,
.serp-result-filemeta,
.serp-result-description,
.serp-result-context {
  color: var(--serp-muted);
  font-size: var(--serp-result-detail-size);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
}
.serp-result-sitename { color: var(--default-color); font-size: var(--serp-result-body-size); font-weight: 500; }
.serp-result-source {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  min-height: 2.75rem;
  padding-right: 6.5rem;
}
.serp-result-favicon { flex: 0 0 auto; width: 1.75rem; height: 1.75rem; object-fit: contain; border-radius: 0.35rem; }
.serp-result-source-text { display: flex; flex-direction: column; min-width: 0; gap: 0.1rem; }
.serp-result-sitename:hover { color: var(--accent-color); text-decoration: underline; text-underline-offset: 0.2em; }
.serp-result-sitename,
.serp-result-source-path { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.serp-result-source-path:hover { color: var(--accent-color); }
.serp-path-separator { margin-inline: 0.35rem; }
.serp-result-tools { position: absolute; top: 1.3rem; right: 0; display: flex; gap: 0.2rem; }
.serp-document-panel .serp-result-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--serp-muted);
  font-size: 1.1rem;
  text-decoration: none;
  transition: background-color 180ms ease, color 180ms ease;
}
.serp-document-panel .serp-result-action:hover { background: var(--serp-tint); color: var(--accent-color); }
.serp-document-panel .serp-result-action:active { background: #e5edf4; transform: translateY(1px); }
.serp-result-title { margin: 0.75rem 0 0.5rem; font-family: inherit; font-size: var(--serp-result-title-size); font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.serp-result-title a { display: block; color: var(--accent-color); text-decoration: none; }
.serp-result-title a:hover { color: #173f57; text-decoration: none; }
.serp-result-title a:hover .serp-result-filename { text-decoration: underline; text-underline-offset: 0.15em; }
.serp-result-location { display: block; margin-bottom: 0.3rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.serp-result-filename { display: block; }
.serp-result-filemeta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-top: 0.75rem; margin-bottom: 0.6rem; }
.serp-result-filemeta > :empty { display: none; }
.serp-result-filemeta > :not(:empty) ~ :not(:empty)::before { content: "•"; margin-inline-end: 0.8rem; }
.serp-result-format { display: inline-flex; align-items: center; min-height: 2rem; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: uppercase; text-decoration: none; }
.serp-result-format:hover { color: var(--accent-color); text-decoration: underline; text-underline-offset: 0.2em; }
.serp-result-description,
.serp-result-context { max-width: 65ch; margin: 0; color: var(--default-color); font-size: var(--serp-result-body-size); line-height: 1.6; overflow-wrap: anywhere; }
.serp-result-context { display: flex; flex-wrap: wrap; column-gap: 0.4rem; }
.serp-result-audio { display: flex; align-items: center; gap: 0.75rem; min-width: 0; margin-top: 0.5rem; }
.serp-result-audio audio { min-width: 0; max-width: 100%; }
.serp-document-empty { margin-block: 1.5rem; padding: 2.5rem; border-radius: 0.75rem; background: var(--serp-tint); }
.serp-document-empty > .bi { display: block; margin-bottom: 1rem; color: var(--accent-color); font-size: 2rem; }
.serp-document-empty h2 { max-width: 36ch; font-size: 1.5rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.025em; }
.serp-document-empty p { margin: 0.75rem 0 0; color: var(--serp-muted); }
/* Wicket falls back to the all-files tab when every category is empty. */
.serp-tabpanel .alert-warning {
  margin-block: 1.5rem;
  padding: 2rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--serp-tint);
  color: var(--serp-muted);
  text-align: left !important;
}
.serp-tabpanel .alert-warning h4 { font-size: 1.4rem; font-weight: 600; line-height: 1.4; }
.serp-tabpanel .alert-warning p { margin: 0.75rem 0 0; }
.serp-document-pagination { margin-top: 1.75rem; }
.serp-document-pagination .pagination { flex-wrap: wrap; justify-content: center !important; gap: 0.35rem; }
.serp-document-pagination .page-link { display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.75rem; margin: 0; border: 1px solid var(--serp-line); border-radius: 0.35rem !important; color: var(--accent-color); font-size: 0.85rem; }
.serp-document-pagination .active .page-link { background: var(--accent-color); border-color: var(--accent-color); color: #ffffff; }
.serp-page .footer { --background-color: #f3f7fa; }

@media (min-width: 992px) {
  .serp-main > section > .container,
  .serp-page .footer > .container,
  .serp-page .footer-bottom > .container {
    margin-inline: 0;
    margin-inline-start: 2.25rem;
    width: calc(100% - 2.25rem);
  }
}
@media (max-width: 991.98px) {
  .serp-page .container { padding-inline: 1.5rem; }
  .serp-search-row { gap: 1rem; }
  .serp-home-link { justify-self: start; justify-content: center; min-width: 2.75rem; font-size: 1.15rem; }
  .serp-brand-name { display: none; }
  .serp-logo { width: 1.9rem; height: 1.9rem; }
  .serp-heading-row { align-items: flex-start; flex-direction: column; gap: 0.3rem; margin-top: 1rem; }
  .serp-preferred-source { min-height: 2rem; }
  .serp-tabpanel .nav-tabs { gap: 1.2rem; }
}
@media (max-width: 575.98px) {
  .serp-page { --serp-result-title-size: 1.25rem; }
  .serp-main .search-results-header { padding: 1.1rem 0 0.9rem; }
  .serp-search-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .serp-search-row .search-form { z-index: 0; }
  .serp-home-link {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 0.35rem;
    width: 2.75rem;
    height: 2.75rem;
    justify-content: center;
    transform: translateY(-50%);
  }
  .serp-logo { width: 1.5rem; height: 1.5rem; }
  .serp-page .search-results-header .search-form .form-control { padding-inline: 3rem 0.45rem; }
  .serp-page .search-control .search-control-icon { display: none; }
  .serp-heading { font-size: 0.95rem; font-weight: 500; }
  .serp-tabpanel .nav-tabs a { min-height: 3.25rem; font-size: 0.88rem; }
  .serp-status-bar { margin-bottom: 0.75rem; }
  .serp-status-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.75rem; }
  .serp-status-contentguard { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .serp-status-row .host-collapse-toggle { grid-column: 2; grid-row: 1; }
  .serp-guard-explanation { font-size: 0.75rem; }
  .serp-page .host-collapse-toggle { padding-inline: 0.55rem; font-size: 0.75rem; }
  .serp-document-filters summary { grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; padding: 0.75rem; }
  .serp-filter-selection { grid-column: 1; font-size: 0.75rem; }
  .serp-filter-chevron { grid-column: 2; grid-row: 1 / span 2; }
  .serp-document-filters .serp-subcat-cloud { padding-inline: 0.75rem; }
  .serp-subcat-chip { min-height: 2.75rem; }
  .serp-result-source { gap: 0.5rem; padding-right: 5.75rem; }
  .serp-result-tools { gap: 0; }
  .serp-result-title { margin-top: 0.75rem; }
  .serp-document-empty { padding: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .serp-page *, .serp-page *::before, .serp-page *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
