/* ATLAS — Category showcase: mosaic main + wide listing sub-modal */

.tv-catshow-backdrop {
  position: fixed;
  inset: 0;
  z-index: 305;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.tv-catshow-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Main window: square mosaic tiles ── */
.tv-catshow {
  position: fixed;
  z-index: 315;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  width: min(1040px, calc(100vw - 20px));
  max-height: min(90vh, 820px);
  background: var(--tv-surface-solid);
  border: 1px solid var(--tv-line-soft);
  border-radius: 22px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Sub window: extra wide, like browse page ── */
.tv-catshow-sub {
  position: fixed;
  z-index: 325;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  width: min(1440px, calc(100vw - 20px));
  max-height: min(96vh, 980px);
  background: var(--tv-surface-solid);
  border: 1px solid var(--tv-line-soft);
  border-radius: 22px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tv-catshow.is-open,
.tv-catshow-sub.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.tv-catshow__head,
.tv-catshow-sub__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--tv-line-soft);
  flex-shrink: 0;
}

.tv-catshow__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tv-catshow__icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  background: var(--tv-bg-2);
  border: 1px solid var(--tv-line-soft);
  flex-shrink: 0;
}

.tv-catshow__head h2,
.tv-catshow-sub__head h2 {
  margin: 0;
  font-family: var(--tv-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tv-catshow__tag {
  margin: 4px 0 0;
  font-size: 0.76rem;
  color: var(--tv-muted);
  font-weight: 500;
}

.tv-catshow__body,
.tv-catshow-sub__body {
  padding: 18px 22px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mosaic grid — main window */
.tv-catshow__subs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (max-width: 640px) {
  .tv-catshow__subs { grid-template-columns: 1fr; }
}

.tv-catshow-subcard {
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--tv-line-soft);
  background: linear-gradient(165deg, var(--tv-surface-solid), var(--tv-bg-2));
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--tv-text);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s;
}

.tv-catshow-subcard:hover {
  transform: translateY(-3px);
  border-color: var(--tv-line);
  box-shadow: var(--tv-shadow-sm);
}

.tv-catshow-subcard__mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--tv-bg-2);
  aspect-ratio: 1;
  overflow: hidden;
}

.tv-catshow-subcard__mosaic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  min-height: 0;
  min-width: 0;
}

.tv-catshow-subcard__foot {
  padding: 12px 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tv-catshow-subcard__name {
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.25;
}

.tv-catshow-subcard__arrow {
  font-size: 0.9rem;
  color: var(--tv-muted);
  flex-shrink: 0;
}

/* Listing cards — sub window (wide browse grid) */
.tv-catshow-sub .tv-catshow-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 1100px) {
  .tv-catshow-sub .tv-catshow-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .tv-catshow-sub .tv-catshow-cards { grid-template-columns: repeat(2, 1fr); }
  .tv-catshow-sub { width: calc(100vw - 12px); }
}

@media (max-width: 420px) {
  .tv-catshow-sub .tv-catshow-cards { grid-template-columns: 1fr; }
}

.tv-catshow-sub .tv-card {
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--tv-line-soft);
  background: var(--tv-surface-solid);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
}

.tv-catshow-sub .tv-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--tv-shadow-sm);
}

.tv-catshow-sub .tv-card__img {
  aspect-ratio: 16 / 10;
  width: 100%;
  position: relative;
  overflow: hidden;
  background-color: #1a1a1e;
  flex-shrink: 0;
}

.tv-catshow-sub .tv-card__img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tv-catshow-sub .tv-card__img .tv-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}

.tv-catshow-sub .tv-card__body {
  padding: 12px 14px 14px;
}

.tv-catshow-sub .tv-card__price {
  font-family: var(--tv-display);
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 5px;
  color: var(--tv-gold);
}

.tv-catshow-sub .tv-card__title {
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.35;
}

.tv-catshow-sub .tv-card__meta {
  font-size: 0.72rem;
  color: var(--tv-muted);
  margin: 0;
}

.tv-catshow__all {
  margin-top: 14px;
  text-align: center;
}

.tv-catshow-sub__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--tv-line-soft);
}

.tv-catnav__item[data-tv-cat-open],
.tv-cat[data-tv-cat-open] {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .tv-catshow-backdrop,
  .tv-catshow,
  .tv-catshow-sub,
  .tv-catshow-subcard {
    transition: none;
  }
}
