/* ==========================================================================
   UNPACKED — Unified Design Tokens
   Single source of truth for all design decisions.
   Derived from landing page (bone-white/terracotta/navy system).
   ========================================================================== */

:root {
  /* ─── Color Palette ─── */
  /* Base */
  --color-bg: #F9F7F4;
  --color-bg-card: #FFFFFF;
  --color-bg-elevated: #F0EDE6;

  /* Text hierarchy */
  --color-text: #1F2937;
  --color-text-muted: #6B7280;
  --color-text-light: #9CA3AF;

  /* Brand */
  --color-primary: #1B365D;      /* Deep navy — trust, authority */
  --color-primary-light: #2D4A7A;
  --color-accent: #A0522D;       /* Terracotta — warmth, action */
  --color-accent-light: #C0683A;
  --color-cta: #D4380D;          /* Terracotta CTA — primary actions */
  --color-cta-hover: #B82E0A;

  /* Borders */
  --color-border: #D4C9B8;
  --color-border-light: #E8E2D8;

  /* Semantic */
  --color-success: #166534;
  --color-success-bg: #DCFCE7;
  --color-success-border: #BBF7D0;
  --color-warning: #92400E;
  --color-warning-bg: #FEF3C7;
  --color-warning-border: #FDE68A;
  --color-error: #991B1B;
  --color-error-bg: #FEF2F2;
  --color-error-border: #FECACA;

  /* ─── Typography ─── */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;

  --text-xs: 0.7rem;
  --text-sm: 0.8rem;
  --text-base: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.05rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  --leading-tight: 1.15;
  --leading-normal: 1.6;
  --leading-relaxed: 1.7;

  /* ─── Spacing ─── */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;

  /* ─── Sizing ─── */
  --radius-sm: 2px;
  --radius: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --max-w: 1080px;
  --max-w-narrow: 720px;
  --max-w-form: 500px;

  /* ─── Shadows ─── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.06), 0 4px 6px rgba(0,0,0,.04);

  /* ─── Transitions ─── */
  --transition-fast: 120ms ease;
  --transition: 150ms ease;
  --transition-slow: 250ms ease;

  /* ─── Z-index ─── */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
}

/* ==========================================================================
   Base Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Utility Classes (composable, single-purpose)
   ========================================================================== */

/* Layout */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--space-lg); }
.container-narrow { max-width: var(--max-w-narrow); margin: 0 auto; padding: 0 var(--space-lg); }
.container-form { max-width: var(--max-w-form); margin: 0 auto; padding: 0 var(--space-lg); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xl); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }

/* Typography */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }
.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.leading-tight { line-height: var(--leading-tight); }
.leading-relaxed { line-height: var(--leading-relaxed); }

/* Section labels */
.section-label {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.section-title {
  font-size: clamp(var(--text-xl), 2.5vw, var(--text-3xl));
  font-weight: var(--font-extrabold);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

.section-subtitle {
  color: var(--color-text-muted);
  max-width: var(--max-w-narrow);
  line-height: var(--leading-relaxed);
}

/* Cards */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  padding: var(--space-lg);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-icon {
  margin-bottom: var(--space-md);
  color: var(--color-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--color-cta);
  color: #fff;
  border-color: var(--color-cta);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-cta-hover);
  border-color: var(--color-cta-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--color-text-muted); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { color: var(--color-text); }

.btn-block { width: 100%; }

/* Inputs */
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  background: #fff;
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input:focus { outline: none; border-color: var(--color-primary); }
.input::placeholder { color: var(--color-text-light); }

.label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin-bottom: 4px;
  color: var(--color-text);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-success { background: var(--color-success-bg); border: 1px solid var(--color-success-border); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); border: 1px solid var(--color-warning-border); color: var(--color-warning); }
.badge-error { background: var(--color-error-bg); border: 1px solid var(--color-error-border); color: var(--color-error); }
.badge-primary { background: var(--color-bg-elevated); border: 1px solid var(--color-border); color: var(--color-primary); }

/* SVG Icon System */
.icon { display: inline-block; flex-shrink: 0; }
.icon-sm { width: 20px; height: 20px; }
.icon-md { width: 28px; height: 28px; }
.icon-lg { width: 36px; height: 36px; }
.icon-xl { width: 48px; height: 48px; }
.icon use { stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm use { stroke-width: 1.8; }
.icon-lg use { stroke-width: 1.3; }
.icon-xl use { stroke-width: 1.2; }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate { animation: fadeUp 0.5s ease both; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* Focus visible */
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 0 var(--space-md); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: var(--space-md); }
  .flex-col-mobile { flex-direction: column; }
  .btn { padding: 12px 24px; }
}