/* ======================================================
   styles.css — Manual “Mongoo”
   Paleta accesible, fondo claro y texto oscuro
====================================================== */

/* ========= 1) Tokens de diseño ========= */
:root {
  --color-primary: #13aa52;        /* verde Mongo */
  --color-primary-light: #16c264;
  --color-bg: #f8fafc;             /* fondo muy claro */
  --color-surface: #ffffff;        /* tarjetas/superficie */
  --color-text: #1e1e1e;           /* texto principal */
  --color-muted: #4b5563;          /* texto secundario */
  --color-border: #d1d5db;         /* bordes suaves */
  --ring: #13aa52;                 /* foco accesible */
  --radius: 12px;
}

/* ========= 2) Reset, base y contenedor ========= */
* { box-sizing: border-box; }
html:focus-within { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* Enlaces y foco */
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:is(a, button, .btn):focus { outline: 3px solid var(--ring); outline-offset: 3px; }

/* Accesibilidad: skip link + helper */
.skip-link {
  position: absolute; left: -999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  left: 1rem; top: 1rem; width: auto; height: auto; padding: .6rem 1rem;
  background:#000; color:#fff; border-radius: .75rem; outline: 3px solid var(--ring);
}
.sr-only { position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ========= 3) Navegación superior ========= */
.main-nav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 20;
}
.nav-inner {
  display:flex; justify-content:space-between; align-items:center; padding:.5rem 1rem;
}
.brand { font-weight:700; color:var(--color-primary); font-size:1.1rem; }
.nav-links { list-style:none; display:flex; gap:1rem; margin:0; padding:0; }
.nav-links a { color:var(--color-text); font-weight:500; transition: color .25s ease; }
.nav-links a:hover { color: var(--color-primary); }
.nav-links a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

/* ========= 4) Cabecera / hero compacto ========= */
header {
  background: linear-gradient(180deg, rgba(19,170,82,.12) 0%, rgba(19,170,82,.04) 100%);
  border-bottom: 1px solid var(--color-border);
}
header .hero {
  display:grid; grid-template-columns: 1fr auto; align-items:center;
  gap: 1rem; padding: 0.75rem 1rem;
}
header .hero.hero--compact { padding: 1rem .75rem; gap: 1rem; }

header .hero-content { display:grid; gap:.4rem; }
header .hero-content .kicker {
  display:inline-block; font-weight:800; letter-spacing:.02em;
  color:var(--color-primary); font-size:clamp(1.05rem, 2.2vw, 1.35rem); line-height:1.1;
}
header .hero-content h1 {
  margin:0; line-height:1.2; font-size:clamp(1.8rem, 3vw, 2.4rem);
}
header .hero-content .subtitle {
  margin:.25rem 0 0; color:var(--color-muted); font-size:1rem; max-width:68ch;
}

/* Imagen a la derecha del hero */
header .hero .hero-illus {
  max-width:130px; height:auto; border-radius:.6rem; justify-self:end;
  transition: transform .25s ease;
}
header .hero .hero-illus:hover { transform: scale(1.04); }

/* Responsive header */
@media (max-width: 768px) {
  header .hero { grid-template-columns: 1fr; text-align:center; }
  header .hero .hero-illus { justify-self:center; margin-top:.5rem; }
}

/* ========= 5) Botones / CTA ========= */
.cta { display:flex; gap:.75rem; flex-wrap:wrap; margin-top:1.25rem; }
.btn {
  appearance:none; border:0; border-radius:.9rem; padding:.8rem 1rem;
  font-weight:600; cursor:pointer; font-size:1rem;
}
.btn-primary { background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light)); color:#fff; }
.btn-outline { background:transparent; color:var(--color-text); border:1px solid var(--color-border); }

/* ========= 6) Tarjetas, secciones y utilidades ========= */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.section-title {
  font-size: 1.3rem; margin: 0 0 .5rem; font-weight:700; color: var(--color-primary);
}
.lead { color: var(--color-muted); }

/* Grids reutilizables */
.grid { display:grid; gap:1rem; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
/* ========= 6bis) Grid adaptable para secciones con código ========= */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1024px) {
  /* En pantallas medianas y pequeñas, apila en una sola columna */
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Asegura que los bloques de código no generen scroll horizontal */
.grid-2 pre {
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* Listas */
ol.indice { margin:0; padding-left:1.2rem; }
ol.indice li, .objetivos li { margin:.35rem 0; }
/* ========= Listas con rombo verde ========= */
/* Mantén la lista como list-item para que ::marker funcione */
ul { padding-left: 1.2rem; }

/* Rombo verde como marcador por defecto en las UL */
ul li::marker {
  content: "◆ ";
  color: var(--color-primary);
  font-size: 0.8em;          /* tamaño del rombo */
  line-height: 1;            /* alinea verticalmente el marcador */
}

/* Opcional: solo dentro de tarjetas */
.card ul li::marker {
  content: "◆ ";
}

/* Opcional: listas anidadas un poco más pequeñas */
ul ul li::marker { font-size: 0.7em; opacity: 0.9; }

/* No tocar OL (listas numeradas), pero puedes acentuar el número si quieres: */
ol li::marker { color: var(--color-primary); font-weight: 700; }

/* ========= 7) Tablas ========= */
.table { width:100%; border-collapse:collapse; text-align:left; }
.table th, .table td { padding:.6rem .5rem; border-top:1px solid var(--color-border); }
.table thead th { background:#f0fdf4; color:#065f46; border-top:none; }
.table caption { caption-side: bottom; color: var(--color-muted); padding-top:.5rem; }


/* ========= Tablas mejoradas (responsive y accesibles) ========= */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
  font-size: 0.95rem;
}

.table th, .table td {
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--color-border);
  vertical-align: top;
}

.table thead th {
  background: #f0fdf4;
  color: #065f46;
  font-weight: 700;
  text-align: left;
  border-top: none;
}

.table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.table tbody tr:hover {
  background: #ecfdf5;
  transition: background 0.2s ease-in-out;
}

.table code, .table kbd {
  background: #0b1020;
  color: #e8e8e8;
  padding: 0.15rem 0.4rem;
  border-radius: 0.4rem;
  font-size: 0.9em;
}

/* ========= Tablas compactas y código que ajusta línea ========= */
.table-compact th, .table-compact td {
  padding: 0.55rem 0.6rem;        /* menos padding */
  font-size: 0.92rem;             /* tipografía más pequeña */
}

.table-compact pre.code-fit {
  margin: 0;
  font-size: 0.9em;               /* aún más compacto dentro de la celda */
  white-space: pre-wrap;          /* permite salto de línea */
  word-break: break-word;         /* corta palabras largas si hace falta */
  overflow-wrap: anywhere;        /* garantiza ajuste en móviles */
}

/* Si quieres apretar aún más en pantallas pequeñas */
@media (max-width: 640px) {
  .table-compact th, .table-compact td { font-size: 0.88rem; }
  .table-compact pre.code-fit { font-size: 0.85em; }
}



/* ========= 8) Bloques de código ========= */
pre {
  background:#0b1020; color:#e8e8e8; border-radius: var(--radius);
  padding:1rem; overflow:auto; box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
code { font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:.95em; }

/* ========= 9) Callouts didácticos ========= */
.callout {
  border:1px solid var(--color-border); border-left-width:6px;
  border-radius: var(--radius); padding:1rem; background: var(--color-surface);
}
.callout.success { border-left-color:#16c264; background:#f0fdf4; }
.callout.info    { border-left-color:#3b82f6; background:#eff6ff; }
.callout.warn    { border-left-color:#f59e0b; background:#fff7ed; }

/* ========= 10) Pie de página ========= */
footer {
  position:relative; background:var(--color-surface);
  border-top:2px solid var(--color-border); margin-top:2rem; text-align:center;
  color:var(--color-muted); font-size:.95rem;
}
footer .footer-img {
  max-width:100%; height:auto; display:block; margin:0 auto .5rem;
  border-radius:.75rem; box-shadow:0 1px 4px rgba(0,0,0,.06);
}
footer .wrap { padding-bottom:.5rem; }

/* ========= 11) Video embebido ========= */
.video-wrapper{
  position:relative; width:100%; aspect-ratio:16/9; background:#000;
  border-radius: var(--radius); overflow:hidden; box-shadow:0 2px 12px rgba(0,0,0,.08);
}
.video-wrapper iframe{ position:absolute; inset:0; width:100%; height:100%; border:0; }

/* ========= 12) Accesibilidad: menos movimiento ========= */
@media (prefers-reduced-motion: reduce) {
  * { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}

/* ========== Fin styles.css ========== */
/* Grid base (déjalo tal cual, o unifícalo) */
.grid { 
  display: grid; 
  gap: 1rem; 
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Forzar 1 columna donde lo necesites */
.grid--one {
  grid-template-columns: 1fr !important;
}

/* (Opcional) limitar solo a la práctica guiada por ID */
#ejercicio-crud-consola .grid {
  grid-template-columns: 1fr;
}

/* Tu grid-2 actual, lo mantienes igual */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
}
/* 🔰 BLOQUE DE INTRODUCCIÓN DE NUEVO TEMA */
.intro-tema {
  background: #e8f4e9;
  color: #121212;
  border-radius: 1.5rem;
  padding: 2rem;
  margin: 2rem 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
}

/* 💡 Pequeña etiqueta “Tema nuevo” */
.intro-tema::before {
  content: "✨ NUEVO TEMA";
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.15);
  color: #141414;
  font-size: 0.75rem;
  letter-spacing: 1px;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* 🏷️ Título del bloque */
.intro-tema h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #0a0a0a;
}

/* 🪄 Subtítulo inspirador */
.intro-tema .lead {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* 🧩 Listas dentro de la introducción */
.intro-tema ul {
  margin-top: 1rem;
  padding-left: 1.5rem;
}

.intro-tema li {
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

.intro-tema code {
  background: rgba(255, 255, 255, 0.15);
  color: #ebe6e6;
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
  font-size: 0.95rem;
}

/* 🎯 Bloques de info dentro de introducción */
.intro-tema .callout.info {
  background: rgba(255, 255, 255, 0.1);
  border-left: 4px solid #fff;
  padding: 1rem;
  border-radius: 1rem;
  margin-top: 1rem;
}

.intro-tema .callout.info strong {
  color: #0c0c0c;
}
