/* ──────────────────────────────────────────────────────────────────
   LocoPal Agent — Official Site
   Design: deep navy dark mode · electric blue primary · violet accent
   Signature: the permission moment, animated in the hero
   ────────────────────────────────────────────────────────────────── */
:root {
  --void:        #070B12;
  --surface:     #0D1322;
  --surface-2:   #131D30;
  --surface-3:   #1A2540;
  --blue:        #3B8AFF;
  --blue-glow:   rgba(59,138,255,0.40);
  --blue-dim:    rgba(59,138,255,0.12);
  --blue-border: rgba(59,138,255,0.30);
  --violet:      #8B5CF6;
  --violet-dim:  rgba(139,92,246,0.12);
  --green:       #22D3A0;
  --text:        #DDE5F5;
  --text-2:      #8895AB;
  --text-3:      #4E5C72;
  --border:      rgba(255,255,255,0.06);
  --border-mid:  rgba(255,255,255,0.10);
  --radius:      16px;
  --wide:        1100px;
}

/* ── Light mode overrides ─────────────────────────────────────────── */
[data-theme="light"] {
  --void:        #F4F6FB;
  --surface:     #FFFFFF;
  --surface-2:   #EEF2FA;
  --surface-3:   #E4EAF6;
  --text:        #0F1520;
  --text-2:      #455060;
  --text-3:      #8896A8;
  --border:      rgba(0,0,0,0.07);
  --border-mid:  rgba(0,0,0,0.12);
  --blue-dim:    rgba(59,138,255,0.10);
  --blue-border: rgba(59,138,255,0.22);
  --violet-dim:  rgba(139,92,246,0.08);
  --blue-glow:   rgba(59,138,255,0.30);
}
/* Grid texture in light mode: barely-there */
[data-theme="light"] body::before {
  background-image:
    linear-gradient(rgba(59,138,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,138,255,0.025) 1px, transparent 1px);
}
/* Hero radial in light mode: lighter */
[data-theme="light"] .hero::after {
  background: radial-gradient(ellipse 60% 55% at 50% 20%,
    rgba(59,138,255,0.10) 0%, rgba(139,92,246,0.04) 45%, transparent 75%);
}
[data-theme="light"] .topbar { background: rgba(244,246,251,0.90); }
[data-theme="light"] .topbar.scrolled { background: rgba(244,246,251,0.97); }
[data-theme="light"] .demo-card {
  box-shadow: 0 0 0 1px rgba(59,138,255,.10),
              0 24px 64px rgba(0,0,0,.12),
              0 0 80px rgba(59,138,255,.05);
}
[data-theme="light"] .strip { background: rgba(0,0,0,0.06); }
[data-theme="light"] .cards article:hover {
  box-shadow: 0 12px 36px rgba(0,0,0,.12), 0 0 0 1px rgba(59,138,255,.06);
}
[data-theme="light"] footer { background: #EEF2FA; }

/* Smooth colour transitions when switching themes */
body, .topbar, .hero::after, .strip-item, .cards article, .downloads article,
.pair-item, .faq-item, .demo-card, .demo-titlebar, .demo-typing-wrap,
footer, .foot-inner { transition: background .25s, color .25s, border-color .25s; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font: 400 16px/1.7 "PingFang SC","SF Pro Text","Noto Sans SC",
        system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1,h2,h3 { line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; }
a { color: var(--blue); text-decoration: none; transition: color .15s; }
a:hover { color: #78AAFF; }
code {
  padding: 2px 7px; border-radius: 5px;
  background: var(--surface-2);
  font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size: .86em; color: #A5C4FF; border: 1px solid var(--border-mid);
}

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: 12px; top: 12px; z-index: 99;
  padding: 8px 16px; border-radius: 8px;
  background: var(--blue); color: #fff;
}

/* ── Ambient grid noise in background ─── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(59,138,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,138,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  max-width: 100%; padding: 0 clamp(20px, 4vw, 48px);
  height: 64px;
  background: rgba(7,11,18,0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background .3s;
}
.topbar.scrolled { background: rgba(7,11,18,0.95); }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  width: 100%; max-width: var(--wide); margin: 0 auto;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; font-size: 15px; letter-spacing: -.3px;
  user-select: none;
}
.brand img {
  border-radius: 9px;
  box-shadow: 0 0 0 1px var(--border-mid), 0 4px 12px rgba(59,138,255,.25);
  transition: box-shadow .2s;
}
.brand:hover img { box-shadow: 0 0 0 1px var(--blue-border), 0 4px 18px rgba(59,138,255,.45); }
.topbar nav { display: flex; align-items: center; gap: 28px; font-size: 14px; }
.topbar nav a { color: var(--text-2); transition: color .15s; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a.cta {
  padding: 7px 18px;
  border: 1px solid var(--blue-border);
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-dim);
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.topbar nav a.cta:hover {
  background: rgba(59,138,255,0.22);
  border-color: var(--blue);
  color: #78AAFF;
  transform: translateY(-1px);
}

/* ── Theme toggle ────────────────────────────────────────────────── */
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2); font-size: 16px; line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.theme-toggle:hover {
  background: var(--surface-3); border-color: var(--blue-border);
  color: var(--text); transform: scale(1.08);
}
.theme-toggle:active { transform: scale(.94); }

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 92vh;
  padding: 80px clamp(20px, 4vw, 48px) 60px;
  text-align: center;
  z-index: 1;
}

/* Radial glow behind hero content */
.hero::after {
  content: '';
  position: absolute; z-index: 0;
  top: -10%; left: 50%; transform: translateX(-50%);
  width: min(900px, 100vw); height: 600px;
  background: radial-gradient(ellipse 60% 55% at 50% 20%,
    rgba(59,138,255,0.15) 0%, rgba(139,92,246,0.07) 45%, transparent 75%);
  pointer-events: none;
}

.hero > * { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 20px;
  padding: 5px 14px;
  border: 1px solid var(--blue-border);
  border-radius: 999px;
  background: var(--blue-dim);
  color: #78AAFF; font-size: 12px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase;
  animation: fade-up .6s ease both;
}
.eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 6px var(--blue-glow);
  animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .6; transform: scale(1.3); }
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(34px, 5.5vw, 58px);
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #E2EEFF 30%, #78AAFF 60%, #B59BFF 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fade-up .6s .1s ease both;
}
.lede {
  max-width: 560px; margin: 0 auto 36px;
  color: var(--text-2); font-size: 17px; line-height: 1.7;
  animation: fade-up .6s .2s ease both;
}

.hero-actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  margin-bottom: 24px;
  animation: fade-up .6s .3s ease both;
}
.hero-meta {
  color: var(--text-3); font-size: 13px;
  animation: fade-up .5s .5s ease both;
}

/* Hero permission dialog demo */
.hero-demo {
  margin-top: 48px; margin-bottom: 8px;
  animation: fade-up .7s .4s ease both;
}
.demo-card {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(59,138,255,.12),
              0 24px 64px rgba(0,0,0,.55),
              0 0 80px rgba(59,138,255,.08);
  min-width: 360px; max-width: 480px;
  backdrop-filter: blur(12px);
  text-align: left;
}
.demo-titlebar {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.demo-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.demo-dot:nth-child(1) { background: #FF5F57; }
.demo-dot:nth-child(2) { background: #FFBD2E; }
.demo-dot:nth-child(3) { background: #28C840; }
.demo-name {
  margin-left: 6px;
  color: var(--text-3); font-size: 12px; font-weight: 500;
}
.demo-body { padding: 20px 20px 4px; }
.demo-label {
  display: block; margin-bottom: 8px;
  color: var(--text-2); font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
}
.demo-typing-wrap {
  display: flex; align-items: center; gap: 0;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  min-height: 46px;
}
#demo-text {
  color: #A5C4FF; font-size: 14px; font-family: ui-monospace,monospace;
  word-break: break-all;
}
.demo-cursor {
  color: var(--blue); font-size: 16px; font-weight: 400;
  animation: blink-cursor .9s step-end infinite;
}
@keyframes blink-cursor { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.demo-actions {
  display: flex; gap: 10px; padding: 16px 20px 20px;
  opacity: 0; transition: opacity .4s;
}
.demo-actions.visible { opacity: 1; }
.demo-deny {
  flex: 1; padding: 9px 0;
  background: transparent; border: 1px solid var(--border-mid);
  border-radius: 9px; color: var(--text-2); font-size: 14px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.demo-deny:hover { border-color: var(--text-3); color: var(--text); }
.demo-allow {
  flex: 2; padding: 9px 0;
  background: var(--blue); border: 1px solid var(--blue);
  border-radius: 9px; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 16px rgba(59,138,255,.35);
  transition: background .15s, box-shadow .15s, transform .1s;
}
.demo-allow:hover { background: #5A9FFF; box-shadow: 0 6px 22px rgba(59,138,255,.5); transform: translateY(-1px); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 26px;
  border: 1px solid var(--border-mid);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text); font-size: 15px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background .15s, transform .12s, box-shadow .15s;
}
.button:hover {
  border-color: var(--border-mid);
  background: var(--surface-3);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.button:active { transform: translateY(0); }
.button.primary {
  background: var(--blue); border-color: var(--blue); color: #fff;
  box-shadow: 0 6px 24px rgba(59,138,255,.35);
}
.button.primary:hover {
  background: #5A9FFF; border-color: #5A9FFF;
  box-shadow: 0 8px 30px rgba(59,138,255,.5);
}
.button[aria-disabled="true"] {
  opacity: .4; cursor: default; pointer-events: none;
}

/* ── Stats strip ─────────────────────────────────────────────────── */
.strip {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  max-width: var(--wide); margin: 0 auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 1;
}
.strip-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 20px;
  background: var(--void);
  transition: background .2s;
}
.strip-item:hover { background: var(--surface); }
.strip-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--blue-dim);
  border: 1px solid var(--blue-border);
  font-size: 18px; line-height: 1;
  margin-bottom: 2px;
}
.strip-item strong { font-size: 15px; font-weight: 700; color: var(--text); }
.strip-item span   { font-size: 13px; color: var(--text-2); text-align: center; }

/* ── Sections ────────────────────────────────────────────────────── */
.section {
  max-width: var(--wide); margin: 0 auto;
  padding: 72px clamp(20px, 4vw, 48px);
  position: relative; z-index: 1;
}
.section-header {
  margin-bottom: 48px;
}
.section-eyebrow {
  display: inline-block; margin-bottom: 12px;
  color: var(--violet); font-size: 12px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
}
.section h2 {
  margin: 0; font-size: clamp(26px, 3.5vw, 36px);
  background: linear-gradient(135deg, var(--text) 0%, #8895AB 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.section-lede {
  margin: 8px 0 0; color: var(--text-2); font-size: 15px;
}
.section-version { color: var(--text-2); font-size: 14px; }
.section-version strong { color: var(--text); }

/* ── Reveal animation (applied by IntersectionObserver) ───────────── */
.reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity .55s ease, transform .55s ease;
}
.reveal.visible {
  opacity: 1; transform: translateY(0);
}

/* ── Feature cards ───────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.cards article {
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.cards article::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue-border), transparent);
  opacity: 0; transition: opacity .2s;
}
.cards article:hover {
  border-color: var(--border-mid);
  transform: translateY(-3px);
  box-shadow: 0 12px 36px rgba(0,0,0,.4), 0 0 0 1px rgba(59,138,255,.08);
}
.cards article:hover::before { opacity: 1; }
.card-icon {
  width: 42px; height: 42px; margin-bottom: 16px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 20px; line-height: 1;
}
.card-icon.blue   { background: var(--blue-dim);   border: 1px solid var(--blue-border); }
.card-icon.violet { background: var(--violet-dim); border: 1px solid rgba(139,92,246,.3); }
.card-icon.green  { background: rgba(34,211,160,.1); border: 1px solid rgba(34,211,160,.25); }
.cards h3 { margin: 0 0 10px; font-size: 16px; font-weight: 650; color: var(--text); }
.cards p  { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.65; }

/* ── Download cards ──────────────────────────────────────────────── */
.downloads {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  align-items: stretch;
}
.downloads article {
  display: flex; flex-direction: column;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.downloads article:hover {
  border-color: var(--blue-border);
  box-shadow: 0 0 0 1px rgba(59,138,255,.12), 0 12px 32px rgba(0,0,0,.4);
  transform: translateY(-2px);
}
.dl-platform-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.dl-platform-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center; flex-shrink: 0;
  border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border-mid);
  font-size: 22px; line-height: 1;
}
.dl-head { display: flex; align-items: center; gap: 8px; }
.dl-head h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.dl-format {
  padding: 2px 8px; border-radius: 6px;
  background: var(--blue-dim); border: 1px solid var(--blue-border);
  color: #78AAFF; font-size: 11px; font-weight: 600;
}
.dl-detail { color: var(--text-2); font-size: 13px; margin-bottom: 16px; }

/* info-wrap grows to push button to bottom */
.dl-info { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.dl-install { color: var(--text-2); font-size: 13px; line-height: 1.55; flex: 1; }
.dl-size    { color: var(--text-3); font-size: 12px; }
.dl-soon    { color: var(--text-2); font-size: 13px; }

/* button pinned to bottom */
.downloads .button {
  width: 100%; justify-content: center;
  margin-top: 20px;
  padding: 11px 0; font-size: 14px;
}

.loading { color: var(--text-3); font-size: 14px; }
.fineprint { margin-top: 24px; color: var(--text-3); font-size: 13px; line-height: 1.6; }

/* ── Pairs (privacy) ─────────────────────────────────────────────── */
.pairs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.pair-item {
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s, transform .2s;
}
.pair-item:hover { border-color: var(--border-mid); transform: translateY(-2px); }
.pair-item h3 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 8px; font-size: 15px; font-weight: 650; color: var(--text);
}
.pair-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 8px; font-size: 14px; line-height: 1;
  background: var(--violet-dim); border: 1px solid rgba(139,92,246,.25);
}
.pair-item p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.65; }

/* ── FAQ ─────────────────────────────────────────────────────────── */
.faq { display: flex; flex-direction: column; gap: 2px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .2s;
}
.faq-item:hover { border-color: var(--border-mid); }
.faq-q {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px;
  font-weight: 600; font-size: 15px; color: var(--text);
  cursor: pointer;
  background: transparent; border: 0; width: 100%; text-align: left;
  transition: color .15s;
}
.faq-q:hover { color: #78AAFF; }
.faq-chevron {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 6px; background: var(--surface-2);
  color: var(--text-2); font-size: 12px;
  transition: transform .25s, background .15s;
}
.faq-item.open .faq-chevron { transform: rotate(90deg); background: var(--blue-dim); color: var(--blue); }
.faq-a {
  display: none; padding: 0 22px 18px;
  color: var(--text-2); font-size: 14px; line-height: 1.7;
  border-top: 1px solid var(--border);
}
.faq-item.open .faq-a { display: block; }

/* ── Footer ──────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 40px;
  position: relative; z-index: 1;
}
.foot-inner {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 16px;
  max-width: var(--wide); margin: 0 auto;
  padding: 28px clamp(20px, 4vw, 48px);
}
.foot-brand { display: flex; align-items: center; gap: 10px; }
.foot-brand img { border-radius: 7px; box-shadow: 0 0 0 1px var(--border-mid); }
.foot-brand strong { color: var(--text); font-size: 14px; font-weight: 700; }
.foot-inner nav { display: flex; gap: 24px; font-size: 14px; }
.foot-inner nav a { color: var(--text-2); }
.foot-inner nav a:hover { color: var(--text); }
.foot-inner small { color: var(--text-3); font-size: 13px; }

/* ── Keyframes ───────────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes float-slow {
  0%,100% { transform: translateY(0px); }
  50%     { transform: translateY(-8px); }
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .strip { grid-template-columns: 1fr 1fr; }
  .strip-item:last-child { grid-column: span 2; }
  .downloads { grid-template-columns: 1fr; }
  .topbar nav { gap: 16px; font-size: 13px; }
  .hero { min-height: 75vh; }
  .demo-card { min-width: unset; }
}
@media (max-width: 480px) {
  .strip { grid-template-columns: 1fr; }
  .strip-item:last-child { grid-column: auto; }
  .hero-actions { flex-direction: column; align-items: center; }
  .hero-actions .button { width: 100%; max-width: 280px; justify-content: center; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
