/* =========================================================
   Clip-Lending base styles — общий для osobiy-doctor.ru
   и novaya-ulybka-msk.ru. Тема переключается классом
   на <body>: theme-alexey | theme-viktor
   ========================================================= */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--c-link-hover); }

/* === ТЕМЫ ============================================== */

body.theme-alexey {
  --c-bg: #f6f1ea;
  --c-bg-card: #ffffff;
  --c-bg-dark: #1c1916;
  --c-text: #1c1916;
  --c-text-muted: #6b5e51;
  --c-text-inverse: #f6f1ea;
  --c-accent: #8c2a26;        /* бордо */
  --c-accent-soft: #d9b8a1;
  --c-link: #8c2a26;
  --c-link-hover: #5e1c19;
  --c-border: #d9cdbf;
  --c-table-stripe: #ede4d6;
  --font-heading: "Inter", "Segoe UI", Arial, sans-serif;
  --font-weight-h: 800;
  --radius: 4px;
}

body.theme-viktor {
  --c-bg: #f4f3f0;
  --c-bg-card: #ffffff;
  --c-bg-dark: #0f1a2b;
  --c-text: #1a1f2d;
  --c-text-muted: #5b6478;
  --c-text-inverse: #f4f3f0;
  --c-accent: #1f3a68;        /* тёмно-синий */
  --c-accent-soft: #c4cdd9;
  --c-link: #1f3a68;
  --c-link-hover: #11264a;
  --c-border: #d0d6df;
  --c-table-stripe: #e9ecf1;
  --font-heading: "Inter", "Segoe UI", Arial, sans-serif;
  --font-weight-h: 600;
  --radius: 2px;
}

/* === КОНТЕЙНЕР ========================================= */

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}
.container--wide { max-width: 920px; }

/* === ШАПКА ============================================= */

.site-header {
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg-card);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-header__brand {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-h);
  font-size: 18px;
  color: var(--c-text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-header__phone {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 17px;
  color: var(--c-accent);
  text-decoration: none;
  white-space: nowrap;
}
.site-header__phone:hover { color: var(--c-link-hover); }

/* Минимальный header — для страниц истории (без брендинга и телефона) */
.site-header--minimal {
  padding: 10px 0;
  background: transparent;
  border-bottom: 1px solid var(--c-border);
}
.site-header--minimal .site-header__row {
  justify-content: center;
}
.site-header__label {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}

/* === ТИПОГРАФИКА ====================================== */

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-h);
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 0 0 14px;
  color: var(--c-text);
}
h1 { font-size: clamp(24px, 4vw, 36px); margin-top: 28px; }
h1.hero { font-size: clamp(28px, 5vw, 44px); line-height: 1.1; margin-top: 36px; }
h2 { font-size: clamp(20px, 3vw, 26px); margin-top: 32px; }
h3 { font-size: clamp(18px, 2.2vw, 21px); margin-top: 24px; font-weight: 700; }
p { margin: 0 0 18px; }
blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--c-accent);
  font-style: italic;
  color: var(--c-text-muted);
}

/* Крючок — переходный «клиффхэнгер» между блоками */
p.hook {
  margin: 28px 0;
  padding: 14px 20px;
  background: var(--c-bg-card);
  border-left: 3px solid var(--c-accent);
  font-size: 17px;
  font-weight: 500;
  color: var(--c-text);
  line-height: 1.45;
}

.subtitle {
  font-size: clamp(18px, 2.4vw, 22px);
  color: var(--c-text-muted);
  margin: -8px 0 24px;
  line-height: 1.4;
}
.meta-line {
  font-size: 14px;
  color: var(--c-text-muted);
  margin-bottom: 32px;
  letter-spacing: 0.02em;
}
.anchor-note {
  font-size: 14px;
  color: var(--c-text-muted);
  margin-top: 32px;
  padding: 16px 20px;
  border-left: 3px solid var(--c-border);
  background: var(--c-bg-card);
  line-height: 1.5;
}

/* === КНОПКИ =========================================== */

.btn {
  display: inline-block;
  padding: 18px 36px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  text-align: center;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
  letter-spacing: 0.01em;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--c-bg-dark);
  color: var(--c-text-inverse);
}
.btn--primary:hover { opacity: 0.88; }
.btn--accent {
  background: var(--c-accent);
  color: #fff;
}
.btn--accent:hover { opacity: 0.9; }
.btn--block { display: block; width: 100%; }
.btn--big { padding: 22px 40px; font-size: 19px; }

.cta-wrap {
  margin: 48px 0;
  text-align: center;
}

/* === ЗАГЛУШКИ ДЛЯ ФОТО ================================= */

.fig {
  margin: 28px 0;
  text-align: center;
}
.fig img {
  width: 100%;
  max-height: 56vh;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--c-border);
}
.fig figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--c-text-muted);
  line-height: 1.4;
  text-align: center;
}

.fig-placeholder {
  margin: 32px 0;
}
.fig-placeholder__box {
  background: repeating-linear-gradient(
    45deg,
    var(--c-border),
    var(--c-border) 10px,
    var(--c-bg-card) 10px,
    var(--c-bg-card) 20px
  );
  border: 2px dashed var(--c-text-muted);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--c-text-muted);
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}
.fig-placeholder__icon {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  margin-bottom: 12px;
  opacity: 0.7;
}
.fig-placeholder__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 6px;
  word-break: break-all;
}
.fig-placeholder__hint {
  font-size: 13px;
  line-height: 1.4;
  max-width: 480px;
  margin: 0 auto;
  font-family: var(--font-heading);
}

/* === ТАБЛИЦА СРАВНЕНИЯ ================================= */

.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 32px 0;
  font-size: 15px;
  background: var(--c-bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--c-border);
}
.compare-table th, .compare-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.compare-table thead th {
  background: var(--c-bg-dark);
  color: var(--c-text-inverse);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.compare-table tbody tr:nth-child(even) { background: var(--c-table-stripe); }
.compare-table td:first-child {
  font-weight: 600;
  width: 32%;
}
.compare-table td.cell-win {
  color: var(--c-accent);
  font-weight: 700;
}

/* === ОФФЕР ============================================= */

.offer {
  margin: 56px 0 24px;
  padding: 36px 28px;
  background: var(--c-bg-dark);
  color: var(--c-text-inverse);
  border-radius: var(--radius);
}
.offer h2 {
  color: var(--c-text-inverse);
  margin-top: 0;
  font-size: clamp(22px, 3vw, 30px);
}
.offer ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.offer ul li {
  padding: 10px 0 10px 28px;
  position: relative;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.offer ul li:last-child { border-bottom: none; }
.offer ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 10px;
  color: var(--c-accent-soft);
  font-weight: 700;
}
.offer-note {
  margin-top: 20px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.08);
  border-left: 3px solid var(--c-accent-soft);
  font-size: 15px;
  line-height: 1.5;
}

.filter-out {
  margin: 32px 0;
  padding: 24px 28px;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.filter-out h3 { margin-top: 0; font-size: 18px; }
.filter-out ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.filter-out ul li {
  padding: 8px 0 8px 24px;
  position: relative;
  font-size: 15px;
  color: var(--c-text-muted);
  line-height: 1.5;
}
.filter-out ul li::before {
  content: "✗";
  position: absolute;
  left: 0;
  top: 8px;
  color: var(--c-text-muted);
  font-weight: 700;
}

/* === ФОРМА КВИЗА ====================================== */

.quiz {
  margin: 40px 0;
  padding: 32px 28px;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.quiz h2 { margin-top: 0; }
.quiz__intro {
  margin: -8px 0 28px;
  color: var(--c-text-muted);
  font-size: 15px;
}
.quiz__q {
  margin: 24px 0;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--c-border);
}
.quiz__q:last-of-type { border-bottom: none; }
.quiz__q legend {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 12px;
  color: var(--c-text);
  padding: 0;
}
.quiz__q label {
  display: block;
  padding: 8px 0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.45;
}
.quiz__q input[type="radio"] {
  margin-right: 10px;
  vertical-align: middle;
  accent-color: var(--c-accent);
}
.quiz__q input[type="text"] {
  display: block;
  margin: 8px 0 0;
  padding: 10px 14px;
  width: 100%;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--c-bg);
}

.field {
  margin: 16px 0;
}
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field input[type="text"],
.field input[type="tel"] {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--c-bg);
}
.field input:focus {
  outline: 2px solid var(--c-accent);
  outline-offset: 1px;
  border-color: var(--c-accent);
}

.consent {
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-text-muted);
}
.consent input[type="checkbox"] {
  margin-right: 8px;
  vertical-align: middle;
  accent-color: var(--c-accent);
}

.quiz__post {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--c-border);
  font-size: 14px;
  color: var(--c-text-muted);
  line-height: 1.55;
}
.quiz__post ul { padding-left: 20px; }
.quiz__post li { margin-bottom: 6px; }

/* === ФУТЕР ============================================= */

.site-footer {
  margin-top: 72px;
  padding: 32px 0;
  border-top: 1px solid var(--c-border);
  background: var(--c-bg-card);
  font-size: 14px;
  color: var(--c-text-muted);
  line-height: 1.55;
}
.site-footer__row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  justify-content: space-between;
}
.site-footer__col p { margin: 0 0 4px; }
.site-footer a { color: var(--c-text-muted); }

/* Минимальный footer — без реквизитов, только политика+соглашение */
.site-footer--minimal {
  margin-top: 48px;
  padding: 18px 0;
  font-size: 13px;
}
.site-footer--minimal .site-footer__row {
  justify-content: center;
  text-align: center;
}
.site-footer--minimal p { margin: 0; }

/* === THANKS PAGE ====================================== */

.thanks {
  text-align: center;
  padding: 80px 0 40px;
}
.thanks__icon {
  display: inline-block;
  width: 64px;
  height: 64px;
  line-height: 64px;
  background: var(--c-accent);
  color: #fff;
  border-radius: 50%;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 24px;
}
.thanks h1 {
  margin-top: 0;
  font-size: clamp(26px, 4vw, 36px);
}

/* === Визитка врача — «Знакомство с Кареном» === */
.doctor-bizcard {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 22px;
  align-items: center;
  margin: 24px 0 32px;
  padding: 20px;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.doctor-bizcard__photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  background: var(--c-border);
}
.doctor-bizcard__name {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-h);
  font-size: clamp(20px, 2.5vw, 24px);
  margin: 0 0 4px;
  color: var(--c-text);
  line-height: 1.2;
}
.doctor-bizcard__title {
  font-size: 14px;
  color: var(--c-text-muted);
  margin: 0 0 14px;
  line-height: 1.4;
}
.doctor-bizcard__rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 18px;
  font-size: 13px;
  line-height: 1.45;
}
.doctor-bizcard__rows > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.doctor-bizcard__row-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}
.doctor-bizcard__row-val {
  font-size: 14px;
  color: var(--c-text);
}
@media (max-width: 640px) {
  .doctor-bizcard {
    grid-template-columns: 84px 1fr;
    gap: 14px;
    padding: 14px;
  }
  .doctor-bizcard__photo {
    width: 84px;
    height: 84px;
  }
  .doctor-bizcard__rows {
    grid-template-columns: 1fr;
  }
}

/* === Финальный CTA-блок «Запишитесь на консультацию» (на system.html) === */
.cta-final {
  margin: 48px 0 24px;
  background: var(--c-bg-dark);
  color: var(--c-text-inverse);
  border-radius: var(--radius);
  padding: 0;
}
.cta-final__inner {
  padding: 36px 32px 32px;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}
.cta-final__title {
  color: var(--c-text-inverse);
  font-size: clamp(22px, 3vw, 28px);
  margin: 0 0 12px;
  line-height: 1.2;
}
.cta-final__sub {
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.55;
  margin: 0 0 22px;
  color: rgba(255,255,255,0.85);
}
.cta-final__sub strong { color: #fff; }
.cta-final__bonuses {
  list-style: none;
  padding: 0;
  margin: 0 0 26px;
  text-align: left;
  display: inline-block;
}
.cta-final__bonuses li {
  padding: 7px 0;
  font-size: 15px;
  line-height: 1.45;
  color: rgba(255,255,255,0.92);
}
.cta-final__bullet {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  margin-right: 10px;
  background: var(--c-accent);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  vertical-align: middle;
}
.cta-final .btn--accent {
  padding: 20px 40px;
  font-size: 18px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}
.cta-final__note {
  margin: 18px 0 0;
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
}

/* === МОДАЛ КВИЗА — открывается по кнопке «Забронировать консультацию» */

.quiz-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 18, 0.7);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 24px 16px;
  animation: quizModalFadeIn 0.18s ease;
}
.quiz-modal.is-open { display: flex; }
.quiz-modal__panel {
  position: relative;
  background: var(--c-bg);
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  margin: auto;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.quiz-modal__panel .quiz-stepper {
  margin: 0;
  border: none;
}
.quiz-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.06);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  line-height: 36px;
  cursor: pointer;
  color: var(--c-text);
  z-index: 2;
  transition: background 0.15s;
}
.quiz-modal__close:hover { background: rgba(0,0,0,0.12); }
body.is-quiz-open { overflow: hidden; }

@keyframes quizModalFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* CTA-кнопка «Забронировать консультацию» — варианты */
.btn--book {
  background: var(--c-accent);
  color: #fff;
}
.btn--book:hover { opacity: 0.92; }

/* Sticky-CTA в нижнем правом углу (опционально) */
.cta-floating {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
@media (max-width: 640px) {
  .cta-floating {
    bottom: 12px;
    right: 12px;
    left: 12px;
    text-align: center;
  }
  .quiz-modal { padding: 12px 8px; }
}

/* === ПОШАГОВЫЙ КВИЗ (один вопрос на экран) ============= */

.quiz-stepper {
  margin: 40px 0;
  padding: 32px 28px;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

.quiz-stepper__head {
  margin-bottom: 20px;
}
.quiz-stepper__progress {
  height: 6px;
  background: var(--c-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.quiz-stepper__progress-bar {
  height: 100%;
  background: var(--c-accent);
  width: 0;
  transition: width 0.3s ease;
}
.quiz-stepper__counter {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  text-transform: uppercase;
}

.quiz-step { display: none; }
.quiz-step.is-active { display: block; }

.quiz-step__title {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-h);
  font-size: clamp(20px, 2.6vw, 24px);
  line-height: 1.25;
  margin: 0 0 8px;
  color: var(--c-text);
}
.quiz-step__hint {
  font-size: 14px;
  color: var(--c-text-muted);
  margin: 0 0 20px;
  line-height: 1.4;
}
.quiz-step__image {
  margin: 0 0 20px;
  text-align: center;
}
.quiz-step__image img {
  max-width: 100%;
  max-height: 36vh;
  border-radius: var(--radius);
  display: inline-block;
}

.quiz-options {
  display: grid;
  gap: 10px;
}
.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-bg);
  cursor: pointer;
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 0.1s, background 0.1s;
}
.quiz-option:hover { border-color: var(--c-accent-soft); }
.quiz-option input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--c-accent);
  flex-shrink: 0;
}
.quiz-option:has(input:checked) {
  border-color: var(--c-accent);
  background: var(--c-bg-card);
}
.quiz-option__text { flex: 1; }
.quiz-option__other {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--c-bg);
}

.quiz-step__nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}
.quiz-step__nav .btn { padding: 14px 26px; font-size: 16px; }
.quiz-step__nav .btn--secondary {
  background: transparent;
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
}
.quiz-step__nav .btn--secondary:hover {
  color: var(--c-text);
  border-color: var(--c-text-muted);
}
.quiz-step__nav .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.quiz-step--final .field { margin: 14px 0; }
.quiz-step--final .consent { margin: 16px 0; font-size: 13px; }

/* === МОБИЛЬНЫЕ ПРАВКИ ================================== */

@media (max-width: 640px) {
  body { font-size: 17px; }
  .container { padding: 0 16px; }
  .site-header__brand { font-size: 16px; }
  .site-header__phone { font-size: 15px; }
  .offer, .quiz, .filter-out, .quiz-stepper { padding: 24px 20px; }
  .compare-table { font-size: 14px; }
  .compare-table th, .compare-table td { padding: 10px 8px; }
  .btn { padding: 16px 24px; font-size: 16px; }
  .btn--big { padding: 18px 28px; font-size: 17px; }
  .fig img { max-height: 50vh; }
  .quiz-option { padding: 14px 14px; font-size: 15px; }
  p.hook { font-size: 16px; padding: 12px 16px; }
}
