/* ==========================================================================
   Article / publication reading page
   ========================================================================== */

.article-head {
  padding-top: clamp(7rem, 12vw, 10rem);
  padding-bottom: clamp(2rem, 4vw, 3rem);
  position: relative;
}
.article-head .wrap-read { max-width: 780px; margin-inline: auto; padding-inline: clamp(1.15rem, 4vw, 2.5rem); }
.crumbs { font-family: var(--f-ui); font-size: .78rem; letter-spacing: .04em; color: var(--ink-3);
  margin-bottom: 1.6rem; display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--pine); }
.crumbs .sep { color: var(--line-2); }

.ah-meta-top { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.article-title { font-size: var(--step-4); line-height: 1.08; letter-spacing: -.018em; margin: 0 0 1rem; font-weight: 400; }
.article-authors { font-family: var(--f-body); font-size: var(--step-1); color: var(--ink-2); font-style: italic; margin: 0 0 1.4rem; }
.article-pubmeta { font-family: var(--f-ui); font-size: .9rem; color: var(--ink-3); line-height: 1.6;
  padding-top: 1.3rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.article-pubmeta .venue { color: var(--pine); font-weight: 600; }

.article-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.6rem; }

/* Availability / rights note */
.rights-note {
  max-width: 780px; margin: 1.8rem auto 0; padding-inline: clamp(1.15rem, 4vw, 2.5rem);
}
.rights-note .rn-inner {
  font-family: var(--f-ui); font-size: .84rem; line-height: 1.55; color: var(--ink-2);
  background: var(--card-2); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: .95rem 1.2rem;
}
.rights-note.abstract .rn-inner { border-left-color: var(--t-abstract); }

/* Body */
.article-body { max-width: var(--measure); margin: clamp(2rem,4vw,3rem) auto 0; padding-inline: clamp(1.15rem, 4vw, 2.5rem);
  font-size: 1.16rem; line-height: 1.75; }
.article-body > p:first-of-type::first-letter {
  font-family: var(--f-display); font-size: 3.6em; line-height: .82; float: left; margin: .06em .12em -.06em 0;
  color: var(--pine); font-weight: 500;
}
.article-body.no-dropcap > p:first-of-type::first-letter { font-size: inherit; float: none; margin: 0; color: inherit; font-family: inherit; }
.article-body p { margin: 0 0 1.3em; }
.article-body h2 { font-size: var(--step-2); margin: 2.2em 0 .5em; letter-spacing: -.01em; }
.article-body h3 { font-size: var(--step-1); margin: 1.8em 0 .4em; }
.article-body h2 + p, .article-body h3 + p { margin-top: 0; }
.article-body a { color: var(--pine-2); border-bottom: 1px solid var(--line-2); transition: border-color .3s; }
.article-body a:hover { border-bottom-color: var(--gold); }
.article-body ul, .article-body ol { margin: 0 0 1.3em; padding-left: 1.4em; }
.article-body li { margin: 0 0 .5em; }
.article-body blockquote { margin: 1.6em 0; padding: .2em 0 .2em 1.5em; border-left: 2px solid var(--gold);
  font-style: italic; color: var(--ink-2); font-size: 1.05em; }
.article-body img { border-radius: var(--radius-sm); margin: 1.8em auto; box-shadow: var(--shadow-2); }
/* Academic tables: small text, generous column spacing, clean top/header/bottom rules */
.article-body .tablewrap { margin: 2.3em 0; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.article-body .tablewrap .table-caption { font-family: var(--f-ui); font-size: .82rem; font-weight: 600;
  color: var(--ink); margin-bottom: .7em; line-height: 1.4; }
.article-body table { border-collapse: collapse; margin: 2.3em 0; font-family: var(--f-ui); font-size: .76rem;
  line-height: 1.45; color: var(--ink-2); width: auto; max-width: 100%;
  border-top: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); }
.article-body .tablewrap table { margin: 0; }
.article-body th, .article-body td { text-align: left; vertical-align: top; white-space: normal;
  padding: .5em 1.7em .5em 0; }
.article-body th:first-child, .article-body td:first-child { padding-left: .15em; }
.article-body th:last-child, .article-body td:last-child { padding-right: .3em; }
.article-body tr:first-child > * { font-weight: 600; color: var(--ink); vertical-align: bottom;
  border-bottom: 1px solid var(--ink-3); padding-top: .3em; padding-bottom: .55em; }
.article-body table th { background: none; font-weight: 600; }
.article-body hr { border: 0; height: 1px; background: var(--line); margin: 2.4em 0; }

/* Abstract lead block */
.abstract-block { max-width: var(--measure); margin: clamp(2rem,4vw,3rem) auto 0; padding-inline: clamp(1.15rem, 4vw, 2.5rem); }
.abstract-block .ab-label { font-family: var(--f-ui); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin-bottom: .9rem; display: block; }
.abstract-block p { font-size: 1.18rem; line-height: 1.7; color: var(--ink); }
.abstract-block .ab-first { font-family: var(--f-display); }

/* References / footnotes (mammoth emits sup + ol) */
.article-body .references, .article-body .footnotes,
.article-body h2.references-h { }
/* References section: nested inside .article-body, so reset its width/padding and give
   the list quieter type with a classic hanging indent (one <p> per reference). */
.article-body .references-section { max-width: none; margin: 2.8rem 0 0; padding: 1.9rem 0 0;
  border-top: 1px solid var(--line); }
.article-body .references-section h2 { font-size: var(--step-1); margin: 0 0 1.1rem; }
.article-body .references-section p,
.article-body .references-section li {
  font-family: var(--f-ui); font-size: .85rem; line-height: 1.52; color: var(--ink-2);
  margin: 0 0 .6em; padding-left: 1.6em; text-indent: -1.6em; }
.article-body .references-section li { text-indent: 0; padding-left: 0; }
.article-body .references-section ol { padding-left: 1.5em; }
.article-body .references-section p:first-of-type::first-letter { font-size: inherit; float: none; margin: 0; color: inherit; font-family: inherit; }
.article-body sup a, .article-body a[id^="footnote-ref"] { color: var(--gold); border: 0; font-weight: 600; }

/* Citation box */
.cite-box { max-width: var(--measure); margin: 2.5rem auto 0; padding-inline: clamp(1.15rem, 4vw, 2.5rem); }
.cite-box .cb-inner { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow-1); }
.cite-box .cb-label { font-family: var(--f-ui); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin-bottom: .8rem; display: flex; justify-content: space-between; align-items: center; }
.cite-box .cb-text { font-family: var(--f-ui); font-size: .92rem; line-height: 1.6; color: var(--ink-2); }
.copy-btn { font-family: var(--f-ui); font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--pine); background: var(--pine-soft); border: 1px solid rgba(45,88,73,.18); border-radius: 100px; padding: .35em .85em;
  cursor: pointer; transition: all .3s var(--ease); }
.copy-btn:hover { background: var(--pine); color: #fff; }
.copy-btn.done { background: var(--t-full); color: #fff; border-color: transparent; }

/* Related */
.related-section { border-top: 1px solid var(--line); margin-top: clamp(3rem,6vw,5rem); }

/* Book listing page */
.book-hero { padding-top: clamp(7rem,12vw,10rem); }
.book-cover-lg { aspect-ratio: 2 / 3; border-radius: 6px; box-shadow: var(--shadow-3); overflow: hidden; }

/* ---- Reading progress bar ---- */
.read-progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; transform: scaleX(0); transform-origin: left;
  background: linear-gradient(90deg, var(--gold-2), var(--gold)); z-index: 120; will-change: transform; }

/* ---- Reading layout with margin column for TOC + sidenotes ---- */
.reading { max-width: 1200px; margin-inline: auto; position: relative;
  padding-inline: clamp(1.15rem, 4vw, 2.5rem); }

/* Sticky contents (left margin on wide screens) */
.toc-rail { display: none; }
.reading-main { min-width: 0; }
@media (min-width: 1180px) {
  .toc-rail.has-items { display: block; position: absolute; top: 0; bottom: 0;
    left: calc(50% - 590px); width: 200px; }
  .toc-rail .toc-inner { position: sticky; top: 108px; font-family: var(--f-ui);
    max-height: calc(100vh - 130px); overflow-y: auto; }
  .toc-rail .toc-title { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold);
    font-weight: 600; margin-bottom: 1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
  .toc-rail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
  .toc-rail a { font-size: .82rem; line-height: 1.35; color: var(--ink-3); display: block; padding-left: .8rem;
    border-left: 2px solid transparent; transition: color .3s var(--ease), border-color .3s var(--ease); }
  .toc-rail a:hover { color: var(--ink); }
  .toc-rail a.active { color: var(--pine); border-left-color: var(--gold); font-weight: 500; }
}

/* ---- Margin sidenotes (footnotes) ---- */
.article-body .sidenote { display: none; }
.fn-list { max-width: var(--measure); margin: 2.5rem auto 0; padding: 2rem clamp(1.15rem,4vw,2.5rem) 0;
  border-top: 1px solid var(--line); font-family: var(--f-ui); font-size: .86rem; line-height: 1.55; color: var(--ink-2); }
.fn-list .fnl-title { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold);
  font-weight: 600; margin-bottom: 1rem; }
.fn-list ol { padding-left: 1.3em; margin: 0; }
.fn-list li { margin-bottom: .7em; }
.fn-list li p { margin: 0 0 .3em; }
.fn-back { border: 0 !important; color: var(--gold); margin-left: .3em; }
.fn-flash { background: var(--gold-soft); border-radius: 4px; transition: background 1.2s ease; }
sup.fn-ref { font-size: .68em; line-height: 0; }
sup.fn-ref a { color: var(--gold); border: 0; font-weight: 600; padding: 0 .1em; }

@media (min-width: 1180px) {
  .article-body .sidenote {
    display: block; float: right; clear: right; width: 250px; margin-right: -290px; margin-top: .1rem; margin-bottom: 1rem;
    font-family: var(--f-ui); font-size: .8rem; line-height: 1.5; color: var(--ink-3); text-align: left;
    padding-left: 1rem; border-left: 1px solid var(--line-2); position: relative;
  }
  .article-body .sidenote .sn-num { color: var(--gold); font-weight: 600; margin-right: .3em; }
  .article-body .sidenote p { margin: 0; }
  .fn-list { display: none; }
}

/* ---- Recovered published tables (figures) ---- */
.article-tables { max-width: 820px; margin: clamp(3rem, 6vw, 5rem) auto 0;
  padding: 2.5rem clamp(1.15rem, 4vw, 2.5rem) 0; border-top: 1px solid var(--line); }
.article-tables .wrap-read { max-width: none; margin: 0; padding: 0; }
.tables-h { font-size: var(--step-2); margin: 0 0 .3rem; }
.tables-note { font-family: var(--f-ui); font-size: .82rem; color: var(--ink-3); margin: 0 0 1.8rem; }
.table-fig { margin: 0 0 2.2rem; background: #fdfcf9; border: 1px solid var(--line); border-radius: 8px;
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow-1); }
.table-fig img { width: 100%; height: auto; display: block; }
.table-fig figcaption { font-family: var(--f-ui); font-size: .82rem; color: var(--ink-3);
  line-height: 1.5; margin-top: .85rem; }
/* Tables recreated as clean HTML from the published version */
.table-fig-html { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-fig table { border-collapse: collapse; width: 100%; font-family: var(--f-ui); font-size: .82rem;
  line-height: 1.45; color: var(--ink-2); border-top: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); }
.table-fig thead th, .table-fig tr.head > * { font-weight: 600; color: var(--ink); vertical-align: bottom;
  border-bottom: 1px solid var(--ink-3); }
.table-fig th, .table-fig td { text-align: left; vertical-align: top; white-space: normal;
  padding: .5em 1.6em .5em 0; }
.table-fig td.n, .table-fig th.n { text-align: right; padding-right: 1.1em; font-variant-numeric: tabular-nums; }
.table-fig tbody tr:last-child.sum > * { border-top: 1px solid var(--ink-3); font-weight: 600; color: var(--ink); }
/* wide multi-column tables (e.g. literature reviews): scroll horizontally, keep columns legible */
.table-fig table.wide { min-width: 900px; font-size: .78rem; }
.table-fig table.wide td, .table-fig table.wide th { padding: .55em 1.2em .6em 0; }
.table-fig table.wide tbody tr + tr td { border-top: 1px solid var(--line); }
.table-fig table.wide tbody td { border-top: 1px solid var(--line); }

/* ---- Note / citation hover preview ---- */
sup.ref-cite, sup.fn-ref.has-note { cursor: help; color: var(--gold); font-weight: 600;
  transition: color .2s ease; }
sup.ref-cite:hover, sup.fn-ref.has-note:hover { color: var(--pine-2); }
.note-tip {
  position: absolute; z-index: 200; top: 0; left: 0; pointer-events: none;
  background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd); border-radius: 12px; box-shadow: var(--shadow-3);
  padding: .8rem 1rem; font-family: var(--f-ui); font-size: .8rem; line-height: 1.5; color: var(--ink-2);
  opacity: 0; transform: translateY(4px); transition: opacity .18s ease, transform .18s ease; }
.note-tip.show { opacity: 1; transform: none; pointer-events: auto; }
.note-tip .nt-num { color: var(--gold); font-weight: 700; margin-right: .25em; }
.note-tip p { margin: 0 0 .4em; }
.note-tip p:last-child { margin: 0; }

/* ---- Back to top ---- */
.to-top { position: fixed; right: clamp(1rem, 3vw, 2rem); bottom: clamp(1rem, 3vw, 2rem); z-index: 90;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); color: var(--pine); cursor: pointer;
  display: flex; align-items: center; justify-content: center; opacity: 0; transform: translateY(12px) scale(.9);
  pointer-events: none; transition: opacity .4s var(--ease), transform .4s var(--ease), background .3s; box-shadow: var(--shadow-2); }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { color: var(--gold); transform: translateY(-2px); }

/* Long-form reading tweaks on small screens */
@media (max-width: 640px) {
  .article-body { font-size: 1.08rem; }
  .article-body > p:first-of-type::first-letter { font-size: 3em; }
}
