/* Recent Topics carousel */
#recent-topics {
  --rt-color-primary: #B20623;
  --rt-color-primary-rgb: 178, 6, 35;
  --rt-color-contrast: #ffffff;
  --rt-color-surface: #ffffff;
  --rt-color-muted: #f5f7fb;
  --rt-color-muted-dark: #e3e7f0;
  --rt-color-text: #1f1f1f;
  position: relative;
  max-width: 960px;
  margin: 0 auto 2rem;
  padding: 0 0.75rem;
}

#recent-topics .rt-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

#recent-topics .rt-heading {
  color: #141414;
  letter-spacing: 0.03em;
}

.rt-carousel-frame {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

#recent-topics.rt-frame-ready .rt-carousel-frame {
  display: flex;
}

.rt-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 0 1.2rem;
  text-align: center;
  color: rgba(31, 31, 31, 0.8);
}

.rt-loader__spinner {
  width: clamp(32px, 8vw, 48px);
  height: clamp(32px, 8vw, 48px);
  border-radius: 50%;
  position: relative;
  background: conic-gradient(
    #B20623 0deg 120deg,
    #ffffff 120deg 240deg,
    #000000 240deg 360deg
  );
  animation: rt-spin 1.2s linear infinite;
}

.rt-loader__spinner::after {
  content: "";
  position: absolute;
  inset: clamp(8px, 2.5vw, 12px);
  border-radius: 50%;
  background: #006400;
}

.rt-loader__text {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.rt-loader--error {
  color: #b20623;
}

.rt-loader--error .rt-loader__spinner {
  display: none;
}

@keyframes rt-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.rt-card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  touch-action: pan-y;
  -ms-touch-action: pan-y;
}

.rt-card-list > li {
  width: 100%;
  max-width: 560px;
  display: none;
}

.rt-card-list > li.rt-active {
  display: block;
}

.rt-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.3rem 1.1rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
  text-align: center;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.1rem;
  will-change: transform, opacity;
}

.rt-card--slide-in-forward {
  animation: rt-card-slide-in-forward 0.22s ease-out both;
}

.rt-card--slide-in-backward {
  animation: rt-card-slide-in-backward 0.22s ease-out both;
}

@keyframes rt-card-slide-in-forward {
  from {
    transform: translateX(28px);
    opacity: 0.05;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes rt-card-slide-in-backward {
  from {
    transform: translateX(-28px);
    opacity: 0.05;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.rt-excerpt {
  font-size: clamp(0.9rem, calc(0.6vw + 0.65rem), 1rem);
  line-height: 1.6;
  color: #474747;
  margin: 0;
  text-align: left;
  word-break: break-word;
}

.rt-topic-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0;
}

.rt-topic-link {
  margin: 0;
}

.rt-topic-link > a {
  display: block;
  color: var(--rt-color-primary);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.rt-topic-link > a:hover,
.rt-topic-link > a:focus {
  text-decoration: underline;
}

.rt-first-excerpt {
  margin: 0.35rem 0 0;
  font-size: clamp(0.875rem, calc(0.55vw + 0.655rem), 0.995rem);
  font-style: italic;
  color: rgba(31, 31, 31, 0.65);
  text-align: left;
  line-height: 1.55;
  word-break: break-word;
}

.rt-topic-meta,
.rt-post-summary__meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  font-size: clamp(0.875rem, calc(0.5vw + 0.67rem), 0.9375rem);
  letter-spacing: 0.01em;
  color: rgba(31, 31, 31, 0.58);
  font-weight: 400;
  text-align: center;
}

.rt-topic-meta .icon,
.rt-post-summary__meta .icon {
  font-size: clamp(0.875rem, calc(0.35vw + 0.74rem), 0.9375rem);
  color: rgba(var(--rt-color-primary-rgb), 0.7);
}

.rt-topic-meta .username,
.rt-topic-meta .username-coloured,
.rt-post-summary__meta .username,
.rt-post-summary__meta .username-coloured {
  font-weight: 400;
  text-decoration: none;
  color: inherit;
}

.rt-topic-meta .username:hover,
.rt-topic-meta .username:focus,
.rt-topic-meta .username-coloured:hover,
.rt-topic-meta .username-coloured:focus,
.rt-post-summary__meta .username:hover,
.rt-post-summary__meta .username:focus,
.rt-post-summary__meta .username-coloured:hover,
.rt-post-summary__meta .username-coloured:focus {
  color: var(--rt-color-primary);
  text-decoration: underline;
}

.rt-topic-meta__item {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: rgba(31, 31, 31, 0.58);
}

.rt-topic-meta__item time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rt-post-summary {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0;
}

.rt-post-summary__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
}

.rt-post-summary__label {
  font-size: clamp(0.875rem, calc(0.35vw + 0.675rem), 1.025rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rt-color-primary);
  white-space: nowrap;
}

.rt-post-summary__rule {
  flex: 1 1 60px;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(var(--rt-color-primary-rgb), 0) 0%,
    rgba(var(--rt-color-primary-rgb), 0.25) 40%,
    rgba(var(--rt-color-primary-rgb), 0.4) 60%,
    rgba(var(--rt-color-primary-rgb), 0) 100%
  );
}

.rt-post-summary__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.rt-post-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: clamp(0.875rem, calc(0.45vw + 0.69rem), 0.9375rem);
  color: rgba(31, 31, 31, 0.6);
}

.rt-post-meta .icon {
  font-size: clamp(0.875rem, calc(0.35vw + 0.74rem), 0.9375rem);
  color: rgba(var(--rt-color-primary-rgb), 0.7);
}

.rt-post-meta time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rt-last-post-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  color: var(--rt-color-primary);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: inherit;
  background: transparent;
  transition: color 0.2s ease;
}

.rt-last-post-link .icon {
  font-size: 0.9em;
}

.rt-last-post-link:hover,
.rt-last-post-link:focus {
  color: var(--rt-color-primary);
  text-decoration: underline;
}

.rt-button,
.rt-reply-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 1.4rem;
  border: 1px solid var(--rt-color-primary);
  border-radius: 18px;
  color: var(--rt-color-primary);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.rt-button:hover,
.rt-button:focus,
.rt-reply-button:hover,
.rt-reply-button:focus {
  background: var(--rt-color-primary);
  color: var(--rt-color-contrast);
  border-color: var(--rt-color-primary);
  box-shadow: 0 0 0 3px rgba(var(--rt-color-primary-rgb), 0.12);
}

.rt-button:focus-visible,
.rt-reply-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--rt-color-primary-rgb), 0.25);
}

.rt-button[disabled],
.rt-button[aria-disabled="true"],
.rt-reply-button[disabled],
.rt-reply-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
  background: rgba(var(--rt-color-primary-rgb), 0.08);
}

.rt-reply-button {
  padding: 0.5rem 1.4rem;
  border-radius: 18px;
  margin: 0 auto;
}

.rt-nav {
  background: transparent;
  border: none;
  color: var(--rt-color-primary);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  transition: background 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

.rt-nav:hover {
  background: rgba(var(--rt-color-primary-rgb), 0.12);
}

.rt-nav[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
  color: var(--rt-color-primary);
}

.rt-empty-item {
  text-align: center;
}

.rt-empty-item[hidden] {
  display: none !important;
}

.rt-pagination {
  margin: 2rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 720px;
}

.rt-pagination__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 12px;
  border: 1px solid transparent;
  box-shadow: none;
}

.rt-pagination__item {
  display: flex;
}

.rt-pagination__item[hidden] {
  display: none !important;
}
.rt-pagination-shell {
  display: none;
}

#recent-topics.rt-frame-ready .rt-pagination-shell {
  display: block;
}

.rt-pagination__ellipsis {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: rgba(20, 20, 20, 0.5);
  padding: 0 0.35rem;
}

.rt-pagination__button,
.rt-pagination__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(var(--rt-color-primary-rgb), 0.18);
  background: transparent;
  color: var(--rt-color-text);
  font-size: clamp(0.875rem, calc(0.25vw + 0.755rem), 0.975rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: none;
  touch-action: manipulation;
}

.rt-pagination__button:hover,
.rt-pagination__button:focus,
.rt-pagination__arrow:hover,
.rt-pagination__arrow:focus {
  background: rgba(var(--rt-color-primary-rgb), 0.08);
  color: var(--rt-color-primary);
  border-color: rgba(var(--rt-color-primary-rgb), 0.38);
  box-shadow: 0 0 0 1px rgba(var(--rt-color-primary-rgb), 0.12);
}

.rt-pagination__button:focus-visible,
.rt-pagination__arrow:focus-visible {
  outline: 2px solid rgba(var(--rt-color-primary-rgb), 0.45);
  outline-offset: 2px;
  box-shadow: none;
}

.rt-pagination__button--active,
.rt-pagination__button[aria-current="page"] {
  background: var(--rt-color-primary);
  color: var(--rt-color-contrast);
  border-color: var(--rt-color-primary);
  box-shadow: 0 4px 12px rgba(var(--rt-color-primary-rgb), 0.22);
}

.rt-pagination__button--active:hover,
.rt-pagination__button--active:focus,
.rt-pagination__button[aria-current="page"]:hover,
.rt-pagination__button[aria-current="page"]:focus {
  color: var(--rt-color-contrast);
}

.rt-pagination__button[disabled],
.rt-pagination__button[aria-disabled="true"],
.rt-pagination__arrow[disabled],
.rt-pagination__arrow[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  background: transparent;
  color: rgba(31, 31, 31, 0.38);
  border-color: rgba(var(--rt-color-primary-rgb), 0.14);
  box-shadow: none;
}

.rt-pagination__arrow-icon {
  font-size: 1rem;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  #recent-topics * {
    transition: none !important;
    animation: none !important;
  }
}

@media (max-width: 520px) {
  #recent-topics {
    padding: 0;
    margin: 0 auto 1.75rem;
  }

  #recent-topics .rt-header {
    margin-bottom: 1rem;
  }

  #recent-topics .rt-heading {
    letter-spacing: 0.025em;
  }

  .rt-carousel-frame {
    gap: 0.1rem;
  }

  .rt-card {
    padding: 1.35rem 1.1rem;
    border-radius: 16px;
    min-height: 280px;
    gap: 1.25rem;
  }

  .rt-topic-header {
    gap: 0.45rem;
  }

  .rt-first-excerpt {
    line-height: 1.65;
    margin: 0.4rem 0 0;
  }

  .rt-excerpt {
    line-height: 1.8;
  }

  .rt-topic-meta {
    gap: 0.35rem;
  }

  .rt-topic-meta__item {
    gap: 0.24rem;
  }

  .rt-post-summary {
    gap: 0.78rem;
    margin-top: 0;
  }

  .rt-post-summary__header {
    gap: 0.62rem;
  }

  .rt-post-summary__rule {
    flex-basis: 52px;
  }

  .rt-post-summary__meta {
    gap: 0.35rem;
  }

  .rt-post-meta {
    line-height: 1.65;
  }

  .rt-nav {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .rt-pagination__list {
    width: 100%;
    gap: 0.25rem;
  }

  .rt-pagination__button,
  .rt-pagination__arrow {
    min-width: 2.1rem;
    padding: 0.38rem 0.7rem;
    font-size: 0.76rem;
  }

  .rt-card-list > li {
    max-width: 100%;
  }

  #recent-topics {
    max-width: 100%;
  }

  .rt-carousel-frame {
    width: 100%;
  }

  .rt-card {
    width: 100%;
  }
}

@media (min-width: 600px) {
  #recent-topics {
    padding: 0 1.1rem;
    margin: 0 auto 2.25rem;
  }

  #recent-topics .rt-heading {
    letter-spacing: 0.035em;
  }

  .rt-card {
    padding: 1.95rem 1.65rem;
    border-radius: 22px;
    min-height: 330px;
    gap: 1.5rem;
  }

  .rt-excerpt {
    line-height: 1.85;
  }

  .rt-topic-header {
    gap: 0.5rem;
  }

  .rt-first-excerpt {
    margin: 0.45rem 0 0;
    line-height: 1.7;
  }

  .rt-topic-meta {
    gap: 0.4rem;
  }

  .rt-post-summary__meta {
    gap: 0.4rem;
  }

  .rt-post-summary {
    gap: 0.9rem;
    margin-top: 0;
  }

  .rt-post-summary__header {
    gap: 0.95rem;
  }

  .rt-post-summary__label {
  }

  .rt-post-meta {
    line-height: 1.65;
  }

  .rt-button,
  .rt-reply-button {
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
  }

  .rt-nav {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    font-size: 1.4rem;
  }

  .rt-pagination__button,
  .rt-pagination__arrow {
    min-width: 2.5rem;
    padding: 0.48rem 0.95rem;
  }

  .rt-pagination__list {
    gap: 0.4rem;
  }

  .rt-pagination {
    gap: 0.85rem;
  }
}

@media (min-width: 768px) {
  #recent-topics {
    padding: 0 1.75rem;
    margin: 0 auto 2.5rem;
  }

  #recent-topics .rt-heading {
    letter-spacing: 0.05em;
  }

  .rt-card {
    padding: 2.35rem 2.05rem;
    border-radius: 26px;
    min-height: 380px;
    gap: 1.85rem;
  }

  .rt-topic-header {
    gap: 0.55rem;
  }

  .rt-first-excerpt {
    margin: 0.55rem 0 0;
    line-height: 1.75;
  }

  .rt-topic-meta {
    gap: 0.45rem;
  }

  .rt-post-summary__meta {
    gap: 0.45rem;
  }

  .rt-post-summary {
    gap: 1.05rem;
  }

  .rt-post-summary__label {
  }

  .rt-post-meta {
    line-height: 1.7;
  }

  .rt-nav {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    font-size: 1.55rem;
  }

  .rt-pagination__button,
  .rt-pagination__arrow {
    min-width: 2.7rem;
    padding: 0.52rem 1.05rem;
  }

  .rt-pagination__list {
    gap: 0.5rem;
  }

  .rt-pagination {
    gap: 0.95rem;
  }
}

@media (min-width: 992px) {
  #recent-topics {
    padding: 0 1.75rem;
    margin: 0 auto 3rem;
  }

  .rt-card {
    padding: 2.85rem 2.5rem;
    border-radius: 28px;
    min-height: 430px;
    gap: 2.1rem;
  }

  .rt-topic-header {
    gap: 0.65rem;
  }

  .rt-first-excerpt {
    margin: 0.6rem 0 0;
    line-height: 1.8;
  }

  .rt-topic-meta {
    gap: 0.55rem;
  }

  .rt-post-summary__meta {
    gap: 0.55rem;
  }

  .rt-post-summary {
    gap: 1.25rem;
  }

  .rt-post-summary__label {
  }

  .rt-post-meta {
    line-height: 1.75;
  }

  .rt-nav {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    font-size: 1.68rem;
  }

  .rt-pagination__button,
  .rt-pagination__arrow {
    min-width: 2.95rem;
    padding: 0.58rem 1.2rem;
  }

  .rt-pagination__list {
    gap: 0.6rem;
  }

  .rt-pagination {
    gap: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rt-card--slide-in-forward,
  .rt-card--slide-in-backward {
    animation: none !important;
  }
}
