/* Shared discovery UI for Catalog and Textbooks. Loaded after app styles. */
:root {
  --muted: #4d6072;
  --control-border: #687d8e;
  --focus-color: #003366;
  --search-radius: 8px;
  --search-gap: 16px;
}

[hidden] { display: none !important; }

/* Opaque reading surfaces keep contrast predictable as content scrolls. */
body { background: #f4f9fc; }
body .portal-chrome :is(.portal-chrome__header, .portal-chrome__footer) {
  background: #f7fbff; backdrop-filter: none; -webkit-backdrop-filter: none;
}
body :is(.command-surface, .insight-panel) { background: #ffffff; }
body .hero { background: linear-gradient(135deg, #003366, #07507e); }
body .hero-panel { background: #f2f7fb; }
body .eyebrow, :root body .portal-chrome .portal-chrome__footer-links a { color: #005a9c; }
body .hero-copy .eyebrow { color: var(--gold); }
body .hero-panel .eyebrow { color: var(--saints-blue); }

body .portal-chrome .portal-chrome__footer {
  position: static;
  margin-top: 24px;
}

body .portal-chrome .portal-chrome__header { padding: 12px 24px; }
body .portal-chrome .portal-chrome__mark { height: 60px; width: 60px; }
body { overflow-x: visible; }
main { padding-bottom: 16px; }

.hero {
  padding: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  gap: 24px;
}
.hero-copy h1, .hero h1 {
  font-size: clamp(1.8rem, 3.2vw, 2.5rem);
  line-height: 1.15;
  margin-bottom: 12px;
}
.hero-copy .lead { max-width: 52ch; }
.hero-panel { min-height: 0; padding: 18px; gap: 8px; }
.hero-panel .eyebrow { color: var(--saints-blue); margin-bottom: 0; }
.hero-panel strong { font-size: 1.3rem; }
.mini-metrics { gap: 12px; }
.mini-metrics div { padding: 8px 12px; }
.mini-metrics b { font-size: 1.4rem; }
.mini-metrics span { color: var(--muted); }

.term-picker { display: block; margin-top: 4px; padding-top: 12px; }
.term-picker__controls { display: flex; gap: 8px; margin-top: 6px; }
.term-picker__controls .sf-native-select { flex: 1; min-width: 0; }
.term-picker__controls button { flex: 0 0 auto; padding: 10px 14px; }
.term-picker [data-term-message] { color: var(--muted); font-size: 0.875rem; line-height: 1.4; margin: 8px 0 0; }

.command-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(200px, 1fr); gap: var(--search-gap); }
.search-box, .filter-box { display: grid; gap: 6px; min-width: 0; }
.toolbar.command-surface { align-items: end; gap: var(--search-gap); }
.search-box label, .filter-box label, .term-picker > label {
  display: block; color: var(--saints-blue); font-size: 0.9375rem; font-weight: 700;
}
body :is(input, select) {
  min-height: 48px; border: 1px solid var(--control-border); border-radius: var(--search-radius);
  background: var(--surface); color: var(--ink); font: inherit; padding: 10px 12px;
}
body input::placeholder { color: var(--muted); opacity: 1; }
body select { cursor: pointer; }
body button:disabled, body button[aria-disabled="true"] { cursor: default; }

:root body :is(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus-color);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--surface);
}
:root body .hero-copy :is(a, h1):focus-visible { outline-color: var(--gold); box-shadow: none; }
:root body [role="tabpanel"]:focus-visible { outline-offset: 5px; }
body [tabindex="-1"] { scroll-margin-block: 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.no-script { padding: 24px; color: var(--ink); }
.result-pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: var(--search-gap); padding: 20px 0 4px;
}
.result-pagination button { padding: 10px 16px; }
.result-pagination span { color: var(--ink); text-align: center; }
.result-pagination button:disabled { background: var(--mist); color: var(--muted); border: 1px solid var(--line); }
.course-line h3 { font-size: 1.05rem; line-height: 1.4; margin: 0; }
body .course-link { white-space: normal; max-width: 100%; line-height: 1.4; }
.course-line h3 { min-width: 0; max-width: 100%; }
.adoption-card__main h3 { font-size: 1.1rem; line-height: 1.4; margin: 6px 0 12px; }
.material-row h4 { font-size: 1rem; line-height: 1.4; margin: 0; }
.material-code { white-space: normal; text-align: left; }
body .isbn-link { color: #005a9c; }
.adoption-card, .course-card, .material-row, .material-row dd, .detail-section-list { overflow-wrap: anywhere; min-width: 0; }
.section-modal:not([open]) { display: none; }
dialog.section-modal {
  margin: auto; width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  color: var(--ink); overflow: auto; background: var(--surface);
}
dialog.section-modal::backdrop { background: rgba(0, 25, 50, 0.6); }
.section-modal__body { padding: 6px; }
.section-toggle { min-height: 44px; }
.section-row__heading { margin: 0; font-size: inherit; }
.section-row__details { padding: 12px; color: var(--ink); }
.section-row__meta, .section-row__schedule { color: var(--ink); }
.detail-hero-copy { align-content: start; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 20px; gap: 16px; }
  .hero-panel { min-width: 0; }
  .command-main { grid-template-columns: 1fr; }
  .toolbar.command-surface { display: grid; grid-template-columns: 1fr; }
  .term-picker__controls { flex-wrap: wrap; }
  .term-picker__controls .sf-native-select { flex-basis: 100%; width: 100%; }
  .term-picker__controls button { width: 100%; }
  .source-chip { white-space: normal; }
  .result-pagination { gap: 12px; }
  .result-pagination span { flex-basis: 100%; order: -1; }
  .section-modal__header { gap: 12px; }
}

@media (forced-colors: active) {
  :root body :is(a, button, input, select, summary, [tabindex]):focus-visible {
    outline-color: Highlight; box-shadow: none;
  }
  body :is(button, select, input), .tag, .status-toggle button { border: 1px solid ButtonText; }
  .status-toggle button.selected, [role="tab"][aria-selected="true"] { border: 3px solid Highlight; }
  .bar-track { border: 1px solid CanvasText; }
  .bar-fill { background: Highlight; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
