/* Home catalogue layout. Card appearance remains in home-cards.css. */
body:has(.home-catalog) { --home-sidebar-open-size: 208px; --home-sidebar-size: var(--home-sidebar-open-size); --home-sidebar-gap: 30px; --home-filter-motion: 0.22s; --home-filter-ease: cubic-bezier(0.25, 0.1, 0.25, 1); }
body:has(.home-catalog) :is(.home-catalog, .home-seo) {
  width: min(100% - 64px, 1440px);
}
body:has(.home-catalog) .page { padding-top: 24px; }

.home-catalog {
  position: relative;
  display: grid;
  grid-template-columns: var(--home-sidebar-size) minmax(0, 1fr);
  grid-template-rows: auto minmax(64px, auto) repeat(4, 64px) 44px minmax(44px, 1fr);
  column-gap: var(--home-sidebar-gap);
  row-gap: 16px;
  min-height: calc(100vh - 140px);
  align-items: start;
  scroll-margin-top: 120px;
}
.home-catalog::before {
  content: "";
  grid-column: 1;
  grid-row: 1 / -1;
  align-self: stretch;
  border-right: 1px solid var(--border);
  margin-right: -15px;
  pointer-events: none;
}
.home-sidebar, .home-sidebar__body, .home-sidebar__inner, .home-sidebar .xsort-area { display: contents; }
.home-sidebar:not([open]) > .home-sidebar__body { display: none; }
.home-sidebar .xsort-label { display: none; }
.home-sidebar__heading {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--text-strong);
  font: 700 18px/1.3 var(--font);
  text-transform: none;
  cursor: pointer;
  list-style: none;
}
.home-sidebar__heading::-webkit-details-marker { display: none; }
.home-sidebar__heading::marker { content: ""; }
.home-sidebar__heading > svg:first-child { flex-shrink: 0; }
.home-sidebar__chevron { display: block; flex-shrink: 0; margin-left: auto; transform: rotate(90deg); }
.home-catalog__heading {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  font-size: clamp(23px, 2vw, 30px);
  line-height: 1.3;
  letter-spacing: -0.025em;
}
.home-sidebar .xsort-div:has(.xsort-ul) {
  grid-column: 1;
  width: 100%;
  height: 64px;
  padding-top: 23px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}
.home-sidebar .xsort-div:has([data-field="type"]) { grid-row: 2; }
.home-sidebar .xsort-div:has([data-field="year"]) { grid-row: 3; }
.home-sidebar .xsort-div:has([data-field="genre"]) { grid-row: 4; }
.home-sidebar .xsort-div:has([data-field="strana"]) { grid-row: 5; }
.home-sidebar .xsort-div:has([data-field="hd"]) { grid-row: 6; }
.home-filter-label {
  position: absolute;
  top: 0;
  left: 0;
  font: 400 13px/1.4 var(--font);
  color: var(--text-soft);
}
.home-sidebar .xsort-selected {
  position: relative;
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 400;
}
.home-sidebar .xsort-selected::after { top: 16px; }
.home-sidebar .is-open > .xsort-selected::after { top: 19px; }
.home-sidebar .xsort-div:is(.xsort-active, .is-open) .xsort-selected { border-color: var(--green); }
.home-sidebar .xsort-active .xsort-selected { background: var(--hover-soft); }
.home-sidebar .xsort-ul { min-width: min(208px, calc(100vw - 32px)); }
.home-sidebar .xsort-div:has(.xsort-selected:focus-visible) { outline: none; }
.home-sidebar .xsort-selected:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.home-sidebar .xsort-div:has([data-field="defaultsort"]) {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  width: 182px;
  margin-right: 104px;
  z-index: 2;
  height: 42px;
  padding-top: 0;
}
.home-sidebar .xsort-div:has([data-field="defaultsort"]) .home-filter-label { display: none; }
.home-sidebar .xsort-area .xsort-div-clearall {
  grid-column: 1;
  grid-row: 7;
  display: inline-flex;
  justify-self: start;
  justify-content: start;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.home-sidebar .xsort-div-clearall svg { display: none; }
.home-catalog .home-sidebar .xsort-area .xsort-div-clearall { display: inline-flex; }
.home-sidebar__favorites {
  grid-column: 1;
  grid-row: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 14px;
}
.home-sidebar__favorites:hover, .home-catalog__more:hover { color: var(--accent-text); }
/* Native sections stay visible together; active filters show the server results instead. */
.home-catalog__caption.home-catalog__filtered-heading { margin: 0 310px 16px 0; min-height: 44px; display: flex; align-items: center; }
.home-catalog__view {
  z-index: 2;
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  display: flex;
  gap: 4px;
  width: 92px;
}
.home-catalog__view-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  box-shadow: none;
  color: var(--text-soft);
  cursor: pointer;
}
.home-catalog__view-button:hover { background: var(--control-hover); }
.home-catalog__view-button[aria-pressed="true"] { color: var(--green); }
.home-catalog__content { grid-column: 2; grid-row: 2 / -1; min-width: 0; contain: layout; }
.home-catalog .cards-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 22px 16px; }
.home-catalog__panel[hidden], .home-catalog .home-card[hidden] { display: none; }
.home-feed-default { display: grid; gap: 36px; }
.home-catalog__panel { min-width: 0; scroll-margin-top: 128px; }
.home-catalog__panel:not(:has(.home-card)) { display: none; }
.home-catalog__section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 16px; }
.home-feed-default > .home-catalog__panel:first-child .home-catalog__section-head { margin-right: 310px; }
.home-catalog__panel + .home-catalog__panel { padding-top: 28px; border-top: 1px solid var(--border); }
.home-catalog__caption { margin: 0; color: var(--text-strong); font-size: 22px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; }
/* Limit homepage selections to two rows at each existing grid breakpoint. */
.home-catalog__panel .cards-grid > .home-card:nth-child(n + 13) { display: none; }
@media (max-width: 1350px) {
  .home-catalog__panel .cards-grid > .home-card:nth-child(n + 11) { display: none; }
}
@media (max-width: 1150px) {
  .home-catalog__panel .cards-grid > .home-card:nth-child(n + 9) { display: none; }
}
@media (max-width: 650px) {
  .home-catalog__panel .cards-grid > .home-card:nth-child(n + 7) { display: none; }
}
@media (max-width: 520px) {
  .home-catalog__panel .cards-grid > .home-card:nth-child(n + 5) { display: none; }
}
:root[data-home-view="list"] .home-catalog__panel .cards-grid > .home-card:nth-child(n + 3) { display: none; }
.home-catalog__favorites > .section__head { margin-right: 310px; flex-wrap: wrap; }
.home-catalog__favorites { margin-bottom: 26px; padding-bottom: 26px; border-bottom: 1px solid var(--border); scroll-margin-top: 128px; }
.home-catalog__close { display: inline-flex; align-items: center; gap: 8px; padding: 8px; border: 0; background: none; color: var(--text-soft); font: 400 13px/1.4 var(--font); cursor: pointer; }
.home-catalog__close span { font-size: 22px; }
.home-catalog__more { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text-soft); font-size: 14px; white-space: nowrap; }
.home-catalog__links:empty { display: none; }
.home-catalog__links { margin-top: 28px; }
.home-catalog__links .xl-home { padding: 20px 0; background: transparent; border-top: 1px solid var(--border); box-shadow: none; }
.home-catalog :is(button, a, summary):focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
body:has(.home-catalog) .home-seo { padding-left: calc(var(--home-sidebar-size) + var(--home-sidebar-gap)); }
body:has(.home-catalog) .home-seo .descr { padding: 24px 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; box-shadow: none; }

@media (max-width: 1350px) {
  body:has(.home-catalog) { --home-sidebar-open-size: 190px; --home-sidebar-gap: 26px; }
  .home-catalog .cards-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 1150px) {
  .home-catalog .cards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  body:has(.home-catalog) :is(.home-catalog, .home-seo) { width: calc(100% - 40px); }
  .home-catalog { grid-template-columns: minmax(0, 1fr) 92px; grid-template-rows: auto auto auto auto; gap: 18px 12px; min-height: 0; }
  .home-catalog::before { display: none; }
  .home-catalog__heading { grid-column: 1 / -1; grid-row: 1; align-self: stretch; font-size: 24px; }
  .home-sidebar { grid-column: 1 / -1; grid-row: 2; display: block; width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }
  .home-sidebar__heading { width: 100%; min-height: 48px; padding: 0 14px; font-size: 15px; cursor: pointer; }
  .home-sidebar__chevron { transform: none; transition: transform 0.16s ease; }
  .home-sidebar[open] .home-sidebar__chevron { transform: rotate(180deg); }
  .home-sidebar__body {
    display: block;
    padding: 0 14px;
  }
  .home-catalog.is-filter-motion .home-sidebar:not([open]) > .home-sidebar__body {
    display: block;
    overflow: hidden;
  }
  .home-sidebar__inner { display: block; padding-block: 4px 14px; }
  .home-sidebar .xsort-area { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; padding: 0; border: 0; background: none; }
  .home-sidebar .xsort-div:has(.xsort-ul), .home-sidebar .xsort-div:has([data-field="defaultsort"]) { grid-column: auto; grid-row: auto; width: 100%; height: 67px; padding-top: 23px; }
  .home-sidebar .xsort-div:has([data-field="defaultsort"]) { order: 6; margin-right: 0; }
  .home-sidebar .xsort-div:has([data-field="defaultsort"]) .home-filter-label { display: block; }
  .home-sidebar .xsort-selected { min-height: 44px; }
  .home-sidebar .xsort-area .xsort-div-clearall { grid-column: 1 / -1; grid-row: auto; order: 7; }
  .home-sidebar__favorites { display: none; }
  .home-catalog__view { grid-column: 2; grid-row: 3; z-index: 2; align-self: start; }
  .home-catalog__content { grid-column: 1 / -1; grid-row: 3; width: 100%; }
  .home-catalog__favorites > .section__head { margin-right: 104px; }
  .home-catalog__caption.home-catalog__filtered-heading { margin: 0 104px 16px 0; }
  .home-feed-default { gap: 26px; }
  .home-feed-default > .home-catalog__panel:first-child .home-catalog__section-head { margin-right: 104px; }
  .home-catalog__panel + .home-catalog__panel { padding-top: 22px; }
  .home-catalog__panel, .home-catalog__favorites { scroll-margin-top: 120px; }
  .home-catalog .cards-grid { gap: 18px 14px; }
  body:has(.home-catalog) .home-seo { padding-left: 0; }
}
@media (max-width: 768px) {
  body:has(.home-catalog) :is(.home-catalog, .home-seo) { width: calc(100% - 24px); }
}
@media (max-width: 650px) {
  .home-catalog .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  body:has(.home-catalog) :is(.home-catalog, .home-seo) { width: calc(100% - 20px); }
  body:has(.home-catalog) .page { padding-top: 18px; }
  .home-catalog { gap: 16px; }
  .home-catalog__heading { font-size: 22px; }
  .home-catalog .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .home-catalog__caption { font-size: 19px; }
  .home-catalog__section-head { gap: 8px; margin-bottom: 12px; }
  .home-catalog__more { gap: 5px; font-size: 12px; }
}
@media (min-width: 1351px) {
  /* Collapsed sidebar fits seven cards. Two full rows need 14, otherwise the last row keeps two empty tracks. */
  .home-catalog:has(> .home-sidebar:not([open])) .cards-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  :root:not([data-home-view="list"]) .home-catalog:has(> .home-sidebar:not([open])) .home-catalog__panel .cards-grid > .home-card:nth-child(-n + 14) { display: flex; }
}
@media (min-width: 901px) {
  .home-sidebar::details-content { display: contents; }
  .home-sidebar .xsort-div:has(.xsort-ul:not([data-field="defaultsort"])),
  .home-sidebar .xsort-div-clearall, .home-sidebar__favorites { width: var(--home-sidebar-open-size); }
  .home-sidebar__heading { width: 100%; overflow: hidden; white-space: nowrap; }
  .home-sidebar__heading > span { flex-shrink: 0; }
  .home-sidebar__heading > svg:first-child { transition: transform var(--home-filter-motion) var(--home-filter-ease); }
  .home-sidebar__heading > :is(span, .home-sidebar__chevron),
  .home-sidebar .xsort-div:has(.xsort-ul),
  .home-sidebar .xsort-div-clearall,
  .home-sidebar__favorites {
    transition: opacity 0.18s ease, transform var(--home-filter-motion) var(--home-filter-ease), visibility 0s linear;
  }
  .home-sidebar__heading > .home-sidebar__chevron { transform: rotate(90deg); }
  body:has(.home-catalog > .home-sidebar:not([open])) { --home-sidebar-size: 44px; }
  .home-catalog.is-filter-motion { overflow-x: clip; }
  .home-catalog.is-filter-motion .home-sidebar:not([open]) > .home-sidebar__body { display: contents; }
  .home-catalog.is-filter-motion .home-sidebar:not([open]) > .home-sidebar__heading { justify-content: flex-start; }
  .home-catalog.is-filter-motion .home-sidebar:not([open]) > .home-sidebar__heading > svg:first-child { transform: translateX(11px); }
  .home-catalog.is-filter-prep .home-sidebar__heading > :is(span, .home-sidebar__chevron),
  .home-catalog.is-filter-prep .home-sidebar .xsort-div:has(.xsort-ul),
  .home-catalog.is-filter-prep .home-sidebar .xsort-div-clearall,
  .home-catalog.is-filter-prep .home-sidebar__favorites,
  .home-catalog.is-filter-motion .home-sidebar:not([open]) > .home-sidebar__heading > :is(span, .home-sidebar__chevron),
  .home-catalog.is-filter-motion .home-sidebar:not([open]) .xsort-div:has(.xsort-ul),
  .home-catalog.is-filter-motion .home-sidebar:not([open]) .xsort-div-clearall,
  .home-catalog.is-filter-motion .home-sidebar:not([open]) .home-sidebar__favorites {
    opacity: 0;
    transform: translateX(-14px);
    pointer-events: none;
  }
  .home-catalog.is-filter-motion .home-sidebar:not([open]) > .home-sidebar__heading > :is(span, .home-sidebar__chevron) { display: block; }
  .home-catalog.is-filter-prep .home-sidebar__heading > .home-sidebar__chevron,
  .home-catalog.is-filter-motion .home-sidebar:not([open]) > .home-sidebar__heading > .home-sidebar__chevron { transform: translateX(-14px) rotate(90deg); }
  .home-catalog.is-filter-motion .home-sidebar:not([open]) > .home-sidebar__heading > :is(span, .home-sidebar__chevron),
  .home-catalog.is-filter-motion .home-sidebar:not([open]) .xsort-div:has(.xsort-ul),
  .home-catalog.is-filter-motion .home-sidebar:not([open]) .xsort-div-clearall,
  .home-catalog.is-filter-motion .home-sidebar:not([open]) .home-sidebar__favorites {
    visibility: hidden;
    transition-delay: 0s, 0s, 0.18s;
  }
  .home-sidebar:not([open]) > .home-sidebar__heading { justify-content: center; }
  .home-sidebar:not([open]) > .home-sidebar__heading > :is(span, .home-sidebar__chevron) { display: none; }
  .home-catalog:has(> .home-sidebar:not([open])) .home-catalog__caption.home-catalog__filtered-heading,
  .home-catalog:has(> .home-sidebar:not([open])) .home-feed-default > .home-catalog__panel:first-child .home-catalog__section-head,
  .home-catalog:has(> .home-sidebar:not([open])) .home-catalog__favorites > .section__head { margin-right: 104px; }
}

/* The same card markup becomes a horizontal row only in the list view. */
@media (prefers-reduced-motion: reduce) {
  .home-sidebar__chevron,
  .home-sidebar__heading > svg:first-child,
  .home-sidebar__heading > :is(span, .home-sidebar__chevron),
  .home-sidebar .xsort-div,
  .home-sidebar .xsort-div-clearall,
  .home-sidebar__favorites { transition: none; }
}
:root[data-home-view="list"] .home-catalog .cards-grid,
:root[data-home-view="list"] .home-catalog:has(> .home-sidebar:not([open])) .cards-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
:root[data-home-view="list"] .home-catalog .home-card {
  --home-card-rating-size: 12px;
  --home-card-rating-pad: 5px;
  --home-card-fav-size: 32px;
  --home-card-fav-nudge-y: 0px;
  --home-card-play-size: 44px;
  --home-card-meta-size: 13px;
  --home-card-status-size: 12px;
  --home-card-status-pad: 4px;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  align-items: start;
  column-gap: 22px;
  row-gap: 8px;
  aspect-ratio: auto;
  min-height: 176px;
  padding: 0 20px 18px 0;
  background: var(--surface);
  color: var(--text);
}
:root[data-home-view="list"] .home-catalog .home-card[hidden] { display: none; }
:root[data-home-view="list"] .home-card::after { display: none; }
:root[data-home-view="list"] .home-card__poster {
  position: relative;
  inset: auto;
  grid-column: 1;
  grid-row: 1 / -1;
  align-self: stretch;
  width: 100%;
  height: auto;
  min-height: 174px;
  margin-bottom: -18px;
}
:root[data-home-view="list"] .home-card__poster img { position: absolute; inset: 0; }
:root[data-home-view="list"] .home-card__info-link { display: contents; }
:root[data-home-view="list"] .home-card__title {
  grid-column: 2;
  grid-row: 1;
  margin-top: 18px;
  padding-right: 44px;
  color: var(--text-strong);
  font-size: 18px;
  line-height: 1.3;
  text-shadow: none;
}
:root[data-home-view="list"] .home-card__meta {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}
:root[data-home-view="list"] .home-card__ratings {
  position: static;
  grid-column: 2;
  grid-row: 3;
  gap: 6px;
}
:root[data-home-view="list"] .home-card__rating { padding: 5px 8px; border-radius: var(--radius-sm); }
:root[data-home-view="list"] .home-card__footer {
  grid-column: 2;
  grid-row: 4;
  align-self: end;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
:root[data-home-view="list"] .home-card .home-card__status:not(.card__eps) { color: var(--text-soft); }
:root[data-home-view="list"] .home-card .home-card__fav { top: 8px; right: 8px; color: var(--text-soft); }
:root[data-home-view="list"] .home-card__fav::before { border-color: var(--border-strong); background: color-mix(in srgb, var(--surface-2) 60%, transparent); transform: none; }
:root[data-home-view="list"] .home-card__fav svg { width: 17px; height: 21px; transform: none; }
:root[data-home-view="list"] .home-card .home-card__fav:is(:hover, .is-active) { color: var(--green); }
:root[data-home-view="list"] .home-card__watch-label { max-width: 104px; padding: 4px 5px; font-size: 10px; line-height: 1.3; white-space: normal; }
@media (max-width: 520px) {
  :root[data-home-view="list"] .home-catalog .home-card {
    --home-card-fav-size: 28px;
    --home-card-play-size: 36px;
    --home-card-meta-size: 11px;
    --home-card-status-size: 10px;
    --home-card-rating-size: 10px;
    grid-template-columns: 80px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 7px;
    min-height: 154px;
    padding: 0 12px 12px 0;
  }
  :root[data-home-view="list"] .home-card__poster { min-height: 154px; margin-bottom: -12px; }
  :root[data-home-view="list"] .home-card__title { margin-top: 12px; padding-right: 32px; font-size: 14px; }
  :root[data-home-view="list"] .home-card__meta { font-size: 11px; }
  :root[data-home-view="list"] .home-card__rating { padding: 5px; }
  :root[data-home-view="list"] .home-card .home-card__fav { top: 2px; right: 2px; }
  :root[data-home-view="list"] .home-card__watch-label { max-width: 74px; font-size: 9px; }
}
