/* CiteFlow — стиль «Терминал» с двумя темами (тёмная по умолчанию, светлая по переключателю).
   Без фреймворков. Тема хранится в data-theme на <html> и в localStorage (ключ cf-theme). */

/* ── Токены: тёмная тема (дефолт) ──────────────────────────────────────────── */
:root {
  --bg: #0b111b;
  --grid: rgba(79, 140, 255, .045);
  --card: #101a29;
  --card2: #16233a;          /* вложенные поверхности: mock-a, чипы, код */
  --card3: #0d1622;          /* поля форм, фон мокапа */
  --line: #22314a;
  --line2: #2a3b58;          /* границы на вложенных поверхностях */
  --ink: #e8eef6;
  --heading: #ffffff;
  --muted: #8ba0b6;
  --article: #cdd9e6;
  --accent: #4f8cff;
  --accent-2: #2dd4bf;       /* циан: kicker, цифры, иконки */
  --accent-soft: #9dbdff;
  --on-accent: #06101f;      /* текст на акцентных кнопках */
  --mark-bg: rgba(45, 212, 191, .25);
  --mark-ink: #7ff0dc;
  --chip-ink: #9dbdff;
  --cta-bg: #0f1a2c;
  --cta-line: #27395a;
  --placeholder: #55677d;
  --ok-bg: #0f2b1c; --ok-ink: #6ee7a0;
  --err-bg: #2b1214; --err-ink: #ff9d9d;
  --mock-shadow: 0 0 0 1px rgba(79, 140, 255, .25), 0 24px 60px -30px rgba(0, 0, 0, .8);
  --sel: rgba(79, 140, 255, .4);
  color-scheme: dark;
}

/* ── Токены: светлая тема ──────────────────────────────────────────────────── */
html[data-theme="light"] {
  --bg: #fbfbf9;
  --grid: rgba(29, 91, 216, .05);
  --card: #ffffff;
  --card2: #eef3fd;
  --card3: #f4f6f8;
  --line: #e4e7ea;
  --line2: #d5dbe2;
  --ink: #16202c;
  --heading: #10161f;
  --muted: #5b6b7c;
  --article: #2a3644;
  --accent: #1d5bd8;
  --accent-2: #0d9488;
  --accent-soft: #14439f;
  --on-accent: #ffffff;
  --mark-bg: #ffe9a8;
  --mark-ink: #4a3b00;
  --chip-ink: #14439f;
  --cta-bg: #f2f6ff;
  --cta-line: #d8e3fa;
  --placeholder: #97a5b4;
  --ok-bg: #e9f7ee; --ok-ink: #14562c;
  --err-bg: #fdeeee; --err-ink: #7c1d1d;
  --mock-shadow: 0 18px 40px -18px rgba(22, 32, 44, .25);
  --sel: rgba(29, 91, 216, .25);
  color-scheme: light;
}

/* ── База ──────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink);
  background: linear-gradient(var(--grid) 1px, transparent 1px) 0 0/100% 44px, var(--bg);
  font: 17px/1.65 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: background-color .2s, color .2s;
}
::selection { background: var(--sel); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  max-width: 960px; margin: 0 auto; padding: 18px 20px;
}
.nav nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
@media (max-width: 480px) {
  .nav { padding: 12px 16px; }
  .nav nav { gap: 12px; font-size: 15px; }
}
.logo { font-weight: 800; font-size: 22px; color: var(--heading); letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }

/* Переключатель темы */
.theme-toggle {
  background: transparent; border: 1px solid var(--line); border-radius: 10px;
  width: 38px; height: 38px; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: block; }
.theme-toggle .i-moon { display: none; }
html[data-theme="light"] .theme-toggle .i-sun { display: none; }
html[data-theme="light"] .theme-toggle .i-moon { display: block; }

h1, h2, h3 { color: var(--heading); }
h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.5px; margin: 28px 0 12px; }
h2 { font-size: 24px; line-height: 1.25; margin: 34px 0 10px; letter-spacing: -0.3px; }
h3 { font-size: 18px; margin: 20px 0 8px; }
.lead { font-size: 19px; color: var(--muted); max-width: 46em; }
.hint { font-size: 14px; color: var(--muted); }
.hero { padding: 30px 0 10px; }

.kicker, .hint, .mock-meta, .post-card .meta {
  font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}
.kicker { color: var(--accent-2); font-weight: 600; text-transform: uppercase; font-size: 13px; letter-spacing: .12em; }

.btn {
  display: inline-block; background: var(--accent); color: var(--on-accent); font-weight: 700;
  padding: 12px 22px; border-radius: 10px; border: 0; cursor: pointer; font-size: 16px;
}
.btn:hover { background: var(--accent-soft); text-decoration: none; color: var(--on-accent); }
html[data-theme="light"] .btn:hover { background: var(--accent-soft); color: #fff; }
.btn-small { padding: 7px 14px; font-size: 14px; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-ghost:hover { background: var(--card2); color: var(--accent-soft); }
.btn-lg { padding: 16px 28px; font-size: 18px; border-radius: 12px; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 10px; }
.cta-final .cta-row { justify-content: center; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; margin: 18px 0;
}
.card h2:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 760px) { .cols, .grid3 { grid-template-columns: 1fr; } }

form label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 15px; }
form input:not([type=checkbox]), form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 8px;
  font: inherit; background: var(--card3); color: var(--ink); margin-top: 4px;
}
form input::placeholder, form textarea::placeholder { color: var(--placeholder); }
form input:focus, form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
form .check { font-weight: 400; font-size: 14px; color: var(--muted); }
form .check input { margin-right: 8px; }
form button { margin-top: 16px; }
.inline { display: inline; }
.inline input { width: auto; }

.notice { border-radius: 10px; padding: 12px 16px; margin: 14px 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice.err { background: var(--err-bg); color: var(--err-ink); }

.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { background: var(--card2); color: var(--chip-ink); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.tags li span { opacity: .6; }
.tags.muted li { background: var(--card3); color: var(--muted); }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; }

.progress { height: 10px; background: var(--card2); border-radius: 999px; overflow: hidden; margin: 24px 0 8px; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .6s; }

.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; margin: 14px 0; padding-left: 44px; position: relative; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}

details.faq { border-bottom: 1px solid var(--line); padding: 12px 0; }
details.faq summary { font-weight: 600; cursor: pointer; font-size: 17px; }
details.faq p { color: var(--muted); }

blockquote { border-left: 3px solid var(--accent); margin: 18px 0; padding: 4px 18px; color: var(--muted); }
article { max-width: 46em; color: var(--article); }
article h1 { font-size: 30px; }
code { background: var(--card2); color: var(--chip-ink); border-radius: 5px; padding: 1px 6px; font-size: .9em; }

.footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 26px 0 40px; color: var(--muted); font-size: 14px; }
.footer a { color: var(--muted); text-decoration: underline; }
.cta, .cta-final { background: var(--cta-bg); border-color: var(--cta-line); }
.cta-final { text-align: center; padding: 36px 24px; }

/* Hero: текст + мокап ответа нейросети */
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 40px; align-items: center; }
.hero-grid h1 { font-size: clamp(28px, 4.5vw, 40px); margin-top: 10px; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; gap: 24px; } }

.mock {
  background: var(--card3); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; box-shadow: var(--mock-shadow);
}
html[data-theme="light"] .mock { background: var(--card); }
.mock-q {
  background: var(--accent); color: var(--on-accent); font-weight: 600;
  border-radius: 14px 14px 4px 14px;
  padding: 10px 16px; font-size: 15px; margin: 0 0 12px auto; width: fit-content; max-width: 90%;
}
.mock-a { background: var(--card2); color: var(--ink); border-radius: 14px 14px 14px 4px; padding: 14px 16px; font-size: 15px; }
html[data-theme="light"] .mock-a { background: var(--card3); }
.mock-a p { margin: 0 0 10px; }
.mock-a mark { background: var(--mark-bg); color: var(--mark-ink); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mock-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.mock-chips span {
  background: var(--card3); border: 1px solid var(--line2); border-radius: 999px;
  padding: 2px 10px; font-size: 12px; color: var(--muted);
}
html[data-theme="light"] .mock-chips span { background: var(--card); }
.mock-meta { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; font-size: 13px; color: var(--muted); }
.mock-meta b { color: var(--accent-2); }

/* Цифры-станции */
.stat b {
  display: block; font-size: 44px; line-height: 1.05; letter-spacing: -1px;
  color: var(--accent-2); margin-bottom: 8px;
  font-family: ui-monospace, Consolas, Menlo, monospace;
}
.stat p { margin: 0; color: var(--muted); }

/* Иконки карточек */
.ico { width: 22px; height: 22px; color: var(--accent-2); vertical-align: -4px; margin-right: 4px; }

/* Блог: карточки статей */
.post-card h3 { margin-top: 0; }
.post-card h3 a { color: var(--heading); }
.post-card h3 a:hover { color: var(--accent); }
.post-card .meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.post-card p { color: var(--muted); }
.post-card .more { font-weight: 600; }
