:root {
  --ink: #111114;
  --white: #ffffff;
  --orange: #ff8c00;
  /* Outlines of the email box and sound button: 3.6:1 on ink, above the 3:1 minimum for form controls. */
  --slate: #676b77;
  --soft-white: rgba(255, 255, 255, 0.72);
  --font-heading: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  /* Spacing scale: every gap and padding on the page comes from these. */
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* Related things sit close together; separate groups sit further apart. */
  --gap-group: var(--space-6);
  --page-side: var(--space-4);

  /* Logo width. The wordmark scales from it, so the two always match. */
  --lockup: min(68vw, 36vh, 340px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* The ink background fades in over this. */
  background: #000000;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--white);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--ink);
}

.stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.stars-mid {
  animation: twinkle 7s ease-in-out infinite alternate;
}

.stars-near {
  animation: twinkle 4.5s ease-in-out -2s infinite alternate;
}

@keyframes twinkle {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.35;
  }
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: var(--space-6) var(--page-side);
  text-align: center;
}

.brand,
.details {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.details {
  max-width: 400px;
}

.logo {
  display: block;
  width: var(--lockup);
  height: auto;
  overflow: visible;
}

/* The wordmark is artwork (custom DREAMZ built on Montserrat ExtraBold), not live text. */
.wordmark {
  /* 32px, so the Z's star clears the tip of the arc above it by about 16px. */
  margin: var(--space-6) 0 0;
  line-height: 0;
}

/* The letters run end to end with the arc: the arc spans 3144 of the logo's 3200 units.
   The artwork's frame is a little larger, because the Z's star pokes out above and to the
   right. The negative margins cancel that extra, so the letters stay centred and the gap is
   measured from the letters, not the star. */
.wordmark svg {
  display: block;
  width: calc(var(--lockup) * 3144 / 3200 * 677.03 / 642.8);
  height: auto;
  margin-top: calc(var(--lockup) * -3144 / 3200 * 37.47 / 642.8);
  margin-right: calc(var(--lockup) * -3144 / 3200 * 34.23 / 642.8);
  fill: currentColor;
}

.tagline {
  margin: var(--gap-group) 0 0;
  font-family: var(--font-heading);
  font-size: clamp(1.625rem, 4.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.description {
  margin: var(--space-3) 0 0;
  color: var(--soft-white);
  font-size: clamp(1rem, 2.4vw, 1.125rem);
  line-height: 1.5;
  text-wrap: balance;
}

.signup {
  width: 100%;
  margin-top: var(--gap-group);
}

.signup[hidden] {
  display: none;
}

.signup-label {
  display: block;
  /* 12px: the label belongs to the box, but it's an invitation, not a tiny field caption. */
  margin-bottom: var(--space-3);
  font-size: 0.9375rem;
  font-weight: 500;
}

.signup-row {
  display: flex;
  gap: var(--space-2);
}

.signup-input,
.signup-button {
  min-height: 48px;
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
}

.signup-input {
  flex: 1;
  min-width: 0;
  padding: 0 var(--space-4);
  border: 1px solid var(--slate);
  background: transparent;
  color: var(--white);
}

.signup-input::placeholder {
  color: var(--soft-white);
  opacity: 1;
}

.signup-button {
  flex: none;
  padding: 0 var(--space-5);
  border: 0;
  background: var(--orange);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.signup-button:hover {
  background: #ffa033;
}

.signup-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.signup-input:focus-visible,
.signup-button:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Form messages and the email line share one spot under the form: the email line shows
   normally, and steps aside while a message is showing. The empty message stays in the
   page (just with no size) so screen readers still announce it when text arrives. */
.signup-message {
  margin: var(--space-4) 0 0;
  color: var(--soft-white);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.signup-message:empty {
  margin: 0;
}

.contact-email {
  /* 16px: a separate way to reach us, so it sits a little apart from the form. */
  margin: var(--space-4) 0 0;
  color: var(--soft-white);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* Keeps "or on WhatsApp" on one line, so the link never wraps onto a line by itself. */
.keep-together {
  white-space: nowrap;
}

.signup-message:not(:empty) + .contact-email {
  display: none;
}

.contact-email a {
  color: var(--white);
  font-weight: 500;
  text-underline-offset: 3px;
}

.contact-email a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 2px;
}

/* After a successful send, the message takes the form's place. */
.signup[hidden] + .signup-message {
  margin: var(--gap-group) 0 0;
}

/* A quiet line at the bottom of the screen. */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-5);
  padding: 0 var(--page-side) var(--space-5);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.footer-links {
  display: flex;
  gap: var(--space-5);
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  color: var(--white);
}

.footer a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 2px;
}

.sound-toggle {
  position: fixed;
  top: var(--page-side);
  right: var(--page-side);
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--slate);
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
}

.sound-toggle[hidden] {
  display: none;
}

.sound-toggle:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.sound-cross,
.sound-toggle.is-off .sound-waves {
  display: none;
}

.sound-toggle.is-off .sound-cross {
  display: inline;
}

/* Hidden until script.js takes over, or reveals everything if GSAP fails to load. */
.intro [data-intro],
.intro .wordmark-letter {
  visibility: hidden;
}

/* Larger screens get a wider margin. */
@media (min-width: 481px) {
  :root {
    --page-side: var(--space-5);
  }
}

/* Short screens tighten the gaps between groups. */
@media (max-height: 700px) {
  :root {
    --gap-group: var(--space-5);
  }
}

@media (max-width: 480px) {
  .signup-row {
    flex-direction: column;
  }

  .signup-input {
    flex: none;
  }
}

/* Phones held sideways: logo on the left, everything else on the right.
   The right padding keeps the form clear of the sound button. */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --lockup: 28vw;
    --gap-group: var(--space-4);
  }

  .page {
    flex-direction: row;
    gap: var(--space-6);
    padding: var(--space-4) 72px var(--space-4) var(--space-5);
  }

  .brand {
    flex: 0 0 auto;
    width: auto;
  }

  .details {
    align-items: flex-start;
    text-align: left;
  }

  .tagline {
    margin-top: 0;
    font-size: 1.375rem;
  }

  .description {
    margin-top: var(--space-2);
  }

  .description,
  .signup-label {
    font-size: 0.875rem;
  }

  .signup-message,
  .contact-email {
    font-size: 0.875rem;
  }
}

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