/* ============================================================
   DT MALWARE SAFE — Design System
   styles.css: tokens, reset, typography, utilities, components
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --primary:        #2563EB;
  --primary-50:     #EFF6FF;
  --primary-100:    #DBEAFE;
  --primary-hover:  #1D4ED8;
  --primary-light:  rgba(37,99,235,0.08);

  /* Signal Palette */
  --safe:           #16A34A;
  --safe-light:     #F0FDF4;
  --warning:        #EAB308;
  --warning-light:  #FEFCE8;
  --danger:         #DC2626;
  --danger-light:   #FEF2F2;

  /* Neutral */
  --bg:             #FAFAF7;
  --bg-alt:         #F3F4F6;
  --surface:        #FFFFFF;
  --border:         #E5E7EB;
  --border-strong:  #D1D5DB;
  --text:           #111827;
  --text-secondary: #374151;
  --text-muted:     #6B7280;
  --text-subtle:    #9CA3AF;

  /* Typography */
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border Radius */
  --radius-sm:  0.375rem;
  --radius:     0.75rem;
  --radius-lg:  1rem;
  --radius-xl:  1.5rem;
  --radius-full:9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow:     0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md:  0 10px 15px rgba(0,0,0,0.10), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-lg:  0 20px 25px rgba(0,0,0,0.10), 0 8px 10px rgba(0,0,0,0.04);
  --shadow-xl:  0 25px 50px rgba(0,0,0,0.15);
  --shadow-blue:0 4px 14px rgba(37,99,235,0.25);

  /* Transitions */
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:  cubic-bezier(0, 0, 0.2, 1);
  --dur-fast:  150ms;
  --dur:       250ms;
  --dur-slow:  400ms;

  /* Container */
  --container: 1200px;
  --container-sm: 768px;
}

/* ── Cross-Document View Transitions ─────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: 200ms var(--ease) both fade-out; }
  ::view-transition-new(root) { animation: 300ms var(--ease-out) both fade-in; }
  @keyframes fade-out { to { opacity: 0; transform: translateY(-4px); } }
  @keyframes fade-in  { from { opacity: 0; transform: translateY(4px); } }
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, video, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

/* ── Typography Scale ─────────────────────────────────────── */
.text-xs   { font-size: 0.75rem;  line-height: 1.5; }
.text-sm   { font-size: 0.875rem; line-height: 1.5; }
.text-base { font-size: 1rem;     line-height: 1.6; }
.text-lg   { font-size: 1.125rem; line-height: 1.6; }
.text-xl   { font-size: 1.25rem;  line-height: 1.4; }
.text-2xl  { font-size: 1.5rem;   line-height: 1.3; }
.text-3xl  { font-size: 1.875rem; line-height: 1.2; }
.text-4xl  { font-size: 2.25rem;  line-height: 1.1; }
.text-5xl  { font-size: 3rem;     line-height: 1.05;}
.text-6xl  { font-size: 3.75rem;  line-height: 1;   }

/* ── Container ────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-6);
}
.container-sm {
  max-width: var(--container-sm);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-blue);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 6px 20px rgba(37,99,235,0.35); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-white {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.btn-white:hover { background: var(--primary-50); }

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #B91C1C; }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1.0625rem; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-heading);
  white-space: nowrap;
}
.badge-blue    { background: var(--primary-100); color: var(--primary); }
.badge-green   { background: var(--safe-light);  color: var(--safe); }
.badge-yellow  { background: var(--warning-light); color: #92400E; }
.badge-red     { background: var(--danger-light); color: var(--danger); }
.badge-gray    { background: var(--bg-alt); color: var(--text-muted); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-body { padding: var(--space-6); }

/* ── Section spacing ──────────────────────────────────────── */
.section { padding-block: var(--space-20); }
.section-sm { padding-block: var(--space-12); }

/* ── Section headers ──────────────────────────────────────── */
.section-eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-heading);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--space-3);
}
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: var(--space-4);
}
.section-subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 56ch;
}
.section-header { text-align: center; margin-bottom: var(--space-12); }
.section-header .section-subtitle { margin-inline: auto; }

/* ── Form elements ────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-textarea { resize: vertical; min-height: 120px; }

/* ── Toast ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  animation: toast-in 0.3s var(--ease-out);
  max-width: 360px;
}
.toast.success { background: var(--safe); }
.toast.error   { background: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(100%); }
}

/* ── Utilities ────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-muted   { color: var(--text-muted); }
.font-bold    { font-weight: 700; }
.font-semibold{ font-weight: 600; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius); }
.hidden { display: none; }

/* ── Grid ─────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .container { padding-inline: var(--space-4); }
}

/* ── Pulse animation ──────────────────────────────────────── */
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(22,163,74,0); }
}
.pulse-dot {
  width: 10px; height: 10px;
  background: var(--safe);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin-block: var(--space-8); }

/* ── Scroll reveal (JS adds .revealed) ───────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.reveal.revealed { opacity: 1; transform: none; }
