/* codex overrides: keep layout stable across browsers and clamp article media */

/* Pages list (/pages/) thumbnails: always same box */
.pages-list .page-card__thumb {
  width: 160px !important;
  height: 110px !important;
  display: block !important;
  overflow: hidden !important;
  border-radius: 6px !important;
  background: #e9e2b9 !important;
  border: 1px solid #cfc78f;
}

.pages-list .page-card__thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

.pages-list .page-card__thumb--empty {
  position: relative;
}

.pages-list .page-card__thumb--empty::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.55), rgba(255,255,255,0) 55%),
    repeating-linear-gradient(135deg, rgba(0,0,0,0.06) 0 8px, rgba(0,0,0,0.02) 8px 16px);
}

/* Home sidebar "Статьи" thumbs: keep consistent */
#module_pages .pages-home-thumb {
  width: 64px;
  height: 48px;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid #cfc78f;
  background: #fff;
  flex: 0 0 64px;
}

#module_pages .pages-home-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

/* Article page hero thumb: clamp height, prevent overflow */
.page-single__thumb {
  max-width: 720px;
  margin: 0 0 16px;
  overflow: hidden;
  border-radius: 8px;
}

.page-single__thumb img {
  width: 100% !important;
  height: auto !important;
  max-height: 420px !important;
  object-fit: cover;
  display: block !important;
}

/* Inline images inside article body */
.page-single__content {
  overflow: hidden;
}

.page-single__content figure,
.page-single__content .page-figure {
  max-width: 720px;
  margin: 14px auto;
  overflow: hidden;
}

.page-single__content img {
  max-width: 100% !important;
  height: auto !important;
  max-height: 520px !important;
  object-fit: contain;
  display: block !important;
}

.page-single__content img[src*='/userfiles/seo/'] {
  width: 100% !important;
  max-width: 720px !important;
  max-height: 520px !important;
  margin: 12px auto !important;
}

/* Long text in excerpts must not break layout */
.page-card__excerpt,
.page-single__content {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Full-width info block (when moved below content) */
#module_info_below {
  clear: both;
  margin: 18px 0 0;
}

#module_info_below .middle ul {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 900px) {
  .pages-list .page-card__thumb { width: 100% !important; height: 160px !important; }
}


/* Clamp article content images (prevents overflow on /pages/<slug>/ across browsers). */
#content .page-content img,
#content .page-text img,
#content .page-card__body img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* If an image is inserted with width/height attrs, keep it contained. */
#content .page-content img[width],
#content .page-text img[width] {
  width: 100% !important;
  height: auto !important;
}

/* Pages layout: make cards consistent across browsers. */
.pages-list .page-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.pages-list .page-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.pages-list .page-card__thumb {
  width: 160px;
  height: 110px;
  flex: 0 0 160px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #cfc78f;
  background: #fff;
}

@media (max-width: 900px) {
  .pages-list .page-card { flex-direction: column; }
  .pages-list .page-card__thumb {
    width: 100% !important;
    height: 180px !important;
    flex: 0 0 auto;
  }
}

/* Article page: never allow inline images to overflow the content box. */
.page-single__content img[width],
.page-single__content img[style*="width"],
.page-single__content img[style*="height"] {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
}
