/* 1. VARIABLES & THEME */
:root {
  /* Spacing */
  --header-height: 70px;
  --content-width: 800px;
  --sidebar-width: 250px;

  /* Colors - Light Mode (Default) */
  --bg-body: #ffffff;
  --bg-surface: #f9f9f9;
  --text-primary: #111111;
  --text-secondary: #666666;
  --border-color: #eaeaea;
  --accent-color: #000000;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Colors - Dark Mode */
    --bg-body: #0a0a0a;
    --bg-surface: #111111;
    --text-primary: #ededed;
    --text-secondary: #888888;
    --border-color: #2a2a2a;
    --accent-color: #ffffff;
  }
}

/* 2. RESET & BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(
    var(--header-height) + 40px
  ); /* Para deep linking correcto */
}

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}
a:hover {
  opacity: 0.7;
}

/* 3. LAYOUT COMPONENTS */
.wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(
    var(--bg-body),
    0.8
  ); /* Hack para opacidad en CSS puro si se usara RGB */
  background-color: var(--bg-body); /* Fallback */
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Main Grid */
.legal-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 60px;
  padding-top: calc(var(--header-height) + 60px);
  padding-bottom: 100px;
}

/* Sidebar Navigation */
.sidebar {
  position: sticky;
  top: calc(var(--header-height) + 40px);
  height: fit-content;
}

.sidebar-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-weight: 600;
}

.nav-link {
  display: block;
  padding: 10px 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  border-left: 2px solid transparent;
  padding-left: 16px;
}

.nav-link.active {
  color: var(--text-primary);
  border-left-color: var(--text-primary);
  font-weight: 500;
}

/* Content Area */
.legal-content {
  max-width: var(--content-width);
}

.legal-section {
  margin-bottom: 80px;
  /* Scroll margin para que el header no tape el titulo al navegar */
  scroll-margin-top: calc(var(--header-height) + 20px);
}

/* Typography */
h1 {
  font-size: 2.8rem;
  letter-spacing: -1.5px;
  margin-bottom: 10px;
  line-height: 1.1;
}
.last-updated {
  display: block;
  margin-bottom: 50px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

h2 {
  font-size: 1.6rem;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

h3 {
  font-size: 1.1rem;
  margin: 32px 0 16px;
  font-weight: 600;
}

p,
li {
  text-align: justify;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

strong {
  color: var(--text-primary);
}
ul {
  padding-left: 24px;
  margin-bottom: 24px;
}

/* Footer Disclaimer */
.legal-footer {
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.legal-footer p {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Mobile Responsive */
@media (max-width: 850px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .sidebar {
    display: none;
  } /* Ocultar sidebar en móvil */
  h1 {
    font-size: 2.2rem;
  }
}
