/* Stackway Gitea custom — homepage hero + chrome fit (Gitea 1.22–1.27) */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/SpaceGrotesk.woff2") format("woff2");
}

/*
  Real DOM (Gitea):
    body (flex column)
      .full.height (flex-grow: 1)  → navbar + page content
      footer.page-footer           → SIBLING, not inside .full.height

  Never set min-height: 100vh/100dvh on .full.height or .sw-hero —
  that reserves the whole viewport and pushes the footer below the fold.
*/

body:has(.sw-home) {
  min-height: 100dvh;
}

body:has(.sw-home) .full.height {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  /* override any previous custom min-height: 100dvh */
  min-height: 0 !important;
  height: auto !important;
  /* Gitea reserves padding for footer gap; keep a small gap only */
  padding-bottom: 0 !important;
}

body:has(.sw-home) #navbar {
  flex-shrink: 0;
  background: var(--color-body) !important;
  border-bottom: 1px solid color-mix(in srgb, var(--color-secondary) 70%, transparent);
  box-shadow: none !important;
}

body:has(.sw-home) .page-footer {
  flex-shrink: 0;
  margin-top: 0 !important;
  background: var(--color-body);
  border-top: 1px solid color-mix(in srgb, var(--color-secondary) 70%, transparent);
}

.page-content.home.sw-home {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
  width: 100%;
}

/* Gitea adds margin-top to first child of .page-content — kill it on home */
.page-content.home.sw-home > :first-child {
  margin-top: 0 !important;
}

.sw-hero {
  position: relative;
  isolation: isolate;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  /* allow flex item to shrink; do not force viewport height */
  min-height: 0 !important;
  height: auto;
  padding: 2rem 1.5rem 2.25rem;
  overflow: hidden;
  color: var(--color-text);
  background: var(--color-body);
}

.sw-hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(
      165deg,
      var(--color-primary-alpha-20) 0%,
      transparent 42%,
      var(--color-body) 72%
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 31px,
      color-mix(in srgb, var(--color-secondary) 45%, transparent) 31px,
      color-mix(in srgb, var(--color-secondary) 45%, transparent) 32px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 31px,
      color-mix(in srgb, var(--color-secondary) 45%, transparent) 31px,
      color-mix(in srgb, var(--color-secondary) 45%, transparent) 32px
    );
  background-size: 100% 100%, 32px 32px, 32px 32px;
  opacity: 0.55;
  animation: sw-grid-drift 28s linear infinite;
  transform: translate3d(0, 0, 0);
}

.sw-hero__glow {
  position: absolute;
  z-index: 0;
  width: min(70vw, 640px);
  height: min(70vw, 640px);
  top: 50%;
  left: 50%;
  translate: -50% -48%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--color-primary-alpha-30) 0%,
    var(--color-primary-alpha-10) 38%,
    transparent 68%
  );
  filter: blur(8px);
  pointer-events: none;
}

.sw-hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
  max-width: 42rem;
  animation: sw-fade-up 0.7s ease-out both;
}

.sw-hero__eyebrow {
  margin: 0;
  font-family: "Space Grotesk", var(--fonts-regular, system-ui, sans-serif);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-light-2, var(--color-secondary-dark-5));
}

.sw-hero__title {
  margin: 0;
  font-family: "Space Grotesk", var(--fonts-regular, system-ui, sans-serif);
  font-size: clamp(2.75rem, 9vw, 5.25rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--color-text);
}

.sw-hero__tagline {
  margin: 0.15rem 0 0.6rem;
  font-family: "Space Grotesk", var(--fonts-regular, system-ui, sans-serif);
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-text-light-1, var(--color-secondary-dark-6));
}

.sw-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.sw-hero__btn.ui.button {
  margin: 0;
  min-width: 7.5rem;
  border-radius: 0.55rem !important;
  font-family: "Space Grotesk", var(--fonts-regular, system-ui, sans-serif);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease,
    border-color 0.18s ease;
}

.sw-hero__btn--primary.ui.primary.button {
  box-shadow: 0 10px 28px var(--color-primary-alpha-30);
}

.sw-hero__btn.ui.button:hover {
  transform: translateY(-1px);
}

.sw-hero__btn--ghost.ui.basic.button {
  background: color-mix(in srgb, var(--color-box-body) 70%, transparent) !important;
  backdrop-filter: blur(6px);
}

html[data-theme="gitea-dark"] .sw-hero__bg,
html[data-theme="theme-gitea-dark"] .sw-hero__bg {
  opacity: 0.35;
}

html[data-theme="gitea-dark"] .sw-hero__glow,
html[data-theme="theme-gitea-dark"] .sw-hero__glow {
  background: radial-gradient(
    circle,
    var(--color-primary-alpha-40) 0%,
    var(--color-primary-alpha-10) 42%,
    transparent 70%
  );
}

@media (prefers-color-scheme: dark) {
  html[data-theme="gitea-auto"] .sw-hero__bg {
    opacity: 0.35;
  }

  html[data-theme="gitea-auto"] .sw-hero__glow {
    background: radial-gradient(
      circle,
      var(--color-primary-alpha-40) 0%,
      var(--color-primary-alpha-10) 42%,
      transparent 70%
    );
  }
}

@keyframes sw-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sw-grid-drift {
  from {
    background-position: 0 0, 0 0, 0 0;
  }
  to {
    background-position: 0 0, 0 32px, 32px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sw-hero__bg {
    animation: none;
  }

  .sw-hero__inner {
    animation: none;
  }

  .sw-hero__btn.ui.button {
    transition: none;
  }
}
