/* Keyword bubble styles */
.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.keyword-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--accent-color);
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--accent-color);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.keyword-bubble:hover {
  background: var(--accent-color);
  color: var(--background-color);
}

.keyword-bubble.small {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
}

.keyword-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--accent-color);
  color: var(--background-color);
  font-size: 0.7rem;
  font-weight: bold;
}

/* Keyword cloud layout */
.keywords-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

/* ---- Topic groups (keywords index + research hub) ---- */

.topic-group {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.topic-group h2 {
  margin-bottom: 0.6rem;
}

/* Research areas: visually distinct from fine-grained topics.
   Solid fill instead of outline, so areas read as "primary". */
.area-bubble {
  background: var(--accent-color);
  color: var(--background-color);
  font-weight: 600;
}

.area-bubble:hover {
  /* keep solid fill on hover; just soften slightly */
  opacity: 0.85;
  background: var(--accent-color);
  color: var(--background-color);
}

.area-bubble .keyword-count {
  background: var(--background-color);
  color: var(--accent-color);
}

/* Labels on publication detail pages ("Research areas:" / "Topics:") */
.keywords-label {
  font-size: 0.8rem;
  color: var(--footnote-color);
  margin-right: 0.35rem;
  align-self: center;
}

.keywords .keywords-label + .keyword-bubble {
  margin-left: 0;
}

/* Research hub topic section spacing */
.research-topics h2 {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

/* ---- Topic group accents ----
 * Two-property indirection: the group sets --topic-accent, and only the
 * bubbles inside it re-map --accent-color to it. This avoids the
 * self-referential --accent-color: var(--accent-color) cycle and gives
 * non-Dracula schemes a graceful fallback (falls back to the group's
 * fallback value = var(--accent-color) from the root scheme).
 */
.topic-group--systems {
  --topic-accent: var(--dracula-cyan, var(--accent-color));
}

.topic-group--methods {
  --topic-accent: var(--dracula-green, var(--accent-color));
}

.topic-group--problems {
  --topic-accent: var(--dracula-orange, var(--accent-color));
}

.topic-group--systems .keyword-bubble,
.topic-group--methods .keyword-bubble,
.topic-group--problems .keyword-bubble {
  --accent-color: var(--topic-accent);
}

.topic-group-label {
  font-size: 0.8rem;
  color: var(--topic-accent, var(--footnote-color));
  margin-bottom: 0.25rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Lens-grouped topic rows on publication pages */
.keywords.lenses {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.keywords.lenses .topic-group .topic-group-label {
  display: block;
  margin-bottom: 0.15rem;
}

/* TBTE series footers: matches theme .post-navigation */

/* Kill the bare <footer> element's native top/bottom margin; otherwise it
   opens its own gap between the post body and the sequence footer. */
.tbte-series {
  margin: 0;
}

/* The <nav class="post-navigation"> below the sequence footer is a sibling
   of </article>, so the theme's 45px title margin shows as a big block of
   whitespace between the two footers. Pull it in for any post that actually
   rendered a sequence footer. */
article:has(.tbte-series) ~ nav .post-navigation-title {
  margin-top: 0;
}

.tbte-series-title {
  display: flex;
  text-align: center;
  position: relative;
  margin: 45px 0 20px;
}

.tbte-series-title h2 {
  text-align: center;
  margin: 0 auto;
  padding: 5px 10px;
  background: var(--background-color);
  color: color-mix(in srgb, var(--text-color) 30%, transparent);
  font-size: calc(var(--font-size) * 0.8);
  font-weight: normal;
  letter-spacing: 0.1em;
  z-index: 1;
}

.tbte-series-title hr {
  background: var(--accent-color);
  position: absolute;
  inset-inline: 0;
  width: 100%;
  margin-top: 15px;
  z-index: 0;
}

.tbte-series-links {
  display: flex;
  flex-flow: row wrap;
  gap: 10px;
  justify-content: center;
  padding-bottom: 0px;
  text-align: center;
}

.tbte-series-links a {
  text-decoration: none;
}

@media print {
  .tbte-series {
    display: none;
  }
}
