/*
Theme Name: web3D Pro
Theme URI: https://web3d.pro/
Author: web3D.pro
Author URI: https://web3d.pro/
Description: Современная тёмная тема для технологического медиа о 3D, AI и инструментах цифровых художников. Магента + циан, glass-карточки, асимметричная сетка, бесконечная live-лента, переключатель тёмная/светлая.
Version: 1.0.23
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: web3d-pro
Tags: news, magazine, dark-mode, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ────────────────────────────────────────────────────────────
   Reset & tokens
   ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  --bg: #06070d;
  --bg-2: #0b0e17;
  --fg: #eef1f7;
  --mute: #7a8398;
  --line: rgba(255,255,255,0.07);
  --line-2: rgba(255,255,255,0.14);
  /* HEX fallbacks for browsers without oklch() (Safari ≤15, Chrome ≤110, FF ≤113) */
  --accent: #ff3aa5;
  --accent-2: #5bc8ff;
  --card: rgba(255,255,255,0.025);
  --card-hi: rgba(255,255,255,0.06);
  --maxw: 1200px;
  --pad: 36px;
}
/* Progressive enhancement: use oklch when the browser supports it */
@supports (color: oklch(0.5 0.1 0)) {
  :root {
    --accent: oklch(0.72 0.28 340);
    --accent-2: oklch(0.82 0.18 220);
  }
}

body.lite {
  --bg: #f4f5f8;
  --bg-2: #ffffff;
  --fg: #0e1220;
  --mute: #5c6680;
  --line: rgba(10,15,30,0.08);
  --line-2: rgba(10,15,30,0.16);
  --accent: #c4187f;
  --accent-2: #1c91c4;
  --card: rgba(255,255,255,0.7);
  --card-hi: rgba(255,255,255,0.95);
}
@supports (color: oklch(0.5 0.1 0)) {
  body.lite {
    --accent: oklch(0.52 0.24 340);
    --accent-2: oklch(0.55 0.18 220);
  }
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255,70,180,0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(80,200,255,0.14), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  letter-spacing: -0.01em;
  min-height: 100vh;
}

body.lite {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255,70,180,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(80,200,255,0.08), transparent 60%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; letter-spacing: -0.025em; }
p { margin: 0; text-wrap: pretty; }
button { font: inherit; cursor: pointer; }

.screen-reader-text { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ────────────────────────────────────────────────────────────
   Site header
   ──────────────────────────────────────────────────────────── */
.site-header { position: relative; border-bottom: 1px solid var(--line); }
.top { display: grid; grid-template-areas: "logo . buttons" "logo nav nav"; grid-template-columns: 200px 1fr auto; align-items: center; padding: 0 var(--pad); column-gap: 28px; max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.logo-link { grid-area: logo; align-self: stretch; display: flex; align-items: center; line-height: 0; padding: 12px 16px 12px 0; }
.logoSwap { display: inline-flex; line-height: 0; }
.logo-link .logoSwap { display: flex; align-items: center; }
/* Размер логотипа задаётся классом варианта. Без !important, иначе мобильный
   медиазапрос ниже не может его переопределить и шапка рвёт вьюпорт. */
.logo-link .logoSwap svg, .logo-link .logoSwap img { width: auto; }
.logoSwap.is-lg svg, .logoSwap.is-lg img { height: 88px; }
.logoSwap.is-sm svg, .logoSwap.is-sm img { height: 40px; }
.logoSwap .l-light { display: none; }
body.lite .logoSwap .l-dark { display: none; }
body.lite .logoSwap .l-light { display: inline-block; }

.main-nav { grid-area: nav; align-self: end; display: flex; gap: 4px; flex-wrap: nowrap; padding: 6px 0 10px; border-top: 1px solid var(--line); overflow: hidden; }
.main-nav a { padding: 7px 12px; border-radius: 999px; font-size: 13px; color: var(--mute); white-space: nowrap; }
.main-nav a:hover,
.main-nav .current-menu-item > a,
.main-nav .current-cat > a { color: var(--fg); background: var(--card); border: 1px solid var(--line-2); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: nowrap; }

.top-right { grid-area: buttons; display: flex; gap: 12px; align-items: center; padding: 12px 0; }
.search-trigger {
  padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  display: inline-flex; gap: 8px; align-items: center; color: var(--mute); font-size: 13px; min-width: 200px;
}
.search-trigger::before {
  content: ""; width: 10px; height: 10px; border: 1.5px solid var(--mute); border-radius: 999px;
  box-shadow: 4px 4px 0 -3px var(--mute);
}
.search-trigger .kbd {
  margin-left: auto; padding: 1px 6px; font-family: 'JetBrains Mono', monospace; font-size: 10px;
  border: 1px solid var(--line-2); border-radius: 4px;
}
.btn {
  padding: 9px 16px; border-radius: 999px; font-size: 13px; background: var(--accent);
  color: #1a0612; font-weight: 600; border: 0; display: inline-block;
}
.btn-ghost {
  padding: 9px 16px; border-radius: 999px; font-size: 13px; color: var(--fg);
  border: 1px solid var(--line-2); background: transparent;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; padding: 4px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); line-height: 1;
}
.theme-toggle span {
  padding: 6px 12px; border-radius: 999px; font-size: 11px; color: var(--mute);
  letter-spacing: 0.1em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px;
}
body:not(.lite) .theme-toggle .t-d {
  background: var(--accent); color: #1a0612; font-weight: 600;
  box-shadow: 0 0 24px -4px var(--accent);
}
body.lite .theme-toggle .t-l { background: var(--accent); color: #fff; font-weight: 600; }

/* Mobile nav toggle */
.menu-toggle { display: none; }

/* ────────────────────────────────────────────────────────────
   Live ticker
   ──────────────────────────────────────────────────────────── */
.live {
  display: flex; align-items: center; gap: 0; padding: 0;
  border-bottom: 1px solid var(--line); font-size: 13px; color: var(--mute); overflow: hidden;
}
.live .head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px 12px var(--pad); flex: none; border-right: 1px solid var(--line);
}
.live .pulse {
  width: 8px; height: 8px; border-radius: 999px; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent); animation: pulse 1.6s ease-out infinite; flex: none;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0    rgba(255,80,200,.7); }
  70%  { box-shadow: 0 0 0 12px rgba(255,80,200,0); }
  100% { box-shadow: 0 0 0 0    rgba(255,80,200,0); }
}
.live .lab {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent);
}
.live .rail {
  flex: 1; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}
.live .track {
  display: flex; gap: 32px; padding: 12px 24px; width: max-content;
  animation: ticker 55s linear infinite; white-space: nowrap;
}
.live:hover .track { animation-play-state: paused; }
.live .track a { color: var(--fg); font-weight: 500; }
.live .track span { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.live .track span::before { content: "◆"; color: var(--accent-2); font-size: 8px; }
@keyframes ticker { to { transform: translate3d(-50%, 0, 0); } }

/* ────────────────────────────────────────────────────────────
   Page wrappers
   ──────────────────────────────────────────────────────────── */
.site-main { min-height: 60vh; }

/* ── 1200px centred container ── */
.hero, .section-head, .grid,
.archive-hero, .pagination,
.live, .site-footer, .site-bottom,
.error-404, .search-page {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
}

/* Hero (front page) */
.hero { padding: 48px var(--pad) 24px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; }
.hero-text {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  padding: 32px; position: relative; overflow: hidden; backdrop-filter: blur(16px);
  display: flex; flex-direction: column; gap: 22px; min-height: 540px;
}
.hero-text::before {
  content: ""; position: absolute; inset: -1px; border-radius: 24px; padding: 1px;
  background: linear-gradient(140deg, var(--accent), transparent 50%, var(--accent-2));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: .6; pointer-events: none;
}
.kicker {
  display: inline-flex; align-items: center; gap: 10px; font-size: 12px;
  font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent-2);
}
.kicker .chip {
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,58,165,0.18);
  border: 1px solid var(--line-2); color: var(--fg);
}
@supports (color: oklch(0.5 0.1 0)) {
  .kicker .chip { background: color-mix(in oklch, var(--accent) 18%, transparent); }
}
.hero-text h1 { font-size: clamp(36px, 4.5vw, 54px); line-height: 1.02; max-width: 16ch; }
.hero-text .dek { font-size: 17px; line-height: 1.55; color: var(--mute); max-width: 56ch; }
.hero-text .actions { display: flex; gap: 10px; }
.hero-text .meta {
  margin-top: auto; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; gap: 18px; font-size: 12px; color: var(--mute);
}
.hero-text .meta b { color: var(--fg); font-weight: 500; }

.hero-figure {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  overflow: hidden; position: relative; min-height: 0;
  display: flex; flex-direction: column;
  /* Обложка больше не растягивается по высоте колонки, поэтому прижимаем
     группу «картинка + подпись» к центру, иначе снизу зияет пустой блок. */
  justify-content: center;
}
/* flex:1 растягивал обложку по высоте текстовой колонки, и после перехода
   на object-fit:contain сверху и снизу оставались широкие пустые поля.
   Держим родную пропорцию кадра. */
.hero-figure .thumb { flex: 0 0 auto; aspect-ratio: 16/9; min-height: 0; }
.hero-figure .caption {
  padding: 18px 22px; font-size: 12px; color: var(--mute); border-top: 1px solid var(--line);
  display: flex; gap: 14px;
}
.hero-figure .caption b { color: var(--fg); font-weight: 500; }
.hero-figure .credit {
  position: absolute; top: 18px; right: 18px; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--accent-2); letter-spacing: 0.12em; text-transform: uppercase;
  background: rgba(0,0,0,0.45); padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); backdrop-filter: blur(8px);
}
body.lite .hero-figure .credit { background: rgba(255,255,255,0.75); color: var(--accent); }

/* Thumb placeholders & featured image */
.thumb { position: relative; background: linear-gradient(135deg, #1a0a22, #06070d); overflow: hidden; }
body.lite .thumb { background: linear-gradient(135deg, #eaddef, #d8e5f0); }
/* Обложки показываем целиком. Раньше стоял object-fit: cover, и картинка
   обрезалась по краям: на сравнениях и подборках терялись подписи и половина
   кадра. Контейнеры приведены к 16/9, это родная пропорция большинства
   обложек, поэтому полей почти не остаётся. */
.thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block;
}
.thumb .placeholder { position: absolute; inset: 0; }
.thumb .placeholder svg { width: 100%; height: 100%; display: block; }
.thumb .meta {
  position: absolute; left: 16px; bottom: 14px; font-size: 11px;
  color: rgba(255,255,255,0.7); font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(0,0,0,0.55); padding: 4px 10px; border-radius: 999px;
}

/* Section header */
.section-head {
  padding: 24px var(--pad) 8px; display: flex; align-items: end;
  justify-content: space-between; gap: 24px;
}
.section-head h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.section-head .pills { display: flex; gap: 8px; flex-wrap: wrap; }
.section-head .pills a {
  padding: 6px 12px; font-size: 12px; color: var(--mute);
  border: 1px solid var(--line); border-radius: 999px;
}
.section-head .pills a:hover, .section-head .pills .on {
  color: var(--fg); background: var(--card-hi); border-color: var(--line-2);
}

/* Card grid */
.grid { padding: 18px var(--pad) 36px; display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px;
  display: flex; flex-direction: column; gap: 14px; overflow: hidden; position: relative;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.card:hover {
  border-color: var(--cat-color, var(--accent));
  box-shadow: 0 0 0 1px var(--cat-color, var(--accent)), 0 20px 44px rgba(0,0,0,0.22);
  transform: translateY(-5px);
  z-index: 3;
}
.card .thumb { border-radius: 12px; aspect-ratio: 16/9; position: relative; overflow: hidden; }
.card .thumb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.52) 0%, transparent 52%); border-radius: inherit; pointer-events: none; }
.card .thumb .tag {
  position: absolute; bottom: 10px; left: 12px; z-index: 1;
  background: rgba(6,7,13,0.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.16); border-radius: 999px;
  padding: 4px 12px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--cat-color, var(--accent-2)) !important;
}
.card .thumb .tag a { color: inherit !important; text-decoration: none; }
.card .tag {
  font-size: 11px; color: var(--accent-2);
  font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 0.12em;
}
.card h3, .card h2 { font-size: 19px; line-height: 1.2; }
.card h3 a, .card h2 a { color: var(--fg); }
.card .meta {
  font-size: 11px; color: var(--mute);
  display: flex; gap: 0; flex-wrap: nowrap; align-items: center;
  margin-top: auto; padding-top: 4px; overflow: hidden;
}
.card .meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta span + span::before { content: ' · '; opacity: .5; }
.card .meta b { color: var(--fg); font-weight: 500; }

.span-12 { grid-column: span 12; }
.span-8  { grid-column: span 8;  }
.span-7  { grid-column: span 7;  }
.span-5  { grid-column: span 5;  }
.span-4  { grid-column: span 4;  }
.span-3  { grid-column: span 3;  }

/* Feature card (large with image left, text right) */
.card.feature { grid-column: span 8; display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; }
.card.feature .thumb { aspect-ratio: 16/9; min-height: 0; align-self: center; border-radius: 18px 0 0 18px; }
.card.feature .body { padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.card.feature h3 { font-size: 28px; line-height: 1.1; }
.card.feature .dek { font-size: 14.5px; color: var(--mute); line-height: 1.5; }

/* Sidebar list (most-read) */
.most-read {
  grid-column: span 4; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px;
}
.most-read h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-2);
  font-family: 'JetBrains Mono', monospace; margin: 0 0 12px;
}
.most-read ol { margin: 0; padding: 0; list-style: none; }
.most-read li {
  display: grid; grid-template-columns: 32px 1fr; gap: 12px;
  padding: 14px 0; border-top: 1px solid var(--line);
  position: relative; transition: padding .25s ease;
}
.most-read li::after {
  content: ""; position: absolute; left: -22px; top: 50%; width: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease; transform: translateY(-50%);
}
.most-read li:first-child { border-top: 0; padding-top: 0; }
.most-read li:hover { padding-left: 8px; }
.most-read li:hover::after { width: 18px; }
.most-read li:hover .num { color: var(--accent-2); }
.most-read .num {
  font-family: 'JetBrains Mono', monospace; font-size: 18px; color: var(--accent); letter-spacing: -0.02em;
  transition: color .25s ease;
}
.most-read .ti { font-size: 14px; line-height: 1.3; }
.most-read .mt { font-size: 11px; color: var(--mute); margin-top: 6px; }
.most-read a { color: var(--fg); }

/* ────────────────────────────────────────────────────────────
   Single article
   ──────────────────────────────────────────────────────────── */
.article-hero { padding: 56px var(--pad) 28px; max-width: var(--maxw); margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.article-hero h1 { font-size: clamp(36px, 4.5vw, 60px); line-height: 1.02; max-width: 18ch; }
.article-hero .dek { font-size: 20px; line-height: 1.5; color: var(--mute); max-width: 60ch; }
.article-hero .meta {
  display: flex; gap: 24px; padding: 18px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--mute); flex-wrap: wrap;
}
.article-hero .meta b { color: var(--fg); font-weight: 500; }
.article-hero .thumb { aspect-ratio: 16/9; border-radius: 18px; }

.article-body {
  padding: 48px var(--pad) 80px; max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 240px 1fr 240px; gap: 40px;
}
.article-body .post-content {
  font-size: 18px; line-height: 1.7; color: var(--fg);
  display: flex; flex-direction: column; gap: 20px;
}
.article-body .post-content h2 { font-size: 26px; line-height: 1.2; margin-top: 12px; }
.article-body .post-content h3 { font-size: 22px; line-height: 1.2; margin-top: 8px; }
.article-body .post-content a { color: var(--accent-2); border-bottom: 1px solid var(--line-2); }
.article-body .post-content blockquote {
  font-size: 24px; line-height: 1.35; padding: 22px 24px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line-2); position: relative;
  margin: 8px 0; color: var(--fg);
}
.article-body .post-content blockquote::before {
  content: "“"; position: absolute; top: -10px; left: 18px;
  font-size: 64px; color: var(--accent); line-height: 1;
}
.article-body .post-content ul,
.article-body .post-content ol { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.article-body .post-content pre {
  font-family: 'JetBrains Mono', monospace; background: var(--bg-2);
  padding: 18px; border-radius: 12px; overflow: auto; font-size: 13px;
}
.article-body .post-content code { font-family: 'JetBrains Mono', monospace; font-size: 0.9em; background: var(--card); padding: 0 6px; border-radius: 4px; }
.article-body .post-content img { border-radius: 14px; }

.article-body .toc, .article-body .related {
  position: sticky; top: 24px; align-self: start; font-size: 13px; color: var(--mute);
  display: flex; flex-direction: column; gap: 18px;
}
.article-body h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-2);
  margin: 0 0 4px; font-family: 'JetBrains Mono', monospace;
}
.article-body .toc ol, .article-body .related ol {
  padding: 0; margin: 0; list-style: none;
  display: flex; flex-direction: column; gap: 12px;
}
.article-body .toc li, .article-body .related li {
  padding-left: 20px; position: relative; line-height: 1.35;
}
.article-body .toc li::before, .article-body .related li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 8px; height: 1px; background: var(--accent-2);
}
.article-body .related a { color: var(--fg); }
.article-body .related .mt { font-size: 11px; color: var(--mute); margin-top: 6px; display: block; }

.article-tags { padding: 0 var(--pad) 48px; max-width: var(--maxw); margin: 0 auto; display: flex; gap: 8px; flex-wrap: wrap; }
.article-tags a {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: 12px; color: var(--mute); font-family: 'JetBrains Mono', monospace;
}

/* ────────────────────────────────────────────────────────────
   Archive / category page
   ──────────────────────────────────────────────────────────── */
/* Одна колонка вместо двух: при 88px заголовок «3D-технологии» рвался
   пополам, а ряд фильтров прижимался к нему сбоку и висел в пустоте. */
.archive-hero {
  padding: 44px var(--pad) 26px; display: block;
  border-bottom: 1px solid var(--line);
  max-width: var(--maxw); margin-left: auto; margin-right: auto;
}
.archive-hero h1 {
  font-size: clamp(34px, 4.6vw, 62px); line-height: 1.02;
  letter-spacing: -0.03em; margin: 0; text-wrap: balance;
}
.archive-hero h1 .dim { color: var(--mute); }
.archive-hero .dek { font-size: 17px; line-height: 1.5; color: var(--mute); max-width: 56ch; }
.archive-hero .pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.archive-hero .pill-row a {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: 13px; color: var(--mute);
}
.archive-hero .pill-row a.on,
.archive-hero .pill-row a.current { background: var(--accent); color: #1a0612; border-color: transparent; font-weight: 600; }

.pagination { padding: 24px var(--pad) 56px; display: flex; gap: 8px; justify-content: center; }
.pagination a, .pagination span {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: 13px; color: var(--mute); font-family: 'JetBrains Mono', monospace;
}
.pagination .current { background: var(--accent); color: #1a0612; border-color: transparent; font-weight: 600; }

/* ── Archive / Category — сетка карточек ──
   Раньше здесь было display:flex/column, из-за чего span-4 не работал
   и каждая карточка растягивалась во всю ширину. ── */
.archive .grid, .category .grid {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px;
  padding: 22px var(--pad) 40px;
}
/* Селектор выше специфичнее базового .grid и перебил бы мобильные
   медиазапросы, поэтому дублируем их здесь. */
@media (max-width: 700px) {
  .archive .grid, .category .grid {
    grid-template-columns: 1fr; gap: 12px; padding: 12px var(--pad) 24px;
  }
}
/* ════════════════════════════════════════════════════════════
   Раздел / рубрика: карточки с обложками.
   До этого здесь стояли .thumb{display:none} и .dek{display:none},
   и раздел выглядел как голый список ссылок без картинок и описаний.
   ════════════════════════════════════════════════════════════ */
.archive-grid { align-items: stretch; }

.archive .card, .category .card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  gap: 0;
  overflow: hidden;
  flex-direction: column;
}
.archive .card .card__media, .category .card .card__media{ display: block; }
.archive .card .thumb, .category .card .thumb{
  display: block; border-radius: 0; aspect-ratio: 16/9;
}
/* Затемняющая шторка была нужна под подпись поверх картинки.
   Подпись переехала в тело карточки, шторка только пачкала обложку. */
.archive .card .thumb::after, .category .card .thumb::after{ display: none; }

.archive .card .body, .category .card .body{
  display: flex; flex-direction: column; gap: 9px;
  padding: 15px 17px 17px; flex: 1 1 auto;
}
.archive .card .tag, .category .card .tag{ margin: 0; }
.archive .card .tag a, .category .card .tag a{
  color: var(--cat-color, var(--accent-2));
  font-size: 10.5px; font-family: var(--mono);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
}
.archive .card h2, .category .card h2{
  font-size: 18px; font-weight: 700; line-height: 1.3; margin: 0;
}
.archive .card h2 a, .category .card h2 a{ color: var(--fg); }
.archive .card .dek, .category .card .dek{
  display: block; color: var(--mute); font-size: 13.5px; line-height: 1.55; margin: 0;
}
.archive .card .meta, .category .card .meta{
  font-size: 11.5px; margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--line); color: var(--mute);
}

/* Первый материал — во всю ширину, обложка слева */
.archive .card.feature, .category .card.feature{
  grid-column: span 12;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: stretch;
}
.archive .card.feature .thumb, .category .card.feature .thumb{
  aspect-ratio: 16/9; height: 100%; border-radius: 0; align-self: stretch;
}
.archive .card.feature .body, .category .card.feature .body{
  padding: 28px 32px; justify-content: center; gap: 13px;
}
.archive .card.feature h2, .category .card.feature h2{
  font-size: clamp(21px, 2.1vw, 30px); line-height: 1.16;
}
.archive .card.feature .dek, .category .card.feature .dek{ font-size: 14.5px; }
.archive .card.feature .meta, .category .card.feature .meta{ margin-top: 6px; }

@media (max-width: 900px) {
  .archive .card.feature, .category .card.feature{
    grid-template-columns: 1fr;
  }
  .archive .card.feature .body, .category .card.feature .body{ padding: 20px; }
}

/* Шапка раздела */
.archive-hero__main { display: flex; flex-direction: column; gap: 14px; }
.archive-hero__dek { color: var(--mute); font-size: 15px; line-height: 1.65; max-width: 68ch; }
.archive-hero__dek p { margin: 0 0 8px; }
.archive-hero__dek p:last-child { margin-bottom: 0; }

.aside-label { margin: 0 0 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); font-family: var(--mono); }
.related-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); font-family: var(--mono); margin: 0 0 12px; }
.footer-label { margin: 0 0 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--fg); }

/* ────────────────────────────────────────────────────────────
   Search
   ──────────────────────────────────────────────────────────── */
.search-form { display: flex; gap: 8px; max-width: 600px; }
.search-form input[type="search"] {
  flex: 1; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--fg); font: inherit; font-size: 14px;
}
.search-form input[type="search"]::placeholder { color: var(--mute); }
.search-form button { padding: 12px 20px; }

.search-head { padding: 56px var(--pad) 24px; }
.search-head h1 { font-size: clamp(36px, 4vw, 56px); margin-bottom: 18px; }
.search-head p { color: var(--mute); margin-bottom: 24px; font-size: 14px; }

/* ────────────────────────────────────────────────────────────
   404
   ──────────────────────────────────────────────────────────── */
.error-404 {
  padding: 96px var(--pad); text-align: center; display: flex;
  flex-direction: column; gap: 24px; align-items: center;
}
.error-404 .big {
  font-family: 'JetBrains Mono', monospace; font-size: clamp(80px, 14vw, 180px);
  line-height: 1; letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-404 h1 { font-size: 36px; }
.error-404 p { color: var(--mute); max-width: 50ch; font-size: 16px; line-height: 1.5; }

/* ────────────────────────────────────────────────────────────
   Comments
   ──────────────────────────────────────────────────────────── */
.comments-area {
  padding: 48px var(--pad); max-width: 900px; margin: 0 auto;
  border-top: 1px solid var(--line);
}
.comments-area h2 { font-size: 24px; margin-bottom: 24px; }
.comment-list { list-style: none; padding: 0; margin: 0 0 32px; display: flex; flex-direction: column; gap: 20px; }
.comment-body {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
}
.comment-meta { font-size: 12px; color: var(--mute); margin-bottom: 8px; }
.comment-meta .fn { color: var(--fg); font-weight: 500; font-style: normal; }
.comment-form { display: flex; flex-direction: column; gap: 12px; }
.comment-form input, .comment-form textarea {
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--fg); font: inherit; font-size: 14px;
}
.comment-form textarea { min-height: 120px; }

/* ────────────────────────────────────────────────────────────
   Footer
   ──────────────────────────────────────────────────────────── */
.site-footer {
  padding: 56px var(--pad) 32px; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1.4fr; gap: 32px;
  font-size: 13px; color: var(--mute);
}
.site-footer .col-brand p { margin-top: 16px; max-width: 44ch; line-height: 1.5; }
.site-footer h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-2);
  margin: 0 0 12px; font-family: 'JetBrains Mono', monospace;
}
.site-footer ul { padding: 0; margin: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.site-footer ul li { transition: color .2s ease; }
.site-footer ul a { transition: color .2s ease; display: inline-block; }
.site-footer ul li:hover,
.site-footer ul a:hover { color: var(--accent); }
.site-footer .newsletter {
  background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.site-footer .newsletter b { color: var(--fg); font-size: 14px; }
.site-footer .newsletter .row { display: flex; gap: 8px; }
.site-footer .newsletter input {
  flex: 1; padding: 9px 12px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--fg); font: inherit; font-size: 12px;
}
.site-bottom {
  border-top: 1px solid var(--line); padding: 16px var(--pad);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--mute);
}

/* ────────────────────────────────────────────────────────────
   WP utility classes (alignments, captions)
   ──────────────────────────────────────────────────────────── */
/* Hover-glow utilities for inline elements (footer links, archive pills) */
.site-footer ul a,
.archive-hero .pill-row a,
.article-tags a {
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.site-footer ul a:hover { color: var(--accent); }
.archive-hero .pill-row a:hover {
  color: var(--fg); border-color: var(--accent);
  background: var(--card-hi);
}
.article-tags a:hover {
  color: var(--fg); border-color: var(--accent-2);
  background: var(--card-hi);
}
.alignright { float: right; margin: 0 0 16px 24px; }
.aligncenter { display: block; margin: 16px auto; }
.alignwide  { margin-left: calc(-1 * var(--pad)); margin-right: calc(-1 * var(--pad)); max-width: none; }
.alignfull  { margin-left: calc(-1 * var(--pad)); margin-right: calc(-1 * var(--pad)); width: calc(100% + var(--pad) * 2); }
.wp-caption-text { font-size: 12px; color: var(--mute); margin-top: 6px; text-align: center; }
.sticky .card { border-color: var(--accent); }

/* ────────────────────────────────────────────────────────────
   Таблицы в статьях — горизонтальный скролл
   ──────────────────────────────────────────────────────────── */
.post-content table {
  display: block; width: 100%; overflow-x: auto;
  -webkit-overflow-scrolling: touch; border-collapse: collapse; margin: 16px 0;
}
.post-content table th,
.post-content table td {
  padding: 10px 14px; border: 1px solid var(--line-2);
  font-size: 14px; text-align: left; white-space: nowrap;
}
.post-content table th { background: var(--card-hi); font-weight: 600; color: var(--fg); }
.post-content table tr:hover td { background: var(--card); }

/* ────────────────────────────────────────────────────────────
   Responsive
   ──────────────────────────────────────────────────────────── */

/* Планшет вертикальный — 1100px */
@media (max-width: 1100px) {
  :root { --pad: 24px; }
  .hero { grid-template-columns: 1fr; }
  .hero-text, .hero-figure { min-height: auto; }
  .hero-figure .thumb { min-height: 0; aspect-ratio: 16/9; }
  .article-hero { padding: 40px var(--pad) 20px; }
  .article-body { grid-template-columns: 1fr; padding: 36px var(--pad) 56px; }
  .article-body .toc, .article-body .related { position: static; }
  .article-body .post-content { font-size: 16px; }
  .site-footer { grid-template-columns: 1fr 1fr; }
  .archive-hero { grid-template-columns: 1fr; }
  .card.feature { grid-column: span 12; grid-template-columns: 1fr; }
  .card.feature .thumb { aspect-ratio: 16/9; border-radius: 18px 18px 0 0; min-height: 0; }
  .most-read { grid-column: span 12; }
  .span-8, .span-7, .span-5, .span-4, .span-3 { grid-column: span 6; }
}

/* Планшет горизонтальный — 900px */
@media (max-width: 900px) {
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-head h2 { font-size: 24px; }
  .hero-text .dek { font-size: 15px; }
  .article-hero .dek { font-size: 17px; }
  .archive-hero h1 { font-size: clamp(40px, 6vw, 72px); }
  /* Feature + most-read stack vertically */
  .card.feature { grid-column: span 12; grid-template-columns: 1fr; }
  .card.feature .thumb { aspect-ratio: 16/9; border-radius: 18px 18px 0 0; min-height: 0; }
  .most-read { grid-column: span 12; }
  .span-8, .span-7, .span-5 { grid-column: span 6; }
}

/* ────────────────────────────────────────────────────────────
   Защита от горизонтального скролла.
   textarea формы комментариев имеет собственную ширину в cols
   и на 375px вылезала за вьюпорт на 77px, утаскивая всю страницу.
   ──────────────────────────────────────────────────────────── */
textarea, input, select, button { max-width: 100%; box-sizing: border-box; }
.comment-form textarea,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"] { width: 100%; box-sizing: border-box; }
img, video, iframe, embed, object, pre, table { max-width: 100%; }
pre { overflow-x: auto; }

/* ────────────────────────────────────────────────────────────
   Хлебные крошки
   ──────────────────────────────────────────────────────────── */
.web3d-crumbs { max-width: var(--maxw); margin: 0 auto; padding: 14px var(--pad) 0; font-size: 12px; }
.web3d-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.web3d-crumbs li { color: var(--mute); display: flex; align-items: center; gap: 6px; }
.web3d-crumbs li + li::before { content: "/"; color: var(--line-2); }
.web3d-crumbs a { color: var(--mute); }
.web3d-crumbs a:hover { color: var(--fg); text-decoration: underline; }
.web3d-crumbs li[aria-current] { color: var(--fg); }
.article-hero .web3d-crumbs { padding-left: 0; padding-right: 0; }
@media (max-width: 700px) {
  .web3d-crumbs { font-size: 11px; padding-top: 10px; }
  /* На узком экране длинный заголовок статьи в крошках только мешает */
  .web3d-crumbs li[aria-current] { display: none; }
  .web3d-crumbs li:nth-last-child(2)::after { content: ""; }
}

/* ───────────────────────────────────────────────────────────────
   Шапка: мобильный режим с 992px, а не с 700px.
   Десктопное меню перестаёт помещаться уже около 900px, поэтому
   диапазон 701-992 раньше оставался непокрытым и рвал вьюпорт.
   Сетка и hero переключаются отдельно, ниже, на 700px.
   ─────────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .top { grid-template-areas: "logo buttons"; grid-template-columns: auto 1fr; column-gap: 12px; padding: 0 var(--pad); }
  .logo-link { padding: 12px 0; }
  .logoSwap.is-lg svg, .logoSwap.is-lg img,
  .logoSwap.is-sm svg, .logoSwap.is-sm img { height: 36px; }
  .top-right { justify-self: end; padding: 10px 0; }
  .main-nav { display: none; }
  body.menu-open .main-nav {
    display: flex; flex-direction: column; gap: 4px;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 16px var(--pad);
    z-index: 100;
  }
  body.menu-open .main-nav ul { flex-direction: column; gap: 4px; align-items: stretch; }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; padding: 8px 12px; border-radius: 999px;
    background: var(--card); border: 1px solid var(--line); color: var(--fg);
  }
  .search-trigger { display: none; }
  .top-right .btn-ghost { display: none; }
  /* Тач-зона не меньше 44px (WCAG 2.5.5), раньше кнопка сжималась до ~22px */
  .theme-toggle { min-height: 44px; display: inline-flex; align-items: center; }
  .theme-toggle span { padding: 10px 12px; font-size: 11px; }
  .top-right .btn { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Мобильный — 700px */
@media (max-width: 700px) {
  :root { --pad: 16px; }

  /* Grid */
  .grid { grid-template-columns: 1fr; gap: 12px; padding: 12px var(--pad) 24px; }
  .span-8, .span-7, .span-5, .span-4, .span-3 { grid-column: span 1; }

  /* Hero */
  .hero { padding: 16px var(--pad) 12px; gap: 14px; }
  .hero-text { padding: 20px; gap: 14px; }
  .hero-text h1 { font-size: 28px; }
  .hero-text .dek { font-size: 14px; }
  .hero-text .actions { flex-wrap: wrap; }

  /* Section head */
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px var(--pad) 4px; }
  .section-head h2 { font-size: 20px; }

  /* Article */
  .article-hero { padding: 24px var(--pad) 14px; gap: 14px; }
  .article-hero h1 { font-size: 26px; }
  .article-hero .dek { font-size: 15px; }
  .article-body { padding: 20px var(--pad) 36px; }
  .article-body .post-content { font-size: 15px; line-height: 1.65; gap: 16px; }
  .article-body .post-content h2 { font-size: 20px; }
  .article-body .post-content h3 { font-size: 17px; }

  /* Cards */
  .card h3, .card h2 { font-size: 16px; }
  .card.feature .body { padding: 18px; }
  .card.feature h3 { font-size: 20px; }

  /* Archive */
  .archive-hero { padding: 28px var(--pad) 18px; }
  .archive-hero h1 { font-size: clamp(30px, 9vw, 52px); }

  /* Footer */
  .site-footer { grid-template-columns: 1fr; }
  .site-bottom { flex-direction: column; gap: 6px; text-align: center; }

  /* Live ticker */
  .live .head { padding: 10px 14px; }
  .live .track { padding: 10px 14px; gap: 20px; font-size: 11px; }

  /* Comments */
  .comments-area { padding: 28px var(--pad); }

  /* Archive mobile tweaks */
  .archive-hero { padding: 28px var(--pad) 18px; }
  .archive .card h2, .category .card h2 { font-size: 17px !important; }
  .archive .card .meta, .category .card .meta { font-size: 11px; }
  .archive .card, .category .card { padding: 16px 0; }
}

/* Малые телефоны — 420px */
@media (max-width: 420px) {
  :root { --pad: 14px; }
  body { font-size: 13px; }
  .hero-text h1 { font-size: 22px; }
  .article-hero h1 { font-size: 22px; }
  .article-body .post-content h2 { font-size: 18px; }
  .article-body .post-content h3 { font-size: 15px; }
  .article-body .post-content { font-size: 14px; }
  .theme-toggle { display: none; }
  .top-right { gap: 8px; }
  .btn { padding: 8px 12px; font-size: 12px; }
  .section-head h2 { font-size: 18px; }
  .card h3, .card h2 { font-size: 15px; }
  .most-read .ti { font-size: 13px; }
  .live .head { display: none; }
}

/* ════════════════════════════════════════════════════════════
   Адаптив сетки раздела.
   Правила .archive .grid специфичнее базового .grid, поэтому
   мобильные медиазапросы для них дублируются здесь, в конце
   файла: так порядок каскада гарантирован.
   Отдельно гасим span-12 у первой карточки: в одноколоночной
   сетке он создавал 11 неявных колонок, и карточки сжимались
   до нескольких пикселей.
   ════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .archive .grid, .category .grid {
    grid-template-columns: 1fr; gap: 12px; padding: 12px var(--pad) 24px;
  }
  .archive .card.feature, .category .card.feature,
  .archive .card.span-4, .category .card.span-4 { grid-column: span 1; }
  .archive .card.feature, .category .card.feature { grid-template-columns: 1fr; }
  .archive .card.feature .body, .category .card.feature .body { padding: 18px; }
  .archive .card.feature h2, .category .card.feature h2 { font-size: 20px; }
}
