/* =========================================================
   STAR — Topic single (single-topic.php) — redesign
   Source: demo pages/star-community/css/style.css
   Breakpoints: 1439px / 1199px / 1023px / 767px (max-width)
   Fonts (galano, mori, recoleta) are loaded by dist/css/app.css.
   ========================================================= */

/* ---------- Scoped base (replaces the demo's global reset) ---------- */
:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore),
:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) *,
:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) *::before,
:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) *::after {
  box-sizing: border-box;
}

:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) :where(h1, h2, h3, p, ul, ol, dl, dd, figure) {
  margin: 0;
}

:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) :where(ul, ol) {
  padding: 0;
  list-style: none;
}

:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) :where(a) {
  color: inherit;
  text-decoration: none;
}

:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) :where(img, svg, iframe, video) {
  display: block;
  max-width: 100%;
}

:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) :where(button) {
  font: inherit;
  cursor: pointer;
}

:where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) :focus-visible {
  outline: 2px solid #6C2975;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  :where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) *,
  :where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) *::before,
  :where(.cm-breadcrumbs, .cm-hero, .cm-topic-panel-wrap, .cm-explore) *::after {
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   REUSABLE COMPONENTS
   ========================================================= */

/* ---------- Eyebrow / section label ---------- */
.cm-eyebrow {
  margin-bottom: 42px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #5BC6D0;
}

/* ---------- Section title (Recoleta) ---------- */
.cm-section-title {
  margin-bottom: 50px;
  font-family: "recoleta", "Fraunces", serif;
  font-size: clamp(32px, 3.5053vw, 53px);
  font-weight: 700;
  line-height: 1.0526;
  color: #10477C;
}

/* ---------- Pill buttons ---------- */
.cm-pill-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 12px 20px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.cm-pill-button--cyan {
  background-color: #5BC6D0;
  color: #10477C;
}

.cm-pill-button--navy {
  background-color: #10477C;
  color: #fff;
}

.cm-pill-button--cyan:hover,
.cm-pill-button--navy:hover {
  background-color: #fff;
  color: #10477C;
}

/* ---------- Topic icon (circle badge) ---------- */
.cm-topic-icon {
  display: inline-flex;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: #10477C;
  color: #FDCB1F;
}

.cm-topic-icon svg,
.cm-topic-icon img {
  width: 100%;
  height: 100%;
}

.cm-topic-icon svg :is(path, circle, rect, ellipse, polygon):not([fill="none"]),
.cm-topic-card__icon svg :is(path, circle, rect, ellipse, polygon):not([fill="none"]) {
  fill: currentColor;
}

.cm-topic-icon--lg {
  width: 53px;
  height: 53px;
}

.cm-topic-icon--sm {
  width: 32px;
  height: 32px;
}

/* ---------- Download card ---------- */
.cm-download-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 24px 32px;
  border-radius: 20px;
  background-color: #A9E4DE;
  color: #10477C;
}

.cm-download-card__icon {
  display: flex;
  align-items: center;
  height: 28px;
}

.cm-download-card__icon svg {
  width: 20px;
  height: 20px;
}

.cm-download-card__title {
  font-size: 20px;
  font-weight: 600;
  line-height: 21px;
}

.cm-download-card .cm-pill-button {
  margin-top: 12px;
}

.cm-download-card--dark {
  gap: 16px;
  background-color: #10477C;
  color: #fff;
}

.cm-download-card--dark .cm-download-card__icon {
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  border-radius: 8px;
}

.cm-download-card__content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cm-download-card__content .cm-pill-button {
  margin-top: 16px;
}

/* ---------- Card base ---------- */
.cm-card {
  min-height: 246px;
  border-radius: 8px;
  overflow: hidden;
}

.cm-card__title {
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
  letter-spacing: -0.5px;
}

.cm-card__title a:hover {
  text-decoration: underline;
}

.cm-card[hidden] {
  display: none;
}

/* =========================================================
   BREADCRUMBS
   ========================================================= */
.cm-breadcrumbs {
  padding: 0 5.291vw;
  background-color: #A9E4DE;
}

.cm-breadcrumbs__list {
  display: inline-flex;
  padding: 10px 16px;
  border-radius: 0 0 20px 20px;
  background-color: #F1F1F1;
  font-family: "recoleta", "Fraunces", serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
  color: #10477C;
}

.cm-breadcrumbs__list a:hover {
  color: #6C2975;
}

/* =========================================================
   HERO
   ========================================================= */
.cm-hero {
  padding: 2.6455vw 5.291vw 7.937vw;
  background-color: #A9E4DE;
  color: #10477C;
}

.cm-hero__header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
}

.cm-hero__title {
  font-family: "galano", "Outfit", sans-serif;
  font-size: clamp(32px, 3.1746vw, 48px);
  font-weight: 700;
  line-height: 1.0526;
  letter-spacing: -0.0208em;
}

.cm-hero__body {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
}

.cm-hero__text {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}

.cm-hero__description {
  font-size: 20px;
  line-height: 1.7143;
}

.cm-hero__description p + p {
  margin-top: 1em;
}

.cm-hero__downloads {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cm-hero__body--no-media {
  grid-template-columns: minmax(0, 1fr);
}

.cm-hero__body--no-media .cm-hero__text {
  max-width: 800px;
}

.cm-hero__media {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Video */
.cm-video {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background-color: #000;
}

.cm-video__poster,
.cm-video iframe,
.cm-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.cm-video__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease;
}

.cm-video__play svg {
  width: 100%;
  height: 100%;
}

.cm-video--image {
  background-color: transparent;
}

.cm-video__play svg path {
  transition: fill 0.2s ease;
}

.cm-video__play:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.cm-video__play:hover svg path {
  fill: #000;
}

/* =========================================================
   TOPIC PANEL (sticky nav + sections)
   ========================================================= */
.cm-topic-panel-wrap {
  background: linear-gradient(to bottom, #A9E4DE 300px, #F0F1EC 300px);
}

.cm-topic-panel {
  position: relative;
  margin: 0 5.291vw;
  border-radius: 40px;
  background-color: #fff;
}

/* ---------- Scroll nav ---------- */
.cm-scroll-nav {
  position: sticky;
  top: 40px;
  z-index: 20;
  margin-left: 2.6455vw;
  transform: translateY(-50%);
}

.cm-scroll-nav__list {
  display: flex;
  width: fit-content;
  border-radius: 50px;
  background-color: #5BC6D0;
  overflow: hidden;
}

.cm-scroll-nav__item {
  position: relative;
  display: block;
  padding: 24px;
  font-size: 20px;
  font-weight: 700;
  line-height: 21px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  transition: color 0.3s ease;
}

.cm-scroll-nav__list li:first-child .cm-scroll-nav__item {
  padding-left: 50px;
}

.cm-scroll-nav__list li:last-child .cm-scroll-nav__item {
  padding-right: 50px;
}

.cm-scroll-nav__item:hover {
  color: #0A2D4F;
}

.cm-scroll-nav__fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background-color: #4FBDC8;
}

.cm-scroll-nav__label {
  position: relative;
}

.cm-scroll-nav__item.is-active .cm-scroll-nav__label,
.cm-scroll-nav__item.is-passed .cm-scroll-nav__label {
  color: #000;
}

.cm-scroll-nav__item.is-passed .cm-scroll-nav__fill {
  width: 100%;
}

/* ---------- Topic section ---------- */
.cm-topic-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 40px;
  padding: 7.937vw 5.291vw;
  scroll-margin-top: 60px;
}

.cm-topic-section__main {
  max-width: 800px;
}

.cm-rich-text p {
  margin-bottom: 22px;
  font-size: 22px;
  line-height: 1.7143;
  color: #10477C;
}

.cm-rich-text {
  color: #10477C;
}

.cm-rich-text :where(ul, ol) {
  margin: 0 0 22px;
  padding-left: 1.25em;
  font-size: 22px;
  line-height: 1.7143;
}

.cm-rich-text ul {
  list-style: disc;
}

.cm-rich-text ol {
  list-style: decimal;
}

.cm-rich-text :where(h2, h3, h4) {
  margin: 32px 0 16px;
  font-family: "recoleta", "Fraunces", serif;
  line-height: 1.2;
}

.cm-rich-text a {
  text-decoration: underline;
}

.cm-rich-text iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.cm-topic-section__video {
  margin-top: 32px;
}

.cm-topic-section__sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Resources section ---------- */
.cm-topic-section--resources {
  display: block;
  padding-bottom: 80px;
}

.cm-topic-section__header {
  text-align: center;
}

/* Filters */
.cm-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-bottom: 77px;
}

.cm-filter {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cm-filter__label {
  font-family: "recoleta", "Fraunces", serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 30px;
  color: #10477C;
}

/* Custom dropdown */
.cm-dropdown {
  position: relative;
  width: 180px;
}

.cm-dropdown__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 40px;
  background-color: #FDCB1F;
  font-size: 12px;
  font-weight: 600;
  line-height: 12px;
  color: #6C2975;
  text-align: left;
  transition: border-color 0.2s ease;
}

.cm-dropdown__trigger:hover {
  border-color: #8C00FF;
}

.cm-dropdown__caret {
  flex-shrink: 0;
  width: 8px;
  height: 7px;
  transition: transform 0.2s ease;
}

.cm-dropdown__trigger[aria-expanded="true"] .cm-dropdown__caret {
  transform: rotate(180deg);
}

.cm-dropdown__options {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 15;
  display: none;
  width: 100%;
  margin-top: 2px;
  padding: 20px 0;
  border-radius: 20px;
  background-color: #FDCB1F;
  box-shadow: 0 0 4px 0 #E9E1F8;
  font-size: 12px;
  font-weight: 600;
  color: #6C2975;
}

.cm-dropdown.is-open .cm-dropdown__options {
  display: block;
}

.cm-dropdown__options li {
  padding: 8px 16px;
  cursor: pointer;
}

.cm-dropdown__options li:hover,
.cm-dropdown__options li.is-focused,
.cm-dropdown__options li[aria-selected="true"] {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Card grid */
.cm-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

/* Resource card */
.cm-card--resource {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 22px 20px;
  background-color: #5BC6D0;
}

.cm-card__type {
  font-size: 12px;
  font-weight: 800;
  line-height: 12px;
  letter-spacing: 0.36px;
  text-transform: uppercase;
  color: #fff;
}

.cm-card--resource__body {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.cm-card--resource .cm-card__title {
  flex: 1;
  color: #000;
}

.cm-card--resource__image {
  flex: 0 1 31.295%;
  min-width: 0;
  height: auto;
  margin-left: 10px;
  border-radius: 8px;
  aspect-ratio: 1;
  object-fit: cover;
}

/* Story card */
.cm-card--story {
  display: flex;
  flex-direction: column;
  background-color: #FFF7DA;
}

.cm-card--story__image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.cm-card--story .cm-card__title {
  padding: 20px 20px 0;
  color: #10477C;
}

.cm-card--story__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: auto 20px 20px;
  padding-top: 16px;
}

/* =========================================================
   EXPLORE MORE TOPICS
   ========================================================= */
.cm-explore {
  padding: 7.937vw 5.291vw;
  overflow-x: clip;
}

.cm-explore__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.cm-explore__intro {
  position: relative;
  display: flex;
  align-items: center;
  padding: 30px;
  border-radius: 0 40px 40px 0;
  background-color: #6C2975;
  transform: translate(-5%, -10%);
}

.cm-explore__intro::before {
  content: "";
  position: absolute;
  top: 0;
  right: calc(100% - 1px);
  width: 50vw;
  height: 100%;
  background-color: #6C2975;
}

.cm-explore__title {
  font-family: "recoleta", "Fraunces", serif;
  font-size: clamp(24px, 2.5132vw, 38px);
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
}

/* Topic card */
.cm-topic-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px 20px;
  border-radius: 40px;
  background-color: #fff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cm-topic-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(16, 71, 124, 0.1);
}

.cm-topic-card__icon {
  width: 90px;
  height: 90px;
  margin: 0 auto;
  color: #ED4A38;
}

.cm-topic-card__icon svg,
.cm-topic-card__icon img {
  width: 100%;
  height: 100%;
}

.cm-topic-card__title {
  margin-bottom: 8px;
  font-family: "galano", "Outfit", sans-serif;
  font-size: clamp(18px, 1.5873vw, 24px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
  text-align: center;
  color: #10477C;
}

.cm-topic-card__description {
  display: -webkit-box;
  margin-bottom: 16px;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.38;
  text-align: center;
  color: #7A7A7A;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cm-topic-card__meta {
  margin-top: auto;
  padding: clamp(15px, 1.9841vw, 30px);
  border-radius: 20px;
  background-color: #EFF9FA;
}

.cm-topic-card__meta-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cm-topic-card__meta-item + .cm-topic-card__meta-item {
  margin-top: 12px;
  padding-top: 12px;
}

.cm-topic-card__meta dt {
  font-size: 11px;
  font-weight: 600;
  line-height: 11px;
  letter-spacing: 0.55px;
  text-transform: uppercase;
  color: #5BC6D0;
}

.cm-topic-card__meta dd {
  font-size: 14px;
  font-weight: 600;
  line-height: 15px;
  color: #10477C;
}

/* =========================================================
   RESPONSIVE — max-width 1439px
   ========================================================= */
@media (max-width: 1439px) {
  .cm-hero__body {
    gap: 40px;
  }

  .cm-topic-section {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 36px;
  }

  .cm-card-grid {
    gap: 20px;
  }
}

/* =========================================================
   RESPONSIVE — max-width 1199px
   ========================================================= */
@media (max-width: 1199px) {
  .cm-topic-section {
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .cm-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cm-explore__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================================================
   RESPONSIVE — max-width 1023px
   ========================================================= */
@media (max-width: 1023px) {
  .cm-breadcrumbs,
  .cm-hero {
    padding-left: 40px;
    padding-right: 40px;
  }

  .cm-hero {
    padding-top: 28px;
    padding-bottom: 96px;
  }

  .cm-hero__body {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .cm-hero__text {
    justify-content: flex-start;
  }

  .cm-topic-panel {
    margin: 0 40px;
  }

  .cm-scroll-nav {
    margin-left: 20px;
  }

  .cm-topic-section {
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 80px 40px;
  }

  .cm-topic-section__main {
    max-width: none;
  }

  .cm-topic-section__sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .cm-topic-section__sidebar .cm-download-card {
    flex: 1 1 240px;
  }

  .cm-topic-section--resources {
    padding-bottom: 64px;
  }

  .cm-section-title {
    margin-bottom: 40px;
  }

  .cm-eyebrow {
    margin-bottom: 28px;
  }

  .cm-rich-text p,
  .cm-rich-text :where(ul, ol) {
    font-size: 20px;
  }

  .cm-filters {
    margin-bottom: 48px;
  }

  .cm-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cm-explore {
    padding: 80px 40px;
  }
}

/* =========================================================
   RESPONSIVE — max-width 767px
   ========================================================= */
@media (max-width: 767px) {
  .cm-breadcrumbs,
  .cm-hero {
    padding-left: 20px;
    padding-right: 20px;
  }

  .cm-breadcrumbs__list {
    padding: 8px 14px;
    font-size: 14px;
  }

  .cm-hero {
    padding-top: 24px;
    padding-bottom: 72px;
  }

  .cm-hero__header {
    gap: 14px;
    margin-bottom: 24px;
  }

  .cm-topic-icon--lg {
    width: 40px;
    height: 40px;
  }

  .cm-hero__description {
    font-size: 18px;
    line-height: 1.6;
  }

  .cm-download-card {
    padding: 22px 24px;
  }

  .cm-video__play {
    width: 56px;
    height: 56px;
  }

  .cm-topic-panel-wrap {
    background: linear-gradient(to bottom, #A9E4DE 200px, #F0F1EC 200px);
  }

  .cm-topic-panel {
    margin: 0 20px;
    border-radius: 24px;
  }

  .cm-scroll-nav {
    top: 34px;
    margin-left: 0;
    margin-right: 0;
  }

  .cm-scroll-nav__list {
    margin: 0 auto;
  }

  .cm-scroll-nav__item {
    padding: 16px 12px;
    font-size: 15px;
    line-height: 18px;
  }

  .cm-scroll-nav__list li:first-child .cm-scroll-nav__item {
    padding-left: 22px;
  }

  .cm-scroll-nav__list li:last-child .cm-scroll-nav__item {
    padding-right: 22px;
  }

  .cm-topic-section {
    gap: 32px;
    padding: 56px 20px;
  }

  .cm-topic-section__sidebar {
    flex-direction: column;
  }

  .cm-topic-section__sidebar .cm-download-card {
    flex-basis: auto;
  }

  .cm-eyebrow {
    margin-bottom: 20px;
  }

  .cm-section-title {
    margin-bottom: 28px;
  }

  .cm-rich-text p,
  .cm-rich-text :where(ul, ol) {
    margin-bottom: 18px;
    font-size: 17px;
    line-height: 1.65;
  }

  .cm-topic-section--resources {
    padding-bottom: 40px;
  }

  .cm-filters {
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
  }

  .cm-filter {
    justify-content: space-between;
  }

  .cm-card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .cm-card {
    min-height: 200px;
  }

  .cm-explore {
    padding: 64px 20px;
  }

  .cm-explore__grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .cm-explore__intro {
    min-height: 120px;
    margin-bottom: 8px;
    border-radius: 0 32px 32px 0;
    transform: translateX(-20px);
  }

  .cm-topic-card {
    border-radius: 28px;
  }

  .cm-topic-card__icon {
    width: 64px;
    height: 64px;
  }
}

/* =========================================================
   LOGGED-IN: keep the sticky scroll nav and download sidebar below the
   WP admin bar (32px tall above 782px, 46px at 782px and below, not fixed
   at 600px and below). js/topic-single.js reads the computed `top`, so the
   active-section tracking follows these offsets automatically.
   ========================================================= */
.admin-bar .cm-scroll-nav {
  top: calc(40px + 32px);
}

.admin-bar .cm-topic-section__sidebar {
  top: calc(100px + 32px);
}

@media (max-width: 782px) {
  .admin-bar .cm-scroll-nav {
    top: calc(40px + 46px);
  }
}

@media (max-width: 767px) {
  .admin-bar .cm-scroll-nav {
    top: calc(34px + 46px);
  }
}

@media (max-width: 600px) {
  .admin-bar .cm-scroll-nav {
    top: 34px;
  }
}
