/* ==========================================================================
   Студия 117 — дизайн-система
   Тёмная тема как фирменный стиль: фон почти чёрный, акцент — фиолетовый,
   подтверждения и «галочки» — мятный. Шрифты: Inter (текст), JetBrains Mono (цифры).
   ========================================================================== */

:root {
  /* Поверхности */
  --bg: #080b12;
  --bg-alt: #0d1119;
  --card: #121826;
  --card-hover: #172032;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* Текст */
  --text: #eef2f8;
  --muted: #98a4b9;

  /* Бренд */
  --brand: #7c5cff;        /* декоративный: свечения, градиенты, рамки */
  --brand-solid: #5a3ce8;  /* фон кнопок — с белым текстом даёт контраст 6.5:1 */
  --brand-ink: #a894ff;    /* ссылки и надзаголовки на тёмном фоне */
  --accent: #2fe3a8;       /* галочки, статус «в проде» */
  --danger: #ff7a7a;

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1160px;

  /* Отступы кратны 4 */
  --gap: 24px;
  --section-y: 96px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Якоря не прячутся под липкой шапкой */
[id] { scroll-margin-top: 88px; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }

.mono, .stat-value, .step-num { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Видимый фокус — обязателен для клавиатурной навигации */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-ink);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand-solid); color: #fff; padding: 12px 20px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow-lg { max-width: 760px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; }
svg.ico[href], .ico use { pointer-events: none; }

/* ---------- Шапка ---------- */

.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(8, 11, 18, 0.88);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.header-inner { display: flex; align-items: center; gap: 28px; padding: 14px 20px; }

.logo { display: flex; align-items: center; gap: 12px; color: var(--text); }
.logo:hover { text-decoration: none; }
/* Знак рисуется в SVG (views/partials/logo.ejs): барабан — семёрка,
   палочки — две единицы. Размер задаём здесь, а не в самой картинке,
   чтобы в подвале и админке он мог отличаться. */
.logo-mark { display: block; width: 46px; height: 46px; flex: none; }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-name { font-weight: 800; font-size: 1.2rem; letter-spacing: 0.01em; }
/* Прописные в разрядку — так дескриптор набран на фирменном макете */
.logo-slogan { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.18em; color: var(--muted); }

.nav { display: flex; gap: 24px; margin-left: auto; }
.nav a { color: var(--muted); font-size: 0.94rem; font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }

.header-cta { flex: none; }

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 10px;
  background: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 11px 22px;
  border: 1px solid transparent; border-radius: 12px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; text-align: center;
  transition: background-color .2s ease, border-color .2s ease, transform .12s ease, color .2s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand-solid); color: #fff; }
.btn-primary:hover { background: #6d4dff; }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--brand); background: rgba(124, 92, 255, 0.1); }

.btn-sm { min-height: 38px; padding: 8px 16px; font-size: 0.88rem; }
.btn-lg { min-height: 52px; padding: 14px 30px; font-size: 1rem; }

.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.94rem; }
.link-arrow .ico { width: 18px; height: 18px; transition: transform .2s ease; }
.link-arrow:hover { text-decoration: none; }
.link-arrow:hover .ico { transform: translateX(3px); }

/* ---------- Первый экран ---------- */

.hero { position: relative; padding: 92px 0 72px; overflow: hidden; }
/* Фон первого экрана, если редактор его загрузил. Картинка приглушена
   и накрыта градиентом: под белым текстом должно оставаться темно,
   иначе заголовок перестанет читаться на светлых кадрах. */
.hero-photo {
  position: absolute; inset: 0; z-index: 0;
  background-image: var(--hero-image);
  background-size: cover; background-position: center;
  opacity: 0.3;
}
.hero-photo::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 11, 18, 0.55) 0%, rgba(8, 11, 18, 0.88) 100%);
}
.hero-glow {
  position: absolute; inset: -30% 0 auto 50%; transform: translateX(-50%);
  width: min(1000px, 130%); aspect-ratio: 1;
  background: radial-gradient(circle at 50% 40%, rgba(124, 92, 255, 0.28) 0%, rgba(79, 140, 255, 0.10) 38%, transparent 68%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 860px; }

.eyebrow {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand-ink); margin-bottom: 14px;
}
.hero h1 { margin-bottom: 22px; }
.grad {
  background: linear-gradient(100deg, #a894ff 0%, #4f8cff 55%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { font-size: clamp(1.02rem, 1.6vw, 1.18rem); color: var(--muted); max-width: 640px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

.hero-badges { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 34px; }
.hero-badges li { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; color: var(--muted); }
.hero-badges .ico { width: 18px; height: 18px; color: var(--accent); }

/* ---------- Полоса с цифрами ---------- */

.stats-strip { border-block: 1px solid var(--line); background: var(--bg-alt); }
/* Число колонок задаётся классом, а не переменной в repeat():
   repeat(var(--n), 1fr) поддерживается не везде, а классы переопределяются
   в медиазапросах — с инлайновым стилем это уже не сработало бы. */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); padding: 36px 20px; }
.stats-grid.cols-1 { grid-template-columns: 1fr; }
.stats-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
.stat-label { font-size: 0.9rem; color: var(--muted); }

/* ---------- Секции ---------- */

.section { padding: var(--section-y) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--line); }

.section-head { margin-bottom: 44px; max-width: 720px; }
.section-head h2 { margin-bottom: 14px; }
.section-lead { color: var(--muted); font-size: 1.02rem; }
.section-head-row {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; max-width: none;
}

.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ---------- Карточки ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color .2s ease, background-color .2s ease;
}
/* И h2, и h3: в карточке кейса заголовок h3, в карточке статьи — h2,
   а отступ под ним нужен одинаковый. Заголовок в шапке кейса (.case-top)
   отступ обнуляет сам — там расстояние держит подзаголовок. */
.card h2, .card h3 { margin-bottom: 10px; }
.card p { color: var(--muted); }
.card p + p { margin-top: 12px; }

.service-card:hover, .case-card:hover, .article-card:hover { border-color: var(--line-strong); }

.card-icon {
  display: grid; place-items: center;
  width: 46px; height: 46px; margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(124, 92, 255, 0.14);
  border: 1px solid rgba(124, 92, 255, 0.28);
  color: var(--brand-ink);
}
.card-icon .ico { width: 22px; height: 22px; }

.ticks { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.ticks li { display: flex; align-items: flex-start; gap: 9px; font-size: 0.92rem; color: var(--muted); }
.ticks .ico { width: 17px; height: 17px; margin-top: 4px; color: var(--accent); }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags li {
  font-size: 0.78rem; font-weight: 500; color: var(--muted);
  padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px;
}

.chip {
  flex: none; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.chip-live { background: rgba(47, 227, 168, 0.14); color: var(--accent); border: 1px solid rgba(47, 227, 168, 0.3); }
.chip-wip { background: rgba(255, 255, 255, 0.06); color: var(--muted); border: 1px solid var(--line-strong); }
.chip-accent { background: var(--brand-solid); color: #fff; align-self: flex-start; margin-bottom: 14px; }

/* Портфолио */
/* Плашка статуса стоит nowrap и не переносится внутри себя: если она
   выросла, пусть съедет на свою строку, а не выталкивает прокрутку.
   Предел длины в src/fields.js остаётся — он про вид, а не про поломку. */
.case-top { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 6px; }
.case-top h2, .case-top h3 { margin: 0; }
.case-card h2 a, .case-card h3 a, .article-card h2 a, .article-card h3 a { color: var(--text); }
.case-tagline { color: var(--brand-ink) !important; font-size: 0.92rem; margin-bottom: 12px; }
.case-result {
  margin-top: 14px; padding-left: 14px;
  border-left: 2px solid var(--accent);
  color: var(--text) !important; font-size: 0.94rem;
}
.case-card .link-arrow { margin-top: 18px; }
/* height: auto обязателен. У картинки в разметке проставлены width и height,
   чтобы страница не прыгала при загрузке, но без этой строки браузер берёт
   высоту из атрибута буквально — и картинка 16:9 сплющивается по ширине. */
.case-cover {
  width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 28px;
}

/* Обложка в карточке списка. Без overflow: hidden — картинка и так по месту,
   а скрытое переполнение прогон на растяжение считает обрезанным текстом. */
.case-thumb {
  display: block; width: 100%; height: auto;
  aspect-ratio: 16 / 9; object-fit: cover;
  margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}

/* Статьи */
/* В карточке статьи теги стоят НАД заголовком, а не после текста, как в кейсе.
   Поэтому верхний отступ здесь лишний — его уже даёт сама карточка, — а нижний
   обязателен: без него заголовок прилипает к чипам вплотную. */
.article-card .tags { margin-top: 0; margin-bottom: 14px; }
.article-card time { display: block; margin-top: 16px; font-size: 0.84rem; color: var(--muted); }

/* ---------- Процесс ---------- */

.steps { list-style: none; display: grid; gap: 2px; counter-reset: step; }
.step {
  display: grid; grid-template-columns: 88px 1fr; gap: 24px; align-items: start;
  padding: 26px 0; border-top: 1px solid var(--line);
}
.step:last-child { border-bottom: 1px solid var(--line); }
.step-num { font-size: 1.5rem; font-weight: 700; color: var(--brand-ink); letter-spacing: -0.03em; }
.step h3 { margin-bottom: 8px; }
.step p { color: var(--muted); max-width: 68ch; }

/* ---------- Форматы ---------- */

.format-card { display: flex; flex-direction: column; }
.format-card.is-featured { border-color: rgba(124, 92, 255, 0.45); background: linear-gradient(180deg, rgba(124, 92, 255, 0.08), transparent 60%), var(--card); }
.format-lead { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-ink) !important; margin-bottom: 6px; }
.format-term { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; color: var(--text) !important; margin-bottom: 14px; }
.format-card .btn { margin-top: auto; }
.format-card .ticks { margin-bottom: 24px; }

/* ---------- Вопросы ---------- */

.faq { display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px; cursor: pointer; font-weight: 600; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-sign { position: relative; width: 14px; height: 14px; flex: none; }
.faq-sign::before, .faq-sign::after {
  content: ''; position: absolute; inset: 50% 0 auto 0;
  height: 2px; background: var(--brand-ink); border-radius: 2px; transition: transform .2s ease;
}
.faq-sign::after { transform: rotate(90deg); }
.faq-item[open] .faq-sign::after { transform: rotate(0deg); opacity: 0; }
.faq-item p { padding: 0 22px 20px; color: var(--muted); }

/* ---------- Заявка ---------- */

.section-request { background: var(--bg-alt); border-top: 1px solid var(--line); }
.request-inner { display: grid; grid-template-columns: 1fr 1.05fr; gap: 48px; align-items: start; }
.request-copy h2 { margin-bottom: 16px; }
.request-copy > p { color: var(--muted); }
.request-direct { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.request-form { padding: 32px; }

.lead-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-wide, .form-actions { grid-column: 1 / -1; }
.field label { font-size: 0.88rem; font-weight: 500; }
.req { color: var(--brand-ink); }
.hint { font-size: 0.78rem; color: var(--muted); }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  font: inherit; font-size: 16px; /* 16px не даёт iOS зумить при фокусе */
  color: var(--text); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .2s ease, background-color .2s ease;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #6b768c; }
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.24); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: rgba(255, 255, 255, 0.06); }
select { appearance: none; cursor: pointer; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% + 2px), calc(100% - 14px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
select option { background: var(--card); color: var(--text); }

.form-actions { display: flex; flex-direction: column; gap: 12px; }
.form-actions .btn { width: 100%; }
.consent { font-size: 0.78rem; color: var(--muted); }
.form-error {
  grid-column: 1 / -1; margin: 0; padding: 12px 14px;
  background: rgba(255, 122, 122, 0.1); border: 1px solid rgba(255, 122, 122, 0.35);
  border-radius: var(--radius-sm); color: var(--danger); font-size: 0.9rem;
}

/* Ловушка для ботов */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Внутренние страницы ---------- */

.page-head { padding: 64px 0 8px; }
.page-head h1 { margin-bottom: 16px; }
.page-lead { color: var(--muted); font-size: 1.05rem; max-width: 680px; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 20px; }
.crumbs a { color: var(--muted); }
.case-head { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.case-head h1 { margin-bottom: 0; }
.page-head .tags { margin-top: 20px; }

.callout {
  padding: 18px 22px; margin-bottom: 32px;
  background: rgba(47, 227, 168, 0.07);
  border: 1px solid rgba(47, 227, 168, 0.25);
  border-radius: var(--radius-sm);
}
.callout strong { color: var(--accent); }

.empty { color: var(--muted); padding: 40px 0; }

.article-meta { color: var(--muted); font-size: 0.9rem; }

/* Текст статьи */
.prose { font-size: 1.05rem; }
.prose h2 { font-size: 1.5rem; margin: 40px 0 14px; }
.prose h3 { font-size: 1.2rem; margin: 30px 0 10px; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p { color: #c9d2e0; margin-bottom: 18px; max-width: 70ch; }
.prose ul, .prose ol { margin: 0 0 18px 22px; color: #c9d2e0; }
.prose li { margin-bottom: 8px; }
.prose blockquote {
  margin: 0 0 18px; padding: 14px 20px;
  border-left: 3px solid var(--brand); background: rgba(124, 92, 255, 0.07);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text);
}
.prose code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.88em;
  padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08);
}

/* ---------- Призыв на внутренних страницах ---------- */

.cta-band { background: var(--bg-alt); border-top: 1px solid var(--line); }
.cta-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 28px; }
.cta-inner h2 { margin-bottom: 8px; }
.cta-inner p { color: var(--muted); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Ошибки ---------- */

.error-page { padding-top: 100px; }
.error-code { font-family: 'JetBrains Mono', monospace; font-size: 4rem; font-weight: 700; color: var(--brand-ink); }
.error-page .hero-actions { justify-content: center; }
.error-page .page-lead { margin: 0 auto; }

/* ---------- Подвал ---------- */

.site-footer { background: var(--bg); border-top: 1px solid var(--line); padding: 56px 0 28px; }
.footer-inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; }
.footer-note { color: var(--muted); font-size: 0.9rem; margin-top: 16px; }
.footer-title { display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 14px; }
.footer-nav, .footer-contacts { display: flex; flex-direction: column; gap: 10px; }
.footer-nav a, .footer-contacts a { color: var(--text); font-size: 0.92rem; display: inline-flex; align-items: center; gap: 9px; }
.footer-nav a:hover, .footer-contacts a:hover { color: var(--brand-ink); text-decoration: none; }
.footer-contacts .ico { width: 18px; height: 18px; color: var(--muted); }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line);
  font-size: 0.84rem; color: var(--muted);
}
.footer-bottom a { color: var(--muted); }

/* ---------- Окно «спасибо» ---------- */

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 10, 0.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-window {
  position: relative; width: min(440px, 100%); padding: 36px 32px 32px; text-align: center;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 14px;
  animation: modal-in .22s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px;
  background: none; border: 0; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; border-radius: 8px;
}
.modal-close:hover { color: var(--text); }
.modal-icon {
  display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 4px;
  border-radius: 50%; background: rgba(47, 227, 168, 0.14); color: var(--accent);
}
.modal-icon .ico { width: 28px; height: 28px; }
.modal-window p { color: var(--muted); }
.modal-window .btn { width: 100%; }

/* ==========================================================================
   Админка
   ========================================================================== */

.admin-body { background: var(--bg); }
.admin-header { border-bottom: 1px solid var(--line); background: var(--bg-alt); position: sticky; top: 0; z-index: 50; }
.admin-bar { display: flex; align-items: center; gap: 28px; max-width: 1400px; margin: 0 auto; padding: 12px 24px; }
.admin-nav { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
.admin-nav a { color: var(--muted); font-size: 0.92rem; font-weight: 500; }
.admin-nav a:hover, .admin-nav a.is-active { color: var(--text); text-decoration: none; }
.admin-nav a.is-active { color: var(--brand-ink); }

.admin-main { max-width: 1400px; margin: 0 auto; padding: 32px 24px 80px; }
.admin-narrow { max-width: 820px; }
.admin-page-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.admin-page-head h1 { font-size: 1.8rem; }

.admin-login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.admin-login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; }
.admin-login-card h1 { font-size: 1.5rem; }

.admin-form { display: flex; flex-direction: column; gap: 20px; }
.admin-form .form-actions { flex-direction: row; align-items: center; }
.admin-form .form-actions .btn { width: auto; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.checkbox { display: flex; align-items: center; gap: 10px; font-size: 0.94rem; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--brand); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 760px; }
.admin-table th, .admin-table td { padding: 14px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.admin-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--bg-alt); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .cell-wide { max-width: 380px; }
.admin-table select { min-height: 38px; padding: 6px 32px 6px 10px; font-size: 0.88rem; }
.lead-new td { background: rgba(124, 92, 255, 0.05); }
.lead-done { opacity: 0.6; }

.inline-form { display: inline-block; }
.btn-link-danger { background: none; border: 0; color: var(--danger); font: inherit; font-size: 0.88rem; cursor: pointer; padding: 0; }
.btn-link-danger:hover { text-decoration: underline; }

.badge { font-size: 0.76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-on { background: rgba(47, 227, 168, 0.14); color: var(--accent); }
.badge-off { background: rgba(255, 255, 255, 0.07); color: var(--muted); }

/* ---------- Счётчик длины и ошибки полей ---------- */

/* Подпись поля делит строку со счётчиком: запас видно, не отводя глаз от поля */
.admin-form .field label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem; font-weight: 500; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); color: var(--muted);
}
.counter-warn { background: rgba(255, 196, 92, 0.14); color: #ffc45c; }
.counter-full { background: rgba(255, 122, 122, 0.14); color: var(--danger); }

.hint-warn { color: #ffc45c; }
.field-error { font-size: 0.8rem; color: var(--danger); }
.field-invalid input, .field-invalid textarea { border-color: rgba(255, 122, 122, 0.6); }

.markup-hint { margin-top: -8px; }
.markup-hint code { font-size: 0.86em; }

/* ---------- Картинки в админке ---------- */

.editor-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload-field { display: flex; flex-direction: column; gap: 10px; }

textarea.is-dropping { border-color: var(--brand); background: rgba(124, 92, 255, 0.08); }

.upload-status { font-size: 0.8rem; color: var(--muted); }
.upload-status.is-error { color: var(--danger); }

.cover-preview img {
  display: block; width: 100%; max-width: 320px; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}

/* ---------- Картинки внутри статьи ---------- */

.prose-figure { margin: 0 0 24px; }
.prose-figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.prose-video {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #000;
}
.prose-figure figcaption { margin-top: 10px; font-size: 0.86rem; color: var(--muted); }

/* ---------- Блоки главной страницы ---------- */

.block-list { display: flex; flex-direction: column; gap: 10px; }

.block-row {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 16px;
  padding: 14px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
/* Выключенный блок остаётся в списке со всем содержимым — просто приглушён */
.block-row.is-off { opacity: 0.55; }

.block-order { display: flex; flex-direction: column; gap: 2px; }
.btn-move {
  width: 32px; height: 22px; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.8rem; line-height: 1;
  color: var(--muted); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-strong); border-radius: 6px;
}
.btn-move:hover:not(:disabled) { color: var(--text); border-color: var(--brand); }
.btn-move:disabled { opacity: 0.3; cursor: default; }

.block-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.block-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Элементы списка внутри блока ---------- */

.items { display: flex; flex-direction: column; gap: 16px; }
.items-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.items-head h2 { font-size: 1.05rem; }

.item-card {
  display: flex; flex-direction: column; gap: 16px;
  margin: 0; padding: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.item-card legend {
  padding: 0 8px; font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.item-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 640px) {
  /* На телефоне действия уезжают под название, иначе строка не помещается */
  .block-row { grid-template-columns: 40px 1fr; }
  .block-actions { grid-column: 2; }
}

/* ==========================================================================
   Адаптив
   ========================================================================== */

@media (max-width: 1024px) {
  :root { --section-y: 72px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .request-inner { grid-template-columns: 1fr; gap: 36px; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .header-inner { gap: 12px; }
  .nav {
    position: fixed; inset: 68px 0 auto; z-index: 55;
    flex-direction: column; gap: 0; margin: 0;
    background: var(--bg-alt); border-bottom: 1px solid var(--line);
    padding: 8px 20px 20px;
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 1rem; }
  .nav a:last-child { border-bottom: 0; }
  .header-cta { margin-left: auto; }
  .nav-toggle { display: flex; }
}

@media (max-width: 720px) {
  :root { --section-y: 60px; --gap: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid, .stats-grid.cols-2, .stats-grid.cols-3, .stats-grid.cols-4 { grid-template-columns: 1fr; gap: 20px; padding: 28px 20px; }
  .lead-form { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .step { grid-template-columns: 56px 1fr; gap: 16px; }
  .section-head-row { flex-direction: column; align-items: flex-start; }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding: 64px 0 52px; }
  .card, .request-form { padding: 22px; }
  .cta-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .logo-slogan { display: none; }
  .header-cta { display: none; }
  .hero-actions .btn { width: 100%; }
}

/* Уважаем системную настройку «меньше движения» */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
