/* ===== Hide auto-generated page title on homepage ===== */
/* The homepage wraps content in .hero-section; on subpages,
   the h1 has a meaningful ID and must remain visible.
   We visually hide only h1 without an id (the auto-generated "Home" title). */
.md-content__inner > h1:not([id]) {
  display: none;
}

/* ===== Homepage Hero Section ===== */
.md-main .hero-section {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  background: linear-gradient(135deg, #3949ab 0%, #5c6bc0 40%, #7e57c2 100%);
  border-radius: 16px;
  margin: 0 -0.6rem 2rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.md-main .hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.md-main .hero-section h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
  color: #fff !important;
}

.md-main .hero-section .hero-subtitle {
  font-size: 1.15rem;
  font-weight: 400;
  opacity: 0.92;
  margin-bottom: 1.2rem;
  line-height: 1.6;
}

.md-main .hero-section .hero-badges {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.md-main .hero-section .hero-badges img {
  height: 22px;
  transition: transform 0.2s ease;
}

.md-main .hero-section .hero-badges img:hover {
  transform: scale(1.1);
}

/* ===== Architecture Diagram ===== */
.layer-diagram {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 720px;
  margin: 1.5rem auto 2rem;
}

.layer-card {
  display: flex;
  align-items: center;
  padding: 1rem 1.4rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.layer-card:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.layer-card:first-child {
  border-radius: 12px 12px 0 0;
}

.layer-card:last-child {
  border-radius: 0 0 12px 12px;
}

.layer-card + .layer-card {
  border-top: none;
}

.layer-card .layer-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  color: #fff;
  margin-right: 1rem;
}

.layer-card .layer-info {
  flex: 1;
  min-width: 0;
}

.layer-card .layer-info strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.layer-card .layer-info span {
  font-size: 0.82rem;
  opacity: 0.7;
}

.layer-card .layer-arrow {
  font-size: 0.8rem;
  opacity: 0.5;
  flex-shrink: 0;
  margin-left: 1rem;
}

/* Layer colors */
.layer-l3 .layer-tag { background: #e91e63; }
.layer-l2 .layer-tag { background: #ff9800; }
.layer-l1 .layer-tag { background: #4caf50; }
.layer-l0 .layer-tag { background: #2196f3; }

.layer-l3 { background: rgba(233, 30, 99, 0.04); }
.layer-l2 { background: rgba(255, 152, 0, 0.04); }
.layer-l1 { background: rgba(76, 175, 80, 0.04); }
.layer-l0 { background: rgba(33, 150, 243, 0.04); }

/* Divider between L1 and L0 */
.layer-divider {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, #3949ab, #7e57c2);
  margin: 0;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* ===== Problem Cards ===== */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.2rem 0 2rem;
}

.problem-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.problem-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.problem-card .problem-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 0.1rem;
}

.problem-card .problem-text strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
}

.problem-card .problem-text span {
  font-size: 0.84rem;
  opacity: 0.7;
  line-height: 1.5;
}

/* ===== Quick Links Cards ===== */
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 1.2rem 0 2rem;
}

.quick-link-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.1rem;
  border-radius: 10px;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  text-decoration: none !important;
  color: var(--md-default-fg-color) !important;
  transition: all 0.2s ease;
}

.quick-link-card:hover {
  border-color: var(--md-primary-fg-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.quick-link-card .ql-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.quick-link-card .ql-info strong {
  display: block;
  font-size: 0.9rem;
  color: var(--md-primary-fg-color);
}

.quick-link-card .ql-info span {
  font-size: 0.78rem;
  opacity: 0.65;
  line-height: 1.4;
}

/* ===== Section Headings ===== */
.home-section-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.home-section-desc {
  opacity: 0.65;
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
}

/* ===== Feature Cards (grid cards) Enhancement ===== */
.md-typeset .grid.cards > ol > li,
.md-typeset .grid.cards > ul > li {
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.md-typeset .grid.cards > ol > li:hover,
.md-typeset .grid.cards > ul > li:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

/* ===== Dark mode adjustments ===== */
[data-md-color-scheme="slate"] .hero-section {
  background: linear-gradient(135deg, #1a237e 0%, #283593 40%, #4527a0 100%);
}

[data-md-color-scheme="slate"] .problem-card,
[data-md-color-scheme="slate"] .quick-link-card {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-md-color-scheme="slate"] .layer-card {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-md-color-scheme="slate"] .problem-card:hover,
[data-md-color-scheme="slate"] .quick-link-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-md-color-scheme="slate"] .layer-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .md-main .hero-section h1 {
    font-size: 1.7rem;
  }
  .md-main .hero-section .hero-subtitle {
    font-size: 1rem;
  }
  .problem-grid {
    grid-template-columns: 1fr;
  }
  .quick-links-grid {
    grid-template-columns: 1fr;
  }
  .layer-card {
    padding: 0.8rem 1rem;
  }
}
