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

:root {
  --color-primary: #1565C0;
  --color-primary-dark: #0D47A1;
  --color-primary-light: #E8F1F8;
  --color-primary-lighter: #F8FAFC;
  --color-accent: #2E7D32;
  --color-accent-light: #E8F5E9;
  --color-bg: #ffffff;
  --color-bg-alt: #F8FAFC;
  --color-bg-subtle: #F1F5F9;
  --color-bg-muted: #EEF2F6;
  --color-text: #1E293B;
  --color-text-secondary: #475569;
  --color-text-tertiary: #556270;
  --color-border: #E2E8F0;
  --color-border-light: #F1F5F9;
  --color-error: #DC2626;
  --color-overlay: rgba(15, 23, 42, 0.15);
  --color-header-bg: rgba(238, 242, 246, 0.85);
  --color-header-bg-scrolled: rgba(255, 255, 255, 0.95);
  --color-header-border: rgba(0, 0, 0, 0.06);
  --color-primary-ring: rgba(21, 101, 192, 0.3);
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --max-width: 1200px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-xl: 0 16px 32px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg-alt);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--color-primary); color: white; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }

/* ========== Header ========== */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0.875rem 0;
  background: var(--color-header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-header-border);
  transition: var(--transition);
}

header.scrolled {
  background: var(--color-header-bg-scrolled);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.header-logo.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.header-logo img { height: 32px; width: auto; }
.logo img { height: 34px; width: auto; transition: var(--transition); }
header.scrolled .logo img { height: 34px; }

/* ========== Navigation ========== */
nav { display: flex; align-items: center; gap: 2rem; }

nav a {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
}

nav a:not(.btn):hover { color: var(--color-text); }

nav > a:not(.btn)::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width 0.2s;
}

nav > a:not(.btn):hover::after { width: 100%; }

/* ========== Dropdown ========== */
.nav-dropdown {
  position: relative;
}

.nav-dropdown > a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
}

.nav-dropdown > a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width 0.2s;
}

.nav-dropdown:hover > a::after { width: 100%; }

.nav-dropdown > a svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.nav-dropdown:hover > a svg {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 580px;
  max-width: calc(100vw - 2rem);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 200;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--color-bg);
  filter: drop-shadow(0 -1px 0 var(--color-border));
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu,
.dropdown-menu:hover,
.nav-dropdown.dropdown-open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(4px);
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--color-text-secondary);
  transition: all 0.2s;
}

.dropdown-menu a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.dropdown-menu a::after {
  display: none;
}

.dropdown-icon {
  width: 32px;
  height: 32px;
  background: var(--color-bg-subtle);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.dropdown-menu a:hover .dropdown-icon {
  background: var(--color-primary);
  color: white;
}

.dropdown-icon svg {
  width: 16px;
  height: 16px;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-text-tertiary);
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
}

.btn-full { width: 100%; }

.btn-icon { width: 16px; height: 16px; }

/* ========== CTA Section ========== */
.cta-section {
  padding: 5rem 0;
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
}

.cta-content {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.cta-content h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.cta-content p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.65;
}

/* ========== Footer ========== */
footer {
  padding: 3rem 0;
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-logo img { height: 30px; width: auto; }

.footer-links { display: flex; gap: 2rem; }

.footer-links a {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--color-primary); }

.footer-copy {
  color: var(--color-text-tertiary);
  font-size: 0.85rem;
}

/* ========== Legal Pages ========== */
.page-header {
  padding: 7rem 0 2.5rem;
  background: linear-gradient(180deg, var(--color-bg-muted) 0%, var(--color-bg-alt) 100%);
  text-align: center;
  position: relative;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, black 0%, transparent 80%);
  -webkit-mask-image: linear-gradient(180deg, black 0%, transparent 80%);
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
  position: relative;
}

.page-header p {
  color: var(--color-text-secondary);
  position: relative;
}

.page-header .page-date {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-tertiary);
}

.legal-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  background: var(--color-bg);
}

.legal-content a { color: var(--color-primary); }
.legal-content a:hover { text-decoration: underline; }

.legal-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  color: var(--color-text);
}

.legal-content h2:first-of-type { margin-top: 0; }

.legal-content p {
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.legal-content ul,
.legal-content ol {
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  line-height: 1.8;
}

.legal-content li { margin-bottom: 0.5rem; }

.legal-content .highlight {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.legal-content .highlight p {
  margin-bottom: 0;
  font-weight: 500;
  color: var(--color-text);
}

/* ========== Skip Link ========== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-primary);
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: var(--radius);
  z-index: 200;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0.75rem;
}

/* ========== Focus Indicators ========== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ========== Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========== Mobile Navigation ========== */
.mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 101;
}

.mobile-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  position: relative;
  transition: background 0.15s ease;
}

.mobile-toggle span::before,
.mobile-toggle span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform 0.2s ease;
}

.mobile-toggle span::before { transform: translateY(-6px); }
.mobile-toggle span::after { transform: translateY(6px); }

.mobile-toggle[aria-expanded="true"] span { background: transparent; }
.mobile-toggle[aria-expanded="true"] span::before { transform: rotate(45deg); }
.mobile-toggle[aria-expanded="true"] span::after { transform: rotate(-45deg); }

.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  background: var(--color-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mobile-nav.open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-panel {
  background: var(--color-bg);
  padding: 4.5rem 1.25rem 2rem;
  box-shadow: var(--shadow-lg);
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.mobile-nav-links a:not(.btn) {
  display: block;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-radius: var(--radius);
}

.mobile-nav-links a:not(.btn):active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.mobile-nav-links .mobile-nav-primary {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 600;
}

.mobile-nav-section {
  display: block;
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mobile-nav-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 0.5rem 0;
}

.mobile-nav-links .btn {
  margin-top: 0.5rem;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .container { padding: 0 1.25rem; }
  header { padding: 0.75rem 0; }
  .logo img { height: 32px; }
  nav > a:not(.btn) { display: none; }
  nav .nav-dropdown { display: none; }
  nav .btn { display: none; }
  .mobile-toggle { display: flex; }
  .mobile-nav { display: block; }
  .footer-inner { flex-direction: column; gap: 1.5rem; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; gap: 1.25rem; }
  .footer-links a { padding: 0.5rem; }
  .page-header { padding: 7rem 0 2rem; }
}
