/* ===================================================================
   LocalLink — landing page styles
   Mirrors the app: Geist Mono, mesh-green accent, deep terminal black.
   =================================================================== */

:root {
  --accent: #32d74b;
  --accent-2: #0a84ff;
  --accent-soft: rgba(50, 215, 75, 0.14);

  --bg: #04070a;
  --bg-elev: #0b1210;
  --card: #0e1512;
  --card-hover: #121b17;
  --border: #1c2a22;
  --border-soft: #16211b;

  --text: #f2f6f3;
  --text-dim: #9aa69a;
  --text-faint: #6b776b;

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.85);
  --font: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="light"] {
  --accent: #248a3d;
  --accent-2: #007aff;
  --accent-soft: rgba(36, 138, 61, 0.12);

  --bg: #f4f7f4;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --card-hover: #f0f4f0;
  --border: #d9e2d9;
  --border-soft: #e7ede7;

  --text: #10160f;
  --text-dim: #4c574c;
  --text-faint: #757f75;

  --shadow: 0 24px 60px -30px rgba(20, 40, 25, 0.28);
}

* { 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;
  transition: background 0.4s ease, color 0.4s ease;
}

#mesh-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  pointer-events: none;
}

main, .footer { position: relative; z-index: 1; }

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

h1, h2, h3, h4 { line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }

.accent { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 0.55rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 0.95rem 1.7rem; font-size: 1.02rem; }

.btn-primary {
  background: var(--accent);
  color: #04070a;
  box-shadow: 0 8px 24px -10px var(--accent);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -10px var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn:active { transform: scale(0.92); }
.i-moon { display: none; }
html[data-theme="light"] .i-sun { display: none; }
html[data-theme="light"] .i-moon { display: block; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  max-width: var(--maxw);
  margin: 0 auto;
  backdrop-filter: blur(12px);
  transition: background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom-color: var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-name { font-size: 1.15rem; letter-spacing: -0.03em; }
.nav-links {
  display: flex;
  gap: 1.6rem;
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.nav-links a { transition: color 0.2s; }
.nav-links a:hover { color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 0.7rem; }

/* ---------- Layout ---------- */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 6.5rem) clamp(1rem, 4vw, 2.5rem);
}
.section-head { max-width: 640px; margin-bottom: 2.8rem; }
.kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.8rem;
}
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2.5rem) clamp(2rem, 5vw, 3rem);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  margin-bottom: 1.5rem;
}
.eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: ping 2s infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  70%, 100% { box-shadow: 0 0 0 8px transparent; }
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  letter-spacing: -0.04em;
  margin-bottom: 1.1rem;
}
.lede {
  font-size: clamp(1rem, 2vw, 1.18rem);
  color: var(--text-dim);
  max-width: 33rem;
  margin-bottom: 2rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 2rem; }
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-faint);
}
.hero-badges li { display: flex; align-items: center; gap: 0.45rem; }
.hero-badges li::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

/* ---------- Hero phone mockup ---------- */
.hero-art { display: flex; justify-content: center; }
.phone {
  position: relative;
  width: min(280px, 78vw);
  aspect-ratio: 9 / 18.5;
  background: linear-gradient(160deg, #10171400, #0a100d);
  border: 1.5px solid var(--border);
  border-radius: 34px;
  padding: 12px;
  box-shadow: var(--shadow);
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.phone-notch {
  position: absolute;
  top: 12px; left: 50%; transform: translateX(-50%);
  width: 42%; height: 20px;
  background: var(--bg);
  border-radius: 0 0 14px 14px;
  z-index: 2;
}
.phone-screen {
  width: 100%; height: 100%;
  background: var(--bg);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.4rem 0.85rem 0.7rem;
  border-bottom: 1px solid var(--border-soft);
}
.chat-mark {
  width: 26px; height: 26px;
  background: var(--accent);
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.chat-title { color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.chat-peers {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}
.chat-body {
  flex: 1;
  padding: 0.8rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
}
.msg {
  font-size: 0.72rem;
  line-height: 1.45;
  padding: 0.5rem 0.7rem;
  border-radius: 12px;
  max-width: 88%;
  animation: rise 0.5s ease backwards;
}
.msg b { color: var(--accent); font-weight: 600; }
.msg.them {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  border-bottom-left-radius: 4px;
}
.msg.me {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--text);
  border-bottom-right-radius: 4px;
}
.msg.them:nth-child(1) { animation-delay: 0.2s; }
.msg.them:nth-child(2) { animation-delay: 0.6s; }
.msg.me:nth-child(3)   { animation-delay: 1.0s; }
.msg.them:nth-child(4) { animation-delay: 1.4s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.typing {
  align-self: flex-start;
  display: flex; gap: 4px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
  animation-delay: 1.8s;
}
.msg.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
  animation: blink 1.4s infinite;
}
.msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,60%,100% { opacity: 0.25; } 30% { opacity: 1; } }

/* ---------- Problem ---------- */
.problem-grid { display: grid; gap: 2.5rem; }
.problem-lead {
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  color: var(--text);
  max-width: 52rem;
  line-height: 1.65;
}
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.stat {
  flex: 1 1 160px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.stat-num { font-size: 2.6rem; font-weight: 700; color: var(--accent); letter-spacing: -0.03em; }
.stat-label { font-size: 0.85rem; color: var(--text-dim); }

/* ---------- Features ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--card-hover);
}
.card-ic {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  margin-bottom: 1.1rem;
}
.card h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.card p { color: var(--text-dim); font-size: 0.92rem; }

/* ---------- Steps ---------- */
.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem;
  counter-reset: step;
}
.step {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
}
.step-n {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.step h3 { font-size: 1.08rem; margin: 0.7rem 0 0.4rem; }
.step p { color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Download ---------- */
.download { display: flex; justify-content: center; }
.download-card {
  width: 100%;
  background:
    radial-gradient(120% 120% at 50% -10%, var(--accent-soft), transparent 60%),
    var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  box-shadow: var(--shadow);
}
.download-card h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 0.8rem; }
.download-sub { color: var(--text-dim); max-width: 40rem; margin: 0 auto 2rem; }
.download-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 2.5rem;
}
.install-steps {
  text-align: left;
  max-width: 44rem;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem 1.7rem;
}
.install-steps + .install-steps { margin-top: 1.2rem; }
.install-steps h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.install-steps ol { padding-left: 1.2rem; display: grid; gap: 0.6rem; color: var(--text-dim); font-size: 0.92rem; }
.install-steps li::marker { color: var(--accent); font-weight: 700; }
.install-steps b { color: var(--text); }
.install-steps code {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.05rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85em;
}
.note {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border-soft);
  font-size: 0.82rem;
  color: var(--text-faint);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 2rem;
  padding: 2.5rem clamp(1rem, 4vw, 2.5rem);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.footer-brand { display: flex; align-items: center; gap: 0.7rem; }
.footer-brand .brand-mark { color: var(--accent); }
.footer-brand strong { display: block; }
.footer-brand span { font-size: 0.82rem; color: var(--text-dim); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.3rem; font-size: 0.88rem; color: var(--text-dim); }
.footer-links a:hover { color: var(--accent); }
.footer-fine {
  max-width: var(--maxw);
  margin: 1.8rem auto 0;
  font-size: 0.8rem;
  color: var(--text-faint);
  text-align: center;
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Mobile nav overlay ---------- */
.nav-hamburger { display: none; }
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  padding: 5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
}
.mobile-nav.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0s;
}
.mobile-nav nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mobile-nav a {
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 600;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--border-soft);
  transition: color 0.2s;
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover, .mobile-nav a:active { color: var(--accent); }

@media (max-width: 860px) {
  .nav-hamburger { display: inline-grid; }
}

/* ---------- Responsive ---------- */

/* Tablet breakpoint */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero .eyebrow, .hero-cta, .hero-badges { justify-content: center; }
  .lede { margin-inline: auto; }
  .hero-art { order: -1; }
  .phone { width: min(200px, 50vw); }
  .nav-links { display: none; }
  .section-head h2 { font-size: 1.6rem; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
}

/* Mobile breakpoint — majority of users land here */
@media (max-width: 520px) {
  :root { --radius: 14px; --radius-sm: 8px; }

  body { font-size: 15px; }

  /* Nav: compact, always visible, no overlap */
  .nav {
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
  }
  .brand-name { font-size: 0.95rem; }
  .brand-mark svg { width: 20px; height: 20px; }
  .nav-actions { gap: 0.4rem; }
  .nav-actions .btn-sm { display: none; } /* hide download btn in nav; CTA is in hero */
  .icon-btn { width: 34px; height: 34px; }

  /* Hero: phone MUCH smaller, everything stacked tight */
  .hero {
    padding: 0.8rem 1rem 1.5rem;
    gap: 1rem;
  }
  .hero h1 { font-size: 1.9rem; line-height: 1.1; margin-bottom: 0.5rem; }
  .lede { font-size: 0.9rem; margin-bottom: 1rem; }
  .eyebrow { font-size: 0.72rem; padding: 0.28rem 0.65rem; margin-bottom: 0.8rem; }
  .hero-cta { flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
  .hero-badges { gap: 0.3rem 0.8rem; font-size: 0.73rem; }

  /* Phone mockup: much smaller so it doesn't dominate */
  .hero-art { margin-bottom: 0; }
  .phone {
    width: 150px;
    aspect-ratio: 9 / 16;
    border-radius: 20px;
    padding: 5px;
    animation: none; /* disable float on mobile for stability */
    box-shadow: none;
  }
  .phone-notch { height: 12px; width: 34%; border-radius: 0 0 7px 7px; top: 6px; }
  .phone-screen { border-radius: 15px; }
  .chat-head { padding: 0.8rem 0.45rem 0.35rem; gap: 0.25rem; }
  .chat-mark { width: 16px; height: 16px; }
  .chat-mark svg { width: 10px; height: 10px; }
  .chat-title { font-size: 0.6rem; }
  .chat-peers { font-size: 0.5rem; padding: 0.05rem 0.3rem; }
  .chat-body { padding: 0.35rem 0.35rem; gap: 0.25rem; }
  .msg { font-size: 0.52rem; padding: 0.25rem 0.4rem; border-radius: 7px; max-width: 90%; line-height: 1.35; }
  .msg.typing span { width: 4px; height: 4px; }
  .msg b { font-size: inherit; }

  /* Buttons: full width, good tap targets */
  .btn { width: 100%; justify-content: center; padding: 0.85rem 1.2rem; font-size: 0.9rem; }
  .btn-lg { padding: 0.9rem 1.4rem; }
  .nav-actions .btn { width: auto; }

  /* Sections: tighter padding */
  .section { padding: 2.2rem 1rem; }
  .section-head { margin-bottom: 1.5rem; }
  .section-head h2 { font-size: 1.35rem; }
  .kicker { font-size: 0.7rem; margin-bottom: 0.5rem; }

  /* Problem */
  .problem-lead { font-size: 0.98rem; }
  .stat-row { flex-direction: column; }
  .stat { padding: 1.1rem; flex: unset; }
  .stat-num { font-size: 2rem; }

  /* Features: single column */
  .feature-grid { grid-template-columns: 1fr; gap: 0.8rem; }
  .card { padding: 1.2rem; }
  .card-ic { width: 36px; height: 36px; border-radius: 10px; margin-bottom: 0.7rem; }
  .card h3 { font-size: 1rem; }
  .card p { font-size: 0.86rem; }

  /* Steps: single column */
  .steps { grid-template-columns: 1fr; gap: 0.8rem; }
  .step { padding: 1.2rem; }
  .step h3 { font-size: 0.95rem; }

  /* Download */
  .download-card { padding: 1.4rem 1.1rem; border-radius: 16px; }
  .download-card h2 { font-size: 1.5rem; }
  .download-sub { font-size: 0.88rem; }
  .download-actions { flex-direction: column; gap: 0.6rem; }
  .install-steps { padding: 1.1rem; }
  .install-steps h4 { font-size: 0.7rem; }
  .install-steps ol { font-size: 0.84rem; gap: 0.5rem; }

  /* Footer */
  .footer { padding: 1.8rem 1rem; }
  .footer-inner { flex-direction: column; gap: 1rem; align-items: flex-start; }
  .footer-links { gap: 0.9rem; font-size: 0.82rem; flex-wrap: wrap; }
  .footer-fine { font-size: 0.72rem; text-align: left; }
}

/* Extra-small screens (iPhone SE, Galaxy Fold outer) */
@media (max-width: 375px) {
  .hero h1 { font-size: 1.6rem; }
  .hero { padding: 1rem 0.75rem 1.3rem; gap: 1rem; }
  .phone { width: 130px; }
  .section { padding: 1.8rem 0.7rem; }
  .download-card { padding: 1rem 0.8rem; }
  .brand-name { font-size: 0.85rem; }
  .lede { font-size: 0.86rem; }
  .eyebrow { font-size: 0.65rem; padding: 0.25rem 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto; transition: none !important; }
}
