/* Home page. OWNER: home agent. Tokens only (color-mix with tokens allowed). */

/* ---------- Hero / featured carousel ---------- */
.hero {
  --hero-h: clamp(440px, 62vh, 580px);
  position: relative;
  isolation: isolate;
  min-height: var(--hero-h);
  background: var(--surface);
  overflow: hidden;
}
.hero.hero-empty { display: none; }

.hero-slides { position: absolute; inset: 0; }
.hero-slide {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  overflow: hidden;
  opacity: 0; visibility: hidden;
  transition: opacity 0.7s var(--ease-out), visibility 0s linear 0.7s;
}
.hero-slide.is-active {
  opacity: 1; visibility: visible; z-index: 1;
  transition: opacity 0.7s var(--ease-out), visibility 0s;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: center 35%;
  transform: scale(1.04);
  transition: transform 7.5s linear;
}
.hero-slide.is-active .hero-bg { transform: scale(1); }
.hero-scrim {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg,
      var(--bg) 0%,
      color-mix(in srgb, var(--bg) 88%, transparent) 28%,
      color-mix(in srgb, var(--bg) 45%, transparent) 55%,
      transparent 80%),
    linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 40%, transparent) 22%, transparent 45%);
}

.hero-body {
  position: relative;
  padding-block: 48px 132px;
  display: grid; gap: 14px; justify-items: start;
}
.hero-body > * { max-width: 34rem; }
.hero-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  color: var(--text-2); font-size: var(--step--1); font-weight: 600;
}
.hero-type { text-transform: capitalize; color: var(--text); }
.hero-rating { display: inline-flex; align-items: center; gap: 5px; color: var(--text); }
.hero-rating svg { color: var(--accent); fill: var(--accent); }
.hero-title {
  font-size: clamp(2.25rem, 5.2vw, 4.25rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 24px color-mix(in srgb, var(--bg) 70%, transparent);
}
.hero-title a:hover { color: var(--text); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; text-decoration-color: var(--accent); }
.hero-genres { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hero-genres li {
  padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--raised) 75%, transparent);
  color: var(--text-2); font-size: var(--step--1); font-weight: 500;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.hero-actions .btn { min-height: 44px; padding-inline: 20px; }
.hero-btn-latest { background: color-mix(in srgb, var(--raised) 80%, transparent); }

/* Controls: arrows + thumbnail rail */
.hero-controls {
  position: absolute; left: 0; right: 0; bottom: 24px; z-index: 2;
  display: flex; align-items: end; justify-content: space-between; gap: 16px;
  pointer-events: none;
}
.hero-controls > * { pointer-events: auto; }
.hero-nav { display: flex; gap: 8px; }
.hero-arrow {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--text);
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s;
}
.hero-arrow:hover { border-color: var(--accent); color: var(--accent); }
.hero-arrow:focus-visible { border-radius: 50%; }

.hero-rail { display: flex; gap: 10px; }
.hero-thumb {
  position: relative; flex: none;
  width: 60px; aspect-ratio: 3 / 4; padding: 0;
  border: 0; border-radius: var(--r-sm); overflow: hidden;
  background: var(--raised);
  opacity: 0.55;
  transform: translateY(0);
  box-shadow: var(--shadow);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out), outline-color 0.2s;
  outline: 2px solid transparent; outline-offset: 2px;
}
.hero-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-thumb:hover { opacity: 0.9; }
.hero-thumb[aria-current="true"] { opacity: 1; transform: translateY(-6px); outline-color: var(--accent); }
.hero-thumb:focus-visible { outline: 2px solid var(--text); border-radius: var(--r-sm); }
.hero-thumb-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--accent);
  transform: scaleX(0); transform-origin: left;
}
.hero-thumb.is-timing .hero-thumb-bar { animation: hero-progress 7s linear forwards; }
.hero:not(.is-playing) .hero-thumb-bar { animation: none; transform: scaleX(0); }
@keyframes hero-progress { to { transform: scaleX(1); } }

/* Hero skeleton */
.hero-skeleton { position: absolute; inset: 0; display: flex; align-items: center; }
.hero-skeleton-inner { display: grid; gap: 14px; }
.hero-sk-title { height: 56px; width: min(460px, 80%); }
.hero-sk-line { height: 16px; width: min(380px, 70%); }
.hero-sk-line.short { width: min(240px, 50%); }
.hero-sk-btns { height: 44px; width: 260px; margin-top: 8px; }

/* ---------- Two-column body ---------- */
.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 40px;
  align-items: start;
  padding-bottom: 64px;
}
.home-aside { position: sticky; top: calc(var(--header-h) + 16px); }
.home-latest-grid { min-height: 200px; }

.home-popular-skeleton { display: grid; gap: 12px; }
.home-popular-skeleton .sk-head { height: 32px; width: 60%; }
.home-popular-skeleton .sk-row { height: 76px; }

@media (max-width: 959px) {
  .home-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .home-aside { position: static; }
}

@media (max-width: 720px) {
  .hero { --hero-h: auto; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
  .hero-slides { position: relative; inset: auto; display: grid; }
  .hero-slide { position: relative; inset: auto; grid-area: 1 / 1; min-height: 420px; }
  .hero-body { padding-block: 40px 28px; }
  .hero-slide { align-items: end; }
  .hero-scrim {
    background:
      linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 85%, transparent) 40%, color-mix(in srgb, var(--bg) 30%, transparent) 75%, transparent 100%);
  }
  .hero-controls { position: static; padding-block: 4px 12px; align-items: center; }
  .hero-rail { overflow-x: auto; padding: 8px 2px 4px; scrollbar-width: none; }
  .hero-rail::-webkit-scrollbar { display: none; }
  .hero-thumb { width: 44px; }
  .hero-thumb[aria-current="true"] { transform: translateY(-3px); }
  .hero-nav { order: 2; }
  .hero-arrow { width: 40px; height: 40px; }
  .hero-skeleton { position: relative; min-height: 420px; align-items: end; padding-bottom: 28px; }
}

@media (max-width: 400px) {
  .hero-thumb { width: 36px; }
  .hero-rail { gap: 6px; }
  .hero-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-bg, .hero-slide.is-active .hero-bg { transform: none; transition: none; }
}
