/* Channel artwork lives inside the existing card footprint on the main site. */
body.cinema-home .channel-grid .channel-card:not([data-match="true"]) {
  position: relative;
  isolation: isolate;
  justify-content: flex-end;
  overflow: hidden;
  background-size: 165% 165%;
  animation: channel-ambient 14s ease-in-out infinite alternate;
}

/* A narrow light sweep keeps the cards alive without flashing over the labels. */
body.cinema-home .channel-grid .channel-card:not([data-match="true"])::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -12%;
  bottom: -12%;
  left: 0;
  width: 38%;
  background: linear-gradient(90deg, transparent, rgba(255,233,192,.055) 28%, rgba(255,237,205,.20) 54%, rgba(255,246,226,.075) 72%, transparent);
  filter: blur(7px);
  transform: translateX(-175%) skewX(-17deg);
  pointer-events: none;
  animation: channel-light-sweep 8s ease-in-out infinite;
}

body.cinema-home .channel-grid .channel-card:nth-child(4n+2)::before { animation-delay: -2s; }
body.cinema-home .channel-grid .channel-card:nth-child(4n+3)::before { animation-delay: -4s; }
body.cinema-home .channel-grid .channel-card:nth-child(4n+4)::before { animation-delay: -6s; }

@keyframes channel-ambient {
  from { background-position: 0% 25%; }
  to { background-position: 100% 75%; }
}

@keyframes channel-light-sweep {
  0%, 18% { transform: translateX(-175%) skewX(-17deg); opacity: 0; }
  29% { opacity: 1; }
  62%, 100% { transform: translateX(360%) skewX(-17deg); opacity: 0; }
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .card-logo {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .card-logo::after {
  display: none;
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .card-logo img {
  position: absolute;
  top: 7%;
  left: 7%;
  width: 86%;
  height: 55%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
  image-rendering: auto;
  opacity: 1;
  transform: none;
  mix-blend-mode: normal;
  filter: drop-shadow(0 5px 11px rgba(0,0,0,.35));
}

/* These square sources contain wide transparent margins around a slim mark. */
body.cinema-home .channel-grid .channel-card[data-channel-id="ava"] .card-logo img,
body.cinema-home .channel-grid .channel-card[data-channel-id="tv-ava-family-iq"] .card-logo img {
  transform: scale(1.75);
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"])::after {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: auto;
  opacity: 1;
  background: linear-gradient(180deg, transparent 0%, transparent 51%, rgba(14,10,18,.28) 64%, rgba(14,10,18,.82) 77%, rgba(14,10,18,.96) 100%);
  pointer-events: none;
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .card-copy {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: end;
  gap: 2px 5px;
  width: 100%;
  text-shadow: 0 1px 5px rgba(0,0,0,.8);
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .card-copy strong {
  grid-column: 1 / -1;
  line-height: 1.45;
  white-space: normal;
  overflow: visible;
  font-size: clamp(13px, 2.2vw, 16px);
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .card-copy small {
  grid-column: 1;
  min-width: 0;
  color: #c9f3d9;
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .channel-access-badge {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  padding: 2px 6px;
  font-size: 10px;
  white-space: nowrap;
  text-shadow: none;
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .channel-access-badge img.kv-plus-badge-logo {
  width: 62px;
  height: 20px;
}

body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .card-logo.has-text-fallback .logo-fallback {
  position: absolute;
  top: 34%;
  left: 50%;
  width: calc(100% - 24px);
  max-width: 100%;
  font-size: clamp(22px, 5vw, 38px);
  text-align: center;
  overflow-wrap: anywhere;
  opacity: .8;
  transform: translate(-50%, -50%);
}

@media (prefers-reduced-motion: reduce) {
  body.cinema-home .channel-grid .channel-card:not([data-match="true"]),
  body.cinema-home .channel-grid .channel-card:not([data-match="true"])::before {
    animation: none;
  }
}

@media (max-width: 380px) {
  body.cinema-home .channel-grid .channel-card:not([data-match="true"]) .channel-access-badge {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

/* Temporary Messi artwork, restored automatically at 04:00 Baghdad. */
body.cinema-home .channel-grid .channel-card.messi-event .card-logo img {
  inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 36%; filter: none;
}
body.cinema-home .channel-grid .channel-card.messi-event .card-copy {
  background: linear-gradient(0deg,rgba(0,0,0,.9),rgba(0,0,0,.62) 65%,transparent);
}
body.cinema-home .channel-grid .channel-card.messi-event .messi-event-copy { color: #f6d08a; font-weight: 800; }

/* Only the tonight event is larger; hidden and restored at the deadline. */
body.cinema-home main > .messi-opening { order: -3; margin: 0 0 16px; }
.messi-opening[hidden] { display: none !important; }
.messi-opening button { position: relative; display: block; width: 100%; height: clamp(290px, 44vw, 420px); overflow: hidden; border: 1px solid #d9b87980; border-radius: 22px; background: #08070a; padding: 0; color: #fff4db; cursor: pointer; text-align: right; }
.messi-opening button:focus-visible { outline: 3px solid #f2cd84; outline-offset: 4px; }
.messi-opening img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 36%; }
.messi-opening-copy { position: absolute; inset: auto 0 0; display: grid; gap: 3px; padding: 38px 20px 18px; background: linear-gradient(transparent,rgba(0,0,0,.88)); }
.messi-opening-copy strong { font-size: clamp(23px,4vw,34px); line-height: 1.5; }
.messi-opening-copy > span { color: #f4cd81; font-size: 17px; font-weight: 800; }
.messi-opening-copy small { font-size: 14px; color: #eee2ce; }
body.cinema-home .channel-grid .channel-card.messi-event { grid-column: span 2; min-height: 280px; }
@media(min-width:901px) { .messi-opening button { max-width: 740px; margin-inline: auto; } }
