/* Brand palette */
:root {
  --orange: #f07f25;
  --brown: #572e0d;
  --cream: #fff4cb;
  --radius: clamp(18px, 2.2vw, 32px);
}

@font-face {
  font-family: "Sango Rounded";
  /* woff2 first (30KB); the otf is a fallback for very old browsers (64KB) */
  src:
    url("fonts/sango-rounded-bold.woff2") format("woff2"),
    url("fonts/sango-rounded-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

/* One screen, never scrolls. */
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--cream);
  font-family: "Sango Rounded", system-ui, sans-serif;
}

/* Tray-paper artwork as the page background. The flat brown wash on top
 * keeps the doodles as texture rather than noise, so the copy stays legible. */
body {
  background-color: var(--brown);
  background-image:
    linear-gradient(rgba(87, 46, 13, 0.8), rgba(87, 46, 13, 0.8)),
    image-set(url("assets/bg-tray.webp") type("image/webp") 1x,
              url("assets/bg-tray.jpg") type("image/jpeg") 1x);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

/* Copy left, visual right. */
.page {
  height: 100vh;
  height: 100dvh;
  display: grid;
  /* Copy sized to itself, visual capped, the pair centred as one group. */
  grid-template-columns: auto minmax(0, 52vw);
  justify-content: center;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.75rem);
  padding:
    max(clamp(1.25rem, 3vh, 2.25rem), env(safe-area-inset-top))
    max(clamp(1.25rem, 4vw, 3rem), env(safe-area-inset-right))
    max(clamp(1.25rem, 3vh, 2.25rem), env(safe-area-inset-bottom))
    max(clamp(1.25rem, 4vw, 3rem), env(safe-area-inset-left));
}

/* ---- left column ---- */

.intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  justify-self: end; /* hug the visual instead of the left edge */
}

.headline {
  margin: 0 0 clamp(1.1rem, 3vh, 1.9rem);
  max-width: 7.8em; /* two lines, and no dead space beside them */
  font-size: clamp(1.75rem, 4.4vw, 4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--cream);
  text-shadow: 0 2px 14px rgba(87, 46, 13, 0.5);
}

/* Boxed field, in the style of the tray-paper callout: cream panel, solid
 * brown rule, squared off with just enough corner to match the print. */
.signup {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  width: min(100%, 22rem);
  padding: 0.34rem 0.34rem 0.34rem 0.85rem;
  background: var(--cream);
  border: 3px solid var(--brown);
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(87, 46, 13, 0.18);
}

#phone {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brown);
  background: none;
  border: 0;
  outline: none;
}

#phone::placeholder {
  color: rgba(87, 46, 13, 0.55);
}

/* Browsers force their own opaque background onto autofilled fields. This
 * transition is scheduled so far out that it never visibly lands. */
#phone:-webkit-autofill,
#phone:-webkit-autofill:hover,
#phone:-webkit-autofill:focus,
#phone:autofill,
#phone:autofill:focus {
  -webkit-text-fill-color: var(--brown);
  caret-color: var(--brown);
  transition: background-color 600000s 0s, color 600000s 0s;
}

.signup button {
  flex: none;
  padding: 0.45rem 1.05rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--orange);
  border: 2px solid var(--brown);
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.signup button:hover {
  transform: translateY(-1px);
}

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

/* Centred beneath the field, matched to its width. */
.note {
  width: min(100%, 22rem);
  margin: 0.75rem 0 0;
  font-size: clamp(0.88rem, 1.05vw, 1rem);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-align: center;
  color: rgba(255, 244, 203, 0.85);
}

.note.is-error {
  color: var(--orange);
}

/* ---- social: bare glyphs, no chrome ---- */

/* Centred beneath the field, matched to its width. */
.social {
  display: flex;
  justify-content: center;
  gap: 1rem;
  width: min(100%, 22rem);
  margin-top: clamp(1.2rem, 3.5vh, 2.1rem);
}

.social a {
  display: block;
  color: var(--cream);
  line-height: 0;
  transition: color 0.2s ease, transform 0.15s ease;
}

.social a:hover {
  color: var(--orange);
  transform: translateY(-2px);
}

.social svg {
  width: 1.35rem;
  height: 1.35rem;
}

/* Facebook / Instagram / TikTok: matching cream badges, icon in brown. */
.social a.badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  color: var(--brown);
  background: var(--cream);
  border-radius: 30%;
}
.social a.badge:hover {
  color: var(--brown);
  background: var(--orange);
}
.social a.badge svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

/* Instagram's glyph is drawn as an outline, so it strokes instead of fills. */
.social a.badge svg.icon-outline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

/* ---- right column: 16:9 visual, sized to fit rather than fill ---- */

.stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 100%;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden; /* clips the video to the rounded corners */
  background: rgba(255, 244, 203, 0.06);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.visual {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  pointer-events: none;
}

/* ---- audio switch: cup slides left (off) to right (on) ---- */
.audio {
  position: absolute;
  right: clamp(0.6rem, 1.4vw, 1rem);
  bottom: clamp(0.6rem, 1.4vw, 1rem);
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-size: clamp(0.75rem, 0.85vw, 0.88rem);
  color: var(--cream);
}
.audio-icon {
  width: 1.5em;
  height: 1.5em;
  fill: none;
  stroke: var(--cream);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(87, 46, 13, 0.7)); /* legible over the video */
  cursor: pointer;
}
.audio-speaker {
  fill: var(--cream);
}
.audio-waves {
  opacity: 0;
  transform-origin: 3.5px 12px; /* speaker tip, so the waves grow outward from it */
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.audio-icon--on .audio-waves {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .audio-waves {
    transition: none;
  }
}
.sound {
  position: relative;
  font-size: inherit; /* buttons don't inherit by default; the switch is sized in em */
  width: 2.4em;
  height: 1.2em;
  padding: 0;
  background: var(--cream);
  border: 2px solid var(--brown);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.sound:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}
.sound-knob {
  position: absolute;
  top: 50%;
  left: -0.9em;
  width: 2.3em;
  height: 2.3em;
  transform: translateY(-56%) rotate(-10deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.cup {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.35));
  transition: opacity 0.2s ease 0.08s;
}
.cup-on {
  opacity: 0;
}
.sound[aria-checked="true"] {
  background: var(--orange);
}
.sound[aria-checked="true"] .sound-knob {
  transform: translate(1.8em, -56%) rotate(10deg);
}
.sound[aria-checked="true"] .cup-on {
  opacity: 1;
}
.sound[aria-checked="true"] .cup-off {
  opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
  .sound-knob,
  .cup {
    transition: none;
  }
}


.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;
}

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

/* ---- stacked: visual on top, copy beneath, still one screen ---- */

@media (max-width: 860px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    /* Breathing room between the visual and the copy below it. */
    gap: clamp(2.25rem, 8vh, 4rem);
  }

  .stage {
    grid-row: 1;
  }

  .intro {
    grid-row: 2;
    justify-self: center;
    align-items: center;
    text-align: center;
  }

  .headline {
    margin: 0 0 1.1rem;
    max-width: 16em;
    font-size: clamp(1.5rem, 6.4vw, 2.4rem);
  }

  /* Off the visual, pinned to the screen corner, a touch larger for thumbs. */
  .audio {
    position: fixed;
    /* Base rule pins this right; `right: auto` is required, because an
       auto-width fixed box with both left and right set stretches to
       span the viewport instead of hugging the corner. */
    right: auto;
    left: max(1rem, env(safe-area-inset-left));
    bottom: max(1rem, env(safe-area-inset-bottom));
    font-size: 1.25rem;
    z-index: 10;
  }
}

/* Landscape phones: keep the split, shrink the type. */
@media (max-height: 520px) and (min-width: 861px) {
  .headline {
    font-size: clamp(1.3rem, 3.4vw, 2.1rem);
    margin-bottom: 0.9rem;
  }

  .social {
    margin-top: 0.9rem;
  }
}
