/* ============================================================
   Демо-портал — стилі (тестовий стенд)
   ============================================================ */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #17212e;
  --muted: #5c6875;
  --border: #e5e9ef;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff4ff;
  --dark: #0f1a2b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px -8px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Шапка ---------- */

.site-header {
  background: var(--dark);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(4, 10, 20, .25);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .2px;
}

.brand-mark { width: 28px; height: 28px; color: var(--accent); flex: none; }

.site-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}

.nav-link {
  color: rgba(255, 255, 255, .78);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .93rem;
  transition: color .15s, background .15s;
}

.nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-link.is-active { color: #fff; background: rgba(37, 99, 235, .35); }

.header-note {
  color: rgba(255, 255, 255, .75);
  font-size: .8rem;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

.header-note:hover { color: #fff; border-color: rgba(255, 255, 255, .5); }

/* ---------- Hero ---------- */

.hero {
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(37, 99, 235, .35), transparent 60%),
    linear-gradient(160deg, var(--dark) 20%, #16273f 100%);
  color: #fff;
  padding: 84px 0 72px;
}

.hero-kicker {
  display: inline-block;
  background: rgba(37, 99, 235, .28);
  border: 1px solid rgba(96, 141, 255, .5);
  color: #c8d9ff;
  font-size: .8rem;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.2;
  max-width: 720px;
}

.hero p {
  margin: 0 0 26px;
  color: rgba(255, 255, 255, .82);
  max-width: 560px;
  font-size: 1.05rem;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }

.btn-ghost { border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn-ghost:hover { border-color: rgba(255, 255, 255, .7); color: #fff; }

/* ---------- Статистика ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: -40px auto 0;
  position: relative;
  z-index: 2;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--muted); font-size: .9rem; }

/* ---------- Секції ---------- */

.section { padding: 56px 0 8px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-head h2 { margin: 0; font-size: 1.5rem; }

.section-more { font-weight: 600; white-space: nowrap; }

/* ---------- Сітки карток ---------- */

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.grid-3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}

.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px -10px rgba(16, 24, 40, .25); }

.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; }

.card-cover {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: #dbe4f3;
}

.card-cover--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  color: rgba(255, 255, 255, .9);
  font-size: 2rem;
  font-weight: 700;
}

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.card-date { color: var(--muted); font-size: .82rem; }

.card-title { margin: 0; font-size: 1.02rem; line-height: 1.4; }

.card-title a { color: inherit; }
.card-title a:hover { color: var(--accent); }

.card-text { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }

.card-more { font-weight: 600; font-size: .9rem; white-space: nowrap; }

/* ---------- Мітки ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }

.chip {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid #d6e2ff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .82rem;
}

.chip:hover { background: #dce8ff; }
.chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Сторінка матеріалу ---------- */

.page-head { padding: 40px 0 0; }

.page-head h1 { margin: 0 0 8px; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.25; }

.page-meta { color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.article-layout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 26px 0 40px;
  overflow: hidden;
}

.article-cover { width: 100%; max-height: 420px; object-fit: cover; }
.article-cover--ph {
  aspect-ratio: 21 / 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  color: rgba(255, 255, 255, .9);
  font-size: 3rem;
  font-weight: 700;
}

.article-body {
  padding: 28px clamp(18px, 5vw, 44px) 36px;
  max-width: 820px;
  margin: 0 auto;
}

.article-body > :first-child { margin-top: 0; }

/* ---------- Типографіка контенту ---------- */

.article-body h2 { margin: 30px 0 10px; font-size: 1.35rem; }
.article-body h3 { margin: 26px 0 8px; font-size: 1.15rem; }
.article-body p { margin: 12px 0; }
.article-body ul, .article-body ol { margin: 12px 0; padding-left: 24px; }
.article-body li { margin: 6px 0; }
.article-body blockquote {
  margin: 18px 0;
  padding: 10px 18px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  color: #27406e;
}
.article-body blockquote p { margin: 0; }
.article-body pre {
  background: var(--dark);
  color: #dbe7ff;
  padding: 14px 18px;
  border-radius: 10px;
  overflow-x: auto;
}

/* ---------- Список посилань внизу ---------- */

.related {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 40px;
}

.related h3 { margin: 0 0 12px; font-size: 1.05rem; }

.related ul { margin: 0; padding: 0; list-style: none; }

.related li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.related li:last-child { border-bottom: 0; }
.related a { font-weight: 500; }

/* ---------- Освітній блок ---------- */

.promo {
  background: linear-gradient(135deg, #10233d, #1c3d6e);
  color: #fff;
  border-radius: var(--radius);
  padding: 34px clamp(20px, 5vw, 44px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 56px 0 8px;
}

.promo h2 { margin: 0 0 8px; font-size: 1.4rem; }
.promo p { margin: 0; color: rgba(255, 255, 255, .82); max-width: 520px; }

/* ---------- Пагінація ---------- */

.pagination {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 30px 0 10px;
  flex-wrap: wrap;
}

.page-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: .45; cursor: default; }

/* ---------- Стани ---------- */

.state {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.state--error { color: #b3261e; border-color: #f3c1bd; background: #fdf3f2; }

/* ---------- Хлібні крихти / назад ---------- */

.backlink { display: inline-block; margin: 18px 0 0; font-weight: 600; }

/* ---------- Підвал ---------- */

.site-footer { background: var(--dark); color: rgba(255, 255, 255, .8); margin-top: 64px; }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.3fr;
  gap: 32px;
  padding: 44px 20px 32px;
}

.footer-brand { font-weight: 700; color: #fff; margin-bottom: 10px; font-size: 1.05rem; }
.footer-text { margin: 0; font-size: .9rem; max-width: 380px; }
.footer-title { color: #fff; font-weight: 600; margin-bottom: 12px; font-size: .95rem; }
.footer-links { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.footer-links li { margin: 6px 0; }
.footer-links a { color: rgba(255, 255, 255, .8); }
.footer-links a:hover { color: #fff; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 18px 20px 26px;
  font-size: .82rem;
  color: rgba(255, 255, 255, .55);
}

/* ---------- Адаптив ---------- */

@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; padding: 10px 0; gap: 10px; }
  .site-nav { margin-left: 0; order: 3; width: 100%; }
  .header-note { margin-left: auto; }
  .stats { margin-top: -24px; }
  .hero { padding: 56px 0 56px; }
}

@media (max-width: 480px) {
  .nav-link { padding: 6px 8px; font-size: .85rem; }
  .grid { grid-template-columns: 1fr; }
}
