/* ============================================================
   SmartCam Alerts — Tactical Design System
   Source of truth for colors, typography, and shared components.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Palette */
  --ops-black: #0a0e14;
  --panel: #0f1520;
  --panel-hi: #141b28;
  --border: #1a2332;
  --muted: #7a9bbd;
  --text: #c5d5e5;
  --text-hi: #ffffff;
  --signal: #4ade80;
  --signal-hi: #22c55e;
  --alert: #ef4444;
  --warn: #f59e0b;

  /* Typography */
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Rhythm */
  --max-width: 1280px;
  --section-pad-y: 80px;
  --section-pad-x: 24px;
}

/* ---------- RESET ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--ops-black);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

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

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- LAYOUT ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--section-pad-x);
}

.section {
  padding: var(--section-pad-y) 0;
  position: relative;
}

.section-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--signal);
  letter-spacing: 2px;
  margin-bottom: 12px;
}

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3 { font-family: var(--mono); color: var(--text-hi); letter-spacing: -0.5px; font-weight: 700; line-height: 1.1; }

h1 { font-size: clamp(36px, 6vw, 72px); letter-spacing: -2px; }
h2 { font-size: clamp(28px, 4vw, 44px); letter-spacing: -1px; }
h3 { font-size: 18px; }

h1 .accent, h2 .accent, h3 .accent { color: var(--signal); }

p { font-family: var(--sans); color: var(--text); font-size: 15px; }
p.lead { font-size: 17px; color: var(--muted); max-width: 640px; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.5px; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--signal);
  color: var(--ops-black);
}
.btn-primary:hover {
  background: var(--signal-hi);
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--signal);
  color: var(--signal);
}

/* ---------- CHROME ELEMENTS ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--signal);
  letter-spacing: 0.5px;
}
.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  animation: sca-pulse 2s infinite;
}
@keyframes sca-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* ---------- CARD / PANEL ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  position: relative;
}
.panel-label {
  position: absolute;
  top: -9px;
  left: 16px;
  background: var(--ops-black);
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--signal);
  letter-spacing: 1px;
}

/* Demo scenario buttons — selected state */
.demo-scenario-btn { transition: all 0.15s ease; }
.demo-scenario-btn:hover { border-color: var(--muted); }
.demo-scenario-btn.selected {
  border-color: var(--signal);
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.18);
}

/* Demo suggestion pills */
.demo-suggest {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.demo-suggest:hover {
  border-color: var(--signal);
  color: var(--signal);
}

/* ---------- CAMERA FRAME COMPONENT ---------- */
.cam-frame {
  position: relative;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.cam-frame img,
.cam-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cam-frame::after { /* scan lines */
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px);
  pointer-events: none;
  z-index: 3;
}
.cam-grain {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  mix-blend-mode: screen;
  z-index: 2;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence baseFrequency='0.9'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  pointer-events: none;
}
.cam-corners .corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--signal);
  z-index: 4;
}
.cam-corners .corner.tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.cam-corners .corner.tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.cam-corners .corner.bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.cam-corners .corner.br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

.cam-label {
  position: absolute;
  top: 12px;
  left: 20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--signal);
  z-index: 5;
}
.cam-rec {
  position: absolute;
  top: 12px;
  right: 20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--alert);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
}
.cam-rec::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--alert);
  animation: sca-pulse 1.5s infinite;
}
.cam-timestamp {
  position: absolute;
  bottom: 12px;
  right: 20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--signal);
  z-index: 5;
}
.cam-meta {
  position: absolute;
  bottom: 12px;
  left: 20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  z-index: 5;
}

/* AI detection box (toggled via class in JS) */
.ai-box {
  position: absolute;
  border: 1.5px solid var(--signal);
  z-index: 6;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.ai-box.on { opacity: 1; }
.ai-box::before {
  content: attr(data-label);
  position: absolute;
  top: -18px;
  left: -1px;
  background: var(--signal);
  color: var(--ops-black);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  letter-spacing: 0.5px;
}

/* Alert toast */
.alert-toast {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: var(--signal);
  color: var(--ops-black);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  z-index: 7;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.4s ease;
}
.alert-toast.on { opacity: 1; transform: translateY(0); }

/* ---------- NAV ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px var(--section-pad-x);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: 1.5px;
}
.nav-logo .dot {
  width: 7px;
  height: 7px;
  background: var(--signal);
  border-radius: 50%;
  animation: sca-pulse 2s infinite;
}
.nav-links {
  display: flex;
  gap: 28px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.nav-links a:hover { color: var(--signal); }

@media (max-width: 768px) {
  .nav-links { display: none; }
}

/* ---------- FOOTER ---------- */
.footer {
  padding: 48px 0 32px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  margin-top: 80px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--section-pad-x);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}
.footer-brand { font-family: var(--mono); font-size: 13px; color: var(--text-hi); font-weight: 700; letter-spacing: 1.5px; }
.footer-status { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 8px; }
.footer-col h4 { font-family: var(--mono); font-size: 10px; color: var(--signal); letter-spacing: 1.5px; margin-bottom: 12px; text-transform: uppercase; }
.footer-col a { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 4px 0; }
.footer-col a:hover { color: var(--text-hi); }

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

/* ---------- MOBILE RESPONSIVE ---------- */
@media (max-width: 768px) {
  :root { --section-pad-y: 56px; }

  /* Collapse all multi-column inline grids to single column on mobile. */
  .section [style*="grid-template-columns"],
  .hero [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
  }

  /* Reset bento cell spans so the stacked layout reads top-to-bottom */
  .section .panel[style*="grid-row:span"],
  .section .panel[style*="grid-column:span"] {
    grid-row: auto !important;
    grid-column: auto !important;
  }

  /* Hide desktop-only status elements */
  .hero .status-bar { font-size: 9px; padding: 8px 12px; }
  .hero .status-bar .hide-sm { display: none; }

  /* Keep demo scenario buttons in 2 columns on mobile — they're compact enough */
  #demo [style*="grid-template-columns:repeat(2"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Mobile headline scales */
  h1 { font-size: 42px !important; letter-spacing: -1.2px !important; }
  h2 { font-size: 30px !important; }
}

/* ---------- ARTICLE / PROSE ---------- */
.article-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--section-pad-x);
}
.article-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--signal);
  letter-spacing: 1.5px;
  margin-bottom: 16px;
  text-transform: uppercase;
}
.article {
  font-family: var(--sans);
  color: var(--text);
  font-size: 17px;
  line-height: 1.75;
}
.article h1 {
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: -1.5px;
  margin: 0 0 20px;
  color: var(--text-hi);
}
.article h2 {
  font-size: 26px;
  letter-spacing: -0.5px;
  margin: 48px 0 16px;
  color: var(--text-hi);
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.article h2:first-of-type { border-top: none; padding-top: 0; }
.article h3 {
  font-size: 20px;
  margin: 32px 0 12px;
  color: var(--text-hi);
  font-family: var(--mono);
}
.article p { margin: 0 0 18px; color: var(--text); }
.article p strong { color: var(--text-hi); font-weight: 600; }
.article a {
  color: var(--signal);
  text-decoration: underline;
  text-decoration-color: rgba(74, 222, 128, 0.4);
  text-underline-offset: 3px;
}
.article a:hover { text-decoration-color: var(--signal); }
.article ul, .article ol {
  margin: 0 0 20px 22px;
  padding: 0;
}
.article li { margin-bottom: 8px; }
.article code {
  font-family: var(--mono);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 14px;
  color: var(--signal);
}
.article pre {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--signal);
  padding: 16px 20px;
  border-radius: 3px;
  overflow-x: auto;
  margin: 20px 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}
.article pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
}
.article blockquote {
  border-left: 3px solid var(--signal);
  padding: 4px 20px;
  margin: 20px 0;
  color: var(--muted);
  font-style: italic;
  background: rgba(74, 222, 128, 0.04);
}
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
.article th, .article td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}
.article th {
  background: var(--panel);
  font-family: var(--mono);
  color: var(--signal);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.article img {
  border: 1px solid var(--border);
  border-radius: 3px;
  margin: 20px 0;
}
.article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* Post cards (blog index) */
.post-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 14px;
  transition: all 0.15s ease;
  text-decoration: none;
  color: inherit;
}
.post-card:hover {
  border-color: var(--signal);
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(74, 222, 128, 0.1);
}
.post-card .tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--signal);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.post-card h2 {
  font-size: 22px;
  margin: 4px 0 8px;
  color: var(--text-hi);
  letter-spacing: -0.5px;
}
.post-card p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}
.post-card .meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 12px;
  letter-spacing: 0.5px;
}

/* ---------- AUTH PAGES ---------- */
.auth-wrap {
  max-width: 440px;
  margin: 80px auto 40px;
  padding: 0 var(--section-pad-x);
}
.auth-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 36px 32px;
  position: relative;
}
.auth-panel::before {
  content: '// SECURE_AUTH';
  position: absolute;
  top: -9px;
  left: 20px;
  background: var(--ops-black);
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--signal);
  letter-spacing: 1px;
}
.auth-panel h1 {
  font-size: 26px;
  margin-bottom: 6px;
}
.auth-panel .sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 24px;
}
.auth-field {
  margin-bottom: 18px;
}
.auth-field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--signal);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.auth-field input {
  width: 100%;
  padding: 12px 14px;
  background: var(--ops-black);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  transition: border-color 0.15s ease;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.12);
}
.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--alert);
  color: var(--alert);
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 14px;
  border-radius: 3px;
  margin-bottom: 16px;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.auth-footer a { color: var(--signal); }
.auth-footer a:hover { text-decoration: underline; }

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
