/* Страницы расширений 1С — layout и калькулятор (.ext-page, токены в styles.css + tailwind.config.js) */

.ext-page {
  --ext-section-gap: 30px;
  --ext-stream-gap: 30px;
}

/* content-visibility убран: давал CLS при раскрытии секций с feature-grid */

/* --- Поток блоков в секции --- */
.ext-page :is(.container.section-body, .section > .container > .section-body:not(.ext-richtext)) {
  display: flex;
  flex-direction: column;
  gap: var(--ext-stream-gap);
}

.ext-page .ext-blocks-stack {
  display: block;
}

.ext-page :is(.container.section-body, .section > .container > .section-body:not(.ext-richtext)) > :is(
  .ext-slider,
  .ext-video-block,
  .expandable,
  .info-banner,
  .ext-image-figure,
  .ext-blocks-stack
) {
  margin: 0;
}

.ext-page :is(.container.section-body, .section > .container > .section-body:not(.ext-richtext)) > :is(.ext-slider, .ext-video-block) {
  margin-left: auto;
  margin-right: auto;
}

.ext-page .section > .container > .section-body:not(.ext-richtext) > .expandable + .expandable {
  margin-top: calc(12px - var(--ext-stream-gap));
}

.ext-page :is(
  .ext-blocks-stack > .illustration-block:not(:last-child),
  .ext-blocks-stack > .step-text-row:not(:last-child),
  .section > .container > .section-body:not(.ext-richtext) > .illustration-block:not(:last-child),
  .container.section-body > .illustration-block:not(:last-child),
  .step-block > .illustration-block:not(:last-child),
  .step-block > .step-text-row:not(:last-child)
) {
  margin-bottom: var(--ext-stream-gap) !important;
}

.ext-page :is(
  .ext-blocks-stack > .illustration-block,
  .ext-blocks-stack > .step-text-row,
  .section > .container > .section-body:not(.ext-richtext) > .illustration-block,
  .container.section-body > .illustration-block,
  .step-block > .illustration-block,
  .step-block > .step-text-row
) {
  margin-top: 0;
}

/* --- Заголовки по центру (кроме hero) --- */
.ext-page :is(
  .section-title,
  .section-subtitle,
  .section-lead,
  .ext-block-heading,
  .ext-heading-h3,
  .ext-heading-h4,
  .section-body > h2,
  .section-body > h3,
  .section-body > h4,
  .ext-richtext > h2,
  .ext-richtext > h3,
  .ext-richtext > h4,
  .step-body > h2,
  .step-body > h3,
  .step-body > h4,
  .step-header,
  .illustration-text > h2,
  .illustration-text > h3,
  .illustration-text > h4,
  .step-text-row > h2,
  .step-text-row > h3,
  .step-text-row > h4,
  .steps-section .section-title,
  .contact-block h2
) {
  text-align: center;
}

.ext-page :is(.section-title, .ext-block-heading.section-title) {
  margin-bottom: 12px;
}

.ext-page .section > .container > .section-title[data-aos] {
  margin-bottom: 30px;
}

.ext-page .section > .container > .section-title + :is(.section-body, .section-lead, .section-subtitle),
.ext-page .section > .container > .section-body > *:first-child {
  margin-top: 0;
}

.ext-page :is(.ext-heading-h3, .ext-heading-h4) {
  margin-left: auto;
  margin-right: auto;
}

/* --- Слайдер, шаги, отступы секций --- */
.ext-page .ext-slider {
  margin: 0 auto;
  padding: 22px 22px 16px;
}

.ext-page .ext-slider-slide {
  padding: 16px 16px 0;
}

.ext-page .ext-slider-caption {
  margin: 10px 0 0;
  padding-bottom: 0;
}

.ext-page .ext-slider-slide:last-child .ext-slider-caption:last-child {
  margin-bottom: 0;
}

.ext-page .illustration-block {
  margin: 0;
}

.ext-page .step-block > :is(.step-body, .step-header) + :is(.illustration-block, .step-text-row) {
  margin-top: var(--ext-stream-gap) !important;
}

.ext-page .steps-section .step-block {
  margin-bottom: var(--ext-stream-gap);
}

.ext-page .steps-section .step-block:last-child {
  margin-bottom: 0;
}

.ext-page .section + .section {
  margin-top: var(--ext-section-gap);
}

.ext-page #pricing.section--compact + .section.steps-section {
  margin-top: var(--ext-section-y-junction);
}

@media (max-width: 768px) {
  .ext-page {
    --ext-section-gap: 24px;
  }
}

/* --- Калькулятор заказа (OneSCalculatorBlock) --- */
.ext-page .calc-wrap {
  max-width: 720px;
  margin: 0 auto;
  background: var(--ext-bg-elevated);
  border: 1px solid var(--ext-border);
  border-radius: 24px;
  box-shadow: var(--ext-shadow-sm);
  overflow: hidden;
}

.ext-page .calc-title {
  padding: 20px 24px 6px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ext-heading);
}

.ext-page .calc-section {
  padding: 16px 24px;
}

.ext-page .calc-section--first {
  padding-top: 20px;
}

.ext-page .calc-border-top {
  border-top: 1px solid var(--ext-border);
}

.ext-page .calc-label {
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ext-muted);
}

.ext-page .calc-label-highlight {
  font-weight: 700;
  color: var(--ext-accent);
}

.ext-page .calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.ext-page .config-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  border: 2px solid var(--ext-border);
  border-radius: 16px;
  background: var(--ext-bg-elevated);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.ext-page .config-card:hover {
  border-color: var(--ext-accent-hover-border);
  box-shadow: 0 4px 12px var(--ext-accent-ring);
}

.ext-page .config-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
}

.ext-page .config-icon img {
  max-width: 100%;
  max-height: 100%;
}

.ext-page .config-icon i {
  font-size: 1.85rem;
  line-height: 1;
  color: var(--ext-icon);
}

.ext-page .config-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: var(--ext-text);
}

.ext-page .calc-services {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ext-page .calc-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--ext-text);
  cursor: pointer;
}

.ext-page .calc-checkbox input[type="checkbox"] {
  display: none;
}

.ext-page .calc-checkbox-mark {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--ext-border);
  border-radius: 4px;
  transition: all 0.2s;
}

.ext-page .calc-checkbox input:checked + .calc-checkbox-mark {
  background: var(--ext-bg-elevated);
  border-color: var(--ext-accent);
}

.ext-page .calc-checkbox input:checked + .calc-checkbox-mark::after {
  content: '✓';
  font-size: 13px;
  font-weight: 700;
  color: var(--ext-accent);
}

.ext-page .calc-checkbox:hover .calc-checkbox-mark {
  border-color: var(--ext-accent);
}

.ext-page .calc-field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ext-muted);
}

.ext-page .calc-input {
  width: 100%;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 2px solid var(--ext-border);
  border-radius: 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ext-text);
  background: var(--ext-bg-elevated);
  outline: none;
  transition: border-color 0.2s;
}

.ext-page .calc-input:focus {
  border-color: var(--ext-accent);
  box-shadow: 0 0 0 3px var(--ext-accent-ring);
}

.ext-page .calc-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 30px;
  background: var(--ext-bg-muted);
  border-top: 1px solid var(--ext-border);
}

.ext-page .calc-total-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ext-heading);
}

.ext-page .calc-total-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ext-accent);
}

.ext-page .calc-btn {
  padding: 14px 32px;
  border: none;
  border-radius: 40px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ext-on-accent);
  background: var(--ext-calc-btn);
  box-shadow: var(--ext-calc-btn-shadow);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.3s;
}

.ext-page .calc-btn:hover:not(:disabled) {
  background: var(--ext-calc-btn-hover);
  box-shadow: var(--ext-calc-btn-shadow-hover);
  transform: translateY(-2px);
}

.ext-page .calc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ext-page .calc-error {
  padding: 0 30px 20px;
  font-size: 0.9rem;
  color: var(--ext-error);
}

.ext-page .calc-success {
  padding: 0 30px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ext-check);
}

.ext-page :is(.calc-footnote, .calc-agreement) {
  color: var(--ext-soft);
}

.ext-page .calc-footnote {
  padding: 0 30px 10px;
  font-size: 0.9rem;
}

.ext-page .calc-agreement {
  padding: 0 30px 24px;
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  .ext-page .calc-section {
    padding: 16px 20px;
  }

  .ext-page .calc-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .ext-page .calc-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Прочие блоки --- */
.ext-page .feature-card .feature-card__title {
  margin: 0 0 8px;
}

.ext-image-caption-btn {
  padding: 0;
  border: none;
  font: inherit;
  color: inherit;
  background: none;
  text-decoration: underline;
  cursor: pointer;
}

/* CLS: анимации без border/padding */
.ext-page .ext-slider-nav-link {
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Превью изображений (sirius-image-zoom) */
.ext-page .sirius-zoom-img:not(.sirius-zoom-img--enlarged) {
  image-rendering: auto;
}

.ext-page .sirius-zoom-container {
  cursor: zoom-in;
}

.ext-page .sirius-zoom-img--enlarged {
  cursor: zoom-out;
  image-rendering: high-quality;
}

.ext-page .sirius-zoom-img--loading-hd {
  filter: blur(3px);
  transition: filter 0.25s ease;
}

/* Модалка zoom вне .ext-page — fallback = sirius-azure / --ext-accent светлой темы */
html:has(.ext-page) .sirius-zoom-close:focus-visible {
  outline: 2px solid var(--ext-accent, #2563eb);
  outline-offset: 2px;
}
