/* Раздел «Статьи» (`specs/web/articles.md`): лента, страница статьи, карусель
   изображений. Токены цвета и шрифты — общие с сайтом (`site.css`), тёмная
   тема подхватывается через них же. */

.art-main { padding-bottom: 104px; position: relative; overflow-x: clip; }

/* ── Шапка ленты ─────────────────────────────────────────────────────── */
.art-main .art-hero { position: relative; padding: clamp(56px, 9vw, 120px) 0 36px; }
.art-main .art-hero::before {
  content: ""; position: absolute; z-index: -1; inset: -120px -10vw auto -10vw; height: 520px; pointer-events: none;
  background:
    radial-gradient(520px 320px at 12% 30%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(460px 300px at 88% 10%, color-mix(in srgb, #8b5cf6 13%, transparent), transparent 70%),
    radial-gradient(420px 260px at 60% 80%, color-mix(in srgb, #38bdf8 12%, transparent), transparent 70%);
}
.art-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px; padding: 6px 12px 6px 10px;
  border: 1px solid var(--accent-line); border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-ink); font-size: 13px; font-weight: 600; letter-spacing: 0.01em;
}
.art-eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.art-main .art-hero h1 {
  margin: 0; max-width: 16ch; font-family: var(--font-display); font-size: clamp(44px, 7vw, 84px);
  font-weight: 700; line-height: 1.02; letter-spacing: -0.035em; color: var(--ink);
}
.art-main .art-hero .art-lead { max-width: 56ch; margin: 22px 0 0; color: var(--muted); font-size: clamp(17px, 2vw, 20px); line-height: 1.55; }

.topic-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 36px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500;
  text-decoration: none; box-shadow: var(--shadow-sm); transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.chip span { color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.is-active span { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chips .chip { height: 26px; padding: 0 10px; border: 0; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 600; box-shadow: none; }
.chips .chip:hover { background: var(--accent-line); transform: none; }

/* ── Карточки ────────────────────────────────────────────────────────── */
.art-feed { padding-top: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 28px 24px; }
.card {
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow-app); }
.card-cover { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.card:hover .card-cover img { transform: scale(1.045); }
.card-ph {
  position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-height: 160px;
  background:
    radial-gradient(circle at 20% 15%, hsl(calc(var(--h) + 50) 90% 72% / 0.85), transparent 55%),
    linear-gradient(135deg, hsl(var(--h) 72% 52%), hsl(calc(var(--h) + 40) 70% 38%));
}
.card-ph::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,0.18) 1px, transparent 1px); background-size: 18px 18px; mask-image: linear-gradient(160deg, #000, transparent 70%); }
.card-ph img { position: relative; z-index: 1; width: 56px; height: 56px; filter: brightness(0) invert(1); opacity: 0.92; transition: transform 0.5s ease; }
.card:hover .card-ph img { transform: scale(1.12) rotate(-4deg); }
.card-body { display: flex; flex: 1; flex-direction: column; padding: 22px 24px 24px; }
.card-title { margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 650; line-height: 1.25; letter-spacing: -0.015em; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card .chips { position: relative; z-index: 2; }
.card-excerpt {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin: 10px 0 0; color: var(--muted); font-size: 15.5px; line-height: 1.55;
}
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: auto 0 0; padding-top: 18px; color: var(--faint); font-size: 13.5px; }
.card-meta span + span, .card-meta time + span { position: relative; }
.card-meta time + span::before { content: "·"; position: absolute; left: -9px; }

.card--featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.3fr 1fr; }
.card--featured .card-cover { aspect-ratio: auto; min-height: 380px; }
.card--featured .card-body { justify-content: center; padding: clamp(28px, 4vw, 56px); }
.card--featured .card-title { font-size: clamp(26px, 3vw, 38px); line-height: 1.15; letter-spacing: -0.025em; }
.card--featured .card-excerpt { -webkit-line-clamp: 5; font-size: 17px; }
.card--featured .card-meta { margin-top: 24px; padding-top: 0; }

.empty { padding: 72px 0; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 48px; color: var(--muted); font-size: 14px; }

/* ── Статья ──────────────────────────────────────────────────────────── */
.progress { position: fixed; z-index: 60; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), #8b5cf6); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
/* Статья занимает ту же ширину, что и блок «Читайте также» (как `.wrap` сайта). */
.post > * { width: min(1200px, 100% - 64px); margin-inline: auto; }
@media (max-width: 760px) { .post > * { width: calc(100% - 32px); } }
.post-head { padding-top: clamp(40px, 6vw, 84px); }
.back { display: inline-block; margin-bottom: 28px; color: var(--muted); font-size: 14.5px; text-decoration: none; transition: color 0.15s, transform 0.15s; }
.back:hover { color: var(--ink); transform: translateX(-3px); }
.post-head h1 { margin: 0; font-family: var(--font-display); font-size: clamp(34px, 5.4vw, 60px); font-weight: 700; line-height: 1.07; letter-spacing: -0.03em; text-wrap: balance; }
.post-head .art-lead { margin: 22px 0 0; color: var(--muted); font-size: clamp(18px, 2.2vw, 22px); line-height: 1.5; text-wrap: pretty; }
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 30px 0 0; padding-top: 22px; border-top: 1px solid var(--line); color: var(--faint); font-size: 14.5px; }
.byline .author { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; }
.byline .author::before { content: ""; width: 30px; height: 30px; border-radius: 9px; background: var(--surface) url("/assets/brand-mark.svg?v=2") center / 18px no-repeat; border: 1px solid var(--line); }
.byline time + span::before { content: "·"; margin-right: 18px; }

.cover { margin-block: 40px 8px; }
.cover img { width: 100%; max-height: 620px; object-fit: cover; border-radius: 24px; box-shadow: var(--shadow-app); }

.post-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; padding-top: 40px; }
.post-layout:not(:has(.toc)) { grid-template-columns: minmax(0, 1fr); }
.toc { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; padding-right: 8px; font-size: 13.5px; }
.toc p { margin: 0 0 12px; color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.toc a { display: block; padding: 6px 0 6px 14px; border-left: 2px solid var(--line); color: var(--muted); line-height: 1.35; text-decoration: none; transition: color 0.15s, border-color 0.15s; }
.toc a.toc-l3 { padding-left: 28px; font-size: 13px; }
.toc a:hover { color: var(--ink); }
.toc a.is-current { border-left-color: var(--accent); color: var(--ink); font-weight: 600; }

/* ── Подвал статьи ───────────────────────────────────────────────────── */
.post-foot { margin-top: 64px; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-block: 22px; border-block: 1px solid var(--line); color: var(--faint); font-size: 14px; }
.share span { margin-right: 6px; }
.art-cta {
  position: relative; overflow: hidden; margin-top: 40px; padding: clamp(28px, 5vw, 48px); border-radius: 26px; color: #f4f4f5;
  background: radial-gradient(520px 260px at 100% 0%, rgba(59,130,246,0.55), transparent 70%), radial-gradient(420px 240px at 0% 100%, rgba(139,92,246,0.4), transparent 70%), #12121a;
}
.art-cta h2 { margin: 0; font-family: var(--font-display); font-size: clamp(24px, 3vw, 32px); line-height: 1.15; letter-spacing: -0.02em; }
.art-cta p { max-width: 52ch; margin: 14px 0 26px; color: #b9b9c4; font-size: 16.5px; line-height: 1.55; }
.art-cta div { display: flex; flex-wrap: wrap; gap: 10px; }
.art-cta .btn--ghost { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.22); color: #fff; box-shadow: none; }
.art-cta .btn--ghost:hover { background: rgba(255,255,255,0.16); }

.related { margin-top: 96px; }
.related h2 { margin: 0 0 28px; font-family: var(--font-display); font-size: 30px; letter-spacing: -0.02em; }

/* ── Адаптивность ────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .post-layout, .post-layout:not(:has(.toc)) { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .card--featured { grid-template-columns: 1fr; }
  .card--featured .card-cover { aspect-ratio: 16 / 10; min-height: 0; }
  .post-body { font-size: 17.5px; line-height: 1.7; }
  .post-body h2 { font-size: 26px; }
  .post-body h3 { font-size: 21px; }
  .post-body .anchor { display: none; }
}
@media (max-width: 560px) {
  .byline time + span::before { display: none; }
  .grid { grid-template-columns: 1fr; }
  .art-main .art-hero h1 { max-width: none; }
  .gallery-nav { display: none; }
  .post-body pre { margin-inline: -16px; padding-inline: 16px; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card-cover img, .card-ph img, .chip, .back, .gallery-track { transition: none; scroll-behavior: auto; }
  .card:hover, .card:hover .card-cover img { transform: none; }
}
@media print {
  .site-header, .site-footer, .progress, .toc, .share, .art-cta, .related, .gallery-nav, .gallery-meta { display: none !important; }
  .post-body { font-size: 12pt; }
  .gallery-track { display: block; overflow: visible; }
  .gallery-slide { aspect-ratio: auto; margin-bottom: 12px; break-inside: avoid; }
}
