/* Hosts — landing page. Palette mirrors the app's Midnight theme (UI/Theme.swift). */
:root {
  --bg: #0a0e1a;
  --surface: #131a2b;
  --surface2: #0e1422;
  --border: #1e2840;
  --row: #111827;
  --rowBorder: #1b2336;
  --text: #e7ecf5;
  --text2: #aab4c8;
  --textDim: #8893a8;
  --textMut: #7e8aa0;
  --accent: #5b8cff;
  --accent2: #7aa2ff;
  --onAccent: #0b0f14;
  --headerBg: rgba(10, 14, 26, 0.72);
  --green: #34d399;
  --red: #f87171;
  --amber: #f5b54a;
  --purple: #a78bfa;
  --radius: 16px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Smooth recolor when the theme switches */
body, nav, .badge, .shot, .card, .step, .final, .demo-frame, .btn,
.swatch .chip, footer, .code { transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease; }
@media (prefers-reduced-motion: reduce) {
  body, nav, .badge, .shot, .card, .step, .final, .demo-frame, .btn,
  .swatch .chip, footer, .code { transition: none; }
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; }

/* Visible keyboard focus for all interactive elements */
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 3px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---- Background (flat) ---- */
.glow { display: none; }

/* ---- Nav ---- */
nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: var(--headerBg);
  border-bottom: 1px solid var(--border);
}
nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { color: var(--text2); font-size: 14.5px; font-weight: 500; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  display: inline-flex; align-items: center;
  background: var(--accent);
  color: var(--onAccent) !important;
  padding: 0 18px; min-height: 40px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  transition: filter 0.15s;
}
.nav-cta:hover { filter: brightness(1.08); }
@media (max-width: 720px) { .nav-links a:not(.nav-cta) { display: none; } }

/* ---- Hero ---- */
.section { position: relative; z-index: 1; padding: 96px 0; }
header.hero { padding: 110px 0 80px; text-align: center; position: relative; z-index: 1; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  color: var(--accent2);
  padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; margin-bottom: 28px;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.hero h1 {
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin-bottom: 22px;
}
.hero h1 .grad { color: var(--accent2); }
.hero p.sub {
  font-size: clamp(17px, 2.4vw, 21px);
  color: var(--text2);
  max-width: 620px; margin: 0 auto 36px;
}
.cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 26px; border-radius: 12px;
  font-weight: 600; font-size: 15.5px; cursor: pointer;
  transition: opacity 0.15s, background 0.15s, filter 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--onAccent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent2); }
.hero-meta { margin-top: 26px; color: var(--textDim); font-size: 13.5px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { width: 15px; height: 15px; opacity: 0.85; }

/* ---- App screenshots (flat frame) ---- */
.shot {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface2);
}
.shot-hero { margin: 60px auto 0; max-width: 880px; }
.shot-wrap { max-width: 820px; margin: 36px auto 0; }
.shot-cap { text-align: center; color: var(--textDim); font-size: 13.5px; margin-top: 16px; }

/* ---- Demo video ---- */
.demo-wrap { max-width: 620px; margin: 44px auto 0; position: relative; }
.demo-frame {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.demo-frame video { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; }
.demo-glow { display: none; }
.demo-cap { text-align: center; color: var(--textDim); font-size: 13.5px; margin-top: 18px; }

/* ---- Section headings ---- */
.sec-head { text-align: center; max-width: 640px; margin: 0 auto 56px; }
.sec-head .eyebrow { color: var(--accent2); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px; }
.sec-head h2 { font-size: clamp(30px, 4.5vw, 44px); letter-spacing: -0.025em; font-weight: 800; line-height: 1.1; margin-bottom: 16px; }
.sec-head p { color: var(--text2); font-size: 17px; }

/* ---- Feature grid ---- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); transform: translateY(-3px); }
.card .ico {
  width: 44px; height: 44px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  margin-bottom: 18px;
}
.card .ico svg { width: 22px; height: 22px; stroke: var(--accent2); }
.card h3 { font-size: 17.5px; font-weight: 700; margin-bottom: 9px; letter-spacing: -0.01em; }
.card p { color: var(--text2); font-size: 14.5px; }

/* ---- Diff / security split ---- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 32px; } }
.split h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.025em; font-weight: 800; line-height: 1.1; margin-bottom: 18px; }
.split p { color: var(--text2); font-size: 16px; margin-bottom: 14px; }
.checks { list-style: none; margin-top: 22px; }
.checks li { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; color: var(--text2); font-size: 15px; }
.checks svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; stroke: var(--green); }
.checks b { color: var(--text); font-weight: 600; }

/* ---- Themes strip ---- */
.themes { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  background: none; border: none; padding: 6px; margin: 0;
  font: inherit; cursor: pointer; border-radius: 16px;
}
.swatch .chip { width: 60px; height: 60px; border-radius: 14px; border: 1px solid var(--border); position: relative; overflow: hidden; transition: transform 0.18s ease, box-shadow 0.18s ease; }
.swatch .chip .dot { position: absolute; bottom: 9px; left: 9px; width: 16px; height: 16px; border-radius: 50%; }
.swatch span { font-size: 12px; color: var(--textDim); font-weight: 500; transition: color 0.18s ease; }
.swatch:hover .chip { transform: translateY(-3px); }
.swatch[aria-pressed="true"] .chip { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent2); }
.swatch[aria-pressed="true"] span { color: var(--accent2); }
.theme-hint { text-align: center; color: var(--textDim); font-size: 13.5px; margin-top: 22px; }

/* ---- Steps ---- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 24px; position: relative; }
.step .num { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--onAccent); font-weight: 800; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; font-size: 16px; }
.step h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.step p { color: var(--text2); font-size: 14.5px; }
/* The code block is always dark, so its text colors are fixed rather than
   theme variables — light themes would otherwise render dark-on-dark. */
.code {
  margin-top: 36px; background: #060912; border: 1px solid #1e2840; border-radius: 12px;
  padding: 20px 22px; font-family: var(--mono); font-size: 14px; color: #aab4c8;
  white-space: pre; overflow-x: auto;
}
.code .c { color: #6b7689; }
.code .p { color: #34d399; }
.code .s { color: #f5b54a; }
.code-more { margin-top: 16px; font-size: 14.5px; }
.code-more a { color: var(--accent2); font-weight: 600; transition: opacity 0.15s; }
.code-more a:hover { opacity: 0.8; }

/* ---- Final CTA ---- */
.final { text-align: center; background: var(--surface2); border-radius: 28px; padding: 72px 24px; border: 1px solid var(--border); }
.final h2 { font-size: clamp(30px, 5vw, 46px); letter-spacing: -0.025em; font-weight: 800; margin-bottom: 16px; }
.final p { color: var(--text2); font-size: 18px; max-width: 520px; margin: 0 auto 32px; }

/* ---- Footer ---- */
footer { border-top: 1px solid var(--border); padding: 48px 0 64px; margin-top: 80px; }
footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
footer .brand { font-size: 16px; }
footer .links { display: flex; gap: 24px; flex-wrap: wrap; }
footer .links a { color: var(--textDim); font-size: 14px; transition: color 0.15s; }
footer .links a:hover { color: var(--text); }
footer .legal { color: var(--textMut); font-size: 12.5px; width: 100%; margin-top: 8px; }

/* ---- DMG coming-soon callout ---- */
.dmg-soon {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--radius); padding: 20px 24px; margin: 0 0 36px;
}
.dmg-soon .dmg-ico {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent2);
}
.dmg-soon .dmg-text { flex: 1; min-width: 0; }
.dmg-soon h3 { font-size: 16.5px; font-weight: 700; margin-bottom: 5px; }
.dmg-soon p { color: var(--text2); font-size: 14px; }
.dmg-soon code { font-family: var(--mono); font-size: 0.92em; }
.dmg-tag {
  flex: none; align-self: flex-start; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 5px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent2); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
@media (max-width: 620px) {
  .dmg-soon { flex-wrap: wrap; gap: 14px; }
  .dmg-soon .dmg-text { flex-basis: 100%; order: 2; }
}
/* Live download count — hidden until JS confirms a real (>0) count. Toggled via
   a class, not [hidden], so display rules can't fight it. */
.dl-stat { display: none; margin: -22px 0 34px; text-align: center; color: var(--text2); font-size: 14px; }
.dl-stat.show { display: block; animation: fadeIn 0.5s ease; }
.dl-stat strong { color: var(--accent2); font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- Reveal animation ---- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .card:hover { transform: none; }
}
