/*
 * RallyCatch landing page. Tokens mirror packages/shared/src/theme.ts, so the
 * site and the app stay the same brand rather than two dark themes that drift.
 */

:root {
  --black: #0a0a0b;
  --surface: #141416;
  --surface-raised: #1c1c1f;
  --border: #2a2a2e;
  --lime: #d4ff3d;
  --lime-dim: #4a5518;
  --violet: #b58cff;
  --text: #ffffff;
  --text-secondary: #a1a1aa;
  --text-tertiary: #6b6b72;

  --radius-lg: 14px;
  --radius-xl: 24px;
  --shell: min(1180px, 100% - 2.5rem);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.04;
  margin: 0;
  /* Headlines are written to sit on one or two lines; balance keeps a stray word
     from dropping alone when the column is between breakpoints. */
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.1rem, 3.8vw, 3.4rem);
}

h2 {
  font-size: clamp(1.7rem, 2.85vw, 2.4rem);
}

h3 {
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

.accent {
  color: var(--lime);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary);
}

.lede {
  color: var(--text-secondary);
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  max-width: 42ch;
}

/* Two drifting orbs keep the flat black from reading as an empty page. */
.glow {
  position: fixed;
  z-index: 0;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.16;
  pointer-events: none;
  animation: drift 22s ease-in-out infinite alternate;
}

.glow--lime {
  top: -14vw;
  right: -10vw;
  background: var(--lime);
}

.glow--violet {
  top: 80vh;
  left: -16vw;
  background: var(--violet);
  animation-delay: -11s;
}

@keyframes drift {
  to {
    transform: translate3d(4vw, 6vw, 0) scale(1.15);
  }
}

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

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  padding: 1rem max(1.25rem, calc((100% - var(--shell)) / 2));
  background: rgba(10, 10, 11, 0);
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}

.nav.is-stuck {
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  margin-right: auto;
}

.nav__brand img {
  border-radius: 10px;
}

.nav__links {
  display: flex;
  gap: 1.75rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.nav__links a {
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav__links a:hover {
  color: var(--lime);
}

/* Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  padding: 0.95rem 1.6rem;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn--accent {
  background: var(--lime);
  color: var(--black);
  box-shadow: 0 10px 40px -12px rgba(212, 255, 61, 0.7);
}

.btn--accent:hover {
  transform: translateY(-2px);
  background: #e2ff6b;
}

.btn--sm {
  padding: 0.6rem 1.1rem;
  font-size: 0.88rem;
}

.btn--lg {
  padding: 1.1rem 2.2rem;
  font-size: 1.05rem;
}

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

.hero {
  position: relative;
  z-index: 1;
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6rem) 0 clamp(4rem, 8vw, 7rem);
  display: grid;
  /* The photo row carries the page, so it gets the wider half. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr);
  align-items: center;
  /* Wide enough that the lede never runs up against the first card, which the
     pointer parallax can still pull a little to the left. */
  gap: clamp(2rem, 6vw, 5.5rem);
}

.hero__copy {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero__cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero__note {
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

.stats {
  display: flex;
  gap: 2.5rem;
  margin: 0.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.stats dt {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.stats dd {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

/* The sign-in stack from the app: four cards in a row, each with the same white
   border, angle and caption. Sizes are multiples of the card width so the row
   scales as one piece; the app uses 96x122 with a 2px border and 16px radius. */
.hero__stack {
  position: relative;
  /* The row is 3.5 cards wide, so the width is capped to what the hero column
     can hold at each breakpoint rather than to the card alone. */
  --w: clamp(112px, 13.5vw, 170px);
  --h: calc(var(--w) * 1.27);
  /* Room for the tilt and the float, in the same proportion at every size. */
  height: calc(var(--h) + var(--w) * 0.3);
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.card {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Cards step by 0.833 of their width, the overlap the app screen uses. */
  --x: calc((var(--i) - 1.5) * var(--w) * 0.833);
  --y: 0px;
  width: var(--w);
  height: var(--h);
  margin: 0;
  padding: calc(var(--w) * 0.083);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.1em;
  overflow: hidden;
  border: calc(var(--w) * 0.021) solid #fff;
  border-radius: calc(var(--w) * 0.167);
  background: var(--surface);
  box-shadow: 0 30px 60px -25px rgba(0, 0, 0, 0.9);
  transform: translate(-50%, -50%) translate(var(--x), var(--y)) rotate(var(--r));
  animation: float 7s ease-in-out infinite;
  animation-delay: var(--d);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A full-body gym shot pinned to the head, so the card reads as a face. */
.card__photo--top {
  object-position: top center;
}

/* The scrim is part of the card in the app, not part of the photo. */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.45) 50%, rgba(0, 0, 0, 0.92) 100%);
}

.card figcaption {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.card figcaption strong {
  font-size: calc(var(--w) * 0.177);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.card figcaption span {
  font-size: calc(var(--w) * 0.104);
  opacity: 0.92;
  /* One line, clipped by the next card, exactly as the app screen does it. */
  white-space: nowrap;
}

@keyframes float {
  50% {
    transform: translate(-50%, -50%) translate(var(--x), calc(var(--y) - 16px)) rotate(var(--r));
  }
}

/* Marquee ------------------------------------------------------------ */

.marquee {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: 1.1rem 0;
  border-block: 1px solid var(--border);
  background: var(--surface);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee__track {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: max-content;
  animation: slide 38s linear infinite;
  font-weight: 700;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.marquee__track i {
  color: var(--lime);
  font-style: normal;
}

@keyframes slide {
  to {
    transform: translateX(-50%);
  }
}

/* Sections ----------------------------------------------------------- */

.section {
  position: relative;
  z-index: 1;
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 7.5rem) 0;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.section--split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(2rem, 4.5vw, 4rem);
  align-items: center;
}

.section--split > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.75rem;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.tile:hover {
  transform: translateY(-6px);
  border-color: var(--lime-dim);
}

.tile__num {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--lime);
}

.tile p {
  color: var(--text-secondary);
  font-size: 0.98rem;
}

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: var(--text-secondary);
}

.checks li {
  position: relative;
  padding-left: 1.85rem;
}

.checks li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.7rem;
  height: 0.35rem;
  border-left: 2px solid var(--lime);
  border-bottom: 2px solid var(--lime);
  transform: rotate(-45deg);
}

.checks--accent li {
  color: var(--text);
  font-weight: 500;
}

/* Phone mock with an auto-playing swipe loop ------------------------- */

/* iPhone shell: a titanium rail drawn with two gradients, a black bezel, and the
   side keys. Everything scales from --pw so one value resizes the whole device. */
.phone {
  --pw: min(340px, 76vw);
  --bezel: calc(var(--pw) * 0.032);

  position: relative;
  justify-self: center;
  width: var(--pw);
  padding: var(--bezel);
  border-radius: calc(var(--pw) * 0.155);
  background: linear-gradient(145deg, #7e7f86 0%, #34343a 18%, #1b1b1f 52%, #4b4c53 84%, #26262b 100%);
  box-shadow: 0 60px 110px -45px rgba(0, 0, 0, 1), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.phone__key {
  position: absolute;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #5a5b62, #2a2a2f);
}

.phone__key--action {
  left: -3px;
  top: 17%;
  height: 5.5%;
}

.phone__key--up {
  left: -3px;
  top: 26%;
  height: 9%;
}

.phone__key--down {
  left: -3px;
  top: 37%;
  height: 9%;
}

.phone__key--power {
  right: -3px;
  top: 29%;
  height: 13%;
}

.phone__screen {
  position: relative;
  aspect-ratio: 9 / 19.5;
  border-radius: calc(var(--pw) * 0.125);
  overflow: hidden;
  background: var(--black);
  padding: 0.7rem 0.7rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.78rem;
}

.island {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  height: calc(var(--pw) * 0.075);
  border-radius: 999px;
  background: #000;
  z-index: 5;
}

.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.15rem 0.5rem 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.status__icons {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  fill: #fff;
  color: #fff;
}

.status__icons svg {
  height: 0.62rem;
  width: auto;
}

.swipe {
  position: relative;
  flex: 1;
}

.swipe__card {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface-raised);
  opacity: 0;
  transform: scale(0.94) translateY(10px);
  transition: transform 0.55s cubic-bezier(0.3, 0.8, 0.3, 1), opacity 0.4s ease;
}

.swipe__card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.swipe__card.is-current {
  opacity: 1;
  transform: none;
  z-index: 2;
}

.swipe__card.is-leaving {
  opacity: 0;
  transform: translateX(115%) rotate(16deg);
  z-index: 3;
}

.swipe__meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 3rem 1rem 1rem;
  background: linear-gradient(to top, rgba(10, 10, 11, 0.96), transparent);
  font-size: 0.8rem;
}

.swipe__meta strong {
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.swipe__meta span {
  color: var(--lime);
}

.stamp {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: scale(0.8) rotate(-12deg);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.stamp--like {
  background: var(--lime);
  color: var(--black);
}

.is-leaving .stamp--like {
  opacity: 1;
  transform: scale(1) rotate(-12deg);
}

.swipe__controls {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
}

.round {
  display: grid;
  place-items: center;
  width: calc(var(--pw) * 0.135);
  height: calc(var(--pw) * 0.135);
  border-radius: 50%;
  font-size: 0.95rem;
}

.round svg {
  width: 48%;
  height: 48%;
}

.round--pass {
  background: var(--surface-raised);
  color: var(--text-secondary);
}

.round--like {
  background: var(--lime);
  fill: var(--black);
  box-shadow: 0 10px 26px -10px rgba(212, 255, 61, 0.9);
  animation: beat 2.4s ease-in-out infinite;
}

.app__tabs {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.6rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.app__tabs .is-active {
  color: var(--lime);
}

.phone__indicator {
  width: 32%;
  height: 4px;
  margin: 0.35rem auto 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

@keyframes beat {
  10%,
  30% {
    transform: scale(1.14);
  }
  20%,
  40%,
  100% {
    transform: scale(1);
  }
}

/* Premium and closing CTA -------------------------------------------- */

.premium {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(2rem, 4vw, 3.5rem);
  border-radius: var(--radius-xl);
  background: radial-gradient(120% 140% at 0% 0%, rgba(212, 255, 61, 0.1), transparent 60%),
    var(--surface);
  border: 1px solid var(--lime-dim);
}

.premium > div {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cta {
  align-items: center;
  text-align: center;
}


.cta .lede {
  max-width: 34ch;
}

/* Terms and Privacy --------------------------------------------------- */

.legal {
  position: relative;
  z-index: 1;
  width: min(44rem, 100% - 2.5rem);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 5rem);
}

.legal h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 0.4rem 0 0;
}

.legal h2 {
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  margin: 2.25rem 0 0.6rem;
}

.legal p,
.legal li {
  color: var(--text-secondary);
  margin: 0 0 0.85rem;
}

.legal ul {
  margin: 0 0 0.85rem;
  padding-left: 1.2rem;
}

.legal a {
  color: var(--lime);
}

.legal code {
  font-size: 0.9em;
  color: var(--text);
}

.legal p.legal__meta {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin: 0.55rem 0 2.25rem;
}

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

.footer {
  position: relative;
  z-index: 1;
  width: var(--shell);
  margin: 0 auto;
  padding: 2.5rem 0 3.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2rem;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-right: auto;
}

.footer__brand img {
  border-radius: 9px;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer__links a {
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.footer__legal {
  flex-basis: 100%;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

/* Real app screens ---------------------------------------------------- */

.section__head {
  display: grid;
  gap: 0.75rem;
}

.screens {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2.5rem);
  align-items: start;
}

.screens__item {
  margin: 0;
  display: grid;
  gap: 1.5rem;
  justify-items: center;
  text-align: center;
}

/* The middle phone sits lower, so the row reads as a set rather than a grid. */
.screens__item:nth-child(even) {
  margin-top: clamp(0rem, 4vw, 3rem);
}

.screens__item figcaption {
  display: grid;
  gap: 0.5rem;
  max-width: 30ch;
}

.screens__item figcaption p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.phone--shot {
  --pw: min(300px, 100%);
}

/* A simulator capture already has its own status bar and island. */
.phone--shot .phone__screen {
  padding: 0;
  display: block;
}

.phone__shot {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

@media (max-width: 900px) {
  .screens {
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: min(78vw, 300px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 1rem;
  }

  .screens__item {
    scroll-snap-align: center;
  }

  .screens__item:nth-child(even) {
    margin-top: 0;
  }
}

/* Invite banner (/i/CODE) -------------------------------------------- */

.is-hidden {
  display: none !important;
}

.btn--ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: var(--lime);
}

.invite {
  position: relative;
  z-index: 1;
  width: var(--shell);
  margin: clamp(1.5rem, 4vw, 3rem) auto 0;
}

.invite__card {
  display: grid;
  gap: 1rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(212, 255, 61, 0.45);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(212, 255, 61, 0.14), rgba(212, 255, 61, 0) 60%),
    var(--surface);
}

.invite__card .eyebrow {
  color: var(--lime);
}

.invite__body {
  color: var(--text-secondary);
  max-width: 60ch;
}

.invite__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.invite__hint {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .invite__actions {
    display: grid;
  }
}

/* Scroll reveals ------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 90ms);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

@media (max-width: 900px) {
  .hero,
  .section--split {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__stack {
    /* A phone is narrower than the row, so the cards shrink rather than clip. */
    --w: clamp(84px, 23vw, 150px);
    order: -1;
  }

  .nav__links {
    display: none;
  }

  .stats {
    gap: 1.5rem;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .glow,
  .card,
  .marquee__track,
  .round--like {
    animation: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
