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

:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-900: #1e3a5f;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.08);
  --transition: 0.2s ease;

  /* Financial semantic tokens */
  --color-positive:     #059669;
  --color-positive-bg:  #d1fae5;
  --color-negative:     #dc2626;
  --color-negative-bg:  #fee2e2;
  --color-warning:      #d97706;
  --color-warning-bg:   #fef3c7;

  /* UI icon palette */
  --color-purple:       #7c3aed;
  --color-purple-bg:    #ede9fe;
  --color-orange:       #ea580c;
  --color-orange-bg:    #ffedd5;
  --color-rose:         #e11d48;
  --color-rose-bg:      #ffe4e6;
  --color-teal:         #0d9488;
  --color-teal-bg:      #ccfbf1;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  color: var(--gray-800);
  background: #fff;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Typography ===== */
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; color: var(--gray-900); }
h1 { font-size: clamp(2.5rem, 5vw, 4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.75rem); letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }
p { color: var(--gray-600); }

a { color: var(--blue-600); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--blue-700); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ===== Navbar ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--gray-100);
  transition: box-shadow var(--transition);
}
.navbar.scrolled { box-shadow: var(--shadow-md); }
.navbar .container {
  display: flex; align-items: center;
  height: 64px; gap: 24px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.2rem; color: var(--gray-900);
  flex-shrink: 0;
}
.nav-logo svg { width: 32px; height: 32px; }
.nav-links { display: flex; align-items: center; justify-content: center; gap: 4px; list-style: none; flex: 1; min-width: 0; }
.nav-links a {
  font-size: 0.875rem; font-weight: 500; color: var(--gray-600);
  white-space: nowrap; padding: 6px 14px; border-radius: 999px;
  transition: all var(--transition);
}
.nav-links a:hover { color: var(--gray-900); background: var(--gray-100); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 999px;
  background: var(--blue-600); color: #fff !important;
  font-size: 0.813rem; font-weight: 600;
  transition: all var(--transition); white-space: nowrap;
}
.nav-cta:hover { background: var(--blue-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.nav-cta svg { width: 16px; height: 16px; }

/* Language Switcher */
.lang-select {
  padding: 5px 26px 5px 10px;
  border: 1px solid var(--gray-200); border-radius: 999px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 7px center;
  color: var(--gray-700); font-weight: 600; font-size: 0.8rem;
  font-family: inherit; cursor: pointer; outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--transition); flex-shrink: 0;
}
.lang-select:hover { border-color: var(--gray-300); }
.lang-select:focus-visible { border-color: var(--blue-500); }
.mobile-lang-switcher {
  display: flex; justify-content: center;
  padding: 12px 0 4px;
}

.mobile-menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  padding: 8px; border-radius: 8px; color: var(--gray-600);
}
.mobile-menu-btn:hover { background: var(--gray-100); }
.nav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* ===== Mobile Menu ===== */
.mobile-nav {
  display: none;
  position: fixed; top: 64px; left: 0; right: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--gray-100);
  padding: 16px 24px;
  z-index: 99;
}
.mobile-nav.open { display: block; }
.mobile-nav a {
  display: block; padding: 12px 0;
  font-size: 1rem; font-weight: 500; color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}
.mobile-nav a:last-child { border-bottom: none; }

/* ===== Footer ===== */
.footer {
  padding: 60px 0 40px;
  border-top: 1px solid var(--gray-100);
}
.footer-top {
  display: flex; justify-content: space-between; gap: 48px;
  margin-bottom: 48px;
}
.footer-brand p { color: var(--gray-500); font-size: 0.875rem; margin-top: 12px; max-width: 280px; }
.footer-cols { display: flex; gap: 64px; }
.footer-col h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gray-400); margin-bottom: 16px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { font-size: 0.9rem; color: var(--gray-600); }
.footer-col a:hover { color: var(--gray-900); }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--gray-100);
  font-size: 0.8rem; color: var(--gray-400);
}
.footer-legal-links { display: flex; gap: 24px; }
.footer-legal-links a { color: var(--gray-400); }
.footer-legal-links a:hover { color: var(--gray-600); }

/* ===== Animations ===== */
.fade-up {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* ===== Accessibility: Keyboard Focus ===== */
/* Single global rule — covers all interactive elements (links, buttons, inputs, selects). */
/* outline follows border-radius in all modern browsers. */
:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ===== Responsive base ===== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-right .nav-cta { display: none; }
  .mobile-menu-btn { display: block; }
  .footer-top { flex-direction: column; }
  .footer-cols { flex-direction: column; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}

/* ===== Dark Mode ===== */
@media (prefers-color-scheme: dark) {
  :root {
    /* Financial semantic tokens — dark (aligned with App/Shared/HBFinancialColors.swift) */
    --color-positive:     #81c994;
    --color-positive-bg:  #0a2218;
    --color-negative:     #f28a82;
    --color-negative-bg:  #2a0c0c;
    --color-warning:      #fdd560;
    --color-warning-bg:   #2a2008;

    /* UI icon palette — dark */
    --color-purple:       #c4b5fd;
    --color-purple-bg:    #1e1433;
    --color-orange:       #fb923c;
    --color-orange-bg:    #2a1a0a;
    --color-rose:         #fda4af;
    --color-rose-bg:      #2a0c13;
    --color-teal:         #5eead4;
    --color-teal-bg:      #0a2820;
  }

  body       { background: #0a0a0b; color: #e8ebee; }
  h1, h2, h3, h4 { color: #e8ebee; }
  p          { color: #9aa0a6; }
  a          { color: #8ab4f8; }
  a:hover    { color: #aecbfa; }

  /* Navbar */
  .navbar                 { background: rgba(10,10,11,0.85); border-bottom-color: #242628; }
  .nav-logo               { color: #e8ebee; }
  .nav-links a            { color: #9aa0a6; }
  .nav-links a:hover      { color: #e8ebee; background: #222426; }

  /* Language select */
  .lang-select            { background-color: #191b1d; border-color: #3c3c3c; color: #bdc1c6; }
  .lang-select:hover      { border-color: #4a4a4a; }

  /* Mobile */
  .mobile-menu-btn        { color: #9aa0a6; }
  .mobile-menu-btn:hover  { background: #222426; }
  .mobile-nav             { background: rgba(10,10,11,0.98); border-bottom-color: #242628; }
  .mobile-nav a           { color: #bdc1c6; border-bottom-color: #242628; }

  /* Footer */
  .footer                      { border-top-color: #242628; }
  .footer-brand p              { color: #6f7882; }
  .footer-col h4               { color: #5f6368; }
  .footer-col a                { color: #9aa0a6; }
  .footer-col a:hover          { color: #e8ebee; }
  .footer-bottom               { color: #5f6368; }
  .footer-legal-links a        { color: #5f6368; }
  .footer-legal-links a:hover  { color: #9aa0a6; }
}
