/*
 * Блог SaleScout: /ru/blog/, /kz/blog/, /en/blog/ и статьи (серверный рендер src/blog-ssr.js).
 * Подключается после style.css и feature.css: токены --fp-*, кнопки fp-btn, крошки
 * fp-crumbs, чипсы fp-chips, карточки-ссылки fp-linkcard и CTA fp-cta берутся оттуда.
 * Здесь — только блоки блога: первый экран, карточки статей, пустое состояние,
 * пагинация, статья и типографика контента из админки.
 */

/* Unbounded объявлен только в ru/style.css — дублируем для kz/en (тот же файл, грузится один раз) */
@font-face{
  font-family: "Unbounded";
  font-weight: 200 900;
  font-style: normal;
  src: url("../public/fonts/Unbounded/Unbounded-VariableFont_wght.ttf") format("truetype-variations"),
    url("../public/fonts/Unbounded/Unbounded-VariableFont_wght.ttf") format("truetype");
  font-display: swap;
}

/* В Unbounded нет казахских букв (ә, ғ, қ, ң, ө, ұ, ү, һ) — на kz заголовки набраны Noto Sans */
html[lang="kk"]{
  --fp-head: "Noto Sans", "Segoe UI", system-ui, sans-serif;
}

/* --- Первый экран ----------------------------------------------------------- */

.blog-hero{
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 40px 0 clamp(56px, 6vw, 88px);
  background:
    radial-gradient(circle at 88% 18%, rgba(98, 119, 255, .2), transparent 30%),
    radial-gradient(circle at 8% 86%, rgba(21, 128, 61, .1), transparent 28%),
    linear-gradient(155deg, #fbfcff 0%, #f4f6ff 52%, #ffffff 100%);
}

.blog-hero::before{
  content: "";
  position: absolute;
  z-index: -1;
  width: 420px;
  height: 420px;
  right: -260px;
  top: -210px;
  border: 70px solid rgba(76, 92, 230, .08);
  border-radius: 50%;
  pointer-events: none;
}

.blog-hero__grid{
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
  align-items: center;
  gap: clamp(40px, 5vw, 76px);
}

.blog-hero__grid--single{
  grid-template-columns: minmax(0, 1fr);
}

.blog-hero__text{
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.blog-hero__text .fp-h1{
  max-width: 19ch;
}

.blog-hero__grid--single .fp-h1{
  max-width: 24ch;
}

.blog-hero__visual{
  overflow: hidden;
  margin: 0;
  border: 10px solid rgba(255, 255, 255, .78);
  border-radius: 28px;
  background: #f4f5fa;
  box-shadow: 0 30px 80px rgba(40, 46, 96, .15);
  transform: rotate(1.2deg);
}

.blog-hero__visual img{
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

/* --- Карточки статей -------------------------------------------------------- */

.blog-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.blog-grid > li{
  display: flex;
  min-width: 0;
}

.blog-card{
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--fp-line);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 14px 42px rgba(42, 48, 89, .055);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.blog-card:hover{
  border-color: #cfe0ff;
  box-shadow: 0 24px 70px rgba(35, 42, 86, .12);
  transform: translateY(-2px);
}

/* Пропорция обложек из админки (1200×630, как OG-картинка): в 16:10 обрезался текст у краёв */
.blog-card__thumb{
  display: block;
  overflow: hidden;
  aspect-ratio: 1200 / 630;
  border-radius: 13px;
  background: #eef0f7;
}

.blog-card__thumb > img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}

.blog-card:hover .blog-card__thumb > img{
  transform: scale(1.035);
}

.blog-card__meta,
.blog-card__title,
.blog-card__text,
.blog-card__more{
  margin-inline: 10px;
}

.blog-card__meta{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--fp-muted);
}

.blog-card__title{
  font-family: var(--fp-head);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--fp-text);
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

.fp .blog-card__title a{
  color: inherit;
}

.fp .blog-card__title a:hover{
  color: var(--fp-accent);
}

.blog-card__text{
  font-size: 15px;
  line-height: 1.55;
  color: var(--fp-text-2);
}

.fp .blog-card__more{
  align-self: flex-start;
  margin-top: auto;
  margin-bottom: 10px;
  padding-top: 4px;
  font-size: 15px;
  font-weight: 600;
}

.blog-tag{
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f2f7;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--fp-text-2);
  white-space: nowrap;
}

/* Обложка без картинки — как OG-карточки блога: логотип, заголовок, круги */
.blog-cover-ph{
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  width: 100%;
  height: 100%;
  padding: 18px 22px;
  overflow: hidden;
  background: linear-gradient(145deg, #f8f9fe, #eef1fb);
}

.blog-cover-ph::before,
.blog-cover-ph::after{
  content: "";
  position: absolute;
  border-radius: 50%;
}

.blog-cover-ph::before{
  width: 44%;
  aspect-ratio: 1;
  right: -10%;
  top: -24%;
  background: linear-gradient(160deg, #2f7bff, #4a5ce6);
}

.blog-cover-ph::after{
  width: 24%;
  aspect-ratio: 1;
  right: 6%;
  bottom: -12%;
  background: #d5f0de;
}

.blog-cover-ph img{
  position: relative;
  width: 64px;
  height: auto;
}

.blog-cover-ph__title{
  position: relative;
  display: -webkit-box;
  max-width: 64%;
  overflow: hidden;
  font-family: var(--fp-head);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--fp-text);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

/* --- Пустое состояние ------------------------------------------------------- */

.blog-empty{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(36px, 5vw, 64px) clamp(20px, 5vw, 56px);
  border: 1px solid var(--fp-line);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 18px 60px rgba(35, 42, 86, .07);
  text-align: center;
}

.blog-empty__icon{
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: var(--fp-accent-soft);
  color: var(--fp-accent);
}

.blog-empty__icon svg{
  width: 34px;
  height: 34px;
}

.blog-empty__text{
  max-width: 560px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--fp-text-2);
  text-wrap: pretty;
}

.blog-empty__actions{
  justify-content: center;
  margin-top: 6px;
}

.blog-empty__trial{
  font-size: 14px;
  color: var(--fp-muted);
}

.blog-empty__more{
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: clamp(48px, 5vw, 72px);
}

/* В шапке страницы 503 блок стоит сразу под крошками */
.blog-hero .blog-empty{
  margin-top: 8px;
}

/* --- Пагинация -------------------------------------------------------------- */

.blog-pager{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  margin-top: 48px;
}

.blog-pager__pages{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.blog-pager__pages a,
.blog-pager__pages span{
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  font-weight: 600;
}

.fp .blog-pager__pages a{
  border: 1px solid var(--fp-line);
  background: #ffffff;
  color: var(--fp-text);
}

.fp .blog-pager__pages a:hover{
  border-color: #cfe0ff;
  color: var(--fp-accent);
}

.blog-pager__pages [aria-current]{
  background: var(--fp-accent);
  color: #ffffff;
}

.blog-pager__gap{
  align-self: center;
  color: var(--fp-muted);
}

.fp .blog-pager__step{
  font-weight: 600;
}

.blog-pager__step.is-disabled{
  color: var(--fp-muted);
  opacity: .5;
}

/* --- Статья ----------------------------------------------------------------- */

.blog-hero--article{
  padding-bottom: clamp(36px, 4vw, 52px);
}

.blog-article{
  width: min(720px, 100%);
  margin-inline: auto;
}

.blog-article__head{
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.blog-article__head .fp-crumbs{
  margin-bottom: 8px;
}

.fp-h1.blog-article__title{
  font-size: clamp(30px, 3.2vw, 44px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.blog-article__tags{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.blog-article__meta{
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  font-size: 14px;
  color: var(--fp-muted);
}

.blog-article__meta > * + *::before{
  content: "·";
  margin-inline: 10px;
}

.fp-lead.blog-article__lead{
  max-width: none;
}

.blog-body{
  padding: clamp(32px, 4vw, 48px) 0 clamp(56px, 6vw, 88px);
}

.blog-article__cover{
  overflow: hidden;
  margin: 12px 0 0;
  border: 1px solid var(--fp-line);
  border-radius: 22px;
  background: #f3f4f8;
  box-shadow: 0 18px 55px rgba(42, 48, 89, .09);
}

.blog-article__cover img{
  display: block;
  width: 100%;
  height: auto;
}

.blog-toc{
  margin-bottom: 36px;
  padding: 20px 24px;
  border: 1px solid var(--fp-line);
  border-radius: 18px;
  background: linear-gradient(145deg, #f7f9ff, #ffffff);
}

.blog-toc__title{
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fp-muted);
}

.blog-toc ol{
  padding-left: 1.3em;
}

.blog-toc li{
  list-style: decimal;
  font-size: 15px;
  line-height: 1.5;
}

.blog-toc li + li{
  margin-top: 6px;
}

.blog-article__back{
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--fp-line);
  font-weight: 600;
}

/* --- Контент статьи из админки ------------------------------------------------
   style.css обнуляет отступы, списки и размеры заголовков — возвращаем их здесь. */

.blog-prose{
  font-size: 17px;
  line-height: 1.7;
  color: var(--fp-text-2);
  overflow-wrap: break-word;
}

.blog-prose > * + *{
  margin-top: 18px;
}

.blog-prose > :first-child{
  margin-top: 0;
}

.blog-prose h2{
  margin-top: 44px;
  font-family: var(--fp-head);
  font-size: clamp(22px, 2.2vw, 26px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--fp-text);
  scroll-margin-top: 100px;
}

.blog-prose h3{
  margin-top: 32px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--fp-text);
  scroll-margin-top: 100px;
}

.blog-prose :where(h4, h5, h6){
  margin-top: 26px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--fp-text);
}

.blog-prose :where(h2, h3, h4, h5, h6) + *{
  margin-top: 12px;
}

.blog-prose :where(ul, ol){
  padding-left: 1.4em;
}

.blog-prose ul > li{
  list-style: disc;
}

.blog-prose ol > li{
  list-style: decimal;
}

.blog-prose li + li,
.blog-prose li > :where(ul, ol, p){
  margin-top: 8px;
}

.blog-prose li::marker{
  color: var(--fp-accent);
}

.blog-prose :where(strong, b){
  font-weight: 700;
  color: var(--fp-text);
}

.blog-prose :where(em, i){
  font-style: italic;
}

.blog-prose u{
  text-decoration: underline;
}

.blog-prose s{
  text-decoration: line-through;
}

.blog-prose :where(sub, sup){
  font-size: .75em;
  line-height: 0;
}

.fp .blog-prose a{
  color: var(--fp-accent);
  text-decoration: underline;
  text-decoration-color: #b9d1f5;
  text-underline-offset: 3px;
}

.fp .blog-prose a:hover{
  color: var(--fp-accent-hover);
  text-decoration-color: currentColor;
}

.blog-prose blockquote{
  padding: 18px 22px;
  border-left: 4px solid var(--fp-accent);
  border-radius: 0 14px 14px 0;
  background: var(--fp-accent-tint);
  color: var(--fp-text);
}

.blog-prose blockquote > * + *{
  margin-top: 10px;
}

.blog-prose img{
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 16px;
}

.blog-prose p img{
  display: inline-block;
  vertical-align: middle;
}

.blog-prose figure img{
  margin-inline: auto;
}

.blog-prose figcaption{
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fp-muted);
  text-align: center;
}

.blog-prose hr{
  height: 1px;
  margin-block: 36px;
  background: var(--fp-line);
}

.blog-prose code{
  padding: .1em .35em;
  border-radius: 6px;
  background: #eef1f7;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .9em;
  color: var(--fp-text);
}

.blog-prose pre{
  overflow-x: auto;
  padding: 16px 20px;
  border-radius: 14px;
  background: var(--fp-dark);
  font-size: 14px;
  line-height: 1.6;
  color: #e8ebf5;
}

.blog-prose pre code{
  padding: 0;
  background: none;
  color: inherit;
}

/* Таблица — в своём скролл-боксе, страница по ширине не разъезжается */
.blog-table{
  overflow-x: auto;
  border: 1px solid var(--fp-line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 44px rgba(42, 48, 89, .055);
  -webkit-overflow-scrolling: touch;
}

.blog-table table{
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.blog-table :where(th, td){
  padding: 12px 16px;
  border-bottom: 1px solid var(--fp-line);
  text-align: left;
  vertical-align: top;
}

.blog-table th{
  font-weight: 700;
  color: var(--fp-text);
}

.blog-table thead :where(th, td){
  background: var(--fp-bg-soft);
  font-weight: 700;
  color: var(--fp-text);
}

.blog-table tr:last-child > *{
  border-bottom: 0;
}

/* --- Адаптив ---------------------------------------------------------------- */

@media screen and (max-width: 1024px){
  .blog-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blog-hero__grid{
    grid-template-columns: minmax(0, 1fr);
  }

  .blog-hero__visual{
    width: min(560px, 100%);
    transform: none;
  }
}

@media screen and (max-width: 767px){
  .blog-hero{
    padding-top: 24px;
  }

  .blog-hero__visual{
    display: none;
  }

  .blog-grid{
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .blog-empty{
    border-radius: 22px;
  }

  .blog-empty__actions{
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .blog-prose{
    font-size: 16px;
  }

  .blog-prose h2{
    margin-top: 36px;
  }

  .blog-toc{
    padding: 16px 18px;
  }

  .blog-pager__step{
    flex-basis: 100%;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce){
  .blog-card,
  .blog-card__thumb > img{
    transition: none;
  }

  .blog-card:hover,
  .blog-card:hover .blog-card__thumb > img{
    transform: none;
  }
}
