/*!
 * Open Scholar theme: mobile-first, Open Scholar Green (ePublication palette), squared.
 * Base styles are for phones. Wider screens are added with min-width queries.
 * Every corner is square. Green banners carry white text; green text sits on white or soft tints.
 * Distributed under the GNU GPL v3.
 */

:root {
  --alp-accent: #14532d;
  --alp-accent-deep: #123d2a;
  --alp-accent-mid: #1a7a47;
  --alp-ink: #182720;
  --alp-title: #123d2a;
  --alp-muted: #466451;
  --alp-line: #bfd9c7;
  --alp-page: #ffffff;
  --alp-canvas: #f3faf5;
  --alp-meta: #e7f3ea;
  --alp-popup: #f7f7f8;
  --alp-shadow: 0 8px 24px rgba(20, 37, 50, 0.14);
  --alp-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --os-gutter: 16px;
  --os-max: 1120px;
}

/* =====================================================================
   PHONES (base styles)
   ===================================================================== */

html,
body.os-theme {
  height: 100%;
}
body.os-theme {
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--alp-page);
  color: var(--alp-ink);
  font-family: var(--alp-font);
  font-size: 16px;
  line-height: 1.5;
}
body.os-theme .os-page {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--alp-page);
}

/* Type */
body.os-theme h1,
body.os-theme h2,
body.os-theme h3,
body.os-theme h4 {
  color: var(--alp-title);
  font-family: var(--alp-font);
  font-weight: 700;
  line-height: 1.2;
}
body.os-theme h1 {
  font-size: 28px;
  margin: 12px 0 10px;
}
body.os-theme a {
  color: var(--alp-accent);
}
body.os-theme a:hover {
  color: var(--alp-accent-deep);
}
body.os-theme :focus-visible {
  outline: 3px solid var(--alp-accent-mid);
  outline-offset: 2px;
}

/* Skip links: visible only when focused */
body.os-theme .cmp_skip_to_content a:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
body.os-theme .cmp_skip_to_content a:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 3000;
  padding: 10px 14px;
  background: var(--alp-accent);
  color: #fff;
  font-weight: 600;
}

/* ---------- Header: green banner, white text, squared ---------- */
body.os-theme .os-head {
  position: relative;
  z-index: 900;
  background: var(--alp-accent);
  color: #fff;
}
body.os-theme .os-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 56px;
  padding: 8px var(--os-gutter);
  box-sizing: border-box;
}
body.os-theme .os-brand,
body.os-theme .os-brand:hover,
body.os-theme .os-brand:focus {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}
body.os-theme .os-brand__cap {
  width: 36px;
  height: 36px;
  padding: 3px;
  background: #fff;
  object-fit: contain;
  flex: 0 0 auto;
}
body.os-theme .os-brand__name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
body.os-theme .os-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
body.os-theme .os-search {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #fff;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
body.os-theme .os-search:hover {
  background: var(--alp-accent-mid);
  color: #fff;
}
body.os-theme .os-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #fff;
  background: #fff;
  color: var(--alp-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
body.os-theme .os-toggle:hover {
  background: var(--alp-meta);
}
body.os-theme .os-toggle__icon {
  display: inline-block;
  width: 16px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
  margin: 0 0 0 0;
}

/* The menu. On phones it is a squared panel that drops from the bar over the page. */
body.os-theme .os-nav {
  position: relative;
  background: transparent;
}
body.os-theme .os-nav__sheet {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 75vh;
  overflow-y: auto;
  padding: 12px var(--os-gutter) 16px;
  background: #fff;
  border-top: 3px solid var(--alp-accent);
  box-shadow: var(--alp-shadow);
  box-sizing: border-box;
}
body.os-theme .pkp_site_nav_menu--isOpen .os-nav__sheet {
  display: block;
}
body.os-theme .os-nav__title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--alp-muted);
}
body.os-theme .os-nav__links {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  counter-reset: osmenu;
  border-top: 1px solid var(--alp-line);
}
body.os-theme .os-nav__links li {
  counter-increment: osmenu;
  margin: 0;
  border-bottom: 1px solid var(--alp-line);
}
body.os-theme .os-nav__links a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 4px;
  color: var(--alp-ink);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
}
body.os-theme .os-nav__links a::before {
  content: counter(osmenu, decimal-leading-zero);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  background: var(--alp-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
body.os-theme .os-nav__links a:hover,
body.os-theme .os-nav__links a:focus-visible,
body.os-theme .os-nav__links li.current > a {
  background: var(--alp-meta);
  color: var(--alp-accent-deep);
}
body.os-theme .os-nav__account {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
body.os-theme .os-nav__account-menu {
  display: contents;
  list-style: none;
  margin: 0;
  padding: 0;
}
body.os-theme .os-nav__account-menu li {
  margin: 0;
}
body.os-theme .os-nav__account-menu a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--alp-accent);
  background: var(--alp-accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
body.os-theme .os-nav__account-menu a:hover {
  background: var(--alp-accent-deep);
  color: #fff;
}

/* ---------- Content (phone) ---------- */
body.os-theme .pkp_structure_content {
  padding: 16px var(--os-gutter) 12px;
  box-sizing: border-box;
}
body.os-theme .pkp_structure_main {
  min-width: 0;
}
body.os-theme .cmp_breadcrumbs,
body.os-theme .obj_article_details .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: var(--alp-meta);
  color: var(--alp-muted);
  font-size: 13px;
}

/* Section headings: green bar, white text */
body.os-theme .pkp_block .title,
body.os-theme .obj_article_details h2,
body.os-theme .pkp_structure_content h2.section-title {
  display: block;
  margin: 0;
  padding: 10px 12px;
  background: var(--alp-accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

/* Cards: stacked, squared, full width */
body.os-theme .cmp_article_list .obj_article_summary,
body.os-theme .obj_issue_summary,
body.os-theme .obj_announcement_summary,
body.os-theme .obj_galley_link,
body.os-theme .pkp_block {
  background: #fff;
  border: 1px solid var(--alp-line);
  margin: 0 0 12px;
  padding: 14px;
  box-sizing: border-box;
}
body.os-theme .pkp_block {
  background: var(--alp-canvas);
}
body.os-theme .cmp_article_list .obj_article_summary .title a,
body.os-theme .obj_article_summary h2 a {
  color: var(--alp-title);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}
body.os-theme .cmp_article_list .obj_article_summary .meta,
body.os-theme .cmp_article_list .obj_article_summary .date {
  color: var(--alp-muted);
  font-size: 13px;
}
body.os-theme .cmp_article_list .obj_article_summary p {
  color: var(--alp-ink);
  font-size: 15px;
}

/* Status pills: squared */
body.os-theme .pill,
body.os-theme .status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--alp-accent-mid);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

/* Buttons: full width on phones, squared, green */
body.os-theme .pkp_button,
body.os-theme button.pkp_button,
body.os-theme .cmp_button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 0 0 8px;
  padding: 10px 16px;
  box-sizing: border-box;
  border: 1px solid var(--alp-accent);
  background: var(--alp-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
body.os-theme .pkp_button:hover,
body.os-theme button.pkp_button:hover,
body.os-theme .cmp_button:hover {
  background: var(--alp-accent-deep);
  color: #fff;
}
body.os-theme .pkp_button--secondary,
body.os-theme button.pkp_button--secondary {
  background: #fff;
  color: var(--alp-accent);
}
body.os-theme .pkp_button--secondary:hover,
body.os-theme button.pkp_button--secondary:hover {
  background: var(--alp-meta);
  color: var(--alp-accent-deep);
}

/* Fields and tables: squared */
body.os-theme input,
body.os-theme select,
body.os-theme textarea {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--alp-line);
  border-radius: 0;
  background: #fff;
  color: var(--alp-ink);
  font-family: var(--alp-font);
  font-size: 16px;
  box-sizing: border-box;
  max-width: 100%;
}
body.os-theme table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  border: 1px solid var(--alp-line);
}
body.os-theme th {
  padding: 8px 10px;
  background: var(--alp-meta);
  color: var(--alp-accent-deep);
  font-size: 13px;
  text-align: left;
}
body.os-theme td {
  padding: 8px 10px;
  border-top: 1px solid var(--alp-line);
}

/* Popups: on phones, a full-width squared sheet from the bottom */
body.os-theme .pkp_modal_wrapper,
body.os-theme .pkp_modal_overlay,
body.os-theme .ui-widget-overlay {
  z-index: 10000 !important;
}
body.os-theme .pkp_modal_overlay,
body.os-theme .ui-widget-overlay {
  background: rgba(20, 37, 50, 0.5) !important;
}
body.os-theme .pkp_modal_panel,
body.os-theme .ui-dialog,
body.os-theme .pkp_modal_content {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100% !important;
  max-width: none !important;
  max-height: 90vh;
  margin: 0 !important;
  background: var(--alp-popup) !important;
  border: 1px solid var(--alp-line) !important;
  border-bottom: 0 !important;
  border-radius: 0 !important;
  box-shadow: var(--alp-shadow) !important;
  overflow-y: auto;
  box-sizing: border-box;
}
body.os-theme .pkp_modal_title,
body.os-theme .ui-dialog-titlebar {
  background: #fff !important;
  color: var(--alp-title) !important;
  border-bottom: 1px solid var(--alp-line);
  padding: 12px 14px;
  font-weight: 700;
}
body.os-theme .pkp_modal_close,
body.os-theme .pkp_modal_panel_close_box,
body.os-theme .ui-dialog-titlebar-close {
  width: 40px;
  height: 40px;
  background: var(--alp-meta);
  color: var(--alp-accent);
  border: 1px solid var(--alp-line);
  cursor: pointer;
}

/* ---------- Footer (phone): light, stacked, different from the header ---------- */
body.os-theme .os-footer {
  margin-top: 24px;
  background: var(--alp-meta);
  border-top: 4px solid var(--alp-accent);
  color: var(--alp-ink);
}
body.os-theme .os-footer__inner {
  padding: 18px var(--os-gutter) 22px;
  box-sizing: border-box;
}
body.os-theme .os-footer__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--alp-line);
}
body.os-theme .os-footer__cap {
  width: 40px;
  height: 40px;
  padding: 4px;
  background: var(--alp-accent);
  object-fit: contain;
  flex: 0 0 auto;
}
body.os-theme .os-footer__name {
  margin: 0;
  color: var(--alp-title);
  font-size: 16px;
  font-weight: 700;
}
body.os-theme .os-footer__by {
  margin: 0;
  color: var(--alp-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
body.os-theme .os-footer__content {
  font-size: 14px;
}
body.os-theme .os-footer__content a {
  color: var(--alp-accent);
}

/* =====================================================================
   WIDER SCREENS (tablet and desktop)
   ===================================================================== */

@media (min-width: 720px) {
  body.os-theme .pkp_structure_content {
    max-width: var(--os-max);
    margin: 0 auto;
    padding: 24px 24px 16px;
  }
  body.os-theme .os-bar {
    min-height: 64px;
    padding: 8px 24px;
  }
  body.os-theme .os-footer__inner {
    max-width: var(--os-max);
    margin: 0 auto;
    padding: 24px;
  }
  body.os-theme .pkp_modal_panel,
  body.os-theme .ui-dialog,
  body.os-theme .pkp_modal_content {
    left: 50% !important;
    right: auto !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translate(-50%, -50%);
    width: min(640px, 92vw) !important;
    border-bottom: 1px solid var(--alp-line) !important;
  }
}

/* Desktop: one bar with the links across it */
@media (min-width: 960px) {
  body.os-theme .os-head {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-right: 24px;
  }
  body.os-theme .os-bar {
    flex: 0 0 auto;
    min-height: 64px;
    padding: 0 0 0 24px;
  }
  body.os-theme .os-bar__actions {
    order: 3;
  }
  body.os-theme .os-toggle {
    display: none;
  }
  body.os-theme .os-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 64px;
  }
  body.os-theme .os-nav__sheet {
    display: flex;
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    align-items: center;
    gap: 12px;
  }
  body.os-theme .os-nav__title {
    display: none;
  }
  body.os-theme .os-nav__links {
    display: flex;
    flex-direction: row;
    gap: 2px;
    margin: 0;
    border: 0;
  }
  body.os-theme .os-nav__links li {
    border: 0;
    counter-increment: none;
  }
  body.os-theme .os-nav__links a {
    min-height: 44px;
    padding: 8px 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
  }
  body.os-theme .os-nav__links a::before {
    display: none;
  }
  body.os-theme .os-nav__links a:hover,
  body.os-theme .os-nav__links a:focus-visible,
  body.os-theme .os-nav__links li.current > a {
    background: var(--alp-accent-mid);
    color: #fff;
  }
  body.os-theme .os-nav__account {
    display: flex;
    grid-template-columns: none;
    gap: 6px;
  }
  body.os-theme .os-nav__account-menu {
    display: flex;
    gap: 6px;
  }
  body.os-theme .os-nav__account-menu a {
    min-height: 40px;
    padding: 0 14px;
    background: #fff;
    color: var(--alp-accent);
    border-color: #fff;
  }
  body.os-theme .os-nav__account-menu a:hover {
    background: var(--alp-meta);
    color: var(--alp-accent-deep);
  }
  body.os-theme .os-search {
    order: 3;
  }
  body.os-theme .pkp_structure_content {
    padding: 28px 24px 16px;
  }
  body.os-theme .cmp_article_list .obj_article_summary,
  body.os-theme .obj_issue_summary {
    margin-bottom: 14px;
  }
  body.os-theme .pkp_button,
  body.os-theme button.pkp_button,
  body.os-theme .cmp_button {
    width: auto;
    display: inline-flex;
    margin-right: 8px;
  }
  /* Footer: three columns on wide screens */
  body.os-theme .os-footer__inner {
    display: grid;
    grid-template-columns: 1.2fr 2fr;
    gap: 24px;
    align-items: start;
  }
  body.os-theme .os-footer__brand {
    border-bottom: 0;
    margin: 0;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.os-theme *,
  body.os-theme *::before,
  body.os-theme *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* =====================================================================
   HOME DASHBOARD: square buttons (phones 2 across, wide screens 4 across)
   ===================================================================== */
body.os-theme .os-dash {
  margin: 0 0 20px;
}
body.os-theme .os-dash__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--alp-muted);
}
body.os-theme .os-dash__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
body.os-theme .os-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 1 / 1;
  padding: 12px;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--alp-accent);
  color: var(--alp-accent-deep);
  text-decoration: none;
}
body.os-theme .os-tile__no {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--alp-accent-mid);
}
body.os-theme .os-tile__label {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}
body.os-theme .os-tile:hover,
body.os-theme .os-tile:focus-visible {
  background: var(--alp-accent);
  color: #fff;
}
body.os-theme .os-tile:hover .os-tile__no,
body.os-theme .os-tile:focus-visible .os-tile__no {
  color: #fff;
}
@media (min-width: 720px) {
  body.os-theme .os-dash__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }
}

/* =====================================================================
   FOOTER ACCORDIONS: tap a square bar to open its links
   ===================================================================== */
body.os-theme .os-acc-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 12px;
}
body.os-theme .os-acc {
  background: #fff;
  border: 1px solid var(--alp-line);
}
body.os-theme .os-acc__sum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 14px;
  color: var(--alp-title);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
body.os-theme .os-acc__sum::-webkit-details-marker {
  display: none;
}
body.os-theme .os-acc__sum::after {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--alp-accent);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
body.os-theme .os-acc[open] > .os-acc__sum::after {
  content: "\2212";
}
body.os-theme .os-acc[open] > .os-acc__sum {
  background: var(--alp-meta);
  border-bottom: 1px solid var(--alp-line);
}
body.os-theme .os-acc__body {
  padding: 8px 14px 12px;
}
body.os-theme .os-acc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
body.os-theme .os-acc__list li {
  border-bottom: 1px solid var(--alp-line);
}
body.os-theme .os-acc__list li:last-child {
  border-bottom: 0;
}
body.os-theme .os-acc__list a {
  display: block;
  padding: 10px 2px;
  color: var(--alp-accent);
  font-weight: 600;
}
@media (min-width: 720px) {
  body.os-theme .os-acc-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 960px) {
  body.os-theme .os-acc-group {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
