/* ==========================================================================
   Пульс — базовые стили. Mobile-first, светлая и тёмная темы.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #14161a;
  --text-muted: #5f6874;
  --border: #e3e6ea;
  --accent: #d92b3a;
  --accent-soft: rgba(217, 43, 58, .1);
  --accent-text: #ffffff;
  --shadow: 0 1px 2px rgba(16, 20, 28, .06), 0 8px 24px rgba(16, 20, 28, .06);
  --shadow-lg: 0 2px 6px rgba(16, 20, 28, .08), 0 20px 48px rgba(16, 20, 28, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 1220px;
  --header-h: 62px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Georgia", "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --bg-soft: #14171d;
    --surface: #171a21;
    --surface-2: #1e222b;
    --text: #e9ecf1;
    --text-muted: #98a1af;
    --border: #262b35;
    --accent: #ff5a67;
    --accent-soft: rgba(255, 90, 103, .14);
    --accent-text: #17090b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .5), 0 20px 48px rgba(0, 0, 0, .45);
  }
}

:root[data-theme="light"] {
  --bg: #ffffff; --bg-soft: #f5f6f8; --surface: #ffffff; --surface-2: #f0f2f5;
  --text: #14161a; --text-muted: #5f6874; --border: #e3e6ea;
  --accent: #d92b3a; --accent-soft: rgba(217,43,58,.1); --accent-text: #ffffff;
  --shadow: 0 1px 2px rgba(16,20,28,.06), 0 8px 24px rgba(16,20,28,.06);
  --shadow-lg: 0 2px 6px rgba(16,20,28,.08), 0 20px 48px rgba(16,20,28,.12);
}

:root[data-theme="dark"] {
  --bg: #0f1115; --bg-soft: #14171d; --surface: #171a21; --surface-2: #1e222b;
  --text: #e9ecf1; --text-muted: #98a1af; --border: #262b35;
  --accent: #ff5a67; --accent-soft: rgba(255,90,103,.14); --accent-text: #17090b;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 20px 48px rgba(0,0,0,.45);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 750; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
button { font: inherit; cursor: pointer; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-text); padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; gap: 14px;
  min-height: var(--header-h);
}

.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; letter-spacing: -.03em; }
.brand-mark {
  width: 11px; height: 11px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 4px var(--accent-soft); } 50% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .brand-mark { animation: none; } }

.burger {
  margin-left: auto; display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; padding: 0 9px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.burger span { display: block; height: 2px; background: currentColor; border-radius: 2px; transition: transform .2s, opacity .2s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.site-nav {
  display: none; order: 3; width: 100%;
  flex-direction: column; gap: 2px; padding: 8px 0 14px;
  border-top: 1px solid var(--border);
}
.site-nav.is-open { display: flex; }
.site-nav a { padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; font-size: 15px; }
.site-nav a:hover, .site-nav a.is-active { color: var(--text); background: var(--surface-2); }

.header-tools { order: 4; display: flex; gap: 8px; width: 100%; padding-bottom: 12px; }

.search { display: flex; flex: 1; min-width: 0; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 15px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 40px; border: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2); color: var(--text);
}
.search--big { max-width: 560px; margin-top: 14px; }
.search--big input { height: 48px; font-size: 16px; }
.search--big button { width: auto; padding: 0 20px; font-weight: 650; background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
/* в светлой теме показываем луну (переключить на тёмную), в тёмной — солнце */
.theme-toggle .i-moon { display: block; }
.theme-toggle .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  .theme-toggle .i-moon { display: none; }
  .theme-toggle .i-sun { display: block; }
}
:root[data-theme="light"] .theme-toggle .i-moon { display: block; }
:root[data-theme="light"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }

/* бегущая строка трендов */
.ticker { border-top: 1px solid var(--border); background: var(--bg-soft); overflow: hidden; }
.ticker-inner { display: flex; align-items: center; gap: 12px; height: 40px; }
.ticker-label {
  flex: none; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent);
}
.ticker-items { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.ticker-items::-webkit-scrollbar { display: none; }
.ticker-items a {
  flex: none; font-size: 13px; color: var(--text-muted); white-space: nowrap;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.ticker-items a:hover { color: var(--text); border-color: var(--accent); }

/* ------------------------------------------------------------------ layout */

.layout { display: grid; gap: 28px; padding-block: 26px 48px; grid-template-columns: minmax(0, 1fr); }
.layout-main { min-width: 0; }

.page-head { padding-block: 28px 6px; }
.page-head h1 { font-size: clamp(26px, 5vw, 38px); }
.page-head p { color: var(--text-muted); margin-top: 8px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 20px; }
.section-head h2::before {
  content: ""; display: inline-block; width: 4px; height: 17px; margin-right: 9px;
  background: var(--accent); border-radius: 2px; transform: translateY(2px);
}
.section-link { font-size: 13px; font-weight: 650; color: var(--text-muted); }
.section-link:hover { color: var(--accent); }

/* ------------------------------------------------------------------- hero */

.hero { padding-top: 24px; }
.hero-card {
  display: grid; gap: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.hero-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.hero-media { aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-body { padding: 20px; }
.hero-title { font-size: clamp(23px, 5.2vw, 40px); margin: 10px 0 12px; }
.hero-lead { color: var(--text-muted); font-size: 16px; margin-bottom: 14px; }
.hero-more { font-weight: 700; color: var(--accent); font-size: 15px; }

/* ------------------------------------------------------------------- cards */

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card-link { display: flex; flex-direction: column; flex: 1; }
.card-media { aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card-media--empty {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--surface-2), color-mix(in srgb, var(--accent) 12%, var(--surface-2)));
}
.card-media--empty span {
  font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 70%, var(--text-muted));
}
.card:hover .card-media img { transform: scale(1.04); }
.card-body { padding: 15px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 17px; line-height: 1.32; }
.card--sm .card-title { font-size: 15.5px; }
.card-lead { color: var(--text-muted); font-size: 14px; margin: 0; }
.card-sources { padding: 0 16px 13px; font-size: 12px; color: var(--text-muted); }

.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.card-meta time { white-space: nowrap; }
.dot { opacity: .5; }

.chip {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.chip--accent { background: var(--accent-soft); color: var(--accent); }

/* ----------------------------------------------------------------- article */

.crumbs { display: flex; flex-wrap: wrap; gap: 7px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.crumbs a:hover { color: var(--accent); }
.crumbs-current { color: var(--text); }

.article { max-width: 760px; }
.article-head { margin-bottom: 20px; }
.article-title { font-size: clamp(26px, 5.4vw, 42px); margin: 12px 0 14px; }
.article-lead { font-size: 18px; color: var(--text-muted); font-weight: 500; margin: 0; }

.article-figure { margin: 0 0 24px; }
.article-figure img { width: 100%; border-radius: var(--radius); background: var(--surface-2); }
.article-figure figcaption { margin-top: 8px; font-size: 12.5px; color: var(--text-muted); }

.article-body { font-family: var(--font-serif); font-size: 18.5px; line-height: 1.72; }
.article-body p { margin: 0 0 1.15em; }
.article-body h2 {
  font-family: var(--font-sans); font-size: 23px; margin: 1.7em 0 .6em;
  padding-top: .5em; border-top: 1px solid var(--border);
}
.article-body h3 { font-family: var(--font-sans); font-size: 19px; margin: 1.4em 0 .5em; }
.article-body ul { margin: 0 0 1.15em; padding-left: 1.3em; }
.article-body li { margin-bottom: .45em; }
.article-body blockquote {
  margin: 1.4em 0; padding: 4px 0 4px 18px;
  border-left: 3px solid var(--accent); color: var(--text-muted); font-style: italic;
}
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* блок «Обновлено» — свежесть материала */
.update-block {
  margin: 26px 0; padding: 16px 18px;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.update-block p:last-child { margin-bottom: 0; }
.update-stamp {
  display: block; margin-bottom: 8px; font-family: var(--font-sans);
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent);
}
.updated-mark { color: var(--accent); font-weight: 650; }

/* частые вопросы — источник расширенного сниппета в выдаче */
.faq { margin: 34px 0; }
.faq h2 { font-size: 21px; margin-bottom: 14px; }
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); margin-bottom: 9px; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; padding: 13px 16px; font-weight: 650; font-size: 15.5px;
  list-style: none; display: flex; justify-content: space-between; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--accent); font-size: 20px; line-height: 1; flex: none; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin: 0; padding: 0 16px 14px; color: var(--text-muted); font-size: 15px; }

.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0; }
.article-tags a {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; color: var(--text-muted);
}
.article-tags a:hover { border-color: var(--accent); color: var(--accent); }

.share {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text-muted);
}
.share a, .share button {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 600;
}
.share a:hover, .share button:hover { border-color: var(--accent); color: var(--accent); }

.sources { margin: 30px 0; padding: 20px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.sources h2 { font-size: 18px; margin-bottom: 4px; }
.sources-note { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.sources ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.sources li { display: flex; flex-direction: column; gap: 2px; }
.sources li a { font-weight: 600; font-size: 15px; }
.sources li a:hover { color: var(--accent); }
.sources-name { font-size: 12.5px; color: var(--text-muted); }

.related { margin-top: 36px; }

/* ----------------------------------------------------------------- sidebar */

.sidebar { display: grid; gap: 18px; align-content: start; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.widget-title { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 14px; }
.widget--accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.widget--accent p { font-size: 14px; color: var(--text-muted); }

.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; counter-reset: rank; }
.rank a { display: flex; gap: 11px; align-items: flex-start; font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.rank a:hover { color: var(--accent); }
.rank-num { flex: none; width: 22px; font-size: 17px; font-weight: 800; color: var(--accent); opacity: .75; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud a {
  font-size: 13px; padding: 4px 11px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
}
.tag-cloud a:hover { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------------ misc */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 650; font-size: 14.5px; transition: .16s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--primary:hover { color: var(--accent-text); filter: brightness(1.07); }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 32px; flex-wrap: wrap; }
.pager-info { font-size: 13.5px; color: var(--text-muted); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty h3 { font-size: 20px; color: var(--text); margin-bottom: 8px; }
.empty a { color: var(--accent); text-decoration: underline; }
.empty--page { padding-block: 90px; }
.empty--page h1 { font-size: 72px; color: var(--accent); line-height: 1; }
.empty--page h2 { font-size: 24px; color: var(--text); margin: 10px 0; }

.prose { max-width: 760px; padding-bottom: 56px; }
.prose h2 { font-size: 21px; margin: 30px 0 10px; }
.prose p { color: var(--text-muted); }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 22px 0 34px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.stat strong { font-size: 22px; }
.stat span { font-size: 13px; color: var(--text-muted); }

/* ------------------------------------------------------------------ footer */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); margin-top: 30px; }
.footer-inner { display: grid; gap: 24px; padding-block: 34px; }
.footer-brand strong { font-size: 18px; }
.footer-brand p { color: var(--text-muted); font-size: 14px; margin: 6px 0 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.footer-nav a { font-size: 14px; color: var(--text-muted); }
.footer-nav a:hover { color: var(--accent); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between;
  padding-block: 16px 26px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-muted);
}

/* ------------------------------------------------------------- breakpoints */

@media (min-width: 700px) {
  .hero-card { grid-template-columns: 1.25fr 1fr; align-items: stretch; }
  .hero-media { aspect-ratio: auto; height: 100%; min-height: 300px; }
  .hero-body { padding: 30px; display: flex; flex-direction: column; justify-content: center; }
  .footer-inner { grid-template-columns: 2fr 1fr 1fr; }
  .footer-nav { flex-direction: column; gap: 9px; }
}

@media (min-width: 960px) {
  :root { --header-h: 68px; }
  .burger { display: none; }
  .site-nav {
    display: flex; flex-direction: row; order: 2; width: auto; flex: 1;
    padding: 0; border: 0; gap: 2px; overflow-x: auto; scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { padding: 7px 11px; white-space: nowrap; }
  .header-tools { order: 3; width: auto; padding: 0; margin-left: auto; }
  .search { width: 230px; flex: none; }
  .layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 34px; }
  .layout--article { align-items: start; }
  .article-body { font-size: 19px; }
}

@media (min-width: 1140px) {
  .search { width: 270px; }
}
