/* ---------------------------------------------------------
   13. Истории
   --------------------------------------------------------- */
.stories {
  padding-top: 0;   /* вертикальный ритм даёт первая секция — как .catalog на странице категории */
}
.stories__head {
  margin-bottom: 12px;
}
.stories__title {
  font-size: 40px;
  font-weight: 300;
  font-family: var(--font-footer);
  color: #2B2B2B;
}
.stories__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;                    /* как .product-grid на странице категории */
  padding-bottom: 40px;
}
.stories__section {
  padding: 40px var(--gutter) 0;   /* как .catalog: во всю ширину, без капа 1440px */
}
.stories__section-title {
  font-size: clamp(28px, 4vw, 35px);   /* как .section__title в магазине */
  font-weight: 400;
  text-transform: uppercase;
  font-family: var(--font-footer);
  color: var(--ink);
  margin-bottom: 40px;
}
/* Заголовок раздела и «Смотреть все» — в одну строку: заголовок слева, кнопка справа */
/* Заголовок раздела и «Смотреть все» — как в разделе Лукбуки (.lookbook__head/.lookbook__all) */
.stories__section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.stories__section-head .stories__section-title { margin-bottom: 0; }
.stories__all {
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 4px;
  white-space: nowrap;
}
.stories__all:hover { color: var(--ink); }
/* Тот же вид для кнопки «Показать ещё» (это настоящий button) */
button.stories__all {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

/* Видео и Книжный шкаф — по 3 в ряду */
.stories__grid--video,
.stories__grid--books {
  grid-template-columns: repeat(3, 1fr);
}
.stories__grid--video {
  gap: 24px;
  padding-bottom: 64px;
}
.stories__grid--books {
  gap: 24px;
  padding-bottom: 64px;
}
/* «Показать ещё» (карточки сверх лимита скрыты) */
.story-card--off {
  display: none;
}
.stories__more {
  display: flex;
  justify-content: center;
  padding-bottom: 40px;
}
/* Пустой раздел — те же отступы, что у секций */
.stories__empty-wrap {
  padding: 40px var(--gutter) 40px;
}

/* Карточка истории */
.story-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.story-card__media {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;          /* вертикальный формат сторис */
  border-radius: 5px;
  overflow: hidden;
  background: linear-gradient(150deg, #f2f2f4, #e6e6e9);
}
/* Постер из /wa-data/public/stories/<slug>.jpg (слой 0) */
.story-card__ph,
.story-card__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.story-card__ph {
  background: linear-gradient(150deg, #f2f2f4, #e6e6e9);
  z-index: 0;
}
.story-card__cover {
  z-index: 1;
}
/* Превью-видео: не грузится (preload=none) и появляется только на ховере */
.story-card__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  background: #000;
  transition: opacity var(--transition);
  z-index: 3;
  pointer-events: none;
}
.story-card.is-playing .story-card__video {
  opacity: 1;
}
.story-card__title {
  font-size: 16px;
  font-weight: 400;
  font-family: var(--font-footer);
  color: #2B2B2B;
  line-height: 1.4;
}

/* Видео-карточка (16:9) */
.story-card--video { gap: 16px; }
.story-card--video .story-card__media {
  aspect-ratio: 16 / 9;
}
.story-card__media--overlay {
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-card__media--overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.30);
  z-index: 2;
}
/* Значок плеера: всегда виден и строго по центру карточки.
   Раньше не было top/left/transform — значок уезжал в левый верхний угол,
   а opacity:0 прятал его до ховера. */
.story-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  color: #2B2B2B;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity var(--transition);
  z-index: 4;
  pointer-events: none;
}
.story-card__play svg { width: 26px; height: 26px; }
/* На время проигрывания превью значок остаётся на месте, но приглушён,
   чтобы не загораживать кадр; с места не двигается. */
.story-card.is-playing .story-card__play {
  opacity: 0.55;
}
.story-card__video-title {
  font-size: 14px;
  font-weight: 500;
  color: #2B2B2B;
}

/* Книжный шкаф */
.book-card {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
  background: #fff;
  border-radius: 5px;
}
.book-card__cover {
  width: 100px;
  height: 150px;
  flex: none;
  border-radius: 3px;
  overflow: hidden;
  background: linear-gradient(150deg, #f2f2f4, #e6e6e9);
}
.book-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card__body { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.book-card__title {
  font-size: 15px;
  font-weight: 600;
  color: #2B2B2B;
}
.book-card__desc {
  font-size: 13px;
  font-weight: 400;
  color: #8A8A8A;
}
.book-card__link {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  display: inline-block;
  width: max-content;
}
.book-card__link:hover { text-decoration: underline; }
.book-card__ph {
  display: block;
  width: 100px;
  height: 150px;
  background: linear-gradient(150deg, #f2f2f4, #e6e6e9);
}

/* Новости: карточки 16:9, по 3 в ряд */
.stories__grid--news {
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-bottom: 64px;
}
.news-card { display: flex; flex-direction: column; gap: 16px; }
.news-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  overflow: hidden;
  background: linear-gradient(150deg, #f2f2f4, #e6e6e9);
}
.news-card__media img { width: 100%; height: 100%; object-fit: cover; }
.news-card__ph { display: block; width: 100%; height: 100%; background: linear-gradient(150deg, #f2f2f4, #e6e6e9); }
.news-card__body { display: flex; flex-direction: column; gap: 10px; }
.news-card__title { font-size: 16px; font-weight: 600; color: #2B2B2B; }
.news-card__title a { color: inherit; }
.news-card__text { font-size: 13px; line-height: 1.5; color: #8A8A8A; }
.news-card__link { font-size: 13px; font-weight: 500; color: var(--accent); display: inline-block; width: max-content; }
.news-card__link:hover { text-decoration: underline; }

/* Заголовок раздела на главной блога — ссылка на подраздел */
.stories__section-title a { color: inherit; }
.stories__section-title a:hover { color: var(--accent); }

/* Пустой раздел */
.stories__empty { font-size: 15px; color: #8A8A8A; padding-bottom: 40px; }

@media (max-width: 1100px) {
  .stories__grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .stories__grid { grid-template-columns: repeat(2, 1fr); }
  .stories__grid--video,
  .stories__grid--books,
  .stories__grid--news { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .stories__grid,
  .stories__grid--video,
  .stories__grid--books,
  .stories__grid--news { grid-template-columns: 1fr; }
  .stories__head { margin-bottom: 24px; }
  .stories__section-title { margin-bottom: 16px; }
}

/* ---------------------------------------------------------
   Полноэкранный плеер видео (открывается из default.js)
   --------------------------------------------------------- */
.story-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}
.story-modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-modal__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: pointer;
}
.story-modal__stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Панель: видео слева, текст записи справа (нативно из визуального редактора) */
.story-modal__panel {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  max-height: 92vh;
  max-width: 96vw;
}
.story-modal__panel .story-modal__video {
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
}
/* Листание между сторис: стрелки поверх видео */
.story-modal__nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 16, 16, 0.5);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background var(--transition);
}
.story-modal__nav[hidden] { display: none; }
.story-modal__nav:hover { background: var(--accent); }
.story-modal__nav--prev { left: 14px; }
.story-modal__nav--next { right: 14px; }
.story-modal__nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.story-modal__side {
  position: relative;
  width: 380px;
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 34px 34px 38px;
  text-align: left;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
  scrollbar-width: thin;
  scrollbar-color: rgba(25, 25, 25, 0.22) transparent;
}
/* Акцентная полоса сверху — единственное цветовое пятно панели */
.story-modal__side::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 12px 12px 0 0;
}
.story-modal__side-text {
  font-size: 16px;
  line-height: 1.7;
}
.story-modal__side-text > * { margin: 0 0 15px; }
.story-modal__side-text > *:last-child { margin-bottom: 0; }
/* Первый абзац — вводный: чуть крупнее и плотнее остального текста */
.story-modal__side-text > p:first-child {
  font-size: 18px;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.story-modal__side-text img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.story-modal__side-text a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: border-color var(--transition);
}
.story-modal__side-text a:hover { border-bottom-color: var(--ink); }

/* На узких экранах видео сверху, текст под ним, панель прокручивается.
   Селекторы с .story-modal__panel — чтобы правила не перебивались базовыми выше. */
@media screen and (max-width: 900px) {
  .story-modal__panel {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    max-height: 100vh;
    padding: 64px 16px 24px;
    overflow-y: auto;
  }
  .story-modal__panel .story-modal__video { max-height: 62vh; }
  .story-modal__panel .story-modal__side {
    width: auto;
    max-height: none;
  }
}

/* Заголовок карточки сторис скрыт визуально (нужен для поиска и озвучки) */
.story-card__title--off {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.story-card__post-text { display: none; }
.story-modal__video {
  max-width: 96vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  background: #000;
  display: block;
}
.story-modal__close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
.story-modal__close:hover { background: rgba(255, 255, 255, 0.26); }
.story-modal__close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.story-modal__spinner {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: story-spin 800ms linear infinite;
}
.story-modal.is-loading .story-modal__spinner { display: block; }
.story-modal.is-loading .story-modal__video { opacity: 0; }
/* Браузер не смог проиграть файл — показываем выбор вместо чёрного экрана */
.story-modal.is-failed .story-modal__video,
.story-modal.is-failed .story-modal__spinner { display: none; }
.story-modal__fallback {
  width: min(420px, 88vw);
  padding: 32px 28px;
  background: #141414;
  border-radius: var(--radius);
  text-align: center;
}
.story-modal__fallback-text {
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
  margin: 0 0 20px;
}
.story-modal__fallback-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.story-modal__fallback-actions .btn {
  flex: none;
  width: auto;
  padding: 0 22px;
  height: 40px;
}
.story-modal__fallback-file {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: underline;
  transition: color var(--transition);
}
.story-modal__fallback-file:hover { color: #fff; }

/* ---------------------------------------------------------
   Страница записи (/blog/<блог>/<запись>/, в т.ч. Новости)
   Каркас статьи в стиле страниц сайта: центр 800px, заголовок,
   строка с датой, заходное фото, текст редактора, альбом.
   Автор и комментарии из шаблона убраны.
   --------------------------------------------------------- */
.stories .post,
.post-page .article__body {
  padding: 48px var(--gutter) 80px;
}
.post-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* дата записи: тёмная (в hero-варианте .article__meta-date белая) */
.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}
.post-meta__date {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-soft);
}
/* HERO записи: заходное фото на всю ширину окна, поверх него — заголовок и дата.
   Размеры и затемнение берём из .article__hero дизайн-системы (там ровное
   затемнение всей картинки, без градиентов и тени под текстом). */
.post-hero {
  min-height: clamp(380px, 58vh, 620px);
}
.post-hero .article__hero-inner { max-width: 900px; }
.post-hero .article__title { margin: 0; }
.post-hero .article__meta { margin: 0; }
@media (max-width: 560px) {
  .post-hero {
    min-height: clamp(300px, 60vh, 460px);
    padding: 28px var(--gutter);
  }
  .post-hero .article__title { font-size: clamp(24px, 7vw, 32px); }
}
/* остальные кадры альбома — сеткой */
.post-album {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.post-album__item {
  margin: 0;
}
.post-album__item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5px;
}
.post-album__item figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
@media (max-width: 560px) {
  .post-album { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------
   Содержимое визуального редактора (.article__rich)
   Базовые стили (p, li, h2, h3, ul/ol, a) уже есть в дизайн-системе,
   здесь — то, что редактор тоже умеет вставлять: цитаты, картинки,
   разделители, таблицы, выделение.
   --------------------------------------------------------- */
.article__rich blockquote {
  margin: 0;
  padding: 24px 24px 24px 32px;
  background: #F3F3F3;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 18px;
  font-weight: 300;
  line-height: 1.6;
  color: #191919;
}
.article__rich blockquote p { font-size: inherit; color: inherit; }
.article__rich img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 5px;
}
.article__rich figure { margin: 0; }
.article__rich figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.article__rich hr {
  width: 100%;
  height: 1px;
  border: 0;
  background: #e0e0e6;
  margin: 0;
}
.article__rich h4 {
  font-size: 17px;
  font-weight: 500;
  font-family: var(--font-footer);
  color: #191919;
  margin: 0;
}
.article__rich strong, .article__rich b { font-weight: 600; color: #191919; }
.article__rich em, .article__rich i { font-style: italic; }
.article__rich table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.article__rich th, .article__rich td {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e6;
  text-align: left;
}
.article__rich th {
  font-weight: 600;
  color: #191919;
}
.article__rich code {
  padding: 2px 6px;
  background: #f4f4f6;
  border-radius: 4px;
  font-size: 14px;
}
.article__rich pre {
  margin: 0;
  padding: 16px;
  background: #f4f4f6;
  border-radius: 8px;
  overflow-x: auto;
}
.article__rich pre code { padding: 0; background: none; }

/* ---------------------------------------------------------
   Видео на странице записи (/stories/<блог>/<запись>/)
   --------------------------------------------------------- */
.post-video {
  margin: 0 0 32px;
  text-align: center;
}
.post-video__player {
  display: block;
  margin: 0 auto;
  width: auto;
  max-width: 100%;
  max-height: 78vh;
  background: #000;
}
.post-video__file {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--accent);
}
.post-video__file:hover { text-decoration: underline; }
@keyframes story-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .story-modal__spinner { animation: none; }
}
