/* =========================================================
   RGT design system — tokens, reset, typography, utilities
   ========================================================= */

:root {
  /* Brand */
  --rgt-red-50:  #fff1f1;
  --rgt-red-100: #ffe1e1;
  --rgt-red-200: #ffc7c7;
  --rgt-red-400: #f87171;
  --rgt-red-500: #ef4444;
  --rgt-red-600: #dc2626;
  --rgt-red-700: #b91c1c;
  --rgt-red-800: #991b1b;

  /* Neutrals (slate) */
  --ink-50:  #f8fafc;
  --ink-100: #f1f5f9;
  --ink-200: #e2e8f0;
  --ink-300: #cbd5e1;
  --ink-400: #94a3b8;
  --ink-500: #64748b;
  --ink-600: #475569;
  --ink-700: #334155;
  --ink-800: #1e293b;
  --ink-900: #0f172a;
  --ink-950: #020617;

  /* Semantic */
  --bg:           #fafafa;
  --surface:      #ffffff;
  --surface-2:    #f6f7f9;
  --border:       rgba(15, 23, 42, 0.08);
  --border-strong:rgba(15, 23, 42, 0.14);
  --text:         var(--ink-900);
  --text-muted:   var(--ink-500);
  --text-subtle:  var(--ink-400);
  --primary:      var(--rgt-red-600);
  --primary-hover:var(--rgt-red-700);
  --primary-soft: var(--rgt-red-50);
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;

  /* Effects */
  --ring:         0 0 0 3px rgba(220, 38, 38, 0.18);
  --shadow-xs:    0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:    0 2px 6px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:    0 6px 18px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:    0 20px 40px -12px rgba(15, 23, 42, 0.18), 0 8px 16px -8px rgba(15, 23, 42, 0.08);
  --shadow-glow:  0 10px 40px -10px rgba(220, 38, 38, 0.45);

  /* Radii */
  --radius-xs:  6px;
  --radius-sm:  10px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-pill:9999px;

  /* Spacing scale (4-pt grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10:40px;
  --space-12:48px;
  --space-16:64px;
  --space-20:80px;

  /* Type */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Inter', system-ui, sans-serif;

  /* Motion */
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:    150ms;
  --t-base:    220ms;
  --t-slow:    420ms;

  /* Layout */
  --container: 1240px;
  --header-h:  76px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(220, 38, 38, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(15, 23, 42, 0.05), transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
}

img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; }
h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.2; }
h3 { font-size: 1.25rem; line-height: 1.3; }

p { margin: 0; color: var(--text-muted); }

::selection { background: var(--primary); color: #fff; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 6px;
}

/* ---------- Utilities ---------- */
.container { width: min(100% - 32px, var(--container)); margin-inline: auto; }
.hidden { display: none !important; }
.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;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--ink-900);
  --btn-fg: #fff;
  --btn-bd: transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease-out),
    background var(--t-base) var(--ease-out),
    box-shadow var(--t-base) var(--ease-out),
    border-color var(--t-base) var(--ease-out);
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }

.btn--primary {
  --btn-bg: linear-gradient(180deg, var(--rgt-red-500), var(--rgt-red-600));
  --btn-fg: #fff;
}
.btn--primary:hover {
  --btn-bg: linear-gradient(180deg, var(--rgt-red-600), var(--rgt-red-700));
  box-shadow: var(--shadow-glow);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
}
.btn--ghost:hover { --btn-bg: var(--surface-2); }

.btn--full { width: 100%; }
.btn--lg { height: 52px; padding: 0 var(--space-6); font-size: 1rem; border-radius: var(--radius-md); }
.btn--sm { height: 36px; padding: 0 var(--space-3); font-size: 0.85rem; border-radius: var(--radius-sm); }

/* ---------- Inputs ---------- */
.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font: inherit;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.input::placeholder { color: var(--text-subtle); }
.input:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
  outline: none;
}

textarea.input { height: auto; min-height: 120px; padding-block: var(--space-3); resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ---------- Glass ---------- */
.glass {
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-sm);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------- Animations ---------- */
@keyframes rgt-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes rgt-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}
@keyframes rgt-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes rgt-spin {
  to { transform: rotate(360deg); }
}
@keyframes rgt-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.fade-in { animation: rgt-fade-in var(--t-slow) var(--ease-out) both; }

/* Scroll-reveal (paired with motion.js) */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--ink-100) 0%, var(--ink-200) 50%, var(--ink-100) 100%);
  background-size: 200% 100%;
  animation: rgt-shimmer 1.4s linear infinite;
  border-radius: var(--radius-md);
}

/* Spinner */
.spinner {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid var(--ink-200);
  border-top-color: var(--primary);
  animation: rgt-spin 0.8s linear infinite;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
