/* ============ Design tokens ============ */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-soft: #11141c;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-solid: #161a24;
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef1f7;
  --muted: #9aa3b5;
  --brand: #6d8dff;
  --glow-1: rgba(84, 116, 255, 0.16);
  --glow-2: rgba(190, 84, 255, 0.10);
  --mock-card: rgba(255, 255, 255, 0.07);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(11, 13, 18, 0.75);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-soft: #eef1f8;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --border: rgba(22, 32, 55, 0.10);
  --text: #162037;
  --muted: #5d677d;
  --brand: #2046c8;
  --glow-1: rgba(32, 70, 200, 0.10);
  --glow-2: rgba(190, 84, 255, 0.07);
  --mock-card: rgba(22, 32, 55, 0.06);
  --shadow: 0 12px 32px rgba(22, 32, 55, 0.10);
  --header-bg: rgba(245, 247, 251, 0.8);
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}
img, svg { max-width: 100%; vertical-align: middle; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }

/* Ambient background glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 15% -5%, var(--glow-1), transparent 65%),
    radial-gradient(700px 500px at 90% 10%, var(--glow-2), transparent 65%);
  pointer-events: none;
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: 0.2px;
}
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover { border-color: var(--brand); transform: translateY(-1px); }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }

/* ============ Hero ============ */
.hero { padding: clamp(56px, 10vw, 110px) 0 clamp(32px, 6vw, 56px); text-align: center; }
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero h1 .grad {
  background: linear-gradient(92deg, var(--brand), #b06dff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  margin: 0 auto;
  max-width: 560px;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
}

/* ============ App cards ============ */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 22px;
  padding: 18px 0 70px;
}
.app-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  transition: transform 0.25s, border-color 0.25s;
}
.app-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent, var(--brand)) 55%, var(--border)); }
.app-card-head { display: flex; align-items: center; gap: 14px; }
.app-card-head img { width: 56px; height: 56px; border-radius: 14px; flex: none; }
.app-card h2 { margin: 0; font-size: 1.3rem; letter-spacing: -0.01em; }
.app-card .tagline { margin: 0; color: var(--muted); font-size: 0.95rem; }
.app-card .desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 0.78rem;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--mock-card);
  white-space: nowrap;
}
.card-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(120deg, var(--accent, var(--brand)), color-mix(in srgb, var(--accent, var(--brand)) 65%, #b06dff));
  color: #fff;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent, var(--brand)) 35%, transparent);
}
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent, var(--brand)); }

/* ============ App detail page ============ */
.app-hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(24px, 5vw, 56px); align-items: center; padding: clamp(40px, 7vw, 80px) 0 30px; }
.app-hero-info .app-idbar { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.app-hero-info .app-idbar img { width: 72px; height: 72px; border-radius: 18px; }
.app-hero-info h1 { margin: 0; font-size: clamp(1.8rem, 4.5vw, 2.6rem); letter-spacing: -0.02em; line-height: 1.1; }
.app-hero-info .tagline { margin: 4px 0 0; color: var(--muted); font-size: 1.05rem; }
.app-hero-info .desc { color: var(--muted); margin: 14px 0 20px; }
.dl-hint { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }

.back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 26px; color: var(--muted); font-size: 0.92rem; }
.back-link:hover { color: var(--brand); }

/* Phone mockup */
.phone-wrap { display: flex; justify-content: center; }
.phone {
  width: min(290px, 80vw);
  aspect-ratio: 9 / 18.5;
  border-radius: 38px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--surface-solid), var(--bg-soft));
  box-shadow: var(--shadow), inset 0 0 0 6px color-mix(in srgb, var(--bg) 70%, #000 8%);
  padding: 22px 16px 18px;
  position: relative;
  overflow: hidden;
}
.phone::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 78px;
  height: 7px;
  border-radius: 99px;
  background: var(--border);
}
.phone::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(240px 160px at 80% 0%, color-mix(in srgb, var(--accent, var(--brand)) 18%, transparent), transparent 70%);
  pointer-events: none;
}
.mock-head { display: flex; justify-content: space-between; align-items: center; margin: 14px 2px 12px; }
.mock-title { font-weight: 700; font-size: 0.9rem; }
.mock-pill {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--accent, var(--brand));
  border: 1px solid color-mix(in srgb, var(--accent, var(--brand)) 45%, transparent);
  background: color-mix(in srgb, var(--accent, var(--brand)) 12%, transparent);
  padding: 2px 9px;
  border-radius: 99px;
}
.mock-qr { display: flex; justify-content: center; padding: 8px 0 10px; }
.mock-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
  color: var(--muted);
  text-align: center;
  background: var(--mock-card);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mock-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.74rem;
  background: var(--mock-card);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.mock-row .mock-meta { margin-left: auto; color: var(--muted); font-size: 0.66rem; }
.mock-active { border: 1px solid color-mix(in srgb, var(--accent, var(--brand)) 45%, transparent); }
.mock-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent, var(--brand)); flex: none; }
.mock-thumb {
  width: 26px; height: 20px; border-radius: 5px; flex: none;
  background: linear-gradient(130deg, var(--accent, var(--brand)), color-mix(in srgb, var(--accent, var(--brand)) 45%, #b06dff));
  opacity: 0.85;
}
.mock-bar { height: 5px; border-radius: 99px; background: var(--mock-card); overflow: hidden; }
.mock-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent, var(--brand)); }
.mock-np { display: flex; align-items: center; gap: 10px; background: var(--mock-card); border-radius: 12px; padding: 9px 10px; margin: 10px 0 8px; }
.mock-npart {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(130deg, var(--accent, var(--brand)), color-mix(in srgb, var(--accent, var(--brand)) 45%, #b06dff));
}
.mock-npinfo { display: flex; flex-direction: column; line-height: 1.25; }
.mock-npinfo b { font-size: 0.72rem; }
.mock-npinfo small { font-size: 0.62rem; color: var(--muted); }

/* Features */
.section-title { font-size: clamp(1.4rem, 3vw, 1.8rem); letter-spacing: -0.01em; margin: 40px 0 18px; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 16px;
  padding-bottom: 8px;
}
.feature {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  transition: transform 0.25s, border-color 0.25s;
}
.feature:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent, var(--brand)) 45%, var(--border)); }
.feature .f-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--accent, var(--brand));
  background: color-mix(in srgb, var(--accent, var(--brand)) 13%, transparent);
  margin-bottom: 12px;
}
.feature h3 { margin: 0 0 6px; font-size: 1.02rem; }
.feature p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.note-box {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--brand));
  background: var(--surface);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 26px 0 50px;
}

/* Not found */
.notfound { text-align: center; padding: 90px 0; }
.notfound h1 { font-size: 2rem; }
.notfound p { color: var(--muted); }

/* ============ Footer ============ */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0 34px; margin-top: 20px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 0.88rem; }

/* ============ Reveal animation ============ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ============ Responsive ============ */
@media (max-width: 840px) {
  .app-hero { grid-template-columns: 1fr; text-align: center; }
  .app-hero-info .app-idbar { justify-content: center; }
  .app-hero-info .card-actions, .app-hero-info .chips { justify-content: center; }
  .phone-wrap { order: -1; }
  .phone { width: min(240px, 70vw); }
}
