/* The fan carousel uses the same layered 16:9 artwork on desktop and mobile. */
.catalog-hero {
  position: relative;
  width: 100%;
  isolation: isolate;
  container-type: inline-size;
  aspect-ratio: 3.93453;
  touch-action: pan-y;
}

.catalog-hero-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.catalog-hero-card {
  --hero-offset: 0%;
  --hero-scale: 1;
  --hero-dim: 0;
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 35.3%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #14171e;
  transform: translate(-50%, -50%) translateX(var(--hero-offset)) scale(var(--hero-scale));
  transition: transform .5s cubic-bezier(.22,.7,.2,1);
}

@media (max-width: 767px) {
  .catalog-hero-card { transition-duration: .35s; }
}

.catalog-hero-card--wrapped { transition: none; }
.catalog-hero-card:not([data-slot]) { display: none; }
.catalog-hero-card[data-slot="0"] { --hero-scale: 1.28; }
.catalog-hero-card[data-slot="-1"] { --hero-offset: -52%; }
.catalog-hero-card[data-slot="1"] { --hero-offset: 52%; }
.catalog-hero-card[data-slot="-2"] { --hero-offset: -88%; }
.catalog-hero-card[data-slot="2"] { --hero-offset: 88%; }

.catalog-hero-card:is([data-slot="-1"], [data-slot="1"]) {
  z-index: 2;
  --hero-scale: .88;
  --hero-dim: .28;
}

.catalog-hero-card:is([data-slot="-2"], [data-slot="2"]) {
  z-index: 1;
  --hero-scale: .77;
  --hero-dim: .44;
}

.catalog-hero-card[data-slot]:not(:is([data-slot="0"], [data-slot="-1"], [data-slot="1"], [data-slot="-2"], [data-slot="2"])) { display: none; }

.catalog-hero-link,
.catalog-hero-image,
.catalog-hero-preview {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.catalog-hero-link { color: #fff; }
.catalog-hero-link[aria-hidden] { pointer-events: none; }
.catalog-hero-image { object-fit: cover; }
.catalog-hero-card[data-slot="0"] .catalog-hero-image { clip-path: inset(0 0 2px); }
.catalog-hero-preview { z-index: 3; width: 35%; padding: 0; border: 0; background: transparent; cursor: pointer; }
.catalog-hero-card:not([data-slot="0"]) { cursor: pointer; }
.catalog-hero-card:is([data-slot="-1"], [data-slot="-2"]) .catalog-hero-preview { right: auto; }
.catalog-hero-card:is([data-slot="1"], [data-slot="2"]) .catalog-hero-preview { left: auto; }
.catalog-hero-card:is([data-slot="-2"], [data-slot="2"]) .catalog-hero-preview { width: 38%; }
.catalog-hero-preview[hidden],
.catalog-hero-arrow[hidden],
.home-slider-arrow[hidden] { display: none; }

.catalog-hero-link::before,
.catalog-hero-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.catalog-hero-link::before {
  background: rgb(0 0 0 / var(--hero-dim));
  transition: background .5s;
}

.catalog-hero-link::after {
  /* Overlap the image crop so scaling cannot expose the artwork along the lower edge. */
  bottom: -2px;
  background: linear-gradient(180deg, transparent 30%, #080b162e 45%, #080b16d1 82%, #080b16 calc(100% - 6px));
  opacity: 0;
  transition: opacity .4s;
}

.catalog-hero-copy {
  position: absolute;
  z-index: 2;
  inset: auto 8.5% 6%;
  display: grid;
  gap: 6px;
  min-width: 0;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}

.catalog-hero-card[data-slot="0"] .catalog-hero-link::after,
.catalog-hero-card[data-slot="0"] .catalog-hero-copy { opacity: 1; }

.catalog-hero-watch {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 5px;
  min-height: 35px;
  margin-bottom: 3px;
  padding: 5px 14px 5px 11px;
  border-radius: 999px;
  background: var(--site-blue);
  box-shadow: 0 4px 14px #080b164d;
  color: var(--site-blue-on-primary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.catalog-hero-watch svg { display: block; width: 16px; height: 16px; }
.catalog-hero-link:is(:hover, :focus-visible) .catalog-hero-watch { background: var(--site-blue-hover); }

.catalog-hero-title,
.catalog-hero-description,
.catalog-hero-tags {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-hero-title {
  color: #fff;
  font-size: clamp(20px, 1.85cqw, 32px);
  font-weight: 650;
  line-height: 1.35;
  text-shadow: 0 2px 8px #0004;
}

.catalog-hero-description {
  color: #c2c4cd;
  font-size: clamp(11px, .92cqw, 14px);
  line-height: 1.5;
}

.catalog-hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #a5a8b4;
  font-size: clamp(11px, .86cqw, 13px);
  line-height: 1.5;
}

.catalog-hero-tags { display: flex; align-items: center; gap: 8px; }
.catalog-hero-meta > strong { color: #ff268a; font-weight: 600; white-space: nowrap; }

.catalog-hero-arrow,
.home-slider-arrow {
  position: absolute;
  z-index: 5;
  top: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #ffffff29;
  border-radius: 50%;
  background: #1c1d2ee0;
  color: #fff;
  box-shadow: 0 2px 10px #0004;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color .2s, border-color .2s;
}

.catalog-hero-arrow--previous { left: 10px; }
.catalog-hero-arrow--next { right: 10px; }
.catalog-hero-arrow svg,
.home-slider-arrow svg { width: 19px; height: 19px; }
.catalog-hero-arrow:hover { background: #38394e; border-color: #ffffff66; }
.catalog-hero :is(.catalog-hero-link, .catalog-hero-preview):focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.catalog-hero-arrow:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

@media (min-width: 761px) and (max-width: 1000px) {
  .catalog-hero { aspect-ratio: 3.01932; }
  .catalog-hero-card { width: 46%; }
  .catalog-hero-copy { left: 7%; right: 7%; gap: 4px; }
  .catalog-hero-title { font-size: 20px; }
  .catalog-hero-meta { font-size: 10px; gap: 5px; }
  .catalog-hero-tags { gap: 5px; }
}

@media (max-width: 760px) {
  .catalog-hero { aspect-ratio: 2.072; }
  .catalog-hero-card { width: 78%; border-radius: 10px; }
  .catalog-hero-card[data-slot="0"] { --hero-scale: 1.1; }
  .catalog-hero-copy { left: 6%; right: 6%; bottom: 7%; gap: 4px; }
  .catalog-hero-watch { gap: 4px; min-height: 25px; margin-bottom: 1px; padding: 3px 10px 3px 7px; font-size: 10px; }
  .catalog-hero-watch svg { width: 13px; height: 13px; }
  .catalog-hero-title { font-size: clamp(17px, 4.8cqw, 26px); }
  .catalog-hero-description { font-size: 11px; }
  .catalog-hero-meta { font-size: 10px; gap: 6px; }
  .catalog-hero-tags { gap: 6px; }
  .catalog-hero-arrow { width: 32px; height: 32px; }
  .catalog-hero-arrow--previous { left: 5px; }
  .catalog-hero-arrow--next { right: 5px; }
  .catalog-hero-card:is([data-slot="-2"], [data-slot="2"]) .catalog-hero-preview { display: none; }
  .catalog-hero-card:is([data-slot="-1"], [data-slot="1"]) .catalog-hero-preview {
    top: 12%;
    height: 32%;
    width: 10%;
  }
  .catalog-hero-card[data-slot="-1"] .catalog-hero-preview { left: 37%; }
  .catalog-hero-card[data-slot="1"] .catalog-hero-preview { right: 37%; }
}

.home-slider {
  position: relative;
  min-width: 0;
  width: 100%;
}

@media (min-width: 768px) {
  [data-home-columns="7"] { --home-columns: 7; }
  html body.is-home-page [data-home-columns] > .card-grid {
    grid-template-columns: repeat(var(--home-columns, 6), minmax(0, 1fr)) !important;
  }
  html body.is-home-page .home-latest-section[data-home-columns] > .card-grid { row-gap: 28px !important; }
  html body.is-home-page .card-grid.home-slider-rail {
    --slider-gap: 20px;
    grid-template-columns: none !important;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - (var(--home-columns, 6) - 1) * var(--slider-gap)) / var(--home-columns, 6));
    gap: var(--slider-gap) !important;
    overflow: auto hidden;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
  }
  .home-slider-rail::-webkit-scrollbar { display: none; }
  .home-slider-rail .poster-card { scroll-snap-align: start; }
  .home-slider-rail .poster-card:focus-visible { outline-offset: -2px; }
}

.home-slider-arrow {
  top: var(--home-slider-arrow-top, 40%);
  width: 40px;
  height: 40px;
  background: #17191c;
}

.home-slider-arrow--previous { left: -18px; }
.home-slider-arrow--next { right: -18px; }
.home-slider-arrow:hover,
.home-slider-arrow:focus-visible { color: var(--site-blue-on-primary); background: var(--site-blue); border-color: var(--site-blue); }

@media (prefers-reduced-motion: reduce) {
  .catalog-hero-card,
  .catalog-hero-link::before,
  .catalog-hero-link::after,
  .catalog-hero-copy,
  .catalog-hero-arrow,
  .home-slider-arrow { transition: none; }
}

html body .haijiao-channel :is(.topic-breadcrumb, .channel-crumb) {
  gap: 4px 7px;
  color: #a0a2a5;
  font-size: 12px;
}

html body .haijiao-channel .topic-breadcrumb > span:not([aria-current]) { margin: 0; }
html body .haijiao-channel .topic-breadcrumb [aria-current="page"] { color: #83ceff; }
html body .haijiao-channel .topic-page-heading { margin-bottom: 28px; }
html body .haijiao-channel .topic-page-heading h1 { font-size: 32px; }

[data-catalog-grid] { scroll-margin-top: 4px; }
[data-catalog-grid] > .empty-state { grid-column: 1 / -1; }

html body .category-page .category-filters { margin-bottom: 28px; }
.category-filter-line .category-filter-options {
  display: flex;
  flex: 1 1 0;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-height: 108px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.category-filter-line[data-catalog-tags-row] { flex-wrap: nowrap; align-items: flex-start; }
.category-filter-line[data-catalog-tags-row] > span { padding-block-start: 7px; }
.category-filter-line [data-catalog-tags] {
  flex-wrap: nowrap;
  max-height: none;
  overflow: auto hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}
.category-filter-line [data-catalog-tags]::-webkit-scrollbar { display: none; }
.category-filter-line [data-catalog-tags][data-expanded] { flex-wrap: wrap; overflow: visible; }
.category-filter-line [data-catalog-tags] > a {
  flex: none;
  white-space: nowrap;
}
.category-filter-line [data-catalog-tags][data-expanded] > a { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.category-filter-line [data-catalog-tags]:not([data-expanded]) > a:focus-visible { outline-offset: -2px; }
.category-filter-toggle {
  flex: none;
  padding: 6px 12px;
  border: 1px solid #ffffff30;
  border-radius: 999px;
  background: #ffffff0a;
  color: #b8bbbd;
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.category-filter-toggle[hidden] { display: none; }
.category-filter-toggle:is(:hover, :focus-visible) { background: #ffffff14; color: #fff; }
.category-filter-line a { color: #b8bbbd; }
html body .category-filter-line a:is(:hover, :focus-visible, [aria-current="true"]) {
  background: var(--site-blue);
  color: var(--site-blue-on-primary);
}
.category-summary { gap: 20px; align-items: flex-end; margin-bottom: 24px; }
.category-summary a { padding: 4px 9px; border: 1px solid #ffffff24; border-radius: 4px; color: #a7abad; font-size: 11px; }
.category-summary a:is(:hover, :focus-visible) { background: var(--site-blue); color: var(--site-blue-on-primary); border-color: var(--site-blue); }
html body .category-page .haijiao-poster .poster-cover { aspect-ratio: 3 / 4; border-radius: 10px; }
html body .category-page .haijiao-poster .poster-card-title { font-size: 14px; }

@media (min-width: 761px) and (max-width: 1200px) {
  html body .category-page .card-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 24px 16px !important; }
}

@media (max-width: 1000px) {
  html body .topic-layout .card-grid.topic-detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 24px 16px !important; }
}

@media (max-width: 760px) {
  html body .haijiao-channel :is(.topic-breadcrumb, .channel-crumb) { margin-bottom: 18px; }
  html body .haijiao-channel .topic-page-heading,
  html body .category-page .channel-heading { margin-bottom: 20px; }
  html body .haijiao-channel .topic-page-heading h1 { font-size: 26px; }
  html body .haijiao-channel .topic-intro { font-size: 12px; line-height: 1.8; }
  html body .category-page .category-filters { padding: 14px; margin-bottom: 22px; }
  .category-filter-line { gap: 5px; padding-block: 8px; }
  .category-filter-line > span { flex-basis: 32px; width: 32px; }
  .category-filter-line .category-filter-options { gap: 5px; }
  .category-filter-line a { padding: 7px 14px; }
  .category-summary { align-items: flex-start; margin-bottom: 20px; }
  html body .category-page .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 22px 10px !important; }
  html body .category-page .haijiao-poster .poster-card-title { font-size: 12px; }
  html body .category-page .haijiao-poster .poster-card-subtitle { display: none; }
  html body .category-page .haijiao-poster .home-corner-badge { inset: 5px 5px auto auto; min-height: 0; padding: 2px 5px; font-size: 8px; }
  html body .category-page .haijiao-poster .episode-badge span { font-size: 9px; }
  html body .category-page .haijiao-poster .poster-card-meta { font-size: 10px; gap: 5px; flex-wrap: wrap; }
  html body .category-page .haijiao-poster-labels { font-size: 9px; }
}

@media (max-width: 600px) {
  html body .topic-layout .card-grid.topic-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 22px 12px !important; }
}

@media (max-width: 360px) {
  html body .category-page .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

html body.is-home-page .section-header .ghost-action-button {
  padding: 7px 14px;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid #ffffff12;
  background: #ffffff06;
  color: #c7c7c7;
  transition: color .18s, background-color .18s, border-color .18s;
}

html body.is-home-page .section-header .ghost-action-button:is(:hover, :focus-visible) {
  color: #1d9bf0;
  background: #1d9bf012;
  border-color: #1d9bf040;
}

html body.is-home-page .section-header .ghost-action-text {
  color: inherit;
  font-size: 12px;
  white-space: nowrap;
}

html body.is-home-page .section-header .ghost-action-text::after { content: none; }

@media (max-width: 760px) {
  html body.is-home-page .section-header .ghost-action-button { padding: 4px 10px; }
  html body.is-home-page .section-title { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html body.is-home-page .section-header .ghost-action-button { transition: none; }
}

html body .haijiao-channel.rank-layout .rank-page-heading h1 {
  font-size: 25px;
  line-height: 1.35;
}

html body .haijiao-channel.rank-layout .rank-page-heading { padding-bottom: 15px; }
html body .haijiao-channel.rank-layout .rank-tabs { gap: 8px; margin: 0 0 15px; }

html body .haijiao-channel.rank-layout .rank-tab {
  flex: 0 1 auto;
  width: auto;
  height: auto;
  min-width: 78px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid #ffffff0b;
  border-radius: 8px;
  background: #1d1d20;
  color: #929299;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
}

html body .haijiao-channel.rank-layout .rank-tab-text { color: inherit; font: inherit; }
html body .haijiao-channel.rank-layout .rank-tab--active {
  border-color: var(--site-blue);
  background: var(--site-blue);
  color: var(--site-blue-on-primary);
}

html body .haijiao-channel.rank-layout .rank-tab:not(.rank-tab--active):is(:hover, :focus-visible) {
  color: #1d9bf0;
  border-color: #1d9bf055;
}

@media (max-width: 760px) {
  html body .haijiao-channel.rank-layout .rank-page-heading h1 { font-size: 22px; }
  html body .haijiao-channel.rank-layout .rank-tab { min-height: 40px; }
}

@media (max-width: 600px) {
  html body .haijiao-channel.rank-layout .card-grid { gap: 26px 12px !important; }
}

@media (max-width: 767px) {
  html body.is-home-page [data-home-columns] .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 22px 12px !important;
  }
  .home-slider-arrow { display: none; }
  [data-mobile-preview="recent"] .poster-card:nth-child(n+5),
  [data-mobile-preview="ranked"] .poster-card:nth-child(n+7) { display: none; }
}
