/* ═══════════════════════════════════════════════════════════
   Pages: home, article, listings, search, mini-app
   Sections are separated by space, never by rules (Team).
   ═══════════════════════════════════════════════════════════ */

/* ── Home ── */
/* "Read also" under an article: three cards. The feed itself is rows (feed.css). */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-6);
}
@media (max-width: 1024px) {
  .feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .feed-grid { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
}

/* ── Subscribe card ── */
.subscribe {
  position: relative;
  overflow: hidden;
  padding: var(--sp-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  scroll-margin-top: calc(var(--header-height) + var(--sp-6));
}
.subscribe::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 420px;
  height: 420px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(29, 226, 39, 0.14) 0%, transparent 65%);
}
.subscribe > * { position: relative; }
.subscribe__title { font-size: var(--text-2xl); line-height: var(--lh-32); }
/* No widths of their own: the text, the field and the consent take the card's one width
   (ADR-0018) — a 520px text and a 560px field in a 656px card left the text broken before
   the edge and the field hanging short of it. */
.subscribe__text { margin-top: var(--sp-2); color: var(--text-secondary); line-height: var(--lh-24); }
.subscribe__form { margin-top: var(--sp-5); }
.subscribe__consent { margin-top: var(--sp-3); font-size: var(--text-xs); line-height: var(--lh-16); color: var(--text-tertiary); }
.subscribe__consent a { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 2px; }
.subscribe .flash-banner { margin-top: var(--sp-5); }
/* On the home page the form sits beside the text. */
.subscribe--wide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-4) var(--sp-10); align-items: center; }
.subscribe--wide .subscribe__form, .subscribe--wide .flash-banner { margin-top: 0; }
@media (max-width: 900px) {
  .subscribe--wide { display: block; }
  .subscribe--wide .subscribe__form, .subscribe--wide .flash-banner { margin-top: var(--sp-5); }
}
@media (max-width: 560px) {
  .subscribe { padding: var(--sp-6) var(--sp-5); }
  .subscribe__title { font-size: var(--text-xl); line-height: var(--lh-28); }
}
/* A narrow shell keeps the button's word, not its envelope. */
@media (max-width: 400px) {
  .subscribe__form .btn .icon { display: none; }
}

/* ── Article ── */
.article { padding-top: var(--sp-8); }
.article__inner {
  max-width: calc(var(--article-width) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.article__header { margin-top: var(--sp-6); }
/* The breadcrumbs and «В избранное» on one row; the button drops below on a narrow screen. */
.article__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-4);
}
.article__top .breadcrumbs { margin: 0; }
.article__title { font-size: var(--text-4xl); line-height: var(--lh-48); }
.article__lead { margin-top: var(--sp-5); font-size: var(--text-xl); line-height: var(--lh-32); color: var(--text-secondary); }
/* Archived article: the date is the point — the figures may be out of date. */
.article__notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  line-height: var(--lh-20);
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm); /* ~48px tall */
}
.article__notice .icon { flex: none; color: var(--text-tertiary); }
/* The primary source under the body: one quiet line, the link is the outlet's name. */
.article__source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
  font-size: var(--text-sm);
  line-height: var(--lh-20);
  color: var(--text-secondary);
}
.article__source-label { color: var(--text-tertiary); }
.article__source a { display: inline-flex; align-items: center; gap: 4px; color: var(--text); }
@media (hover: hover) {
  .article__source a:hover { color: var(--accent); }
}
.article__source-date::before { content: "·"; margin-right: var(--sp-2); color: var(--text-tertiary); }
/* Under a line, as on the old article page: the reading time on one side, the date on the other. */
.article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1) var(--sp-4);
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  line-height: var(--lh-20);
  color: var(--text-tertiary);
}
.article__date, .article__time { display: inline-flex; align-items: center; gap: var(--sp-1); }
:is(.article__date, .article__time) .icon { width: 16px; height: 16px; }
.article__cover {
  margin-top: var(--sp-8);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.article__cover img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 768px) {
  .article { padding-top: var(--sp-5); }
  .article__title { font-size: 28px; line-height: var(--lh-32); }
  .article__lead { font-size: var(--text-lg); line-height: var(--lh-28); }
  .article__cover { margin-top: var(--sp-6); }
}

/* Table of contents */
.toc {
  margin-top: var(--sp-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.toc summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  font-family: var(--font-heading);
  font-size: var(--text-base);
  line-height: var(--lh-24);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary .icon { width: 20px; height: 20px; color: var(--accent); }
.toc summary .toc__chevron { margin-inline-start: auto; color: var(--text-tertiary); transition: transform var(--dur-2) var(--ease); }
.toc[open] summary .toc__chevron { transform: rotate(180deg); }
.toc ol { padding: 0 var(--sp-5) var(--sp-4); counter-reset: toc; }
.toc li a {
  display: block;
  padding: var(--sp-1) 0;
  font-size: 15px;
  line-height: var(--lh-24);
  color: var(--text-secondary);
  transition: color var(--dur-1) var(--ease);
}
@media (hover: hover) {
  .toc li a:hover { color: var(--accent); }
}
.toc .toc__item--h3 a { padding-inline-start: var(--sp-4); font-size: var(--text-sm); line-height: var(--lh-20); color: var(--text-tertiary); }

/* Prose: Team .rich-content, tuned for long reads. Lines and spacing in px on the 4px grid
   (the design system): 18/28 — 1.56, inside the 1.4–1.65 band for reading text. */
.prose {
  margin-top: var(--sp-10);
  font-size: 18px;
  line-height: var(--lh-28);
  color: var(--text-body);
  overflow-wrap: break-word;
}
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure, .prose .table-wrap { margin: 0 0 var(--sp-6); }
.prose h1, .prose h2 { margin: var(--sp-12) 0 var(--sp-4); font-size: 28px; line-height: var(--lh-36); }
.prose h3 { margin: var(--sp-10) 0 var(--sp-3); font-size: 22px; line-height: var(--lh-28); }
.prose h4 { margin: var(--sp-8) 0 var(--sp-2); font-size: 18px; line-height: var(--lh-24); }
.prose h5, .prose h6 { margin: var(--sp-6) 0 var(--sp-2); font-family: var(--font-body); font-size: 17px; line-height: var(--lh-24); font-weight: 700; letter-spacing: 0; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
@media (hover: hover) {
  .prose a:hover { color: var(--accent-light); }
}
.prose strong, .prose b { color: var(--text); font-weight: 700; }
.prose em { font-style: italic; }
.prose ul { list-style: disc; padding-inline-start: var(--sp-6); }
.prose ol { list-style: decimal; padding-inline-start: var(--sp-6); }
.prose li { margin: var(--sp-2) 0; padding-inline-start: var(--sp-1); }
.prose li::marker { color: var(--accent); }
.prose li > ul, .prose li > ol { margin: var(--sp-2) 0; }
.prose blockquote {
  padding: var(--sp-4) var(--sp-5);
  color: var(--text);
  background: var(--tint);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--r-sm);
}
.prose blockquote > :last-child { margin-bottom: 0; }
.prose code {
  padding: 2px var(--sp-1);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xs);
}
.prose pre {
  padding: var(--sp-4) var(--sp-5);
  overflow-x: auto;
  font-size: 14px;
  line-height: var(--lh-24);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.prose pre code { padding: 0; background: none; border: 0; font-size: inherit; }
.prose img { margin: var(--sp-8) auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
.prose p > img:only-child { margin: 0 auto; }
.prose figure img { margin: 0 auto; }
.prose figcaption { margin-top: var(--sp-2); font-size: var(--text-sm); line-height: var(--lh-20); color: var(--text-tertiary); text-align: center; }
.prose hr { height: 1px; margin: var(--sp-12) 0; background: var(--border); border: 0; }
.prose .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: var(--lh-24); }
.prose th, .prose td { padding: var(--sp-3) var(--sp-4); text-align: start; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose tr:last-child td { border-bottom: 0; }
.prose th { font-size: var(--text-sm); line-height: var(--lh-20); font-weight: 700; color: var(--text); background: var(--surface); }
.prose iframe, .prose video { max-width: 100%; border-radius: var(--r-lg); }
.prose h2[id], .prose h3[id] { scroll-margin-top: calc(var(--header-height) + var(--sp-6)); }
@media (max-width: 768px) {
  .prose { font-size: 17px; }
  .prose h1, .prose h2 { font-size: 23px; line-height: var(--lh-28); }
  .prose h3 { font-size: 19px; line-height: var(--lh-24); }
}

/* After the body */
.article__tags { margin-top: var(--sp-10); }
.share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-8);
}
.share__label { margin-inline-end: var(--sp-2); font-size: var(--text-sm); line-height: var(--lh-20); color: var(--text-tertiary); }
.share__native { display: none; }
.share.has-native .share__native { display: inline-flex; }
.share__copy.is-copied { color: var(--accent); border-color: var(--border-accent); }
.article__subscribe { margin-top: var(--sp-12); }

.adjacent {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4);
  margin-top: var(--sp-12);
}
.adjacent__link {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.adjacent__label { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--text-xs); line-height: var(--lh-16); color: var(--text-tertiary); }
.adjacent__label .icon { width: 16px; height: 16px; }
.adjacent__title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: var(--lh-20);
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.adjacent__link--next { grid-column: 2; text-align: end; align-items: flex-end; }
@media (hover: hover) {
  .adjacent__link:hover { border-color: var(--border-hover); transform: translateY(-2px); }
  .adjacent__link:hover .adjacent__label { color: var(--accent); }
}
@media (max-width: 640px) {
  .adjacent { grid-template-columns: minmax(0, 1fr); }
  .adjacent__link--next { grid-column: auto; }
}

.back-link { display: inline-flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-8); font-size: var(--text-sm); line-height: var(--lh-20); color: var(--text-secondary); }
@media (hover: hover) {
  .back-link:hover { color: var(--accent); }
}
.back-link .icon { width: 16px; height: 16px; }

/* ── Listings: category, tag ── */
.listing-header .breadcrumbs { margin-bottom: var(--sp-5); }
.listing-header .page-subtitle { max-width: 720px; }
.listing-body { margin-top: var(--sp-8); }

/* ── Search ── */
/* The magnifier, the field, the clear cross and «Найти» in one .field-action — as wide as
   the results under it (ADR-0018: one block, one width). */
.search-form { margin-top: var(--sp-6); }
/* Same cross as the header search: a borderless 32px .icon-btn with the 1px icon. Shown
   only while the field has text; it keeps its place, so the field does not jump. */
.search-field__clear {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-color: transparent;
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), opacity var(--dur-1) var(--ease);
}
.field-action__input:placeholder-shown ~ .search-field__clear { opacity: 0; visibility: hidden; }
.search-count { margin-top: var(--sp-6); font-size: var(--text-sm); line-height: var(--lh-20); color: var(--text-tertiary); }

/* ── Mini app: the blog inside the mobile app's WebView (?mini_app) ── */
.mini-app { background: #000; }
.mini-app::before { display: none; }
.mini-app .main-content { padding-top: 0; }
.mini-app .breadcrumbs,
.mini-app .subscribe,
.mini-app .share { display: none; }
.mini-app .page-header { padding-top: var(--sp-6); }
