/* Buildtal Design System — Apple-grade UX foundation
   Shared across all pages. Page-specific styles stay inline.
   Typography: Bricolage Grotesque (display) + DM Sans (body) */

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Type scale (strict — no in-between values) */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 24px;
  --text-2xl: 32px;
  --text-3xl: 40px;
  --text-4xl: 48px;

  /* Spacing scale */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px;  --sp-8: 40px;
  --sp-9: 48px; --sp-10: 64px; --sp-11: 80px; --sp-12: 96px;

  /* Surfaces */
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-2: #F1F3F6;
  --surface-3: #E8ECF1;
  --elevated: #FFFFFF;

  /* Brand */
  --navy: #1B2A4A;
  --navy-mid: #2C3E5A;
  --navy-pale: #E8ECF4;
  --amber: #F59E0B;
  --amber-dark: #D97706;
  --amber-pale: #FEF3C7;
  --orange: #F07D00;
  --orange-dark: #D96E00;
  --orange-pale: #FFF0E0;

  /* Text */
  --text-primary: #0F1D35;
  --text-secondary: #4A5568;
  --text-muted: #8896A5;
  --text-inverse: #FFFFFF;

  /* Semantic */
  --green: #059669;
  --green-bg: #ECFDF5;
  --blue: #2563EB;
  --blue-pale: #EFF6FF;
  --blue-bg: #DBEAFE;
  --purple: #7C3AED;
  --purple-bg: #F0EFFE;
  --teal: #0D9488;
  --teal-bg: #F0FDFA;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --border: #E2E5EA;
  --border-hover: #CBD0D8;
  --focus-ring: rgba(37, 99, 235, 0.4);

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --shadow-xl: 0 24px 48px rgba(0,0,0,0.16);

  /* Radii */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 120ms;
  --duration: 200ms;
  --duration-slow: 350ms;
}

/* ── BASE ──────────────────────────────────────────────────── */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-size: var(--text-base);
}

/* Focus rings — visible only for keyboard */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ── TYPOGRAPHY ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Bricolage Grotesque', -apple-system, sans-serif;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
h1 { font-size: var(--text-2xl); font-weight: 800; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); font-weight: 600; }

/* ── NAVIGATION ────────────────────────────────────────────── */
.bt-nav {
  position: fixed; top: 0; width: 100%; z-index: 200;
  height: 56px; padding: 0 var(--sp-6);
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: all var(--duration) var(--ease);
}
.bt-nav.compact {
  height: 48px;
  box-shadow: var(--shadow-sm);
}
.bt-nav .logo {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--navy);
  text-decoration: none;
  letter-spacing: -0.03em;
}
.bt-nav .logo span { color: var(--orange); }
.bt-nav-center {
  display: flex; align-items: center; gap: var(--sp-1);
}
.bt-nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease);
}
.bt-nav-link:hover { background: var(--surface-2); color: var(--text-primary); }
.bt-nav-link.active { color: var(--blue); font-weight: 600; background: var(--blue-pale); }
.bt-nav-right {
  display: flex; align-items: center; gap: var(--sp-2);
}
.bt-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  transition: all var(--duration-fast) var(--ease);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.bt-btn:active { transform: scale(0.97); }
.bt-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.bt-btn-ghost:hover { background: var(--surface-2); border-color: var(--border-hover); }
.bt-btn-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 1px 3px rgba(240,125,0,0.25);
}
.bt-btn-primary:hover {
  background: var(--orange-dark);
  box-shadow: 0 2px 8px rgba(240,125,0,0.35);
}

/* ── BREADCRUMBS ───────────────────────────────────────────── */
.bt-breadcrumbs {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-xs);
  color: var(--text-muted);
  max-width: 1200px;
  margin: 0 auto;
}
.bt-breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}
.bt-breadcrumbs a:hover { color: var(--text-primary); }
.bt-breadcrumbs .sep { opacity: 0.4; }
.bt-breadcrumbs .current { color: var(--text-secondary); font-weight: 500; }

/* ── MOBILE BOTTOM BAR ────────────────────────────────────── */
.bt-bottom-bar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 200;
  height: 64px;
  padding: var(--sp-2) var(--sp-4);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  justify-content: space-around;
  align-items: center;
}
.bt-bottom-bar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  padding: var(--sp-1);
  transition: color var(--duration-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
  min-width: 56px;
}
.bt-bottom-bar a.active { color: var(--blue); }
.bt-bottom-bar a:active { transform: scale(0.92); }
.bt-bottom-bar svg { width: 22px; height: 22px; }
@media (max-width: 768px) {
  .bt-bottom-bar { display: flex; }
  body { padding-bottom: 64px; }
  .bt-nav-center { display: none; }
}

/* ── FILTER CHIPS ──────────────────────────────────────────── */
.bt-filter-chips {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  padding: var(--sp-3) 0;
}
.bt-chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  background: var(--blue-pale);
  color: var(--blue);
  border: 1px solid var(--blue-bg);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.bt-chip:hover { background: var(--blue-bg); }
.bt-chip .chip-x {
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.15);
  font-size: 9px;
  line-height: 1;
}

/* ── SKELETON LOADING ──────────────────────────────────────── */
.bt-skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: bt-shimmer 1.8s var(--ease) infinite;
  border-radius: var(--radius-sm);
}
@keyframes bt-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── FADE IN ───────────────────────────────────────────────── */
.bt-fade-in {
  animation: bt-fadeIn var(--duration-slow) var(--ease) forwards;
  opacity: 0;
}
@keyframes bt-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.bt-fade-in-delay-1 { animation-delay: 50ms; }
.bt-fade-in-delay-2 { animation-delay: 100ms; }
.bt-fade-in-delay-3 { animation-delay: 150ms; }

/* ── EMPTY STATES ──────────────────────────────────────────── */
.bt-empty {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.bt-empty-icon {
  width: 56px; height: 56px;
  margin: 0 auto var(--sp-5);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 24px;
}
.bt-empty h3 {
  font-size: var(--text-md);
  margin-bottom: var(--sp-2);
}
.bt-empty p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 auto var(--sp-5);
  line-height: 1.6;
}
.bt-empty-cta {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-pale);
  border: 1px solid var(--blue-bg);
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
}
.bt-empty-cta:hover { background: var(--blue-bg); }

/* ── TOAST NOTIFICATIONS ───────────────────────────────────── */
.bt-toast {
  position: fixed; top: var(--sp-6); right: var(--sp-6);
  z-index: 1000;
  max-width: 380px;
  padding: var(--sp-4) var(--sp-5);
  background: var(--navy);
  color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  transform: translateY(-20px);
  opacity: 0;
  transition: all var(--duration-slow) var(--ease-spring);
  pointer-events: none;
}
.bt-toast.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.bt-toast.error { background: var(--red); }
.bt-toast.success { background: var(--green); }

/* ── CARD BASE ─────────────────────────────────────────────── */
.bt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}
.bt-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── UTILITY ───────────────────────────────────────────────── */
.bt-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;
}
