/* ==========================================================================
   Articles, part 2: one-link cards, cover fallback, buttons, product block.
   Loaded after style.css on listings and single posts (inc/articles.php).
   ========================================================================== */
/* Colours: legacy --tk-* role names, aliases of the Learnio DS tokens (style.css :root, task 01a1f408 W2a). */

/* Card = one link. The title link is stretched over the whole card. */
.article-card {
  position: relative;
}
.article-card .article-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
main .article-card:has(.article-title a:focus-visible) {
  border-color: var(--l-focus);
  outline: 2px solid var(--l-focus);
  outline-offset: 2px;
}
.article-card .article-title a:focus-visible {
  outline: none;
}

/* Category chip inside a card is a label, not a link. */
.article-terms .article-chip {
  padding: 4px 10px;
  border-radius: var(--l-r-pill);
  background: var(--tk-bg-blue-light);
  color: var(--tk-fg-blue);
}
.article-readmore {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.article-readmore::after {
  content: "→";
  transition: transform 0.2s var(--ease);
}
.article-card:hover .article-readmore::after {
  transform: translateX(3px);
}

/* Cover fallback: same 16:9 slot as a photo, brand tile with the mark. */
.article-thumb--fallback {
  margin: 0;
  background: var(--tk-bg-blue) url("../logo-white.svg") center / 34% auto no-repeat;
}

/* Previous / next on the article page: outlined pill like the pagination and .ghost-button. */
.article-single-page .article-single-nav .wp-block-post-navigation-link a {
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid var(--tk-bd-line);
  background: var(--tk-bg-surface);
  color: var(--tk-fg-blue);
  font-weight: 600;
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.article-single-page .article-single-nav .wp-block-post-navigation-link a:hover {
  border-color: var(--tk-bd-blue);
  background: var(--tk-bg-surface);
  color: var(--tk-fg-blue);
}
.article-single-page .article-single-nav .wp-block-post-navigation-link a:active {
  transform: scale(0.98);
}
.article-single-page .article-single-nav .wp-block-post-navigation-link a:focus-visible {
  outline: 2px solid var(--l-focus);
  outline-offset: 2px;
}

/* Buttons that older posts carry inside the text: solid site pill. */
.article-rich-content .wp-element-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid var(--tk-bd-blue);
  border-radius: var(--l-r-pill);
  background: var(--tk-bg-blue);
  color: var(--tk-fg-ffffff);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s;
}
.article-rich-content .wp-element-button:hover {
  border-color: var(--tk-bd-blue-dark);
  background: var(--tk-bg-blue-dark);
}

/* «Попробуйте в Лёрнио» under the text. It sits inside the article card, so by the DS surface rule it is no second
   card: a hairline above it, and the products are surface-2 tiles (r12, no border, no shadow). */
.article-rich-content .learnio-article-products {
  display: grid;
  gap: var(--l-s-4);
  margin-top: var(--l-s-6);
  padding: var(--l-s-6) 0 0;
  border-top: 1px solid var(--l-border);
}
.article-rich-content .learnio-article-products__title {
  margin: 0;
  color: var(--l-text);
  font-size: var(--l-fs-section);
  line-height: var(--l-lh-tight);
}
.article-rich-content .learnio-article-products__lead {
  margin: 0;
  color: var(--l-muted);
  font-size: var(--l-fs-md);
  line-height: var(--l-lh);
}
.article-rich-content .learnio-article-products__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--l-s-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.article-rich-content .learnio-article-products__item {
  display: flex;
  margin: 0;
}
.article-rich-content .learnio-article-products__item + .learnio-article-products__item {
  margin-top: 0;
}
.article-rich-content .learnio-article-products__item a {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--l-s-1);
  padding: var(--l-s-4);
  border-radius: var(--l-r-sm);
  background: var(--l-surface-2);
  color: var(--l-muted);
  text-decoration: none;
  transition: background-color var(--l-dur) var(--l-ease);
}
.article-rich-content .learnio-article-products__item a:hover {
  background: var(--l-border);
}
.article-rich-content .learnio-article-products__item a:focus-visible {
  outline: 2px solid var(--l-focus);
  outline-offset: 2px;
}
.article-rich-content .learnio-article-products__name {
  color: var(--l-text);
  font-size: var(--l-fs-title);
  font-weight: 700;
  line-height: 1.3;
}
.article-rich-content .learnio-article-products__text {
  margin-bottom: auto;
  font-size: var(--l-fs-sm);
  line-height: var(--l-lh);
}
.article-rich-content .learnio-article-products__go {
  padding-top: var(--l-s-2);
  color: var(--l-link);
  font-size: var(--l-fs-sm);
  font-weight: 600;
}
.article-rich-content .learnio-article-products__go::after {
  content: " →";
}
.article-rich-content .learnio-article-products__more {
  margin: 0;
}

@media (max-width: 1023.98px) {
  .article-rich-content .learnio-article-products__list {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 767.98px) {
  .article-rich-content .learnio-article-products__more .ghost-button {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .article-card .article-readmore::after,
  .article-rich-content .learnio-article-products__item a {
    transition: none;
  }
}

/* Single article: the whole column is the reading width (820px text + card
   padding), so the text and «Попробуйте в Лёрнио» fill the card edge to edge. */
body main.article-single-page {
  max-width: calc(820px + 2 * 28px + 4px + 40px);
}
@media (max-width: 767.98px) {
  /* Previous / next: two equal full-width pills, one under the other. */
  body .article-single-page .article-single-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  body .article-single-page .article-single-nav .wp-block-post-navigation-link a {
    justify-content: center;
    width: 100%;
  }
}

/* Posts without a picture (wave 3): one of three 3D covers, picked by post ID (inc/design-system.php).
   Same 16:9 slot as a photo on cards, same 4:3 slot on the article page; the image is decorative. */
.article-thumb.article-thumb--cover,
.article-single-thumb.article-single-thumb--cover {
  background: var(--l-surface-2);
}
.article-thumb--cover .learnio-cover-img,
.article-single-thumb--cover .learnio-cover-img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.article-card:hover .article-thumb--cover .learnio-cover-img {
  transform: scale(1.03);
}
html[data-theme="dark"] .learnio-cover-img {
  filter: brightness(0.86);
}
