/* === Кайдо — спокойный дневной дизайн === */

:root {
  --bg: #faf6f0;
  --bg-alt: #f2ecdf;
  --surface: #ffffff;
  --text: #33302b;
  --muted: #6e675c;
  --line: #e7dfd2;
  --accent: #3b5ba0;
  --accent-hover: #2f4a86;
  --accent-soft: rgba(59, 91, 160, 0.1);
  --terra: #c4664a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 32px rgba(70, 58, 35, 0.08);
  --shadow-sm: 0 4px 14px rgba(70, 58, 35, 0.06);
  --transition: 260ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1b18;
    --bg-alt: #26231f;
    --surface: #2c2924;
    --text: #ece6da;
    --muted: #a89e8e;
    --line: #3d3831;
    --accent: #7d9bd6;
    --accent-hover: #93aede;
    --accent-soft: rgba(125, 155, 214, 0.14);
    --shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Manrope", "PT Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }

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

img, svg { max-width: 100%; }

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

.container-narrow { max-width: 780px; }

.section { padding: 72px 0; }

.section-title {
  font-size: clamp(26px, 4vw, 36px);
  margin: 0 0 32px;
}

.page-title {
  font-size: clamp(30px, 4.5vw, 42px);
  margin: 0 0 16px;
}

.page-head { padding-bottom: 24px; }

.lead { font-size: 19px; color: var(--muted); max-width: 640px; }

/* --- Кнопки --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 22px;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
    transform var(--transition), box-shadow var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-hover); }

.btn-danger { background: transparent; color: #b3402e; border: 1.5px solid #e0b7ac; }
.btn-danger:hover { background: #b3402e; color: #fff; border-color: #b3402e; }

.btn-lg { padding: 14px 30px; font-size: 18px; border-radius: 14px; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }

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

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

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

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
}
.logo:hover { color: var(--text); }

.main-nav {
  display: flex;
  gap: 26px;
  margin-left: auto;
}
.main-nav a {
  color: var(--text);
  font-weight: 600;
  padding: 8px 2px;
}
.main-nav a:hover { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 14px; }

.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
}
.burger span {
  display: block;
  height: 2.5px;
  border-radius: 2px;
  background: var(--text);
  transition: transform var(--transition), opacity var(--transition);
}
.burger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* --- Hero --- */

.hero { padding: 88px 0 72px; }

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 56px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(36px, 5.5vw, 56px);
  margin: 0 0 20px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

.hero-version { margin-top: 18px; color: var(--muted); font-size: 15px; }

.app-mockup {
  display: block;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

/* --- Миссия --- */

.mission { background: var(--bg-alt); border-radius: 32px; margin: 0 16px; }

.mission-quote {
  margin: 0 0 24px;
  padding: 28px 32px;
  background: var(--surface);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 19px;
}
.mission-quote p { margin: 0; }

/* --- Преимущества --- */

.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature-card h3 { margin: 18px 0 10px; font-size: 22px; }
.feature-card p { margin: 0; color: var(--muted); }

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}

.feature-visual {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}
.feature-visual svg { max-width: 260px; }

.privacy-points {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.privacy-points li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: var(--muted);
}
.privacy-points svg { flex-shrink: 0; margin-top: 3px; color: var(--accent); }

/* --- Блок последней версии --- */

.release-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 48px;
  text-align: center;
  box-shadow: var(--shadow);
}

.release-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.release-version { margin: 0 0 10px; font-size: clamp(26px, 4vw, 34px); }
.release-meta { color: var(--muted); margin: 0 0 24px; }

.release-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* --- Новости --- */

.section-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.section-more { font-weight: 600; white-space: nowrap; }

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.news-list { display: grid; gap: 20px; max-width: 780px; }

.news-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.news-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.news-meta { margin: 0 0 10px; font-size: 14px; color: var(--muted); }

.news-card-title { margin: 0 0 10px; font-size: 20px; }
.news-card-title a { color: var(--text); }
.news-card-title a:hover { color: var(--accent); }

.news-excerpt { margin: 0 0 14px; color: var(--muted); font-size: 15.5px; }

.news-read { font-weight: 600; font-size: 15px; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}
.tag-release { background: rgba(196, 102, 74, 0.14); color: var(--terra); }
.tag-update { background: rgba(59, 91, 160, 0.12); color: var(--accent); }
.tag-article { background: rgba(120, 140, 90, 0.16); color: #5f7345; }

.pagination {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 40px;
}
.pagination-info { color: var(--muted); }

.empty-note { color: var(--muted); font-size: 18px; }

/* --- Страница загрузки --- */

.release-list { display: grid; gap: 20px; }

.release-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.release-row-latest { border-color: var(--accent); }

.release-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.release-row-title { margin: 0 0 6px; font-size: 20px; }

.release-details { margin-top: 16px; }
.release-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  padding: 6px 0;
}

.sha256 {
  word-break: break-all;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
}
.sha256 code { font-family: "SF Mono", Menlo, Consolas, monospace; }

/* --- Prose (Markdown) --- */

.prose { font-size: 17px; }
.prose h1, .prose h2, .prose h3 { margin: 1.4em 0 0.5em; }
.prose p { margin: 0.8em 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.3em 0; }
.prose img { border-radius: var(--radius-sm); }
.prose pre {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  font-size: 14.5px;
}
.prose code { font-family: "SF Mono", Menlo, Consolas, monospace; }
.prose p code, .prose li code {
  background: var(--bg-alt);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.92em;
}
.prose blockquote {
  margin: 1.2em 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }

.article-back { margin-top: 48px; font-weight: 600; }

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

.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  padding: 48px 0 32px;
  background: var(--bg-alt);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.footer-tagline { color: var(--muted); margin: 10px 0 0; font-size: 15px; }

.footer-links { display: grid; gap: 10px; align-content: start; }
.footer-links a { color: var(--text); font-weight: 500; }
.footer-links a:hover { color: var(--accent); }

.footer-copy { margin-top: 32px; color: var(--muted); font-size: 14px; }

/* --- Админка --- */

.admin-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  margin-top: 0;
}

.admin-nav-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  flex-wrap: wrap;
}

.admin-nav-link {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}
.admin-nav-link:hover, .admin-nav-link.active { background: var(--accent-soft); color: var(--accent); }

.admin-logout { margin-left: auto; }
.admin-logout-btn { background: none; border: none; cursor: pointer; font: inherit; color: var(--muted); }

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 720px;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

a.admin-card { display: grid; gap: 6px; color: var(--text); }
a.admin-card:hover { box-shadow: var(--shadow); color: var(--text); }

.admin-card-num { font-size: 40px; font-weight: 800; color: var(--accent); }
.admin-card-label { color: var(--muted); margin-bottom: 10px; }
.admin-card-title { margin: 0 0 18px; font-size: 20px; }

.admin-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.admin-table-wrap { overflow-x: auto; margin-top: 24px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 15px;
}
.admin-table th, .admin-table td { padding: 14px 16px; text-align: left; vertical-align: top; }
.admin-table thead th { background: var(--bg-alt); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.admin-table tbody tr + tr { border-top: 1px solid var(--line); }

.admin-slug { color: var(--muted); font-size: 13px; }

.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-actions form { margin: 0; }

.status { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.status-published { background: rgba(120, 160, 90, 0.18); color: #4e6b33; }
.status-draft { background: var(--bg-alt); color: var(--muted); }

.sha256-cell { font-size: 13px; font-family: "SF Mono", Menlo, Consolas, monospace; }

/* --- Формы --- */

.admin-form {
  display: grid;
  gap: 18px;
  max-width: 640px;
  margin-top: 8px;
}
.admin-form-wide { max-width: none; }

.admin-form label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.admin-form label > span { color: var(--text); }

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="datetime-local"],
.admin-form input[type="file"],
.admin-form select,
.admin-form textarea {
  font: inherit;
  font-weight: 400;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
  transition: border-color var(--transition);
}
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: end; }
.form-row > label { flex: 0 1 auto; min-width: 180px; }
.form-row > .form-grow { flex: 1 1 320px; }

.checkbox-label {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.checkbox-label input { width: 20px; height: 20px; accent-color: var(--accent); }

.form-error {
  background: rgba(179, 64, 46, 0.1);
  color: #b3402e;
  border: 1px solid #e0b7ac;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-weight: 600;
}

.form-actions { display: flex; gap: 14px; align-items: center; margin-top: 8px; }

.login-card { max-width: 420px; margin: 48px auto; box-shadow: var(--shadow); }

/* Markdown-редактор */

.md-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.md-editor-input textarea { width: 100%; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 14.5px; }
.md-preview-label { font-weight: 600; font-size: 15px; display: block; margin-bottom: 6px; }
.md-preview {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  min-height: 200px;
  background: var(--surface);
  font-size: 15.5px;
  overflow-wrap: break-word;
}

/* --- Адаптивность --- */

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero { padding: 56px 0; }
  .features-grid { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr 1fr; }
  .md-editor { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .main-nav {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px 20px;
    box-shadow: var(--shadow);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition);
  }
  .main-nav.open { transform: none; opacity: 1; pointer-events: auto; }
  .main-nav a { padding: 12px 8px; font-size: 18px; }
  .header-actions { margin-left: auto; }
  .burger { display: flex; }
  .btn-header { display: none; }
  .news-grid { grid-template-columns: 1fr; }
  .release-card { padding: 32px 24px; }
  .section { padding: 48px 0; }
  .footer-inner { flex-direction: column; }
}

/* --- Плавность и reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
