/* Droplet landing page
 * Look-and-feel mirrors the iOS app: deep teal/black, generous spacing,
 * monospaced-numeric energy, soft white pill CTA with a faint glow. */

:root {
  --bg: #04302d;
  --bg-deep: #021917;
  --fg: #fff;
  --fg-dim: rgba(255, 255, 255, 0.55);
  --fg-faint: rgba(255, 255, 255, 0.35);
  --pill-bg: rgba(20, 20, 20, 0.55);
  --pill-border: rgba(255, 255, 255, 0.08);
  --cta-bg: #f4f4f4;
  --cta-fg: #0b0b0b;
  --radius-phone: clamp(28px, 4vw, 48px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fallback colour lives only on html so a video at z-index:-1 can still
 * render in front of it. body must stay transparent — an opaque body
 * background would sit over the video and the whole page would read flat. */
html { background: var(--bg-deep); }
body { background: transparent; }

/* Only the landing page locks to a single viewport. Long-form pages
 * (privacy, etc.) leave the lock off and scroll normally. */
html.is-locked, body.is-locked {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Background layer.
 *
 * A muted, looping background video (Background video.mov) that fills the
 * viewport behind the rest of the UI. The teal `--bg` fallback covers the
 * first paint before the video can decode and any failure mode (autoplay
 * blocked, missing codec, etc.). `object-fit: cover` keeps the video's
 * native aspect ratio while filling the viewport. */
.bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  object-fit: cover;
  object-position: center;
  z-index: -1;
  background-color: var(--bg);
  pointer-events: none;
}


/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  width: min(1280px, calc(100% - 32px));
  height: 100px;
  /* The page is a viewport-locked column layout. Without this, the hero's
   * aspect-ratio'd phone stage forces the body to overflow and flex-shrink
   * collapses the nav down to its content height. */
  flex: 0 0 100px;
  margin: 16px auto 0;
  padding: 0 20px 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.nav__logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.nav__logo img {
  height: 36px;
  width: auto;
  display: block;
}

.nav__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 0 32px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--cta-fg);
  background: var(--cta-bg);
  border-radius: 999px;
  text-decoration: none;
  transition: transform 180ms var(--ease-out), box-shadow 220ms var(--ease-out), background 180ms var(--ease-out);
  box-shadow: 0 4px 30px rgba(255, 255, 255, 0.18);
}

.nav__cta:hover {
  background: #fff;
  box-shadow: 0 6px 36px rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.nav__cta:active {
  transform: translateY(0);
}

/* ---------- Hero ---------- */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 24px;
  width: min(1280px, 100%);
  margin: 0 auto;
  min-height: 0;
}

/* Title + subline live in their own flex column that fills the space between
 * the nav and the phones, so the text always optically centres in that band
 * regardless of viewport height. */
.hero__head {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Subline gets its own real breathing room below the title — feels
   * deliberate rather than tucked under the headline. */
  gap: clamp(24px, 3vw, 44px);
}

.hero__title {
  font-size: clamp(34px, 6.4vw, 88px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--fg);
  text-wrap: balance;
}

.hero__sub {
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  letter-spacing: -0.012em;
  line-height: 1.3;
  text-wrap: balance;
  /* Reserve two lines of height so a longer rotating copy (which wraps on
   * narrow viewports) doesn't shove the phone trio downward when the
   * subline grows from one line to two during the rotation. The slot is
   * centred vertically so a one-line message still sits where the eye
   * expects it. */
  min-height: 2.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Swap animation: copy drifts upward and softens out, then the new line
   * settles back into place from a touch above. Pairs with the centre
   * phone's transition so they finish in lockstep. */
  transform-origin: 50% 50%;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition:
    opacity 260ms ease-out,
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 260ms ease-out;
}
.hero__sub.is-swapping {
  opacity: 0;
  transform: translateY(-8px) scale(0.985);
  filter: blur(2px);
}

/* ---------- Phones ---------- */

.phones {
  position: relative;
  width: 100%;
  max-width: 1100px;
  /* Bind the stage to a fraction of the viewport so the title + subline
   * always have a real share of the screen — previously the aspect-ratio
   * + max-width combo could eat 75%+ of the column on wide displays. */
  height: min(56vh, 56vw);
  margin: 0 auto;
  overflow: hidden;
  flex: 0 0 auto;
}

.phone {
  position: absolute;
  left: 50%;
  /* Anchor to the top so the status-bar / drink-summary stays in frame at
   * every aspect ratio. Bottoms overflow the (shorter) stage and get
   * clipped — that's the intended "phones hanging from the subline" look. */
  top: 0;
  /* Phone width as a fraction of the stage. The screenshots are 1218×2478 ≈
   * 0.491 aspect; we scale by width and let height follow via aspect-ratio. */
  width: 32%;
  aspect-ratio: 1218 / 2478;
  border-radius: var(--radius-phone);
  overflow: hidden;
  /* Soft inset edge + outer shadow gives the cards a bit of depth without
   * looking like a stock device mockup frame. */
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 40px 80px rgba(0, 0, 0, 0.55),
    0 12px 40px rgba(0, 0, 0, 0.35);

  transform-origin: 50% 0%;
  will-change: transform, opacity;
  /* Sequential-swap timing.
   *
   * Earlier the outgoing center phone and the incoming back phone moved
   * simultaneously, sliding right through each other on screen. Now they
   * take turns: phones moving to a back slot fire immediately, and phones
   * moving to the centre wait until the outgoing one has settled. Combined
   * with the timing-function overrides below, the centre phone gets a
   * confident step-forward with a touch of overshoot, and the outgoing
   * one drifts out cleanly behind it. */
  transition:
    transform 520ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 420ms ease-out,
    z-index 0s linear 520ms;
}

.phone img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Position slots — JS swaps the `data-pos` attribute on each phone to rotate
 * them through these three states. The center slot sits forward and fully
 * opaque; the side slots tuck behind, slightly lower, slightly tilted, at
 * 50% opacity. */

.phone[data-pos="center"] {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  z-index: 3;
  /* Wait for the outgoing phone to clear out before stepping forward.
   * Slight overshoot eases the arrival so it reads as "stepping up". */
  transition-delay: 520ms;
  transition-timing-function: cubic-bezier(0.34, 1.35, 0.64, 1);
}

.phone[data-pos="left"] {
  transform: translate(calc(-50% - 65%), 6%) scale(0.92);
  opacity: 0.5;
  z-index: 1;
}

.phone[data-pos="right"] {
  transform: translate(calc(-50% + 65%), 6%) scale(0.92);
  opacity: 0.5;
  z-index: 1;
}

/* Wrap-around handling.
 *
 * In the rotation cycle (left → center → right → left), one phone has to
 * jump the full width of the stage from right back to left each tick.
 * Letting CSS transition the transform smoothly would slide it across the
 * front of the others, which is the "phones go through each other" effect
 * the design needs to avoid. Instead we:
 *   - run a keyframed opacity fade (visible → 0 → visible) on the wrap phone
 *   - cancel the transform transition so the position change happens at the
 *     fade's midpoint, while the phone is invisible
 * The two phones moving rightward (center→right, left→center) stay on the
 * normal transition path and never overlap because they keep their order. */
.phone.is-wrapping {
  animation: phone-wrap 1100ms ease-in-out;
  transition:
    transform 0s linear 550ms,
    opacity 0s linear 0s,
    z-index 0s linear 550ms;
}

@keyframes phone-wrap {
  0%   { opacity: 0.5; }
  25%  { opacity: 0; }
  60%  { opacity: 0; }
  100% { opacity: 0.5; }
}

/* ---------- Footer ---------- */

/* Footer pieces sit pinned to the bottom corners of the viewport so the
 * page reads as one screen-sized composition rather than a scrollable layout. */
.footer {
  font-size: 13px;
  color: var(--fg-faint);
  pointer-events: none;
}

.footer__copy {
  position: fixed;
  left: 32px;
  bottom: 24px;
  letter-spacing: -0.005em;
  pointer-events: auto;
}

.footer__links {
  position: fixed;
  right: 32px;
  bottom: 24px;
  display: flex;
  gap: 20px;
  pointer-events: auto;
}

.footer__links a {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 160ms var(--ease-out);
}

.footer__links a:hover {
  color: var(--fg);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .phones {
    aspect-ratio: 5 / 4;
    max-width: 640px;
  }
  .phone { width: 42%; }
  .phone[data-pos="left"]  { transform: translate(calc(-50% - 26%), 6%) scale(0.94); }
  .phone[data-pos="right"] { transform: translate(calc(-50% + 26%), 6%) scale(0.94); }
}

@media (max-width: 560px) {
  .nav {
    width: calc(100% - 16px);
    height: 56px;
    flex: 0 0 56px;
    margin-top: 10px;
    padding: 0 8px 0 20px;
  }
  .nav__logo img { height: 20px; }
  /* Lock the CTA to a height that fits inside the 56px mobile nav with
   * breathing room — otherwise the desktop's 64px height made it overflow
   * the navbar pill vertically and visually. */
  .nav__cta {
    height: 40px;
    padding: 0 16px;
    font-size: 13px;
  }

  .hero {
    /* Centre the whole hero (text block + phones) as one vertical group so
     * the phones float in the visible middle of the screen rather than
     * crashing into the pinned footer links at the bottom. */
    padding: 12px 20px 0;
    justify-content: center;
    gap: 18px;
  }
  .hero__head {
    flex: 0 0 auto;
  }
  .hero__title {
    font-size: 38px;
  }
  .hero__sub {
    font-size: 17px;
  }

  .phones {
    /* Grow into available viewport height — dvh recomputes when iOS
     * Safari's URL bar shows / hides so we don't undersize the stage when
     * the bar is hidden or overshoot it when the bar is visible. */
    height: min(64dvh, 150vw);
    max-width: 400px;
    aspect-ratio: auto;
    /* Reserve a clear band for the corner footer so the phone bottoms
     * never touch "App Store" / "Privacy" / "© Droplet". */
    margin-bottom: 56px;
  }
  /* Mobile phones are sized by HEIGHT (not width) so they always fit
   * vertically inside the dvh-bound stage — width derives from the
   * aspect-ratio rule on .phone. This stops the phone from clipping at
   * the bottom on short viewports while still letting it grow large on
   * taller ones. */
  .phone {
    width: auto;
    height: 88%;
  }
  .phone[data-pos="left"]  { transform: translate(calc(-50% - 36%), 5%) scale(0.9); }
  .phone[data-pos="right"] { transform: translate(calc(-50% + 36%), 5%) scale(0.9); }

  .footer__copy {
    left: 16px;
    bottom: 16px;
    font-size: 12px;
  }
  .footer__links {
    right: 16px;
    bottom: 16px;
    gap: 14px;
    font-size: 12px;
  }
}

/* Respect reduced-motion: hold the initial layout, skip the rotation cadence. */
@media (prefers-reduced-motion: reduce) {
  .phone { transition: none; }
}
