:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #1e1e2e;
  --darker: #181825;
  --light: #cdd6f4;
  --muted: #6c7086;
  --surface: #313244;
  --surface-hover: #45475a;
  --code-bg: #1e1e2e;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--darker);
  color: var(--light);
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  background: var(--dark);
  border-bottom: 1px solid var(--surface);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

nav ul {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
  font-size: 0.9rem;
}

nav a:hover,
nav a.active {
  background: var(--surface);
  color: var(--light);
}

/* Main content */
main {
  padding: 2rem 0 4rem;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 3rem 1rem;
  background: linear-gradient(135deg, var(--dark) 0%, var(--surface) 100%);
  border-radius: 1rem;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.countdown {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  margin-top: 1.5rem;
  font-weight: 600;
}

.countdown .days {
  color: var(--warning);
  font-size: 1.25rem;
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.card {
  background: var(--dark);
  border: 1px solid var(--surface);
  border-radius: 1rem;
  padding: 1.5rem;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.card h3 {
  color: var(--light);
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--muted);
  font-size: 0.9rem;
}

.card-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  margin-top: 1rem;
}

.card-badge.velocista {
  background: var(--secondary);
}

.card-badge.medio {
  background: var(--warning);
}

.card-badge.avanzado {
  background: var(--danger);
}

/* Content sections */
.content {
  background: var(--dark);
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 2rem;
}

.content h1 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--surface);
}

.content h2 {
  color: var(--light);
  margin: 2rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.content h3 {
  color: var(--light);
  margin: 1.5rem 0 0.75rem;
}

.content p {
  margin-bottom: 1rem;
}

.content ul, .content ol {
  margin: 1rem 0 1rem 1.5rem;
}

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

/* Code blocks */
pre {
  background: var(--code-bg);
  border: 1px solid var(--surface);
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  position: relative;
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
}

p code, li code {
  background: var(--surface);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
}

.code-title {
  background: var(--surface);
  color: var(--muted);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem 0.5rem 0 0;
  font-size: 0.8rem;
  margin-bottom: -1rem;
  display: inline-block;
}

/* Book capsule */
.book-capsule {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
  border-left: 4px solid var(--primary);
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
}

.book-capsule-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.book-capsule p {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.book-capsule .page-ref {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* Tips and warnings */
.tip, .warning, .danger, .strategy {
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 1rem;
}

.tip {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.strategy {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.tip-icon, .warning-icon, .danger-icon, .strategy-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* Collapsible solutions */
details {
  background: var(--surface);
  border-radius: 0.5rem;
  margin: 1rem 0;
}

summary {
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

summary:hover {
  background: var(--surface-hover);
  border-radius: 0.5rem;
}

details[open] summary {
  border-bottom: 1px solid var(--dark);
  border-radius: 0.5rem 0.5rem 0 0;
}

details .solution-content {
  padding: 1rem;
}

/* Team roles */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.team-member {
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
}

.team-member.lider {
  border: 2px solid var(--danger);
}

.team-member.especialista {
  border: 2px solid var(--warning);
}

.team-member.velocista {
  border: 2px solid var(--secondary);
}

.team-member h4 {
  margin-bottom: 0.5rem;
}

.team-member .role {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Progress tracker */
.progress-section {
  margin: 1rem 0;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--surface);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.progress-item input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--secondary);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--surface);
}

th {
  background: var(--surface);
  font-weight: 600;
}

tr:hover {
  background: var(--surface);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin: 1.5rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--surface);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 0.25rem;
  width: 0.75rem;
  height: 0.75rem;
  background: var(--primary);
  border-radius: 50%;
}

.timeline-item h4 {
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.timeline-item p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Navigation buttons */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--surface);
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  color: var(--light);
  text-decoration: none;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

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

.nav-btn.next {
  margin-left: auto;
}

/* Footer */
footer {
  background: var(--dark);
  border-top: 1px solid var(--surface);
  padding: 2rem 0;
  text-align: center;
  color: var(--muted);
}

/* ============================================
   RESPONSIVE DESIGN - Mobile First Approach
   ============================================ */

/* Hamburger menu button (hidden by default) */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 110;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--light);
  border-radius: 2px;
  transition: all 0.3s ease;
  margin: 2px 0;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile overlay when menu is open */
.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

.nav-overlay.active {
  display: block;
}

/* ============================================
   SMALL PHONES (< 480px)
   ============================================ */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .container {
    padding: 0 1rem;
  }

  /* Hero adjustments */
  .hero {
    padding: 2rem 1rem;
    border-radius: 0.75rem;
  }

  .hero h1 {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .countdown {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .countdown .days {
    font-size: 1.1rem;
  }

  /* Cards - single column */
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  .card-icon {
    font-size: 1.75rem;
  }

  /* Content sections */
  .content {
    padding: 1.25rem 1rem;
    border-radius: 0.75rem;
  }

  .content h1 {
    font-size: 1.4rem;
  }

  .content h2 {
    font-size: 1.15rem;
    margin: 1.5rem 0 0.75rem;
  }

  .content h3 {
    font-size: 1rem;
  }

  /* Code blocks */
  pre {
    padding: 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    margin: 0.75rem -0.5rem;
  }

  code {
    font-size: 0.8rem;
  }

  p code, li code {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
  }

  /* Tips and warnings */
  .tip, .warning, .danger, .strategy {
    padding: 0.875rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .tip-icon, .warning-icon, .danger-icon, .strategy-icon {
    font-size: 1.25rem;
  }

  /* Team grid - single column */
  .team-grid {
    grid-template-columns: 1fr;
  }

  .team-member {
    padding: 1rem;
  }

  /* Timeline */
  .timeline {
    padding-left: 1.5rem;
  }

  .timeline-item h4 {
    font-size: 0.95rem;
  }

  .timeline-item p {
    font-size: 0.85rem;
  }

  /* Navigation buttons */
  .nav-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .nav-btn {
    justify-content: center;
    padding: 0.875rem 1rem;
  }

  .nav-btn.next {
    margin-left: 0;
  }

  /* Quotes */
  .quote {
    padding: 1.25rem 1rem;
  }

  .quote-text {
    font-size: 1rem;
  }

  .quote-text::before {
    font-size: 2rem;
    top: 0.25rem;
    left: 0.5rem;
  }

  /* Book capsule */
  .book-capsule {
    padding: 0.875rem 1rem;
  }

  /* Progress items - larger touch targets */
  .progress-item {
    padding: 0.875rem;
    min-height: 44px;
  }

  .progress-item label {
    font-size: 0.9rem;
  }

  /* Footer */
  footer {
    padding: 1.5rem 0;
  }

  footer .container {
    flex-direction: column;
    gap: 0.5rem;
  }

  footer p {
    text-align: center;
  }
}

/* ============================================
   TABLETS AND SMALL LAPTOPS (481px - 768px)
   ============================================ */
@media (max-width: 768px) {
  /* Show hamburger menu */
  .menu-toggle {
    display: flex;
  }

  header .container {
    flex-wrap: nowrap;
  }

  /* Mobile navigation */
  header nav {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--dark);
    border-left: 1px solid var(--surface);
    z-index: 100;
    transition: right 0.3s ease;
    padding: 5rem 1.5rem 2rem;
    overflow-y: auto;
  }

  header nav.active {
    right: 0;
  }

  nav ul {
    flex-direction: column;
    gap: 0.25rem;
  }

  nav a {
    display: block;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    min-height: 44px;
  }

  /* Hero */
  .hero {
    padding: 2.5rem 1.5rem;
    margin-bottom: 1.5rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }

  /* Cards */
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Content */
  .content {
    padding: 1.5rem 1.25rem;
  }

  .content h1 {
    font-size: 1.5rem;
  }

  .content h2 {
    font-size: 1.25rem;
  }

  /* Code */
  pre {
    font-size: 0.8rem;
    padding: 1rem;
    margin: 1rem -0.25rem;
  }

  /* Tables - horizontal scroll */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem -0.5rem;
    padding: 0 0.5rem;
  }

  table {
    min-width: 500px;
  }

  th, td {
    padding: 0.625rem 0.75rem;
    font-size: 0.9rem;
  }

  /* Team grid */
  .team-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* Timeline */
  .timeline {
    padding-left: 1.75rem;
  }

  /* Tips */
  .tip, .warning, .danger, .strategy {
    padding: 1rem 1.25rem;
  }

  /* Navigation buttons */
  .nav-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .nav-btn {
    justify-content: center;
  }

  .nav-btn.next {
    margin-left: 0;
  }

  /* Details/Solutions */
  summary {
    padding: 0.875rem;
    min-height: 44px;
  }
}

/* ============================================
   MEDIUM SCREENS (769px - 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .team-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .content {
    padding: 1.75rem 1.5rem;
  }
}

/* ============================================
   LARGE SCREENS (> 1024px)
   ============================================ */
@media (min-width: 1025px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  .team-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   TOUCH DEVICE ENHANCEMENTS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch */
  .card:hover {
    transform: none;
  }

  /* Larger touch targets */
  nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-btn {
    min-height: 48px;
  }

  .progress-item {
    min-height: 48px;
  }

  summary {
    min-height: 48px;
  }

  /* Active states instead of hover */
  .card:active {
    border-color: var(--primary);
    transform: scale(0.98);
  }

  nav a:active {
    background: var(--surface);
  }

  .nav-btn:active {
    background: var(--primary);
  }
}

/* ============================================
   LANDSCAPE PHONES
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
  header nav {
    padding-top: 3.5rem;
  }

  nav ul {
    gap: 0;
  }

  nav a {
    padding: 0.625rem 1rem;
  }

  .hero {
    padding: 1.5rem 1rem;
  }

  .hero h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  header, footer, .nav-buttons, .menu-toggle {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .content {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  pre {
    border: 1px solid #ddd;
    background: #f5f5f5;
  }

  a {
    color: inherit;
    text-decoration: underline;
  }
}

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

  header nav {
    transition: none;
  }

  .menu-toggle span {
    transition: none;
  }
}

/* Quotes / Citas */
.quote {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-left: 4px solid var(--primary);
  border-radius: 0 0.75rem 0.75rem 0;
  padding: 1.5rem;
  margin: 1.5rem 0;
  position: relative;
}

.quote-text {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--light);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.quote-text::before {
  content: '"';
  font-size: 3rem;
  color: var(--primary);
  opacity: 0.3;
  position: absolute;
  top: 0.5rem;
  left: 0.75rem;
}

.quote-author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quote-author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.quote-author-info {
  display: flex;
  flex-direction: column;
}

.quote-author-name {
  font-weight: 600;
  color: var(--light);
}

.quote-author-role {
  font-size: 0.85rem;
  color: var(--muted);
}

/* AI Section */
.ai-card {
  background: linear-gradient(135deg, var(--dark) 0%, var(--surface) 100%);
  border: 1px solid var(--surface);
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 1rem 0;
}

.ai-card h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--light);
}

.ai-do {
  border-left: 3px solid var(--secondary);
}

.ai-dont {
  border-left: 3px solid var(--danger);
}

.ai-example {
  background: var(--code-bg);
  border: 1px solid var(--surface);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
}

.ai-example-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Syntax highlighting - básico */
.keyword { color: #c678dd; }
.string { color: #98c379; }
.number { color: #d19a66; }
.function { color: #61afef; }
.comment { color: #5c6370; font-style: italic; }
.builtin { color: #e5c07b; }
