/* Блог: список статей и страница статьи. Подключается после styles.css */

/* Размер текста статьи: 16px на мобильных, 18px на десктопе, на 1920 растёт до 20px */
:root {
  --fs-article: 16px;
}
@media (min-width: 768px) {
  :root {
    --fs-article: 18px;
  }
}
@media (min-width: 1728px) {
  :root {
    --fs-article: min(20px, calc(18px + (100vw - 1728px) * 0.0104));
  }
}

body {
  background: var(--pure-white);
}

/* ---------- Общие компоненты ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--sunset-blaze);
  background: var(--sunset-tint-20);
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 13px;
  color: var(--graphite-grey);
}
.post-meta__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}
.link-arrow svg {
  width: 10px;
  height: 10px;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
a:hover > .link-arrow svg,
.link-arrow:hover svg {
  transform: translate(3px, -3px);
}

/* ---------- Заголовок страницы блога ---------- */
.blog-head {
  padding-top: calc(var(--header-height) + clamp(48px, 5vw, 96px));
}
.blog-head__title {
  font-size: var(--fs-hero);
  font-weight: 600;
  line-height: 1.2;
}
.blog-head__sub {
  max-width: 40em;
  margin-top: 16px;
  font-size: var(--fs-sub);
  line-height: 1.5;
  color: var(--graphite-grey);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 40px;
}
.chip {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--obsidian-black);
  background: var(--mist-sand);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.chip:hover {
  background: var(--sunset-tint-20);
}
.chip[aria-pressed="true"],
.chip[aria-current="page"] {
  color: var(--pure-white);
  background: var(--obsidian-black);
}
.chip:focus-visible {
  outline: 2px solid var(--sunset-blaze);
  outline-offset: 2px;
}

/* ---------- Главная статья ---------- */
.featured {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 3.3vw, 64px);
  margin-top: 48px;
}
.featured[hidden],
.post-grid[hidden] {
  display: none;
}
.featured__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-photo);
  background: var(--mist-sand);
}
.featured__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.featured:hover .featured__media img {
  transform: scale(1.03);
}
.featured__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}
.featured__title {
  font-size: var(--fs-lead);
  font-weight: 600;
  line-height: 1.2;
}
.featured__excerpt {
  max-width: 34em;
  font-size: 16px;
  line-height: 1.55;
  color: var(--graphite-grey);
}
/* Вся карточка кликабельна через ссылку в заголовке */
.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
}
.card-link:focus-visible {
  outline: none;
}
.featured:has(.card-link:focus-visible),
.post-card:has(.card-link:focus-visible) {
  outline: 2px solid var(--sunset-blaze);
  outline-offset: 8px;
  border-radius: var(--radius-card);
}

/* ---------- Сетка статей ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(40px, 4vw, 64px) 20px;
  margin-top: clamp(56px, 6vw, 96px);
}
.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.post-card[hidden] {
  display: none;
}
.post-card__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--mist-sand);
}
.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.post-card:hover .post-card__media img {
  transform: scale(1.04);
}
/* Для 3D-иллюстраций с прозрачным фоном */
.post-card__media--illustration {
  display: grid;
  place-items: center;
  background: var(--mist-sand);
}
.post-card__media--illustration img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}
.post-card__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.post-card__title {
  margin-top: 14px;
  font-size: var(--fs-card-title);
  font-weight: 500;
  line-height: 1.25;
  text-wrap: balance;
}
.post-card__excerpt {
  margin-top: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  color: var(--graphite-grey);
}
.blog-empty {
  margin-top: 48px;
  padding: 48px 24px;
  border-radius: var(--radius-card);
  text-align: center;
  color: var(--graphite-grey);
  background: var(--mist-sand);
}
.blog-empty[hidden] {
  display: none;
}

/* ---------- Пагинация ---------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: clamp(56px, 6vw, 96px);
}
.pagination a,
.pagination span {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  background: var(--mist-sand);
  transition: background-color 0.25s ease, color 0.25s ease;
}
.pagination a:hover {
  background: var(--sunset-tint-20);
}
.pagination [aria-current="page"] {
  color: var(--pure-white);
  background: var(--obsidian-black);
}

.blog-end {
  padding-bottom: var(--section-py);
}

/* ---------- Страница статьи ---------- */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 11;
  width: 100%;
  height: 3px;
  background: var(--sunset-blaze);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}
.post-head {
  padding-top: calc(var(--header-height) + clamp(32px, 3.5vw, 64px));
}
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--graphite-grey);
}
.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 8px;
  opacity: 0.5;
}
.breadcrumbs a:hover {
  color: var(--sunset-blaze);
}
.post-head__title {
  max-width: 24em;
  margin-top: 28px;
  font-size: clamp(30px, 3.2vw, 56px);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}
.post-head__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 28px;
}
.post-cover {
  margin-top: 40px;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  border-radius: var(--radius-photo);
  background: var(--mist-sand);
}
.post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 720px);
  justify-content: center;
  gap: clamp(40px, 6vw, 120px);
  padding-block: clamp(40px, 5vw, 80px) var(--section-py);
}
.post-aside {
  position: sticky;
  top: calc(var(--header-height) + 32px);
  align-self: start;
  display: grid;
  gap: 20px;
}
.toc__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.toc ol {
  display: grid;
  gap: 2px;
  margin-top: 16px;
  border-left: 2px solid var(--mist-sand);
}
.toc a {
  display: block;
  margin-left: -2px;
  padding: 8px 0 8px 16px;
  border-left: 2px solid transparent;
  font-size: 14px;
  line-height: 1.35;
  color: var(--graphite-grey);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.toc a:hover {
  color: var(--obsidian-black);
}
.toc a.is-active {
  color: var(--obsidian-black);
  border-left-color: var(--sunset-blaze);
}
.aside-card {
  padding: 22px;
  border-radius: var(--radius-card);
  background: var(--mist-sand);
}
.aside-card__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}
.aside-card__text {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--graphite-grey);
}
.aside-card .btn {
  width: 100%;
  height: 52px;
  margin-top: 16px;
  font-size: 16px;
}
/* «Поделиться»: карточка как блок «Обсудим вашу задачу?», справа группа кнопок в 6px от края */
.share {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  padding: 6px;
  border-radius: var(--radius-card);
  background: var(--mist-sand);
}
.share__label {
  align-self: center;
  padding-left: 16px;
  font-size: 14px;
  color: var(--graphite-grey);
}
.share__group {
  display: flex;
  overflow: hidden;
  border: 1px solid rgb(var(--obsidian-rgb) / 0.08);
  border-radius: calc(var(--radius-card) - 6px); /* радиус карточки минус отступ */
}
.share__btn {
  all: unset;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 52px;
  height: 48px;
  color: var(--obsidian-black);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.share__btn + .share__btn {
  border-left: 1px solid rgb(var(--obsidian-rgb) / 0.08);
}
.share__btn:hover {
  background: var(--pure-white);
}
.share__btn svg {
  width: 20px;
  height: 20px;
}
.share__btn .icon-done,
.share__btn.is-done .icon-copy {
  display: none;
}
.share__btn.is-done .icon-done {
  display: block;
}
.share__btn.is-done {
  color: var(--pure-white);
  background: var(--success-green);
}
.share__btn:focus-visible {
  outline: 2px solid var(--sunset-blaze);
  outline-offset: -2px;
}

/* ---------- Текст статьи (в WordPress это .entry-content) ---------- */
.prose {
  font-size: var(--fs-article);
  line-height: 1.65;
  color: var(--obsidian-black);
}
.prose > * + * {
  margin-top: 1.25em;
}
.prose .lead {
  font-size: 1.2em;
  line-height: 1.5;
  font-weight: 500;
}
.prose h2 {
  margin-top: 2.2em;
  font-size: clamp(26px, 2.2vw, 36px);
  font-weight: 600;
  line-height: 1.2;
  scroll-margin-top: calc(var(--header-height) + 24px);
}
.prose h3 {
  margin-top: 1.8em;
  font-size: clamp(21px, 1.6vw, 26px);
  font-weight: 500;
  line-height: 1.25;
}
.prose h2 + *,
.prose h3 + * {
  margin-top: 0.8em;
}
.prose a {
  color: var(--sunset-shade-80);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.prose a:hover {
  color: var(--sunset-blaze);
}
.prose ul,
.prose ol {
  display: grid;
  gap: 0.6em;
  padding-left: 0;
}
.prose ul li,
.prose ol li {
  position: relative;
  padding-left: 1.6em;
}
.prose ul li::before {
  content: "";
  position: absolute;
  left: 0.2em;
  top: 0.7em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sunset-blaze);
}
.prose ol {
  counter-reset: item;
}
.prose ol li {
  counter-increment: item;
}
.prose ol li::before {
  content: counter(item) ".";
  position: absolute;
  left: 0;
  font-weight: 600;
  color: var(--sunset-blaze);
}
.prose blockquote {
  padding: 8px 0 8px 28px;
  border-left: 3px solid var(--sunset-blaze);
  font-size: 1.3em;
  font-weight: 500;
  line-height: 1.4;
  text-wrap: balance;
}
.prose figure {
  margin-top: 2em;
}
.prose figure img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius-card);
}
.prose figcaption {
  margin-top: 12px;
  font-size: 14px;
  color: var(--graphite-grey);
}
.callout {
  padding: 24px 28px;
  border-radius: var(--radius-card);
  font-size: 0.92em;
  background: var(--mist-sand);
}
.callout__title {
  margin-bottom: 6px;
  font-size: 1.05em;
  font-weight: 600;
}
.callout--accent {
  background: var(--sunset-tint-20);
}

/* ---------- Автор и «читайте также» ---------- */
.author-card {
  display: flex;
  align-items: stretch;
  gap: 20px;
  margin-top: 3em;
  padding: 4px;
  border-radius: var(--radius-card);
  background: var(--mist-sand);
}
.author-card img {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 14px;
  object-fit: cover;
}
.author-card__text {
  align-self: center;
  padding: 6px 6px 6px 0;
}
.author-card strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
}
.author-card p {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--graphite-grey);
}
.related {
  padding-block: var(--section-py);
  background: var(--mist-sand);
}
.related__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}
.related .post-card__media {
  background: var(--pure-white);
}

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .post-layout {
    grid-template-columns: minmax(0, 720px);
  }
  .post-aside {
    position: static;
    order: 2;
  }
  .toc {
    display: none; /* на узких экранах оглавление не нужно */
  }
}
@media (max-width: 1000px) {
  .featured {
    grid-template-columns: minmax(0, 1fr);
  }
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .chips {
    flex-wrap: nowrap;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .chips::-webkit-scrollbar {
    display: none;
  }
  .chip {
    flex: none;
  }
  .post-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .post-cover {
    aspect-ratio: 4 / 3;
  }
  .author-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .author-card__text {
    padding: 0 12px 12px;
  }
  .callout {
    padding: 20px;
  }
}

.nw {
  white-space: nowrap;
}

/* ---------- Заглушки: иконка категории на сером фоне, когда у статьи нет своей картинки ---------- */
.featured__media--illustration {
  display: grid;
  place-items: center;
}
.featured__media--illustration img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}
.post-cover--placeholder {
  position: relative;
}
/* позиционируем абсолютно: проценты высоты внутри блока с aspect-ratio иначе не считаются */
.post-cover--placeholder img {
  position: absolute;
  top: 7%;
  left: 50%;
  width: auto;
  height: 86%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  object-fit: contain;
}
.prose figure.figure-placeholder img {
  box-sizing: border-box;
  padding: 8%;
  object-fit: contain;
  background: var(--mist-sand);
}
