/* Front page (page 1 of the home). Loaded only there; namespaced with .hm-
   and built on the theme's own variables so it stays one design system. */

/* ---------- Hero ---------- */
.hm-hero {
  background: var(--color-surface);
  border-radius: 16px;
  padding: 36px 32px;
  margin-bottom: 18px;
}
.hm-hero-title {
  max-width: 820px;
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 4.2vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.hm-hero-lead {
  max-width: 680px;
  margin: 0;
  font-size: 1.05rem;
  color: var(--color-muted);
}

/* ---------- Topic pills ---------- */
.hm-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 44px;
}
.hm-topic {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 18px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-weight: 600;
  color: var(--color-text);
  transition: border-color .15s ease, color .15s ease;
}
.hm-topic:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

/* ---------- Section heads ---------- */
.hm-section { margin-bottom: 44px; }
.hm-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.hm-h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3.2vw, 1.65rem);
  letter-spacing: -0.01em;
}
.hm-all { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }

/* ---------- Cards ---------- */
.hm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.hm-grid--4 { grid-template-columns: repeat(4, 1fr); gap: 18px; }

.hm-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .15s ease;
}
.hm-card:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .07); }
.hm-card-thumb {
  aspect-ratio: 16 / 10;
  background: var(--color-surface);
  overflow: hidden;
}
.hm-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hm-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 16px 16px;
}
.hm-card .post-card-meta { margin-bottom: 6px; }
.hm-card .post-card-category { position: relative; z-index: 2; }
.hm-card .post-card-category:hover { text-decoration: none; background: var(--color-border); }
.hm-card-title {
  margin: 0 0 6px;
  font-size: 1.02rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hm-card-title a { color: var(--color-text); }
.hm-card-title a::after { content: ""; position: absolute; inset: 0; }
.hm-card-title a:hover { color: var(--color-accent); text-decoration: none; }
.hm-card-title a:focus-visible { outline: none; }
.hm-card-title a:focus-visible::after {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
  border-radius: var(--radius);
}
.hm-card-excerpt {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Featured block ---------- */
.hm-featured {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 44px;
}

/* ---------- Telegram CTA ---------- */
.hm-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 16px;
  padding: 32px 36px;
  margin-bottom: 44px;
}
.hm-cta-title {
  margin: 0 0 6px;
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  letter-spacing: -0.01em;
  color: #fff;
}
.hm-cta-text p { max-width: 620px; margin: 0; color: rgba(255, 255, 255, .92); }
.hm-cta-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 26px;
  background: #fff;
  color: var(--color-accent-dark);
  font-weight: 700;
  text-align: center;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  transition: background .15s ease;
}
.hm-cta-btn svg { width: 22px; height: 22px; flex: none; fill: currentColor; }
.hm-cta-btn:hover { background: var(--color-surface); color: var(--color-accent-dark); text-decoration: none; }
.hm-cta-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* ---------- About ---------- */
.hm-about {
  max-width: 780px;
  margin: 8px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}
.hm-about .hm-h2 { margin-bottom: 12px; }
.hm-about p { margin: 0; color: var(--color-muted); font-size: 0.95rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .hm-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .hm-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .hm-hero { padding: 24px 18px; border-radius: 12px; }
  .hm-hero-title { font-size: 1.5rem; }
  .hm-hero-lead { font-size: 1rem; }
  .hm-topics { margin-bottom: 32px; }
  .hm-section, .hm-featured, .hm-cta { margin-bottom: 32px; }
  .hm-featured { padding: 16px; border-radius: 12px; }

  .hm-grid,
  .hm-grid--4 { grid-template-columns: 1fr; gap: 12px; }

  /* compact horizontal cards for featured + themed blocks; the latest feed stays classic */
  .hm-compact .hm-card { flex-direction: row; }
  .hm-compact .hm-card-thumb {
    position: relative;
    flex: none;
    width: 112px;
    aspect-ratio: auto;
  }
  .hm-compact .hm-card-thumb img { position: absolute; inset: 0; }
  .hm-compact .hm-card-body { padding: 12px 14px; }
  .hm-compact .hm-card-excerpt { display: none; }
  .hm-compact .hm-card-title { margin-bottom: 0; font-size: 0.98rem; }

  .hm-grid--feed { gap: 16px; }
  .hm-cta { flex-direction: column; align-items: stretch; text-align: center; padding: 26px 18px; border-radius: 12px; }
  .hm-cta-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .hm-card, .hm-topic, .hm-cta-btn { transition: none; }
}
