/* ═══════════════════════════════════════════════════════════════
   OpsPing — Shared Design System ("Signal")
   Used by all www/ pages. Single source of truth for visual language.
   Dark tokens match the mobile app dark-glass theme
   (mobile/src/theme-context.tsx); light mode matches light-glass.
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg: #0a0a12;
  --surface: #12121f;
  --surface-raised: #1a1a2e;
  --border: rgba(255,255,255,0.08);
  --text-primary: #f0f0f5;
  --text-secondary: #9090a8;
  --text-muted: #8282a0;
  --text-faint: #5a5a72;
  --accent: #6c63ff;
  --accent-hover: #8b85ff;
  --on-accent: #ffffff;
  --success: #2ed573;
  --warning: #ffa502;
  --error: #ff4757;
  --info: #3498db;
  --p1: #ff4757;
  --p2: #ff6b35;
  --p3: #ffa502;
  --p4: #3498db;
  --p5: #8395a7;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 200; padding: 8px 16px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 13px; border-radius: var(--radius); text-decoration: none; }
.skip-link:focus { top: 16px; }

/* Pilot / coming-soon banner — remove after public launch */
.pilot-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 101;
  background: var(--accent); color: var(--on-accent); text-align: center;
  font-size: 13.5px; font-weight: 500; padding: 9px 16px; line-height: 1.4;
}
.pilot-banner strong { font-weight: 700; }
.pilot-banner a { color: var(--on-accent); font-weight: 600; text-decoration: underline; }
body:has(.pilot-banner) .nav { top: 37px; }
@media (max-width: 640px) {
  body:has(.pilot-banner) .nav { top: 54px; }
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
}

/* ── Grid Background ───────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ── Navigation ────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 64px;
  background: rgba(10,10,18,0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; text-decoration: none; }
.nav-logo-icon {
  width: 32px; height: 32px; border-radius: var(--radius);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--on-accent);
  object-fit: cover;
}
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { font-size: 14px; font-weight: 500; color: var(--text-secondary); transition: color .15s; text-decoration: none; }
.nav-links a:hover { color: var(--text-primary); }
.nav-links .nav-cta {
  padding: 8px 16px; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 13px;
  transition: background .15s, transform .15s;
}
.nav-cta:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ── Sections ──────────────────────────────────────────────── */
section { position: relative; z-index: 1; }
.section-container { max-width: 1160px; margin: 0 auto; padding: 0 32px; }
.section-header { text-align: center; margin-bottom: 56px; }
.section-header h2 { font-family: var(--font-display); font-size: 36px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); margin-bottom: 12px; }
.section-header p { font-size: 16px; color: var(--text-secondary); max-width: 560px; margin: 0 auto; line-height: 1.6; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 28px; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; border: none; cursor: pointer;
  text-decoration: none; transition: all .15s ease;
  font-family: var(--font);
}
.btn-primary {
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 0 24px rgba(108,99,255,0.25), 0 4px 12px rgba(0,0,0,0.3);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 0 32px rgba(108,99,255,0.35), 0 6px 16px rgba(0,0,0,0.4); }
.btn-outline {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--text-muted); background: rgba(255,255,255,0.03); }

/* ── Page Header (for inner pages) ─────────────────────────── */
.page-header {
  padding: 120px 32px 60px;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}
.page-header h1 { font-family: var(--font-display); font-size: 42px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); margin-bottom: 16px; }
.page-header p { font-size: 16px; color: var(--text-secondary); line-height: 1.6; }
.page-content { max-width: 800px; margin: 0 auto; padding: 0 32px 80px; }
.page-content h2 { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); margin: 40px 0 12px; }
.page-content h3 { font-size: 18px; font-weight: 600; color: var(--text-primary); margin: 28px 0 8px; }
.page-content p { font-size: 15px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 16px; }
.page-content ul, .page-content ol { color: var(--text-secondary); font-size: 15px; line-height: 1.7; margin: 0 0 16px 24px; }
.page-content li { margin-bottom: 6px; }
.page-content code {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--surface); padding: 2px 6px; border-radius: var(--radius-sm);
  color: var(--accent-hover);
}
.page-content pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  overflow-x: auto; margin: 16px 0;
}
.page-content a:not(.btn) { color: var(--accent-hover); text-decoration: none; }
.page-content a:not(.btn):hover { text-decoration: underline; }
.page-content a.btn-primary { color: var(--on-accent); }
.page-content a.btn-outline { color: var(--text-primary); }

/* ── Feature Grid ──────────────────────────────────────────── */
.features-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 24px;
  transition: border-color .2s, transform .2s;
}
.feature-card:hover { border-color: rgba(255,255,255,0.18); transform: translateY(-2px); }
.feature-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(108,99,255,0.12);
  display: grid; place-items: center; margin-bottom: 16px;
  font-size: 19px; color: var(--accent-hover);
}
.feature-icon svg { width: 20px; height: 20px; display: block; }
.feature-card h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; letter-spacing: -0.01em; }
.feature-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  padding: 64px 0 40px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  position: relative; z-index: 1;
}
.footer-grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-brand h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; letter-spacing: -0.02em; }
.footer-brand p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.footer-col h4 { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 16px; }
.footer-col a {
  display: block; font-size: 13px; color: var(--text-secondary);
  padding: 5px 0; text-decoration: none; transition: color .15s;
}
.footer-col a:hover { color: var(--text-primary); }
.footer-bottom {
  margin-top: 48px; padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted);
  display: flex; justify-content: space-between;
}
.footer-bottom a { color: inherit; text-decoration: none; }
.footer-bottom a:hover { color: var(--text-primary); text-decoration: underline; }

/* ── Code Diff (migration page) ────────────────────────────── */
.code-diff {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px;
  max-width: 620px; margin: 28px auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.8;
  overflow-x: auto;
}
.code-diff .line-old { color: var(--error); }
.code-diff .line-new { color: var(--success); }
.code-diff .line-comment { color: var(--text-faint); }

/* ── Comparison Table ──────────────────────────────────────── */
.comparison-table {
  max-width: 800px; margin: 0 auto;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; border-collapse: collapse;
  width: 100%;
}
.comp-header { background: var(--surface); padding: 16px 24px; font-size: 15px; font-weight: 700; text-align: left; }
.comp-cell { padding: 14px 24px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-secondary); font-weight: 400; text-align: left; }
.comp-cell[scope="row"] { font-weight: 500; color: var(--text-primary); }
.comp-icon { font-size: 14px; margin-right: 8px; }
.comp-icon.bad { color: var(--error); }
.comp-icon.good { color: var(--success); }

/* ── Pricing Grid ──────────────────────────────────────────── */
.pricing-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px; max-width: 960px; margin: 0 auto;
}
.price-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px 28px;
  transition: border-color .2s, transform .2s;
  display: flex; flex-direction: column;
}
.price-card.recommended { border-color: var(--accent); box-shadow: 0 0 32px rgba(108,99,255,0.12); transform: scale(1.03); }
.price-card .tier-name { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.price-card .price { font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); margin: 16px 0 4px; }
.price-card .price span { font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.price-card .tier-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.price-card ul { list-style: none; margin: 0 0 24px; flex: 1; }
.price-card li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); padding: 6px 0; }
.price-card li::before { content: '✓'; color: var(--success); font-weight: 700; font-size: 12px; flex-shrink: 0; }
.pricing-note { text-align: center; font-size: 14px; color: var(--text-muted); margin-top: 32px; }

/* ── Changelog ─────────────────────────────────────────────── */
.changelog-entry {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  margin-bottom: 16px;
}
.changelog-entry .version { font-size: 13px; font-weight: 700; color: var(--accent-hover); }
.changelog-entry .date { font-size: 12px; color: var(--text-muted); margin-left: 12px; }
.changelog-entry h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 8px 0; }
.changelog-entry ul { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.7; }

/* ── Status Badge ──────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
}
.status-badge.up { background: rgba(46,213,115,0.12); color: var(--success); }
.status-badge.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ── Legal Pages ───────────────────────────────────────────── */
.legal-nav {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 10px; margin-top: 28px;
}
.legal-nav a {
  font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--text-secondary);
  padding: 6px 16px; border: 1px solid var(--border); border-radius: 999px;
  transition: color .15s, border-color .15s;
}
.legal-nav a:hover { color: var(--text-primary); border-color: var(--text-muted); }
.legal-nav a.active { color: var(--accent-hover); border-color: var(--accent); }

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px; margin: 16px 0 24px;
}
.callout p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin: 0; }
.callout p + p { margin-top: 8px; }
.callout strong { color: var(--text-primary); }
.callout--warning { border-left-color: var(--warning); }

.legal-table-wrap { overflow-x: auto; margin: 16px 0 24px; }
.legal-table {
  width: 100%; border: 1px solid var(--border);
  border-radius: var(--radius); border-collapse: separate; border-spacing: 0;
}
.legal-table th {
  background: var(--surface);
  padding: 12px 16px; font-size: 13px; font-weight: 700;
  color: var(--text-primary); text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.legal-table td {
  padding: 12px 16px; font-size: 14px; line-height: 1.6;
  color: var(--text-secondary);
  border-top: 1px solid var(--border); vertical-align: top;
}
.legal-table tbody tr:first-child td { border-top: none; }
.legal-table td:first-child { color: var(--text-primary); font-weight: 500; }

/* ── Cookie Consent Banner ─────────────────────────────────── */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
  padding: 16px 20px;
}
.cookie-banner-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px; justify-content: space-between;
}
.cookie-banner p { margin: 0; flex: 1 1 320px; font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.cookie-banner a { color: var(--accent-hover); text-decoration: none; }
.cookie-banner a:hover { text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.cookie-banner button {
  font-family: var(--font); font-size: 14px; font-weight: 600;
  border-radius: var(--radius); padding: 8px 18px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.cookie-accept { background: var(--accent); color: var(--on-accent); border: none; }
.cookie-accept:hover { background: var(--accent-hover); }
.cookie-decline { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.cookie-decline:hover { border-color: var(--text-muted); }
@media (max-width: 640px) {
  .cookie-banner-inner { flex-direction: column; align-items: stretch; text-align: center; }
  .cookie-banner p { flex: 0 1 auto; }
  .cookie-banner-actions { justify-content: center; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .features-grid { grid-template-columns: 1fr 1fr; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; }
  .price-card.recommended { transform: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .page-header h1 { font-size: 32px; }
  .nav-links a:not(.nav-cta) { display: none; }
}
@media (max-width: 600px) {
  .features-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ── Light Mode (mobile light-glass) ───────────────────────── */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f0f2f5; --surface: #ffffff; --surface-raised: #ffffff;
    --border: rgba(0,0,0,0.09);
    --text-primary: #16141f; --text-secondary: #4c4a5e;
    --text-muted: #6e6c80; --text-faint: #9a98a8;
    --accent: #574fd6; --accent-hover: #463fd0; --on-accent: #ffffff;
    --success: #1e9e50; --warning: #b87700; --error: #d63040;
    --info: #2470c8; --p1: #d63040; --p2: #e05a1f; --p3: #b87700;
    --p4: #2470c8; --p5: #6e6c80;
  }
  .nav { background: rgba(255,255,255,0.85); }
  .bg-grid { background-image: linear-gradient(rgba(0,0,0,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.035) 1px, transparent 1px); }
  .btn-primary { box-shadow: 0 4px 14px rgba(87,79,214,0.25); }
  .btn-primary:hover { box-shadow: 0 6px 20px rgba(87,79,214,0.32); }
  .btn-outline:hover { background: rgba(0,0,0,0.02); }
  .feature-card:hover { border-color: rgba(0,0,0,0.2); }
  .feature-icon { background: rgba(87,79,214,0.1); color: var(--accent); }
  .price-card.recommended { box-shadow: 0 0 32px rgba(87,79,214,0.14), 0 4px 12px rgba(0,0,0,0.06); }
  .page-content code { background: rgba(87,79,214,0.08); color: var(--accent); }
  .page-content a:not(.btn) { color: var(--accent); }
  .changelog-entry .version { color: var(--accent); }
  .legal-nav a.active { color: var(--accent); }
  .cookie-banner a { color: var(--accent); }
  .cookie-banner { box-shadow: 0 -2px 12px rgba(0,0,0,0.08); }
  .status-badge.up { background: rgba(30,158,80,0.12); }
}
