/* Exit Zero — sin fuentes externas, sin dependencias, sin rastreo. */

:root {
  --fondo:      #fcfcfd;
  --tarjeta:    #ffffff;
  --texto:      #16181d;
  --suave:      #5c6370;
  --tenue:      #8b919c;
  --linea:      #e6e8ec;
  --linea-sutil:#f0f1f4;
  --acento:     #0f8a4a;
  --acento-sue: #e8f6ee;
  --codigo-bg:  #f6f7f9;
  --codigo-tx:  #1f2328;
  --sombra:     0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --sombra-alta:0 2px 4px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo:      #0c0e12;
    --tarjeta:    #13161c;
    --texto:      #e6e8ec;
    --suave:      #9aa1ad;
    --tenue:      #6b7280;
    --linea:      #252a33;
    --linea-sutil:#1b1f26;
    --acento:     #3ddc84;
    --acento-sue: #10261a;
    --codigo-bg:  #161a21;
    --codigo-tx:  #d8dce3;
    --sombra:     none;
    --sombra-alta:0 8px 24px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               Arial, sans-serif;
  font-size: 17px;
  line-height: 1.72;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--acento-sue); color: var(--texto); }

.envoltura { max-width: 43rem; margin: 0 auto; padding: 0 20px; }

/* ---------------------------------------------------------- cabecera */
header {
  border-bottom: 1px solid var(--linea-sutil);
  background: var(--tarjeta);
  padding: 15px 0;
  margin-bottom: 3.2rem;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(160%) blur(8px);
}
header .envoltura { display: flex; align-items: baseline; gap: .8rem; }

header a.marca {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
  font-size: .97rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--texto);
  white-space: nowrap;
}
header a.marca::before {
  content: "$ ";
  color: var(--acento);
  font-weight: 400;
}
header a.marca:hover { color: var(--acento); }

header span {
  color: var(--tenue);
  font-size: .82rem;
  letter-spacing: 0;
}

/* ---------------------------------------------------------- titulos */
h1 {
  font-size: 2.45rem;
  line-height: 1.12;
  letter-spacing: -0.038em;
  font-weight: 700;
  margin: 0 0 .8rem;
  background: linear-gradient(170deg, var(--texto) 30%, var(--suave) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* portada: titular grande con el acento vivo */
body.portada h1 {
  font-size: 3.4rem;
  letter-spacing: -0.045em;
  line-height: 1.04;
  background: linear-gradient(135deg, var(--texto) 25%, var(--acento) 115%);
  -webkit-background-clip: text;
  background-clip: text;
}
h2 {
  font-size: 1.32rem;
  line-height: 1.32;
  letter-spacing: -0.021em;
  font-weight: 650;
  margin: 3rem 0 .85rem;
  padding-top: .3rem;
}
h3 {
  font-size: 1.06rem;
  letter-spacing: -0.014em;
  font-weight: 650;
  margin: 2.1rem 0 .6rem;
  color: var(--texto);
}

.resumen {
  color: var(--suave);
  font-size: 1.1rem;
  line-height: 1.6;
  letter-spacing: -0.008em;
  margin: 0 0 1.7rem;
}

.meta {
  color: var(--tenue);
  font-size: .8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
  border-bottom: 1px solid var(--linea-sutil);
  padding-bottom: 1.5rem;
  margin: 0 0 2.4rem;
}

p { margin: 0 0 1.25rem; }
p, li { overflow-wrap: break-word; }
ul, ol { padding-left: 1.3rem; margin: 0 0 1.25rem; }
li { margin-bottom: .45rem; }
li::marker { color: var(--tenue); }

a { color: var(--acento); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 650; }

/* ---------------------------------------------------------- codigo */
code {
  background: var(--codigo-bg);
  color: var(--codigo-tx);
  padding: .14em .36em;
  border-radius: 4px;
  font-size: .855em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
  border: 1px solid var(--linea-sutil);
}

pre {
  background: var(--codigo-bg);
  border: 1px solid var(--linea);
  border-radius: 8px;
  padding: 15px 17px;
  overflow-x: auto;
  font-size: .845rem;
  line-height: 1.62;
  margin: 1.5rem 0;
  box-shadow: var(--sombra);
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 1em;
  color: var(--codigo-tx);
}

/* ---------------------------------------------------------- bloques */
blockquote {
  margin: 1.7rem 0;
  padding: .1rem 0 .1rem 1.15rem;
  border-left: 3px solid var(--acento);
  color: var(--suave);
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

.caja {
  border: 1px solid var(--linea);
  border-left: 3px solid var(--acento);
  border-radius: 8px;
  padding: 1.15rem 1.3rem .35rem;
  margin: 2rem 0;
  background: var(--acento-sue);
  box-shadow: var(--sombra);
}
.caja p:last-child { margin-bottom: .9rem; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: .91rem;
  margin: 1.7rem 0;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}
th, td {
  text-align: left;
  padding: .62rem .85rem;
  border-bottom: 1px solid var(--linea-sutil);
}
th {
  font-weight: 650;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .055em;
  color: var(--tenue);
  border-bottom: 1px solid var(--linea);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--linea-sutil); }

/* ---------------------------------------------------------- indice */
.lede {
  font-size: 1.12rem;
  line-height: 1.62;
  color: var(--suave);
  margin: 0 0 2.6rem;
  padding-bottom: 2.2rem;
  border-bottom: 1px solid var(--linea-sutil);
}

ul.indice { list-style: none; padding: 0; margin: 0; }
ul.indice li { margin: 0 0 .9rem; }

ul.indice a {
  display: block;
  background: var(--tarjeta);
  border: 1px solid var(--linea);
  border-radius: 10px;
  padding: 1.15rem 1.3rem;
  text-decoration: none;
  color: var(--texto);
  font-weight: 650;
  font-size: 1.03rem;
  letter-spacing: -0.014em;
  line-height: 1.4;
  box-shadow: var(--sombra);
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
ul.indice a:hover {
  border-color: var(--acento);
  box-shadow: var(--sombra-alta);
  transform: translateY(-1px);
}
ul.indice a p {
  margin: .45rem 0 0;
  color: var(--suave);
  font-size: .93rem;
  font-weight: 400;
  line-height: 1.58;
  letter-spacing: 0;
}

/* ---------------------------------------------------------- volver */
.volver {
  display: inline-block;
  margin: 3.2rem 0 0;
  font-size: .88rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-decoration: none;
  color: var(--suave);
}
.volver:hover { color: var(--acento); }

/* ---------------------------------------------------------- pie */
footer {
  border-top: 1px solid var(--linea-sutil);
  margin-top: 4.5rem;
  padding: 2rem 0 3.5rem;
  color: var(--tenue);
  font-size: .855rem;
  line-height: 1.6;
}
footer p { margin: 0 0 .7rem; }
footer a { color: var(--suave); }
footer a:hover { color: var(--acento); }

/* ------------------------------------------------- movimiento
   Todo entra por aparicion al hacer scroll. El contenido es visible
   sin JavaScript: la clase .revelar solo se agrega si el script corre,
   asi que si el JS falla no se esconde nada.                        */

.revelar {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .62s cubic-bezier(.21,.6,.35,1),
              transform .62s cubic-bezier(.21,.6,.35,1);
  will-change: opacity, transform;
}
.revelar.visible {
  opacity: 1;
  transform: none;
}

/* el titular y el resumen entran de una, sin esperar al scroll */
@keyframes entrada {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
h1, .resumen, .lede {
  animation: entrada .66s cubic-bezier(.21,.6,.35,1) both;
}
.resumen, .lede { animation-delay: .07s; }

/* brillo suave detras del titular de portada */
body.portada main::before {
  content: "";
  position: absolute;
  top: -120px;
  left: 50%;
  width: min(620px, 92vw);
  height: 340px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center,
              var(--acento-sue) 0%, transparent 68%);
  opacity: .85;
  pointer-events: none;
  z-index: -1;
}
main { position: relative; }

/* quien pida menos movimiento, no recibe ninguno */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .revelar { opacity: 1; transform: none; transition: none; }
  h1, .resumen, .lede { animation: none; }
  ul.indice a:hover { transform: none; }
  * { transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------- telefono */
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .envoltura { padding: 0 16px; }
  h1 { font-size: 1.72rem; }
  h2 { font-size: 1.22rem; margin-top: 2.5rem; }
  header { margin-bottom: 2.4rem; }
  header .envoltura { flex-direction: column; align-items: flex-start; gap: .15rem; }
  pre { font-size: .8rem; padding: 13px 14px; }
  ul.indice a { padding: 1rem 1.1rem; }
}
