/* ============ AppFleet — design system ============ */

:root {
  color-scheme: dark;
  --bg: #05060f;
  --bg-soft: #0b0d1d;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef0ff;
  --text-dim: #9aa0c3;
  --violet: #6d5cff;
  --teal: #00e0c6;
  --pink: #ff5ca8;
  --star: #ffcf5c;
  --badge-text: #c9c4ff;
  --grad: linear-gradient(120deg, var(--violet), var(--teal));
  --nav-bg: rgba(5, 6, 15, 0.72);
  --chip-bg: rgba(0, 0, 0, 0.25);
  --field-bg: rgba(0, 0, 0, 0.28);
  --card-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --marquee-bg: rgba(255, 255, 255, 0.02);
  --hero-glow: radial-gradient(ellipse 80% 60% at 50% -10%, #141738 0%, var(--bg) 60%);
  --blob-opacity-1: 0.35;
  --blob-opacity-2: 0.22;
  --blob-opacity-3: 0.16;
  --grain-opacity: 0.05;
  --radius: 20px;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4fb;
  --bg-soft: #ffffff;
  --surface: rgba(255, 255, 255, 0.66);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --border: rgba(20, 22, 43, 0.12);
  --text: #151832;
  --text-dim: #565b7a;
  --star: #e89b0c;
  --badge-text: #4a3fd6;
  --nav-bg: rgba(243, 244, 251, 0.78);
  --chip-bg: rgba(20, 22, 43, 0.05);
  --field-bg: rgba(255, 255, 255, 0.85);
  --card-shadow: 0 24px 60px rgba(20, 22, 60, 0.14);
  --marquee-bg: rgba(20, 22, 43, 0.03);
  --hero-glow: radial-gradient(ellipse 80% 60% at 50% -10%, #dde0ff 0%, var(--bg) 60%);
  --blob-opacity-1: 0.20;
  --blob-opacity-2: 0.15;
  --blob-opacity-3: 0.11;
  --grain-opacity: 0.035;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.45s ease, color 0.45s ease;
}

::selection { background: var(--violet); color: #fff; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; letter-spacing: -0.02em; }

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

img { display: block; }

/* ============ ambient background ============ */

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--hero-glow); }

.blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(110px);
  will-change: transform;
}
.blob-1 { background: var(--violet); top: -12%; left: -8%; animation: drift 26s ease-in-out infinite alternate; opacity: var(--blob-opacity-1); }
.blob-2 { background: var(--teal); top: 30%; right: -14%; animation: drift 32s ease-in-out infinite alternate-reverse; opacity: var(--blob-opacity-2); }
.blob-3 { background: var(--pink); bottom: -20%; left: 22%; animation: drift 38s ease-in-out infinite alternate; opacity: var(--blob-opacity-3); }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(6vw, -5vh) scale(1.15); }
}

.grain {
  position: absolute;
  inset: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.cursor-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(109, 92, 255, 0.12), transparent 65%);
  transform: translate(-50%, -50%);
  left: 50%;
  top: 30%;
}

/* custom cursor — dot snaps to the pointer, ring trails behind.
   difference blend inverts over both light and dark themes. */
html.custom-cursor, html.custom-cursor * { cursor: none !important; }

.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  mix-blend-mode: difference;
  transition: opacity 0.3s;
}
.cursor-dot { width: 6px; height: 6px; background: #fff; }
.cursor-ring {
  width: 34px;
  height: 34px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  transition: opacity 0.3s, width 0.3s var(--ease-out), height 0.3s var(--ease-out), background-color 0.3s;
}
.cursor-ring.cursor-hover { width: 54px; height: 54px; background: rgba(255, 255, 255, 0.12); }
.cursor-ring.cursor-down { width: 24px; height: 24px; }

/* ============ nav ============ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 64px);
  transition: background 0.4s, backdrop-filter 0.4s, border-color 0.4s, padding 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
  padding-top: 12px;
  padding-bottom: 12px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.brand-mark { width: 30px; height: 30px; border-radius: 8px; }

.nav-links { display: flex; align-items: center; gap: clamp(16px, 3vw, 36px); font-size: 15px; font-weight: 500; }
.nav-links a { color: var(--text-dim); transition: color 0.25s; }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  color: var(--text) !important;
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 100px;
  transition: border-color 0.25s, background 0.25s;
}
.nav-cta:hover { border-color: var(--violet); background: rgba(109, 92, 255, 0.12); }

/* theme toggle */
.theme-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, transform 0.35s var(--ease-out), background 0.25s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--violet); transform: rotate(18deg); }
.theme-toggle svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  transition: opacity 0.3s ease, transform 0.5s var(--ease-out);
}
.theme-toggle .icon-moon { opacity: 1; transform: none; }
.theme-toggle .icon-sun { opacity: 0; transform: rotate(120deg) scale(0.3); }
html[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: none; }
html[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(-120deg) scale(0.3); }

/* ============ hero ============ */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px clamp(20px, 5vw, 64px) 80px;
}

.hero-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(44px, 9vw, 108px);
  font-weight: 700;
  max-width: 14ch;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span {
  display: inline-block;
  transform: translateY(110%);
  animation: line-up 1.1s var(--ease-out) forwards;
}
.hero-title .line:nth-child(2) > span { animation-delay: 0.12s; }
@keyframes line-up { to { transform: translateY(0); } }

.hero-title em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  max-width: 560px;
  margin-top: 26px;
  color: var(--text-dim);
  font-size: clamp(16px, 1.6vw, 19px);
}

.hero-actions { display: flex; gap: 16px; margin-top: 40px; flex-wrap: wrap; justify-content: center; }

/* floating app icons in the hero */
.floater {
  position: absolute;
  width: clamp(52px, 7vw, 84px);
  height: auto;
  border-radius: 24%;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  opacity: 0.85;
  animation: bob 7s ease-in-out infinite;
  will-change: transform;
}
.floater-1 { top: 18%; left: 9%; animation-delay: 0s; }
.floater-2 { top: 14%; right: 11%; animation-delay: -1.4s; }
.floater-3 { top: 46%; left: 4%; animation-delay: -2.8s; width: clamp(42px, 5.5vw, 66px); }
.floater-4 { top: 52%; right: 5%; animation-delay: -4.1s; width: clamp(42px, 5.5vw, 66px); }
.floater-5 { bottom: 16%; left: 16%; animation-delay: -5.2s; }
.floater-6 { bottom: 13%; right: 17%; animation-delay: -6.3s; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-18px) rotate(2.5deg); }
}
@media (max-width: 760px) {
  .floater-3, .floater-4 { display: none; }
}

/* ============ buttons ============ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 32px;
  border-radius: 100px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s, background 0.3s, border-color 0.3s;
  will-change: transform;
}
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 34px rgba(109, 92, 255, 0.4);
}
.btn-primary:hover { box-shadow: 0 14px 44px rgba(0, 224, 198, 0.35); }
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: var(--surface-strong); border-color: rgba(255, 255, 255, 0.2); }

/* ============ stats ============ */

.hero-stats {
  display: flex;
  gap: clamp(28px, 6vw, 72px);
  margin-top: 72px;
  flex-wrap: wrap;
  justify-content: center;
}
.stat { text-align: center; }
.stat dt {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.5vw, 52px);
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat dd { color: var(--text-dim); font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 4px; }

/* ============ marquee ============ */

.marquee {
  display: flex;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  background: var(--marquee-bg);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  animation: marquee 28s linear infinite;
}
@keyframes marquee {
  to { transform: translateX(-100%); }
}
.marquee-item {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 0 26px;
  white-space: nowrap;
}
.marquee-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--grad);
  flex-shrink: 0;
}

/* ============ sections ============ */

.section { padding: clamp(80px, 12vw, 150px) clamp(20px, 5vw, 64px); max-width: 1280px; margin: 0 auto; }

.section-head { max-width: 640px; margin-bottom: clamp(44px, 6vw, 72px); }
.section-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 14px;
}
.section-head h2, .contact-copy h2 { font-size: clamp(30px, 4.5vw, 52px); font-weight: 700; }
.section-sub { color: var(--text-dim); margin-top: 16px; font-size: 17px; }

/* ============ apps grid ============ */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}

.app-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: border-color 0.35s, background 0.35s, box-shadow 0.35s;
  transform-style: preserve-3d;
  will-change: transform;
}
.app-card:hover {
  border-color: rgba(109, 92, 255, 0.5);
  background: var(--surface-strong);
  box-shadow: var(--card-shadow);
}

/* spotlight that follows the cursor inside each card */
.app-card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(109, 92, 255, 0.16), transparent 65%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.app-card:hover .app-card-glow { opacity: 1; }

.app-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.4s var(--ease-out);
}
.app-card:hover .app-icon { transform: scale(1.08) rotate(-3deg); }

.app-genre {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 100px;
  white-space: nowrap;
}

.app-name { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.app-tagline { color: var(--text-dim); font-size: 14.5px; flex-grow: 1; }

.app-shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.app-shots img {
  width: 100%;
  height: auto;
  aspect-ratio: 414 / 896;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s;
}
.app-shots img:nth-child(2) { transform: translateY(6px); }
.app-card:hover .app-shots img { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35); }
.app-card:hover .app-shots img:nth-child(1) { transform: translateY(-4px) rotate(-2deg); }
.app-card:hover .app-shots img:nth-child(2) { transform: translateY(2px); }
.app-card:hover .app-shots img:nth-child(3) { transform: translateY(-4px) rotate(2deg); }

.app-meta { margin: 18px 0 14px; min-height: 24px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rating { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14.5px; color: var(--star); }
.rating svg { width: 15px; height: 15px; }
.rating-count { color: var(--text-dim); font-weight: 400; }

.badge-new {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 100px;
  background: linear-gradient(120deg, rgba(109, 92, 255, 0.2), rgba(0, 224, 198, 0.2));
  border: 1px solid rgba(109, 92, 255, 0.4);
  color: var(--badge-text);
}

.badge-downloads {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid rgba(0, 224, 198, 0.45);
  background: rgba(0, 224, 198, 0.1);
  color: var(--teal);
  white-space: nowrap;
}

.app-stores { display: flex; gap: 10px; flex-wrap: wrap; }
.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.25s, border-color 0.25s, background 0.25s, transform 0.25s var(--ease-out);
}
.store-btn svg { width: 15px; height: 15px; }
.store-btn:hover { color: var(--text); border-color: var(--violet); background: rgba(109, 92, 255, 0.15); transform: translateY(-2px); }

/* ============ studio ============ */

.studio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.studio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  transition: transform 0.4s var(--ease-out), border-color 0.35s;
}
.studio-card:hover { transform: translateY(-6px); border-color: rgba(0, 224, 198, 0.4); }
.studio-num {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 18px;
}
.studio-card h3 { font-size: 22px; margin-bottom: 12px; }
.studio-card p { color: var(--text-dim); font-size: 15px; }

/* ============ contact ============ */

.contact-wrap {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: clamp(40px, 6vw, 90px);
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  padding: clamp(32px, 5vw, 64px);
  backdrop-filter: blur(12px);
}
@media (max-width: 860px) { .contact-wrap { grid-template-columns: 1fr; } }

.contact-copy p { color: var(--text-dim); margin-top: 18px; font-size: 16.5px; }
.contact-points { list-style: none; margin-top: 28px; display: grid; gap: 12px; }
.contact-points li { position: relative; padding-left: 30px; color: var(--text-dim); font-size: 15px; }
.contact-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--grad);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.contact-form { display: grid; gap: 18px; }

.field { position: relative; }
.field input, .field textarea {
  width: 100%;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 18px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15.5px;
  outline: none;
  resize: vertical;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.field input:focus, .field textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(109, 92, 255, 0.15);
}
.field label {
  position: absolute;
  left: 18px;
  top: 16px;
  color: var(--text-dim);
  font-size: 15px;
  pointer-events: none;
  transition: transform 0.25s var(--ease-out), font-size 0.25s, color 0.25s;
  transform-origin: left top;
}
.field input:focus ~ label, .field input:not(:placeholder-shown) ~ label,
.field textarea:focus ~ label, .field textarea:not(:placeholder-shown) ~ label {
  transform: translateY(-10px);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
}
.field.invalid input, .field.invalid textarea { border-color: var(--pink); }

.btn-submit { width: 100%; margin-top: 4px; }
.btn-submit .btn-spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-submit.loading .btn-spinner { display: inline-block; }
.btn-submit.loading { opacity: 0.85; pointer-events: none; }

.form-status { font-size: 14.5px; min-height: 22px; text-align: center; }
.form-status.ok { color: var(--teal); }
.form-status.err { color: var(--pink); }

/* ============ footer ============ */

.footer { border-top: 1px solid var(--border); padding: 34px clamp(20px, 5vw, 64px); }
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-dim);
}
.footer-brand { font-family: var(--font-display); font-weight: 700; color: var(--text); font-size: 16px; }
.footer-stores { display: flex; gap: 22px; }
.footer-stores a { transition: color 0.25s; }
.footer-stores a:hover { color: var(--text); }

/* ============ scroll reveal ============ */

.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ============ accessibility & motion prefs ============ */

:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }

@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; }
  .reveal { opacity: 1; transform: none; }
  .hero-title .line > span { transform: none; }
}
