/* Тази вечер — live: the sky by Sofia's sunset, the "now" line of today's
 * programme and the stories (/stories). Kept apart from app.css; the
 * scripts are in live.js. Motion only with prefers-reduced-motion:
 * no-preference; colours only through the theme tokens (dark, light and
 * the three worlds keep their accents). */

/* ---------- the live sky ----------
   Four stacked bands — day, golden hour, dusk, night — whose weights
   (--w-*) live.js sets from today's sunset and twilight times (sky.go);
   before it runs, data-sky-phase gives the server's phase. The bands fade
   into the paper below the heading, so nothing under them changes. */
.sky {
  position: absolute; z-index: -1; top: 0; left: 0; right: 0; height: 460px;
  overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 35%, transparent);
  mask-image: linear-gradient(#000 35%, transparent);
  --w-day: 0; --w-golden: 0; --w-dusk: 0; --w-night: 0; --w-stars: 0;
}
.sky[data-sky-phase="day"] { --w-day: 1; }
.sky[data-sky-phase="golden"] { --w-golden: 1; }
.sky[data-sky-phase="dusk"] { --w-dusk: 1; --w-stars: 0.35; }
.sky[data-sky-phase="night"] { --w-night: 1; --w-stars: 1; }
@media (max-width: 899px) { .sky { height: 360px; } }
/* The masthead lets the sky through (it is not sticky). */
.masthead { background: transparent; }

.sky-l, .sky-stars, .sky-stars::after { position: absolute; inset: 0; }
.sky-day { opacity: var(--w-day); background: linear-gradient(180deg, rgb(86 150 230 / 0.30), rgb(120 180 240 / 0.10) 60%, transparent); }
.sky-golden { opacity: var(--w-golden); background: linear-gradient(180deg, rgb(110 100 170 / 0.28), rgb(255 150 90 / 0.34) 45%, rgb(255 190 110 / 0.22) 70%, transparent); }
.sky-dusk { opacity: var(--w-dusk); background: linear-gradient(180deg, rgb(44 36 120 / 0.60), rgb(150 70 160 / 0.42) 40%, rgb(240 100 120 / 0.34) 62%, rgb(255 150 90 / 0.20) 80%, transparent); }
.sky-night { opacity: var(--w-night); background: linear-gradient(180deg, rgb(6 9 34 / 0.75), rgb(34 36 96 / 0.28) 65%, transparent); }
/* A few stars: small dots, brighter as night falls; half of them twinkle. */
.sky-stars {
  opacity: var(--w-stars);
  background:
    radial-gradient(1.2px 1.2px at 7% 18%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 16% 52%, #fff 50%, transparent 100%),
    radial-gradient(1.6px 1.6px at 27% 12%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 38% 40%, #fff 50%, transparent 100%),
    radial-gradient(1.3px 1.3px at 52% 9%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 61% 33%, #fff 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 73% 16%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 84% 46%, #fff 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 93% 8%, #fff 50%, transparent 100%);
}
.sky-stars::after {
  content: "";
  background:
    radial-gradient(1.4px 1.4px at 11% 34%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 33% 24%, #fff 50%, transparent 100%),
    radial-gradient(1.7px 1.7px at 46% 28%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 68% 7%, #fff 50%, transparent 100%),
    radial-gradient(1.4px 1.4px at 79% 30%, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 97% 26%, #fff 50%, transparent 100%);
}
/* Light paper: softer, paler bands; the stars in the ink's colour. */
:root[data-theme="light"] .sky-day { background: linear-gradient(180deg, rgb(120 180 245 / 0.30), rgb(160 205 250 / 0.10) 60%, transparent); }
:root[data-theme="light"] .sky-golden { background: linear-gradient(180deg, rgb(255 170 90 / 0.50), rgb(255 140 110 / 0.32) 50%, rgb(255 200 140 / 0.16) 75%, transparent); }
:root[data-theme="light"] .sky-dusk { background: linear-gradient(180deg, rgb(120 100 220 / 0.46), rgb(225 120 175 / 0.34) 50%, rgb(255 170 120 / 0.18) 75%, transparent); }
:root[data-theme="light"] .sky-night { background: linear-gradient(180deg, rgb(48 58 140 / 0.34), rgb(100 106 200 / 0.14) 60%, transparent); }
:root[data-theme="light"] .sky-stars { filter: invert(1) opacity(0.45); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .sky-day { background: linear-gradient(180deg, rgb(120 180 245 / 0.30), rgb(160 205 250 / 0.10) 60%, transparent); }
  :root:not([data-theme]) .sky-golden { background: linear-gradient(180deg, rgb(255 170 90 / 0.50), rgb(255 140 110 / 0.32) 50%, rgb(255 200 140 / 0.16) 75%, transparent); }
  :root:not([data-theme]) .sky-dusk { background: linear-gradient(180deg, rgb(120 100 220 / 0.46), rgb(225 120 175 / 0.34) 50%, rgb(255 170 120 / 0.18) 75%, transparent); }
  :root:not([data-theme]) .sky-night { background: linear-gradient(180deg, rgb(48 58 140 / 0.34), rgb(100 106 200 / 0.14) 60%, transparent); }
  :root:not([data-theme]) .sky-stars { filter: invert(1) opacity(0.45); }
}
/* The worlds: the sky takes a little of the world's paper (velvet red,
   gallery green), so it reads as the same room at another hour. */
:root[data-world="cinema"] .sky { filter: hue-rotate(-38deg) saturate(0.9); }
:root[data-world="gallery"] .sky { filter: hue-rotate(-70deg) saturate(0.75); }
@media (prefers-reduced-motion: no-preference) {
  .sky-l, .sky-stars { transition: opacity 2.5s linear; }
  .sky-stars::after { animation: sky-twinkle 5.5s ease-in-out infinite alternate; }
  @keyframes sky-twinkle { from { opacity: 1; } to { opacity: 0.25; } }
}
@media print { .sky { display: none; } }

/* The brand moon: today's phase (sky.go) over the unlit disc. */
.brand-mark .moon-dark { fill: var(--marker); opacity: 0.16; }

/* ---------- the "now" line ----------
   A full-width row between today's events (the list and the grid); its
   height is fixed, so moving it each minute never jolts the page. */
.now-line {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 24px; margin: 4px 0; list-style: none; pointer-events: none;
}
.now-line::after {
  content: ""; flex: 1; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--marker), color-mix(in srgb, var(--marker) 10%, transparent));
  box-shadow: 0 0 8px color-mix(in srgb, var(--marker) 70%, transparent);
}
.now-label {
  flex: none; padding: 2px 9px 1px; border-radius: 999px;
  background: var(--marker); color: var(--marker-ink);
  font: 800 13px/1.5 var(--text); letter-spacing: 0.01em; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 14px color-mix(in srgb, var(--marker) 55%, transparent);
}
.now-label time { font: inherit; }
.grid > .now-line { grid-column: 1 / -1; margin: -6px 0; }
.day-list > .now-line + .ev .ev-link { box-shadow: none; }

/* "след 25 мин": on the time of what starts within the hour (live.js). */
.soon {
  position: absolute; z-index: 4; padding: 1px 7px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font: 750 11.5px/1.5 var(--text); white-space: nowrap; pointer-events: none;
}
.tile .soon { left: 8px; top: 42px; box-shadow: 0 2px 10px rgb(0 0 0 / 0.35); }
.day-list .soon { left: 0; bottom: 4px; width: 66px; text-align: center; padding-inline: 0; font-size: 10.5px; }
@media (min-width: 640px) { .day-list .soon { width: 76px; font-size: 11.5px; } }
/* The next one: a soft ring that breathes (opacity and scale only). */
.is-next .ev-time, .is-next .tile-time { isolation: isolate; }
.is-next .ev-time { position: relative; }
.is-next .ev-time::after, .is-next .tile-time::after {
  content: ""; position: absolute; inset: -3px; z-index: -1; border-radius: inherit;
  box-shadow: 0 0 0 2px var(--marker), 0 0 16px color-mix(in srgb, var(--marker) 60%, transparent);
  opacity: 0.85;
}
@media (prefers-reduced-motion: no-preference) {
  .is-next .ev-time::after, .is-next .tile-time::after { animation: now-pulse 2.4s ease-in-out infinite; }
  @keyframes now-pulse { 0%, 100% { opacity: 0.25; transform: scale(0.98); } 50% { opacity: 0.95; transform: scale(1.03); } }
}

/* ---------- stories: the home page's button ---------- */
.stories-cta { display: none; }
@media (max-width: 899px) {
  .stories-cta {
    display: inline-flex; align-items: center; gap: 10px; margin: 14px 0 2px;
    min-height: 48px; padding: 4px 14px 4px 4px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--rule);
    color: var(--ink); font-weight: 750; font-size: 16px; text-decoration: none;
  }
  .stories-cta:hover { text-decoration: none; }
}
.stories-ring {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  background: conic-gradient(from 200deg, var(--marker), var(--indigo), var(--marker));
  padding: 2.5px;
}
.stories-ring .icon {
  width: 100%; height: 100%; padding: 9px 8px 9px 10px; border-radius: 999px;
  background: var(--surface); color: var(--ink); fill: currentColor; stroke: none;
}
.stories-n {
  min-width: 26px; padding: 0 7px; border-radius: 999px; text-align: center;
  background: var(--marker); color: var(--marker-ink); font-size: 13.5px; line-height: 24px;
}

/* ---------- /stories: the list (no JavaScript) ---------- */
.stories-page { padding-bottom: 40px; }
.stories-head { padding: 30px 0 8px; }
.stories-head h1 { font: 900 clamp(46px, 8vw, 80px)/0.9 var(--display); letter-spacing: -0.01em; }
.stories-start-row { margin: 14px 0 0; }
.stories-start-row .icon { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.stories-more { margin: 22px 0 0; font-weight: 650; }
.st-bars, .st-top, .st-nav, .st-heart { display: none; }
.st-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 18px; }
@media (min-width: 640px) { .st-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .st-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.st {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--r-card); background: var(--p-bg); color: var(--p-fg);
}
.st-pic { aspect-ratio: 2 / 3; background: var(--p-ph, var(--p-bg)); overflow: hidden; }
.st-pic img { width: 100%; height: 100%; object-fit: cover; }
.st-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.st-kind { margin: 0; font-size: 14px; }
.st-kind .tl svg { width: 15px; height: 15px; vertical-align: -2px; }
.st-title { font: 850 30px/1 var(--display); overflow-wrap: anywhere; }
.st-title a { color: inherit; text-decoration: none; }
.st-facts { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 15.5px; color: var(--p-muted); }
.st-time { font: 850 24px/1 var(--display); color: var(--p-fg); font-variant-numeric: tabular-nums; }
.st-price { font-weight: 750; color: var(--p-fg); }
.st-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.st-actions .btn { flex: 1 1 0; }
.st .btn:not(.btn-primary) { background: transparent; color: var(--p-fg); border-color: color-mix(in srgb, var(--p-fg) 30%, transparent); }
.st .btn-primary { background: var(--p-fg); border-color: var(--p-fg); color: var(--p-bg); }
.st .fav { color: var(--p-fg); border: 1.5px solid color-mix(in srgb, var(--p-fg) 30%, transparent); width: 44px; height: 44px; }
.st .fav[aria-pressed="true"] { color: #ff7aa2; }

/* ---------- /stories: full-screen stories (live.js) ----------
   One story a screen; the poster fills it, the text sits on a shade at
   the bottom. On wide screens a phone-shaped column over a dark room. */
.stories.is-on {
  position: fixed; inset: 0; z-index: 100; display: block;
  background: #07070c; color: #fff; overflow: hidden;
  touch-action: none; overscroll-behavior: contain;
}
html.stories-open, html.stories-open body { overflow: hidden; }
.stories.is-on .st-list {
  position: absolute; inset: 0; margin: 0 auto; max-width: 480px; display: block;
}
@media (min-width: 600px) {
  .stories.is-on .st-list { top: 16px; bottom: 16px; max-width: min(480px, calc((100dvh - 32px) * 9 / 16)); border-radius: 18px; overflow: hidden; }
}
.stories.is-on .st {
  position: absolute; inset: 0; border-radius: 0; visibility: hidden;
  background: var(--p-bg); transform: translateX(var(--st-x, 0)); will-change: transform;
}
.stories.is-on .st.is-cur, .stories.is-on .st.is-in { visibility: visible; }
@media (prefers-reduced-motion: no-preference) {
  .stories.is-on .st.is-in { transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1); }
}
.stories.is-on .st-pic { position: absolute; inset: 0; aspect-ratio: auto; }
.stories.is-on .st-pic::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgb(0 0 0 / 0.45), transparent 18%, transparent 45%, rgb(0 0 0 / 0.82) 78%, rgb(0 0 0 / 0.9));
}
.stories.is-on .st-body {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; color: #fff;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
}
.stories.is-on .st-kind, .stories.is-on .st-kind .tl { color: rgb(255 255 255 / 0.85); }
.stories.is-on .st-title { font-size: clamp(34px, 10vw, 46px); line-height: 0.95; text-wrap: balance; }
.stories.is-on .st-facts { color: rgb(255 255 255 / 0.85); font-size: 16px; }
.stories.is-on .st-time, .stories.is-on .st-price { color: #fff; }
.stories.is-on .st-time { font-size: 30px; }
.stories.is-on .st .btn:not(.btn-primary) { color: #fff; border-color: rgb(255 255 255 / 0.4); background: rgb(0 0 0 / 0.25); }
.stories.is-on .st .btn-primary { background: var(--marker); border-color: var(--marker); color: var(--marker-ink); }
.stories.is-on .st .fav { color: #fff; border-color: rgb(255 255 255 / 0.4); background: rgb(0 0 0 / 0.25); }
.stories.is-on .st .fav[aria-pressed="true"] { color: #ff7aa2; }
.stories.is-on .st-actions .btn { min-height: 50px; font-size: 17px; }

.stories.is-on .st-bars {
  position: absolute; z-index: 3; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(480px, 100%); padding: 0 10px; display: flex; gap: 4px;
}
@media (min-width: 600px) { .stories.is-on .st-bars { top: 26px; width: min(480px, calc((100dvh - 32px) * 9 / 16)); padding: 0 12px; } }
.st-bar { flex: 1; height: 3px; border-radius: 3px; background: rgb(255 255 255 / 0.35); overflow: hidden; }
.st-bar i { display: block; height: 100%; background: #fff; transform-origin: left; transform: scaleX(0); }
.st-bar.is-seen i { transform: scaleX(1); }
.st-bar.is-cur i { animation: st-fill var(--st-ms, 7000ms) linear forwards; }
.stories.is-paused .st-bar.is-cur i { animation-play-state: paused; }
@keyframes st-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* No motion: no auto-advance (live.js), the current bar simply full. */
@media (prefers-reduced-motion: reduce) { .st-bar.is-cur i { animation: none; transform: scaleX(1); } }

.stories.is-on .st-top {
  position: absolute; z-index: 3; top: calc(max(10px, env(safe-area-inset-top)) + 10px); left: 50%; transform: translateX(-50%);
  width: min(480px, 100%); padding: 0 6px 0 14px; display: flex; align-items: center; gap: 4px;
}
@media (min-width: 600px) { .stories.is-on .st-top { top: 36px; width: min(480px, calc((100dvh - 32px) * 9 / 16)); } }
.st-brand { flex: 1; font: 800 17px/1 var(--display); letter-spacing: 0.02em; color: rgb(255 255 255 / 0.92); text-shadow: 0 1px 6px rgb(0 0 0 / 0.5); }
.st-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: #fff; cursor: pointer;
}
.st-btn .icon { width: 24px; height: 24px; filter: drop-shadow(0 1px 4px rgb(0 0 0 / 0.6)); }
.st-btn:focus-visible, .st-nav:focus-visible, .stories.is-on .st a:focus-visible, .stories.is-on .st .fav:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.st-pause .st-i-play { display: none; }
.st-pause[aria-pressed="true"] .st-i-play { display: inline; fill: currentColor; stroke: none; }
.st-pause[aria-pressed="true"] .st-i-pause { display: none; }

/* Arrows: on wide screens beside the column; on phones taps do it. */
.stories.is-on .st-nav { display: none; }
@media (min-width: 600px) {
  .stories.is-on .st-nav {
    position: absolute; z-index: 3; top: 50%; display: grid; place-items: center;
    width: 52px; height: 52px; margin-top: -26px; padding: 0; border-radius: 999px;
    border: 1px solid rgb(255 255 255 / 0.25); background: rgb(255 255 255 / 0.08); color: #fff; cursor: pointer;
  }
  .stories.is-on .st-nav .icon { width: 26px; height: 26px; }
  .stories.is-on .st-prev { left: calc(50% - min(240px, (100dvh - 32px) * 9 / 32) - 72px); }
  .stories.is-on .st-next { right: calc(50% - min(240px, (100dvh - 32px) * 9 / 32) - 72px); }
  .stories.is-on .st-nav:disabled { opacity: 0.3; cursor: default; }
}

/* Double tap: the heart. */
.stories.is-on .st-heart {
  position: absolute; z-index: 4; top: 42%; left: 50%; display: block; width: 120px; height: 120px; margin: -60px 0 0 -60px;
  color: #ff7aa2; opacity: 0; pointer-events: none;
}
.st-heart .icon { width: 100%; height: 100%; fill: currentColor; stroke: none; filter: drop-shadow(0 6px 24px rgb(0 0 0 / 0.5)); }
.st-heart.is-pop { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .st-heart.is-pop { animation: st-heart 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
  @keyframes st-heart { 0% { opacity: 0; transform: scale(0.4); } 25% { opacity: 1; transform: scale(1.12); } 45% { transform: scale(0.96); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.05) translateY(-14px); } }
}
@media (prefers-reduced-motion: reduce) {
  .st-heart.is-pop { animation: st-heart-still 0.9s step-end forwards; }
  @keyframes st-heart-still { to { opacity: 0; } }
}
/* A tile without a picture: its type label moves below the "след …" tag. */
.is-bill .tile-img:has(> .soon) .bill { padding-top: 72px; }
