/* Terra Incognita · estilos
   Negro tinta, puntos color hueso y un único acento verde ácido para lo que se descubre. */

@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fuentes/InstrumentSerif-normal-400.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url(../fuentes/InstrumentSerif-italic-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fuentes/IBMPlexMono-normal-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fuentes/IBMPlexMono-normal-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fuentes/IBMPlexMono-normal-600.woff2) format("woff2"); }

:root {
  --fondo: #09090a;
  --panel: rgba(13, 13, 14, 0.9);
  --hueso: #ece6d6;
  --hueso-2: rgba(236, 230, 214, 0.68);
  --hueso-3: rgba(236, 230, 214, 0.42);
  --hueso-4: rgba(236, 230, 214, 0.16);
  --linea: rgba(236, 230, 214, 0.14);
  --acento: #d4ff3e;
  --acento-2: rgba(212, 255, 62, 0.55);
  --tinta: #09090a;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --margen: 28px;
  --curva: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--fondo); color: var(--hueso);
  font: 400 13px/1.45 var(--mono);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible { outline: 1px solid var(--acento); outline-offset: 3px; }

#lienzo { position: fixed; inset: 0; display: block; cursor: crosshair; touch-action: none; }
.en-escena #lienzo { cursor: default; }
.sin-cursor #lienzo { cursor: none; }

.grano { position: fixed; inset: 0; pointer-events: none; opacity: 0.07; background-size: 180px 180px; }
.vineta { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 52%, rgba(0, 0, 0, 0.6) 100%); }

/* marcas de registro en las esquinas, como en una lámina */
.esquinas i { position: fixed; width: 18px; height: 18px; pointer-events: none; border-color: var(--hueso-4); border-style: solid; border-width: 0; }
.esquinas i:nth-child(1) { top: 14px; left: 14px; border-top-width: 1px; border-left-width: 1px; }
.esquinas i:nth-child(2) { top: 14px; right: 14px; border-top-width: 1px; border-right-width: 1px; }
.esquinas i:nth-child(3) { bottom: 14px; left: 14px; border-bottom-width: 1px; border-left-width: 1px; }
.esquinas i:nth-child(4) { bottom: 14px; right: 14px; border-bottom-width: 1px; border-right-width: 1px; }

/* ---------- marca ---------- */
.marca { position: fixed; top: var(--margen); left: calc(var(--margen) + 8px); pointer-events: none; transition: opacity 0.8s var(--curva); }
.titulo { margin: 0; font: 400 36px/1 var(--serif); letter-spacing: -0.01em; }
.titulo em { font-style: italic; }
.titulo .pre { display: inline-block; position: relative; transition: max-width 1.2s var(--curva) 0.9s, opacity 0.8s ease 0.9s; max-width: 1em; vertical-align: bottom; overflow: hidden; }
.titulo .pre::after { content: ""; position: absolute; left: -2px; right: -2px; top: 55%; height: 2px; background: var(--acento); transform: scaleX(0); transform-origin: left; transition: transform 0.7s var(--curva); }
.cognita .titulo .pre::after { transform: scaleX(1); }
.cognita .titulo .pre { max-width: 0; opacity: 0; }
.sub { margin: 8px 0 0; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--hueso-3); }
.en-escena .marca { opacity: 0.3; }
/* Exploración 2: en la Luna el acento pasa de verde a cian */
.luna { --acento: #6fe3ff; --acento-2: rgba(111, 227, 255, 0.55); }
.final-activo .marca { opacity: 1; }

/* ---------- botón del cuaderno ---------- */
.b-cuaderno {
  position: fixed; top: calc(var(--margen) - 4px); right: calc(var(--margen) + 8px);
  display: flex; flex-direction: column; gap: 9px; padding: 11px 14px 12px;
  border: 1px solid var(--linea); background: rgba(9, 9, 10, 0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px;
  transition: border-color 0.3s, opacity 0.6s, transform 0.6s var(--curva);
}
.b-cuaderno:hover { border-color: var(--hueso-3); }
.b-fila { display: flex; justify-content: space-between; gap: 22px; width: 100%; }
.b-cont { color: var(--acento); font-weight: 500; }
.segmentos { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; width: 100%; min-width: 132px; }   /* WebKit no estira los hijos de un <button> */
.segmentos i { height: 3px; background: rgba(236, 230, 214, 0.24); transition: background 0.6s; }
.segmentos i.si { background: var(--acento); }
.b-cuaderno.pulso { animation: pulso 1.4s var(--curva) 3; }
@keyframes pulso { 0%, 100% { border-color: var(--linea); } 40% { border-color: var(--acento); box-shadow: 0 0 0 4px rgba(212, 255, 62, 0.12); } }
.en-escena .b-cuaderno, .cuaderno-abierto .b-cuaderno { opacity: 0; pointer-events: none; transform: translateY(-8px); }

/* ---------- instrumentos ---------- */
.hud { position: fixed; pointer-events: none; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; transition: opacity 0.6s; }
.hud-izq { left: calc(var(--margen) + 8px); bottom: calc(var(--margen) + 2px); display: grid; gap: 5px; }
.hud-izq div { display: grid; grid-template-columns: 64px auto; align-items: center; }
.hud-izq span { color: var(--hueso-3); }
.hud-izq b { font-weight: 500; color: var(--hueso-2); font-variant-numeric: tabular-nums; }
.barras { display: inline-flex; align-items: flex-end; gap: 3px; height: 12px; }
.barras i { width: 4px; background: var(--hueso-4); transition: background 0.25s; }
.barras i:nth-child(1) { height: 4px; } .barras i:nth-child(2) { height: 6px; } .barras i:nth-child(3) { height: 8px; } .barras i:nth-child(4) { height: 10px; } .barras i:nth-child(5) { height: 12px; }
.barras i.si { background: var(--acento); }
.hud-izq b { display: inline-flex; align-items: center; gap: 10px; }
.h-aviso { font-style: normal; color: var(--acento); animation: parpadeo 1.1s steps(2, end) infinite; }
@keyframes parpadeo { 50% { opacity: 0.25; } }
.hud-der { right: calc(var(--margen) + 8px); bottom: calc(var(--margen) + 2px); color: var(--hueso-3); text-align: right; }
.en-escena .hud { opacity: 0; }

.teclas { position: fixed; left: 50%; bottom: calc(var(--margen) - 2px); transform: translateX(-50%); display: flex; gap: 6px; pointer-events: none; }
.teclas kbd, .saltar kbd {
  font: 500 11px/1 var(--mono); padding: 5px 7px; min-width: 24px; text-align: center;
  border: 1px solid var(--linea); color: var(--hueso-2); background: rgba(9, 9, 10, 0.6);
}
.teclas kbd { animation: tecla 2.2s ease forwards; }
@keyframes tecla { 0% { opacity: 0; transform: translateY(6px); } 10%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------- cuaderno ---------- */
.cuaderno {
  position: fixed; top: 0; right: 0; bottom: 0; width: 410px; max-width: 100%;
  display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--linea);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transform: translateX(102%); transition: transform 0.6s var(--curva);
  -webkit-user-select: text; user-select: text;
}
.cuaderno.abierto { transform: none; }
.c-cabeza { display: flex; justify-content: space-between; align-items: flex-start; padding: 30px 28px 0; }
.c-etq, .intro-etq { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--acento); }
.cuaderno h2 { margin: 0; font: italic 400 34px/1 var(--serif); }
.c-cerrar { width: 34px; height: 34px; border: 1px solid var(--linea); color: var(--hueso-2); font-size: 13px; }
.c-cerrar:hover { border-color: var(--hueso-3); color: var(--hueso); }
.c-intro { margin: 14px 28px 18px; font: 400 17px/1.35 var(--serif); color: var(--hueso-2); }
.lista { list-style: none; margin: 0; padding: 0 28px; overflow-y: auto; flex: 1; border-top: 1px solid var(--linea); }
.entrada { display: grid; grid-template-columns: 38px 1fr; gap: 4px; padding: 16px 0 17px; border-bottom: 1px solid var(--linea); }
.e-num { font-size: 11px; color: var(--hueso-3); padding-top: 3px; letter-spacing: 0.06em; }
.e-tipo { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--hueso-3); }
.e-nombre { margin: 3px 0 5px; font: 400 25px/1.05 var(--serif); min-height: 26px; }
.e-censura {
  display: inline-block; height: 0.62em; vertical-align: 0.08em;
  background: repeating-linear-gradient(90deg, var(--hueso-4) 0 6px, rgba(236, 230, 214, 0.09) 6px 8px);
}
.e-pista { margin: 0; font: italic 400 16px/1.35 var(--serif); color: var(--hueso-2); }
.e-meta { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hueso-3); }
.e-ver { color: var(--acento); letter-spacing: 0.12em; text-transform: uppercase; font-size: 10.5px; border-bottom: 1px solid transparent; }
.e-ver:hover { border-bottom-color: var(--acento); }
.entrada.hallada .e-num { color: var(--acento); }
.entrada.hallada .e-nombre { font-style: italic; }
.entrada.hallada .e-pista { color: var(--hueso-3); }
.entrada.nueva .e-nombre { animation: revela 1.6s var(--curva); }
@keyframes revela { from { opacity: 0; letter-spacing: 0.08em; filter: blur(6px); } to { opacity: 1; letter-spacing: 0; filter: none; } }
.c-pie { display: flex; justify-content: space-between; gap: 12px; padding: 16px 28px 26px; border-top: 1px solid var(--linea); }
.c-boton { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--acento); }
.c-boton-tenue { color: var(--hueso-3); margin-left: auto; }
.c-pie { flex-wrap: wrap; }
.c-boton:hover { color: var(--hueso); }

/* ---------- tarjeta de cada secreto ---------- */
.tarjeta {
  position: fixed; left: 7vw; bottom: 12vh; max-width: 540px; pointer-events: none;
  opacity: 0; transform: translateY(14px); transition: opacity 0.9s var(--curva), transform 1.1s var(--curva);
}
.tarjeta.visible { opacity: 1; transform: none; }
.tarjeta::before { content: ""; position: absolute; z-index: -1; inset: -90px -110px -70px -140px; background: radial-gradient(closest-side, rgba(9, 9, 10, 0.78), rgba(9, 9, 10, 0.5) 55%, rgba(9, 9, 10, 0)); }
.t-etq { display: flex; align-items: center; gap: 12px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--acento); }
.t-etq::before { content: ""; width: 0; height: 1px; background: var(--acento); transition: width 1s var(--curva) 0.3s; }
.tarjeta.visible .t-etq::before { width: 44px; }
.t-tit { margin: 14px 0 14px; font: italic 400 clamp(46px, 6.4vw, 78px)/0.95 var(--serif); letter-spacing: -0.015em; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.8); }
.t-txt { margin: 0; font: 400 20px/1.38 var(--serif); color: var(--hueso-2); text-shadow: 0 1px 18px rgba(0, 0, 0, 0.9); }
.t-pie { margin-top: 16px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--hueso-3); }
.tarjeta.retro .t-tit { font: 600 clamp(30px, 4vw, 46px)/1.05 var(--mono); font-style: normal; letter-spacing: 0.02em; color: #c4f04a; }

/* ---------- aviso, saltar ---------- */
.aviso {
  position: fixed; top: 26px; left: 50%; transform: translate(-50%, -16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 12px; padding: 11px 16px;
  border: 1px solid var(--acento-2); background: rgba(9, 9, 10, 0.85);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
  transition: opacity 0.5s, transform 0.7s var(--curva);
}
.aviso::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--acento); box-shadow: 0 0 12px var(--acento); }
.aviso b { color: var(--acento); font-weight: 500; }
.aviso.visible { opacity: 1; transform: translate(-50%, 0); }
.saltar {
  position: fixed; right: calc(var(--margen) + 8px); bottom: calc(var(--margen) - 2px);
  display: flex; align-items: center; gap: 10px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--hueso-3);
  opacity: 0; pointer-events: none; transition: opacity 0.6s 0.8s, color 0.2s;
}
.en-escena .saltar { opacity: 1; pointer-events: auto; }
.saltar:hover { color: var(--hueso); }

/* ---------- entrada ---------- */
.intro {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 50%, rgba(9, 9, 10, 0.62), rgba(9, 9, 10, 0.9) 70%);
  transition: opacity 0.9s var(--curva);
}
.intro[hidden] { display: none; }
.intro.saliendo { opacity: 0; pointer-events: none; }
.intro-caja { max-width: 560px; text-align: center; }
.intro h2 { margin: 6px 0 18px; font: 400 clamp(54px, 9vw, 96px)/0.9 var(--serif); letter-spacing: -0.02em; }
.intro p { margin: 0 auto 30px; max-width: 470px; font: 400 21px/1.38 var(--serif); color: var(--hueso-2); }
.intro .intro-etq { margin: 0 0 6px; max-width: none; font: 400 11px/1.4 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--acento); }
.intro button {
  padding: 15px 24px; border: 1px solid var(--acento); color: var(--acento);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; transition: background 0.25s, color 0.25s;
}
.intro button:hover { background: var(--acento); color: var(--tinta); }

/* ---------- créditos (al completar los diez) ---------- */
.creditos {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 50%, rgba(9, 9, 10, 0.6), rgba(9, 9, 10, 0.93) 72%);
  opacity: 0; transition: opacity 1.2s var(--curva);
}
.creditos[hidden] { display: none; }
.creditos.visible { opacity: 1; }
.creditos.saliendo { opacity: 0; transition-duration: 0.6s; }
.creditos-caja { max-width: 980px; text-align: center; }
.creditos-etq, .creditos-txt, .creditos-botones { opacity: 0; transform: translateY(10px); }
.creditos-etq { margin: 0; font: 400 11px/1.4 var(--mono); letter-spacing: 0.24em; text-transform: uppercase; color: var(--acento); transition: opacity 0.9s 0.3s, transform 1.1s var(--curva) 0.3s; }
.creditos-nombre {
  margin: 20px 0 0; font: italic 400 clamp(42px, 7vw, 100px)/0.95 var(--serif); letter-spacing: 0.08em;
  opacity: 0; filter: blur(12px); text-shadow: 0 2px 40px rgba(0, 0, 0, 0.9);
  transition: opacity 1.4s 0.7s, filter 1.8s var(--curva) 0.7s, letter-spacing 2.4s var(--curva) 0.7s;
}
.creditos-linea { width: 0; height: 1px; margin: 28px auto 22px; background: var(--acento); transition: width 1.3s var(--curva) 1.7s; }
.creditos-txt { margin: 0 0 32px; font: 400 21px/1.35 var(--serif); color: var(--hueso-2); transition: opacity 1s 2s, transform 1.2s var(--curva) 2s; }
.creditos-botones { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; transition: opacity 1s 2.4s, transform 1.2s var(--curva) 2.4s; }
.creditos.visible .creditos-etq, .creditos.visible .creditos-txt, .creditos.visible .creditos-botones { opacity: 1; transform: none; }
.creditos.visible .creditos-nombre { opacity: 1; filter: none; letter-spacing: -0.015em; }
.creditos.visible .creditos-linea { width: 72px; }
.creditos-enlace, .creditos-cerrar {
  display: inline-flex; align-items: center; gap: 10px; padding: 15px 22px;
  font: 400 11px/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; text-decoration: none;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.creditos-enlace { border: 1px solid var(--acento); color: var(--acento); }
.creditos-enlace:hover { background: var(--acento); color: var(--tinta); }
.creditos-enlace[hidden] { display: none; }
.creditos-cerrar { border: 1px solid var(--linea); color: var(--hueso-2); }
.creditos-cerrar:hover { border-color: var(--hueso-3); color: var(--hueso); }
.creditos a:focus-visible { outline: 1px solid var(--acento); outline-offset: 3px; }

/* la puerta a la Exploración 2: el punto final de los créditos de la Tierra.
   Sin cursor de mano ni foco; solo un destello muy de vez en cuando */
.puerta { cursor: default; padding: 8px 6px; margin: -8px -6px; animation: puerta 26s ease-in-out 7s infinite; }
@keyframes puerta { 0%, 95%, 100% { color: inherit; text-shadow: none; } 97% { color: var(--acento); text-shadow: 0 0 10px var(--acento); } }
.c-fuentes { margin: 0; padding: 10px 28px 0; font-size: 10px; letter-spacing: 0.08em; color: var(--hueso-3); }
.c-credito { margin: 0; padding: 14px 28px 0; border-top: 1px solid var(--linea); font: italic 400 16px/1.3 var(--serif); color: var(--hueso-3); }
.c-credito a { color: var(--hueso); text-decoration: none; }
.c-credito a[href] { cursor: pointer; }
.c-credito a[href]:hover b { color: var(--acento); }
.c-credito b { font-weight: 400; transition: color 0.2s; }
.c-credito a:not([href]) .flecha { display: none; }
.c-credito + .c-pie { border-top: 0; }

/* ---------- pantallas estrechas ---------- */
@media (max-width: 700px) {
  :root { --margen: 18px; }
  .titulo { font-size: 27px; }
  .sub { font-size: 10px; margin-top: 6px; }
  .b-cuaderno { padding: 9px 11px 10px; font-size: 10px; }
  .b-fila { gap: 12px; }
  .hud-der { display: none; }
  .hud-izq { font-size: 10px; }
  .cuaderno { top: auto; left: 0; width: 100%; height: 82vh; border-left: 0; border-top: 1px solid var(--linea); transform: translateY(102%); }
  .c-cabeza { padding: 22px 18px 0; }
  .c-intro { margin: 10px 18px 14px; font-size: 16px; }
  .lista { padding: 0 18px; }
  .c-pie { padding: 14px 18px 22px; }
  .c-credito { padding: 12px 18px 0; }
  .c-fuentes { padding: 8px 18px 0; }
  .creditos-txt { font-size: 18px; }
  .tarjeta { left: 18px; right: 18px; bottom: 76px; }
  .t-tit { font-size: 44px; }
  .t-txt { font-size: 17px; }
  .esquinas i { display: none; }
}
@media (max-width: 480px) {
  .sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tarjeta, .cuaderno, .aviso, .intro, .creditos, .creditos * { transition-duration: 0.01s !important; transition-delay: 0s !important; }
}
