/* Теоремы, леммы, определения */
.theorem, .lemma, .definition {
  border-left: 4px solid #444;
  background-color: #fafafa;
  padding: 0.8em 1em;
  margin: 1.2em 0;
}

/* Заголовок внутри блока */
.theorem > p:first-child,
.lemma > p:first-child,
.definition > p:first-child {
  font-weight: bold;
}

.theorem p:not(:first-child),
.lemma p:not(:first-child),
.corollary p:not(:first-child),
.proposition p:not(:first-child) {
  font-style: italic;
}

/* Доказательства */
.proof {
  border-left: 4px solid #888;
  background-color: #fdfdfd;
  padding: 0.8em 1em;
  margin: 1.2em 0;
  font-style: italic;
}

/* Квадратик в конце доказательства */
.proof::after {
  content: "∎";
  display: block;
  text-align: right;
  font-style: normal;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2em;
  margin-top: 1.5em;
}

/* Hide empty article cards */
.article-card:empty {
  display: none !important;
}

/* Ensure cards have minimum content to display */
.article-card {
  min-height: auto;
}

/* Hide cards without h3 title (empty or malformed cards) */
.article-card:not(:has(> h3)) {
  display: none !important;
}

.article-card {
  display: block;
  padding: 1em 1.2em;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: #fafafa;
  transition: box-shadow 0.2s, transform 0.2s;
}

.article-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.article-card h3 {
  margin-top: 0;
  margin-bottom: 0.4em;
}

.article-card p {
  margin: 0;
  color: #555;
  font-size: 0.95em;
}

/* Center-aligned images and videos */
div[style*="text-align:center"] img,
div[style*="text-align:center"] video {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
