/* =========================================================================
   PubArx — author resources: the LaTeX template page (/help/latex-template)
   and the template promo in the submission guide. Uses the tokens from
   pubarx.css only, so it follows the light and dark themes.
   ========================================================================= */

/* ------------------------------------------------------------------ hero */

.res-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
  padding: clamp(22px, 4.5vw, 52px);
  background:
    radial-gradient(720px 340px at 100% 0%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 70%),
    radial-gradient(540px 280px at 0% 100%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
@media (max-width: 980px) { .res-hero { grid-template-columns: minmax(0, 1fr); } }
.res-hero h1 { font-size: clamp(2rem, 1.35rem + 2.5vw, 3.05rem); line-height: 1.08; letter-spacing: -0.025em; margin-bottom: 14px; }
.res-hero .lede { font-size: 1.1rem; color: var(--text-2); max-width: 58ch; margin: 0 0 26px; }
.res-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 480px) { .res-actions .btn { width: 100%; } }
.res-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; margin: 20px 0 0; padding: 0; font-size: 0.86rem; color: var(--text-3); }
.res-facts li { display: inline-flex; align-items: center; gap: 6px; }

.res-toc { margin: 18px 0 0; }
.res-toc .chips { justify-content: center; }
@media (max-width: 640px) { .res-toc .chips { justify-content: flex-start; } }

/* ------------------------------------------------------------------ sections */

.res-section { margin-top: clamp(44px, 6vw, 72px); scroll-margin-top: 88px; }
.res-section-head { max-width: 72ch; margin-bottom: 20px; }
.res-section-head h2 { margin-bottom: 6px; }
.res-section-head > p { color: var(--text-2); margin: 0; }
.res-grid > .card + .card { margin-top: 0; }

.res-feature-icon {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--brand-soft); color: var(--brand);
}
.res-feature-icon svg { width: 21px; height: 21px; }
.res-feature:nth-child(even) .res-feature-icon { background: var(--accent-soft); color: var(--accent); }
.res-feature h3 { font-family: var(--font-sans); font-size: 1.02rem; font-weight: 650; letter-spacing: 0; margin: 14px 0 6px; }
.res-feature p { margin: 0; color: var(--text-2); font-size: 0.93rem; }

/* Numbered steps */
.res-steps { list-style: none; margin: 0; padding: 0; counter-reset: res-step; }
.res-steps > li { position: relative; padding: 0 0 16px 40px; font-size: 0.94rem; color: var(--text-2); }
.res-steps > li:last-child { padding-bottom: 0; }
.res-steps > li::before {
  counter-increment: res-step; content: counter(res-step);
  position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 0.82rem;
  background: var(--brand-soft); color: var(--brand);
}
.res-steps > li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 32px; bottom: 4px; width: 1px; background: var(--border); }
.res-steps strong { color: var(--text); }

/* Files in the package */
.res-files { list-style: none; margin: 0; padding: 0; }
.res-files li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.res-files li:first-child { padding-top: 0; }
.res-files li:last-child { border-bottom: 0; padding-bottom: 0; }
.res-files svg { width: 18px; height: 18px; margin-top: 2px; color: var(--text-3); }
.res-file-text { flex: 1; min-width: 0; }
.res-file-text a { display: block; font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600; }
.res-file-text span { display: block; font-size: 0.84rem; color: var(--text-3); }
.res-file-size { font-size: 0.8rem; color: var(--text-3); white-space: nowrap; }

/* ------------------------------------------------------------------ code */

.res-split { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(24px, 4vw, 48px); align-items: start; }
@media (max-width: 980px) { .res-split { grid-template-columns: minmax(0, 1fr); } }
.res-split .res-section-head { margin-bottom: 0; }

.res-code-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); box-shadow: var(--shadow-sm); overflow: hidden; }
.res-code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
  font-family: var(--font-mono); font-size: 0.84rem; color: var(--text-2);
}
.res-code-head > span { display: inline-flex; align-items: center; gap: 6px; }
.res-code {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  white-space: pre; word-break: normal; overflow-wrap: normal; tab-size: 2;
  font-size: 0.83rem; line-height: 1.65; color: var(--text); background: var(--surface-2);
}
.res-code code { font-size: inherit; }
.res-code .tok-cmd { color: var(--brand); font-weight: 600; }
.res-code .tok-com { color: var(--text-3); font-style: italic; }
.res-code-inline { margin-top: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ------------------------------------------------------------------ tables */

.res-tables { align-items: start; }
.res-tables code { white-space: nowrap; font-size: 0.86em; color: var(--brand); }
.res-tables td:last-child { color: var(--text-2); }

/* ------------------------------------------------------------------ checklist */

.res-scholar-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.res-scholar-head h2 { margin-bottom: 4px; }
.res-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 32px; }
@media (max-width: 760px) { .res-checklist { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------------ FAQ */

.res-faq { border-top: 1px solid var(--border); max-width: 900px; }
.res-faq details { border-bottom: 1px solid var(--border); }
.res-faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 2px; cursor: pointer; list-style: none;
  font-weight: 600; font-size: 1.02rem; color: var(--text);
}
.res-faq summary::-webkit-details-marker { display: none; }
.res-faq summary::after {
  content: "+"; content: "+" / ""; flex-shrink: 0; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; border: 1px solid var(--border-strong); color: var(--text-3);
  font-weight: 400; font-size: 1.1rem; line-height: 1; transition: transform .15s;
}
.res-faq details[open] summary::after { transform: rotate(45deg); }
.res-faq summary:hover { color: var(--brand); }
.res-faq .answer { padding: 0 2px 18px; color: var(--text-2); max-width: 75ch; }
.res-faq .answer p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ call to action */

.res-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap;
  padding: clamp(22px, 4vw, 36px); border-radius: var(--radius-lg);
  background:
    radial-gradient(520px 220px at 100% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    var(--brand);
  color: var(--brand-ink);
}
.res-cta h2 { color: var(--brand-ink); margin: 0 0 6px; }
.res-cta p { margin: 0; max-width: 56ch; color: color-mix(in srgb, var(--brand-ink) 82%, var(--brand)); }
.res-cta .res-cta-link { color: var(--brand-ink); }
.res-cta .res-cta-link:hover { color: var(--brand-ink); background: color-mix(in srgb, var(--brand-ink) 14%, transparent); }

/* ------------------------------------------------------------------ submission guide promo */

.res-promo {
  display: flex; gap: 16px; align-items: flex-start; margin: 1.6em 0;
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
}
.res-promo h3 { margin: 0 0 4px; font-family: var(--font-sans); font-size: 1.02rem; font-weight: 650; }
.res-promo p { margin: 0 0 12px; font-size: 0.95rem; color: var(--text); }
.res-promo .row { gap: 8px 16px; }
@media (max-width: 520px) { .res-promo { flex-direction: column; } }

/* =========================================================================
   CSS-only preview of page 1 of the template (decorative, role="img").
   Sizes are in container-query units so the page scales as one piece;
   the px values before them are fallbacks for older browsers.
   ========================================================================= */

.tpl-preview { margin: 0; width: 100%; max-width: 410px; justify-self: center; }
.tpl-stack { position: relative; container-type: inline-size; }
.tpl-stack::before {
  content: ""; position: absolute; inset: 12px -10px -12px 14px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); transform: rotate(2.4deg);
}
.tpl-sheet {
  position: relative; display: flex; flex-direction: column;
  aspect-ratio: 210 / 297; overflow: hidden;
  padding: 22px 24px 16px; padding: 5.5cqw 6cqw 4cqw;
  gap: 6px; gap: 1.55cqw;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-lg);
  font-family: var(--font-serif); line-height: 1.3;
  font-size: 9px; font-size: 2.2cqw;
}
.tpl-sheet > span, .tpl-sheet span span { display: block; }

.tpl-band {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 4px; margin-bottom: 1.2cqw;
  padding: 5px 9px; padding: 1.25cqw 2.2cqw;
  background: var(--brand); color: var(--brand-ink);
  border-bottom: 2px solid var(--accent); border-bottom-width: 0.5cqw;
  font-family: var(--font-sans); font-size: 7px; font-size: 1.65cqw;
}
.tpl-wordmark { display: inline-flex; align-items: baseline; font-weight: 700; font-size: 9px; font-size: 2.35cqw; letter-spacing: -0.01em; white-space: nowrap; }
.tpl-sheet .tpl-wordmark span { display: inline; color: color-mix(in srgb, var(--accent) 45%, var(--brand-ink)); }
.tpl-wordmark small { margin-left: 6px; margin-left: 1.5cqw; font-size: 6px; font-size: 1.45cqw; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.78; }
.tpl-band-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.9; }

.tpl-eyebrow { font-family: var(--font-sans); font-weight: 700; font-size: 6px; font-size: 1.45cqw; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.tpl-title { font-weight: 700; font-size: 18px; font-size: 4.4cqw; line-height: 1.12; letter-spacing: -0.01em; color: var(--brand); }
.tpl-authors { font-size: 10px; font-size: 2.45cqw; line-height: 1.45; }
.tpl-authors sup { font-size: 0.62em; color: var(--text-3); margin-left: 1px; }
.tpl-sheet .tpl-orcid { display: inline-block; width: 8px; height: 8px; width: 2.1cqw; height: 2.1cqw; margin-left: 2px; vertical-align: -1px; }

.tpl-sheet .tpl-affils, .tpl-sheet .tpl-abstract, .tpl-sheet .tpl-col,
.tpl-sheet .tpl-caption, .tpl-sheet .tpl-theorem { display: flex; flex-direction: column; gap: 4px; gap: 0.95cqw; }
.tpl-affils .tpl-line { height: 2px; height: 0.6cqw; }

.tpl-line { height: 3px; height: 0.8cqw; border-radius: 99px; background: var(--border-strong); opacity: 0.75; }

.tpl-abstract {
  margin-top: 2px; margin-top: 0.6cqw;
  padding: 8px 10px; padding: 2cqw 2.4cqw;
  background: var(--brand-soft); border-left: 2px solid var(--accent); border-left-width: 0.6cqw;
}
.tpl-abstract .tpl-line { background: color-mix(in srgb, var(--brand) 30%, var(--border-strong)); opacity: 0.55; }
.tpl-label { font-family: var(--font-sans); font-weight: 700; font-size: 6px; font-size: 1.4cqw; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand); }
.tpl-sheet .tpl-kw { display: flex; align-items: center; gap: 8px; gap: 2cqw; margin-top: 2px; margin-top: 0.6cqw; padding-top: 4px; padding-top: 1cqw; border-top: 1px solid color-mix(in srgb, var(--brand) 18%, transparent); }
.tpl-kw .tpl-line { flex: none; }

.tpl-sheet .tpl-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; gap: 4cqw; flex: 1; min-height: 0; overflow: hidden; margin-top: 4px; margin-top: 1cqw; }
.tpl-heading { margin-top: 2px; margin-top: 0.7cqw; font-family: var(--font-sans); font-weight: 700; font-size: 8px; font-size: 1.95cqw; color: var(--brand); }
.tpl-heading b { margin-right: 4px; margin-right: 1cqw; color: var(--accent); }
.tpl-sheet .tpl-equation { display: flex; align-items: center; justify-content: center; gap: 8px; gap: 2cqw; padding: 2px 0; padding: 0.6cqw 0; }
.tpl-equation .tpl-line { opacity: 1; background: var(--text-3); }
.tpl-equation i { font-size: 7px; font-size: 1.6cqw; font-style: normal; color: var(--text-3); }

.tpl-sheet .tpl-figure {
  display: flex; align-items: flex-end; gap: 4px; gap: 1.1cqw;
  height: 64px; height: 15.5cqw; padding: 6px; padding: 1.5cqw;
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2);
}
.tpl-sheet .tpl-bar { flex: 1; border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--brand) 40%, var(--surface)); }
.tpl-sheet .tpl-bar.is-accent { background: var(--accent); }
.tpl-h-45 { height: 45%; } .tpl-h-50 { height: 50%; } .tpl-h-55 { height: 55%; }
.tpl-h-70 { height: 70%; } .tpl-h-90 { height: 90%; }

/* booktabs-style table: heavy top and bottom rules, a light rule under the header */
.tpl-sheet .tpl-table {
  display: flex; flex-direction: column; gap: 4px; gap: 0.9cqw; padding: 4px 0; padding: 0.9cqw 0;
  border-top: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
}
.tpl-sheet .tpl-row { display: flex; justify-content: space-between; gap: 6px; gap: 1.5cqw; }
.tpl-sheet .tpl-row.is-head { padding-bottom: 4px; padding-bottom: 0.9cqw; border-bottom: 1px solid var(--border-strong); }
.tpl-row .tpl-line { flex: none; }
.tpl-row.is-head .tpl-line { background: var(--text-3); }

.tpl-caption b, .tpl-theorem b { font-family: var(--font-sans); font-weight: 700; font-size: 6.5px; font-size: 1.55cqw; color: var(--brand); }
.tpl-caption .tpl-line { height: 2px; height: 0.6cqw; }
.tpl-theorem { padding: 3px 0; padding: 0.7cqw 0; }

.tpl-sheet .tpl-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; margin-top: 0.6cqw; font-family: var(--font-sans); font-size: 6px; font-size: 1.4cqw; color: var(--text-3); }
.tpl-sheet .tpl-foot span { display: inline; }

.tpl-preview figcaption { margin-top: 22px; text-align: center; font-size: 0.82rem; color: var(--text-3); }

@media (max-width: 980px) { .tpl-preview { max-width: 380px; } }
@media (prefers-reduced-motion: no-preference) {
  .tpl-stack::before { transition: transform .3s ease; }
  .res-hero:hover .tpl-stack::before { transform: rotate(3.4deg); }
}
