/* Сторис: кадр (общий для сайта и редактора в админке), кружки на главной, полноэкранный просмотр */

/* ---------- Кадр 9:16 ---------- */
.story-frame {
  position: relative; aspect-ratio: 9 / 16; overflow: hidden; container-type: inline-size;
  background: var(--story-bg, #0f5b4a); color: #fff;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.st-img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; display: block; pointer-events: none; }
.st-el {
  position: absolute; transform: translate(-50%, -50%); width: max-content; max-width: 90%;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif; font-weight: 600; line-height: 1.3;
  font-size: calc(var(--fs) * 1px); font-size: calc(var(--fs) * 100cqw / 360);
  text-align: center; white-space: pre-line; overflow-wrap: anywhere;
}
.st-text span { padding: .1em .38em; border-radius: .3em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.st-text.st-has-bg { line-height: 1.45; }
.st-text.st-has-bg span { background: var(--bg); }
.st-text:not(.st-has-bg) { text-shadow: 0 1px 10px rgba(0, 0, 0, .35); }
.st-head { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 700; line-height: 1.08; }
.st-text.st-head.st-has-bg { line-height: 1.3; }
.st-bold { font-weight: 800; }
.st-btn {
  border: 0; margin: 0; background: var(--bg, #0f5b4a); padding: .75em 1.5em; border-radius: 999px;
  font-weight: 700; white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); cursor: pointer;
}
.st-btn.st-head { font-weight: 700; }

/* ---------- Кружки на главной ---------- */
.stories { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 6px; margin-bottom: 8px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story-ring {
  flex: none; width: 74px; padding: 0; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.story-ring .ring {
  width: 70px; height: 70px; border-radius: 50%; padding: 2.5px;
  background: conic-gradient(from 200deg, var(--gold, #b88a35), var(--accent, #9b1c31), var(--brand, #0f5b4a), var(--gold, #b88a35));
  transition: transform .15s;
}
.story-ring:active .ring { transform: scale(.94); }
.story-ring.seen .ring { background: var(--line, #ddd); }
.story-ring .thumb {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden; border: 2.5px solid var(--bg, #fff);
  background: var(--story-bg, #0f5b4a); display: grid; place-items: center;
  color: #fff; font: 700 26px/1 'Cormorant Garamond', Georgia, serif;
}
.story-ring .thumb img { width: 100%; height: 100%; object-fit: cover; }
.story-ring .t { font-size: 11.5px; line-height: 1.25; max-width: 74px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Просмотр на весь экран ---------- */
.stv {
  position: fixed; inset: 0; z-index: 100; background: #000; display: grid; place-items: center;
  touch-action: none; overscroll-behavior: contain; animation: stv-in .18s ease-out;
}
@keyframes stv-in { from { opacity: 0; transform: scale(.96); } }
.stv.closing { opacity: 0; transition: opacity .15s; }
.stv .story-frame { width: min(100vw, 100vh * 9 / 16); width: min(100vw, 100dvh * 9 / 16); }
.stv-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3; padding: 8px 8px 28px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .38), transparent); pointer-events: none;
}
.stv-bars { display: flex; gap: 4px; }
.stv-bars i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255, 255, 255, .38); overflow: hidden; }
.stv-bars b { display: block; height: 100%; width: 0; background: #fff; }
.stv-head { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 13.5px; font-weight: 600; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.stv-head img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: #fff; }
.stv-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stv-close {
  pointer-events: auto; width: 36px; height: 36px; margin: -4px -2px -4px 0; border: 0; border-radius: 50%;
  background: none; color: #fff; display: grid; place-items: center;
}
.stv-close svg { width: 24px; height: 24px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .4)); }
.stv-nav { display: none; }
/* телефон: экран вытянутее 9:16 — сторис на весь экран, как в Инстаграме (шрифты считаются от ширины, позиции — в процентах) */
@media (max-aspect-ratio: 9/16) {
  .stv .story-frame { width: 100vw; height: 100vh; height: 100dvh; aspect-ratio: auto; }
  .stv-top { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
}
@media (min-width: 700px) and (hover: hover) {
  .stv .story-frame { width: min(100vw, (100vh - 40px) * 9 / 16); width: min(100vw, (100dvh - 40px) * 9 / 16); height: auto; aspect-ratio: 9 / 16; border-radius: 14px; }
  .stv-nav {
    display: grid; place-items: center; position: absolute; top: 50%; transform: translateY(-50%); z-index: 4;
    width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); color: #222;
  }
  .stv-nav[hidden] { display: none; }
  .stv-nav svg { width: 22px; height: 22px; }
  .stv-prev { right: calc(50% + min(100vw, (100dvh - 40px) * 9 / 16) / 2 + 18px); }
  .stv-next { left: calc(50% + min(100vw, (100dvh - 40px) * 9 / 16) / 2 + 18px); }
}
body.stv-open { overflow: hidden; }
