/* Open Library fresh layout + typography refinement — 2026-08-28 v1
 * Loaded last on purpose. Versioned filename prevents stale Cloudflare CSS.
 */

:root {
  --ol-fresh-text: #0F172A;
  --ol-fresh-text-2: #26364D;
  --ol-fresh-muted: #52627A;
  --ol-fresh-soft: #7B8AA2;
  --ol-fresh-line: #DCE4EE;
  --ol-fresh-canvas: #F5F8FC;
  --ol-fresh-surface: #FFFFFF;
  --ol-fresh-red: #DC2626;
  --ol-fresh-red-dark: #B91C1C;
  --ol-fresh-red-soft: #FFF5F5;
  --ol-fresh-radius: 16px;
  --ol-fresh-shadow: 0 12px 34px rgba(15, 23, 42, .07);
  --ol-fresh-shadow-hover: 0 18px 44px rgba(15, 23, 42, .11);
}

/* ===== Global readability: slightly larger, darker, calmer ===== */
html {
  font-size: 16px !important;
}

html body {
  background: var(--ol-fresh-canvas) !important;
  color: var(--ol-fresh-text) !important;
  font-size: 14px !important;
  line-height: 1.65 !important;
}

html body,
html body button,
html body input,
html body select,
html body textarea {
  color: var(--ol-fresh-text) !important;
}

html body .pkp_structure_main p,
html body .pkp_structure_main li,
html body .pkp_structure_main dd,
html body .pkp_structure_main td,
html body .pkp_structure_main th {
  color: var(--ol-fresh-text-2);
  font-size: 14px;
  line-height: 1.72;
}

html body .pkp_structure_main h1,
html body .pkp_structure_main h2,
html body .pkp_structure_main h3,
html body .pkp_structure_main h4 {
  color: var(--ol-fresh-text) !important;
  letter-spacing: -.025em;
}

html body .pkp_structure_main h1 { font-size: 30px !important; line-height: 1.18 !important; }
html body .pkp_structure_main h2 { font-size: 23px !important; line-height: 1.25 !important; }
html body .pkp_structure_main h3 { font-size: 17px !important; line-height: 1.35 !important; }

html body .pkp_structure_main label,
html body .pkp_structure_main legend {
  color: var(--ol-fresh-text) !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
}

html body .pkp_structure_main input,
html body .pkp_structure_main select,
html body .pkp_structure_main textarea,
html body .pkp_structure_main button {
  font-size: 13.5px !important;
}

html body input::placeholder,
html body textarea::placeholder {
  color: #718096 !important;
  opacity: 1 !important;
}

html body .pkp_structure_main a:not(.cmp_button):not(.obj_galley_link) {
  text-underline-offset: 2px;
}

/* ===== Wider, more contemporary shell ===== */
html body.openlib-site-page .openlib_site_shell,
html body.openlib-site-page .pkp_structure_content,
html body.openlib-journal-page .openlib_journal_shell {
  width: 1240px !important;
  max-width: calc(100% - 48px) !important;
}

html body.openlib-site-index .pkp_structure_main,
html body.openlib-site-page .pkp_structure_main {
  padding-top: 28px !important;
}

/* ===== Header polish ===== */
html body .openlib_site_header,
html body .openlib_journal_header {
  box-shadow: 0 1px 0 rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.025) !important;
}

html body .openlib_site_header__main_inner {
  min-height: 72px !important;
}

html body .openlib_site_brand__mark {
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 18px rgba(220,38,38,.20) !important;
}

html body .openlib_site_brand__text strong {
  font-size: 18px !important;
  letter-spacing: -.03em !important;
}

html body .openlib_site_brand__text small {
  color: #75849A !important;
  font-size: 10px !important;
}

html body .openlib_site_header__account .pkp_navigation_user > li > a,
html body .openlib_site_nav_menu .pkp_navigation_primary > li > a,
html body .openlib_color_mode_toggle {
  color: #334155 !important;
  font-size: 12px !important;
}

/* ===== Homepage search: fresher white surface with red ambient tint ===== */
html body.openlib-site-index .openlib_search_panel {
  position: relative;
  margin: 0 0 32px !important;
  padding: 14px !important;
  overflow: hidden;
  border: 1px solid rgba(220,38,38,.20) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 100% 0%, rgba(248,113,113,.10), transparent 28%),
    linear-gradient(180deg, #FFFFFF 0%, #FFFCFC 100%) !important;
  box-shadow: var(--ol-fresh-shadow) !important;
}

html body.openlib-site-index .openlib_search_panel:before {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #991B1B 0%, #DC2626 45%, #FB7185 100%);
  content: "";
}

html body.openlib-site-index .openlib_discovery__form {
  grid-template-columns: minmax(0,1fr) 220px 160px !important;
  gap: 10px !important;
}

html body.openlib-site-index .openlib_discovery__form input[type="search"],
html body.openlib-site-index .openlib_discovery__form select,
html body.openlib-site-index .openlib_discovery__form button {
  height: 46px !important;
  border-radius: 11px !important;
  font-size: 13px !important;
}

html body.openlib-site-index .openlib_discovery__form input[type="search"],
html body.openlib-site-index .openlib_discovery__form select {
  border-color: #D7E0EA !important;
  background: rgba(255,255,255,.96) !important;
}

html body.openlib-site-index .openlib_discovery__form button {
  padding: 0 18px !important;
  box-shadow: 0 8px 18px rgba(220,38,38,.16) !important;
  font-size: 12px !important;
}

html body.openlib-site-index .openlib_discovery__meta {
  margin-top: 10px !important;
  color: var(--ol-fresh-muted) !important;
  font-size: 11.5px !important;
}

html body.openlib-site-index .openlib_discovery__meta strong {
  color: var(--ol-fresh-text) !important;
}

/* ===== Browse publications heading/filter ===== */
html body.openlib-site-index .openlib_journal_tools {
  align-items: center !important;
  margin-bottom: 17px !important;
  padding-bottom: 14px !important;
  border-bottom: 1px solid var(--ol-fresh-line) !important;
}

html body.openlib-site-index .openlib_journal_tools__eyebrow,
html body.openlib-site-page .openlib_search_page__eyebrow {
  color: var(--ol-fresh-red) !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
  letter-spacing: .085em !important;
}

html body.openlib-site-index .openlib_journal_tools h2 {
  margin-top: 2px !important;
  font-size: 24px !important;
}

html body.openlib-site-index .openlib_journal_count {
  margin-top: 4px !important;
  color: var(--ol-fresh-muted) !important;
  font-size: 11.5px !important;
}

html body.openlib-site-index .openlib_journal_filter {
  width: 255px !important;
}

html body.openlib-site-index .openlib_journal_filter input[type="search"] {
  height: 40px !important;
  border-color: #D7E0EA !important;
  border-radius: 10px !important;
  color: var(--ol-fresh-text-2) !important;
  font-size: 12px !important;
}

/* ===== Publication cards: airier, stronger hierarchy ===== */
html body.openlib-site-index .openlib_journal_grid,
html body.openlib-site-index .openlib_journal_grid.openlib_journal_grid--two {
  grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  gap: 18px !important;
}

html body.openlib-site-index .openlib_journal_card {
  min-height: 300px !important;
  border: 1px solid #DDE5EE !important;
  border-radius: var(--ol-fresh-radius) !important;
  box-shadow: 0 5px 22px rgba(15,23,42,.045) !important;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease !important;
}

html body.openlib-site-index .openlib_journal_card:before {
  width: 100% !important;
  height: 3px !important;
  background: linear-gradient(90deg, #991B1B 0%, #DC2626 48%, #FB7185 100%) !important;
}

html body.openlib-site-index .openlib_journal_card:hover {
  transform: translateY(-4px) !important;
  border-color: #C9D4E1 !important;
  box-shadow: var(--ol-fresh-shadow-hover) !important;
}

html body.openlib-site-index .openlib_journal_main {
  grid-template-columns: 120px minmax(0,1fr) !important;
  gap: 18px !important;
  min-height: 232px !important;
  padding: 18px 18px 16px !important;
}

html body.openlib-site-index .openlib_journal_media,
html body.openlib-site-index .openlib_journal_media a {
  width: 120px !important;
}

html body.openlib-site-index .openlib_journal_media img {
  width: 120px !important;
  max-width: 120px !important;
  height: 170px !important;
  max-height: 170px !important;
  object-fit: cover !important;
  border: 1px solid #D8E0EA !important;
  border-radius: 10px !important;
  background: #fff !important;
  box-shadow: 0 9px 20px rgba(15,23,42,.08) !important;
}

html body.openlib-site-index .openlib_journal_content h3 {
  margin: 1px 0 8px !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
}

html body.openlib-site-index .openlib_journal_content h3 a {
  color: var(--ol-fresh-text) !important;
  font-weight: 800 !important;
  text-decoration: none !important;
}

html body.openlib-site-index .openlib_journal_slug {
  display: inline-flex !important;
  align-items: center;
  min-height: 24px;
  margin: 0 0 10px !important;
  padding: 3px 9px !important;
  border: 1px solid #F4C6CA !important;
  border-radius: 999px !important;
  background: #FFF7F7 !important;
  color: #B91C1C !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
}

html body.openlib-site-index .openlib_journal_content .description,
html body.openlib-site-index .openlib_journal_content .description p {
  color: #43536A !important;
  font-size: 12.5px !important;
  line-height: 1.62 !important;
}

html body.openlib-site-index .openlib_journal_footer {
  padding: 12px 18px 16px !important;
  border-top: 1px solid #E3E9F0 !important;
  background: #FBFCFE !important;
}

html body.openlib-site-index .openlib_journal_actions {
  gap: 10px !important;
}

html body.openlib-site-index .openlib_journal_actions a {
  min-height: 42px !important;
  border-radius: 10px !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
}

/* ===== Global search results: same visual language as homepage ===== */
html body.openlib-site-page .openlib_search_page__heading {
  margin-bottom: 18px !important;
}

html body.openlib-site-page .openlib_search_page__heading h1 {
  margin: 3px 0 5px !important;
  font-size: 29px !important;
}

html body.openlib-site-page .openlib_search_page__heading p {
  color: var(--ol-fresh-muted) !important;
  font-size: 13.5px !important;
}

html body.openlib-site-page .openlib_search_form {
  padding: 14px !important;
  border: 1px solid #DDE5EE !important;
  border-radius: 16px !important;
  background: #fff !important;
  box-shadow: var(--ol-fresh-shadow) !important;
}

html body.openlib-site-page .openlib_search_form__primary input,
html body.openlib-site-page .openlib_search_form__primary select,
html body.openlib-site-page .openlib_search_form__submit {
  border-radius: 10px !important;
  font-size: 13px !important;
}

html body.openlib-site-page .openlib_search_advanced summary {
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

html body.openlib-site-page .openlib_search_results_header {
  margin-top: 28px !important;
  margin-bottom: 14px !important;
  padding-bottom: 13px !important;
}

html body.openlib-site-page .openlib_search_results_header h2 {
  font-size: 24px !important;
}

html body.openlib-site-page .openlib_search_results_count {
  color: #9F1239 !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
}

html body.openlib-site-page .openlib_search_results {
  gap: 14px !important;
}

html body.openlib-site-page .openlib_search_results .obj_article_summary {
  padding: 18px 20px 18px 22px !important;
  border: 1px solid #DDE5EE !important;
  border-radius: 14px !important;
  box-shadow: 0 5px 20px rgba(15,23,42,.04) !important;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

html body.openlib-site-page .openlib_search_results .obj_article_summary:hover {
  transform: translateY(-2px);
  border-color: #CBD5E1 !important;
  box-shadow: 0 12px 28px rgba(15,23,42,.08) !important;
}

html body.openlib-site-page .openlib_search_results .obj_article_summary .title {
  margin-bottom: 8px !important;
  font-size: 16px !important;
  line-height: 1.45 !important;
}

html body.openlib-site-page .openlib_search_results .obj_article_summary .subtitle {
  font-size: 11px !important;
}

html body.openlib-site-page .openlib_search_results .obj_article_summary .meta {
  color: var(--ol-fresh-muted) !important;
  font-size: 12px !important;
}

/* ===== Journal pages: typography and navigation feel less cramped ===== */
html body.openlib-journal-page .openlib_journal_brand__title {
  color: var(--ol-fresh-text) !important;
  font-size: 28px !important;
  line-height: 1.24 !important;
  font-weight: 800 !important;
  letter-spacing: -.03em !important;
}

html body.openlib-journal-page .openlib_journal_header__navrow_inner {
  min-height: 52px !important;
}

html body.openlib-journal-page .openlib_journal_nav a,
html body.openlib-journal-page .openlib_journal_search {
  color: #334155 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

html body.openlib-journal-page .openlib_journal_nav a:hover,
html body.openlib-journal-page .openlib_journal_nav a:focus,
html body.openlib-journal-page .openlib_journal_nav a[aria-current="page"] {
  color: var(--ol-fresh-red) !important;
}

html body.openlib-journal-page .pkp_structure_main {
  color: var(--ol-fresh-text-2) !important;
}

html body.openlib-journal-page .obj_article_summary .title,
html body.openlib-journal-page .obj_article_details .page_title,
html body.openlib-journal-page .current_issue_title,
html body.openlib-journal-page .page_issue .title {
  color: var(--ol-fresh-text) !important;
}

/* ===== Footer ===== */
html body .pkp_structure_footer_wrapper,
html body .pkp_structure_footer {
  color: #475569 !important;
  font-size: 12.5px !important;
}

/* ===== Dark mode keeps contrast, not washed out ===== */
html[data-openlib-color-mode="dark"] body {
  --ol-fresh-text: #F8FAFC;
  --ol-fresh-text-2: #E2E8F0;
  --ol-fresh-muted: #A8B5C7;
  --ol-fresh-soft: #94A3B8;
  --ol-fresh-line: #334155;
  --ol-fresh-canvas: #0B1220;
  --ol-fresh-surface: #111827;
  background: #0B1220 !important;
}

html[data-openlib-color-mode="dark"] body.openlib-site-index .openlib_search_panel,
html[data-openlib-color-mode="dark"] body.openlib-site-page .openlib_search_form,
html[data-openlib-color-mode="dark"] body.openlib-site-index .openlib_journal_card,
html[data-openlib-color-mode="dark"] body.openlib-site-page .openlib_search_results .obj_article_summary {
  border-color: #334155 !important;
  background: #111827 !important;
}

html[data-openlib-color-mode="dark"] body.openlib-site-index .openlib_journal_footer {
  border-color: #334155 !important;
  background: #0F172A !important;
}

html[data-openlib-color-mode="dark"] body.openlib-site-index .openlib_journal_content .description,
html[data-openlib-color-mode="dark"] body.openlib-site-index .openlib_journal_content .description p,
html[data-openlib-color-mode="dark"] body.openlib-site-page .openlib_search_page__heading p {
  color: #CBD5E1 !important;
}

/* ===== Responsive ===== */
@media (max-width: 1023px) {
  html body.openlib-site-page .openlib_site_shell,
  html body.openlib-site-page .pkp_structure_content,
  html body.openlib-journal-page .openlib_journal_shell {
    max-width: calc(100% - 32px) !important;
  }

  html body.openlib-site-index .openlib_journal_main {
    grid-template-columns: 100px minmax(0,1fr) !important;
    gap: 14px !important;
  }

  html body.openlib-site-index .openlib_journal_media,
  html body.openlib-site-index .openlib_journal_media a {
    width: 100px !important;
  }

  html body.openlib-site-index .openlib_journal_media img {
    width: 100px !important;
    max-width: 100px !important;
    height: 142px !important;
    max-height: 142px !important;
  }
}

@media (max-width: 767px) {
  html body { font-size: 13.5px !important; }
  html body .pkp_structure_main h1 { font-size: 25px !important; }
  html body .pkp_structure_main h2 { font-size: 21px !important; }

  html body.openlib-site-index .openlib_search_panel {
    padding: 12px !important;
    border-radius: 14px !important;
  }

  html body.openlib-site-index .openlib_discovery__form {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  html body.openlib-site-index .openlib_discovery__query,
  html body.openlib-site-index .openlib_discovery__form select,
  html body.openlib-site-index .openlib_discovery__form button {
    width: 100% !important;
  }

  html body.openlib-site-index .openlib_journal_tools {
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  html body.openlib-site-index .openlib_journal_filter {
    width: 100% !important;
  }

  html body.openlib-site-index .openlib_journal_grid,
  html body.openlib-site-index .openlib_journal_grid.openlib_journal_grid--two {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  html body.openlib-site-index .openlib_journal_card {
    min-height: 0 !important;
  }

  html body.openlib-site-index .openlib_journal_main {
    grid-template-columns: 88px minmax(0,1fr) !important;
    min-height: 0 !important;
    padding: 15px !important;
  }

  html body.openlib-site-index .openlib_journal_media,
  html body.openlib-site-index .openlib_journal_media a {
    width: 88px !important;
  }

  html body.openlib-site-index .openlib_journal_media img {
    width: 88px !important;
    max-width: 88px !important;
    height: 125px !important;
    max-height: 125px !important;
  }

  html body.openlib-site-index .openlib_journal_content h3 {
    font-size: 14.5px !important;
  }

  html body.openlib-site-index .openlib_journal_content .description,
  html body.openlib-site-index .openlib_journal_content .description p {
    font-size: 11.5px !important;
  }

  html body.openlib-journal-page .openlib_journal_brand__title {
    font-size: 23px !important;
  }
}
