:root {
  --bg-0: #05071d;
  --bg-1: #0a0f3f;
  --bg-2: #2b0d38;
  --ink: #eef1ff;
  --muted: #a8aed1;
  --accent: #8d5cff;
  --accent-soft: #5e3dd6;

  --page-x: clamp(1.25rem, 4vw, 3.5rem);
  --page-y: clamp(1.25rem, 2.8vh, 2.25rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(70vw 80vh at 18% 22%, rgba(123, 92, 255, 0.22), transparent 64%),
    radial-gradient(58vw 72vh at 77% 30%, rgba(255, 77, 195, 0.2), transparent 67%),
    linear-gradient(115deg, var(--bg-1) 0%, #050930 42%, var(--bg-2) 100%);
  overflow-x: hidden;
}

.cosmos {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(38vw 34vw at 74% 26%, rgba(171, 80, 244, 0.16), transparent 70%),
    radial-gradient(28vw 28vw at 26% 72%, rgba(70, 105, 255, 0.13), transparent 72%);
}

main {
  min-height: 100dvh;
  display: grid;
  align-items: center;
  padding: var(--page-y) var(--page-x);
}

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

.brand img {
  width: clamp(150px, 15vw, 212px);
  height: auto;
  display: block;
}

/* ─── Hero layout ─────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(2rem, 5vw, 6rem);
  align-items: center;
  width: 100%;
  min-height: min(calc(100dvh - (var(--page-y) * 2)), 860px);
}

.hero-copy {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-copy .brand {
  margin-bottom: clamp(1rem, 2vh, 1.5rem);
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2.3rem, 3.45vw, 3.55rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.hero-copy h1 span {
  display: block;
  white-space: nowrap;
}

.sub {
  margin: clamp(1.25rem, 2.6vh, 2rem) 0 0;
  font-size: clamp(1.25rem, 2.1vw, 2.1rem);
  line-height: 1.3;
  color: var(--muted);
}

.sub span {
  display: block;
  white-space: nowrap;
}

.app-store-badge {
  display: inline-flex;
  align-self: flex-start;
  margin-top: clamp(1.4rem, 2.8vh, 2.3rem);
  line-height: 0;
  border-radius: 13px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.app-store-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.app-store-badge img {
  width: clamp(190px, 17vw, 250px);
  height: auto;
  display: block;
}

/* ─── Carousel ─────────────────────────────────────────────────── */

.carousel {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

/*
 * All slides are stacked on top of each other via position:absolute.
 * The active slide is centered (z-index 3). Prev/next are offset
 * left/right and scale down so they peek from *behind* the active
 * phone — matching the mockup's "stacked deck" look.
 * overflow:hidden clips anything that extends beyond the frame.
 */
.c-frame {
  width: 100%;
  height: min(64dvh, 600px);
  min-height: 360px;
  position: relative;
  /* clip-path instead of overflow:hidden — clips slides left/right/top
     but extends 40px below so phone drop-shadows aren't cut off */
  clip-path: inset(0 0 -40px 0);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

.c-frame:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.c-frame.is-dragging {
  cursor: grabbing;
}

/* ── Slide states ───────────────────────────────────────────────
 *
 * translateX % is relative to the slide's own width (= frame width).
 * At 22% shift: the side phone's center is at ~22% from the frame
 * center, so its inner edge tucks behind the active phone and only
 * the outer ~38% peeks out — no clipping needed at the frame edges.
 */
.c-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.42s ease, opacity 0.42s ease;
  z-index: 1;
  /* Default: off to the right, invisible */
  transform: translateX(60%) scale(0.78);
  opacity: 0;
  pointer-events: none;
}

.c-slide.is-before {
  transform: translateX(-60%) scale(0.78);
  opacity: 0;
}

.c-slide.is-after {
  transform: translateX(60%) scale(0.78);
  opacity: 0;
}

.c-slide.is-prev {
  transform: translateX(-22%) scale(0.86);
  opacity: 0.65;
  z-index: 2;
  pointer-events: auto;
}

.c-slide.is-next {
  transform: translateX(22%) scale(0.86);
  opacity: 0.65;
  z-index: 2;
  pointer-events: auto;
}

.c-slide.is-active {
  transform: translateX(0) scale(1);
  opacity: 1;
  z-index: 3;
  pointer-events: auto;
}

/* ─── Phone frame ──────────────────────────────────────────────── */

/*
 * Realistic iPhone 15 Pro chrome via layered box-shadows:
 *   ring 1 — inner screen-edge glow
 *   ring 2 — dark gap between screen and frame
 *   ring 3 — titanium mid ring
 *   ring 4 — titanium outer ring
 *   ring 5 — outer dark rim / ground shadow
 *   ring 6/7 — depth drop shadow
 * Dynamic Island overlays the top of the screenshot so the CSS
 * pill perfectly masks the one already in the screenshot pixels.
 */

.phone {
  aspect-ratio: 393 / 852;   /* iPhone 15 logical resolution */
  height: 90%;
  width: auto;
  border-radius: 11.2% / 5.17%; /* Circular corners: h=11.2%×width, v=5.17%×height → equal px for 393:852 ratio */
  overflow: hidden;
  position: relative;
  background: #050505;
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.07),   /* screen edge glow  */
    0 0 0 2px   #1a1a20,                             /* dark inner gap    */
    0 0 0 3.5px rgba(185, 185, 200, 0.30),           /* titanium mid ring */
    0 0 0 5px   rgba(110, 110, 125, 0.40),           /* titanium rim      */
    0 0 0 6px   rgba(12, 12, 18, 0.95),              /* outer dark rim    */
    0 18px 45px rgba(0, 0, 0, 0.55),                 /* deep drop shadow  */
    0 5px  14px rgba(0, 0, 0, 0.30);                 /* close shadow      */
}

/* Dynamic Island — pure black pill overlaying the screenshot's notch */
.phone-island {
  position: absolute;
  top: 1.8%;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  height: 3.6%;
  background: #000;
  border-radius: 999px;
  z-index: 5;
  pointer-events: none;
}

/* Faint front-camera dot inside the island */
.phone-island::after {
  content: '';
  position: absolute;
  right: 16%;
  top: 50%;
  transform: translateY(-50%);
  width: 26%;
  height: 68%;
  background: #0d0d0d;
  border-radius: 999px;
}

.phone img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* ─── Dots ─────────────────────────────────────────────────────── */

.c-dots {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease;
}

.dot:hover {
  transform: scale(1.15);
}

.dot.is-active {
  background: #fff;
  transform: scale(1.15);
}

/* ─── Reveal animation ─────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 440ms ease, transform 440ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Tablet / stacked layout (≤ 1100px) ──────────────────────── */

@media (max-width: 1100px) {
  main {
    min-height: auto;
    align-items: stretch;
  }

  .hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: clamp(2rem, 5vh, 4rem);
    min-height: auto;
  }

  .hero-copy {
    max-width: 760px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-copy h1 {
    font-size: clamp(1.8rem, 6.8vw, 2.7rem);
    line-height: 1.05;
    max-width: 18ch;
    white-space: normal;
    text-wrap: balance;
  }

  .hero-copy h1 span {
    white-space: normal;
    display: inline;
  }

  .sub {
    margin-top: 1rem;
    font-size: clamp(0.95rem, 3.8vw, 1.26rem);
    max-width: 36ch;
    white-space: normal;
  }

  .sub span {
    white-space: normal;
    display: inline;
  }

  .app-store-badge {
    align-self: auto;
    margin-top: 1.25rem;
  }

  .app-store-badge img {
    width: clamp(156px, 44vw, 240px);
  }

  .carousel {
    width: 100%;
    gap: 1.25rem;
    margin-top: 1.5rem;
  }

  .c-frame {
    height: clamp(380px, 56vh, 560px);
    min-height: 380px;
  }
}

/* ─── Mobile (≤ 640px) ─────────────────────────────────────────── */

@media (max-width: 640px) {
  :root {
    --page-x: 1.1rem;
    --page-y: 0.75rem;
  }

  .brand img {
    width: 148px;
  }

  .hero-copy h1 {
    font-size: clamp(1.5rem, 7vw, 2rem);
    max-width: 14ch;
  }

  .sub {
    margin-top: 0.85rem;
    font-size: clamp(0.88rem, 4vw, 1.08rem);
    max-width: 28ch;
  }

  .app-store-badge img {
    width: clamp(140px, 50vw, 200px);
  }

  .carousel {
    margin-top: 1rem;
  }

  .c-frame {
    height: clamp(260px, 52vh, 420px);
    min-height: 260px;
  }

  /* .phone border-radius uses the % formula above — scales correctly at all sizes */
}

/* ─── Footer ───────────────────────────────────────────────────── */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem var(--page-x);
  font-size: 0.85rem;
  color: rgba(168, 174, 209, 0.5);
}

.site-footer nav {
  display: flex;
  gap: 1.25rem;
}

.site-footer a {
  color: rgba(168, 174, 209, 0.5);
  text-decoration: none;
  transition: color 180ms ease;
}

.site-footer a:hover {
  color: rgba(168, 174, 209, 0.9);
}
