/**
 * @file
 * Glass UI for category pages + matching sidebar panels.
 */

.puya-cat-page {
  --puya-cat-gap: 1.1rem;
}

.puya-cat-page__inner {
  display: flex;
  flex-direction: column;
  gap: var(--puya-cat-gap);
}

.puya-cat-page__header,
.puya-cat-panel,
.puya-cat-desc,
.puya-cat-feed-card,
.puya-sidebar-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--puya-glass-border);
  border-radius: 1.05rem;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)),
    var(--puya-glass-panel-bg);
  box-shadow: var(--puya-glass-shadow), inset 0 1px 0 var(--puya-glass-highlight);
  backdrop-filter: blur(var(--puya-glass-blur));
  -webkit-backdrop-filter: blur(var(--puya-glass-blur));
}

.puya-cat-page__header {
  padding: 1rem 1.25rem;
}

.puya-cat-page__header-glow {
  position: absolute;
  inset: auto -10% -40% auto;
  width: 55%;
  height: 120%;
  background: radial-gradient(circle, rgba(var(--bs-primary-rgb), 0.22), transparent 70%);
  pointer-events: none;
}

.puya-cat-page__title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  font-weight: 800;
  line-height: 1.35;
}

.puya-cat-hero__shell {
  height: 100%;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)),
    var(--puya-glass-bg);
}

.puya-cat-carousel__media img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.puya-cat-hero__card-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: auto;
}

/* Category hero: slider fills height of the two side cards */
@media (min-width: 768px) {
  .puya-cat-hero.is-hero-synced .alpha-frontpage-hero-slider-shell.is-height-synced {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .puya-cat-hero.is-hero-synced .alpha-frontpage-hero-slider-shell.is-height-synced > .row,
  .puya-cat-hero.is-hero-synced .alpha-frontpage-hero-slider-shell.is-height-synced > .row > [class*="col"],
  .puya-cat-hero.is-hero-synced #catCarousel,
  .puya-cat-hero.is-hero-synced #catCarousel .carousel-inner,
  .puya-cat-hero.is-hero-synced #catCarousel .carousel-item.active {
    height: 100%;
    min-height: 0;
  }

  .puya-cat-hero.is-hero-synced #catCarousel .carousel-item.active > .g-0,
  .puya-cat-hero.is-hero-synced #catCarousel .carousel-item.active > div {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  .puya-cat-hero.is-hero-synced #catCarousel .carousel-item.active .position-relative:first-child {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .puya-cat-hero.is-hero-synced #catCarousel .carousel-item.active .position-relative:first-child a,
  .puya-cat-hero.is-hero-synced #catCarousel .carousel-item.active .position-relative:first-child .field,
  .puya-cat-hero.is-hero-synced #catCarousel .carousel-item.active .position-relative:first-child .field__item,
  .puya-cat-hero.is-hero-synced #catCarousel .carousel-item.active .position-relative:first-child article {
    display: block;
    height: 100%;
  }

  .puya-cat-hero.is-hero-synced #catCarousel .carousel-item.active .position-relative:first-child img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .puya-cat-hero.is-hero-synced #catCarousel .alpha-carousel-content {
    flex: 0 0 auto;
    height: auto !important;
    min-height: 0 !important;
    margin-top: -2.75rem;
  }

  .puya-cat-hero.is-hero-synced #catCarousel .alpha-carousel-meta,
  .puya-cat-hero.is-hero-synced #catCarousel .card-title,
  .puya-cat-hero.is-hero-synced #catCarousel .alpha-carousel-lead {
    min-height: 0;
    max-height: none;
  }

  .puya-cat-hero.is-hero-synced #catCarousel .card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .puya-cat-hero.is-hero-synced #catCarousel .alpha-carousel-lead {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .puya-cat-side-latest .alpha-latest-card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

.puya-cat-desc {
  padding: 1rem 1.15rem;
}

.puya-cat-desc__body {
  position: relative;
  z-index: 1;
  font-size: 0.92rem;
  line-height: 1.75;
  color: inherit;
  opacity: 0.9;
}

.puya-cat-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.puya-cat-feed-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.puya-cat-feed-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--bs-primary-rgb), 0.4);
  box-shadow:
    0 16px 34px rgba(var(--bs-primary-rgb), 0.14),
    inset 0 1px 0 var(--puya-glass-highlight);
}

.puya-cat-feed-card__link {
  display: grid;
  grid-template-columns: minmax(110px, 220px) 1fr;
  gap: 0.85rem;
  align-items: stretch;
  text-decoration: none !important;
  color: inherit !important;
  padding: 0.7rem;
}

.puya-cat-feed-card__media {
  overflow: hidden;
  border-radius: 0.8rem;
  background: rgba(0, 0, 0, 0.06);
  align-self: start;
}

.puya-cat-feed-card__media img,
.puya-cat-feed-card__media .field,
.puya-cat-feed-card__media .field__item,
.puya-cat-feed-card__media article {
  display: block;
  width: 100%;
  height: auto;
}

.puya-cat-feed-card__media img {
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: opacity 0.25s ease;
}

.puya-cat-feed-card:hover .puya-cat-feed-card__media img {
  opacity: 0.92;
}

.puya-cat-feed-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.15rem 0.25rem;
}

.puya-cat-feed-card__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.55;
}

.puya-cat-feed-card__lead {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.65;
  opacity: 0.72;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.puya-cat-feed-card__cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--bs-primary);
  font-size: 0.82rem;
  font-weight: 700;
}

html[dir="ltr"] .puya-cat-feed-card__cta i {
  transform: scaleX(-1);
}

.puya-cat-section-header {
  margin-bottom: 0.85rem;
}

.puya-cat-section-header__title {
  margin: 0 0 0.2rem;
  font-size: 1.25rem;
  font-weight: 800;
}

.puya-cat-section-header__lead {
  margin: 0;
  font-size: 0.84rem;
  opacity: 0.65;
}

.puya-cat-panel {
  padding: 0.85rem 1rem;
  height: 100%;
}

.puya-cat-ranked__list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.puya-cat-ranked__item {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.65rem;
  align-items: start;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(127, 127, 127, 0.18);
}

.puya-cat-ranked__item:last-child {
  border-bottom: 0;
  padding-bottom: 0.15rem;
}

.puya-cat-ranked__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.55rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.25), transparent 45%),
    rgba(var(--bs-primary-rgb), 0.9);
  box-shadow: 0 6px 14px rgba(var(--bs-primary-rgb), 0.25);
}

.puya-cat-ranked__title {
  font-size: 0.9rem;
  line-height: 1.55;
  font-weight: 600;
}

.puya-cat-ranked__title a {
  color: inherit !important;
  text-decoration: none !important;
}

.puya-cat-ranked__title a:hover {
  color: var(--bs-primary) !important;
}

/* Sidebar glass */
.sidebar .puya-sidebar-panel,
#sidebar_second .puya-sidebar-panel {
  margin-bottom: 0.85rem;
  padding: 0.85rem;
}

.puya-sidebar-panel__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.85rem;
  color: inherit !important;
}

.puya-sidebar-panel__badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 0.75rem;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 42%),
    rgba(var(--bs-primary-rgb), 0.92);
  box-shadow: 0 8px 18px rgba(var(--bs-primary-rgb), 0.28);
  font-size: 1.1rem;
}

.puya-sidebar-panel__badge--mic {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(180deg, #7c3aed, #5b21b6);
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.28);
}

.puya-sidebar-panel__badge--news {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(180deg, #0ea5e9, #0369a1);
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.28);
}

.puya-sidebar-panel__copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1 1 auto;
}

.puya-sidebar-panel__title {
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.3;
}

.puya-sidebar-panel__subtitle {
  font-size: 0.75rem;
  line-height: 1.4;
  opacity: 0.62;
  font-weight: 500;
}

.puya-sidebar-panel__chevron {
  flex: 0 0 auto;
  color: var(--bs-primary);
  font-size: 0.95rem;
  opacity: 0.85;
}

html[dir="ltr"] .puya-sidebar-panel__chevron {
  transform: scaleX(-1);
}

.puya-sidebar-panel__head:hover .puya-sidebar-panel__title {
  color: var(--bs-primary);
}

.puya-sidebar-panel__icon {
  color: var(--bs-primary);
  font-size: 1rem;
}

.puya-sidebar-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.puya-sidebar-list__item {
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(127, 127, 127, 0.16);
  font-size: 0.86rem;
  line-height: 1.55;
}

.puya-sidebar-list__item:last-child {
  border-bottom: 0;
}

.puya-sidebar-list__item a {
  color: inherit !important;
  text-decoration: none !important;
}

.puya-sidebar-list__item a:hover {
  color: var(--bs-primary) !important;
}

.puya-sidebar-carousel {
  border-radius: 0.85rem;
  overflow: hidden;
}

.puya-sidebar-carousel__card {
  display: block;
  text-decoration: none !important;
  color: inherit !important;
}

.puya-sidebar-carousel__media {
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
}

.puya-sidebar-carousel__media img {
  width: 100%;
  display: block;
  object-fit: cover;
}

.puya-sidebar-carousel__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: #fff;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.35));
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.puya-sidebar-carousel__title {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.5;
}

.puya-sidebar-carousel .carousel-control-prev,
.puya-sidebar-carousel .carousel-control-next {
  width: 2.2rem;
  height: 2.2rem;
  top: 35%;
  bottom: auto;
  border-radius: 50%;
  opacity: 1;
}

.puya-sidebar-embed {
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid var(--puya-glass-border);
}

.puya-sidebar-embed iframe {
  display: block;
  max-width: 100%;
}

.puya-sidebar-media-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.puya-sidebar-media-list__link {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.55rem;
  align-items: center;
  text-decoration: none !important;
  color: inherit !important;
}

.puya-sidebar-media-list__thumb {
  overflow: hidden;
  border-radius: 0.55rem;
}

.puya-sidebar-media-list__thumb img {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 16 / 10;
}

.puya-sidebar-media-list__text {
  font-size: 0.84rem;
  line-height: 1.5;
  font-weight: 600;
}

.puya-sidebar-media-list__link:hover .puya-sidebar-media-list__text {
  color: var(--bs-primary);
}

/* Infinite scroll pager inside glass list */
.puya-cat-page__list .views-infinite-scroll-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.puya-cat-page__list .pager,
.puya-cat-page__list .js-pager__items {
  margin-top: 0.75rem;
}

@media (max-width: 767.98px) {
  .puya-cat-feed-card__link {
    grid-template-columns: 1fr;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .puya-cat-page__header,
  .puya-cat-panel,
  .puya-cat-desc,
  .puya-cat-feed-card,
  .puya-sidebar-panel {
    background: #17171a;
  }

  html[data-bs-theme="light"] .puya-cat-page__header,
  html[data-bs-theme="light"] .puya-cat-panel,
  html[data-bs-theme="light"] .puya-cat-desc,
  html[data-bs-theme="light"] .puya-cat-feed-card,
  html[data-bs-theme="light"] .puya-sidebar-panel {
    background: #ffffff;
  }
}
