/* =========================================================
   Research overview (research.html) and theme pages (research/<slug>.html)
   ========================================================= */

/* ---------- shared bits ---------- */
.hero-jump { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 0; padding: 0; list-style: none; }
.page-hero .section-lede a { color: var(--text); text-decoration-color: rgb(var(--cyan-rgb) / .5); text-underline-offset: 3px; }
.page-hero .section-lede a:hover { color: var(--cyan); text-decoration-color: var(--cyan); }

.page-research .section h2,
.page-research .page-body h2,
.topic-body h2 {
  margin: 0;
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.5rem); line-height: 1.1; letter-spacing: -.034em;
}

/* ---------- overview: theme cards ---------- */
.page-research .research-grid { margin-top: 0; }
.rcard-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin-top: auto; padding-top: 22px;
}
.rcard-foot .rcard-more { margin-top: 0; padding-top: 0; }
.rcard-count {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
}
.rcard-count-num {
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; letter-spacing: -.02em; text-transform: none;
  color: var(--text);
}

/* ---------- overview: earlier work ---------- */
.earlier-list {
  list-style: none; margin: clamp(32px, 4vw, 48px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: clamp(20px, 3vw, 40px);
}
.earlier-list li {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: baseline;
  padding: 18px 0 20px; border-top: 1px solid var(--line);
}
.earlier-num { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; color: var(--text-3); }
.earlier-title { font-family: var(--font-display); font-weight: 500; font-size: 1.04rem; line-height: 1.4; letter-spacing: -.012em; color: var(--text-2); }

/* ---------- theme page: hero ---------- */
.page-research-topic .page-hero h1 { max-width: calc(100% - 230px); }
.page-research-topic .page-hero .section-lede { max-width: min(62ch, calc(100% - 230px)); }
.topic-hero-meta { display: flex; flex-wrap: wrap; gap: 14px 28px; }

.topic-glyph {
  position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%);
  width: 196px; height: 196px; display: grid; place-items: center; pointer-events: none;
}
.topic-orbit {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px dashed rgb(var(--violet-rgb) / .38);
  animation: spin 60s linear infinite;
}
.topic-orbit::before {
  content: ""; position: absolute; inset: 22px; border-radius: 50%;
  border: 1px solid rgb(var(--cyan-rgb) / .14);
}
.topic-orbit-dot {
  position: absolute; top: 50%; left: -4px; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 10px rgb(var(--amber-rgb) / .8);
}
.glyph--xl {
  position: relative; width: 116px; height: 116px; border-radius: 32px;
  background: linear-gradient(160deg, rgb(var(--surface-rgb) / .78), rgb(var(--surface-rgb) / .4));
  border-color: rgb(var(--cyan-rgb) / .28);
  box-shadow: inset 0 0 32px rgb(var(--cyan-rgb) / .1), 0 24px 60px -30px rgb(var(--cyan-rgb) / .55);
}
.glyph--xl svg { width: 76px; height: 76px; stroke-width: 1.35; }
.motion-paused .topic-orbit { animation-play-state: paused; }

/* ---------- theme page: intro ---------- */
.topic-intro { margin-bottom: clamp(56px, 8vw, 104px); }
.prose { max-width: 68ch; color: var(--text-2); font-size: 1.04rem; line-height: 1.72; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 1.1em; }
.prose > p:first-of-type { color: var(--text); font-size: 1.12rem; line-height: 1.65; }
.prose a { color: var(--text); text-decoration-color: rgb(var(--cyan-rgb) / .5); text-underline-offset: 3px; transition: color .2s, text-decoration-color .2s; }
.prose a:hover { color: var(--cyan); text-decoration-color: var(--cyan); }
.prose ul { margin: 0 0 1.25em; padding: 0; list-style: none; }
.prose li { position: relative; padding: 5px 0 5px 24px; }
.prose li::before {
  content: ""; position: absolute; left: 4px; top: calc(5px + .86em); width: 6px; height: 6px; margin-top: -3px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px rgb(var(--cyan-rgb) / .7);
}


/* ---------- theme page: papers (sticky head + list, like the home page news) ---------- */
.topic-papers {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(36px, 5.5vw, 88px); align-items: start;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.topic-papers-head { position: sticky; top: calc(var(--header-h) + 40px); }
.topic-papers-head .legend { margin: 18px 0 0; }
.topic-papers-head .link-arrow { margin-top: 22px; }
.topic-papers h2 .nowrap { white-space: nowrap; }
.topic-papers h2 .count { margin-left: 6px; vertical-align: .32em; }
.count {
  display: inline-grid; place-items: center; min-width: 2.1em; padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgb(var(--cyan-rgb) / .35); background: rgb(var(--cyan-rgb) / .07);
  font-family: var(--font-mono); font-size: .42em; font-weight: 500; letter-spacing: .02em; line-height: 1.5; color: var(--cyan);
}
.topic-papers .section-lede { margin-top: 12px; font-size: 1rem; }

.more-pubs { border-top: 1px solid var(--line); }
.more-pubs > summary {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 18px 0 0; padding: 11px 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgb(var(--surface-rgb) / .35);
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .04em; color: var(--text-2);
  cursor: pointer; list-style: none;
  transition: border-color .2s, background-color .2s, color .2s;
}
.more-pubs > summary::-webkit-details-marker { display: none; }
.more-pubs > summary:hover { color: var(--cyan); border-color: rgb(var(--cyan-rgb) / .55); background: rgb(var(--cyan-rgb) / .07); }
.more-pubs > summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.more-pubs[open] > summary svg { transform: rotate(180deg); }
.more-pubs .when-open { display: none; }
.more-pubs[open] .when-open { display: inline; }
.more-pubs[open] .when-closed { display: none; }
.more-pubs[open] > summary { margin-bottom: 18px; }
.more-pubs .pub:first-child { border-top: 1px solid var(--line); padding-top: 20px; }
.more-pubs[open] .pub:first-child { border-top: 0; padding-top: 2px; }

/* ---------- theme page: prev / next ---------- */
.topic-nav {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px;
  margin-top: clamp(56px, 8vw, 96px);
}
.topic-nav-link {
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px 24px 24px; border-radius: 20px; text-decoration: none;
  transition: transform .35s var(--ease), box-shadow .35s ease;
}
.topic-nav-link:hover { transform: translateY(-3px); box-shadow: var(--card-shadow), 0 26px 60px -34px rgb(var(--cyan-rgb) / .55); }
.topic-nav-link--next { align-items: flex-end; text-align: right; }
.topic-nav-dir {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3);
  transition: color .2s;
}
.topic-nav-link:hover .topic-nav-dir { color: var(--cyan); }
.topic-nav-title {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.16rem; line-height: 1.3; letter-spacing: -.02em;
}
.topic-nav-link--next .topic-nav-title { flex-direction: row-reverse; }
.topic-nav-title .glyph { width: 40px; height: 40px; border-radius: 12px; }

/* ---------- focus: keep each control's own shape ---------- */
.topic-nav-link:focus-visible { border-radius: 20px; outline-offset: 3px; }
.more-pubs > summary:focus-visible { border-radius: 999px; }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .earlier-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic-glyph { width: 156px; height: 156px; }
  .glyph--xl { width: 96px; height: 96px; border-radius: 26px; }
  .glyph--xl svg { width: 62px; height: 62px; }
  .page-research-topic .page-hero h1 { max-width: calc(100% - 180px); }
  .page-research-topic .page-hero .section-lede { max-width: min(62ch, calc(100% - 180px)); }
}
@media (max-width: 860px) {
  .topic-papers { grid-template-columns: minmax(0, 1fr); }
  .topic-papers-head { position: static; }
  .topic-papers { gap: 28px; }
}
@media (max-width: 680px) {
  .earlier-list { grid-template-columns: minmax(0, 1fr); }
  .page-research-topic .page-hero h1,
  .page-research-topic .page-hero .section-lede { max-width: none; }
  .topic-glyph { top: 0; transform: none; width: 72px; height: 72px; }
  .topic-orbit::before { inset: 9px; }
  .glyph--xl { width: 48px; height: 48px; border-radius: 14px; }
  .glyph--xl svg { width: 32px; height: 32px; stroke-width: 1.6; }
  .topic-nav { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .topic-nav-link { padding: 18px 20px 20px; }
  .prose { font-size: 1rem; }
  .prose > p:first-of-type { font-size: 1.06rem; }
}
@media (prefers-reduced-motion: reduce) {
  .topic-nav-link:hover { transform: none; }
}
