/* home-features — see contract: poster marks, continue-row ×, search history, kids profile */

/* ---- poster marks (Film.cardHTML): the viewer's progress, seen check, bookmark ----
   They sit at the poster's bottom, clear of the rating (top-left) and quality (top-right). */
.card .poster { position: relative; }
.pm {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-end; gap: 7px;
  padding: 0 9px 9px; pointer-events: none;
}
.pm.prog { padding-top: 30px; background: linear-gradient(180deg, rgba(8,6,16,0), rgba(8,6,16,.55)); }
.pm-tags { display: flex; gap: 5px; }
.pm-tags i {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px;
  background: rgba(14,10,26,.6); border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(8px) saturate(150%); -webkit-backdrop-filter: blur(8px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
.pm-tags svg { width: 14px; height: 14px; }
.pm-save svg { fill: currentColor; }
.pm-save.planned { color: #ff7fa8; }
.pm-save.watching { color: #6cd2ff; }
.pm-save.postponed { color: var(--star); }
.pm-save.dropped { color: #a49db9; }
.pm-tags .pm-done {
  background: linear-gradient(180deg, #47c95c, #2a9c3e); border-color: transparent; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.pm-done svg { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pm-bar {
  align-self: stretch; height: 4px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.24); box-shadow: inset 0 1px 1px rgba(0,0,0,.3);
}
.pm-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent-grad); box-shadow: 0 0 8px rgba(255,93,143,.7); }
/* «Новая серия» / «+3 серии»: bottom-left, the tags keep the right; on a narrow poster the tags
   wrap above it (wrap-reverse keeps the pill on the bottom line) */
.pm-line { align-self: stretch; display: flex; flex-wrap: wrap-reverse; align-items: center; justify-content: flex-end; gap: 5px; min-width: 0; }
.pm-new {
  margin-right: auto; max-width: 100%; padding: 4px 9px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 700 11.5px/1.15 var(--body); letter-spacing: .01em; color: #fff; background: var(--accent-grad);
  box-shadow: 0 4px 12px rgba(255,93,143,.38), inset 0 1px 0 rgba(255,255,255,.35);
}
@media (max-width: 560px) {
  .pm-line { gap: 4px; }
  .pm-new { padding: 3px 7px; font-size: 10.5px; }
}
@media (max-width: 560px) {
  .pm { gap: 5px; padding: 0 6px 6px; }
  .pm.prog { padding-top: 24px; }
  .pm-tags { gap: 4px; }
  .pm-tags i { width: 22px; height: 22px; }
  .pm-tags svg { width: 12px; height: 12px; }
  .pm-bar { height: 3px; }
}

/* ---- continue watching: × removes a title from the row ---- */
.cont-cell {
  position: relative; flex: 0 0 auto; display: flex;
  transition: width .3s ease, margin .3s ease, opacity .22s ease, transform .3s ease;
}
.cont-cell:hover .cont { border-color: rgba(255,255,255,.2); }
.cont-cell .cont .name { padding-right: 24px; }
.cont-x {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 999px;
  border: 1px solid var(--glass-line); background: rgba(255,255,255,.08); color: var(--muted);
  box-shadow: var(--glass-hi);
  transition: opacity .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.cont-x svg { width: 13px; height: 13px; }
.cont-x:hover { background: var(--danger); border-color: transparent; color: #fff; }
.cont-x:disabled { cursor: default; }
/* folding away: the width runs to 0 and the negative margin swallows the strip's gap */
.cont-cell.gone { width: 0 !important; margin-right: -12px; opacity: 0; transform: scale(.94); overflow: hidden; pointer-events: none; }
@media (min-width: 720px) and (hover: hover) {
  .cont-x { opacity: 0; }
  .cont-cell:hover .cont-x, .cont-x:focus-visible { opacity: 1; }
}

/* ---- header search: recent queries above «Продолжить просмотр» ---- */
.hs-qhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hs-qclear { border: 0; background: none; padding: 2px 4px; color: var(--muted); font-size: 13px; font-weight: 500; }
.hs-qclear:hover { color: #ff9dbd; }
.hs-qs { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px 6px; }
.hs-q {
  display: inline-flex; align-items: center; max-width: 100%; height: 36px; border-radius: 999px;
  border: 1px solid var(--glass-line); background: var(--glass); box-shadow: var(--glass-hi);
  transition: background .12s ease, border-color .12s ease;
}
.hs-q:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); }
.hs-q:has(.hs-qlink.active) { background: rgba(255,93,143,.14); border-color: rgba(255,93,143,.55); }
.hs-qlink {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0; height: 100%; padding: 0 4px 0 12px;
  border-radius: 999px 0 0 999px; font-size: 14px; font-weight: 500;
}
.hs-qlink svg { flex: none; width: 15px; height: 15px; color: var(--muted); }
.hs-qlink.active svg { color: var(--accent); }
.hs-qlink span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.hs-qx {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-right: 5px; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 17px; line-height: 1;
}
.hs-qx:hover { background: rgba(255,255,255,.12); color: var(--text); }
.hs-qs + .hs-head { margin-top: 6px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.07); }
@media (max-width: 719px) {
  .hs-q { height: 38px; }
  .hs-qx { width: 30px; height: 30px; margin-right: 3px; }
  .hs-qlink span { max-width: 190px; }
}

/* ---- kids profile: a note above the catalogue ---- */
.kids-banner {
  display: flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%;
  margin: 0 0 22px; padding: 8px 20px 8px 8px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,194,75,.15), rgba(255,93,143,.07));
  border: 1px solid rgba(255,214,140,.28); box-shadow: var(--glass-hi);
}
.kb-ico {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  background: linear-gradient(135deg, #ffc24b, #ff5d8f); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.kb-ico svg { width: 21px; height: 21px; }
.kb-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.kb-text b { font-size: 15px; font-weight: 700; }
.kb-text span { color: var(--muted); font-size: 13px; }
@media (max-width: 719px) {
  .kids-banner { width: auto; margin-bottom: 16px; border-radius: 24px; }
}

/* phones: the search over the whole screen while typing (see search.js) */
.hs-cancel { display: none; }
@media (max-width: 719px) {
  html.search-open, html.search-open body { overflow: hidden; }
  /* --hs-top: where the field sat in the header (search.js), so it stays at the same height */
  .hsearch.m-open {
    --hs-y: max(var(--hs-top, 0px), calc(10px + env(safe-area-inset-top)));
    position: fixed; z-index: 1500; left: 0; right: 0; top: var(--vvtop, 0px); height: var(--vvh, 100vh);
    max-width: none; margin: 0; padding: var(--hs-y) 12px 0;
  }
  /* the dark glass behind it is a layer of its own (search.js), so it can fade out while the
     field slides back into the header */
  .hs-veil {
    position: fixed; inset: 0; z-index: 1499; pointer-events: none; opacity: 0;
    background: rgba(12,9,22,.97); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    transition: opacity .32s ease;
  }
  html.search-open .hs-veil { opacity: 1; pointer-events: auto; }
  .hsearch.m-anim:not(.m-open) { position: relative; z-index: 1501; }
  .hsearch.m-open input { width: calc(100% - 84px); }
  .hsearch.m-open .hs-icon { left: 29px; top: calc(var(--hs-y) + 23px); }
  .hsearch.m-open .hs-clear { right: 104px; top: calc(var(--hs-y) + 23px); }
  .hsearch.m-open .hs-cancel {
    display: block; position: absolute; right: 12px; top: var(--hs-y); width: 74px; height: 46px;
    border: 0; background: none; color: #ff9dbd; font-size: 16px; font-weight: 600;
    animation: hs-cancel .32s cubic-bezier(.2,.8,.2,1) both;
  }
  .hsearch.m-open .hs-drop {
    position: absolute; top: calc(var(--hs-y) + 56px); left: 0; right: 0; bottom: 0;
    max-height: none; margin: 0; padding: 4px 12px 18px; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    overflow-y: auto; overscroll-behavior: contain; animation: hs-list .34s ease .06s both;
  }
  .hsearch.m-anim .hs-clear { visibility: hidden; }
}
@keyframes hs-cancel { from { opacity: 0; transform: translateX(24px); } }
@keyframes hs-list { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .hsearch.m-open .hs-cancel, .hsearch.m-open .hs-drop { animation: none !important; }
  .hs-veil { transition: none; }
}

/* horizontal strips line up with the rest of the page: on desktop they stop at the content
   edge; on phones both run to the screen edges */
@media (min-width: 720px) {
  .strip-cards { padding: 12px 0 18px; margin: -12px 0 -14px; }
}
@media (max-width: 719px) {
  #continue.strip { padding: 4px var(--gutter) 18px; margin: 0 calc(-1 * var(--gutter)) -14px; scroll-padding-inline: var(--gutter); }
}

/* ---- «Вышло новое» and the server's picks (index.js makeRow): the «Буду смотреть» strip; a row
   fades in when its cards arrive instead of popping in */
.hrow:not([hidden]) { animation: hrow-in .38s ease both; }
@keyframes hrow-in { from { opacity: 0; transform: translateY(6px); } }
#homeSections:empty { display: none; }

/* phones: iOS Safari blurs whatever sits under the status bar (its own edge effect) and the blur
   fades out below it; the header starts under that zone so FILM and the search stay sharp, while
   the page background behind the status bar still gets the blur */
@media (max-width: 719px) {
  .wrap > .top { padding-top: calc(14px + max(env(safe-area-inset-top), 20px)); }
}

/* «Что посмотреть?»: «Смотреть» carries the site's play glyph (no ▶ character, iOS draws it as an emoji) */
#pickWatch svg { flex: none; width: 16px; height: 16px; margin-left: -2px; }
@media (max-width: 360px) {
  /* 320 px: «Ещё вариант» and «Буду смотреть» share a line without pushing the sheet wider */
  .pick-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pick-actions .btn { padding-left: 10px; padding-right: 10px; }
  #pickSave svg { display: none; }
}

/* arrows on horizontal rows (computers, on hover; api.js F.stripArrows) */
.sa-host { position: relative; }
.sa-btn {
  position: absolute; z-index: 5; width: 44px; height: 44px; margin-top: -22px; padding: 0; border-radius: 999px;
  display: grid; place-items: center; color: #fff; cursor: pointer;
  border: 1px solid var(--glass-line, rgba(255,255,255,.16)); background: rgba(24,18,44,.78);
  backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: var(--glass-hi, inset 0 1px 0 rgba(255,255,255,.18));
  opacity: 0; pointer-events: none; transition: opacity .18s ease, background .15s ease;
}
.sa-btn svg { width: 22px; height: 22px; }
.sa-prev { left: -14px; }
.sa-prev svg { transform: scaleX(-1); }
.sa-next { right: -14px; }
.sa-host:hover > .sa-btn:not([hidden]) { opacity: 1; pointer-events: auto; }
.sa-btn:hover { background: rgba(44,32,76,.9); }
.sa-btn[hidden] { display: grid !important; opacity: 0 !important; pointer-events: none !important; }
@media (hover: none), (pointer: coarse) { .sa-btn { display: none !important; } }
