.cosmic-hero {
  --hero-background: #fff;
  --hero-foreground: var(--color-black);
  --hero-gutter: var(--page-gutter);
  --hero-top-clearance: clamp(82px, 10svh, 112px);
  --hero-content-reserve: 240px;
  --hero-stack-size: min(
    calc(100vw - (var(--hero-gutter) * 2)),
    max(230px, calc(var(--viewport-height, 100dvh) - 32px))
  );
  font-family: var(--font-body);
}

.cosmic-hero__content h1 {
  font-family: var(--font-title);
  font-weight: 400;
}

.cosmic-hero,
.cosmic-hero * {
  box-sizing: border-box;
}

.cosmic-hero {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--viewport-height, 100dvh);
  min-height: var(--viewport-height, 100dvh);
  padding: 0 var(--hero-gutter);
  overflow: hidden;
  color: var(--hero-foreground);
  background:
    radial-gradient(circle at 50% 43%, rgba(3, 3, 6, 0.035), transparent 45%),
    var(--hero-background);
  isolation: isolate;
}

.cosmic-hero__visual {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
}

.cosmic-hero__stack {
  position: relative;
  width: max(0px, var(--hero-stack-size));
  height: max(0px, var(--hero-stack-size));
  max-width: 100%;
  max-height: 100%;
  flex: none;
  contain: layout paint;
}

.cosmic-hero__layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  object-position: 50% 50%;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  will-change: transform;
  user-select: none;
  pointer-events: none;
}

.cosmic-hero__layer--flare {
  z-index: 1;
  animation: cosmic-rotate-counterclockwise 15s linear infinite;
}

.cosmic-hero__layer--earth {
  z-index: 2;
  animation: cosmic-rotate-clockwise 15s linear infinite;
}

.cosmic-hero__layer--astronaut {
  z-index: 3;
  will-change: auto;
}

.cosmic-hero.is-paused .cosmic-hero__layer--flare,
.cosmic-hero.is-paused .cosmic-hero__layer--earth {
  animation-play-state: paused;
}

@keyframes cosmic-rotate-clockwise {
  to { transform: rotate(1turn); }
}

@keyframes cosmic-rotate-counterclockwise {
  to { transform: rotate(-1turn); }
}

.cosmic-hero__content {
  position: absolute;
  top: 50%;
  left: var(--hero-gutter);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: min(calc(50vw - 350px), 400px);
  padding: 0;
  text-align: left;
  transform: translateY(-50%);
}

.cosmic-hero__content h1 {
  max-width: 400px;
  margin: 0;
  font-size: clamp(27px, 2.3vw, 36px);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1;
  text-wrap: balance;
  white-space: nowrap;
}

.cosmic-hero__content > p {
  max-width: 400px;
  margin: 8px 0 0;
  color: rgba(3, 3, 6, 0.68);
  font-size: clamp(12px, 0.9vw, 14px);
  font-weight: 400;
  letter-spacing: -0.018em;
  line-height: 1.35;
  text-wrap: balance;
}

.cosmic-hero__accent {
  color: var(--color-black);
  font-weight: 700;
}

.cosmic-hero__controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(100%, 400px);
  max-width: 100%;
  margin-top: 14px;
}

.cosmic-hero__form {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  width: max-content;
  max-width: 100%;
  margin: 0;
  align-self: flex-start;
}

.cosmic-hero__form input,
.cosmic-hero__form button {
  width: 100%;
  height: var(--button-height);
  min-height: var(--button-height);
  border-radius: var(--button-radius);
  font: inherit;
}

.cosmic-hero__form input {
  min-width: 0;
  contain: inline-size;
  padding: 0 var(--button-padding-inline);
  border: 1px solid rgba(3, 3, 6, 0.18);
  outline: none;
  color: var(--color-black);
  background: #fff;
  font-size: 14px;
  box-shadow: none;
  transition:
    border-color 220ms ease,
    box-shadow 220ms ease;
}

.cosmic-hero__form input::placeholder {
  color: rgba(3, 3, 6, 0.48);
}

.cosmic-hero__form input:focus {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 4px rgba(11, 153, 255, 0.14);
}

.cosmic-hero__form input[aria-invalid="true"] {
  border-color: #c72f2f;
}

.cosmic-hero__form button {
  justify-self: stretch;
}

.cosmic-hero__form .global-button.global-button {
  width: 100%;
}

.cosmic-hero__rocket {
  position: relative;
  width: 18px;
  height: 20px;
  flex: 0 0 18px;
  overflow: visible;
  font-style: normal;
  line-height: 1;
}

.cosmic-hero__rocket::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: clamp(20px, calc(var(--button-height) - 26px), 24px);
  height: clamp(19px, calc(var(--button-height) - 27px), 23px);
  background: url("../site-navigation/rocket-animated.svg?v=3") center / contain no-repeat;
  transform: translate(-50%, -50%);
}

.cosmic-hero__form-status {
  grid-column: 1 / -1;
  min-height: 1em;
  color: rgba(3, 3, 6, 0.62);
  font-size: 12px;
  line-height: 1;
}

.cosmic-hero__form-status:not(:empty) {
  padding-block: clamp(5px, 0.65vw, 8px);
}

.cosmic-hero__region {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 0.63vw, 9px);
  width: auto;
  height: var(--button-height);
  min-height: var(--button-height);
  margin-top: 2px;
  padding: 0 var(--button-padding-inline);
  border: 1px solid rgba(3, 3, 6, 0.04);
  border-radius: var(--button-radius);
  color: var(--color-black);
  background: #fff;
  box-shadow:
    0 9px 24px rgba(3, 3, 6, 0.13),
    0 2px 5px rgba(3, 3, 6, 0.08);
  text-align: left;
  align-self: flex-start;
}

.cosmic-hero__region:not(.is-ready) {
  visibility: hidden;
}

.cosmic-hero__region-flag {
  display: grid;
  place-items: center;
  width: clamp(22px, 1.88vw, 27px);
  height: clamp(22px, 1.88vw, 27px);
  flex: 0 0 clamp(22px, 1.88vw, 27px);
  overflow: hidden;
  border-radius: 50%;
  filter: drop-shadow(0 2px 3px rgba(3, 3, 6, 0.2));
  font-size: clamp(20px, 1.74vw, 25px);
  line-height: 1;
}

.cosmic-hero__region-flag img,
.cosmic-hero__region-flag span {
  grid-area: 1 / 1;
}

.cosmic-hero__region-flag img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.cosmic-hero__region-flag img[hidden],
.cosmic-hero__region-flag span[hidden] {
  display: none;
}

.cosmic-hero__region-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.cosmic-hero__region-copy > span {
  font-size: 10px;
  font-weight: 500;
  line-height: 1.05;
}

.cosmic-hero__region-copy strong {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.05;
  white-space: normal;
}

.cosmic-hero__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Intermediate stage: keep the copy beside the artwork, but give the longer
   proposal label its own row before the side lane becomes too narrow. */
@media (max-width: 1799px), (max-aspect-ratio: 17 / 10) {
  .cosmic-hero__content {
    width: min(
      400px,
      max(
        210px,
        calc((100vw - var(--hero-stack-size)) / 2 - (var(--hero-gutter) * 2))
      )
    );
  }

  .cosmic-hero__form {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }
}

/* Narrow stage: only now does the complete copy block move below the artwork. */
@media (max-width: 1099px), (max-aspect-ratio: 3 / 2) {
  .cosmic-hero {
    --hero-content-reserve: 290px;
    --hero-stack-size: min(
      calc(100vw - (var(--hero-gutter) * 2)),
      max(100px, calc(var(--viewport-height, 100dvh) - var(--hero-top-clearance) - var(--hero-content-reserve)))
    );
    grid-template-areas:
      "visual"
      "content";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: start;
    column-gap: 0;
    width: 100%;
    height: var(--viewport-height, 100dvh);
    min-height: var(--viewport-height, 100dvh);
    padding: var(--hero-top-clearance) var(--hero-gutter) 0;
  }

  .cosmic-hero__content {
    position: relative;
    top: auto;
    left: auto;
    align-items: center;
    width: min(100%, 400px);
    padding: 6px 0 max(22px, env(safe-area-inset-bottom));
    justify-self: center;
    text-align: center;
    transform: none;
  }

  .cosmic-hero__region {
    align-self: center;
  }

  .cosmic-hero__form {
    align-self: center;
    width: max-content;
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  .cosmic-hero {
    --viewport-height: 100svh;
  }
}

@media (max-width: 699px) {
  .cosmic-hero {
    --hero-top-clearance: clamp(72px, 10svh, 94px);
    --hero-content-reserve: 300px;
  }

  .cosmic-hero__content {
    padding-top: 5px;
  }

  .cosmic-hero__content h1 {
    font-size: clamp(25px, 8vw, 34px);
  }

  .cosmic-hero__content > p {
    max-width: 350px;
  }

}

@media (max-height: 620px) {
  .cosmic-hero {
    --hero-top-clearance: 54px;
    min-height: var(--viewport-height, 100dvh);
  }

  .cosmic-hero__visual {
    padding-bottom: 4px;
  }

  .cosmic-hero__content {
    padding-top: 4px;
  }
}

.home-loading .cosmic-hero__layer--flare,
.home-loading .cosmic-hero__layer--earth {
  animation-play-state: paused;
}
