:root {
  --bg: #0a0d07;          /* fondo del mate vacío */
  --ink: #e9e6d6;
  --dim: #8d927a;
  --yerba: #a9ab4c;
  --yerba-dark: #5c6626;
  --mate: #c8552a;
  --line: #262b1a;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --mono: "VT323", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body.intro { overflow: hidden; height: 100dvh; }

/* ---------- Intro ---------- */

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: opacity .6s;
}

#title {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: max(9dvh, env(safe-area-inset-top)) 16px calc(11dvh + env(safe-area-inset-bottom));
  text-align: center;
  transition: opacity .4s;
  pointer-events: none;   /* deja pasar los clicks a la escena (monitor) */
}
.langs { margin-top: 18px; pointer-events: auto; font: 400 clamp(9px, 1.4vw, 13px)/1 var(--pixel); color: #000; }
#title.hide .langs { pointer-events: none; }
/* en la vista final se corre a la esquina para no tapar los monitores */
body.home .langs { position: fixed; margin: 0; top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); }
.langs span { margin: 0 .2em; color: var(--ink); text-shadow: 0 2px 0 #000; }
.langs button {
  font: inherit; color: var(--ink);
  background: #000a; border: 0; padding: .6em .7em; cursor: pointer;
}
.langs button:hover, .langs button:focus-visible { background: #000; outline: 0; }
.langs button[aria-pressed="true"] { color: #10140a; background: var(--yerba); }
#title .row { display: flex; flex-wrap: wrap; gap: 28px 32px; justify-content: center; pointer-events: auto; }
#title.hide .row { pointer-events: none; }
#title.hide { opacity: 0; pointer-events: none; }

#title h1 {
  margin: 0;
  font: 400 clamp(18px, 4.6vw, 44px)/1.5 var(--pixel);
  letter-spacing: .06em;
  text-shadow: 0 .18em 0 #000, .1em 0 0 #000, -.1em 0 0 #000, 0 -.1em 0 #000, .1em .18em 0 #000, -.1em .18em 0 #000;
}

.btn {
  font: 400 clamp(10px, 1.5vw, 14px)/1 var(--pixel);
  color: #10140a;
  background: var(--yerba);
  border: 0;
  padding: 1em 1.3em;
  cursor: pointer;
  white-space: nowrap;
  /* borde pixelado */
  box-shadow:
    0 -4px 0 0 #d6d77a, 0 4px 0 0 var(--yerba-dark),
    -4px 0 0 0 #000, 4px 0 0 0 #000,
    0 -8px 0 0 #000, 0 8px 0 0 #000;
}
.btn:hover, .btn:focus-visible { background: #c6c860; outline: 0; }
.btn:active { transform: translateY(4px); }
#lights { background: #d9d2bd; box-shadow: 0 -4px 0 0 #f4efe0, 0 4px 0 0 #8c8571, -4px 0 0 0 #000, 4px 0 0 0 #000, 0 -8px 0 0 #000, 0 8px 0 0 #000; }
#lights:hover { background: #ece6d4; }
/* botonera del standing desk: clickeable, sin texto */
#desk, #bar-hot { position: fixed; padding: 0; border: 0; background: none; cursor: pointer; }
#desk[hidden], #bar-hot[hidden] { display: none; }
#desk:hover, #desk:focus-visible, #bar-hot:hover, #bar-hot:focus-visible { outline: 2px solid #ffffffaa; outline-offset: 1px; }
#start { animation: pulse 1.2s steps(2) infinite; }
#start:hover, #start:focus-visible { animation: none; }
/* en la pantalla inicial el botón es más grande */
#start:only-child, #lights[hidden] ~ #start { font-size: clamp(14px, 2.6vw, 22px); padding: 1em 1.6em; }

/* ---------- Monitor clickeable + contacto estilo VS Code ---------- */

.hot {
  position: fixed;
  display: grid; place-items: center;
  padding: 0; border: 0; background: none; cursor: pointer;
  outline: 3px dashed #ffffffaa; outline-offset: 2px;
  animation: pulse 1.2s steps(2) infinite;
}
.hot[hidden] { display: none; }
.hot span {
  font: 400 clamp(8px, 1.1vw, 12px)/1 var(--pixel);
  color: #fff; background: #007acc;
  padding: .7em .8em;
  box-shadow: 0 0 0 3px #000;
}
.hot:hover, .hot:focus-visible { outline-color: #fff; animation: none; }

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  padding: 16px;
  background: #000a;
}
.overlay[hidden] { display: none; }
.vsc {
  width: min(680px, 100%);
  max-height: 100%;
  display: flex; flex-direction: column;
  background: #1e1e1e; color: #d4d4d4;
  box-shadow: 0 0 0 4px #000, 0 0 0 8px #3c3c3c;
  font: 14px/1.9 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.vsc-tabs { display: flex; justify-content: space-between; background: #2d2d2d; }
.vsc-tab { padding: 4px 16px; background: #1e1e1e; border-top: 2px solid #3794ff; color: #fff; }
#contact-close { width: 40px; border: 0; background: none; color: #ccc; font-size: 20px; cursor: pointer; }
#contact-close:hover { background: #c42b1c; color: #fff; }
.vsc-code { margin: 0; padding: 12px 16px 16px 0; overflow: auto; counter-reset: ln; }
.ln { counter-increment: ln; padding-left: 56px; position: relative; white-space: pre-wrap; }
.ln::before { content: counter(ln); position: absolute; left: 0; width: 40px; text-align: right; color: #6e7681; }
.ln.in { padding-left: 80px; }
.vsc .c { color: #6a9955; } .vsc .k { color: #c586c0; } .vsc .v { color: #9cdcfe; }
.vsc .p { color: #9cdcfe; } .vsc .s { color: #ce9178; } .vsc .f { color: #dcdcaa; }
.vsc input, .vsc textarea {
  font: inherit; color: #ce9178;
  background: #2a2a2a; border: 0; border-bottom: 1px solid #569cd6;
  padding: 0 4px; width: min(22em, 60%);
  vertical-align: top;
}
.vsc textarea { resize: vertical; line-height: 1.5; margin: 4px 0; }
.vsc input:focus, .vsc textarea:focus { outline: 1px solid #3794ff; background: #252526; }
.vsc ::placeholder { color: #7a5a4c; }
.vsc a { color: #ce9178; text-decoration: underline; text-underline-offset: 3px; }
.vsc a:hover { color: #fff; }
.run { font: inherit; color: #d4d4d4; background: #0e639c; border: 0; padding: 0 8px; cursor: pointer; }
.run:hover, .run:focus-visible { background: #1177bb; outline: 0; }
.vsc-status { display: flex; justify-content: space-between; padding: 0 12px; background: #007acc; color: #fff; font-size: 12px; }

@keyframes pulse { 50% { filter: brightness(.78); } }

#caption {
  position: fixed;
  left: 0; right: 0; bottom: calc(5dvh + env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font: 400 clamp(9px, 1.5vw, 14px)/1.6 var(--pixel);
  color: var(--ink);
  text-shadow: 0 2px 0 #000;
  pointer-events: none;
}

#skip {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right));
  font: 400 10px/1 var(--pixel);
  color: var(--ink);
  background: #000a;
  border: 2px solid var(--ink);
  padding: 8px 10px;
  cursor: pointer;
  opacity: .7;
}
#skip:hover { opacity: 1; }

/* sonido: siempre visible arriba a la derecha; "saltar" queda debajo */
#snd {
  position: fixed; z-index: 11;
  top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right));
  font: 400 10px/1 var(--pixel);
  color: var(--ink); background: #000a;
  border: 2px solid var(--ink);
  padding: 8px 10px; cursor: pointer; opacity: .7;
}
#snd:hover, #snd:focus-visible { opacity: 1; outline: 0; }
#snd[aria-pressed="false"] { color: var(--dim); border-color: var(--dim); }
#skip { top: calc(52px + env(safe-area-inset-top)); }

/* ---------- Pared de yerba: experiencias ---------- */

#wall { list-style: none; margin: 0; padding: 0; }
#wall > li {
  position: fixed;
  left: 55%; top: 45%;
  width: min(600px, 76vw);
  padding: 22px 24px 20px;
  background: rgba(10, 13, 7, .8);
  box-shadow: 0 0 0 4px #0a0d07, 0 0 0 8px var(--yerba-dark);
  font: 400 clamp(19px, 2.2vw, 24px)/1.3 var(--mono);
  will-change: transform, opacity;
  max-height: 70dvh; overflow: auto;   /* una tarjeta larga se puede desplazar */
}
.when { display: block; margin-bottom: 12px; color: var(--yerba); font: 400 10px/1 var(--pixel); }
#wall h2 { margin: 0 0 10px; font: 400 clamp(12px, 1.8vw, 16px)/1.6 var(--pixel); }
#wall h2 span { color: var(--mate); }
#wall p { margin: 0 0 14px; color: #d3d0bd; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.tags li { padding: 0 8px; border: 2px solid var(--yerba-dark); color: var(--yerba); font-size: .85em; }

#next {
  position: fixed;
  left: 55%; bottom: calc(5dvh + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font: 400 clamp(10px, 1.6vw, 14px)/1 var(--pixel);
  color: #10140a;
  background: var(--yerba);
  border: 0;
  padding: 1em 1.3em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow:
    0 -4px 0 0 #d6d77a, 0 4px 0 0 var(--yerba-dark),
    -4px 0 0 0 #000, 4px 0 0 0 #000,
    0 -8px 0 0 #000, 0 8px 0 0 #000;
}
#next:hover, #next:focus-visible { background: #c6c860; outline: 0; }
#next:disabled { opacity: 0; pointer-events: none; }

#xp-hot span { background: #d97757; }

#about-hot span { background: #611f69; }

/* ---------- Sobre mí: Slack ---------- */
.slack {
  width: min(720px, 100%);
  max-height: 100%;
  display: grid; grid-template-columns: 190px 1fr;
  background: #fff; color: #1d1c1d;
  box-shadow: 0 0 0 4px #000, 0 0 0 8px #3f0e40;
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.s-side { background: #3f0e40; color: #cfc3cf; padding: 14px 0; }
.s-side p, .s-side ul { margin: 0; padding: 0; list-style: none; }
.s-side .s-ws { padding: 0 16px 14px; color: #fff; font-weight: 700; border-bottom: 1px solid #5a2a5b; }
.s-side .s-label { padding: 14px 16px 6px; font-size: 13px; }
.s-side li { padding: 3px 16px; }
.s-side li.active { background: #1164a3; color: #fff; }
.s-main { display: flex; flex-direction: column; min-width: 0; min-height: 380px; }
.s-head { display: flex; justify-content: space-between; align-items: center; padding-left: 20px; border-bottom: 1px solid #ddd; }
#slack-close { width: 44px; height: 44px; border: 0; background: none; color: #555; font-size: 22px; cursor: pointer; }
#slack-close:hover { background: #c42b1c; color: #fff; }
.s-msgs { flex: 1; overflow: auto; padding: 16px 20px 4px; }
.s-msg { display: flex; gap: 10px; margin-bottom: 14px; }
.s-msg p { margin: 0; }
.s-av { flex: none; display: grid; place-items: center; width: 36px; height: 36px; background: #2eb67d; color: #fff; font: 400 14px/1 var(--pixel); }
.s-who time { color: #616061; font-size: 12px; margin-left: 4px; }
.s-input { margin: 4px 20px 20px; padding: 10px 14px; border: 1px solid #bbb; border-radius: 8px; color: #8a8a8a; }
@media (max-width: 560px) {
  .slack { grid-template-columns: 1fr; }
  .s-side { display: none; }
}

/* ---------- Aviso "es mi setup real" + fotos ---------- */
#real {
  position: fixed;
  left: 50%; bottom: calc(2.2dvh + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0; padding: 4px 10px;
  width: max-content; max-width: calc(100vw - 24px);
  text-align: center;
  background: #000b; color: var(--ink);
  font: 400 18px/1.3 var(--mono);
}
#real[hidden] { display: none; }
#real-open {
  font: 400 9px/1.6 var(--pixel);
  color: var(--yerba); background: none; border: 0; padding: 0 2px;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
#real-open:hover, #real-open:focus-visible { color: #fff; outline: 0; }

.photos {
  width: min(860px, 100%);
  max-height: 100%;
  display: flex; flex-direction: column;
  background: #14170f; color: var(--ink);
  box-shadow: 0 0 0 4px #000, 0 0 0 8px var(--yerba-dark);
  font: 400 20px/1.3 var(--mono);
}
.photos-head { display: flex; justify-content: space-between; align-items: center; padding-left: 16px; }
#photos-close { width: 44px; height: 44px; border: 0; background: none; color: #ccc; font-size: 22px; cursor: pointer; }
#photos-close:hover { background: #c42b1c; color: #fff; }
.photos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 16px 16px; overflow: auto; }
.photos-grid figure { margin: 0; }
.photos-grid img { display: block; width: 100%; height: auto; }
.photos-grid figcaption { padding-top: 6px; color: var(--dim); text-align: center; }
/* celular: una foto por vez a pantalla casi completa; se pasa deslizando al costado */
@media (max-width: 700px), (max-height: 480px), (pointer: coarse) {
  #photos { padding: 0; }
  .photos { width: 100%; height: 100%; box-shadow: none; background: #0a0d07; padding-top: env(safe-area-inset-top); }
  .photos-grid {
    flex: 1; min-height: 0;
    display: flex; gap: 0; padding: 0;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory; overscroll-behavior: contain;
    scrollbar-width: none;
  }
  .photos-grid::-webkit-scrollbar { display: none; }
  .photos-grid figure {
    flex: 0 0 100%; min-width: 0; height: 100%;
    scroll-snap-align: center;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 0 10px calc(10px + env(safe-area-inset-bottom)); box-sizing: border-box;
  }
  .photos-grid img { width: auto; height: auto; max-width: 100%; max-height: calc(100% - 40px); object-fit: contain; }
  .photos-grid figure:nth-child(1) figcaption::after { content: "  \00B7  1/2  \2192"; }
  .photos-grid figure:nth-child(2) figcaption::after { content: "  \00B7  \2190  2/2"; }
}

/* ---------- Experiencia: chat ---------- */
.chat {
  width: min(640px, 100%);
  max-height: 100%;
  display: flex; flex-direction: column;
  background: #262624; color: #e8e4d8;
  box-shadow: 0 0 0 4px #000, 0 0 0 8px #3a3936;
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.chat-head { display: flex; justify-content: space-between; align-items: center; padding-left: 16px; background: #1f1e1d; }
.spark { color: #d97757; }
#chat-close { width: 40px; height: 36px; border: 0; background: none; color: #ccc; font-size: 20px; cursor: pointer; }
#chat-close:hover { background: #c42b1c; color: #fff; }
.chat-body { padding: 20px; overflow: auto; min-height: 300px; }
.msg { margin: 0 0 20px; }
.msg.user { width: fit-content; max-width: 80%; margin-left: auto; padding: 8px 14px; background: #3a3936; border-radius: 12px; }
.msg.bot { display: flex; gap: 12px; }
#chat-answer { margin: 0; white-space: pre-wrap; font-family: ui-serif, Georgia, serif; }
#chat-answer.typing::after { content: "\258D"; color: #d97757; }
.chat-input { display: flex; justify-content: space-between; align-items: center; margin: 0 16px 16px; padding: 10px 12px 10px 16px; background: #30302e; border: 1px solid #45443f; border-radius: 12px; color: #8a877d; }
.send { display: grid; place-items: center; width: 28px; height: 28px; background: #d97757; color: #fff; border-radius: 8px; }

/* ---------- Celular, táctil y pantallas bajas ---------- */

button, canvas { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#title, #next, #skip, #caption { -webkit-user-select: none; user-select: none; }

/* botones del menú inferior: sólo en pantallas chicas o táctiles */
.m-only { display: none; }

@media (max-width: 700px), (max-height: 480px), (pointer: coarse) {
  .m-only:not([hidden]) { display: inline-block; }
  #title .row { gap: 20px 14px; }
  .hot span { display: none; }            /* queda el recuadro; el nombre está en el menú */
  .vsc input, .vsc textarea { font-size: 16px; }   /* evita el zoom de iOS al enfocar */
}

@media (max-width: 560px) {
  .overlay { padding: 10px; }
  .vsc { font-size: 13px; }
  .ln { padding-left: 34px; }
  .ln::before { width: 22px; }
  .ln.in { padding-left: 46px; }
  .vsc input, .vsc textarea { width: 64%; }
  .vsc-code { padding-right: 10px; }
  #wall > li { left: 54%; width: 80vw; padding: 16px 16px 14px; }
}

/* celular acostado */
@media (max-height: 480px) {
  #title { padding-top: max(4dvh, env(safe-area-inset-top)); padding-bottom: calc(7dvh + env(safe-area-inset-bottom)); }
  #title h1 { font-size: 16px; }
  #title h1 br { display: none; }
  .langs { margin-top: 8px; }
  #wall > li { top: 42%; padding: 12px 16px; font-size: 17px; max-height: 62dvh; }
  #wall h2 { font-size: 11px; margin-bottom: 6px; }
  .when { margin-bottom: 8px; }
  #wall p { margin-bottom: 8px; }
  #next { bottom: calc(3dvh + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  #start { animation: none; }
}
