/* CSS Portal homepage – scoped to .home-modern */
.home-modern {
  --hm-ink: #101828;
  --hm-muted: #5b6577;
  --hm-line: #e4e7ec;
  --hm-paper: #ffffff;
  --hm-wash: #f5f6fa;
  --hm-accent: #3556f5;
  --hm-accent-ink: #1f3ad1;
  --hm-radius: 14px;
  --hm-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  color: var(--hm-ink);
  margin-inline: auto;
}

.home-modern h1,
.home-modern h2,
.home-modern h3 { font-family: var(--hm-head); letter-spacing: -0.02em; color: var(--hm-ink); }

/* Toolbar (share / favourite) */
.hm-toolbar { display: flex; justify-content: flex-end; gap: 12px; margin-bottom: 8px; }
.hm-toolbar button { background: none; border: 0; padding: 6px; font-size: 24px; line-height: 1; color: var(--hm-muted); cursor: pointer; border-radius: 8px; }
.hm-toolbar button:hover { color: var(--hm-accent); background: var(--hm-wash); }

/* Hero */
.hm-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 48px; align-items: center; padding: 20px 0 26px; }
.hm-hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); line-height: 1.05; font-weight: 700; margin: 0 0 20px; }
.hm-hero p { font-size: 1.1rem; line-height: 1.65; color: var(--hm-muted); max-width: 52ch; margin: 0 0 28px; }
.hm-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hm-btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 10px; border: 1px solid var(--hm-line); background: var(--hm-paper); color: var(--hm-ink); font-weight: 600; text-decoration: none; transition: border-color .15s, background-color .15s; }
.hm-btn:hover { border-color: var(--hm-ink); color: var(--hm-ink); }
.hm-btn--primary { background: var(--hm-accent); border-color: var(--hm-accent); color: #fff; }
.hm-btn--primary:hover { background: var(--hm-accent-ink); border-color: var(--hm-accent-ink); color: #fff; }
.home-modern a:focus-visible,
.home-modern button:focus-visible,
.home-modern input:focus-visible { outline: 3px solid var(--hm-accent); outline-offset: 2px; }

/* Code snippet + result */
.hm-snippet { display: grid; gap: 14px; }
.hm-snippet__code { margin: 0; padding: 22px 24px; background: #101828; color: #d5dbea; border-radius: 16px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .86rem; line-height: 1.75; overflow-x: auto; }
.hm-snippet__code code { font: inherit; color: inherit; background: none; padding: 0; }
.t-sel { color: #ffb86b; }
.t-prop { color: #8fb4ff; }
.t-fn { color: #7fe0b5; }
.t-num { color: #ff9ab0; }
.t-val { color: #ff9ab0; }
.hm-snippet__result { padding: 28px; border-radius: 16px; background: var(--hm-wash); border: 1px solid var(--hm-line); }
.hm-snippet__card { display: grid; gap: 6px; background: linear-gradient(135deg, #3556f5, #ff7a59); border-radius: 24px; box-shadow: 0 14px 30px rgba(16, 24, 40, .22); padding: 28px; color: #fff; }
.hm-snippet__card strong { font-family: var(--hm-head); font-size: 1.35rem; letter-spacing: -0.01em; }
.hm-snippet__card span { opacity: .92; }

/* Section headings */
.hm-section { padding: 8px 0 56px; }
.hm-section__head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 24px; }
.hm-section__head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0; }
.hm-section__head a { font-weight: 600; color: var(--hm-accent); text-decoration: none; }
.hm-section__head a:hover { text-decoration: underline; }

/* Category cards */
.hm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.hm-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 24px; background: var(--hm-paper); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); transition: border-color .15s, box-shadow .15s; }
.hm-card:hover { border-color: var(--hm-accent); box-shadow: 0 10px 28px rgba(53, 86, 245, .12); }
.hm-card__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; font-size: 26px; background: var(--hm-tint, #eef1ff); color: var(--hm-tone, var(--hm-accent)); }
.hm-card h3 { font-size: 1.2rem; margin: 6px 0 0; }
.hm-card h3 a { color: inherit; text-decoration: none; }
.hm-card p { margin: 0; color: var(--hm-muted); line-height: 1.6; font-size: .95rem; }
.hm-card__badge { position: absolute; top: 18px; right: 18px; padding: 3px 10px; border-radius: 999px; background: #ffedd5; color: #9a3412; font-size: .75rem; font-weight: 700; }

/* Blog – featured + card grid */
.hm-posts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }

.hm-pcard { position: relative; display: flex; flex-direction: column; background: var(--hm-paper); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.hm-pcard:hover { border-color: var(--hm-accent); box-shadow: 0 10px 28px rgba(53, 86, 245, .12); transform: translateY(-2px); }

.hm-pcard__img { aspect-ratio: 16 / 10; background: var(--hm-wash); overflow: hidden; }
.hm-pcard__img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hm-pcard__body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 20px; flex: 1; }
.hm-pcard__tag { align-self: flex-start; padding: 3px 10px; border-radius: 999px; background: #eef1ff; color: var(--hm-accent-ink); font-size: .75rem; font-weight: 700; }
.hm-pcard h3 { font-size: 1.05rem; line-height: 1.3; margin: 0; }
.hm-pcard h3 a { color: var(--hm-ink); text-decoration: none; }
.hm-pcard__excerpt { color: var(--hm-muted); font-size: .92rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hm-pcard__excerpt p { margin: 0; }
.hm-pcard__meta { margin-top: auto; padding-top: 6px; font-size: .82rem; color: var(--hm-muted); }

/* Featured (first) post: full width, image beside text */
.hm-pcard--featured { grid-column: 1 / -1; flex-direction: row; }
.hm-pcard--featured .hm-pcard__img { flex: 0 0 48%; aspect-ratio: auto; min-height: 280px; }
.hm-pcard--featured .hm-pcard__body { justify-content: center; gap: 12px; padding: 32px 36px; }
.hm-pcard--featured h3 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); line-height: 1.2; }
.hm-pcard--featured .hm-pcard__excerpt { font-size: 1rem; -webkit-line-clamp: 4; }
.hm-pcard--featured .hm-pcard__meta { margin-top: 0; }

/* Responsive */
@media (max-width: 991px) {
  .hm-hero { grid-template-columns: 1fr; gap: 32px; padding-top: 16px; }
  .hm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575px) {
  .hm-grid { grid-template-columns: 1fr; }
  .hm-posts { grid-template-columns: 1fr; }
  .hm-pcard--featured { flex-direction: column; }
  .hm-pcard--featured .hm-pcard__img { flex: none; min-height: 0; aspect-ratio: 16 / 10; }
  .hm-pcard--featured .hm-pcard__body { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .home-modern * { transition: none !important; }
}