/* ==========================================================================
   CodeMe - Legal Pages CSS
   Design System: Neroxa | Accent: Violet
   ========================================================================== */

:root {
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --max-width: 800px;
}

/* Dark Mode (default) */
:root, [data-theme="dark"] {
  --surface-ground: #050810;
  --surface-base: #0B1120;
  --surface-card: #111B2E;
  --surface-raised: #1A2744;
  --accent-400: #A78BFA;
  --accent-500: #8B5CF6;
  --text-100: #FFFFFF;
  --text-200: #F5F3FF;
  --text-300: #DDD6FE;
  --text-muted: #7C7A9C;
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-default: rgba(255, 255, 255, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Light Mode */
[data-theme="light"] {
  --surface-ground: #F8FAFC;
  --surface-base: #FFFFFF;
  --surface-card: #FFFFFF;
  --surface-raised: #F1F5F9;
  --accent-400: #7C3AED;
  --accent-500: #6D28D9;
  --text-100: #1E293B;
  --text-200: #334155;
  --text-300: #475569;
  --text-muted: #64748B;
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-default: rgba(0, 0, 0, 0.10);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
}

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

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.7;
  color: var(--text-200);
  background: var(--surface-base);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 30% -20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 10% 90%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] body::before { opacity: 0.5; }

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.brand-logo {
  height: 36px;
  width: 36px;
  filter: drop-shadow(0 2px 8px rgba(139, 92, 246, 0.25));
  transition: filter 0.3s ease;
}

[data-theme="light"] .brand-logo {
  filter: brightness(0.2) drop-shadow(0 2px 8px rgba(139, 92, 246, 0.15));
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-400);
  text-decoration: none;
}

.brand-name:hover { color: var(--accent-500); }

.theme-toggle {
  margin-left: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--accent-500);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.theme-toggle:hover svg { color: var(--accent-400); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Main Content */
main.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: var(--space-xl) auto;
  padding: var(--space-xl);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Typography */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-100);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent-400);
  margin: var(--space-lg) 0 var(--space-sm);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-200);
  margin: var(--space-md) 0 var(--space-sm);
}

p { margin-bottom: var(--space-md); }
small { color: var(--text-muted); font-size: 0.875rem; }

section {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-subtle);
}

section:last-of-type { border-bottom: none; }

ul, ol {
  margin: var(--space-sm) 0 var(--space-md) var(--space-lg);
}

li { margin-bottom: var(--space-sm); }

a {
  color: var(--accent-400);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover { color: var(--accent-500); text-decoration: underline; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
}

th, td {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-default);
  text-align: left;
}

th {
  background: var(--surface-raised);
  font-weight: 600;
  color: var(--text-100);
}

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--space-lg);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer a {
  color: var(--text-muted);
  margin: 0 var(--space-sm);
}

.footer a:hover { color: var(--accent-400); }

/* Back Link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-200);
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.back-link:hover {
  border-color: var(--accent-400);
  color: var(--accent-400);
  text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
  main.wrap {
    margin: var(--space-md);
    padding: var(--space-lg);
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.05rem; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
