/* ============================================================
   Zerofold · custom.css
   Подключается после встроенных стилей страницы:
   <link rel="stylesheet" href="custom.css">
   Файл переопределяет и дополняет встроенный <style>.
   ============================================================ */

/* ---------- 1. Переменные (совместимы с index.html) ---------- */
:root {
  --brand:      #2563EB;
  --brand-dark: #1D4ED8;
  --cta:        #FF6B00;
  --text:       #0F172A;
  --muted:      #64748B;
  --bg:         #F1F5F9;
  --card:       #FFFFFF;
  --border:     #E2E8F0;
  --radius:     16px;
  --shadow-sm:  0 2px 12px rgba(15, 23, 42, .04);
  --shadow-lg:  0 20px 45px rgba(37, 99, 235, .15);
}

[data-theme="dark"] {
  --text:   #E2E8F0;
  --muted:  #94A3B8;
  --bg:     #0B1220;
  --card:   #141C2E;
  --border: #233047;
}

/* ---------- 2. База ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .35s, color .35s;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { text-decoration: none; color: inherit; }

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

::selection {
  background: rgba(37, 99, 235, .2);
  color: var(--text);
}

/* Видимый фокус для клавиатуры — требование доступности */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 3. Переливающийся заголовок ---------- */
.hero h1 span,
.zf-gradient-text {
  background-image: linear-gradient(
    90deg,
    #2563EB, #06B6D4, #8B5CF6, #FF6B00, #2563EB
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: inline-block;
  animation: zfShimmer 7s linear infinite;
  will-change: background-position;
}

/* Мягкий вариант (без оранжевого) */
.zf-gradient-text--cool {
  background-image: linear-gradient(90deg, #2563EB, #06B6D4, #8B5CF6, #2563EB);
}

[data-theme="dark"] .hero h1 span,
[data-theme="dark"] .zf-gradient-text {
  background-image: linear-gradient(
    90deg,
    #4F8CFF, #22D3EE, #A78BFA, #FF8A33, #4F8CFF
  );
}

@keyframes zfShimmer {
  0%   { background-position:   0% 50%; }
  100% { background-position: 300% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .hero h1 span,
  .zf-gradient-text {
    animation: none;
    background-position: 0% 50%;
  }
}

/* ---------- 4. Шапка ---------- */
header.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  backdrop-filter: saturate(180%) blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.logo b { color: var(--brand); }
.logo span { color: var(--cta); }

nav.main-nav { display: flex; gap: 6px; align-items: center; }

nav.main-nav a {
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 15px;
  color: var(--muted);
  transition: background .25s, color .25s;
}

nav.main-nav a:hover { background: var(--bg); color: var(--text); }

nav.main-nav a.active {
  color: var(--brand);
  background: rgba(37, 99, 235, .1);
  font-weight: 600;
}

.theme-toggle {
  background: var(--card);
  border: 1.5px solid var(--border);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 17px;
  color: var(--text);
  transition: border-color .25s, transform .25s;
}

.theme-toggle:hover { border-color: var(--cta); transform: rotate(15deg); }

/* ---------- 5. Hero ---------- */
.hero { padding: 70px 0 50px; text-align: center; }

.hero h1 {
  font-size: 48px;
  line-height: 1.15;
  margin-bottom: 18px;
  letter-spacing: -.02em;
}

.hero p {
  color: var(--muted);
  font-size: 19px;
  max-width: 660px;
  margin: 0 auto 28px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 14px 30px;
  border-radius: 12px;
  font-weight: 700;
  display: inline-block;
  transition: background .25s, transform .25s, box-shadow .25s;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(37, 99, 235, .3);
}

.btn-orange { background: var(--cta); color: #fff; }
.btn-orange:hover {
  background: #FF8A33;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(255, 107, 0, .3);
}

/* ---------- 6. Категории: пять плиток в ряд ---------- */
.cats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 40px;
}

.cat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform .28s, border-color .28s, box-shadow .28s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 104px;
}

.cat-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: var(--shadow-lg);
}

.cat-card .ic { font-size: 26px; line-height: 1; margin-bottom: 8px; }
.cat-card h3 { font-size: 14px; font-weight: 600; line-height: 1.3; }
.cat-card span { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 7. Заголовок раздела ---------- */
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.sec-head h2 { font-size: 26px; letter-spacing: -.01em; }

.sec-head a {
  color: var(--brand);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  transition: opacity .2s;
}

.sec-head a:hover { opacity: .75; }

/* ---------- 8. Лента новостей ---------- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 30px;
  min-height: 120px;
}

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

.news-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand);
}

.news-card .thumb {
  height: 170px;
  background: linear-gradient(135deg, var(--brand), var(--cta));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: #fff;
}

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

.news-card .cat {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--cta);
  margin-bottom: 8px;
}

.news-card h3 {
  font-size: 18px;
  line-height: 1.35;
  margin-bottom: 10px;
}

.news-card p {
  font-size: 14px;
  color: var(--muted);
  flex: 1;
  margin-bottom: 14px;
}

.news-card .meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.news-card .src { color: var(--brand); font-weight: 600; }

/* Скелетон загрузки */
.zf-skel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 330px;
  animation: zfPulse 1.4s ease-in-out infinite;
}

@keyframes zfPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .5; }
}

/* Кнопка «Показать ещё» */
#loadMore {
  display: block;
  margin: 0 auto 50px;
  padding: 13px 34px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: border-color .25s, color .25s, transform .25s;
}

#loadMore:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-2px);
}

/* Сообщение «новостей нет» */
.zf-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- 9. Подписка ---------- */
.subscribe {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border-radius: 20px;
  padding: 46px;
  text-align: center;
  color: #fff;
  margin-bottom: 60px;
}

.subscribe h2 { font-size: 28px; margin-bottom: 12px; }
.subscribe p { opacity: .9; margin-bottom: 24px; }

.subscribe form {
  display: flex;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.subscribe input {
  flex: 1;
  min-width: 220px;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
}

.subscribe button {
  padding: 14px 30px;
  background: var(--cta);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .25s, transform .25s;
}

.subscribe button:hover { background: #FF8A33; transform: translateY(-2px); }

.sub-msg {
  margin-top: 14px;
  font-size: 14px;
  opacity: 0;
  transition: opacity .3s;
  min-height: 20px;
}

.sub-msg.show { opacity: 1; }

/* ---------- 10. Подвал ---------- */
footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 30px;
}

.foot-grid h4 { margin-bottom: 12px; font-size: 15px; }
.foot-grid a { color: var(--muted); font-size: 14px; transition: color .2s; }
.foot-grid a:hover { color: var(--brand); }

.foot-links { display: flex; flex-direction: column; gap: 8px; }

.copyright {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 11. Адаптив ---------- */
@media (max-width: 960px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); }
  .cats      { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}

@media (max-width: 768px) {
  .header-inner {
    height: auto;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0;
  }

  nav.main-nav { flex-wrap: wrap; justify-content: center; gap: 4px; }
  nav.main-nav a { padding: 7px 12px; font-size: 14px; }

  .hero { padding: 44px 0 36px; }
  .hero h1 { font-size: 30px; }
  .hero p  { font-size: 16px; }

  .news-grid { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; }
  .subscribe { padding: 30px 20px; }
  .sec-head h2 { font-size: 21px; }
}

@media (max-width: 560px) {
  .cats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cat-card { min-height: 92px; padding: 14px 8px; }
  .cat-card .ic { font-size: 22px; margin-bottom: 6px; }
  .cat-card h3 { font-size: 13px; }
  .cat-card span { display: none; }
}

/* ---------- 12. Печать ---------- */
@media print {
  header.site-header, footer, .subscribe, #loadMore, .theme-toggle { display: none; }
  body { background: #fff; color: #000; }
}