/* Shared visual system, loaded after page-specific styles. */
:root { --radius: 8px; --radius-lg: 12px; --panel: var(--surface-soft); --muted: #526174; }
html[data-theme="dark"] { --muted: #b6c2d2; }
body { font-size: 16px; line-height: 1.7; }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { color: var(--text); font-weight: 700; word-break: keep-all; overflow-wrap: anywhere; }
h1 { letter-spacing: -.035em; }
a { text-underline-offset: 4px; }
.shared-header-inner { width: min(1120px, calc(100% - 32px)); margin: auto; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.shared-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.shared-nav a { padding: 10px 14px; border-radius: var(--radius); text-decoration: none; color: var(--muted); font-weight: 700; }
.shared-nav a:hover { color: var(--primary); background: var(--surface-soft); }
.shared-nav a[aria-current="page"] { color: #fff; background: #2457d6; }
.info-page { background: var(--bg); }
.info-shell, .guide-shell { width: min(960px, calc(100% - 32px)); padding: 32px 0 48px; }
.library-shell { width: min(1120px, calc(100% - 32px)); max-width: 1120px; }
.info-document { padding: clamp(20px, 4vw, 40px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); gap: 20px; }
.info-document h1, .admin-card h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); line-height: 1.3; }
.info-document h2 { font-size: 1.25rem; line-height: 1.45; margin-top: 16px; }
.info-document p, .info-document li { line-height: 1.85; }
.guide-hero { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.guide-note, .guide-check-grid > div, .guide-step-list article { background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.guide-link-card { border-radius: var(--radius); }
.guide-toc, .guide-footer { line-height: 1.7; }
.shared-footer { display: grid; gap: 16px; padding-block: 28px; color: var(--muted); border-top: 1px solid var(--line); }
.shared-footer nav { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.shared-footer a { color: var(--muted); }
.admin-shell { min-height: auto; padding-block: 32px 48px; }
.admin-card { box-shadow: var(--shadow-sm); padding: clamp(20px, 4vw, 36px); }
.article-editor, .article-list-item, .column-filters { border-color: var(--line); }
.article-preview, .service-cover { background: var(--surface-soft); border-color: var(--line); color: var(--text); border-radius: var(--radius); }
.article-meta, .library-intro, #library-count, .library-book .book-provider, .library-book .book-meta, .cover-fallback { color: var(--muted); font-size: .875rem; }
.library-book h2 a, .library-book summary { color: var(--text); }
.book-access { color: var(--accent); }
.library-filters, .column-filters, .controls { padding: 20px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-lg); box-shadow: none; }
.article-editor input, .article-editor textarea, .article-editor select,
.column-filters input, .column-filters select, .library-filters input, .library-filters select,
.controls input, .controls select { min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.library-filters button, #empty-reset { min-height: 44px; border-radius: var(--radius); border-color: var(--line); background: var(--surface-soft); color: var(--text); }
.resource-card { background: var(--surface); border-color: var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.resource-card:hover { box-shadow: var(--shadow-sm); transform: none; border-color: var(--primary); }
.hero-meta-row { background: var(--surface); border-color: var(--line); border-radius: var(--radius-lg); }
.hero-primary { box-shadow: none; }
.hero-secondary { background: var(--surface); border-color: var(--line); color: var(--primary); }
.hero-copy > p:nth-of-type(2), .catalog-header p, .catalog-help, .controls label span, .support-strip, .site-footer { color: var(--muted); }
.provider-link { color: var(--primary); }
html[data-theme="dark"] .hero { background: var(--surface-soft); border-color: var(--line); }
@media (max-width: 700px) {
  .shared-header-inner { align-items: flex-start; flex-direction: column; gap: 8px; padding-block: 12px; }
  .shared-nav { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shared-nav a { font-size: .875rem; padding: 8px 10px; }
  .info-shell, .guide-shell { padding-top: 20px; }
  .info-document { padding: 20px 16px; }
  .library-filters, .column-filters, .controls { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .resource-card { transition: none; } }

/* Catalog-first layout: keep the first resources within the initial viewport. */
.hero { padding: 0; }
.hero-inner { padding-block: 10px; }
.hero-copy { padding: 0; row-gap: 4px; }
.hero-kicker { display: none; }
.hero h1 { font-size: clamp(1.25rem, 2vw, 1.7rem); line-height: 1.3; }
.hero-actions { grid-row: 1 / 3; }
.hero-meta-row { margin-top: 4px; padding: 4px 0; border: 0; background: transparent; box-shadow: none; }
.catalog { padding-top: 16px; display: block; }
.catalog-header { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.catalog-header h2 { font-size: 1.25rem; }
.catalog-header > div:first-child { margin: 0; }
.catalog-actions { gap: 6px; }
.catalog-actions button { min-height: 36px; padding: 6px 10px; font-size: .875rem; }
.catalog-shortcuts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 8px; font-size: .875rem; }
.catalog-shortcuts a { color: var(--primary); }
.filter-toolbar { margin: 0 0 8px; }
.controls { grid-template-columns: minmax(180px, 1.5fr) repeat(5, minmax(0, 1fr)); padding: 12px; gap: 10px; margin-bottom: 8px; }
.controls label { min-width: 0; gap: 4px; }
.catalog-notes { font-size: .875rem; color: var(--muted); margin: 6px 0; }
.catalog-notes summary { cursor: pointer; width: fit-content; padding-block: 4px; }
.catalog-notes .catalog-help { width: 100%; margin: 8px 0; padding: 0; border: 0; display: block; }
.catalog-notes p { margin: 8px 0; }
.catalog-notes a { color: var(--primary); }
.result-bar { margin-block: 8px; }
.resource-card > .card-description { order: 2; }
.provider-list li > div:first-child { display: flex; flex-direction: column; align-items: stretch; }
.provider-list li > div:first-child > .direct-links { order: 1; }
.provider-list li > div:first-child > .provider-domain,
.provider-list li > div:first-child > small { order: 2; }
@media (min-width: 901px) {
  .catalog-shortcuts { float: left; min-height: 40px; align-items: center; }
  .filter-toolbar { min-height: 40px; }
  .controls { clear: both; }
  .hero-meta-item strong { font-size: .875rem; }
  .hero-meta-row { font-size: .8rem; }
  .resource-card { padding: 12px; gap: 6px; }
  .resource-card .card-description { margin: 0; }
}
@media (max-width: 900px) {
  .controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .hero-inner { padding-block: 10px; }
  .hero-copy > p:nth-of-type(2) { font-size: .8rem; margin-top: 4px; }
  .hero-actions { display: none; }
  .hero-meta-row { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .75rem; }
  .hero-meta-scope { margin: 0; }
  .hero-meta-item { display: inline-flex; gap: 4px; padding: 0; font-size: .75rem; }
  .hero-meta-item strong { font-size: inherit; }
  .catalog { padding-top: 10px; }
  .catalog-header { gap: 6px; }
  .catalog-actions { justify-content: flex-start; }
  .catalog-actions button { font-size: .75rem; padding: 6px 8px; }
  #favoritesSummary { font-size: .75rem; }
  .catalog-shortcuts { font-size: .8rem; gap: 6px 12px; }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; }
  .controls .search-field { grid-column: 1 / -1; }
  .result-bar { font-size: .8rem; }
  .hero h1 { font-size: 1.1rem; }
  .hero-copy > p:nth-of-type(2) { display: none; }
  .hero-meta-item:last-child { display: none; }
  .hero-meta-row { display: none; }
  .provider-list-summary { padding-block: 4px; }
  .catalog-header > div:first-child { flex-basis: 100%; }
  .catalog-actions { display: flex; flex-wrap: wrap; width: 100%; }
  .catalog-actions button { width: auto; min-width: 0; flex: 0 1 auto; }
  .filter-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .filter-toggle-button { width: auto; flex: 0 0 auto; }
  .filter-toolbar .sort-field { width: auto; flex: 1; min-width: 0; }
  .filter-toolbar .sort-field select { min-width: 0; width: 100%; }
  .filter-toolbar .view-switch { margin-left: auto; }
  .result-bar { display: block; }
  .result-bar p:nth-child(2) { display: none; }
}
