/* ========================================
   CSS Variables & Theme
   ======================================== */
:root {
  /* Light theme (default) */
  --bg-gradient: linear-gradient(180deg, #f8f4ff 0%, #fef0f5 40%, #f0f4ff 100%);
  --text-primary: #1a1a2e;
  --text-muted: #666666;
  --text-faint: #999999;
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(255, 255, 255, 0.8);
  --search-bg: rgba(150, 150, 170, 0.12);
  --spec-bg: rgba(0, 0, 0, 0.04);
  --tab-bg: rgba(255, 255, 255, 0.95);
  --phone-bg: linear-gradient(180deg, #f8f4ff 0%, #fef0f5 50%, #fdf2f8 100%);
  --phone-shadow: 0 32px 64px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --status-bg: rgba(34, 197, 94, 0.1);
  --privacy-bg: rgba(34, 197, 94, 0.08);
  --privacy-border: rgba(34, 197, 94, 0.2);
  --divider: rgba(0, 0, 0, 0.05);
  --cta-bg: #000000;
  --cta-text: #ffffff;
}

/* Dark theme variables */
:root.dark {
  --bg-gradient: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 40%, #16213e 100%);
  --text-primary: #ffffff;
  --text-muted: #888888;
  --text-faint: #666666;
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.08);
  --search-bg: rgba(255, 255, 255, 0.06);
  --spec-bg: rgba(255, 255, 255, 0.06);
  --tab-bg: rgba(30, 30, 50, 0.95);
  --phone-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  --phone-shadow: 0 32px 64px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --status-bg: rgba(34, 197, 94, 0.15);
  --privacy-bg: rgba(34, 197, 94, 0.1);
  --privacy-border: rgba(34, 197, 94, 0.25);
  --divider: rgba(255, 255, 255, 0.05);
  --cta-bg: #ffffff;
  --cta-text: #000000;
}

/* Auto dark mode based on system preference */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-gradient: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 40%, #16213e 100%);
    --text-primary: #ffffff;
    --text-muted: #888888;
    --text-faint: #666666;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.08);
    --search-bg: rgba(255, 255, 255, 0.06);
    --spec-bg: rgba(255, 255, 255, 0.06);
    --tab-bg: rgba(30, 30, 50, 0.95);
    --phone-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    --phone-shadow: 0 32px 64px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --status-bg: rgba(34, 197, 94, 0.15);
    --privacy-bg: rgba(34, 197, 94, 0.1);
    --privacy-border: rgba(34, 197, 94, 0.25);
    --divider: rgba(255, 255, 255, 0.05);
    --cta-bg: #ffffff;
    --cta-text: #000000;
  }
}

/* Toggle inverts: system light + checked = dark */
@media (prefers-color-scheme: light) {
  html:has(.theme-checkbox:checked) {
    --bg-gradient: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 40%, #16213e 100%);
    --text-primary: #ffffff;
    --text-muted: #888888;
    --text-faint: #666666;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.08);
    --search-bg: rgba(255, 255, 255, 0.06);
    --spec-bg: rgba(255, 255, 255, 0.06);
    --tab-bg: rgba(30, 30, 50, 0.95);
    --phone-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    --phone-shadow: 0 32px 64px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --status-bg: rgba(34, 197, 94, 0.15);
    --privacy-bg: rgba(34, 197, 94, 0.1);
    --privacy-border: rgba(34, 197, 94, 0.25);
    --divider: rgba(255, 255, 255, 0.05);
    --cta-bg: #ffffff;
    --cta-text: #000000;
  }
}

/* Toggle inverts: system dark + checked = light */
@media (prefers-color-scheme: dark) {
  html:has(.theme-checkbox:checked) {
    --bg-gradient: linear-gradient(180deg, #f8f4ff 0%, #fef0f5 40%, #f0f4ff 100%);
    --text-primary: #1a1a2e;
    --text-muted: #666666;
    --text-faint: #999999;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.8);
    --search-bg: rgba(150, 150, 170, 0.12);
    --spec-bg: rgba(0, 0, 0, 0.04);
    --tab-bg: rgba(255, 255, 255, 0.95);
    --phone-bg: linear-gradient(180deg, #f8f4ff 0%, #fef0f5 50%, #fdf2f8 100%);
    --phone-shadow: 0 32px 64px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    --status-bg: rgba(34, 197, 94, 0.1);
    --privacy-bg: rgba(34, 197, 94, 0.08);
    --privacy-border: rgba(34, 197, 94, 0.2);
    --divider: rgba(0, 0, 0, 0.05);
    --cta-bg: #000000;
    --cta-text: #ffffff;
  }
}

/* ========================================
   Base Styles
   ======================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg-gradient);
  background-attachment: fixed;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-gradient);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  color: var(--text-primary);
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  /* iOS safe areas */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ========================================
   Navigation
   ======================================== */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  max-width: 800px;
  margin: 0 auto;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  border-radius: 9px;
}

.nav-title {
  font-size: 18px;
  font-weight: 600;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-unofficial {
  font-size: 11px;
  color: var(--text-muted);
}

/* Hide the actual checkbox */
.theme-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-toggle {
  background: var(--search-bg);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: opacity 0.2s ease;
  display: inline-block;
}

.theme-toggle:hover {
  opacity: 0.8;
}

/* Theme icon visibility - shows sun when dark, moon when light */
/* Default: light mode shows moon */
.theme-icon-dark {
  display: none;
}

/* System dark: show sun by default */
@media (prefers-color-scheme: dark) {
  .theme-icon-light {
    display: none;
  }

  .theme-icon-dark {
    display: inline;
  }
}

/* When toggled, swap the icons */
@media (prefers-color-scheme: light) {
  html:has(.theme-checkbox:checked) .theme-icon-light {
    display: none;
  }

  html:has(.theme-checkbox:checked) .theme-icon-dark {
    display: inline;
  }
}

@media (prefers-color-scheme: dark) {
  html:has(.theme-checkbox:checked) .theme-icon-light {
    display: inline;
  }

  html:has(.theme-checkbox:checked) .theme-icon-dark {
    display: none;
  }
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
  padding: 40px 32px 48px;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  font-size: clamp(32px, 6vw, 44px);
  font-weight: 600;
  letter-spacing: -1px;
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ========================================
   CTA Badge (App Store Button)
   ======================================== */
.cta-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cta-badge {
  display: inline-block;
}

.cta-button,
.ph-badge {
  cursor: pointer;
}

.ph-badge img {
  height: 54px;
  width: auto;
  transition: transform 0.2s ease;
}

.ph-badge:hover img {
  transform: translateY(-2px);
}

.apple-badge {
  height: 54px;
  width: auto;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.cta-badge:hover .apple-badge {
  transform: translateY(-2px);
}

/* Default (light mode): show black badge, hide white */
.apple-badge-light {
  display: inline-block;
}

.apple-badge-dark {
  display: none;
}

/* System dark mode: show white badge, hide black */
@media (prefers-color-scheme: dark) {
  .apple-badge-light {
    display: none;
  }

  .apple-badge-dark {
    display: inline-block;
  }
}

/* Toggle inverts: system light + checked = dark mode (show white) */
@media (prefers-color-scheme: light) {
  html:has(.theme-checkbox:checked) .apple-badge-light {
    display: none;
  }

  html:has(.theme-checkbox:checked) .apple-badge-dark {
    display: inline-block;
  }
}

/* Toggle inverts: system dark + checked = light mode (show black) */
@media (prefers-color-scheme: dark) {
  html:has(.theme-checkbox:checked) .apple-badge-light {
    display: inline-block;
  }

  html:has(.theme-checkbox:checked) .apple-badge-dark {
    display: none;
  }
}

.cta-subtext {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-faint);
}

/* ========================================
   Phone Screenshot
   ======================================== */
.phone-container {
  margin-top: 48px;
  display: flex;
  justify-content: center;
  gap: 24px;
}

.phone-screenshot {
  max-width: 580px;
  max-height: 50vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 32px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Hide light screenshot on mobile */
@media (max-width: 680px) {
  .phone-screenshot-light {
    display: none;
  }

  .phone-screenshot {
    max-height: 40vh;
  }
}

/* ========================================
   Features
   ======================================== */
.features {
  padding: 24px 32px 48px;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-muted);
}

.feature-dot {
  color: var(--text-faint);
}

/* ========================================
   Footer
   ======================================== */
.footer {
  padding: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  border-top: 1px solid var(--divider);
}

.copyright {
  margin-top: 8px;
}

.footer-links {
  margin-top: 8px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
  .nav {
    padding: 16px 20px;
  }

  .hero {
    padding: 32px 20px 40px;
  }

  .phone-frame {
    width: 260px;
    height: 520px;
  }

  .features {
    gap: 16px;
  }
}