/* home.css - Home: hero, section tiles, rails (design pass, agent DA). Tokens only (css/tokens.css); loads last.
   Structure (js/ui/screens/home.js):
     .screen--home > .screen__header, .home__warn, .home__rows > .home__scroll > [.home-hero, .home-row--tiles, .home-row--rail ...]
   The rows area bleeds to the screen edges (cards scroll off the edge, the hero backdrop is full-bleed); text and the
   first card of each row start at the gutter. Vertical scrolling = transform on .home__scroll; rails = transform on the track.
   Selected state everywhere: accent ring + glow (a pseudo-element faded with opacity) + slight scale (tokens --focus-*).
   Local properties (not in tokens.css): --hero-h, --hero-main, --hero-spot (read by home.js: rem numbers),
   --home-poster-w, --home-card-w, --home-tile-w, --home-tile-h, --ico (tile icon mask), --fit-w (set by home.js). */

.screen--home {
  --hero-h: 24.5rem;
  --hero-main: 120;            /* rem the featured block needs before a shelf of extra titles appears beside it */
  --hero-spot: 13.75;          /* rem per shelf title (card + gap) */
  --home-poster-w: 11rem;
  --home-card-w: 16rem;
  --home-tile-w: 14.5rem;
  --home-tile-h: 7.75rem;
}

.screen--home .home__warn {
  flex: 0 0 auto; margin-bottom: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-m);
  background: var(--c-surface-1); color: var(--c-warn); font-size: var(--fs-s); font-weight: var(--fw-medium);
  box-shadow: inset 0.25rem 0 0 var(--c-warn);
}

.screen--home .home__rows {
  flex: 1 1 auto; min-height: 0; display: block; position: relative; overflow: hidden;
  margin: 0 calc(var(--gutter) * -1); padding: 0; gap: 0;
}
.home__scroll {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-3); padding-bottom: var(--sp-5);
  transition: transform var(--dur-slow) var(--ease);
}
.home__scroll--jump { transition: none; }

/* ---------- hero ---------- */
.home-hero { position: relative; flex: 0 0 auto; height: var(--hero-h); display: flex; align-items: stretch; }
.home-hero__main {
  position: relative; flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end;
  padding: 0 var(--gutter) var(--sp-2);
}
/* one background-image element (set by home.js), no blur; the scrim is its ::after */
.home-hero__bg {
  position: absolute; top: 0; bottom: 0; right: 0; width: min(100%, calc(var(--hero-h) * 2.7));
  background-color: var(--c-bg); background-position: center 22%; background-size: cover; background-repeat: no-repeat;
  opacity: 0; transition: opacity var(--dur-slow) var(--ease);
}
.home-hero__bg.has-image { opacity: 1; }
.home-hero__bg.is-poster { background-size: auto 100%; background-position: right var(--sp-6) center; }
.home-hero__bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, var(--c-bg) 0%, rgba(0, 0, 0, 0) 16%), var(--scrim-hero); }
.home-hero__bg.is-poster::after { background: var(--scrim-left); }
/* with a shelf on its right the backdrop also fades out on that side */
.home-hero.has-spots .home-hero__bg::after { background: linear-gradient(to left, var(--c-bg) 0%, rgba(0, 0, 0, 0) 22%), linear-gradient(to bottom, var(--c-bg) 0%, rgba(0, 0, 0, 0) 16%), var(--scrim-hero); }

.home-hero__text { position: relative; z-index: 1; width: 100%; max-width: 58rem; display: flex; flex-direction: column; gap: var(--sp-2); }
.home-hero__kicker {
  font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--c-accent-hi);
}
.home-hero__kicker:empty, .home-hero__plot:empty, .home-hero__status:empty, .home-hero__meta:empty { display: none; }
.home-hero__title {
  font-size: var(--fs-xxl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); letter-spacing: -0.015em;
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.home-hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); font-size: var(--fs-s); color: var(--c-fg-2); font-weight: var(--fw-medium); }
.home-hero__chip { white-space: nowrap; }
.home-hero__chip--rating { color: var(--c-fg); font-weight: var(--fw-semibold); }
.home-hero__chip--age { padding: 0 0.45rem; border-radius: var(--r-xs); box-shadow: inset 0 0 0 0.08rem var(--c-line-strong); }
.vstar { color: var(--c-gold); font-style: normal; margin-right: 0.3em; }
.home-hero__status { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-s); color: var(--c-fg-2); min-width: 0; }
.home-hero__bar { flex: 0 0 12rem; }
.home-hero__statustxt { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-hero__plot {
  font-size: var(--fs-s); line-height: var(--lh-loose); color: var(--c-fg-2); max-width: 62ch;
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.home-hero__actions { display: flex; gap: var(--sp-2); padding-top: var(--sp-1); }
/* button look: shared with the detail screens, see "buttons" in css/vod.css */

/* shelf beside the hero (ultrawide): big posters, part of the hero row for the remote */
.home-hero__spots {
  --home-poster-w: 12.5rem;
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: var(--sp-3); padding: 0 var(--gutter) var(--sp-2) 0;
}
.home-hero:not(.has-spots) .home-hero__spots { display: none; }
.screen--home .home-hero__spots .hero-spot { position: relative; margin-right: 0; }

/* ---------- rows ---------- */
.screen--home .home-row { flex: 0 0 auto; display: flex; flex-direction: column; gap: 0; padding: 0; }
.screen--home .home-row__title {
  padding: 0 var(--gutter); font-size: var(--fs-m); font-weight: var(--fw-semibold); letter-spacing: 0.01em; color: var(--c-muted);
  transition: color var(--dur) var(--ease);
}
.screen--home .home-row.is-active .home-row__title { color: var(--c-fg); }
/* the view is the clip box: padded so the scaled card + ring + glow are not cut; negative margins give the room back */
.screen--home .home-row__view { position: relative; overflow: hidden; padding: 1.5rem var(--gutter); margin: -0.75rem 0 -1.1rem; }
.screen--home .home-row--tiles .home-row__view { margin-top: -1.1rem; }
.screen--home .home-row__track { position: relative; transition: transform var(--dur-slow) var(--ease); will-change: auto; }
.screen--home .home-row.is-active .home-row__track { will-change: transform; }
.screen--home .home-row__track > * { position: absolute; top: 0; }

/* ---------- section tiles ---------- */
.screen--home .home-tile {
  flex: none; width: var(--fit-w, var(--home-tile-w)); height: var(--home-tile-h); margin-right: var(--sp-3);
  padding: var(--sp-2) var(--sp-3) 0.9rem; border-radius: var(--r-l); overflow: visible;
  background-color: var(--c-surface-1); background-image: var(--grad-card); box-shadow: inset 0 0 0 0.06rem var(--c-line);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.1rem;
  transition: transform var(--dur) var(--ease);
}
.screen--home .home-tile::before {            /* line icon: an SVG mask filled with the accent */
  content: ""; position: absolute; left: var(--sp-3); top: 0.95rem; width: 1.85rem; height: 1.85rem; background: var(--c-accent-hi);
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
}
.screen--home .home-tile::after, .screen--home .rail-card__art::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: var(--focus-shadow); opacity: 0; transition: opacity var(--dur) var(--ease);
}
.screen--home .home-tile .tile__label { font-size: var(--fs-m); font-weight: var(--fw-semibold); line-height: var(--lh-tight); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen--home .home-tile .tile__sub { font-size: var(--fs-xs); color: var(--c-muted); min-height: 1.25em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen--home .home-tile .tile__logo { position: absolute; right: var(--sp-3); top: 0.8rem; height: 2.2rem; max-width: 42%; max-height: none; object-fit: contain; }
.screen--home .home-row--tiles .home-tile.is-focused {
  outline: none; transform: scale(var(--focus-scale)); z-index: 2; background-color: var(--c-surface-2) !important;
}
.screen--home .home-tile.is-focused::after, .screen--home .rail-card.is-focused .rail-card__art::after { opacity: 1; }
.screen--home .home-tile.is-focused .tile__sub { color: var(--c-fg-2); }

.home-tile { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='6' height='6' rx='1'/%3E%3Crect x='14' y='4' width='6' height='6' rx='1'/%3E%3Crect x='4' y='14' width='6' height='6' rx='1'/%3E%3Crect x='14' y='14' width='6' height='6' rx='1'/%3E%3C/svg%3E"); }
.tile--continue { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M10 8.5l5.5 3.5-5.5 3.5z'/%3E%3C/svg%3E"); }
.tile--live { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='18' height='13' rx='2'/%3E%3Cpath d='M8 2.5l4 4.5 4-4.5'/%3E%3C/svg%3E"); }
.tile--vod { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M7.5 4v16M16.5 4v16M3 9h4.5M3 15h4.5M16.5 9H21M16.5 15H21'/%3E%3C/svg%3E"); }
.tile--series { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='9' width='18' height='11' rx='2'/%3E%3Cpath d='M6 5.5h12M9 2.5h6'/%3E%3C/svg%3E"); }
.tile--favs { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.9L12 16.9l-5.2 2.8 1-5.9-4.3-4.1 5.9-.8z'/%3E%3C/svg%3E"); }
.tile--epg { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='15' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4M7 14h4M14 14h3M7 17h7'/%3E%3C/svg%3E"); }
.tile--on-now { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Cpath d='M7.8 16.2a6 6 0 010-8.4M16.2 7.8a6 6 0 010 8.4M4.9 19.1a10 10 0 010-14.2M19.1 4.9a10 10 0 010 14.2'/%3E%3C/svg%3E"); }
.tile--reminders { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 16v-5a6 6 0 0112 0v5l2 2H4zM10 21h4'/%3E%3C/svg%3E"); }
.tile--recordings { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Ccircle cx='12' cy='12' r='3.5'/%3E%3C/svg%3E"); }
.tile--search { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20.5 20.5L16 16'/%3E%3C/svg%3E"); }
.tile--account { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0116 0'/%3E%3C/svg%3E"); }
.tile--help { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9.5a2.5 2.5 0 114 2c-.9.6-1.5 1.2-1.5 2.3M12 17.3v.2'/%3E%3C/svg%3E"); }
.tile--settings { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h9M19 7h1M4 17h1M11 17h9'/%3E%3Ccircle cx='16' cy='7' r='2.5'/%3E%3Ccircle cx='8' cy='17' r='2.5'/%3E%3C/svg%3E"); }

/* ---------- rail cards ---------- */
/* default = landscape card (channels, pins: a contained logo); .rail-card--poster = 2:3 artwork (movies / series) */
.screen--home .rail-card {
  width: var(--home-card-w); margin-right: var(--sp-3); padding: 0; border-radius: 0; background: none; overflow: visible;
  display: flex; flex-direction: column; gap: 0.45rem; transform-origin: center 42%;
  transition: transform var(--dur) var(--ease);
}
.screen--home .rail-card--poster { width: var(--home-poster-w); }
.screen--home .rail-card__art {
  position: relative; flex: 0 0 auto; height: calc(var(--home-card-w) * 0.5625); border-radius: var(--r-m); overflow: visible;
  background-color: var(--c-surface-1); background-image: var(--grad-card); box-shadow: var(--sh-1), inset 0 0 0 0.06rem var(--c-line);
  display: flex; align-items: center; justify-content: center;
}
.screen--home .rail-card--poster .rail-card__art { height: calc(var(--home-poster-w) * 1.5); }
.screen--home .rail-card__img { max-width: 70%; max-height: 70%; object-fit: contain; }
.screen--home .rail-card--poster .rail-card__img {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; border-radius: inherit;
}
.screen--home .rail-card__badge {
  position: absolute; top: 0.45rem; left: 0.45rem; right: auto; padding: 0.05rem 0.45rem; border-radius: var(--r-xs);
  background: var(--c-overlay); color: var(--c-fg); font-size: var(--fs-xs); font-weight: var(--fw-bold); line-height: 1.35;
}
.screen--home .rail-card__badge--tick {
  left: auto; right: 0.45rem; width: 1.5rem; height: 1.5rem; padding: 0; border-radius: 50%; text-align: center; line-height: 1.5rem;
  background: var(--c-ok); color: var(--c-bg);
}
.screen--home .rail-card__progress {
  position: absolute; left: 0.5rem; right: 0.5rem; bottom: 0.5rem; height: 0.25rem; border-radius: var(--r-pill); overflow: hidden;
  background: rgba(255, 255, 255, 0.28);
}
.screen--home .rail-card__progress > i { position: absolute; inset: 0; background: var(--c-accent); transform-origin: left center; }
/* poster cards: details (year, rating, time left) fade in over the artwork on focus / hover - nothing reflows */
.screen--home .rail-card__over {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2.4rem 0.6rem 1.05rem; border-radius: 0 0 var(--r-m) var(--r-m);
  background: var(--scrim-bottom); opacity: 0; transition: opacity var(--dur) var(--ease);
}
.screen--home .rail-card.is-focused .rail-card__over { opacity: 1; }
.screen--home .rail-card__label {
  font-size: var(--fs-s); font-weight: var(--fw-medium); color: var(--c-fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--dur) var(--ease);
}
.screen--home .rail-card__sub { font-size: var(--fs-xs); color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.25em; margin-top: -0.3rem; }
.screen--home .rail-card__over .rail-card__sub {
  margin: 0; min-height: 0; color: var(--c-fg); font-weight: var(--fw-medium); white-space: normal; line-height: 1.25;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.screen--home .rail-card__year { margin-right: 0.6rem; }
.screen--home .rail-card.is-focused {
  outline: none; background-color: transparent !important; transform: scale(var(--focus-scale)); z-index: 2;
}
.screen--home .rail-card.is-focused .rail-card__label { color: var(--c-fg); }
.screen--home .rail-card.is-focused .rail-card__sub { color: var(--c-fg-2); }
.screen--home .rail-card.is-focused .rail-card__over .rail-card__sub { color: var(--c-fg); }

/* landscape card without a logo: the name, centred, on the tinted card */
.screen--home .rail-card__art > .ph-title {
  font-size: var(--fs-s); font-weight: var(--fw-semibold); padding: 0.7rem;
  background: linear-gradient(160deg, hsl(var(--ph-h, 250), 40%, 20%) 0%, hsl(var(--ph-h, 250), 45%, 8%) 100%);
}
