/* Departure Mono (Helena Zhang, SIL OFL — ver assets/fonts/DepartureMono-OFL.txt).
   Es pixel art: se ve nítida en múltiplos de 11px. */
@font-face {
  font-family: "Departure Mono";
  src: url("assets/fonts/DepartureMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-alt: #f3f3ef;
  --surface: #ffffff;
  --border: #e3e3dc;
  --text: #1f2421;
  --muted: #5d625e;
  --faint: #9a9e98;
  --accent: #8cc63f;
  --accent-ink: #5f8f1f;
  --accent-2: #5f8f1f;
  --radius: 4px;
  --font: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --mono: var(--font);
  --pixel: "Departure Mono", var(--font);
}

/* Oscuro: por sistema (si no se eligió claro) o elegido con el botón. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121412;
    --bg-alt: #181b18;
    --surface: #1c201c;
    --border: #2c312b;
    --text: #e8ebe5;
    --muted: #a6aca3;
    --faint: #737a70;
    --accent: #9ed653;
    --accent-ink: #9ed653;
    --accent-2: #9ed653;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121412;
  --bg-alt: #181b18;
  --surface: #1c201c;
  --border: #2c312b;
  --text: #e8ebe5;
  --muted: #a6aca3;
  --faint: #737a70;
  --accent: #9ed653;
  --accent-ink: #9ed653;
  --accent-2: #9ed653;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  transition: background-color .25s ease, color .25s ease;
  color: var(--text);
  font: 300 16px/1.75 var(--font);
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--accent-ink); }
h1, h2, h3 { font-family: var(--pixel); font-weight: 400; line-height: 1.15; margin: 0 0 .6em; letter-spacing: .01em; text-wrap: balance; }
strong, b { font-weight: 500; }
h2 { font-size: clamp(1.9rem, 3.5vw, 2.75rem); }
h3 { font-size: 1.375rem; }
p { margin: 0 0 1em; }
.mono { font-family: var(--mono); }
.center { text-align: center; justify-content: center; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

.skip {
  position: absolute; left: 16px; top: -48px;
  background: var(--accent); color: #000; padding: 8px 12px; border-radius: 8px; z-index: 100;
}
.skip:focus { top: 12px; }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font: 500 .95rem var(--font); color: var(--text); text-decoration: none; }
.brand__avatar { height: 32px; width: auto; }
/* Los controles de la barra nunca se achican; si falta lugar, el nombre se recorta (y en pantallas muy chicas queda solo el avatar). */
.brand { min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang, .theme-toggle, .nav__toggle { flex-shrink: 0; }
@media (max-width: 420px) {
  .brand { gap: 6px; font-size: .72rem; }
  .nav .nav__inner { gap: 8px; }
  .lang button { padding: 0 8px; }
}
@media (max-width: 359px) { .brand span { display: none; } }
.nav__inner { gap: 16px; }
.brand { margin-right: auto; }
.nav__links { display: flex; gap: 24px; align-items: center; }

/* Selector de idioma ES | EN (sin JS no aparece: la página queda en español) */
.lang { display: none; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.i18n .lang { display: inline-flex; }
.lang button {
  font: 500 .78rem var(--font); letter-spacing: .06em; padding: 0 10px; height: 36px; cursor: pointer;
  background: transparent; color: var(--muted); border: 0;
}
.lang button + button { border-left: 1px solid var(--border); }
.lang button[aria-pressed="true"] { background: var(--accent); color: #142006; }
.lang button:not([aria-pressed="true"]):hover { color: var(--text); }

/* Botón de tema: muestra el sol en oscuro (pasar a claro) y la luna en claro. Sin JS no aparece. */
.theme-toggle {
  display: none; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0;
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
:root[data-theme] .theme-toggle { display: inline-flex; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-ink); }
:root[data-theme="dark"] .theme-toggle__moon, :root[data-theme="light"] .theme-toggle__sun { display: none; }
.nav__links a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 400; font-size: .85rem; }
.nav__links a:not(.btn):hover, .nav__links a.is-active { color: var(--text); font-weight: 500; }
.nav__toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav__toggle span { display: block; width: 22px; height: 2px; margin: 5px 0; background: var(--text); transition: transform .2s; }

@media (max-width: 820px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px; display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: 12px 0; }
  .nav__links .btn { margin-top: 8px; text-align: center; }
}

/* BOTONES */
.btn {
  display: inline-block; padding: 11px 22px; border-radius: var(--radius);
  background: var(--accent); color: #142006; font-weight: 500; text-decoration: none; font-size: .9rem;
  border: 1px solid var(--accent); transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); box-shadow: none; }
.btn--small { padding: 8px 16px; font-size: .9rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* HERO */
.hero { padding: clamp(64px, 11vw, 120px) 0 72px; }
.hero__grid { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.prompt { font-size: .82rem; letter-spacing: .12em; color: var(--muted); margin-bottom: 14px; }
.prompt span { color: var(--accent-ink); }

/* Cursor de terminal parpadeando: solo en el inicio, Servicios y Contacto */
.prompt--cursor::after {
  content: ""; display: inline-block; width: .6em; height: 1.1em; margin-left: 4px;
  vertical-align: -.2em; background: var(--accent);
  animation: cursor-blink 1.06s step-end infinite;
}
@keyframes cursor-blink { 50% { opacity: 0; } }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.125rem); margin-bottom: 22px; }
.hero__role { font-size: 1.05rem; color: var(--muted); max-width: 640px; margin-bottom: 18px; }
.hero__lead { font-size: 1rem; color: var(--muted); max-width: 640px; }
.hero__lead strong { color: var(--text); }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 48px; }
.hero__avatar { margin: 0; }
.hero__avatar img { height: 320px; width: auto; }
@media (max-width: 820px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__avatar { order: -1; }
  .hero__avatar img { height: 170px; }
}
.stats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 620px; }
.stats li { border-left: 2px solid var(--accent); padding-left: 14px; }
.stats b { display: block; font: 400 1.9rem var(--pixel); }
.stats span { color: var(--muted); font-size: .85rem; }
.stats li { min-width: 0; }
@media (max-width: 640px) { .stats { gap: 10px; } .stats li { padding-left: 10px; } .stats span { font-size: .78rem; } }
/* En celulares chicos, tres columnas no alcanzan para "automatización": lista con número y texto en fila */
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; gap: 8px; }
  .stats li { display: flex; align-items: baseline; gap: 12px; }
  .stats b { font-size: 1.5rem; min-width: 2.6em; }
}

/* Separador como el de la referencia: línea fina con un tramo verde a la izquierda */
.section { border-top: 1px solid var(--border); position: relative; }
.section::before {
  content: ""; position: absolute; top: -1px; left: max(16px, calc((100% - 1120px) / 2));
  width: 52px; height: 2px; background: var(--accent);
}

/* SECCIONES */
.section { padding: clamp(64px, 10vw, 110px) 0; }
.center .prompt { text-align: center; }
.section--alt { background: var(--bg-alt); }
.section__lead { color: var(--muted); font-size: 1.1rem; margin-bottom: 36px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: start; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-2 p { color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card p { color: var(--muted); }
.card__icon { font: 400 1.375rem var(--pixel); color: var(--accent-ink); margin-bottom: 14px; }
.facts dl { margin: 0; display: grid; gap: 14px; }
.facts dt { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.facts dd { margin: 2px 0 0; color: var(--text); font-weight: 400; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.cards--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cards--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
/* Proyectos: 2×2 fijo, para que ninguna tarjeta quede sola en una fila */
.cards--projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .cards--projects { grid-template-columns: 1fr; } }

.tags { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font: 400 .75rem var(--mono); padding: 3px 10px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-ink);
}

.services { display: grid; gap: 4px; }
.service { display: flex; gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--border); }
.service:last-child { border-bottom: 0; }
.service__n { color: var(--accent-ink); font: 400 1.65rem var(--pixel); min-width: 48px; }
.service p { color: var(--muted); margin: 0; max-width: 680px; }
.service--featured { background: color-mix(in srgb, var(--accent) 7%, transparent); border-left: 2px solid var(--accent); padding-left: 20px; padding-right: 20px; }
.service__list { margin: 12px 0 0; padding-left: 1.2em; color: var(--muted); display: grid; gap: 4px; max-width: 680px; }
.service__list li::marker { content: "› "; color: var(--accent-ink); }
.service .link { display: inline-block; margin-top: 4px; padding-block: 10px; font-weight: 600; text-decoration: none; }

/* Preview de la web: captura a sangre arriba de la tarjeta, recortada desde el borde superior. */
.project { display: flex; flex-direction: column; }
.project__preview {
  display: block; margin: -26px -26px 22px; aspect-ratio: 16 / 10; overflow: hidden;
  border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-alt);
}
.project__preview img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .4s ease; }
.project:hover .project__preview img { transform: scale(1.03); }
/* Tarjeta ancha (este sitio): preview a la izquierda, texto a la derecha */
.project--wide { grid-column: 1 / -1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 0 32px; align-items: center; }
.project--wide .project__preview { margin: -26px 0 -26px -26px; height: calc(100% + 52px); aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--border); border-radius: var(--radius) 0 0 var(--radius); }
.project--wide .project__body { display: flex; flex-direction: column; padding: 8px 0; }
@media (max-width: 760px) {
  .project--wide { grid-template-columns: 1fr; }
  .project--wide .project__preview { margin: -26px -26px 22px; height: auto; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
}
.project__kind { color: var(--accent-ink); font-size: .78rem; letter-spacing: .1em; margin-bottom: 8px; }
.project__preview--empty { display: grid; place-items: center; text-decoration: none;
  background: repeating-linear-gradient(45deg, var(--bg-alt) 0 10px, var(--surface) 10px 20px); }
.project__preview--empty span { font: 400 1.1rem var(--pixel); color: var(--muted); padding: 6px 12px; background: var(--surface); border: 1px solid var(--border); }
.project .link { display: inline-block; margin-top: auto; padding-top: 18px; padding-bottom: 8px; font-weight: 600; text-decoration: none; }

.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.timeline > li { position: relative; padding: 0 0 36px 28px; }
.timeline > li::before {
  content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg);
}
.timeline__when { color: var(--accent-ink); font-size: .8rem; letter-spacing: .1em; }
.timeline p { color: var(--muted); max-width: 700px; }
.timeline ul { margin: 0; padding-left: 1.2em; color: var(--muted); max-width: 760px; display: grid; gap: 6px; }
.timeline ul li::marker { content: "› "; color: var(--accent-ink); }
.timeline__org { font-size: .85rem; color: var(--faint); margin: -6px 0 12px; }
.timeline .tags li::marker { content: none; }
.timeline ul.tags { padding-left: 0; display: flex; margin-top: 16px; }

/* "Más detalles": desplegable nativo, estilo prompt */
.more { margin-top: 14px; max-width: 760px; }
.more summary {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-size: .82rem; letter-spacing: .08em; color: var(--accent-ink);
  padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius);
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "+"; font-family: var(--pixel); }
.more[open] summary::before { content: "−"; }
.more summary:hover { border-color: var(--accent); }
.more[open] > ul:first-of-type { margin-top: 14px; }

.section--cta { background: var(--bg-alt); }
.section--cta .section__lead { margin-bottom: 32px; }
.contact {
  list-style: none; padding: 0; margin: 0 auto; max-width: 900px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; text-align: left;
}
.contact li {
  display: grid; gap: 6px; padding: 20px 22px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.contact li:hover { border-color: var(--accent); }
.contact__label { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.contact__value { font: 400 1.05rem var(--pixel); color: var(--text); text-decoration: none; overflow-wrap: anywhere; user-select: all; }
.contact__value:hover { color: var(--accent-ink); }
/* Links dentro del texto (p. ej. Vitto Labs): subrayado suave que se marca al pasar */
.inline-link { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent-ink) 45%, transparent); }
.inline-link:hover { text-decoration-color: currentColor; }
h3 .inline-link { color: inherit; }
/* Toda la tarjeta de contacto es tocable (no solo el texto) */
.contact li { position: relative; }
.contact__value::after { content: ""; position: absolute; inset: 0; }
@media (max-width: 760px) { .contact { grid-template-columns: 1fr; } }
.section--cta .hero__cta { margin: 28px 0 0; }

.footer { padding: 28px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.footer p { margin: 0; }

/* Aparición al hacer scroll (main.js agrega .is-visible). Sin JS, todo queda visible. */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .prompt--cursor::after { animation: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
