@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   ДИЗАЙН-СИСТЕМА "НишаСайт"
   Палитра построена на цветах логотипа: тёмно-синий текст, насыщенный
   сине-фиолетовый акцент, голубые и бирюзовые оттенки, тёплый оранжевый —
   как в лого — используется точечно (warning/декор), не как основной цвет.
   ========================================================================== */
:root {
  /* Возвращено по просьбе: исходная оранжевая палитра (как было изначально), а не
     сине-фиолетовая из редизайна. Структурные улучшения (скругления, тени, анимации)
     оставлены — они завязаны на этих же переменных, так что просто "переехали" на
     старые цвета. */
  --primary: #14151a;
  --secondary: #b25e00;
  --accent: #ff5a2d;
  --accent-2: #ff8a5a;
  --success: #1a7a4c;
  --success-bg: #e7f6ee;
  --warning: #b25e00;
  --warning-bg: #fff3e0;
  --danger: #d92d20;
  --danger-bg: #fdecea;

  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f4f3ee;
  --border: #e7e6e2;
  --border-strong: #d8d6cc;

  --text: #14151a;
  --text-soft: #55575f;
  --muted: #9a988f;

  /* Совместимость со старыми именами переменных, используемыми в разметке. */
  --ink: var(--text);
  --ink-soft: var(--text-soft);
  --line: var(--border);
  --paper: var(--bg);
  --card: var(--surface);
  --accent-ink: #ffffff;
  --green: var(--success);
  --brand-purple: #7c5cfc;
  --brand-blue: #4f8cff;
  --brand-green: #34d399;
  --brand-orange: #f5b942;

  --gradient-primary: var(--accent);
  --gradient-soft: linear-gradient(135deg, rgba(255,90,45,.08), rgba(255,90,45,.03));

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(20,21,26,.04), 0 2px 6px rgba(20,21,26,.04);
  --shadow: 0 1px 2px rgba(20,21,26,.04), 0 8px 24px rgba(20,21,26,.06);
  --shadow-lg: 0 20px 50px -12px rgba(20,21,26,.18), 0 8px 24px rgba(20,21,26,.08);
  --shadow-glow: 0 8px 20px -4px rgba(255,90,45,.3);

  --ease: cubic-bezier(.4,0,.2,1);
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  letter-spacing: -.005em;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: rgba(255,90,45,.22); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fade-up { animation: fadeSlideUp .5s var(--ease) both; }

/* ---------- HEADER ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(247,247,251,.78);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 84px; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -.02em; display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; transition: opacity .15s var(--ease); }
.logo:hover { opacity: .8; }
.logo-mark {
  width: 46px; height: 46px; aspect-ratio: 1 / 1; flex-shrink: 0; flex-grow: 0;
  object-fit: contain; display: block;
}
.logo-text-col { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.logo-word { font-weight: 800; font-size: 25px; letter-spacing: -.02em; white-space: nowrap; }
.logo-tagline { font-size: 12.5px; font-weight: 600; color: var(--text-soft); letter-spacing: 0; white-space: nowrap; }
/* В шапке подзаголовок под лого только на широких экранах — на планшете/телефоне
   скрываем, чтобы шапка не раздувалась по высоте и логотип точно не обрезался.
   В футере (там своя вёрстка, больше воздуха) подзаголовок виден всегда. */
.site-header .logo-tagline { display: block; }
@media (max-width: 680px) { .site-header .logo-tagline { display: none; } }
@media (max-width: 480px) { .logo-mark { width: 36px; height: 36px; } .logo-word { font-size: 20px; } .site-header .wrap { height: 72px; } }
.nav { display: flex; gap: 30px; align-items: center; }
.nav a { font-weight: 600; font-size: 14.5px; color: var(--text-soft); transition: color .15s var(--ease); position: relative; }
.nav a:hover, .nav a.active { color: var(--text); }
.header-actions { display: flex; gap: 12px; align-items: center; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--radius-sm); padding: 12px 22px;
  font-weight: 700; font-size: 14.5px; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), opacity .2s var(--ease), border-color .2s var(--ease);
  letter-spacing: -.005em;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--text); color: #fff; box-shadow: 0 2px 8px rgba(23,26,43,.16); }
.btn-primary:hover { background: #262a42; box-shadow: 0 6px 16px rgba(23,26,43,.22); transform: translateY(-1px); }
.btn-accent { background: var(--gradient-primary); color: #fff; box-shadow: var(--shadow-glow); }
.btn-accent:hover { box-shadow: 0 12px 28px -4px rgba(255,90,45,.45); transform: translateY(-1px); filter: brightness(1.04); }
.btn-outline { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(255,90,45,.05); }
.btn-ghost { background: transparent; color: var(--text-soft); padding: 10px 14px; }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-sm { padding: 8px 15px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ---------- HERO ---------- */
/* Первый экран должен целиком занимать высоту окна (чтобы полоса со статистикой
   ниже НЕ попадала в область видимости при открытии сайта) — но без уменьшения
   шрифта под маленькие экраны: если контента меньше высоты окна, свободное
   место просто равномерно распределяется как воздух сверху/снизу и между
   колонками, а не сжимает текст. */
.hero {
  padding: 40px 0 0;
  overflow: hidden;
  min-height: calc(100vh - 84px);
  min-height: calc(100dvh - 84px);
  display: flex; flex-direction: column; justify-content: space-between;
}
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; min-width: 0; padding-bottom: 36px; }
.hero-col-text { min-width: 0; }
.hero-col-shot { min-width: 0; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 7px 16px;
  font-size: 13px; font-weight: 700; color: var(--text-soft); margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.hero h1 { font-size: 40px; line-height: 1.14; letter-spacing: -.03em; margin: 0 0 16px; font-weight: 800; color: var(--text); }
.hero h1 span { color: var(--accent); }
.hero p.lead { font-size: 16.5px; line-height: 1.55; color: var(--text-soft); margin: 0 0 24px; max-width: 480px; }
.hero-actions { display: flex; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.btn-lg { padding: 15px 26px; font-size: 15.5px; font-weight: 700; border-radius: 12px; }
.btn-accent.btn-lg { box-shadow: 0 12px 26px -6px rgba(255,90,45,.36); }
.hero-trust-row { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--text-soft); font-weight: 700; }
.hero-trust-row span { display: flex; align-items: center; gap: 7px; }
.hero-trust-row i { color: var(--success); }

.hero-shot {
  border-radius: var(--radius); overflow: hidden; background: var(--surface); min-width: 0;
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transition: transform .4s var(--ease);
}
.hero-shot-topbar { background: var(--surface-2); padding: 10px 14px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); }
.hero-shot-topbar .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.hero-shot-url { margin-left: 10px; color: var(--text-soft); font-size: 12px; display: flex; align-items: center; }
.hero-shot img { width: 100%; display: block; max-height: 380px; object-fit: cover; object-position: top; }

.hero-features-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px;
  padding: 28px 0 40px; border-top: 1px solid var(--border);
}
.hero-feature { display: flex; gap: 13px; align-items: flex-start; min-width: 0; }
.hero-feature i { font-size: 16px; color: var(--accent); flex-shrink: 0; margin-top: 3px; }
.hero-feature h4 { font-size: 14px; font-weight: 800; margin: 0 0 3px; color: var(--text); }
.hero-feature p { font-size: 12.5px; line-height: 1.42; color: var(--text-soft); margin: 0; }

@media (max-width: 900px) {
  .hero { min-height: 0; display: block; padding: 24px 0 0; }
  .hero-split { grid-template-columns: 1fr; gap: 24px; }
  .hero-col-shot { order: -1; }
  .hero h1 { font-size: 30px; }
  .hero-shot img { max-height: 320px; }
  .hero-features-row { grid-template-columns: 1fr 1fr; gap: 22px; padding-bottom: 28px; }
}
@media (max-width: 520px) {
  .hero-features-row { grid-template-columns: 1fr; }
}


.value-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.value-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.value-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.value-card .ic { font-size: 22px; margin-bottom: 14px; color: var(--accent); }
.value-card h3 { font-size: 16px; margin: 0 0 8px; letter-spacing: -.01em; }
.value-card p { font-size: 14px; color: var(--text-soft); margin: 0; }
.ic-circle { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 14px; transition: transform .2s var(--ease); }
.value-card:hover .ic-circle { transform: scale(1.06); }
.ic-circle.c-purple { background: rgba(124,92,252,.12); color: var(--brand-purple); }
.ic-circle.c-blue { background: rgba(79,140,255,.12); color: var(--brand-blue); }
.ic-circle.c-green { background: rgba(52,211,153,.14); color: #0f8a63; }
.ic-circle.c-orange { background: rgba(245,185,66,.16); color: var(--warning); }

.trust-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 24px; text-align: center; }
.trust-stat-num { font-size: 27px; font-weight: 800; color: var(--text); line-height: 1.2; display: flex; align-items: center; justify-content: center; gap: 7px; letter-spacing: -.02em; }
.trust-stat-num i { font-size: 20px; color: var(--success); }
.trust-stat-label { color: var(--text-soft); font-size: 13.5px; margin-top: 4px; }

.demo-device-btn.active { background: var(--text); color: #fff; border-color: var(--text); }

#demo-editor-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 16px;
}
.demo-topbar-left { display: flex; align-items: center; gap: 10px; }
.demo-project-name { font-weight: 700; font-size: 14px; }
.demo-tag { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-left: 4px; text-transform: uppercase; letter-spacing: .03em; }
.demo-topbar-center { display: flex; align-items: center; gap: 4px; }
.demo-topbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.demo-topbar-right { display: flex; align-items: center; gap: 12px; }
#demo-save-status { font-size: 12.5px; color: var(--text-soft); font-weight: 600; display: flex; align-items: center; gap: 6px; }
#demo-save-status i.fa-circle-check { color: var(--success); }
.demo-topbar-center .demo-device-btn { padding: 8px 11px; }

#demo-shell { display: flex; border-radius: 0 0 var(--radius-lg) var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
#demo-canvas-outer { flex: 1; min-width: 0; background: var(--surface); }

#demo-library-panel {
  width: 210px; flex-shrink: 0; background: var(--surface-2); border-right: 1px solid var(--border);
  padding: 20px 16px; overflow-y: auto; max-height: 560px;
}
#demo-library-panel textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px;
  font-family: inherit; font-size: 12.5px; resize: none; background: var(--surface); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
#demo-library-panel textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,90,45,.12); }

.demo-el { border-radius: 4px; outline: 2px solid transparent; outline-offset: 3px; transition: outline-color .15s; cursor: pointer; }
.demo-el:hover { outline-color: rgba(255,90,45,.35); }
.demo-el.demo-el-selected { outline: 2px dashed var(--accent); }

#demo-float-toolbar {
  position: absolute; display: none; align-items: center; gap: 2px; background: var(--text); border-radius: var(--radius-sm);
  padding: 4px; box-shadow: var(--shadow-lg); z-index: 20; transform: translateY(-100%); margin-top: -8px;
}
#demo-float-toolbar span { color: #fff; font-size: 11px; font-weight: 700; padding: 0 8px; white-space: nowrap; }
#demo-float-toolbar button { width: 24px; height: 24px; border: none; background: transparent; color: #fff; border-radius: 6px; font-size: 11px; cursor: pointer; transition: background .15s; }
#demo-float-toolbar button:hover { background: rgba(255,255,255,.15); }
#demo-float-toolbar button:disabled { opacity: .3; cursor: not-allowed; }
#demo-float-toolbar button:disabled:hover { background: transparent; }

#demo-panel {
  width: 260px; flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--border); padding: 24px 18px;
  display: flex; flex-direction: column; justify-content: flex-start; overflow-y: auto; max-height: 508px;
}
#demo-panel-empty { text-align: center; color: var(--text-soft); font-size: 13.5px; line-height: 1.5; margin: auto 0; }
#demo-panel-body { display: flex; flex-direction: column; gap: 16px; }
#demo-add-panel { text-align: left; }
.demo-panel-title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); font-weight: 700; }
.demo-panel-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.demo-swatches { display: flex; gap: 8px; }
.demo-swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; transition: box-shadow .15s var(--ease); }
.demo-swatches button.active { box-shadow: 0 0 0 2px var(--text); }
@keyframes demoAiProgress {
  0% { transform: translateX(-100%); width: 40%; }
  50% { width: 60%; }
  100% { transform: translateX(250%); width: 40%; }
}
.demo-align-btns { display: flex; gap: 6px; }
.demo-align-btns button { width: 32px; height: 32px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); cursor: pointer; color: var(--text-soft); transition: all .15s var(--ease); }
.demo-align-btns button.active { background: var(--text); color: #fff; border-color: var(--text); }
.demo-checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.demo-panel-hint { font-size: 12px; color: var(--text-soft); margin: 0; line-height: 1.5; }
.demo-panel-field label { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; margin-bottom: 7px; color: var(--text); }
.demo-icon-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.demo-icon-grid button {
  aspect-ratio: 1; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-soft); font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all .15s var(--ease);
}
.demo-icon-grid button:hover { border-color: var(--accent); color: var(--accent); background: rgba(255,90,45,.06); }

@media (max-width: 900px) {
  #demo-shell { flex-direction: column; }
  #demo-library-panel { width: auto; border-right: none; border-bottom: 1px solid var(--border); max-height: 240px; }
  #demo-editor-topbar { border-radius: var(--radius) var(--radius) 0 0; }
}

.demo-card { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; width: 128px; text-align: left; }
.demo-card .ic { color: var(--accent); margin-bottom: 6px; font-size: 15px; }
.demo-card b { display: block; color: var(--text); font-size: 12.5px; font-weight: 700; line-height: 1.3; }

#demo-add-block-row { padding: 16px 24px 20px; text-align: center; background: var(--surface); }
#demo-library-list { display: flex; flex-direction: column; gap: 6px; }
.demo-lib-item {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; font-weight: 600;
  color: var(--text); cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.demo-lib-item i { color: var(--accent); width: 16px; }
.demo-lib-item:hover { background: rgba(255,90,45,.05); border-color: var(--accent); transform: translateX(2px); }
.demo-block-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); font-weight: 700; margin-bottom: 12px; }
.demo-block-mini-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; min-width: 168px; flex-shrink: 0; }

@media (max-width: 760px) {
  #demo-shell { flex-direction: column; }
  #demo-panel { width: auto; border-left: none; border-top: 1px solid var(--border); max-height: none; }
}

/* ---------- SECTION HEADINGS ---------- */
.section { padding: 68px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 34px; gap: 20px; }
.section-head h2 { font-size: 32px; letter-spacing: -.025em; margin: 0 0 8px; font-weight: 800; }
.section-head p { color: var(--text-soft); margin: 0; font-size: 15px; }

/* ---------- CATEGORY CHIPS ---------- */
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 10px 18px; font-size: 14px; font-weight: 600; white-space: nowrap;
  display: flex; align-items: center; gap: 8px; transition: all .18s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ---------- SITE CARDS ---------- */
.sites-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.site-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease); display: flex; flex-direction: column;
}
.site-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); border-color: var(--border-strong); }
.site-thumb {
  aspect-ratio: 16/9; background: var(--gradient-soft);
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted);
  position: relative; overflow: hidden;
}
.site-thumb img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
  /* быстрее и с лёгким замедлением у конца — прокрутка успевает дойти до подвала */
  transition: object-position 2.4s ease-out;
}
.site-thumb:hover img { object-position: bottom center; transition-duration: 2.4s; }
.badge-free {
  position: absolute; top: 12px; left: 12px; background: var(--success); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill); letter-spacing: .02em;
}
.site-body { padding: 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.site-cat { font-size: 12px; color: var(--text-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.site-title { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.site-desc { font-size: 14px; color: var(--text-soft); margin: 0; flex: 1; }
.site-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 8px; flex-wrap: wrap; }
.site-footer .site-price { flex-shrink: 0; }
.site-footer > div { display: flex; gap: 6px; flex-shrink: 0; }
.site-price { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.site-price.free { color: var(--success); }

/* ---------- CATALOG LAYOUT ---------- */
.catalog-layout { display: grid; grid-template-columns: 260px 1fr; gap: 32px; align-items: start; }
.filters {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  position: sticky; top: 104px; display: flex; flex-direction: column; gap: 22px;
  /* Пункт 7: если категорий много, сама панель фильтров не должна вытягиваться на всю
     длину списка шаблонов — ограничиваем её высотой экрана, а внутренний список категорий
     получает собственную прокрутку (см. #filter-categories ниже). */
  max-height: calc(100vh - 124px);
  overflow-y: auto;
}
/* Список категорий — своя прокрутка, чтобы длинный перечень не распирал всю панель */
#filter-categories { max-height: 320px; overflow-y: auto; padding-right: 4px; }
#filter-categories::-webkit-scrollbar { width: 6px; }
#filter-categories::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.filter-block h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); margin: 0 0 12px; font-weight: 700; }
.filter-option { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.filter-option input { accent-color: var(--accent); width: 16px; height: 16px; }
.price-inputs { display: flex; gap: 10px; }
.price-inputs input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 10px; font-size: 14px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.price-inputs input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,90,45,.12); }
.search-box { position: relative; margin-bottom: 20px; }
.search-box input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 13px; padding: 14px 16px 14px 44px;
  font-size: 15px; background: var(--surface); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,90,45,.1); }
.search-box .ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-soft); }
.sort-select {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; font-weight: 600; background: var(--surface); transition: border-color .15s var(--ease);
}
.sort-select:focus { outline: none; border-color: var(--accent); }
.results-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.results-count { color: var(--text-soft); font-size: 14px; }

/* ---------- FOOTER ---------- */
.site-footer-main { border-top: 1px solid var(--border); padding: 52px 0 32px; margin-top: 80px; background: var(--surface-2); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer-grid h4 { font-size: 14px; margin: 0 0 14px; font-weight: 700; }
.footer-grid a { display: block; font-size: 14px; color: var(--text-soft); margin-bottom: 10px; transition: color .15s var(--ease); }
.footer-grid a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 20px; display: flex; justify-content: space-between; font-size: 13px; color: var(--text-soft); }

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(23,26,43,.5); backdrop-filter: blur(3px); display: none;
  align-items: center; justify-content: center; z-index: 1000; padding: 20px;
  animation: fadeIn .2s var(--ease);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 420px; padding: 32px;
  box-shadow: var(--shadow-lg); position: relative;
  animation: scaleIn .25s var(--ease);
}
.modal-close { position: absolute; top: 18px; right: 18px; background: none; border: none; font-size: 20px; color: var(--text-soft); transition: color .15s var(--ease); border-radius: 8px; padding: 4px; }
.modal-close:hover { color: var(--text); background: var(--surface-2); }
.modal h3 { font-size: 22px; margin: 0 0 8px; letter-spacing: -.02em; font-weight: 800; }
.modal p.sub { color: var(--text-soft); font-size: 14px; margin: 0 0 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease); background: var(--surface); color: var(--text);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,90,45,.1); }
.code-inputs { display: flex; gap: 8px; margin-bottom: 20px; }
.code-inputs input {
  width: 44px; height: 52px; text-align: center; font-size: 20px; font-weight: 700;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.code-inputs input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,90,45,.1); }
.hint { font-size: 13px; color: var(--text-soft); margin-top: 10px; }
.hint.error { color: var(--danger); }
.hint.success { color: var(--success); }

/* ---------- DASHBOARD / ADMIN SHARED ---------- */
.app-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 84px); }
.sidebar { border-right: 1px solid var(--border); padding: 24px 16px; background: var(--surface); }
.sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; color: var(--text-soft); margin-bottom: 4px; transition: all .15s var(--ease);
}
.sidebar a:hover { background: var(--surface-2); color: var(--text); }
.sidebar a.active { background: var(--text); color: #fff; }
.sidebar-badge {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px;
  border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; margin-left: auto;
}
.main-content { padding: 32px 40px; }
.page-title { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 800; }
.page-sub { color: var(--text-soft); margin: 0 0 28px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card .label { font-size: 13px; color: var(--text-soft); font-weight: 600; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); font-weight: 700; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
td { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr { transition: background .15s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
.tag { display: inline-flex; padding: 5px 11px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.tag-paid { background: var(--success-bg); color: var(--success); }
.tag-pending { background: var(--warning-bg); color: var(--warning); }
.tag-free { background: rgba(255,90,45,.12); color: var(--primary); }

.card-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; margin-bottom: 24px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row .field { margin-bottom: 0; }

/* ---------- EDITOR ---------- */
.editor-topbar {
  height: 60px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px; background: var(--surface); position: sticky; top: 0; z-index: 100000;
}
.editor-topbar .group { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--text-soft); transition: all .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn:disabled { opacity: .4; }
.editor-canvas { width: 100%; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.editable-section { position: relative; border-bottom: 1px dashed transparent; }
.editable-section:hover { outline: 2px solid rgba(255,90,45,.3); outline-offset: -2px; }
.section-toolbar {
  position: absolute; top: 8px; right: 8px; display: none; gap: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; box-shadow: var(--shadow); z-index: 10;
}
.editable-section:hover .section-toolbar { display: flex; }
.section-toolbar button { border: none; background: none; padding: 6px 8px; border-radius: 6px; font-size: 13px; transition: background .15s; }
.section-toolbar button:hover { background: var(--surface-2); }
.insert-divider { position: relative; height: 24px; display: flex; align-items: center; justify-content: center; }
.insert-divider::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.insert-plus {
  position: relative; z-index: 2; width: 28px; height: 28px; border-radius: 50%; background: var(--text); color: #fff;
  border: none; font-size: 16px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.insert-divider:hover .insert-plus { opacity: 1; transform: scale(1.08); }
[contenteditable="true"]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- CONTACT PANEL (главная, в конце страницы) ---------- */
.contact-panel {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 48px; box-shadow: var(--shadow);
}
.contact-panel-text { display: flex; flex-direction: column; justify-content: center; }
.contact-requisites { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 0; }
.contact-requisites a { color: var(--text-soft); text-decoration: underline; }
.contact-methods { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.contact-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.contact-row:hover { background: var(--surface-2); transform: translateX(3px); }
.contact-row:hover .contact-row-go { opacity: 1; transform: translate(0,0); }
.contact-ic {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; background: rgba(255,90,45,.1); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.contact-row-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.contact-row-text b { font-size: 14.5px; font-weight: 700; color: var(--text); }
.contact-row-text small { font-size: 13px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-row-go { margin-left: auto; font-size: 12px; color: var(--muted); opacity: 0; transform: translate(-4px,4px); transition: all .18s var(--ease); flex-shrink: 0; }

@media (max-width: 760px) {
  .contact-panel { grid-template-columns: 1fr; padding: 32px 24px; gap: 28px; }
  .contact-panel-text { text-align: left; }
  .contact-panel-text p[style*="max-width"] { max-width: none !important; }
}

@media (max-width: 900px) {
  .value-grid, .sites-grid { grid-template-columns: 1fr 1fr; }
  .catalog-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .app-layout { grid-template-columns: 1fr; }
  .hero h1 { font-size: 38px; }
}

/* Пункт 5: блок «сайт под ключ» (valkov-devsite) — на узких экранах колонки в стопку */
@media (max-width: 860px) {
  #custom .wrap > div { grid-template-columns: 1fr !important; gap: 26px !important; }
}

/* ==========================================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ (телефоны и планшеты)
   --------------------------------------------------------------------------
   Весь сайт — каталог, карточки шаблонов, страницы, тарифы, личный кабинет,
   обучение — должен нормально открываться и читаться с телефона.
   ИСКЛЮЧЕНИЕ: редактор сайта (editor.html) намеренно НЕ адаптируется —
   при ширине меньше 1024px он показывает заглушку «только на компьютере».
   Поэтому здесь нет и не должно быть правил для .editor-topbar, #canvas,
   панелей Zero-блоков и прочего инструментария редактора.
   ========================================================================== */

/* ---------- Бургер-меню в шапке ----------
   Раньше .nav оставалось display:flex на любой ширине: пункты меню наезжали
   на логотип и кнопку «Войти». Теперь на узких экранах меню сворачивается
   в кнопку-бургер и раскрывается выпадающей панелью. */
.nav-toggle {
  display: none;
  width: 42px; height: 42px; flex-shrink: 0;
  align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 17px;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.nav-toggle:hover { background: var(--surface-2); border-color: var(--border-strong); }

@media (max-width: 900px) {
  .nav-toggle { display: flex; }

  /* Выпадающая панель позиционируется от .wrap (top:100% = под шапкой),
     поэтому ему нужен собственный контекст позиционирования. */
  .site-header .wrap { height: 68px; gap: 12px; position: relative; }

  /* Меню превращается в выпадающую панель под шапкой.
     .wrap имеет боковые отступы (16px), поэтому растягиваем панель за их пределы
     отрицательными margin — иначе она была бы уже шапки и «висела» бы по центру. */
  .nav {
    display: none;
    position: absolute; left: -16px; right: -16px; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    max-height: calc(100vh - 68px);
    overflow-y: auto;
  }
  .nav.open { display: flex; }
  .nav a {
    padding: 14px 24px;
    font-size: 15.5px;
    border-bottom: 1px solid var(--border);
  }
  .nav a:last-child { border-bottom: none; }
  .nav a.active { color: var(--accent); }

  /* Кнопка «Войти» / имя пользователя остаётся видимой рядом с бургером */
  .header-actions { gap: 8px; }
}

@media (max-width: 420px) {
  /* На самых узких экранах прячем подпись у кнопки входа, чтобы шапка не ломалась */
  .header-actions .btn { padding: 8px 12px; font-size: 12.5px; }
}

/* ---------- Общие отступы и типографика ---------- */
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .section { padding: 44px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 24px; }
  .section-head h2 { font-size: 24px; }
  .section-head p { font-size: 14px; }
  .hero h1 { font-size: 28px; }
  .hero .lead { font-size: 15px; }

  /* Кнопки-действия в hero: в столбик и во всю ширину — по ним проще попасть пальцем */
  .hero-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-actions .btn { width: 100%; }
  .btn-lg { padding: 14px 20px; font-size: 15px; }
}

/* ---------- Сетки карточек ----------
   На 900px они становятся 2 колонками (правило выше), а ниже 640px карточки
   уже слишком узкие — разворачиваем в одну колонку. */
@media (max-width: 640px) {
  .value-grid, .sites-grid { grid-template-columns: 1fr; }
  .hero-features-row { grid-template-columns: 1fr; gap: 18px; }
  .trust-stats-grid { grid-template-columns: 1fr 1fr; gap: 18px; }
}

/* Блок «Из чего складывается стоимость» на главной — две карточки в стопку.
   Сетка задана инлайн-стилем, поэтому переопределяем через !important. */
@media (max-width: 760px) {
  .pricing-parts-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
}

/* ---------- Каталог: фильтры ----------
   Панель фильтров на телефоне не должна быть липкой и занимать пол-экрана —
   она встаёт обычным блоком над списком шаблонов. */
@media (max-width: 900px) {
  .filters {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 18px;
    gap: 18px;
  }
  #filter-categories { max-height: 210px; }
  .results-bar { flex-wrap: wrap; gap: 10px; }
  .sort-select { width: 100%; }
}

/* ---------- Личный кабинет и админка ----------
   .app-layout уже разворачивается в одну колонку на 900px — здесь приводим
   в порядок боковое меню и внутренние отступы. */
@media (max-width: 900px) {
  .app-layout { min-height: 0; }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
    display: flex; flex-wrap: wrap; gap: 6px;
    position: sticky; top: 68px; z-index: 50;
  }
  .sidebar a { margin-bottom: 0; padding: 9px 13px; font-size: 13.5px; }
  .main-content { padding: 22px 16px; }
  .page-title { font-size: 21px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .card-form { padding: 18px; }
}

@media (max-width: 460px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card .value { font-size: 24px; }
}

/* ---------- Таблицы ----------
   Таблицы заявок/заказов шире экрана телефона. Оборачиваем в горизонтальную
   прокрутку, чтобы они не растягивали всю страницу вбок. */
@media (max-width: 760px) {
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-card table { min-width: 560px; }
  th, td { padding: 11px 13px; font-size: 13px; }
}

/* ---------- Модальные окна ----------
   На телефоне модалка должна помещаться в экран и прокручиваться внутри себя,
   иначе нижние кнопки («Продолжить», «Понятно») оказываются недоступны. */
@media (max-width: 560px) {
  .modal-overlay { padding: 12px; align-items: flex-start; }
  .modal {
    padding: 24px 20px;
    margin: 12px 0;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }
  .modal h3 { font-size: 19px; padding-right: 28px; }
  .modal p.sub { font-size: 13.5px; }
}

/* iOS Safari автоматически «зумит» страницу при фокусе на поле, если размер шрифта
   в нём меньше 16px — после этого вёрстка выглядит увеличенной и сдвинутой.
   Поэтому на телефоне у всех полей ввода минимум 16px. */
@media (max-width: 760px) {
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="tel"], input[type="search"],
  textarea, select,
  .field input, .field textarea, .field select,
  .search-box input, .price-inputs input, .sort-select {
    font-size: 16px;
  }
}

/* ---------- Подвал ---------- */
@media (max-width: 600px) {
  .site-footer-main { padding: 36px 0 24px; margin-top: 48px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; margin-bottom: 24px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: left; }
}

/* ---------- Мелочи, зависящие от касаний ---------- */
@media (hover: none) {
  /* Ховер-эффекты на телефоне «залипают» после тапа — отключаем сдвиги.
     Прокрутка превью карточки шаблона по ховеру на тач-экране тоже не нужна. */
  .site-card:hover { transform: none; }
  .value-card:hover { transform: none; }
  .stat-card:hover { transform: none; }
  .contact-row:hover { transform: none; }
  .site-thumb:hover img { object-position: top center; }
}
