/* Служебная вёрстка контентной модели ПАТТ поверх существующего дизайна. */
.cms-page-body:empty,
.cms-file-slot:empty,
.cms-gallery-slot:empty { display: none; }

.cms-section-index { padding: 8px 0 64px; }
.news-page .cms-page-body .page-content { padding-bottom: 0; }
.news-page .news-image { height: 220px; background: #f1f5f2; }
.news-page .news-image img { object-fit: cover; }
.news-page .news-image:has(> img:not([src])) { display: none; }
.ec-editing .news-page .news-image:has(> img:not([src])) {
  position: relative;
  display: grid;
  border: 1px dashed #64748b;
}
.ec-editing .news-page .news-image:has(> img:not([src]))::after {
  content: '＋ Добавить фото';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #334155;
  font: 600 14px/1.2 system-ui, sans-serif;
  pointer-events: none;
}
.cms-section-index h2 { margin-bottom: 22px; }
.cms-section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.cms-section-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(14, 48, 35, .14);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(22, 50, 37, .08);
}
.cms-section-card > img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #eef3ec;
}
.cms-section-card > img[src$="/assets/patt-logo.png"] { display: none; }
.cms-placeholder-cover { display: none; }
.ec-editing .cms-section-card > img[src$="/assets/patt-logo.png"] + .cms-placeholder-cover {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-height: 44px;
  margin: 18px 22px 0;
  padding: 9px 14px;
  border: 1px dashed #64748b;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font: 600 14px/1.2 system-ui, sans-serif;
}
.ec-editing .cms-placeholder-cover:hover { background: #e2e8f0; }
.ec-editing .cms-placeholder-cover:focus-visible { outline: 3px solid #bc8800; outline-offset: 3px; }
.cms-section-card-content { display: flex; flex: 1; flex-direction: column; padding: 22px; }
.cms-section-card h3 { margin: 0 0 10px; font-size: clamp(1.05rem, 2vw, 1.3rem); }
.cms-section-card p { margin: 0 0 18px; color: #506258; }
.cms-section-card .text-link { margin-top: auto; }
.cms-editor-fields { display: none; }
.cms-document-slot { margin-top: 24px; }
.cms-document-slot a { margin-right: 12px; }
.cms-extra-menu:empty { display: none; }
.cms-extra-menu { display: flex; flex-direction: column; gap: 8px; }
.cms-detail-shell { min-height: 40vh; }
.cms-detail-meta { margin-bottom: 22px; }
.cms-detail-cover { width: 100%; max-height: 620px; object-fit: cover; border-radius: 20px; }
.news-detail .cms-detail-cover {
  display: block;
  width: auto;
  min-width: min(100%, 360px);
  max-width: min(100%, 900px);
  height: auto;
  max-height: none;
  object-fit: contain;
  margin-inline: auto;
}
.news-detail .cms-detail-cover:not([src]) { display: none; }
.ec-editing .news-detail .cms-detail-cover:not([src]) + .cms-placeholder-cover {
  display: block;
  margin-bottom: 20px;
  padding: 11px 15px;
  border: 1px dashed #64748b;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font: 600 14px/1.2 system-ui, sans-serif;
}
.cms-detail-gallery { margin-top: 24px; }
.sveden-card { position: relative; }
.sveden-card .cms-card-cover-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.sveden-card .cms-card-cover-link:focus-visible {
  outline: 3px solid #bc8800;
  outline-offset: 4px;
}
.ec-editing .sveden-card .cms-card-cover-link { display: none; }
.cms-dialog-editor { display: none; padding-top: 36px; padding-bottom: 52px; }
.cms-dialog-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.cms-dialog-editor-grid > article {
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(14, 48, 35, .14);
  border-radius: 16px;
  background: #fff;
}
.cms-dialog-editor-grid h3 { margin-bottom: 12px; }
.cms-publication-state { margin: 0 0 16px; }
.cms-publication-state small { display: block; margin-top: 6px; color: #64748b; }

.cms-preview-bar {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 40px);
  padding: 10px 12px 10px 16px;
  box-sizing: border-box;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
  font: 14px/1.2 system-ui, sans-serif;
}
.cms-preview-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: #d1fae5;
}
.cms-preview-label::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  content: '';
}
.cms-preview-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 13px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #22c55e;
  color: #052e12;
  font-weight: 700;
  text-decoration: none;
}
.cms-preview-edit:hover { background: #16a34a; }
.cms-preview-edit:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.cms-save-confirmation {
  position: fixed;
  right: 20px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 99999;
  max-width: calc(100vw - 40px);
  padding: 12px 16px;
  box-sizing: border-box;
  border: 1px solid #86efac;
  border-radius: 10px;
  background: #fff;
  color: #14532d;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .14);
  font: 14px/1.3 system-ui, sans-serif;
}

.ec-editing .cms-editor-fields { display: none !important; }
.ec-editing .cms-edit-only { display: block !important; }
.banner-editor-view .banner-set[aria-hidden="true"],
.banner-editor-view .banner-nav { display: none; }
.banner-editor-view .banner-track { transform: none !important; }

/* На главной карточка остаётся компактной; анонс виден в полном архиве. */
#news .news-grid .news-body > p { display: none; }

@media (max-width: 900px) {
  .cms-section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .cms-section-grid { grid-template-columns: 1fr; }
  .cms-dialog-editor-grid { grid-template-columns: 1fr; }
  .cms-preview-bar {
    right: 8px;
    left: 8px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    max-width: none;
  }
  .cms-preview-edit { flex: 1; min-height: 44px; }
  .cms-save-confirmation {
    right: 8px;
    left: 8px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    max-width: none;
  }
}
@media (max-width: 380px) {
  .cms-preview-bar { align-items: stretch; flex-direction: column; gap: 8px; padding: 10px 12px; }
  .cms-preview-edit { width: 100%; }
  .cms-save-confirmation { bottom: calc(116px + env(safe-area-inset-bottom)); }
}
@media print {
  .cms-preview-bar,
  .cms-save-confirmation { display: none !important; }
}
