/* Remove default spacing only when hero section is present */
.md-content__inner:has(.hero-section) {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.md-content__inner:has(.hero-section):before {
  display: none !important;
}

.md-content:has(.hero-section) {
  margin-top: 0 !important;
}

/* Remove any top spacing from the page */
.md-main__inner:has(.hero-section) {
  margin-top: 0 !important;
}

.md-content__inner > :first-child {
  margin-top: 0 !important;
}

/* ==================== HERO SECTION ==================== */

.hero-section {
  background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
  color: white;
  padding: 60px 32px 48px;
  margin: 0 -24px 36px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

/* Animated background pattern */
.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
  animation: heroShift 8s ease-in-out infinite;
  pointer-events: none;
}

/* Additional animated layer */
.hero-section::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  background:
    linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
  animation: heroRotate 15s linear infinite;
  pointer-events: none;
}

@keyframes heroShift {
  0%, 100% {
    opacity: 0.7;
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateY(-15px) scale(1.05);
  }
}

@keyframes heroRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

[data-md-color-scheme="slate"] .hero-section {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.hero-content {
  max-width: 850px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.badge-gradient {
  display: none;
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background: linear-gradient(to bottom, #fff 0%, rgba(255, 255, 255, 0.95) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #ffffff !important;
  margin-bottom: 1.5rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 400;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 2rem;
  animation: actionsFadeIn 1s ease-out 0.3s backwards;
}

@keyframes actionsFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== FEATURES GRID ==================== */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 2.5rem;
}

.feature-card {
  position: relative;
  overflow: hidden;
  padding: 36px 24px;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(21, 101, 192, 0.12);
  border-color: rgba(21, 101, 192, 0.3);
}

[data-md-color-scheme="slate"] .feature-card {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-md-color-scheme="slate"] .feature-card:hover {
  box-shadow: 0 8px 20px rgba(96, 165, 250, 0.2);
  border-color: rgba(96, 165, 250, 0.4);
}

.feature-icon {
  font-size: 2.8rem;
  margin-bottom: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #e3f2fd 0%, #90caf9 100%);
  border-radius: 16px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(21, 101, 192, 0.08);
}

.feature-card:hover .feature-icon {
  transform: translateY(-2px) rotate(-5deg);
  box-shadow: 0 6px 16px rgba(21, 101, 192, 0.15);
}

[data-md-color-scheme="slate"] .feature-icon {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-md-color-scheme="slate"] .feature-card:hover .feature-icon {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--text-color);
  letter-spacing: -0.02em;
}

.feature-card p {
  color: var(--text-color);
  opacity: 0.7;
  line-height: 1.65;
  margin: 0;
  font-size: 0.85rem;
}

/* ==================== SECTION HEADERS ==================== */

.section-header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 900;
  margin-bottom: 1rem;
  border: none;
  color: var(--text-color);
  letter-spacing: -0.03em;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ==================== OVERLAY CARDS ==================== */

.overlay-grid {
  margin-bottom: 4rem;
}

.plugins-section {
  margin-bottom: 4rem;
}

.overlay-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.overlay-card:hover {
  text-decoration: none;
}

.overlay-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--link-color) 0%, var(--accent-color) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  mix-blend-mode: overlay;
}

.overlay-card:hover::after {
  opacity: 0.15;
}

.overlay-card img {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.overlay-card:hover img {
  transform: scale(1.05);
}

.overlay-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-color);
  letter-spacing: -0.01em;
}

.overlay-card p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0;
  flex-grow: 1;
  font-size: 0.95rem;
}

.overlay-card .md-button {
  display: none;
}

/* ==================== CTA SECTION ==================== */

.cta-section {
  text-align: center;
  margin: 4rem 0;
}

.cta-section h2 {
  font-size: 1.75rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
  color: var(--text-color);
  letter-spacing: -0.02em;
  border: none;
  padding-bottom: 0;
}

.cta-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2.5rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

.cta-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 2rem;
}

.cta-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.cta-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--link-color);
}

.cta-card-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: transform 0.3s ease;
}

.cta-card:hover .cta-card-icon {
  transform: scale(1.1) rotate(-5deg);
}

.cta-card strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.75rem;
}

.cta-card p {
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  font-size: 0.9rem;
}

.cta-card a {
  font-weight: 600;
  color: var(--link-color);
}

/* Legacy support - hide old CTA */
.homepage-cta {
  display: none;
}

/* ==================== QUICK START SECTION ==================== */

.md-typeset hr {
  display: none;
}

/* Improve spacing between major sections */
.plugins-section,
.homepage-cta {
  margin-top: 5rem;
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */

@media (max-width: 768px) {
  .hero-section {
    padding: 64px 24px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .section-header h2 {
    font-size: 2rem;
  }

  .homepage-cta {
    padding: 2rem;
  }
}

/* ==================== ACCESSIBILITY ==================== */

@media (prefers-reduced-motion: reduce) {
  .hero-section::before,
  .hero-section::after,
  .hero-title,
  .hero-subtitle,
  .hero-actions,
  .feature-icon,
  .overlay-card img,
  .cta-item,
  .cta-icon {
    animation: none;
    transition: none;
  }
}
