.os-topics-page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  /* Guard against any child (chip rows, grids) bleeding past the viewport. */
  overflow-x: clip;
}

.os-topics-header {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  margin-bottom: 2.5rem;
  padding: clamp(1.5rem, 4vw, 3.25rem);
  border: 1px solid rgba(212, 175, 55, 0.24);
  border-radius: 28px;
  background:
    radial-gradient(circle at 86% 16%, rgba(212, 175, 55, 0.15), transparent 28%),
    linear-gradient(135deg, #24162f 0%, #17131d 58%, #111017 100%);
  box-shadow: 0 24px 60px rgba(18, 12, 22, 0.18);
}

.os-topics-headerContent {
  max-width: 760px;
}

.os-topics-eyebrow,
.os-topics-sectionKicker,
.os-topics-conceptTopline,
.os-topics-intentTopline,
.os-topics-cardMeta,
.os-topics-pathTopline {
  /* emphasis-600 is #8d949e — 3.06:1 on white, under the 4.5:1 bar for text
     this size. emphasis-700 is 5.36:1 and reads just as secondary. */
  color: var(--ifm-color-emphasis-700);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.os-topics-eyebrow {
  margin: 0 0 0.65rem;
  color: #e8c85e;
  text-transform: uppercase;
}

.os-topics-header h1 {
  margin: 0 0 0.8rem;
  color: #fffaf0;
  font-size: clamp(2.35rem, 5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.os-topics-lede {
  max-width: 720px;
  margin: 0;
  color: rgba(255, 250, 240, 0.82);
  font-size: 1.1rem;
  line-height: 1.8;
}

.os-topics-headerNote {
  max-width: 660px;
  margin: 1rem 0 0;
  color: rgba(255, 250, 240, 0.64);
  line-height: 1.7;
}

.os-topics-headerPanel {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(12px);
}

.os-topics-headerPanel div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  min-height: 70px;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.os-topics-headerPanel div:last-child {
  border-bottom: 0;
}

.os-topics-headerPanel strong {
  color: #e8c85e;
  font-family: var(--ifm-heading-font-family);
  font-size: 1.55rem;
  line-height: 1;
}

.os-topics-headerPanel span {
  color: rgba(255, 250, 240, 0.7);
  font-size: 0.92rem;
}

.os-topics-section {
  margin-top: 3.25rem;
}

.os-topics-sectionHeader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 420px);
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.os-topics-sectionHeader h2 {
  margin: 0;
  font-size: 1.65rem;
}

.os-topics-sectionHeader p {
  margin: 0;
  color: var(--ifm-color-emphasis-700);
  line-height: 1.65;
}

.os-topics-sectionKicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.5rem !important;
  text-transform: uppercase;
}

.os-topics-pathGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
}

.os-topics-pathCard {
  grid-column: span 2;
}

.os-topics-pathCard:nth-child(-n + 2) {
  grid-column: span 3;
}

.os-topics-pathCard,
.os-topics-intentCard,
.os-topics-conceptCard,
.os-topics-filterPanel,
.os-topics-emptyState {
  border: 1px solid var(--ifm-color-emphasis-200);
  border-radius: 18px;
  background: var(--ifm-background-surface-color);
}

.os-topics-pathCard {
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  box-shadow: 0 14px 34px rgba(24, 16, 29, 0.08);
}

.os-topics-pathImage {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8.5;
  height: auto;
  object-fit: cover;
  background: var(--ifm-color-emphasis-100);
}

.os-topics-pathBody {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.15rem 1.2rem 1.25rem;
}

.os-topics-pathTopline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.os-topics-pathStep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--ifm-color-primary);
  color: var(--ifm-color-primary-contrast-background);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
}

.os-topics-pathCard h3,
.os-topics-intentCard h3,
.os-topics-conceptCard h3 {
  margin: 0 0 0.55rem;
  /* Raw gold on the white card is 2.1:1. The -text token is AA and remaps to
     full gold in dark mode, so the dark cards are unchanged. */
  color: var(--esoteric-gold-text);
  font-size: 1.1rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.os-topics-pathCard p,
.os-topics-intentCard p,
.os-topics-conceptCard p {
  margin: 0 0 0.9rem;
  color: var(--ifm-color-emphasis-700);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.os-topics-pathCard p {
  flex: 1;
  font-size: 0.94rem;
}

.os-topics-cardMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  letter-spacing: 0;
}

.os-topics-cardMeta span,
.os-topics-intentTopline span,
.os-topics-aliases span,
.os-topics-conceptTopline {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  border: 1px solid var(--ifm-color-emphasis-200);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  background: color-mix(in srgb, var(--ifm-color-primary) 4%, transparent);
  /* These chips inherited a muted grey that measured 2.87:1 on their own tinted
     background — they are small, secondary, and were the least readable text on
     the page. emphasis-700 is 5.36:1 and still reads as secondary. */
  color: var(--ifm-color-emphasis-700);
}

.os-topics-primaryLink,
.os-topics-secondaryLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: auto;
  gap: 0.45rem;
  border-radius: 10px;
  font-weight: 800;
  text-decoration: none;
}

.os-topics-primaryLink {
  border: 1px solid var(--ifm-color-primary);
  background: var(--ifm-color-primary);
  color: var(--ifm-color-primary-contrast-background);
  padding: 0.48rem 0.8rem;
}

.os-topics-primaryLink:hover {
  color: var(--ifm-color-primary-contrast-background);
  text-decoration: none;
  filter: brightness(1.04);
}

.os-topics-secondaryLink {
  justify-content: flex-start;
  color: var(--ifm-color-primary);
}

.os-topics-secondaryLink svg {
  transition: transform 0.2s ease;
}

.os-topics-secondaryLink:hover svg {
  transform: translateX(3px);
}

.os-topics-secondaryLink:hover {
  text-decoration: none;
}

.os-topics-filterPanel {
  position: sticky;
  top: calc(var(--ifm-navbar-height) + 0.6rem);
  z-index: 3;
  margin-top: 3.25rem;
  padding: 1rem 1.1rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--ifm-background-surface-color) 92%, transparent), var(--ifm-background-surface-color)),
    var(--ifm-background-surface-color);
  box-shadow: 0 16px 42px rgba(24, 16, 29, 0.09);
}

.os-topics-searchRow {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.os-topics-searchBox {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  min-height: 46px;
  padding: 0 0.9rem;
  border: 1px solid var(--ifm-color-emphasis-300);
  border-radius: 12px;
  color: var(--ifm-color-emphasis-700);
  background: var(--ifm-background-color);
}

.os-topics-searchBox:focus-within {
  border-color: var(--ifm-color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ifm-color-primary) 18%, transparent);
}

.os-topics-searchBox input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ifm-color-content);
  font: inherit;
}

.os-topics-clearButton,
.os-topics-categoryChip {
  appearance: none;
  border: 1px solid var(--ifm-color-emphasis-300);
  background: var(--ifm-background-color);
  color: var(--ifm-color-emphasis-800);
  cursor: pointer;
  font: inherit;
}

.os-topics-clearButton {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 0.85rem;
  font-weight: 800;
}

.os-topics-clearButton:hover,
.os-topics-categoryChip:hover {
  border-color: var(--ifm-color-primary);
  color: var(--ifm-color-primary);
}

.os-topics-filterHelp {
  margin: 0.65rem 0 0;
  color: var(--ifm-color-emphasis-700);
  font-size: 0.88rem;
}

.os-topics-categoryChips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.os-topics-categoryChip {
  min-height: 36px;
  border-radius: 999px;
  padding: 0.38rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 800;
}

.os-topics-categoryChipActive {
  border-color: var(--ifm-color-primary);
  background: var(--ifm-color-primary);
  /* --ifm-color-primary-contrast-background is Infima's *background* that
     contrasts with primary, not its foreground; using it as text colour put
     #444950 on #9c27b0 — 1.43:1, all but unreadable. Text on the primary fill
     has to flip with the theme, because primary itself does: dark purple in
     light mode, light purple in dark. */
  color: #fff;
}

[data-theme='dark'] .os-topics-categoryChipActive {
  color: var(--esoteric-dark-bg);
}

.os-topics-categoryChipActive:hover {
  color: #fff;
}

[data-theme='dark'] .os-topics-categoryChipActive:hover {
  color: var(--esoteric-dark-bg);
}

.os-topics-intentGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.os-topics-intentCard,
.os-topics-conceptCard {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 1.25rem;
}

.os-topics-intentTopline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  letter-spacing: 0;
}

.os-topics-intentCard p,
.os-topics-conceptCard p {
  flex: 1;
  font-size: 0.95rem;
}

.os-topics-conceptGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.os-topics-conceptTopline {
  align-self: flex-start;
  margin-bottom: 0.75rem;
  letter-spacing: 0;
}

.os-topics-aliases {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.os-topics-aliases span {
  color: var(--ifm-color-emphasis-700);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.os-topics-emptyState {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 2rem;
  color: var(--ifm-color-emphasis-700);
  text-align: center;
}

.os-topics-emptyState p {
  max-width: 560px;
  margin: 0;
  line-height: 1.7;
}

@media (hover: hover) {
  .os-topics-pathCard,
  .os-topics-intentCard,
  .os-topics-conceptCard {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }

  .os-topics-pathCard:hover,
  .os-topics-intentCard:hover,
  .os-topics-conceptCard:hover {
    border-color: color-mix(in srgb, var(--ifm-color-primary) 52%, var(--ifm-color-emphasis-200));
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
  }
}

@media (max-width: 1100px) {
  .os-topics-pathGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .os-topics-pathCard,
  .os-topics-pathCard:nth-child(-n + 2) {
    grid-column: span 1;
  }

  .os-topics-intentGrid,
  .os-topics-conceptGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .os-topics-page {
    padding: 2rem 1rem 4rem;
  }

  .os-topics-header,
  .os-topics-sectionHeader {
    grid-template-columns: 1fr;
  }

  .os-topics-header {
    padding: 1.25rem;
  }

  .os-topics-header h1 {
    font-size: 2.25rem;
  }

  .os-topics-headerPanel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .os-topics-headerPanel div {
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
    min-height: 74px;
    text-align: center;
  }

  .os-topics-pathGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .os-topics-filterPanel {
    position: static;
  }
}

@media (max-width: 560px) {
  .os-topics-pathGrid,
  .os-topics-intentGrid,
  .os-topics-conceptGrid {
    grid-template-columns: 1fr;
  }

  .os-topics-page {
    padding-top: 1.25rem;
  }

  .os-topics-header {
    padding: 1.25rem;
    gap: 0.8rem;
    border-radius: 20px;
  }

  .os-topics-header h1 {
    font-size: 1.7rem;
  }

  .os-topics-lede {
    font-size: 0.98rem;
    line-height: 1.6;
  }

  .os-topics-headerNote {
    margin-top: 0.7rem;
  }

  /* Drop the secondary index-stats panel on phones so search reaches the top
     of the first screen; it stays on tablet/desktop. */
  .os-topics-headerPanel {
    display: none;
  }

  .os-topics-section {
    margin-top: 2rem;
  }

  .os-topics-sectionHeader h2 {
    font-size: 1.35rem;
  }

  .os-topics-pathBody,
  .os-topics-intentCard,
  .os-topics-conceptCard,
  .os-topics-filterPanel {
    padding: 0.9rem;
  }

  .os-topics-pathTopline {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .os-topics-primaryLink {
    width: 100%;
  }

  .os-topics-searchRow {
    align-items: stretch;
    flex-direction: column;
  }

  .os-topics-clearButton {
    justify-content: center;
    width: 100%;
  }

  .os-topics-categoryChips {
    flex-wrap: wrap;
    padding: 0 0 0.25rem;
  }

  .os-topics-categoryChip {
    flex: 0 0 auto;
  }
}

@media (max-width: 380px) {
  .os-topics-page {
    padding-right: 0.8rem;
    padding-left: 0.8rem;
  }

  .os-topics-header {
    padding: 1rem;
  }

  .os-topics-headerPanel {
    grid-template-columns: 1fr;
  }

  .os-topics-headerPanel div {
    min-height: 54px;
  }
}
