/* ============================================
   Klip Landing Page — Apple Design Aesthetic
   ============================================ */

:root {
  --bg: #fff;
  --bg-secondary: #f5f5f7;
  --bg-dark: #1d1d1f;
  --text: #1d1d1f;
  --text-secondary: #86868b;
  --text-on-dark: #f5f5f7;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --card-bg: #fff;
  --card-border: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.1);
  --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.1);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --nav-border: rgba(0, 0, 0, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --bg-secondary: #111;
    --bg-dark: #000;
    --text: #f5f5f7;
    --text-secondary: #86868b;
    --text-on-dark: #f5f5f7;
    --accent: #2997ff;
    --accent-hover: #40a3ff;
    --card-bg: #1c1c1e;
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.06);
    --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.08);
    --nav-bg: rgba(0, 0, 0, 0.72);
    --nav-border: rgba(255, 255, 255, 0.08);
  }
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Nav ────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--nav-border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.nav-logo img { border-radius: 8px; }

.nav-cta {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  transition: opacity 0.2s;
}
.nav-cta:hover { opacity: 0.8; }

/* ── Buttons ────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  border-radius: 980px;
  font-size: 17px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
}

.btn-large {
  padding: 20px 40px;
  font-size: 19px;
}

/* ── Section Title ──────────────────────── */
.section-title {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-align: center;
  margin-bottom: 64px;
}

/* ── Hero ────────────────────────────────── */
/* Scroll-driven hero */
.hero-scroll {
  height: 300vh;
  position: relative;
  background: #000;
}

.hero-scroll-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#heroCanvas {
  max-height: 85vh;
  max-width: 60vw;
  width: auto;
  height: auto;
  display: block;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 5vh;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 50%, transparent 100%);
  padding-top: 15vh;
}

.hero-overlay > * {
  pointer-events: auto;
}

.hero-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 16px;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.hero-subtitle {
  font-size: clamp(15px, 1.8vw, 19px);
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 500px;
  text-align: center;
  text-shadow: 0 1px 10px rgba(0,0,0,0.5);
}

/* ── Bento Grid ─────────────────────────── */
.bento {
  padding: 120px 0;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
}

.bento-card {
  border-radius: 20px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(80px) scale(0.92);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s ease;
}

.bento-card:hover {
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.bento-card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.bento-card-inner {
  position: relative;
  height: 100%;
  background: var(--bg-secondary);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bento-card-inner img {
  width: 85%;
  margin: 24px auto 0;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s;
}

.bento-card.visible .bento-card-inner img {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.bento-card-inner.bento-dark {
  background: #1d1d1f;
}

.bento-card-inner.bento-accent {
  background: var(--accent);
}

/* Grid spans */
.bento-large { grid-column: span 2; grid-row: span 2; }
.bento-tall { grid-column: span 2; grid-row: span 2; }
.bento-wide { grid-column: span 2; }
.bento-medium { grid-column: span 2; }
.bento-small { grid-column: span 1; }

/* Label */
.bento-label {
  position: relative;
  z-index: 2;
  padding: 20px 24px;
  color: var(--text);
}

.bento-card-inner.bento-dark .bento-label,
.bento-card-inner.bento-accent .bento-label {
  color: #fff;
}

.bento-label-top {
  order: -1;
}

.bento-label h3 {
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.bento-label p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.bento-card-inner.bento-dark .bento-label p {
  color: rgba(255,255,255,0.6);
}

.bento-card-inner.bento-accent .bento-label p {
  color: rgba(255,255,255,0.85);
}

/* ── Keyboard card ── */
.kb-grid {
  padding: 12px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.kb-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-main {
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.kb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font);
}

.kb-main .kb {
  min-width: 56px;
  height: 56px;
  font-size: 24px;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 0 20px rgba(0,113,227,0.15);
}

.kb-sm {
  min-width: 36px;
  height: 32px;
  font-size: 13px;
  padding: 0 10px;
}

.kb-label {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

/* ── Fuzzy search card ── */
.fuzzy-demo {
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.fuzzy-input {
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 16px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: #fff;
  letter-spacing: 0.05em;
}

.fuzzy-cursor {
  color: rgba(255,255,255,0.4);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.fuzzy-result {
  background: rgba(255,255,255,0.95);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 15px;
  color: #1d1d1f;
  font-weight: 500;
}

.fuzzy-result mark {
  background: rgba(0,113,227,0.2);
  color: #0071e3;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Secrets card ── */
.secrets-list {
  padding: 8px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.secret-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid rgba(255,59,48,0.15);
  overflow: hidden;
  min-width: 0;
}

.secret-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ff3b30;
  background: rgba(255,59,48,0.1);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.secret-row code {
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ── Theme card ── */
.theme-demo {
  display: flex;
  gap: 12px;
  padding: 16px 24px 24px;
  justify-content: center;
  flex: 1;
  align-items: center;
}

.theme-card {
  width: 120px;
  padding: 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-light-card {
  background: #f5f5f7;
  border: 1px solid rgba(0,0,0,0.08);
}

.theme-dark-card {
  background: #2c2c2e;
  border: 1px solid rgba(255,255,255,0.08);
}

.theme-dots {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.theme-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.theme-dots span:nth-child(1) { background: #ff5f57; }
.theme-dots span:nth-child(2) { background: #febc2e; }
.theme-dots span:nth-child(3) { background: #28c840; }

.theme-line {
  height: 6px;
  border-radius: 3px;
}

.theme-light-card .theme-line { background: rgba(0,0,0,0.08); }
.theme-dark-card .theme-line { background: rgba(255,255,255,0.1); }

.w40 { width: 40%; }
.w60 { width: 60%; }
.w80 { width: 80%; }

@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .bento-large,
  .bento-tall,
  .bento-wide,
  .bento-medium,
  .bento-small {
    grid-column: span 1;
    grid-row: span 1;
  }

  /* Hero mobile */
  #heroCanvas {
    max-width: 90vw;
    max-height: 60vh;
  }

  .hero-scroll {
    height: 200vh;
  }

  .hero-title {
    font-size: 32px;
    padding: 0 20px;
  }

  .hero-subtitle {
    font-size: 15px;
    padding: 0 24px;
  }

  .hero-overlay {
    padding-bottom: 3vh;
  }

  /* Nav mobile */
  .nav-inner {
    padding: 0 16px;
  }

  /* Bento content mobile */
  .bento {
    padding: 60px 0;
  }

  .bento-card-inner img {
    width: 92%;
  }

  .kb-grid {
    padding: 12px 16px 16px;
  }

  .kb-main .kb {
    min-width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .secrets-list {
    padding: 8px 16px 16px;
  }

  .secret-row code {
    font-size: 10px;
  }

  .fuzzy-demo {
    padding: 12px 16px 16px;
  }

  .theme-demo {
    padding: 12px 16px 16px;
  }

  .theme-card {
    width: 100px;
  }

  /* Sections mobile */
  .bento-label h3 {
    font-size: 20px;
  }

  .section-title {
    font-size: 28px;
  }

  .container {
    padding: 0 16px;
  }

  /* Button mobile */
  .btn-large {
    font-size: 15px;
    padding: 14px 28px;
  }
}

/* ── Privacy ─────────────────────────────── */
.privacy {
  padding: 120px 0;
  background: var(--bg-dark);
  color: var(--text-on-dark);
}

.privacy .section-title { color: var(--text-on-dark); }

.privacy-stats {
  display: flex;
  justify-content: center;
  gap: 80px;
  margin-bottom: 48px;
}

.privacy-stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: clamp(56px, 8vw, 80px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--accent);
}

.stat-label {
  display: block;
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.privacy-text {
  text-align: center;
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Pulse animation for stats */
@keyframes statPulse {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.stat-number.pulsed {
  animation: statPulse 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── How It Works ────────────────────────── */
.how-it-works {
  padding: 120px 0;
}

.steps {
  display: flex;
  justify-content: center;
  gap: 0;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
  padding: 0 32px;
}

.step-number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  position: relative;
  z-index: 2;
}

.step-connector {
  position: absolute;
  top: 28px;
  left: calc(50% + 28px);
  width: calc(100% - 56px);
  height: 2px;
  background: var(--card-border);
  z-index: 1;
}

.step:last-child .step-connector { display: none; }

.step h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.step p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Screenshots ─────────────────────────── */
.screenshots {
  padding: 120px 0;
  background: var(--bg-secondary);
  overflow: hidden;
}

.screenshots-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  align-items: center;
}

.screenshot-card {
  flex: 0 1 360px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow-hover);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.screenshot-card:first-child { transform: rotate(-3deg); }
.screenshot-card:last-child { transform: rotate(3deg); }

.screenshot-card:hover { transform: rotate(0deg) scale(1.03); }

.screenshot-card img { width: 100%; }

/* ── Footer CTA ──────────────────────────── */
.footer-cta {
  padding: 120px 0;
  text-align: center;
}

.footer-req {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── Footer ──────────────────────────────── */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--card-border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--accent); }

.footer-copy {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Animations ──────────────────────────── */
.anim-up,
.anim-slide-left,
.anim-slide-right,
.anim-slide-up {
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transition-delay: var(--delay, 0ms);
}

.anim-up { transform: translateY(40px); }
.anim-slide-left { transform: translateX(-80px) rotate(-5deg); }
.anim-slide-right { transform: translateX(80px) rotate(5deg); }
.anim-slide-up { transform: translateY(60px); }

.anim-up.visible,
.anim-slide-left.visible,
.anim-slide-right.visible,
.anim-slide-up.visible {
  opacity: 1;
  transform: none;
}

/* Keep screenshot rotation after animation */
.screenshot-card:first-child.anim-slide-left.visible { transform: rotate(-3deg); }
.screenshot-card:last-child.anim-slide-right.visible { transform: rotate(3deg); }

/* ── Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .privacy-stats {
    flex-direction: column;
    gap: 40px;
  }

  .steps {
    flex-direction: column;
    gap: 48px;
  }

  .step-connector {
    top: auto;
    left: 50%;
    width: 2px;
    height: 48px;
    transform: translateX(-50%);
    top: 56px;
  }

  .screenshots-row {
    flex-direction: column;
    gap: 24px;
  }

  .screenshot-card:first-child,
  .screenshot-card:last-child {
    transform: none;
  }

  .screenshot-card:first-child.anim-slide-left.visible,
  .screenshot-card:last-child.anim-slide-right.visible {
    transform: none;
  }

  .footer-inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .hero { padding: 120px 0 60px; }
  .hero-image { margin-top: 48px; }

  .section-title { margin-bottom: 48px; }
}