/* ==========================================================================
   AllForm — контентные SEO-страницы
   Шаблоны, база знаний и калькулятор выборки. Подключается после styles.css
   и использует его токены: палитра и типографика здесь не переопределяются.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Каркас страницы
   -------------------------------------------------------------------------- */

.page-main {
  padding-bottom: clamp(56px, 7vw, 96px);
}

.page-hero {
  padding: clamp(20px, 3vw, 32px) 0 clamp(28px, 4vw, 44px);
}

.page-hero h1 {
  max-width: 24ch;
  margin-top: 14px;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.03;
  letter-spacing: -0.035em;
}

.page-lead {
  max-width: 66ch;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.6;
}

.page-lead a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Хлебные крошки */

.crumbs {
  padding-top: 18px;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  list-style: none;
}

.crumbs li {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.crumbs li + li::before {
  content: "/";
  color: var(--line-strong);
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.crumbs [aria-current="page"] {
  color: var(--ink);
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Контентная сетка
   -------------------------------------------------------------------------- */

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  padding-top: 8px;
}

.page-content {
  min-width: 0;
}

.page-aside {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 96px;
}

@media (max-width: 900px) {
  .page-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-aside {
    position: static;
    order: 2;
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --------------------------------------------------------------------------
   Текстовые блоки
   -------------------------------------------------------------------------- */

.prose {
  max-width: 68ch;
  overflow-wrap: anywhere;
}

.prose p {
  color: var(--ink);
  font-size: 16.5px;
  line-height: 1.65;
}

.prose p + p {
  margin-top: 16px;
}

.prose h2 {
  margin-top: 36px;
  margin-bottom: 14px;
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose h3 {
  margin-top: 26px;
  margin-bottom: 10px;
  font-size: 1.15rem;
}

.prose ul {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-left: 22px;
  list-style: disc;
}

.prose li {
  padding-left: 2px;
  font-size: 16.5px;
  line-height: 1.6;
}

.prose li::marker {
  color: var(--accent);
}

.prose a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--accent);
}

.prose strong {
  font-weight: 700;
}

.content-block {
  margin-top: clamp(32px, 4vw, 44px);
}

.content-block h2 {
  max-width: 26ch;
  font-size: clamp(1.45rem, 2.6vw, 1.95rem);
}

.content-block__note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

/* Список «Кому подойдёт» */

.check-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  max-width: 68ch;
}

.check-list li {
  position: relative;
  padding-left: 30px;
  font-size: 16px;
  line-height: 1.55;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.28em;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

.check-list li::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 0.52em;
  width: 5px;
  height: 9px;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* --------------------------------------------------------------------------
   Карточки-списки: шаблоны и статьи
   -------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
  margin-top: 18px;
  list-style: none;
}

.card-grid--three {
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
}

.info-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.info-card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.info-card__title {
  font-size: 1.08rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.info-card__title a {
  text-decoration: none;
}

.info-card__title a:hover {
  color: var(--accent-dark);
}

.info-card__desc {
  flex-grow: 1;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.info-card__meta {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.info-card__link {
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 650;
}

.info-card__link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Категории на хабах */

.cat-block {
  padding-top: clamp(28px, 4vw, 40px);
  border-top: 1px solid var(--line);
}

.cat-block + .cat-block {
  margin-top: clamp(32px, 4vw, 44px);
}

.cat-block:first-of-type {
  border-top: 0;
  padding-top: 8px;
}

.cat-block__head {
  max-width: 72ch;
}

.cat-block__head h2 {
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
}

.cat-block__head p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.55;
}

.related {
  margin-top: clamp(40px, 5vw, 56px);
  padding-top: clamp(28px, 4vw, 40px);
  border-top: 1px solid var(--line);
}

.related h2,
.section-heading h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
}

/* --------------------------------------------------------------------------
   Превью вопросов
   -------------------------------------------------------------------------- */

.q-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  counter-reset: question;
  list-style: none;
}

.q-item {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.q-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.q-item__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.q-item__optional {
  color: var(--muted);
  font-size: 12px;
}

.q-item__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
}

.q-item__detail {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.q-options {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-left: 0;
  list-style: none;
}

.q-options li {
  position: relative;
  padding-left: 24px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.q-options li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.45em;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
}

/* --------------------------------------------------------------------------
   FAQ
   -------------------------------------------------------------------------- */

.faq-list {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  max-width: 72ch;
}

.faq-item {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.faq-item h3 {
  font-size: 1.05rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.faq-item p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Боковая колонка
   -------------------------------------------------------------------------- */

.aside-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.aside-card--accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.aside-card__label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.aside-card--accent .aside-card__label {
  color: var(--accent-dark);
}

.aside-card__text {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.aside-card .btn {
  margin-top: 16px;
}

.aside-card .btn + .btn {
  margin-top: 8px;
}

.aside-card__note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.aside-card__link {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 650;
}

.aside-card__link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.aside-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  list-style: none;
}

.aside-list a {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.aside-list a:hover {
  color: var(--accent-dark);
  text-decoration-color: currentColor;
}

/* --------------------------------------------------------------------------
   Финальный CTA
   -------------------------------------------------------------------------- */

.cta-simple {
  position: relative;
  overflow: hidden;
  margin-top: clamp(48px, 6vw, 72px);
  padding: clamp(28px, 4.5vw, 52px);
  border-radius: var(--radius-xl);
  background: var(--accent);
  color: #fff;
}

.cta-simple::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -100px;
  width: 380px;
  height: 380px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  pointer-events: none;
}

.cta-simple h2 {
  max-width: 22ch;
  margin-top: 14px;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
}

.cta-simple p:not(.eyebrow) {
  max-width: 58ch;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 16px;
  line-height: 1.6;
}

.cta-simple__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.cta-simple__ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.cta-simple__ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.cta-simple__ghost:focus-visible {
  outline-color: #fff;
}

/* --------------------------------------------------------------------------
   Калькулятор выборки
   -------------------------------------------------------------------------- */

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(20px, 3vw, 32px);
  align-items: start;
}

.calc-card {
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.calc-card__title {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  letter-spacing: -0.02em;
}

.calc-field {
  margin: 24px 0 0;
  padding: 0;
  border: 0;
}

.calc-field > label,
.calc-field legend {
  display: block;
  margin-bottom: 10px;
  padding: 0;
  font-size: 14px;
  font-weight: 650;
}

.calc-field output {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.calc-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* Радиокнопки «90 / 95 / 99» */

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented label {
  position: relative;
  display: inline-flex;
  min-width: 78px;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.segmented label:hover span {
  border-color: #b9b9ad;
}

.segmented input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.segmented input:focus-visible + span {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Ползунок погрешности */

input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

input[type="number"]:focus {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
  outline-offset: 0;
}

input[type="number"]:disabled {
  background: #f0f0eb;
  color: var(--muted);
  cursor: not-allowed;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.45;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Результат */

.calc-result {
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}

.calc-result__label {
  color: var(--accent-dark);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.calc-result__value {
  margin-top: 6px;
  color: var(--accent-dark);
  font-size: clamp(3rem, 8vw, 4.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.calc-result__note {
  margin-top: 12px;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
}

.calc-result__hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.calc-result .btn {
  margin-top: 18px;
}

.calc-result .btn + .btn {
  margin-top: 8px;
}

.calc-result .btn--ghost {
  color: var(--accent-dark);
}

.calc-result .btn--ghost:hover {
  background: rgba(36, 80, 230, 0.08);
  color: var(--accent-dark);
}

/* Таблица-справочник */

.table-scroll {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  -webkit-overflow-scrolling: touch;
}

.calc-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}

.calc-table caption {
  padding: 14px 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
}

.calc-table th,
.calc-table td {
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.calc-table thead th {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.calc-table tbody th {
  color: var(--ink);
  font-weight: 650;
  text-align: left;
}

.calc-table td {
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Адаптив
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .calc-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .page-main {
    padding-bottom: 56px;
  }

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

  .page-hero h1 {
    max-width: none;
    font-size: clamp(1.75rem, 8vw, 2.4rem);
  }

  .page-lead {
    font-size: 16px;
  }

  .info-card,
  .q-item,
  .faq-item,
  .aside-card {
    padding: 18px;
  }

  .card-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .cta-simple {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }

  .cta-simple__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-simple__actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .crumbs {
    padding-top: 12px;
  }

  .crumbs [aria-current="page"] {
    max-width: 60vw;
  }

  .calc-card,
  .calc-result {
    padding: 20px 18px;
    border-radius: var(--radius-md);
  }

  .calc-result__value {
    font-size: clamp(2.6rem, 16vw, 3.4rem);
  }

  .segmented label {
    min-width: 0;
  }

  .segmented span {
    padding-inline: 12px;
  }

  .q-item__head {
    gap: 6px;
  }
}
