.site-header,
.site-footer,
.hero,
.showcase-grid,
.architecture-grid,
.download-card,
.header-actions,
.hero__actions,
.card-grid {
  display: grid;
}

.site-header,
.site-footer {
  width: var(--content-width);
  margin: 0 auto;
}

.site-header {
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand nav";
  align-items: center;
  padding: 22px 0 10px;
}

.header-actions {
  grid-auto-flow: column;
  gap: 12px;
  align-items: center;
  /* Place navigation at the right/top of the header on all pages */
  grid-area: nav;
  justify-content: flex-end;   /* right align nav items within the nav area */
  justify-items: end;          /* right align each item in the grid */
  justify-self: end;           /* pin the nav group to the right edge of header */
}

/* Ensure the logo/brand sits to the left of the nav on wide screens */
.site-header .brand {
  grid-area: brand;
}

.hero {
  padding: 54px 0 18px;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 36px;
  align-items: center;
}

.hero__content {
  max-width: 660px;
}

.hero__lead {
  margin-top: 22px;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.hero__actions {
  grid-auto-flow: column;
  /*justify-content: flex-start;*/
  gap: 14px;
  margin: 28px 0 34px;
}

.hero__block{
  text-align: center;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.hero__stats div {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.hero__stats dt {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hero__stats dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.hero__visual {
  display: grid;
  position: relative;
  min-height: 460px;
  padding: 26px;
  place-items: center;
  overflow: visible;
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.showcase-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 12px;
  align-items: stretch;
}

.architecture-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.download-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 24px;
  align-items: center;
}

.site-footer {
  grid-template-columns: repeat(4, auto);
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 28px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

@media (max-width: 1040px) {
  .hero,
  .showcase-grid,
  .architecture-grid,
  .download-card {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .download-card__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .site-header,
  .hero,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .site-header,
  .hero {
    gap: 18px;
  }

  /* On small screens, stack nav above brand to keep nav at top-right */
  .site-header {
    grid-template-areas:
      "nav"
      "brand";
  }

  /* Header nav: on small screens, allow wrapping and center align */
  .header-actions {
    display: flex;            /* override grid */
    flex-wrap: wrap;          /* allow 2 lines if needed */
    gap: 8px 10px;            /* compact spacing on mobile */
    justify-content: center;  /* center the buttons */
    justify-self: stretch;    /* take full width under header */
    align-items: center;
  }

  /* Keep hero actions stacked vertically on small screens */
  .hero__actions {
    grid-auto-flow: row;
  }

  .card-grid,
  .hero__stats {
    grid-template-columns: 1fr;
  }

  /* Footer nav: wrap and center like the top menu on small screens */
  .site-footer {
    display: flex;            /* override grid */
    flex-wrap: wrap;          /* allow wrapping to 2 lines if needed */
    gap: 8px 10px;            /* compact spacing on mobile */
    justify-content: center;  /* center the items */
    align-items: center;
    padding-bottom: 32px;
  }

  .site-footer > * {
    flex: 0 0 auto;           /* prevent items from stretching */
    white-space: nowrap;      /* keep labels on a single line */
    text-align: center;
  }
}
