/* css/preview.css — live preview pane styled as the final article */

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.preview-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.preview-stage {
  background: var(--paper-deep);
  padding: 30px 20px;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

/* Continuous-flow preview — one scrolling A4-width column; dashed lines every 297mm */
.preview-flow-host {
  width: 100%;
  display: flex;
  justify-content: center;
}
.preview-flow-host .paper-flow {
  width: 210mm;
  max-width: 210mm;
  margin: 0;
  padding: 19.05mm 18mm 12.7mm;
  background: #fff;
  box-shadow: 0 10px 40px -8px rgba(0,0,0,0.18), 0 2px 8px -2px rgba(0,0,0,0.06);
  box-sizing: border-box;
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.65;
  color: #1a1611;
  /* PDF page-break guides (297mm = A4 height) */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(297mm - 2px),
    rgba(168, 52, 31, 0.22) calc(297mm - 2px),
    rgba(168, 52, 31, 0.22) 297mm
  );
  background-size: 100% 297mm;
  background-repeat: repeat-y;
  background-color: #fff;
  background-origin: content-box;
}
.preview-flow-host.preview-error {
  display: block;
  padding: 24px;
}

.preview-error-msg {
  padding: 24px;
  color: var(--bad, #8b2a1a);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Elsevier title page: css/elsevier-title.css (shared with HTML/PDF export) */

.paper-publisher-note {
  margin: 28px 0 12px;
  padding-top: 14px;
  border-top: 1px solid #ccc;
}
.paper-publisher-note-text {
  font-size: 11px;
  line-height: 1.45;
  text-align: justify;
  color: #444;
  margin: 0;
}

.paper-back-section { margin: 20px 0; }
.paper-back-section h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 10px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 4px;
}
.paper-back-text p { margin-bottom: 10px; text-align: justify; }
.paper-ref-item { page-break-inside: avoid; }
.figure-ref-broken { color: var(--bad); font-weight: 600; }
.figure-ref-node { color: var(--accent); font-weight: 600; }

/* The paper styles below are SHARED with the exported HTML/PDF.
   Keep this section in sync with templates/article.css (or load both). */
.paper {
  background: #ffffff;
  width: 100%;
  max-width: 820px;
  padding: 60px 70px;
  box-shadow: 0 10px 40px -8px rgba(0,0,0,0.18), 0 2px 8px -2px rgba(0,0,0,0.06);
  font-family: var(--font-serif);
  color: #1a1611;
  font-size: 15px;
  line-height: 1.65;
}

.paper-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid #1a1611;
  padding-bottom: 12px;
  margin-bottom: 28px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #444;
}
.paper-header .ph-left { font-weight: 600; }
.paper-header .ph-right { text-align: right; }

.paper-type {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.paper-title {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 18px;
  color: #1a1611;
}
.paper-authors {
  font-size: 16px;
  margin-bottom: 8px;
}
.paper-authors sup { color: var(--accent); font-weight: 600; }
.paper-affils {
  font-size: 12px;
  font-style: italic;
  color: #555;
  margin-bottom: 6px;
  line-height: 1.5;
}
.paper-corresp {
  font-size: 12px;
  color: #555;
  margin-bottom: 24px;
}

.paper-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  background: #faf7ef;
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin-bottom: 24px;
  font-size: 12px;
}
.paper-meta-grid span strong {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #666;
  display: block;
}

.paper-abstract-block {
  background: #faf7ef;
  border: 1px solid #e5dfd0;
  padding: 18px 22px;
  margin-bottom: 22px;
}
.paper-abstract-block h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.paper-abstract-block p { font-size: 14px; line-height: 1.6; text-align: justify; }
.paper-keywords {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #ccc;
  font-size: 13px;
}
.paper-keywords strong {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #666;
  margin-right: 6px;
}

.paper-body h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 14px 0 6px;
  color: #1a1611;
  border-bottom: 1px solid #ddd;
  padding-bottom: 4px;
}
.paper-body h3 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 10px 0 4px;
  color: #1a1611;
}
.paper-body > p {
  text-align: justify;
  hyphens: auto;
  margin: 0 0 0.35em;
  line-height: 1.55;
  text-indent: 0;
  orphans: 2;
  widows: 2;
}
.paper-body > p + p {
  text-indent: 1.5em;
}
.paper-body > h2 + p,
.paper-body > h3 + p {
  text-indent: 0;
}
.paper-body ul,
.paper-body ol {
  margin: 0 0 0.5em 1.5em;
  text-align: justify;
}
.paper-body figure,
.paper-table-wrap {
  margin: 0.6em 0;
  page-break-inside: avoid;
}
.paper-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  margin: 12px 0;
  color: #555;
}
.paper-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: #f5f2ea;
  padding: 2px 5px;
}
.paper-body .citation-node,
.paper-body .citation-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.1s ease;
}
.paper-body a.citation-link:hover {
  color: #0b47a1;
  text-decoration: underline;
}
.paper-body a.citation-link:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
  border-radius: 2px;
}
.paper-table-wrap { margin: 0.75em 0 1em; }
.paper-table-label { font-size: 13px; margin: 0 0 6px; text-align: justify; }
.paper-table-inner { overflow-x: auto; }

.paper-body table.paper-table {
  margin: 0;
  font-size: 13px;
}

.paper-body .table-ref-node {
  font-weight: 600;
  color: var(--accent);
}
.paper-body .math-inline { display: inline; }
.paper-body .math-block { display: block; margin: 1em 0; text-align: center; }
.paper-body .paper-footnotes {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px dashed #ccc;
  font-size: 13px;
}
.paper-body sup.footnote-ref a { color: var(--accent); text-decoration: none; }

.paper-figures { margin: 24px 0; }
.paper-figure {
  break-inside: avoid-page;
  page-break-inside: avoid;
  margin: 18px 0;
  text-align: center;
}
.paper-figure img {
  max-width: 100%;
  max-height: 200mm;
  height: auto;
  border: 1px solid #ddd;
}
.paper-figure figcaption {
  font-size: 12px;
  margin-top: 6px;
  color: #444;
  font-style: italic;
}
.paper-figure figcaption strong {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-right: 6px;
}

.paper-refs h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 24px 0 12px;
  border-bottom: none;
  padding-bottom: 4px;
}
.paper-refs ol {
  list-style: none;
  padding: 0;
  margin: 0;
}
.paper-refs li {
  font-size: 12.5px;
  line-height: 1.32;
  margin: 0;
  padding: 0 0 1px 2em;
  text-align: justify;
  text-indent: -2em;
  border: none;
}
.paper-refs li a {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  border: none;
  margin-left: 6px;
  text-indent: 0;
}
.paper-refs .ref-print-links { white-space: nowrap; }
.paper-refs-list li {
  list-style: none;
  padding: 0 0 1px 2em;
  text-indent: -2em;
  margin: 0;
  line-height: 1.32;
}

.paper-citation-bar {
  margin: 22px 0 8px;
  padding: 14px 18px;
  background: #faf7ef;
  border-left: 3px solid var(--accent);
  font-size: 12.5px;
  font-style: italic;
}
.paper-citation-bar--after-abstract {
  margin: 10px 0 14px;
  border: 1px solid #e5dfd0;
  border-left: 3px solid var(--accent);
}
.el-title-front .paper-citation-bar--after-abstract {
  margin-top: 12px;
  margin-bottom: 0;
}
.paper-citation-bar strong {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #666;
  font-style: normal;
  display: block;
  margin-bottom: 4px;
}

.paper-footer-line {
  margin-top: 40px;
  padding-top: 12px;
  border-top: 1px solid #1a1611;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #555;
}

/* Reference list item: anchor-target highlight when a citation jumps here.
   Uses box-shadow rather than border + padding so the existing
   hanging-indent (padding-left: 2em; text-indent: -2em) is preserved. */
.paper-ref-item:target {
  background: #fff8e1;
  box-shadow: inset 3px 0 0 #f9a825;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

/* Hover card — preview-only progressive enhancement (citationHover.js) */
.citation-hover-card {
  position: absolute;
  z-index: 9999;
  max-width: 380px;
  min-width: 260px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 8px 24px -4px rgba(0,0,0,0.18),
              0 2px 6px -2px rgba(0,0,0,0.08);
  padding: 12px 14px;
  font-family: var(--font-serif, Georgia, serif);
  font-size: 13px;
  line-height: 1.5;
  color: #1a1611;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.citation-hover-card--visible {
  opacity: 1;
  pointer-events: auto;
}
.citation-hover-divider {
  border: none;
  border-top: 1px solid #eee;
  margin: 10px 0;
}
.citation-hover-text {
  font-size: 13px;
  color: #1a1611;
  margin-bottom: 8px;
}
.citation-hover-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.citation-hover-action {
  color: #1a73e8;
  text-decoration: none;
  font-size: 12px;
  font-family: var(--font-mono, monospace);
  border: 1px solid #1a73e8;
  padding: 2px 8px;
  border-radius: 2px;
}
.citation-hover-action:hover {
  background: #1a73e8;
  color: #fff;
}
.citation-hover-missing {
  color: #c62828;
  font-style: italic;
  font-size: 12px;
}

/* Print: the card is interactive UI only — never show it on paper.
   The underlying <a href="#ref-N"> link survives in the PDF. */
@media print {
  .citation-hover-card { display: none !important; }
  .paper-ref-item:target {
    background: none;
    box-shadow: none;
  }
  .paper-body a.citation-link,
  .paper-body a.citation-link:visited {
    color: var(--accent);
    text-decoration: none;
  }
  .paper-body a.citation-link:after { content: none !important; }
}