/* =========================================================================
   PubArx — engagement: subject following, browse filters, paper metrics and sharing.
   Loaded after pubarx.css and panel.css; colours come from the theme tokens only.
   ========================================================================= */

/* ------------------------------------------------------------------ follow button */

.follow { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }
.follow-form { display: inline-flex; margin: 0; }
.follow-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.82rem; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer;
  text-decoration: none; transition: background-color .15s, border-color .15s, color .15s;
}
.follow-btn svg { width: 14px; height: 14px; }
a.follow-btn:hover, button.follow-btn:hover { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; }
.follow-btn.is-following {
  background: var(--brand-soft); color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 35%, transparent);
}
.follow-btn .when-hover { display: none; }
.follow-btn.is-following:hover, .follow-btn.is-following:focus-visible {
  background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}
.follow-btn.is-following:hover .when-idle, .follow-btn.is-following:focus-visible .when-idle { display: none; }
.follow-btn.is-following:hover .when-hover, .follow-btn.is-following:focus-visible .when-hover { display: inline; }
.follow-btn.is-covered { cursor: default; background: transparent; border-style: dashed; color: var(--text-3); font-weight: 500; }
.follow-count { font-size: 0.82rem; color: var(--text-3); white-space: nowrap; }

/* ------------------------------------------------------------------ subjects page */

.follow-intro {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 24px; border-radius: var(--radius);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
  font-size: 0.93rem; color: var(--text);
}
.follow-intro > div { flex: 1; min-width: 220px; }
.follow-intro strong { margin-right: 4px; }
.follow-intro-icon {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); color: var(--brand); flex-shrink: 0;
}
.follow-intro-icon svg { width: 18px; height: 18px; }

.subject-cards { align-items: start; }
.field-head { flex-wrap: wrap; align-items: flex-start; }
.field-head-text { min-width: 0; flex: 1; }
.field-head h2 a { color: var(--text); }
.field-head h2 a:hover { color: var(--link); text-decoration: none; }
.subject-meta { display: block; font-size: 0.8rem; color: var(--text-3); margin-top: 2px; }

.subject-rows { list-style: none; margin: 0; padding: 0; font-size: 0.93rem; }
.subject-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.subject-row:last-child { border-bottom: 0; padding-bottom: 0; }
.subject-row:first-child { padding-top: 4px; }
.subject-row-main { min-width: 0; display: flex; flex-direction: column; }
.subject-row-main a { font-weight: 550; overflow-wrap: anywhere; }
.subject-row:target, .card:target { scroll-margin-top: 96px; }
.subject-row:target .subject-row-main a { color: var(--accent); }

/* ------------------------------------------------------------------ list pages */

/* Own class names (not .list-toolbar / .segmented): rankings.css styles those for other pages. */
.list-title { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 6px; }
.list-title h1 { margin: 0; }
.browse-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
}

.browse-filter {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.browse-filter a {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 14px; border-radius: 999px;
  color: var(--text-2); font-size: 0.85rem; font-weight: 550; white-space: nowrap;
}
.browse-filter a svg { width: 14px; height: 14px; }
.browse-filter a:hover { color: var(--text); text-decoration: none; }
.browse-filter a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: var(--shadow-sm); }

/* Type of paper (research article, technical report, ...) above the listing. */
.type-filter { margin: 4px 0 14px; }
.type-filter .chip { gap: 6px; }
.type-filter .chip[aria-current="page"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.chip-count { color: var(--text-3); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.type-filter .chip[aria-current="page"] .chip-count { color: inherit; }

/* ------------------------------------------------------------------ news */

.news-list { list-style: none; margin: 0; padding: 0; }
.news-item { padding: 18px 0; border-bottom: 1px solid var(--border); }
.news-item:first-child { padding-top: 4px; }
.news-item time { display: block; margin-bottom: 4px; font-size: 0.82rem; color: var(--text-3); }
.news-item h2, .news-item h3 { margin: 0 0 6px; font-size: 1.2rem; line-height: 1.3; }
.news-item h2 a, .news-item h3 a { color: var(--text); }
.news-item h2 a:hover, .news-item h3 a:hover { color: var(--link); }
.news-item p { margin: 0; color: var(--text-2); }
.news-list-compact .news-item { padding: 10px 0; }
.news-list-compact .news-item h3 { margin: 0; font-size: 1rem; }
.news-meta { margin: 0; font-size: 0.9rem; color: var(--text-3); }
.news-body table { width: 100%; margin: 0 0 1em; border-collapse: collapse; font-size: 0.95rem; }
.news-body th, .news-body td { padding: 6px 10px; border: 1px solid var(--border); text-align: left; }
.news-body pre { overflow-x: auto; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.news-body code { font-family: var(--font-mono); font-size: 0.9em; }
.news-more { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.news-more h2 { margin-bottom: 4px; font-size: 1.1rem; }

/* ------------------------------------------------------------------ conferences and workshops */

.venue-group { margin-bottom: 28px; }
.venue-group > h2 { margin-bottom: 4px; font-size: 1.15rem; }
.venue-list { list-style: none; margin: 0; padding: 0; }
.venue-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.venue-item h3 { margin: 6px 0; font-size: 1.15rem; line-height: 1.3; }
.venue-item h3 a { color: var(--text); }
.venue-item h3 a:hover { color: var(--link); }
.venue-item p { margin: 0; color: var(--text-2); }
.venue-short { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.venue-item-meta, .venue-item-foot { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; font-size: 0.84rem; color: var(--text-3); }
.venue-item-foot { margin-top: 8px; }
.venue-item-foot:empty { display: none; }
.venue-head .venue-item-meta { margin-bottom: 8px; }
.venue-item.has-image { display: grid; grid-template-columns: minmax(0, 1fr) 168px; gap: 18px; align-items: start; }
.venue-thumb {
  display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
}
.venue-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* The venue's image: a wide banner across the page, or a poster or logo at its own shape above the text. */
.venue-figure { margin: 0 0 24px; }
.venue-figure a { display: inline-block; max-width: 100%; border-radius: var(--radius); }
.venue-figure img {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 520px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2);
}
.venue-figure.is-wide { margin-bottom: 28px; }
.venue-figure.is-wide a { display: block; width: fit-content; margin-inline: auto; }
.venue-figure.is-wide img { max-height: 440px; }
.venue-figure figcaption { margin-top: 6px; font-size: 0.8rem; color: var(--text-3); }
.venue-image-current { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.venue-image-current img {
  display: block; width: 160px; height: auto; max-height: 120px; object-fit: contain;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
}
@media (max-width: 640px) {
  .venue-item.has-image { grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; }
  .venue-figure img { max-height: 420px; }
}
.venue-how { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); }
.venue-how h2 { margin-bottom: 8px; font-size: 1.1rem; }
.venue-how ol { margin: 0 0 12px; padding-left: 1.3em; color: var(--text-2); }
.venue-how li + li { margin-top: 6px; }
.venue-body { margin-bottom: 8px; }
.venue-body > :first-child { margin-top: 0; }
#accepted h2 .count { margin-left: 6px; font-size: 0.85rem; font-weight: 500; color: var(--text-3); }

/* The submitter's card on the paper page and invited reviews. */
.venue-track { list-style: none; margin: 0; padding: 0; }
.venue-track li { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.venue-track li:first-child { padding-top: 0; }
.venue-track li:last-child { border-bottom: 0; padding-bottom: 0; }
.venue-track-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-weight: 600; }
.venue-note {
  margin-top: 6px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); white-space: pre-line;
}
.review-venue { margin-top: 6px; }
.review-venue .badge:hover { text-decoration: none; filter: brightness(0.97); }

/* Administration and the researcher panel. */
.venue-moves { gap: 8px; }
.venue-moves form { margin: 0; }
.venue-invite > label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.92rem; }
.venue-invite .row { gap: 8px; flex-wrap: nowrap; }
.venue-invite .input { flex: 1; min-width: 0; }
.venue-suggestions ul { list-style: none; margin: 6px 0 0; padding: 0; }
.venue-suggestions li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.venue-suggestions li:last-child { border-bottom: 0; }
.venue-suggestions form { margin: 0; }
.venue-reviews { list-style: none; margin: 0; padding: 0; }
.venue-reviews li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.venue-reviews li:last-child { border-bottom: 0; }
.venue-reviews li > div { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
.venue-decline { margin-top: 8px; font-size: 0.86rem; }
.venue-decline summary { cursor: pointer; color: var(--text-3); }
.venue-decline form { margin-top: 8px; max-width: 460px; }
@media (max-width: 640px) {
  .venue-invite .row { flex-wrap: wrap; }
}

/* ------------------------------------------------------------------ paper page */

/* Full text: the PDF reader (public/js/pdf-viewer.js). Pages stay white in the dark theme, like paper. */
.full-text-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.full-text-head h2 { margin: 0; }
.pdf-launch { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.pdf-launch .row { margin-top: 12px; gap: 8px; }
.pdf-status { margin-top: 10px; }
.pdf-status:empty { display: none; }
.pdf-toolbar { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; font-size: 0.86rem; color: var(--text-2); }
.pdf-toolbar[hidden], .pdf-stage[hidden], .pdf-launch[hidden], .full-text [hidden] { display: none; }
.pdf-pages, .pdf-zoom { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pdf-zoom { min-width: 3.6em; text-align: center; }
.pdf-tools { display: inline-flex; align-items: center; gap: 2px; }
.pdf-tool {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--text-2); cursor: pointer;
}
.pdf-tool:hover { border-color: var(--border); background: var(--surface-2); color: var(--text); text-decoration: none; }
.pdf-tool:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.pdf-tool[aria-pressed="true"] { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.pdf-tool svg { width: 16px; height: 16px; }
.pdf-stage {
  position: relative; height: min(85vh, 1100px); min-height: 420px; overflow: auto; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overscroll-behavior: contain;
}
.pdf-stage:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pdf-page { position: relative; margin: 0 auto 16px; background: #fff; box-shadow: 0 0 0 1px var(--border); }
.pdf-page:last-child { margin-bottom: 0; }
.pdf-page canvas { display: block; }
.pdf-links a { position: absolute; z-index: 2; border-radius: 2px; }
.pdf-links a:hover, .pdf-links a:focus-visible { background: rgb(30 58 110 / 0.12); }
[data-pdf-viewer]:fullscreen { display: flex; flex-direction: column; margin: 0; padding: 12px 16px 16px; background: var(--surface); }
[data-pdf-viewer]:fullscreen .pdf-stage { flex: 1; height: auto; min-height: 0; }
@media (max-width: 640px) {
  .pdf-stage { height: 78vh; min-height: 360px; padding: 8px; }
  .pdf-page { margin-bottom: 8px; }
}
@media print { .full-text { display: none; } }

/* Text layer from pdf.js (web/pdf_viewer.css, Apache-2.0): invisible, selectable text over each page. */
.pdf-page .textLayer {
  position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1;
  -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none;
  transform-origin: 0 0; caret-color: CanvasText; z-index: 0;
}
.pdf-page .textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.pdf-page .textLayer > :not(.markedContent), .pdf-page .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.pdf-page .textLayer span.markedContent { top: 0; height: 0; }
.pdf-page .textLayer span[role="img"] { -webkit-user-select: none; user-select: none; cursor: default; }
.pdf-page .textLayer ::selection { background: rgb(0 0 255 / 0.25); }
.pdf-page .textLayer br::selection { background: transparent; }
.pdf-page .textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; -webkit-user-select: none; user-select: none; }
.pdf-page .textLayer.selecting .endOfContent { top: 0; }

.related-papers { list-style: none; margin: 0 0 10px; padding: 0; }
.related-papers li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.related-papers a { display: block; font-family: var(--font-serif); font-weight: 600; line-height: 1.35; color: var(--text); }
.related-papers a:hover { color: var(--link); }
.related-papers span { display: block; margin-top: 3px; font-size: 0.8rem; color: var(--text-3); }

.crumb-row { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.crumb-row .breadcrumbs { margin-bottom: 0; }

.metric-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.metric-pair > div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.metric-pair dt { font-size: 0.76rem; color: var(--text-3); }
.metric-pair dd { margin: 2px 0 0; font-family: var(--font-serif); font-size: 1.45rem; font-weight: 600; line-height: 1.15; color: var(--text); }

.share-url { height: 32px; padding-top: 4px; padding-bottom: 4px; font-size: 0.82rem; color: var(--text-2); }
.share-links { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.share-links a {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 0.84rem; font-weight: 550; white-space: nowrap;
}
.share-links a:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.share-links svg { color: var(--text-3); }

@media (max-width: 480px) {
  .browse-toolbar { align-items: flex-start; flex-direction: column; }
  .browse-filter { width: 100%; }
  .browse-filter a { flex: 1; justify-content: center; padding: 0 10px; }
}

@media print {
  .follow, .browse-filter, .type-filter, #share { display: none !important; }
}
