/* ==========================================================
   ARTICLE VIEW
   Scoped to .av-* so nothing here can reach the 123 other
   places that use a bare "content" class.
   ========================================================== */

:root {
  --av-brand: #15588c;
  --av-brand-dark: #0e3f69;
  --av-ink: #1a2332;
  --av-ink-soft: #34495f;
  --av-muted: #5b6b7f;
  --av-line: #e3e8ef;
  --av-surface: #f6f9fc;
  --av-radius: 10px;
  --av-shadow: 0 1px 2px rgba(16, 34, 56, .06), 0 8px 24px rgba(16, 34, 56, .07);
}

.av-shell {
  padding-top: 28px;
  padding-bottom: 56px;
}

/* ---------- header ---------- */

.av-header {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--av-line);
  margin-bottom: 28px;
}

.av-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.av-journal {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--av-brand);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.av-journal:hover,
.av-journal:focus {
  color: var(--av-brand-dark);
  border-bottom-color: currentColor;
  text-decoration: none;
}

.av-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  line-height: 1.6;
}

.av-chip--type {
  background: #eaf2f9;
  color: var(--av-brand);
}

.av-chip--oa {
  background: #e8f6ee;
  color: #17714a;
}

.av-chip--oa img {
  display: block;
  opacity: .85;
}

.av-title {
  font-size: clamp(1.5rem, 1.15rem + 1.7vw, 2.25rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--av-ink);
  margin: 0 0 12px;
}

.av-authors {
  /* Scholar asks for the authors just under the title, larger than body text.
     Body copy is ~1rem and .av-title tops out at 2.25rem, so sit between. */
  font-size: clamp(1.0625rem, 1rem + .4vw, 1.25rem);
  line-height: 1.4;
  font-weight: 600;
  color: var(--av-muted);
  margin: 0 0 16px;
}

.av-meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  padding: 0;
  margin: 0 0 22px;
  font-size: .8125rem;
  color: var(--av-muted);
}

.av-meta__k {
  font-weight: 600;
  color: var(--av-ink);
  margin-right: 4px;
}

.av-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.av-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--av-line);
  border-radius: var(--av-radius);
  background: #fff;
  color: var(--av-ink);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.av-btn:hover,
.av-btn:focus {
  background: var(--av-surface);
  border-color: #c8d3e0;
  color: var(--av-brand);
  text-decoration: none;
}

.av-btn:focus-visible {
  outline: 2px solid var(--av-brand);
  outline-offset: 2px;
}

.av-btn--primary {
  background: var(--av-brand);
  border-color: var(--av-brand);
  color: #fff;
}

.av-btn--primary:hover,
.av-btn--primary:focus {
  background: var(--av-brand-dark);
  border-color: var(--av-brand-dark);
  color: #fff;
}

.av-btn--ghost {
  border-style: dashed;
  color: var(--av-muted);
}

.av-btn--quiet {
  border: none;
  background: none;
  color: var(--av-muted);
  font-weight: 500;
  padding-left: 4px;
  padding-right: 4px;
}

.av-btn--sm {
  padding: 6px 12px;
  font-size: .8125rem;
}

.av-btn__i {
  flex: none;
  opacity: .8;
}

/* ---------- expandable panels ---------- */

.av-panel {
  border: 1px solid var(--av-line);
  border-left: 3px solid var(--av-brand);
  border-radius: var(--av-radius);
  background: var(--av-surface);
  padding: 16px 18px;
  margin: 0 0 24px;
}

.av-panel[hidden] {
  display: none;
}

.av-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.av-panel__title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--av-ink);
  margin: 0;
  letter-spacing: .01em;
}

.av-panel__close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--av-muted);
  cursor: pointer;
  padding: 0 2px;
}

.av-panel__close:hover {
  color: var(--av-ink);
}

/* ---------- citation ---------- */

#avCiteText {
  font-size: .875rem;
  line-height: 1.65;
  color: var(--av-ink);
  background: #fff;
  border: 1px solid var(--av-line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

#avCiteText p {
  margin: 0;
}

#avCiteText a {
  color: var(--av-brand);
  overflow-wrap: anywhere;
}

.av-cite__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.av-cite__note {
  margin: 10px 0 0;
  font-size: .8125rem;
  color: #17714a;
  min-height: 1.2em;
}

.av-share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.av-share__btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--av-line);
  background: #fff;
  color: var(--av-ink);
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: none;
}

.av-share__btn:hover,
.av-share__btn:focus {
  background: var(--av-brand);
  border-color: var(--av-brand);
  color: #fff;
  text-decoration: none;
}

/* ---------- body + sticky contents ---------- */

.av-body {
  display: block;
}

.av-toc {
  margin: 0 0 24px;
  border: 1px solid var(--av-line);
  border-radius: var(--av-radius);
  background: var(--av-surface);
  padding: 14px 16px;
}

.av-toc[hidden] {
  display: none;
}

.av-toc__title {
  margin: 0 0 8px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--av-muted);
}

.av-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: avtoc;
}

.av-toc__list li {
  margin: 0;
}

.av-toc__list a {
  display: block;
  padding: 5px 0 5px 12px;
  border-left: 2px solid transparent;
  color: var(--av-muted);
  font-size: .875rem;
  line-height: 1.45;
  text-decoration: none;
}

.av-toc__list a:hover {
  color: var(--av-brand);
  text-decoration: none;
}

.av-toc__list a[aria-current="true"] {
  border-left-color: var(--av-brand);
  color: var(--av-brand);
  font-weight: 600;
}

.av-toc__list .av-toc__sub a {
  padding-left: 26px;
  font-size: .8125rem;
}

/* ---------- article content ---------- */

.av-article {
  font-size: 1.0625rem;
  line-height: 1.78;
  color: var(--av-ink);
}

.av-article h2,
.av-article h3,
.av-article h4 {
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.01em;
  margin: 2em 0 .7em;
}

/* Each level takes its own size, weight and colour so the hierarchy stays
   scannable down a long paper. h4 used to be 1.0625rem, exactly the body
   size, so it read as a bold paragraph rather than a heading. */
.av-article h2 { font-size: 1.4375rem; color: var(--av-ink); }
.av-article h3 { font-size: 1.25rem; color: var(--av-brand-dark); }
.av-article h4 { font-size: 1.125rem; font-weight: 600; color: var(--av-ink-soft); }

.av-article h2:first-child,
.av-article h3:first-child,
.av-article h4:first-child {
  margin-top: 0;
}

.av-article p {
  margin: 0 0 1.1em;
}

.av-article td p {
  margin-bottom: 0;
}

.av-article a {
  color: var(--av-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.av-article a:hover {
  color: var(--av-brand-dark);
}

/* Editors paste a dates row and a citation block into the article body.
   The dates row is hidden because the meta row now carries Published,
   Accepted and Received properly. The citation block stays visible: for
   older articles it is original content, and the Cite panel falls back
   to it, which for many articles is the only place a DOI exists. New
   articles take their citation from the admin field instead, so their
   body stays clean. */
.av-article #border {
  display: none;
}

.av-block {
  display: flow-root;
}

.av-block:empty {
  display: none;
}

.av-block--refs {
  margin-top: 2.5em;
  padding-top: 1.75em;
  border-top: 1px solid var(--av-line);
  font-size: .9375rem;
}

.av-article img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 1.25em auto;
  background: var(--av-surface);
}

.av-article figure {
  margin: 1.5em 0;
  text-align: center;
}

.av-article figcaption {
  font-size: .875rem;
  color: var(--av-muted);
  margin-top: .6em;
}

.av-article blockquote {
  margin: 1.4em 0;
  padding: .25em 0 .25em 1.1em;
  border-left: 3px solid var(--av-line);
  color: var(--av-muted);
}

.av-article table,
.av-article table[align="center"] {
  display: table;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.5em auto !important;
  font-size: .9375rem;
  background: #fff;
  box-shadow: var(--av-shadow);
}

.av-article p[align="center"],
.av-article .av-centered-caption {
  text-align: center;
}

.av-article p[align="center"] img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.av-article th,
.av-article td {
  border: 1px solid var(--av-line);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
  min-width: 90px;
}

.av-article th[align="center"],
.av-article td[align="center"],
.av-article th[align="center"] p,
.av-article td[align="center"] p {
  text-align: center !important;
}

.av-article th[align="right"],
.av-article td[align="right"],
.av-article th[align="right"] p,
.av-article td[align="right"] p {
  text-align: right !important;
}

.av-article th {
  background: var(--av-surface);
  font-weight: 700;
  color: var(--av-ink);
}

.av-article tbody tr:nth-child(even) td {
  background: #fbfcfe;
}

.av-article ul,
.av-article ol {
  margin: 0 0 1.1em;
  padding-left: 1.4em;
}

.av-article li {
  margin-bottom: .4em;
}

/* ---------- licence ---------- */

.av-license {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--av-line);
}

.av-license__text {
  margin: 0;
  font-size: .8125rem;
  line-height: 1.7;
  color: var(--av-muted);
  max-width: 74ch;
}

.av-license__text a {
  color: var(--av-brand);
}

/* ---------- responsive ---------- */

@media (min-width: 640px) {
  .av-meta {
    gap: 8px 28px;
  }
}

@media (min-width: 1100px) {
  .av-body {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 44px;
    align-items: start;
  }

  .av-toc {
    grid-column: 1;
    position: sticky;
    top: 88px;
    margin: 0;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: none;
    border: none;
    border-right: 1px solid var(--av-line);
    border-radius: 0;
    padding: 0 18px 0 0;
  }

  .av-article {
    grid-column: 2;
  }

  /* A missing contents list must not leave a phantom 232px gutter behind:
     display:none drops the TOC out of the grid, and auto-placement would
     otherwise squeeze the article into the narrow first track. */
  .av-toc[hidden] ~ .av-article {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .av-btn {
    transition: none;
  }
}

/* ==========================================================
   Modal (kept from the previous stylesheet)
   ========================================================== */

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  inset: 0;
  background: rgba(15, 28, 42, .55);
  padding: 20px;
  overflow-y: auto;
}

.modal-content {
  background: #fff;
  margin: 8vh auto;
  max-width: 460px;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(10, 25, 45, .28);
  padding: 26px 26px 24px;
  position: relative;
}

.modal-content h4 {
  margin: 0 0 16px;
  font-size: 1.0625rem;
  color: #1a2332;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #5b6b7f;
  cursor: pointer;
}

.close-btn:hover {
  color: #1a2332;
}

.modal-content form input {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  font-size: .9375rem;
  box-sizing: border-box;
}

.modal-content form input:focus {
  outline: none;
  border-color: #15588c;
  box-shadow: 0 0 0 3px rgba(21, 88, 140, .12);
}

.modal-content form button {
  width: 100%;
  margin-top: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #15588c;
  color: #fff;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
}

.modal-content form button:hover {
  background: #0e3f69;
}
