/* =========================================================================
   Travia — Sitio de la primera entrega
   Sistema visual heredado del mock de Recursos/style.css: misma paleta, misma
   tipografia y los mismos espaciados, para que la documentacion y el producto
   se lean como la misma cosa.
   ====================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sora:wght@400;500;600;700;800&display=swap');

:root {
  --navy: #0E3A5C;
  --blue: #1E6FA8;
  --sky: #4FA8D8;
  --celeste: #EAF6FB;
  --coral: #FF7A50;
  --coral-dark: #E8632F;
  --success: #2BB673;
  --warning: #F4B740;
  --danger: #E05252;
  --ink: #1A2733;
  --muted: #5C7080;
  --border: #DCE7EF;
  --bg: #F4F8FA;
  --white: #FFFFFF;

  --display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --body: 'Inter', 'Segoe UI', system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-full: 999px;

  --sh-sm: 0 2px 8px rgba(14, 58, 92, .05);
  --sh-md: 0 8px 24px rgba(14, 58, 92, .07);
  --sh-lg: 0 16px 48px rgba(14, 58, 92, .12);

  --barra-h: 60px;
  --lateral-w: 264px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--barra-h) + 16px); }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- marca */
.isotipo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--r-full); flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), var(--sky));
  color: #fff;
}
.isotipo svg { width: 18px; height: 18px; }

/* --------------------------------------------------------- barra superior */
.barra {
  position: sticky; top: 0; z-index: 60;
  height: var(--barra-h);
  background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  box-shadow: 0 2px 14px rgba(14, 58, 92, .28);
}
.barra__marca {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  font-family: var(--display); font-weight: 800; font-size: 1.05rem;
  letter-spacing: -.3px; color: #fff;
}
.barra__marca:hover { text-decoration: none; opacity: .9; }
/* El subtitulo es una sola linea o no es nada: partido en tres se sale de una
   barra de altura fija, y truncado sigue diciendo de que documento se trata. */
.barra__marca small {
  display: block; font-family: var(--body); font-weight: 500;
  font-size: .68rem; letter-spacing: .8px; text-transform: uppercase;
  opacity: .62; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barra__ubicacion {
  margin-left: auto; padding-left: 16px;
  font-size: .78rem; font-weight: 600; letter-spacing: .3px;
  color: rgba(255,255,255,.72); white-space: nowrap;
}

.barra__menu {
  display: none; background: transparent; color: #fff; cursor: pointer;
  border: 1.5px solid rgba(255,255,255,.35); border-radius: var(--r-sm);
  width: 36px; height: 36px; align-items: center; justify-content: center;
}

/* ------------------------------------------------------------ disposicion */
.disposicion {
  display: grid;
  grid-template-columns: var(--lateral-w) minmax(0, 1fr);
  align-items: start;
  max-width: 1400px; margin-inline: auto;
}
.disposicion--ancha { grid-template-columns: minmax(0, 1fr); }

.lateral {
  position: sticky; top: var(--barra-h);
  height: calc(100vh - var(--barra-h));
  overflow-y: auto;
  padding: 26px 14px 40px 22px;
  border-right: 1px solid var(--border);
  background: var(--white);
}
.lateral__titulo {
  font-size: .68rem; font-weight: 700; letter-spacing: 1.3px;
  text-transform: uppercase; color: var(--muted);
  margin: 0 0 10px 10px;
}
.lateral__grupo + .lateral__titulo { margin-top: 24px; }
.lateral a {
  display: block; padding: 6px 10px; border-radius: var(--r-sm);
  font-size: .84rem; color: var(--muted); line-height: 1.4;
  border-left: 2px solid transparent;
}
.lateral a:hover { background: var(--celeste); color: var(--navy); text-decoration: none; }
.lateral a.es-actual { color: var(--blue); font-weight: 600; border-left-color: var(--blue); background: var(--celeste); }
.lateral a.n3 { padding-left: 22px; font-size: .8rem; }

.principal { width: min(940px, 100%); margin-inline: auto; padding: 34px 34px 90px; min-width: 0; }
.principal--ancha { width: min(1240px, 100%); }

/* ------------------------------------------------------------- cabeceras */
.cabecera {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff; border-radius: var(--r-lg);
  padding: 34px 36px; margin-bottom: 30px; box-shadow: var(--sh-md);
}
.cabecera .eyebrow {
  font-size: .7rem; font-weight: 700; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--sky); margin-bottom: 8px;
}
.cabecera h1 {
  font-family: var(--display); font-size: 2.1rem; font-weight: 800;
  line-height: 1.12; letter-spacing: -.8px; margin-bottom: 10px;
}
.cabecera p { font-size: 1rem; opacity: .9; max-width: 68ch; }

/* portada del indice */
.portada {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 62%, var(--sky) 130%);
  color: #fff; border-radius: var(--r-lg);
  padding: 52px 46px; margin-bottom: 28px; box-shadow: var(--sh-lg);
  position: relative; overflow: hidden;
}
.portada::after {
  content: ''; position: absolute; right: -90px; top: -90px;
  width: 320px; height: 320px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.portada > * { position: relative; }
/* Logo de la Escuela Da Vinci, tomado de la plantilla PL04 de la catedra y
   convertido a blanco con transparencia para apoyarlo sobre el degrade. */
.portada__logo { display: block; height: 56px; width: auto; margin-bottom: 22px; }
.portada .eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: 1.8px;
  text-transform: uppercase; color: var(--sky); margin-bottom: 12px;
}
.portada h1 {
  font-family: var(--display); font-size: 3.4rem; font-weight: 800;
  line-height: 1.02; letter-spacing: -2px; margin-bottom: 12px;
}
.portada .bajada { font-size: 1.12rem; opacity: .92; max-width: 62ch; margin-bottom: 30px; }
.portada dl {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px; border-top: 1px solid rgba(255,255,255,.22); padding-top: 26px;
}
.portada dt {
  font-size: .66rem; font-weight: 700; letter-spacing: 1.1px;
  text-transform: uppercase; opacity: .62; margin-bottom: 3px;
}
.portada dd { font-size: .94rem; font-weight: 600; }

/* ------------------------------------------------------------------ kpis */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 14px; margin-bottom: 32px;
}
.kpi {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px 18px 16px; box-shadow: var(--sh-sm);
}
.kpi__valor {
  font-family: var(--display); font-size: 1.85rem; font-weight: 800;
  color: var(--navy); line-height: 1; letter-spacing: -1px;
}
.kpi__etiqueta {
  font-size: .72rem; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase; color: var(--muted); margin-top: 7px;
}

/* --------------------------------------------------------------- tarjetas */
.rejilla {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px; margin: 26px 0 34px;
}
.tarjeta {
  display: block; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 20px; box-shadow: var(--sh-sm);
  transition: .2s ease; color: inherit; height: 100%;
}
a.tarjeta:hover {
  text-decoration: none; transform: translateY(-3px);
  box-shadow: var(--sh-md); border-color: var(--sky);
}
.tarjeta__num {
  font-family: var(--display); font-size: .78rem; font-weight: 800;
  color: var(--white); background: var(--blue);
  width: 26px; height: 26px; border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.tarjeta h3 {
  font-family: var(--display); font-size: 1.02rem; font-weight: 700;
  color: var(--navy); margin-bottom: 6px; line-height: 1.3;
}
.tarjeta p { font-size: .85rem; color: var(--muted); line-height: 1.55; }

/* --------------------------------------------------------------- bloques */
.bloque {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 22px 24px; margin: 24px 0;
  box-shadow: var(--sh-sm);
}
.bloque h3 {
  font-family: var(--display); font-size: 1.05rem; font-weight: 700;
  color: var(--navy); margin-bottom: 10px;
}

.aviso {
  border-left: 4px solid var(--sky); background: var(--celeste);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 16px 20px; margin: 22px 0; font-size: .93rem; color: var(--navy);
}
.aviso strong { color: var(--navy); }
.aviso--coral { border-left-color: var(--coral); background: #FFF3EE; }

/* ------------------------------------------------------------ etiquetas */
.tag {
  display: inline-block; font-size: .7rem; font-weight: 700;
  letter-spacing: .4px; padding: 3px 9px; border-radius: var(--r-full);
  white-space: nowrap;
}
.tag--ok { background: #DEF5EA; color: #1B7A4C; }
.tag--curso { background: #FFF0D6; color: #8A6100; }
.tag--pend { background: #EDF2F6; color: var(--muted); }
.tag--web { background: var(--celeste); color: var(--blue); }
.tag--ambas { background: #E6F7EF; color: #1B7A4C; }
.tag--alta { background: #FDE7E7; color: #A62F2F; }

/* --------------------------------------------------- contenido Markdown */
.md { font-size: .96rem; }
.md > *:first-child { margin-top: 0; }
.md h3 {
  font-family: var(--display); font-size: 1.5rem; font-weight: 700;
  color: var(--navy); letter-spacing: -.5px;
  margin: 42px 0 14px; padding-bottom: 9px; border-bottom: 2px solid var(--border);
  scroll-margin-top: calc(var(--barra-h) + 16px);
}
.md h4 {
  font-family: var(--display); font-size: 1.14rem; font-weight: 700;
  color: var(--navy); margin: 30px 0 10px;
  scroll-margin-top: calc(var(--barra-h) + 16px);
}
.md h5 {
  font-family: var(--display); font-size: 1rem; font-weight: 600;
  color: var(--blue); margin: 22px 0 8px;
  scroll-margin-top: calc(var(--barra-h) + 16px);
}
.md p { margin: 12px 0; }
.md ul, .md ol { margin: 12px 0 12px 24px; }
.md li { margin: 5px 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.md strong { color: var(--navy); font-weight: 700; }
.md code {
  font-family: 'Cascadia Code', Consolas, ui-monospace, monospace;
  font-size: .86em; background: var(--celeste); color: var(--navy);
  padding: 2px 6px; border-radius: var(--r-sm);
  overflow-wrap: anywhere;
}
.md .color { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.md .color-muestra {
  display: inline-block; width: 1.15em; height: 1.15em; flex: none;
  border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(14, 58, 92, .25);
}
.md pre.code {
  background: var(--navy); color: #DCE7EF; border-radius: var(--r-md);
  padding: 18px 20px; overflow-x: auto; margin: 18px 0; font-size: .84rem;
  line-height: 1.55;
}
.md pre.code code { background: none; color: inherit; padding: 0; }
.md blockquote {
  border-left: 4px solid var(--sky); background: var(--celeste);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 4px 20px; margin: 20px 0; color: var(--navy);
}
.md blockquote p { margin: 12px 0; }

/* ---------------------------------------------------------------- tablas */
.tbl-wrap {
  overflow-x: auto; margin: 20px 0; border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--white); box-shadow: var(--sh-sm);
}
table { border-collapse: collapse; width: 100%; font-size: .87rem; }
thead th {
  background: var(--celeste); color: var(--navy); font-weight: 700;
  text-align: left; padding: 11px 14px; white-space: nowrap;
  border-bottom: 2px solid var(--border);
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAFCFE; }

/* -------------------------------------------------------------- diagramas */
.diagrama {
  position: relative;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 0; margin: 24px 0;
  overflow: hidden; text-align: center; box-shadow: var(--sh-sm);
}
.diagrama svg { max-width: 100%; height: auto; }
.mermaid { text-align: center; }

/* El lienzo recorta; la capa se mueve y se escala adentro. Separarlos deja el
   transform en un solo nodo, que es lo unico que el navegador tiene que
   recomponer al arrastrar. */
.diagrama__lienzo {
  position: relative; overflow: hidden;
  cursor: grab; touch-action: none;
  background:
    radial-gradient(circle at 1px 1px, rgba(92,112,128,.16) 1px, transparent 0)
    0 0 / 22px 22px;
}
.diagrama__lienzo:focus-visible { outline: 2px solid var(--sky); outline-offset: -2px; }
.diagrama__lienzo.esta-arrastrando { cursor: grabbing; }
.diagrama__capa {
  position: absolute; top: 0; left: 0;
  transform-origin: 0 0; will-change: transform;
}
.diagrama__capa .mermaid { text-align: left; }
.diagrama__capa svg { max-width: none; }

.diagrama__barra {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-top: 1px solid var(--border); background: #FBFDFE;
}
.diagrama__pista {
  margin-right: auto; font-size: .74rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.diagrama__nivel {
  font-size: .74rem; font-weight: 700; color: var(--navy);
  min-width: 44px; text-align: right; font-variant-numeric: tabular-nums;
}
.diagrama__barra button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--white); color: var(--muted); transition: .16s ease;
}
.diagrama__barra button:hover { border-color: var(--sky); color: var(--blue); background: var(--celeste); }
.diagrama__barra button svg { width: 15px; height: 15px; }

/* Ver en grande: el diagrama ocupa la ventana entera. Es lo que hace falta con
   los subsistemas de casos de uso, que son anchos y no entran en la columna. */
.diagrama.esta-expandido {
  position: fixed; inset: 16px; z-index: 200; margin: 0;
  display: flex; flex-direction: column; box-shadow: var(--sh-lg);
}
.diagrama.esta-expandido .diagrama__lienzo { flex: 1; }
body.con-diagrama-expandido { overflow: hidden; }
body.con-diagrama-expandido::after {
  content: ''; position: fixed; inset: 0; z-index: 199;
  background: rgba(14, 58, 92, .5);
}

/* ------------------------------------------------------------ prototipos */
.proto-nav {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 26px;
  padding-bottom: 18px; border-bottom: 1px solid var(--border);
}
.proto-nav button {
  font-family: var(--body); font-size: .82rem; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--border); background: var(--white);
  color: var(--muted); border-radius: var(--r-full); padding: 7px 15px;
  transition: .18s ease;
}
.proto-nav button:hover { border-color: var(--sky); color: var(--blue); }
.proto-nav button.es-actual {
  background: var(--blue); border-color: var(--blue); color: #fff;
}

.pantalla { margin-bottom: 46px; scroll-margin-top: calc(var(--barra-h) + 16px); }
.pantalla__encabezado { margin-bottom: 14px; }
.pantalla__encabezado h3 {
  font-family: var(--display); font-size: 1.22rem; font-weight: 700;
  color: var(--navy); margin-bottom: 4px;
}
.pantalla__encabezado p { font-size: .9rem; color: var(--muted); max-width: 78ch; }
.pantalla__pie {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 12px; font-size: .8rem; color: var(--muted);
}
.pantalla__pie a { font-weight: 600; }

/* marco de navegador para el prototipo web */
.marco-web {
  border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; background: var(--white); box-shadow: var(--sh-md);
}
.marco-web__barra {
  display: flex; align-items: center; gap: 8px;
  background: #E9F1F6; border-bottom: 1px solid var(--border); padding: 9px 14px;
}
.marco-web__punto { width: 10px; height: 10px; border-radius: 50%; background: #C9D9E4; }
.marco-web__url {
  flex: 1; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 4px 14px; margin-left: 8px;
  font-size: .75rem; color: var(--muted);
  font-family: 'Cascadia Code', Consolas, ui-monospace, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Pantalla del mock que todavia no tiene ruta en web/src/App.jsx. Texto en
   tinta y no en el color de acento: es informacion, no una alerta. */
.marco-web__nota {
  flex: none; margin-left: 8px; padding: 3px 10px;
  border: 1px dashed var(--border); border-radius: var(--r-full);
  font-size: .68rem; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: var(--navy); background: var(--white);
}
.marco-web iframe { display: block; width: 100%; height: 640px; border: 0; background: var(--bg); }

/* marco de telefono para el prototipo mobile */
.tira-telefonos {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 34px 26px; margin: 26px 0 40px;
}
.telefono { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.telefono__marco {
  position: relative; width: 300px; padding: 11px;
  background: linear-gradient(160deg, #26333D, #131B21);
  border-radius: 34px; box-shadow: var(--sh-lg);
  flex-shrink: 0;
}
.telefono__pantalla {
  position: relative; width: 278px; height: 618px;
  border-radius: 24px; overflow: hidden; background: var(--white);
}
/* El iframe se dibuja a 360x800 (densidad de referencia de Android) y se
   reduce a 278x618 con transform, para que el mock conserve sus medidas
   reales en vez de reacomodarse a un ancho que ningun telefono tiene. */
.telefono__pantalla iframe {
  width: 360px; height: 800px; border: 0; display: block;
  transform: scale(.7722); transform-origin: 0 0;
}
.telefono__isla {
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  width: 62px; height: 7px; border-radius: var(--r-full);
  background: rgba(0,0,0,.35); z-index: 3; pointer-events: none;
}
.telefono__pie { text-align: center; max-width: 300px; }
.telefono__pie strong {
  display: block; font-family: var(--display); font-size: .92rem;
  color: var(--navy); font-weight: 700;
}
.telefono__pie span { font-size: .8rem; color: var(--muted); line-height: 1.45; display: block; margin-top: 2px; }

.respaldo-marco {
  display: none; padding: 26px; text-align: center; background: var(--celeste);
  border: 1px dashed var(--sky); border-radius: var(--r-md); font-size: .88rem;
}

/* ----------------------------------------------------------- paginacion */
.paginacion {
  display: flex; gap: 14px; margin-top: 56px;
  padding-top: 26px; border-top: 1px solid var(--border);
}
.paginacion a {
  flex: 1; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 15px 18px; box-shadow: var(--sh-sm);
  transition: .18s ease;
}
.paginacion a:hover { border-color: var(--sky); text-decoration: none; box-shadow: var(--sh-md); }
.paginacion small {
  display: block; font-size: .68rem; font-weight: 700; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 3px;
}
.paginacion strong {
  font-family: var(--display); font-size: .96rem; color: var(--navy); font-weight: 700;
}
.paginacion .siguiente { text-align: right; }

/* ---------------------------------------------------------------- footer */
.pie {
  border-top: 1px solid var(--border); background: var(--white);
  padding: 26px 34px; text-align: center; font-size: .82rem; color: var(--muted);
}

/* ------------------------------------------------------------ adaptable */
@media (max-width: 1080px) {
  .disposicion { grid-template-columns: minmax(0, 1fr); }
  .lateral {
    position: fixed; top: var(--barra-h); left: 0; z-index: 55;
    width: 280px; transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--sh-lg);
  }
  .lateral.esta-abierto { transform: translateX(0); }
  .barra__menu { display: inline-flex; }
  .velo {
    position: fixed; inset: var(--barra-h) 0 0 0; background: rgba(14,58,92,.42);
    z-index: 54; opacity: 0; pointer-events: none; transition: opacity .22s ease;
  }
  .velo.esta-abierto { opacity: 1; pointer-events: auto; }
}

@media (max-width: 820px) {
  .barra__ubicacion { display: none; }
  .barra__marca small { display: none; }
  .principal { padding: 24px 18px 70px; }
  .portada { padding: 34px 24px; }
  .portada h1 { font-size: 2.3rem; letter-spacing: -1.2px; }
  .cabecera { padding: 26px 22px; }
  .cabecera h1 { font-size: 1.6rem; }
  .paginacion { flex-direction: column; }
  .marco-web iframe { height: 480px; }
}

/* --------------------------------------------------------------- impresion */
@media print {
  .barra, .lateral, .velo, .paginacion, .proto-nav { display: none !important; }
  .diagrama__barra { display: none !important; }
  .disposicion { display: block; }
  .principal { width: 100%; padding: 0; }
  body { background: #fff; }
  .tarjeta, .bloque, .diagrama, .tbl-wrap { box-shadow: none; }
  .pantalla, .diagrama, .tbl-wrap { break-inside: avoid; }
  /* Impreso no hay quien arrastre: el diagrama vuelve a su tamanio natural,
     entero y sin recorte. */
  .diagrama { overflow: visible; padding: 16px; }
  .diagrama__lienzo { height: auto !important; overflow: visible; background: none; }
  .diagrama__capa { position: static; transform: none !important; }
  .diagrama__capa svg { max-width: 100%; height: auto; }
}
