@font-face {
  font-family: "Manrope";
  src: url(fonts/manrope-latin-wght.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --bg-2: #141414;
  --text: #f2f2f2;
  --text-2: #cfcfcf;
  --muted: #9a9a9a;
  --accent: #d71920; /* rojo alternativa Uhlsport 2004–06 (aprox.) */
  --accent-text: #eb4046; /* el mismo rojo, un poco más claro: el de marca no llega a 4.5:1 en texto chico */
  --accent-soft: rgba(215, 25, 32, 0.18);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); overflow-x: hidden; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 20;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 4px; text-decoration: none;
}
.skip:focus { top: 12px; }

.nav {
  position: fixed; inset: 0 0 auto; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: rgba(10, 10, 10, 0.7); backdrop-filter: blur(8px);
}
.nav nav { display: flex; gap: 16px; align-items: center; }
.nav nav a { text-decoration: none; color: var(--muted); font-size: 14px; }
.nav nav a:hover { color: var(--text); }
.logo { display: flex; }
#lang {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  min-width: 40px; min-height: 36px; background: none; border: 1px solid var(--accent); color: var(--text);
  border-radius: 4px; padding: 0 10px; cursor: pointer; font: inherit; font-size: 14px;
}
/* pausa del sol 3D: lo muestra scene.js solo si hay animación (no con reducir movimiento ni sin WebGL) */
#motion {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; cursor: pointer;
  background: none; border: 1px solid var(--accent); border-radius: 4px; color: var(--text);
}
#motion[hidden] { display: none; }
#motion svg { fill: currentColor; }
#motion .i-play, #motion[data-paused="true"] .i-pause { display: none; }
#motion[data-paused="true"] .i-play { display: inline; }
/* en celular queda solo Contacto (en los artículos, la vuelta al portfolio): es el destino que importa */
@media (max-width: 600px) { .nav nav a:not(.nav-contact, .nav-back, .nav-lang) { display: none; } }

/* Hero: nombre a la izquierda y el sol (canvas de fondo) a la derecha; en móvil el sol arriba y el texto abajo */
.hero { position: relative; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; justify-items: start; overflow: hidden; }
/* resplandor donde va a aparecer el sol: evita la pantalla negra mientras carga el 3D, y es el respaldo si no carga */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 74% 50%, rgba(215, 25, 32, 0.24), transparent 42%);
  animation: glow 1.6s ease-in-out infinite alternate; transition: opacity 1s;
}
.scene-ready .hero::before { opacity: 0; animation: none; }
.no-webgl .hero::before { animation: none; } /* sin 3D el resplandor queda fijo: no titila para siempre */
/* Sin GPU main.js no carga el 3D, y el sol es una imagen fija: un render del mismo 3D, de frente y sin estrellas.
   Va donde lo pone scene.js: rayos de min(48vw, 58.7svh) de diámetro centrados en (74vw, 50svh), y en celular
   min(84vw, 34.2svh) en (50vw, 30svh); la imagen mide 1,167 veces ese diámetro. Si cambia el 3D, regenerarla. */
.sun-static .hero::before {
  --d: min(48vw, 58.7svh); --s: calc(var(--d) * 1.167);
  animation: none;
  background: url(img/sol-640.webp) no-repeat calc(74vw - var(--s) / 2) calc(50svh - var(--s) / 2) / var(--s) var(--s),
    radial-gradient(circle at 74% 50%, rgba(215, 25, 32, 0.24), transparent 42%);
}
@media (max-width: 899px) {
  .sun-static .hero::before {
    --d: min(84vw, 34.2svh);
    background: url(img/sol-400.webp) no-repeat calc(50vw - var(--s) / 2) calc(30svh - var(--s) / 2) / var(--s) var(--s),
      radial-gradient(circle at 50% 30%, rgba(215, 25, 32, 0.24), transparent 45%);
  }
}
@keyframes glow { from { opacity: 0.55; } to { opacity: 1; } }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
main, footer { position: relative; z-index: 1; }
#top:focus, #content:focus { outline: none; } /* el skip link mueve el foco al main: sin un recuadro alrededor de toda la página */
.hero-text { position: relative; padding: 0 16px; margin-left: max(0px, calc(7vw - 16px)); max-width: 50vw; }
@media (max-width: 899px) {
  .hero { align-items: end; justify-items: center; }
  .hero::before { background: radial-gradient(circle at 50% 30%, rgba(215, 25, 32, 0.24), transparent 45%); }
  .hero-text { text-align: center; margin: 0; max-width: none; padding-bottom: 7svh; }
  .role { font-size: 1rem; }
}
.eyebrow { color: var(--text); font-weight: 600; letter-spacing: 2px; text-transform: uppercase; font-size: 14px; }
h1, h2, .role, .eyebrow { text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5.2vw, 4.75rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.01em; } /* "Kazerian Blengio" tiene que entrar al lado del sol */
.role { color: var(--text-2); font-size: 1.125rem; max-width: 36em; margin: 14px 0 28px; }
.btn {
  display: inline-block; padding: 11px 27px; background: var(--accent); color: #fff; border: 1px solid transparent; /* en alto contraste el borde marca el botón */
  text-decoration: none; font-weight: 600; border-radius: 4px; transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 899px) { .actions { justify-content: center; } }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--text-2); }
.btn-ghost:hover { border-color: var(--accent); box-shadow: 0 8px 24px var(--accent-soft); }
.print-only { display: none; }

section:not(.hero) { max-width: 820px; margin: 0 auto; padding: 96px 16px; }
h2 { font-size: 2rem; margin-bottom: 24px; }
h2::after { content: ""; display: block; width: 48px; height: 3px; background: var(--accent); margin-top: 8px; }

#about p + p { margin-top: 12px; }
.about-grid { display: grid; gap: 28px; align-items: start; }
.portrait { width: 100%; height: auto; max-width: 220px; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 2px solid var(--accent); justify-self: center; }
@media (min-width: 700px) { .about-grid { grid-template-columns: 220px 1fr; } }
.stats { list-style: none; padding: 0; margin-top: 32px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 480px) { .stats { grid-template-columns: 1fr; } }
.stats li { background: rgba(20, 20, 20, 0.75); border-left: 3px solid var(--accent); padding: 16px; }
.stats strong { display: block; font-size: 1.8rem; color: var(--accent); }
.stats span { color: var(--muted); font-size: 14px; }

.timeline { list-style: none; padding: 0; border-left: 2px solid var(--bg-2); }
.timeline > li { position: relative; padding: 0 0 32px 24px; }
.timeline > li::before {
  content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent);
}
.timeline > li.edu::before { background: var(--text); }
/* Año de inicio a la izquierda de la línea (solo escritorio; en celular ya está en la línea de fechas) */
@media (min-width: 760px) {
  .timeline { margin-left: 96px; }
  .timeline > li::after { content: attr(data-year); content: attr(data-year) / ""; position: absolute; left: -104px; top: 1px; width: 76px; text-align: right; color: var(--muted); font-size: 15px; font-weight: 700; letter-spacing: 0.5px; }
  .timeline > li:first-child::after { color: var(--accent-text); }
}
/* La línea se llena de rojo a medida que se baja por la experiencia (scroll nativo de CSS, sin JS) */
.timeline { position: relative; }
@supports (animation-timeline: view()) {
  .timeline::before { content: ""; position: absolute; left: -2px; top: 0; width: 2px; height: 100%; background: var(--accent); transform-origin: top; animation: fill-line linear both; animation-timeline: view(); animation-range: cover 10% cover 70%; }
}
@keyframes fill-line { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Secciones numeradas: 01, 02… en rojo junto al título */
main { counter-reset: sec; }
main > section:not(.hero) { counter-increment: sec; }
main > section:not(.hero) > h2::before { content: counter(sec, decimal-leading-zero); content: counter(sec, decimal-leading-zero) / ""; display: block; color: var(--accent-text); font-size: 14px; font-weight: 700; letter-spacing: 2px; margin-bottom: 4px; }
.meta { color: var(--muted); font-size: 14px; }
.timeline > li > ul { list-style: none; padding: 0; margin-top: 8px; color: var(--text-2); }
.timeline > li > ul li { position: relative; padding-left: 18px; }
.timeline > li > ul li::before { content: ""; position: absolute; left: 0; top: 0.8em; width: 8px; height: 2px; background: var(--accent); }
.timeline > li > ul li + li { margin-top: 6px; }

.skill-groups { display: grid; gap: 36px; }
.skill-groups h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); margin-bottom: 12px; }
.skill-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.skill-grid li {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 8px;
  background: rgba(20, 20, 20, 0.75); border: 1px solid #222; border-radius: 8px;
  font-size: 13px; text-align: center; color: var(--text-2);
}
.skill-grid .wide { grid-column: span 2; }
.skill-grid i {
  width: 32px; height: 32px; background: var(--text);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.i-aws { --icon: url(icons/amazonwebservices.svg); }
.i-lambda { --icon: url(icons/awslambda.svg); }
.i-serverless { --icon: url(icons/serverless.svg); }
.i-sqs { --icon: url(icons/amazonsqs.svg); }
.i-apigw { --icon: url(icons/amazonapigateway.svg); }
.i-ecs { --icon: url(icons/amazonecs.svg); }
.i-node { --icon: url(icons/nodedotjs.svg); }
.i-ts { --icon: url(icons/typescript.svg); }
.i-js { --icon: url(icons/javascript.svg); }
.i-nest { --icon: url(icons/nestjs.svg); }
.i-react { --icon: url(icons/react.svg); }
.i-angular { --icon: url(icons/angular.svg); }
.i-ionic { --icon: url(icons/ionic.svg); }
.i-pg { --icon: url(icons/postgresql.svg); }
.i-mysql { --icon: url(icons/mysql.svg); }
.i-mongo { --icon: url(icons/mongodb.svg); }
.i-dynamo { --icon: url(icons/amazondynamodb.svg); }
.i-cloudwatch { --icon: url(icons/amazoncloudwatch.svg); }
.i-jest { --icon: url(icons/jest.svg); }
.i-terraform { --icon: url(icons/terraform.svg); }
.i-docker { --icon: url(icons/docker.svg); }
.i-gha { --icon: url(icons/githubactions.svg); }
.i-datadog { --icon: url(icons/datadog.svg); }
.i-bun { --icon: url(icons/bun.svg); }
.i-gemini { --icon: url(icons/googlegemini.svg); }
.i-gcp { --icon: url(icons/googlecloud.svg); }
.i-svelte { --icon: url(icons/svelte.svg); }

.case, .quote, .project { margin: 0; padding: 24px; background: rgba(20, 20, 20, 0.75); border-left: 3px solid var(--accent); }
.case h3 { font-size: 1.25rem; margin-bottom: 4px; }
.case-context { color: var(--muted); font-size: 14px; margin-bottom: 16px; } /* deja claro que es del trabajo actual, no de tialuk */
.project h3 { font-size: 1.5rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-2); border: 1px solid #444; border-radius: 999px; padding: 2px 10px; }
.project .lead { color: var(--text); margin: 8px 0 20px; }
.project dd ul { list-style: none; padding: 0; }
.project dd li { position: relative; padding-left: 18px; }
.project dd li + li { margin-top: 6px; }
.project dd li::before { content: ""; position: absolute; left: 0; top: 0.8em; width: 8px; height: 2px; background: var(--accent); }
/* Diagrama del flujo de tialuk: fila en escritorio, columna en celular; las flechas son parte del CSS */
.flow { margin: 0 0 24px; }
.flow figcaption { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.flow ol { list-style: none; padding: 0; display: flex; gap: 22px; counter-reset: step; }
.flow li { position: relative; flex: 1 1 0; min-width: 0; padding: 12px; border: 1px solid #2a2a2a; border-top: 2px solid var(--accent); background: rgba(10, 10, 10, 0.6); counter-increment: step; }
.flow li::before { content: counter(step); content: counter(step) / ""; display: block; color: var(--accent-text); font-size: 12px; font-weight: 700; }
.flow li + li::after { content: "→"; content: "→" / ""; position: absolute; left: -19px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 17px; font-weight: 700; }
.flow b { display: block; font-size: 14px; margin: 2px 0 4px; }
.flow span { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .flow ol { flex-direction: column; gap: 18px; }
  .flow li + li::after { content: "↓"; content: "↓" / ""; left: 50%; top: -21px; transform: translateX(-50%); font-size: 18px; }
}
.figures { list-style: none; padding: 0; margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px 32px; }
.figures strong { display: block; font-size: 1.5rem; color: var(--accent); }
.figures span { color: var(--muted); font-size: 14px; }
.case dl, .project dl { display: grid; grid-template-columns: 120px 1fr; gap: 12px 20px; }
.case dt, .project dt { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; padding-top: 3px; }
.case dd, .project dd { margin: 0; color: var(--text-2); }
@media (max-width: 600px) { .case dl, .project dl { grid-template-columns: 1fr; gap: 4px; } .case dd + dt, .project dd + dt { margin-top: 10px; } }
.tags-line { margin-top: 18px; color: var(--muted); font-size: 14px; }
.quote blockquote { margin: 0; font-size: 1.125rem; line-height: 1.7; }
.quote figcaption { margin-top: 14px; color: var(--muted); font-size: 14px; }
.quote figcaption a { color: var(--text-2); text-decoration: underline 1px var(--accent); text-underline-offset: 4px; }

/* Página de artículo (writing/): columna de lectura angosta, sin 3D */
.article { position: relative; max-width: 720px; margin: 0 auto; padding: 110px 16px 64px; }
.article-meta { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.article h1 { font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.15; }
.article-subtitle { color: var(--text-2); font-size: 1.15rem; margin: 14px 0 36px; }
.article h2 { font-size: 1.55rem; margin: 44px 0 14px; }
.article h2::after { width: 32px; height: 2px; margin-top: 6px; }
.article h3 { font-size: 1.15rem; margin: 28px 0 10px; }
.article p, .article ul { color: var(--text-2); margin-bottom: 16px; }
.article ul { padding-left: 20px; }
.article li + li { margin-top: 6px; }
.article strong { color: var(--text); }
.article code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; background: #1a1a1a; border: 1px solid #262626; border-radius: 4px; padding: 1px 5px; }
.article pre { margin: 0 0 20px; padding: 16px 18px; background: #111; border: 1px solid #222; border-left: 3px solid var(--accent); overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.article pre code { background: none; border: 0; padding: 0; font-size: inherit; color: #e6e6e6; }
.article-end { margin-top: 48px; padding-top: 20px; border-top: 1px solid #222; }
.article-end a, .readmore { color: var(--text); text-decoration: underline 2px var(--accent); text-underline-offset: 5px; font-weight: 600; }
.readmore { display: inline-block; margin-top: 18px; }
.readmore + .readmore { margin-left: 24px; }

.writing { list-style: none; padding: 0; display: grid; gap: 16px; }
.writing li { padding: 20px 24px; background: rgba(20, 20, 20, 0.75); border-left: 3px solid var(--accent); }
.writing a { font-size: 1.125rem; font-weight: 700; text-decoration: underline 2px var(--accent); text-underline-offset: 5px; }
.writing p { color: var(--text-2); margin-top: 8px; }
.writing .meta { color: var(--muted); margin-top: 6px; }

/* blanco con subrayado rojo: el rojo como texto sobre negro no llega al contraste AA */
.links { list-style: none; padding: 0; display: flex; gap: 20px; margin-top: 16px; flex-wrap: wrap; }
.links a { font-weight: 600; text-decoration: underline 2px var(--accent); text-underline-offset: 5px; }
.links a:hover { text-decoration-thickness: 4px; }

footer { text-align: center; color: var(--muted); padding: 32px 16px; font-size: 14px; }

/* "pending" lo pone main.js: sin JS el contenido se ve igual */
.reveal { transition: opacity .8s, transform .8s; }
.reveal.pending { opacity: 0; transform: translateY(24px); }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.pending { opacity: 1; transform: none; transition: none; }
  .timeline::before { animation: none; transform: none; }
  .hero::before { animation: none; }
  html { scroll-behavior: auto; }
}

/* Versión imprimible: de acá salen los PDF del CV (los genera tools/generar.mjs) */
@media print {
  @page { size: A4; margin: 10mm 15mm; }
  body { background: #fff; color: #111; font-size: 9.8pt; line-height: 1.32; } /* justo para que entre en 2 páginas en los dos idiomas */
  #scene, .nav, .skip, .actions, .eyebrow, .portrait, .stats, #contact, #recommendation, #writing, footer, .timeline > li::before { display: none !important; } /* la recomendación luce en el sitio; en el CV le quita lugar a las skills */
  .print-only { display: block; }
  a { color: inherit; text-decoration: none; }
  .hero { min-height: 0; display: block; justify-items: normal; }
  .hero::before { display: none; }
  .hero-text { margin: 0; padding: 0; max-width: none; text-align: left; }
  h1 { font-size: 22pt; color: #111; }
  h1 br { display: none; }
  .role { color: #333; font-size: 11.5pt; margin: 2pt 0; max-width: none; }
  .contact-line { color: #444; font-size: 9.5pt; }
  .contact-line span { white-space: nowrap; } /* cada dato entero: la URL de LinkedIn no se corta */
  .reveal, .reveal.pending { opacity: 1 !important; transform: none !important; transition: none; }
  section:not(.hero) { max-width: none; margin: 8pt 0 0; padding: 0; }
  h2 { font-size: 12pt; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6pt; padding-bottom: 3pt; border-bottom: 1.5pt solid var(--accent); }
  h2::after { display: none; }
  .about-grid { display: block; }
  /* en el CV la experiencia va antes que el caso y el proyecto: es lo primero que busca un recruiter */
  main { display: flex; flex-direction: column; }
  .hero { order: 0; } #about { order: 1; } #experience { order: 2; } #case { order: 3; } #project { order: 4; } #recommendation { order: 5; } #skills { order: 6; }
  h2, h3, dt { break-after: avoid; }
  .quote, .figures { break-inside: avoid; }
  .project .lead { display: none; } /* repite "La idea" */
  .flow { display: none; } /* en el CV ya lo cuenta "Qué construí" */
  .timeline { margin-left: 0; }
  .timeline::before, .timeline > li::after, main > section:not(.hero) > h2::before { display: none !important; }
  .readmore { display: none; }
  .case, .quote, .project { background: none; padding: 0; border: 0; }
  .project h3 { font-size: 11pt; }
  .badge { font-size: 7.5pt; color: #555; border-color: #999; letter-spacing: 0; }
  .project .lead { color: #222; font-size: 10pt; margin: 3pt 0 6pt; }
  .project dl { grid-template-columns: 70pt 1fr; gap: 2pt 10pt; }
  .project dt { font-size: 8.5pt; color: #555; letter-spacing: 0; }
  .project dd { color: #222; font-size: 10pt; }
  .figures { margin-top: 6pt; gap: 2pt 16pt; }
  .figures strong { display: inline; font-size: 10pt; margin-right: 4pt; }
  .figures span { color: #555; font-size: 9pt; }
  .case h3 { font-size: 11pt; margin-bottom: 1pt; }
  .case-context { color: #555; font-size: 9pt; margin-bottom: 4pt; }
  .case dl { grid-template-columns: 70pt 1fr; gap: 2pt 10pt; }
  .case dt { font-size: 8.5pt; color: #555; letter-spacing: 0; }
  .case dd, .quote blockquote { color: #222; font-size: 10pt; }
  .tags-line { margin-top: 4pt; color: #555; font-size: 9pt; }
  .quote figcaption { margin-top: 4pt; color: #555; font-size: 9pt; }
  .quote figcaption a { color: inherit; text-decoration: none; }
  .quote blockquote { line-height: 1.38; }
  .project dd li + li, .timeline > li > ul li + li { margin-top: 2pt; }
  #about p + p { margin-top: 5pt; }
  .timeline { border: 0; }
  .timeline > li { padding: 0 0 5pt; break-inside: avoid; }
  .timeline h3 { font-size: 11pt; }
  .meta { color: #555; font-size: 9.5pt; }
  .timeline > li > ul { color: #222; margin-top: 3pt; }
  .timeline > li > ul li + li { margin-top: 2pt; }
  .skill-groups { display: block; }
  .skill-groups > div { display: flex; gap: 8pt; margin-bottom: 3pt; }
  .skill-groups h3 { flex: 0 0 120pt; margin: 0; font-size: 9pt; color: #555; letter-spacing: 0; } /* los ATS leen "C L O U D" si hay espaciado */
  .skill-grid { display: block; }
  .skill-grid li { display: inline; padding: 0; border: 0; background: none; color: #111; font-size: 10pt; }
  .skill-grid li + li::before { content: " · "; }
  .skill-grid i { display: none; }
}
