/* ==========================================================================
   ggates1020 — base site
   Palette: Chrome Black #0D0D0D · Digital Lilac #D9B8FF
   ========================================================================== */

:root {
  --black: #0D0D0D;
  --black-2: #151515;
  --black-3: #1E1E1E;
  --lilac: #D9B8FF;
  --lilac-soft: rgba(217, 184, 255, 0.14);
  --lilac-line: rgba(217, 184, 255, 0.22);
  --text: #F4EEFB;
  --text-muted: #9B94A6;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 28px;
  --gutter: clamp(20px, 5vw, 64px);
  --max: 1200px;
}

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

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

::selection { background: var(--lilac); color: var(--black); }

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

h1, h2, h3 { margin: 0; line-height: 1.02; letter-spacing: -0.035em; font-weight: 800; }

.eyebrow {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lilac);
}

.muted { color: var(--text-muted); }

/* ---------- Buttons & pills ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), background 0.3s;
}
.btn span { transition: transform 0.3s var(--ease-out); }
.btn--primary { background: var(--lilac); color: var(--black); }
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px -8px rgba(217, 184, 255, 0.55);
}
.btn--primary:hover span { transform: translateX(4px); }
.btn--ghost { border: 1px solid var(--lilac-line); color: var(--text-muted); }
.btn--lg { font-size: clamp(16px, 2.4vw, 22px); padding: 18px 34px; }
.is-disabled { cursor: default; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--lilac-line);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.pill--live, .pill--wip { color: var(--lilac); }
.pill--live::before, .pill--wip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--lilac);
}
.pill--live::before { box-shadow: 0 0 0 0 var(--lilac); animation: ping 2s infinite; }
.pill--wip::before { background: transparent; border: 1.5px solid var(--lilac); }

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(217, 184, 255, 0.6); }
  80%, 100% { box-shadow: 0 0 0 8px rgba(217, 184, 255, 0); }
}

/* ---------- Progress bar ---------- */

.progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 100; }
.progress__bar {
  display: block;
  height: 100%;
  background: var(--lilac);
  transform-origin: left;
  transform: scaleX(0);
}

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

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px var(--gutter);
  transition: background 0.4s, padding 0.4s var(--ease-out), border-color 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  padding-block: 14px;
  background: rgba(13, 13, 13, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: rgba(255, 255, 255, 0.06);
}
.nav__logo { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }
.nav__logo span { color: var(--lilac); }
.nav__links { display: flex; gap: clamp(18px, 3vw, 36px); font-size: 15px; font-weight: 500; }
.nav__links a { color: var(--text-muted); transition: color 0.2s; }
.nav__links a:hover { color: var(--lilac); }

/* ---------- Side rail ---------- */

.rail {
  position: fixed;
  left: calc(var(--gutter) / 2 - 12px);
  top: 50%;
  z-index: 40;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
.rail.is-visible { opacity: 1; pointer-events: auto; }
.rail a {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.45;
  transition: opacity 0.3s, color 0.3s, transform 0.3s var(--ease-out);
}
.rail a.is-active { color: var(--lilac); opacity: 1; transform: translateX(4px); }
@media (max-width: 1100px) { .rail { display: none; } }

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

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 140px var(--gutter) 120px;
  max-width: var(--max);
  margin: 0 auto;
}
.hero__glow {
  position: absolute;
  top: 10%;
  right: -10%;
  width: min(70vw, 760px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 184, 255, 0.35), rgba(217, 184, 255, 0) 65%);
  filter: blur(40px);
  z-index: -1;
  animation: drift 14s ease-in-out infinite alternate;
}
.hero__grid {
  position: absolute;
  inset: 0 calc(-1 * var(--gutter));
  z-index: -2;
  background-image:
    linear-gradient(rgba(217, 184, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 184, 255, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 60% 40%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 60% 40%, #000 20%, transparent 70%);
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-12%, 10%) scale(1.15); }
}

.hero__title { font-size: clamp(52px, 11vw, 148px); font-weight: 900; }
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero__title .line > span {
  display: inline-block;
  transform: translateY(105%);
  animation: rise 1.1s var(--ease-out) forwards;
}
.hero__title .line:nth-child(2) > span { animation-delay: 0.12s; }
.hero__title em { font-style: normal; color: var(--lilac); }

.hero__eyebrow, .hero__lede, .hero__cta {
  opacity: 0;
  animation: fade-up 1s var(--ease-out) forwards;
}
.hero__eyebrow { animation-delay: 0.05s; }
.hero__lede { animation-delay: 0.35s; }
.hero__cta { animation-delay: 0.5s; align-self: flex-start; }

.hero__lede {
  max-width: 560px;
  margin: 32px 0 40px;
  font-size: clamp(18px, 2vw, 21px);
  color: var(--text-muted);
}

@keyframes rise { to { transform: translateY(0); } }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  width: 26px; height: 42px;
  border: 2px solid var(--lilac-line);
  border-radius: 20px;
  transform: translateX(-50%);
}
.scroll-cue span {
  position: absolute;
  top: 8px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--lilac);
  animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}

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

.marquee {
  overflow: hidden;
  border-block: 1px solid rgba(255, 255, 255, 0.06);
  padding: 22px 0;
  background: var(--black-2);
}
.marquee__track {
  display: flex;
  gap: 36px;
  width: max-content;
  align-items: center;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  animation: marquee 32s linear infinite;
}
.marquee__track i { font-style: normal; color: var(--lilac); font-size: 0.6em; }
.marquee__track span:nth-of-type(even) { color: var(--lilac); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Section head ---------- */

.apps { max-width: var(--max); margin: 0 auto; padding: 140px var(--gutter) 40px; }
.section-head h2 { font-size: clamp(44px, 7vw, 88px); }

/* ---------- App block ---------- */

.app {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: clamp(40px, 7vw, 110px);
  min-height: 100vh;
  padding: 100px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 80px;
}
.app--flip .app__text { order: 2; }
.app--flip .app__visual { order: 1; }

.app__num {
  display: block;
  font-size: clamp(80px, 12vw, 150px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--lilac-line);
  margin-bottom: 20px;
}
.app__meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.app__name { font-size: clamp(40px, 5.5vw, 68px); }
.app__tagline {
  margin: 14px 0 22px;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 600;
  color: var(--lilac);
  letter-spacing: -0.01em;
}
.app__desc { margin: 0 0 24px; color: var(--text-muted); max-width: 520px; }
.app__features {
  list-style: none;
  padding: 0;
  margin: 0 0 36px;
  display: grid;
  gap: 10px;
  font-size: 16px;
}
.app__features li { display: flex; gap: 12px; align-items: center; }
.app__features li::before {
  content: "";
  width: 18px; height: 1.5px;
  background: var(--lilac);
  flex: none;
}

.app__visual { display: flex; justify-content: center; perspective: 1400px; }

/* ---------- Phone frame ---------- */

.phone {
  --rx: 0deg;
  --ry: 0deg;
  --ty: 0px;
  position: relative;
  width: min(300px, 72vw);
  aspect-ratio: 9 / 19;
  padding: 12px;
  border-radius: 48px;
  background: linear-gradient(145deg, #2A2A2E, #121214);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.08),
    0 50px 100px -30px rgba(0, 0, 0, 0.9),
    0 0 120px -20px rgba(217, 184, 255, 0.35);
  transform: translateY(var(--ty)) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  will-change: transform;
}
.phone::before { /* dynamic island */
  content: "";
  position: absolute;
  top: 22px; left: 50%;
  width: 84px; height: 24px;
  margin-left: -42px;
  border-radius: 20px;
  background: #000;
  z-index: 3;
}
.phone__screen {
  position: relative;
  height: 100%;
  border-radius: 38px;
  overflow: hidden;
  background: var(--black);
}

/* ---------- Mock: CardSnap ---------- */

.mock-cardsnap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 60px 22px 30px;
  background: radial-gradient(circle at 50% 40%, #2A2433, var(--black) 70%);
}
.cs-finder { position: relative; width: 82%; aspect-ratio: 63 / 88; padding: 10px; }
.cs-corner { position: absolute; width: 22px; height: 22px; border: 3px solid var(--lilac); }
.cs-corner.tl { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.cs-corner.tr { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.cs-corner.bl { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.cs-corner.br { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }
.cs-card {
  height: 100%;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(160deg, #3A2B2B, #1E1618);
  border: 3px solid #0A0A0A;
}
.cs-card > div { border-radius: 4px; background: rgba(255, 255, 255, 0.12); }
.cs-card__title { height: 14px; }
.cs-card__art { flex: 1; background: linear-gradient(135deg, #C77D4A, #6B2E2E) !important; }
.cs-card__type { height: 10px; }
.cs-card__text { height: 26px; background: rgba(255, 255, 255, 0.08) !important; }
.cs-card__text.short { height: 12px; width: 60%; }
.cs-scanline {
  position: absolute;
  left: 4%; right: 4%;
  height: 2px;
  background: var(--lilac);
  box-shadow: 0 0 18px 4px rgba(217, 184, 255, 0.6);
  animation: scan 2.6s ease-in-out infinite alternate;
}
@keyframes scan { from { top: 6%; } to { top: 94%; } }
.cs-result {
  width: 100%;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(217, 184, 255, 0.12);
  border: 1px solid var(--lilac-line);
  font-size: 13px;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s var(--ease-out) 0.9s, transform 0.6s var(--ease-out) 0.9s;
}
.cs-result span { color: var(--lilac); font-size: 12px; }
.is-visible .cs-result { opacity: 1; transform: none; }

/* ---------- Mock: Scatterbox ---------- */

.mock-scatterbox {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 60px 18px 30px;
}
.sb-board { position: relative; aspect-ratio: 1; }
.sb-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  height: 100%;
}
.sb-cell {
  border-radius: 4px;
  background: var(--black-3);
  transition: background 0.4s, box-shadow 0.4s, transform 0.5s var(--ease-out);
  transform: scale(0.4);
  opacity: 0;
}
.is-visible .sb-cell {
  transform: scale(1);
  opacity: 1;
  transition-delay: calc(var(--d) * 12ms);
}
.sb-cell.is-atom { background: var(--lilac); box-shadow: 0 0 14px rgba(217, 184, 255, 0.8); }
.sb-ray { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sb-ray polyline {
  fill: none;
  stroke: #FF5A6E;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 1.5px #FF5A6E);
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
}
.is-visible .sb-ray polyline { animation: beam 2.2s var(--ease-out) 0.9s forwards; }
@keyframes beam { to { stroke-dashoffset: 0; } }
.sb-hud { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); padding: 0 4px; }
.sb-hud b { color: var(--lilac); margin-left: 4px; }

/* ---------- Mock: Upkeep (iPad host + iPhone peer) ---------- */

.uk-devices {
  --rx: 0deg;
  --ry: 0deg;
  --ty: 0px;
  position: relative;
  width: min(540px, 100%);
  padding: 0 0 90px 90px;
  transform: translateY(var(--ty)) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  will-change: transform;
}

.tablet {
  position: relative;
  aspect-ratio: 4 / 3;
  padding: 14px;
  border-radius: 36px;
  background: linear-gradient(145deg, #2A2A2E, #121214);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.08),
    0 50px 100px -30px rgba(0, 0, 0, 0.9),
    0 0 120px -20px rgba(217, 184, 255, 0.35);
}
.tablet::before { /* front camera */
  content: "";
  position: absolute;
  top: 5px; left: 50%;
  width: 5px; height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #000;
}
.tablet__screen {
  height: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: var(--black);
}

.phone--mini {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 26%;
  padding: 6px;
  border-radius: 26px;
  transform: translateZ(60px);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.1),
    0 30px 60px -10px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(0, 0, 0, 0.6);
}
.phone--mini::before { top: 12px; width: 34px; height: 10px; margin-left: -17px; }
.phone--mini .phone__screen { border-radius: 21px; }

.mock-upkeep {
  container-type: inline-size;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr auto;
  gap: 6px;
  padding: 8px;
}
.phone--mini .mock-upkeep { grid-template-rows: 1fr 1fr; gap: 4px; padding: 26px 5px 8px; }

.uk-seat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--black-3);
  transform: rotate(var(--r, 0deg));
  overflow: hidden;
}
.phone--mini .uk-seat { border-radius: 10px; }
.uk-seat:nth-child(1) { background: linear-gradient(160deg, #3B2D52, #1E1A26); }
.uk-seat:nth-child(4) { background: linear-gradient(160deg, #D9B8FF, #A98BD6); color: var(--black); }
.uk-seat b {
  font-size: 14cqw;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.uk-seat small { font-size: 2.6cqw; opacity: 0.7; margin-top: 4px; }
.phone--mini .uk-seat b { font-size: 20cqw; }
.phone--mini .uk-seat small { font-size: 6.5cqw; margin-top: 2px; }

/* Tap on the phone */
.uk-seat.is-tapped::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 60%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%) scale(0);
  animation: tap 0.6s var(--ease-out);
}
@keyframes tap {
  to { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

/* Change arrives on the iPad */
.uk-seat.is-synced b { animation: synced 0.7s var(--ease-out); }
.uk-seat.is-synced { box-shadow: inset 0 0 0 2px var(--lilac); transition: box-shadow 0.15s; }
@keyframes synced {
  0% { transform: scale(1); }
  30% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
.uk-delta {
  position: absolute;
  top: 18%;
  right: 16%;
  font-size: 4cqw;
  font-weight: 800;
  color: var(--lilac);
  animation: delta 1s var(--ease-out) forwards;
  pointer-events: none;
}
.uk-seat:nth-child(4) .uk-delta { color: var(--black); }
@keyframes delta {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-40%); }
}

.uk-sync {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 4px 0 2px;
  font-size: 12px;
  color: var(--text-muted);
}
.uk-sync span { width: 7px; height: 7px; border-radius: 50%; background: var(--lilac); animation: ping 2s infinite; }

@media (max-width: 520px) {
  .uk-devices { padding: 0 0 60px 52px; }
  .tablet { padding: 9px; border-radius: 24px; }
  .tablet__screen { border-radius: 15px; }
  .uk-sync { font-size: 10px; }
  .phone--mini { border-radius: 20px; padding: 4px; }
  .phone--mini .phone__screen { border-radius: 16px; }
  .phone--mini::before { top: 8px; width: 24px; height: 7px; margin-left: -12px; }
  .phone--mini .mock-upkeep { padding-top: 18px; }
}

/* ---------- About ---------- */

.about { padding: 160px var(--gutter); background: var(--lilac); color: var(--black); }
.about .eyebrow { color: var(--black); opacity: 0.6; }
.about__inner { max-width: var(--max); margin: 0 auto; }
.about__big {
  margin: 0;
  font-size: clamp(28px, 4.4vw, 56px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.about .muted { color: rgba(13, 13, 13, 0.5); }

/* ---------- Contact ---------- */

.contact {
  max-width: var(--max);
  margin: 0 auto;
  padding: 180px var(--gutter);
  text-align: center;
}
.contact__title { font-size: clamp(56px, 12vw, 160px); font-weight: 900; }
.contact p { color: var(--text-muted); margin: 20px 0 40px; }

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

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px var(--gutter);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  color: var(--text-muted);
}
.footer a:hover { color: var(--lilac); }

/* ---------- Scroll reveal ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.9s var(--ease-out),
    transform 0.9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.js .reveal--scale { transform: translateY(60px) scale(0.92); }
.js .reveal.is-visible { opacity: 1; transform: none; }

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

@media (max-width: 860px) {
  .app,
  .app--flip {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 80px 0;
  }
  .app--flip .app__text,
  .app__text { order: 1; }
  .app--flip .app__visual,
  .app__visual { order: 2; }
  .apps { padding-top: 100px; }
  .about, .contact { padding-block: 110px; }
}

@media (max-width: 520px) {
  body { font-size: 17px; }
  .nav__links { gap: 16px; font-size: 14px; }
  .footer { flex-direction: column; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .marquee__track { animation: none; }
}

/* ---------- App actions ---------- */

.app__actions { display: flex; flex-wrap: wrap; gap: 12px; }
a.btn--ghost { color: var(--text); }
a.btn--ghost:hover { border-color: var(--lilac); color: var(--lilac); transform: translateY(-2px); }
.btn .apple { width: 15px; height: 18px; margin-top: -3px; }
