/*!
 * SignalDeck MarketGuard — Brand & Design System
 * Tokens, components, animations and utilities that complement Tailwind.
 * Loaded after Tailwind so it can override safely.
 */

/* ─────────────────────────────────────────────────────────────────────────────
 * 1. Design Tokens
 * ───────────────────────────────────────────────────────────────────────────── */
:root {
  /* Brand palette — fintech midnight */
  --sd-bg-0:     #05070d;   /* page background */
  --sd-bg-1:     #0a0f1c;   /* surface */
  --sd-bg-2:     #111827;   /* elevated surface */
  --sd-bg-3:     #1a2236;   /* card / hover */
  --sd-line:     #1f2a44;   /* hairlines */
  --sd-line-2:   #2a3656;

  --sd-ink-0:    #f8fafc;   /* primary text */
  --sd-ink-1:    #cbd5e1;   /* secondary text */
  --sd-ink-2:    #94a3b8;   /* tertiary text */
  --sd-ink-3:    #64748b;   /* muted */

  --sd-accent:        #22d3ee;  /* cyan — brand accent */
  --sd-accent-2:      #0ea5e9;  /* sky — gradient pair */
  --sd-accent-deep:   #0c4a6e;  /* deep accent for backgrounds */
  --sd-primary:       #2563eb;  /* primary CTA blue */
  --sd-primary-deep:  #1d4ed8;

  /* Verdict colors */
  --sd-ok:        #22c55e;
  --sd-warn:      #f59e0b;
  --sd-danger:    #ef4444;
  --sd-info:      #38bdf8;
  --sd-pause:     #fb923c;

  /* Typography */
  --sd-font-sans:    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sd-font-display: 'Fraunces', 'Playfair Display', Georgia, serif;
  --sd-font-mono:    ui-monospace, 'JetBrains Mono', 'Fira Code', Menlo, monospace;

  /* Radius & shadow */
  --sd-radius-sm: 8px;
  --sd-radius:    14px;
  --sd-radius-lg: 22px;
  --sd-shadow-glow:  0 0 0 1px rgba(34,211,238,0.15), 0 30px 80px -20px rgba(34,211,238,0.35);
  --sd-shadow-card:  0 1px 0 rgba(255,255,255,0.04) inset, 0 30px 60px -30px rgba(2,6,23,0.8);
}

/* ─────────────────────────────────────────────────────────────────────────────
 * 2. Base
 * ───────────────────────────────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sd-font-sans);
  font-feature-settings: 'cv11','ss01','ss03';
  background: var(--sd-bg-0);
  color: var(--sd-ink-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Selection */
::selection { background: rgba(34,211,238,0.35); color: #fff; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: #1f2a44 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #1f2a44; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #2a3656; }

/* Focus ring (accessibility) */
:focus-visible { outline: 2px solid var(--sd-accent); outline-offset: 2px; border-radius: 4px; }

/* Display headings */
.sd-display {
  font-family: var(--sd-font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: 'ss01';
}

.sd-mono { font-family: var(--sd-font-mono); }

/* Text balance for headings */
h1, h2, h3, .sd-balance { text-wrap: balance; }

/* ─────────────────────────────────────────────────────────────────────────────
 * 3. Background effects
 * ───────────────────────────────────────────────────────────────────────────── */
.sd-bg-grid {
  background-image:
    linear-gradient(rgba(34,211,238,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,211,238,0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 35%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 35%, transparent 75%);
}

.sd-bg-radial {
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(34,211,238,0.18), transparent 60%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(37,99,235,0.12), transparent 70%),
    var(--sd-bg-0);
}

.sd-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  pointer-events: none;
}
.sd-glow-orb.--cyan  { background: radial-gradient(circle, #22d3ee, transparent 60%); }
.sd-glow-orb.--blue  { background: radial-gradient(circle, #2563eb, transparent 60%); }
.sd-glow-orb.--green { background: radial-gradient(circle, #22c55e, transparent 60%); }

/* Animated glow */
@keyframes sd-pulse-soft {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 0.75; transform: scale(1.08); }
}
.sd-pulse-soft { animation: sd-pulse-soft 6s ease-in-out infinite; }

/* ─────────────────────────────────────────────────────────────────────────────
 * 4. Buttons
 * ───────────────────────────────────────────────────────────────────────────── */
.sd-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  border-radius: var(--sd-radius);
  padding: 0.85rem 1.4rem;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  font-size: 0.95rem;
  line-height: 1;
}
.sd-btn:active { transform: translateY(1px); }

.sd-btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #38bdf8 0%, #2563eb 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 18px 40px -16px rgba(37,99,235,0.65);
}
.sd-btn-primary:hover {
  background: linear-gradient(180deg, #22d3ee 0%, #1d4ed8 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 22px 50px -16px rgba(34,211,238,0.55);
}

.sd-btn-ghost {
  color: var(--sd-ink-0);
  background: rgba(255,255,255,0.04);
  border-color: var(--sd-line);
  backdrop-filter: blur(8px);
}
.sd-btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--sd-line-2);
}

.sd-btn-outline {
  color: var(--sd-accent);
  border-color: rgba(34,211,238,0.35);
  background: rgba(34,211,238,0.05);
}
.sd-btn-outline:hover {
  background: rgba(34,211,238,0.12);
  border-color: rgba(34,211,238,0.6);
}

.sd-btn-lg { padding: 1rem 1.6rem; font-size: 1rem; border-radius: var(--sd-radius-lg); }
.sd-btn-sm { padding: 0.55rem 0.9rem; font-size: 0.85rem; }

/* ─────────────────────────────────────────────────────────────────────────────
 * 5. Cards & surfaces
 * ───────────────────────────────────────────────────────────────────────────── */
.sd-card {
  background: linear-gradient(180deg, rgba(26,34,54,0.6) 0%, rgba(10,15,28,0.7) 100%);
  border: 1px solid var(--sd-line);
  border-radius: var(--sd-radius-lg);
  box-shadow: var(--sd-shadow-card);
  transition: transform .25s ease, border-color .2s ease, box-shadow .25s ease;
}
.sd-card:hover {
  border-color: var(--sd-line-2);
}

.sd-card-glow {
  position: relative;
}
.sd-card-glow::before {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(34,211,238,0.6), rgba(37,99,235,0.1) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}

.sd-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--sd-line-2);
  background: rgba(34,211,238,0.06);
  color: var(--sd-ink-1);
  letter-spacing: 0.01em;
}
.sd-pill .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--sd-accent);
  box-shadow: 0 0 12px var(--sd-accent);
  animation: sd-blink 2.4s ease-in-out infinite;
}
@keyframes sd-blink { 0%,100%{opacity:1;} 50%{opacity:.35;} }

/* ─────────────────────────────────────────────────────────────────────────────
 * 6. Verdict chips (mirrors engine output)
 * ───────────────────────────────────────────────────────────────────────────── */
.sd-verdict {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .9rem;
  border-radius: 999px;
  font-family: var(--sd-font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  border: 1px solid currentColor;
}
.sd-verdict::before {
  content: '';
  width: 8px; height: 8px; border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}
.sd-verdict.--approved  { color: #4ade80; background: rgba(34,197,94,0.08); }
.sd-verdict.--limited   { color: #facc15; background: rgba(234,179,8,0.08); }
.sd-verdict.--escalated { color: #fb923c; background: rgba(249,115,22,0.08); }
.sd-verdict.--paused    { color: #fb923c; background: rgba(249,115,22,0.08); }
.sd-verdict.--refused   { color: #f87171; background: rgba(239,68,68,0.10); }

/* ─────────────────────────────────────────────────────────────────────────────
 * 7. Form controls
 * ───────────────────────────────────────────────────────────────────────────── */
.sd-input, .sd-select, .sd-textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--sd-line);
  color: var(--sd-ink-0);
  border-radius: var(--sd-radius);
  padding: 0.75rem 0.95rem;
  font-size: 0.95rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .2s ease;
}
.sd-input::placeholder, .sd-textarea::placeholder { color: var(--sd-ink-3); }
.sd-input:focus, .sd-select:focus, .sd-textarea:focus {
  outline: none;
  border-color: var(--sd-accent);
  box-shadow: 0 0 0 4px rgba(34,211,238,0.18);
  background: rgba(15,23,42,0.85);
}
.sd-label {
  display:block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sd-ink-1);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────────────────────────
 * 8. Brand mark / logo type
 * ───────────────────────────────────────────────────────────────────────────── */
.sd-logo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--sd-ink-0);
}
.sd-logo .mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #22d3ee 0%, #2563eb 100%);
  position: relative;
  box-shadow: 0 6px 20px -6px rgba(34,211,238,0.6);
}
.sd-logo .mark::after {
  content: '';
  position: absolute; inset: 6px;
  border-radius: 4px;
  background: var(--sd-bg-0);
}
.sd-logo .mark::before {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 10px; height: 10px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: linear-gradient(135deg, #22d3ee, #2563eb);
  border-radius: 2px;
  z-index: 1;
}
.sd-logo .accent { color: var(--sd-accent); }

/* ─────────────────────────────────────────────────────────────────────────────
 * 9. Section helpers
 * ───────────────────────────────────────────────────────────────────────────── */
.sd-section { padding: 5rem 1.5rem; position: relative; }
@media (min-width: 768px) { .sd-section { padding: 6.5rem 2rem; } }

.sd-container { max-width: 1200px; margin: 0 auto; width: 100%; }
.sd-container-sm { max-width: 880px; margin: 0 auto; width: 100%; }

.sd-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sd-accent);
  margin-bottom: 1rem;
}

.sd-h1 {
  font-family: var(--sd-font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 5.5vw, 4.4rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.sd-h2 {
  font-family: var(--sd-font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 3.5vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.sd-h3 {
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.sd-lead {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.6;
  color: var(--sd-ink-1);
  max-width: 42rem;
}

.sd-gradient-text {
  background: linear-gradient(135deg, #22d3ee 0%, #60a5fa 50%, #818cf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Divider */
.sd-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sd-line-2), transparent);
}

/* ─────────────────────────────────────────────────────────────────────────────
 * 10. Animations
 * ───────────────────────────────────────────────────────────────────────────── */
@keyframes sd-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sd-fade-up { animation: sd-fade-up .7s cubic-bezier(.2,.7,.2,1) both; }
.sd-fade-up-1 { animation-delay: .05s; }
.sd-fade-up-2 { animation-delay: .15s; }
.sd-fade-up-3 { animation-delay: .25s; }
.sd-fade-up-4 { animation-delay: .35s; }

@keyframes sd-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.sd-marquee {
  display: flex; gap: 3rem;
  animation: sd-marquee 40s linear infinite;
  width: max-content;
}
.sd-marquee-mask {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

/* ─────────────────────────────────────────────────────────────────────────────
 * 11. Mockup preview window
 * ───────────────────────────────────────────────────────────────────────────── */
.sd-window {
  background: linear-gradient(180deg, #0c1424 0%, #070b16 100%);
  border: 1px solid var(--sd-line-2);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.05) inset,
    0 50px 100px -20px rgba(0,0,0,0.6),
    0 0 0 1px rgba(34,211,238,0.08);
}
.sd-window-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--sd-line);
  background: rgba(15, 23, 42, 0.5);
}
.sd-window-bar .dot { width: 11px; height: 11px; border-radius: 999px; }
.sd-window-bar .dot.r { background: #ef4444; }
.sd-window-bar .dot.y { background: #f59e0b; }
.sd-window-bar .dot.g { background: #22c55e; }
.sd-window-bar .url {
  margin-left: auto;
  font-family: var(--sd-font-mono);
  font-size: 0.7rem;
  color: var(--sd-ink-3);
  background: rgba(15, 23, 42, 0.6);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--sd-line);
}

/* Score gauge ring */
.sd-gauge {
  --val: 78;
  --color: #22c55e;
  width: 110px; height: 110px;
  border-radius: 999px;
  background:
    conic-gradient(var(--color) calc(var(--val) * 1%), rgba(255,255,255,0.06) 0);
  display: grid; place-items: center;
  position: relative;
}
.sd-gauge::before {
  content: '';
  position: absolute; inset: 8px;
  background: var(--sd-bg-1);
  border-radius: 999px;
}
.sd-gauge .val {
  position: relative;
  font-family: var(--sd-font-mono);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--sd-ink-0);
}
.sd-gauge .val small { font-size: 0.7rem; color: var(--sd-ink-3); margin-left: 2px; }

/* ─────────────────────────────────────────────────────────────────────────────
 * 12. Utility tweaks
 * ───────────────────────────────────────────────────────────────────────────── */
.sd-link {
  color: var(--sd-accent);
  text-decoration: none;
  border-bottom: 1px dashed rgba(34,211,238,0.4);
  transition: color .15s ease, border-color .15s ease;
}
.sd-link:hover { color: #67e8f9; border-color: rgba(103,232,249,0.7); }

.sd-noise {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sd-fade-up, .sd-pulse-soft, .sd-marquee, .sd-pill .dot { animation: none !important; }
  .sd-card, .sd-btn { transition: none !important; }
}
