@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-card: #ffffff;
  
  --ink-primary: #0f172a;
  --ink-secondary: #334155;
  --ink-muted: #64748b;
  --ink-faint: #cbd5e1;
  
  --accent: #059669;
  --accent-hover: #047857;
  --accent-light: #ecfdf5;
  --accent-border: #a7f3d0;
  --accent-glow: rgba(16, 185, 129, 0.18);
  
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  
  --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 16px 36px -4px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 12px 32px -6px var(--accent-glow);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  background-color: var(--bg-page);
  background-image: 
    radial-gradient(circle at 15% 8%, rgba(16, 185, 129, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(59, 130, 246, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 60%);
  background-attachment: fixed;
  color: var(--ink-secondary);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── SCROLL PROGRESS BAR (APPLE-STYLE FINE LINE) ─── */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  width: 0%;
  background: linear-gradient(90deg, #059669 0%, #10b981 60%, #34d399 100%);
  z-index: 1000;
  transition: width 0.12s var(--ease-apple);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  pointer-events: none;
}

/* ─── HEADER & NAV (FROSTED GLASS EFFECT) ─── */
header {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s var(--ease-apple);
}

header.scrolled {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
  border-bottom-color: rgba(226, 232, 240, 0.9);
}

nav {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.3s var(--ease-apple);
}

.nav-logo:hover {
  transform: scale(1.02);
}

.nav-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
  transition: transform 0.4s var(--ease-spring);
}

.nav-logo:hover .nav-logo-mark {
  transform: rotate(-5deg) scale(1.08);
}

.nav-logo span {
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.25s var(--ease-apple);
}

.nav-links a:hover {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.nav-links a.active {
  background: var(--ink-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

/* ─── APPLE-STYLE SLIDING SEGMENTED CONTROL (ES | EN) ─── */
.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: rgba(241, 245, 249, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius-full);
  padding: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.lang-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  width: calc(50% - 3px);
  background: #ffffff;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.32s var(--ease-apple);
  pointer-events: none;
}

body[data-lang="en"] .lang-indicator {
  transform: translateX(100%);
}

.lang-btn {
  position: relative;
  z-index: 2;
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: color 0.25s var(--ease-apple);
  user-select: none;
}

.lang-btn.active {
  color: var(--accent);
}

.lang-btn:hover:not(.active) {
  color: var(--ink-primary);
}

/* Visibility based on language */
body[data-lang="es"] .lang-en { display: none !important; }
body[data-lang="en"] .lang-es { display: none !important; }

/* ─── MAIN CONTAINER ─── */
main {
  flex: 1;
}

/* ─── HERO SECTION ─── */
.hero {
  position: relative;
  padding: 72px 24px 56px;
}

.hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 56px;
  align-items: center;
}

/* Status Pill with breathing animation */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #065f46;
  background: rgba(236, 253, 245, 0.85);
  border: 1px solid #a7f3d0;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.08);
  transition: all 0.3s var(--ease-apple);
}

.status-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 2.2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink-primary);
  margin-bottom: 18px;
}

.gradient-text {
  background: linear-gradient(135deg, #059669 0%, #10b981 60%, #047857 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  background-size: 200% 200%;
  animation: gradient-shift 6s ease infinite;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-intro {
  font-size: 1.05rem;
  color: var(--ink-secondary);
  line-height: 1.7;
  max-width: 620px;
}

/* Hero Meta Card (Apple Frosted Container) */
.hero-meta {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: transform 0.4s var(--ease-apple), box-shadow 0.4s var(--ease-apple);
}

.hero-meta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.hero-meta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 3px;
  background: linear-gradient(90deg, #059669, #10b981);
  border-radius: 3px 3px 0 0;
}

.meta-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-item label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.meta-item span {
  font-size: 0.88rem;
  color: var(--ink-primary);
  font-weight: 600;
  font-family: var(--font-display);
}

.meta-divider {
  height: 1px;
  background: var(--border-light);
}

/* ─── CARDS GRID (PORTAL INDEX) ─── */
.cards {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-decoration: none;
  color: var(--ink-secondary);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  transition: transform 0.4s var(--ease-apple), box-shadow 0.4s var(--ease-apple), border-color 0.3s ease;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(16, 185, 129, 0.4);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  transition: background 0.3s ease;
}

.card:hover .card-badge {
  background: #d1fae5;
}

.card-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink-faint);
  line-height: 1;
  transition: color 0.3s ease;
}

.card:hover .card-num {
  color: var(--accent);
}

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.22rem;
  color: var(--ink-primary);
  line-height: 1.3;
  transition: color 0.25s ease;
}

.card:hover .card-title {
  color: var(--accent);
}

.card-desc {
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.65;
  flex: 1;
}

.card-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  transition: gap 0.25s var(--ease-apple);
}

.card-link span {
  transition: transform 0.3s var(--ease-spring);
}

.card:hover .card-link span {
  transform: translateX(5px);
}

/* ─── TWO-COLUMN CONTENT LAYOUT ─── */
.content-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 24px 96px;
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 48px;
}

/* STICKY TABLE OF CONTENTS (APPLE-LIKE SIDEBAR) */
.toc {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 22px 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
  transition: box-shadow 0.3s ease;
}

.toc:hover {
  box-shadow: var(--shadow-md);
}

.toc-heading {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 14px;
  padding-left: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-list a {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  line-height: 1.4;
  transition: all 0.22s var(--ease-apple);
  position: relative;
}

.toc-list a:hover {
  color: var(--ink-primary);
  background: var(--bg-subtle);
  transform: translateX(3px);
}

.toc-list a.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 700;
  transform: translateX(4px);
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.1);
}

.toc-list a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 3px;
}

/* ─── ARTICLE & SECTIONS ─── */
article {
  min-width: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 52px;
  box-shadow: var(--shadow-sm);
}

.section {
  padding-bottom: 44px;
  margin-bottom: 44px;
  border-bottom: 1px solid var(--border-light);
  scroll-margin-top: 90px;
  transition: opacity 0.5s var(--ease-apple), transform 0.5s var(--ease-apple);
}

.section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  margin-bottom: 18px;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 12px;
}

h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, #059669, #10b981);
  border-radius: 2px;
}

h3 {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-primary);
  margin: 30px 0 12px;
}

p {
  font-size: 0.95rem;
  color: var(--ink-secondary);
  line-height: 1.8;
  margin-bottom: 14px;
}

p:last-child {
  margin-bottom: 0;
}

ul, ol {
  padding-left: 22px;
  margin-bottom: 16px;
  color: var(--ink-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
}

li {
  margin-bottom: 6px;
}

strong {
  color: var(--ink-primary);
  font-weight: 700;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s var(--ease-apple);
}

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

/* ─── CALLOUT BOX ─── */
.callout {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.9) 0%, rgba(240, 253, 244, 0.7) 100%);
  border: 1px solid #a7f3d0;
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 28px 0;
  font-size: 0.92rem;
  color: #064e3b;
  line-height: 1.7;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.06);
  position: relative;
  transition: transform 0.3s var(--ease-apple), box-shadow 0.3s var(--ease-apple);
}

.callout:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.1);
}

.callout strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

/* ─── TABLES ─── */
.legal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 26px 0;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.legal-table th, .legal-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.legal-table th {
  background: var(--bg-subtle);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-primary);
  border-bottom: 1px solid var(--border);
}

.legal-table tr:last-child td {
  border-bottom: none;
}

.legal-table tr:nth-child(even) td {
  background: #fbfbfb;
}

.legal-table tr {
  transition: background 0.2s ease;
}

.legal-table tr:hover td {
  background: #f0fdf4;
}

/* ─── BACK TO TOP FLOATING BUTTON (APPLE MINIMALIST) ─── */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.9);
  transition: all 0.35s var(--ease-apple);
  z-index: 90;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  background: var(--ink-primary);
  color: #ffffff;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ─── SILKY SCROLL REVEAL (APPLE-STYLE INTERSECTION OBSERVER) ─── */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.75s var(--ease-apple), transform 0.75s var(--ease-apple);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ─── FOOTER ─── */
footer {
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 38px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

footer p {
  font-size: 0.83rem;
  color: var(--ink-muted);
  margin: 0;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-links a {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s var(--ease-apple);
}

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

/* ─── RESPONSIVE ─── */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; gap: 36px; }
  .cards { grid-template-columns: 1fr; }
  .content-wrap { grid-template-columns: 1fr; gap: 32px; }
  .toc { position: static; max-height: none; }
  article { padding: 32px 24px; }
}

@media (max-width: 640px) {
  nav { padding: 0 16px; }
  .nav-links { display: none; }
  h1 { font-size: 2.1rem; }
  .hero { padding: 48px 16px 40px; }
  .content-wrap { padding: 24px 16px 64px; }
  .cards { padding: 24px 16px; }
  article { padding: 24px 16px; }
  .back-to-top { bottom: 20px; right: 20px; width: 40px; height: 40px; }
}
