@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

/* Convertido a tema oscuro para alinear con el resto del sitio (index.html y
   /docs/*.html). Excepción deliberada: figure/.gallery/.catalog-card (las
   capturas de pantalla del sistema) mantienen un fondo claro — son imágenes
   de una interfaz clara, así que se muestran en un "marco" claro sobre la
   página oscura en vez de recortarse/verse mal sobre fondo oscuro. Por eso
   existe --brand-on-light: variante de --brand pensada para texto legible
   dentro de esos marcos claros, separada de --brand-dark (pensada para texto
   sobre el fondo oscuro del resto de la página). */
:root {
  --bg: #0a0e17;
  --surface: #111827;
  --ink: #e2e8f0;
  --muted: #64748b;
  --line: #1e2d45;
  --brand: #00d4ff;
  --brand-dark: #33dceb;
  --brand-on-light: #08758b;
  --orange: #de2e03;
  --navy: #0a2430;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "DM Sans", Arial, sans-serif; line-height: 1.6; }

/* ── TOPBAR ────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; background: rgba(10,14,23,.85); backdrop-filter: blur(12px); display: flex; align-items: center; gap: 18px; padding: 0 28px; color: #fff; border-bottom: 1px solid var(--line); }
.brand { color: var(--brand); font: 700 1.15rem "Space Mono", monospace; text-decoration: none; letter-spacing: .04em; }
.brand span { color: var(--orange); }
/* Mismo estilo del logo (Ruta/CC) para menciones de RutaCC dentro de texto
   corrido, pero heredando el tamaño de fuente del párrafo que lo contiene
   (mismo patrón que .rutacc-brand en css/index.css). */
.rutacc-brand { font-family: "Space Mono", monospace; font-size: inherit; font-weight: 700; letter-spacing: .04em; color: var(--brand); }
.rutacc-brand span { color: var(--orange); }
.brand-caption { font-size: .88rem; color: #c1d3d9; border-left: 1px solid #ffffff33; padding-left: 18px; }
.search { margin-left: auto; width: min(360px,30vw); background: #ffffff14; border: 1px solid #ffffff35; border-radius: 4px; padding: 7px 12px; display: flex; gap: 8px; align-items: center; }
.search input { border: 0; outline: 0; background: transparent; color: #fff; width: 100%; font: inherit; }
.search input::placeholder { color: #bbccd2; }
.system-link { color: #fff; text-decoration: none; font-size: .82rem; border: 1px solid #ffffff55; padding: 7px 12px; border-radius: 3px; }
.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.3rem; }

/* ── SIDEBAR ───────────────────────────────────────────── */
/* Sin max-width/margin:auto acá a propósito: antes centraba todo el bloque
   sidebar+contenido en la página, así que en pantallas anchas el sidebar
   quedaba flotando lejos del borde izquierdo real en vez de pegado a él
   (el reporte de "el menú lateral quedó muy al centro"). Al sacar el límite,
   el sidebar (flex item, sticky) queda pegado al borde izquierdo real del
   viewport, y el contenido llena el resto del ancho hasta su propio
   max-width — mismo patrón que usan la mayoría de los sitios de
   documentación (MDN, Stripe Docs, etc.). */
.layout { display: flex; }
.sidebar { width: 270px; flex: none; position: sticky; top: 64px; height: calc(100vh - 64px); overflow: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 27px 20px; }
.side-title { font: 700 .72rem "Space Mono", monospace; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 12px; }
.sidebar nav { display: flex; flex-direction: column; }
.sidebar nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-left: 2px solid transparent; font-size: .9rem; }
.sidebar nav a:hover { background: rgba(0,212,255,.08); border-left-color: var(--brand); color: var(--brand-dark); }
.side-footer { border-top: 1px solid var(--line); margin-top: 28px; padding: 18px 10px; font: 700 .7rem "Space Mono", monospace; color: var(--brand-dark); }
/* Clase propia (no ".side-footer span" genérico) para no chocar con el
   "CC" en naranja del logo, que también es un <span> dentro de .side-footer. */
.side-footer .meta { font-weight: 400; color: var(--muted); }

/* ── CONTENT ───────────────────────────────────────────── */
.content { flex: 1; min-width: 0; max-width: 1050px; padding: 34px 58px 70px; }
.breadcrumbs { font-size: .82rem; color: var(--muted); display: flex; gap: 10px; margin-bottom: 35px; }
.breadcrumbs a { color: var(--brand-dark); }
.hero { padding: 42px 0 36px; border-bottom: 1px solid var(--line); }
.eyebrow, .section-kicker { font: 700 .7rem "Space Mono", monospace; letter-spacing: .14em; color: var(--brand-dark); text-transform: uppercase; }
.hero h1 { font-size: 3.25rem; line-height: 1.12; margin: 13px 0; color: var(--ink); letter-spacing: -.04em; }
.hero h1 strong { color: var(--brand); }
.lead { font-size: 1.25rem; max-width: 680px; color: var(--muted); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
.hero-meta span { border: 1px solid var(--line); background: var(--surface); padding: 5px 11px; border-radius: 3px; color: var(--muted); font-size: .78rem; }
.doc-section { padding: 50px 0 20px; scroll-margin-top: 80px; }
.doc-section h2 { font-size: 2rem; color: var(--ink); margin: 6px 0 14px; letter-spacing: -.02em; }
.doc-section h3 { color: var(--brand-dark); margin: 22px 0 5px; }
.doc-section p { max-width: 820px; }
.steps, .checklist { padding-left: 27px; }
.steps li, .checklist li { padding: 5px 0; }
.checklist { list-style: "✓  "; }

/* ── CARDS (sobre el fondo oscuro) ─────────────────────── */
.module-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 22px 0; }
.module-grid div, .resource-card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 16px; box-shadow: var(--shadow); }
.module-grid b { display: block; color: var(--brand-dark); margin-bottom: 4px; }
.module-grid span { font-size: .88rem; color: var(--muted); }
.resource-card { margin: 18px 0; }
.resource-card p { margin-top: 0; }

.notice { border-left: 4px solid var(--brand); background: rgba(0,212,255,.06); padding: 14px 18px; margin: 22px 0; max-width: 850px; }
.notice p { margin: 3px 0; }
.notice.warning { border-color: #d99100; background: rgba(255,215,0,.06); }
.notice.danger { border-color: var(--orange); background: rgba(222,46,3,.08); }
.notice.info { margin-top: 28px; }

/* ── CAPTURAS DE PANTALLA (marco claro a propósito, ver nota arriba) ───── */
figure { margin: 25px 0; background: #fff; border: 1px solid var(--line); padding: 10px; box-shadow: var(--shadow); }
figure img { display: block; max-width: 100%; height: auto; margin: auto; }
figcaption { text-align: center; color: #566573; font-size: .78rem; padding: 9px 4px 2px; }
.gallery { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px; }
.gallery figure { margin: 0; }
.gallery figure img { max-height: 460px; object-fit: contain; }
.catalog { display: grid; grid-template-columns: repeat(3,1fr); gap: 15px; }
.catalog-card { background: #fff; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; box-shadow: var(--shadow); }
.catalog-card img { display: block; width: 100%; height: 155px; object-fit: contain; background: #eef3f5; }
.catalog-card div { padding: 10px 12px; }
.catalog-card small, .catalog-card b { display: block; }
.catalog-card small { color: var(--brand-on-light); font: 700 .65rem "Space Mono", monospace; text-transform: uppercase; }
.catalog-card b { font-size: .88rem; color: #17202a; }
.doc-section figure img, .catalog-card img { cursor: zoom-in; }
.doc-section figure img:focus, .catalog-card img:focus { outline: 3px solid var(--brand); outline-offset: 3px; }

/* ── LIGHTBOX ──────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(4,13,18,.92); display: flex; align-items: center; justify-content: center; padding: 48px 80px; }
.lightbox[hidden] { display: none; }
.lightbox-content { width: min(1200px,92vw); height: calc(100vh - 96px); margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: transparent; border: 0; box-shadow: none; padding: 0; }
.lightbox-content img { max-width: 100%; max-height: calc(100% - 35px); object-fit: contain; cursor: default; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.lightbox-content figcaption { color: #dcebef; font-size: .85rem; padding: 12px 0 0; }
.lightbox-close, .lightbox-nav { position: absolute; border: 1px solid rgba(255,255,255,.45); background: rgba(10,36,48,.8); color: #fff; cursor: pointer; border-radius: 4px; transition: background .2s, color .2s; }
.lightbox-close:hover, .lightbox-nav:hover { background: var(--brand); color: var(--navy); }
.lightbox-close { top: 18px; right: 24px; width: 42px; height: 42px; font-size: 2rem; line-height: 1; }
.lightbox-nav { top: 50%; transform: translateY(-50%); width: 45px; height: 58px; font-size: 3rem; line-height: 1; }
.lightbox-prev { left: 22px; }
.lightbox-next { right: 22px; }
.lightbox-open { overflow: hidden; }

/* ── FOOTER ────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--line); margin-top: 55px; padding-top: 25px; display: flex; justify-content: space-between; gap: 15px; align-items: center; color: var(--muted); font-size: .8rem; }
.footer a { color: var(--brand-dark); }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .sidebar { width: 230px; }
  .content { padding: 30px; }
  .module-grid { grid-template-columns: repeat(2,1fr); }
  .catalog { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 680px) {
  .topbar { padding: 0 15px; gap: 11px; }
  .menu-toggle { display: block; }
  .brand-caption, .system-link { display: none; }
  .search { width: auto; flex: 1; }
  .sidebar { position: fixed; z-index: 15; left: -270px; transition: left .2s; box-shadow: 4px 0 18px #0002; }
  .sidebar.open { left: 0; }
  .content { padding: 22px 18px; }
  .hero h1 { font-size: 2.35rem; }
  .module-grid, .gallery, .catalog { grid-template-columns: 1fr; }
  .footer { flex-direction: column; align-items: flex-start; }
  .lightbox { padding: 55px 12px 25px; }
  .lightbox-content { width: 100%; height: calc(100vh - 80px); }
  .lightbox-nav { width: 36px; height: 48px; font-size: 2.3rem; }
  .lightbox-prev { left: 7px; }
  .lightbox-next { right: 7px; }
  .lightbox-close { right: 12px; }
}
