/* Portfolio Iñaki Santos · estilo "canvas" no-code · azul claro */
:root {
  --bg: #eaf6ff;
  --dot: #b7dbf5;
  --blue-100: #d6ecff;
  --blue-300: #8ccbff;
  --blue-500: #2f9bf5;
  --blue-700: #1769b8;
  --ink: #0e2236;
  --muted: #4b6277;
  --white: #fff;
  --yellow: #ffe27a;
  --green: #5fd49b;
  --radius: 18px;
  --shadow: 6px 6px 0 var(--blue-300);
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.4px, transparent 1.4px);
  background-size: 26px 26px;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
ul { list-style: none; margin: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.center { text-align: center; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 12px; z-index: 50;
  width: min(1120px, 100% - 24px);
  margin: 12px auto 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px 8px 10px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--blue-300);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-head); font-weight: 700; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px;
  background: var(--blue-500); color: #fff; border-radius: 10px; font-size: 15px;
}
.menu { display: flex; gap: 4px; }
.menu a {
  text-decoration: none; font-weight: 500; font-size: 15px;
  padding: 6px 12px; border-radius: 999px; transition: background .2s;
}
.menu a:hover { background: var(--blue-100); }
.lang { display: flex; gap: 2px; background: var(--blue-100); padding: 3px; border-radius: 999px; }
.lang-btn {
  font: 600 13px var(--font-body); border: 0; background: transparent; color: var(--ink);
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
}
.lang-btn.is-on { background: var(--ink); color: #fff; }

/* ---------- Nodos (tarjetas) ---------- */
.node {
  position: relative;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.node-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  border-bottom: 2px solid var(--ink);
  background: var(--blue-100);
  border-radius: 16px 16px 0 0;
  font: 500 13px/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: .02em;
}
.node-body { padding: 22px 24px 24px; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-blue { background: var(--blue-500); }
.port {
  position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  background: #fff; border: 2px solid var(--ink); border-radius: 50%; z-index: 2;
}
.port-l { left: -8px; }
.port-r { right: -8px; }

/* Cable vertical entre secciones */
.wire {
  position: relative; width: 2px; height: 64px; margin: 0 auto;
  background-image: linear-gradient(var(--ink) 55%, transparent 55%);
  background-size: 2px 10px;
}
.wire::before, .wire::after {
  content: ""; position: absolute; left: -6px; width: 14px; height: 14px;
  background: #fff; border: 2px solid var(--ink); border-radius: 50%;
}
.wire::before { top: -7px; }
.wire::after { bottom: -7px; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr); gap: 48px; align-items: center; padding: 64px 0 56px; }
.hero-node .node-body { padding: 30px 32px 32px; }
.typed-line {
  font: 500 17px/1.4 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color: var(--blue-700); margin-bottom: 14px; min-height: 1.4em;
}
.caret { display: inline-block; width: 2px; height: 1.1em; background: var(--ink); margin-left: 3px; vertical-align: -3px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero h1 { font-size: clamp(34px, 5.2vw, 56px); letter-spacing: -.02em; }
.hero h1 mark { background: linear-gradient(transparent 60%, var(--blue-300) 60%); color: inherit; padding: 0 .1em; }
.lead { font-size: 19px; color: var(--muted); max-width: 58ch; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.btn {
  display: inline-block; text-decoration: none; font: 600 16px var(--font-body);
  padding: 12px 22px; border: 2px solid var(--ink); border-radius: 12px;
  transition: transform .15s, box-shadow .15s;
}
.btn-primary { background: var(--blue-500); color: #fff; box-shadow: 4px 4px 0 var(--ink); }
.btn-ghost { background: #fff; box-shadow: 4px 4px 0 var(--blue-300); }
.btn:hover { transform: translate(-2px, -2px); }
.btn-primary:hover { box-shadow: 6px 6px 0 var(--ink); }
.btn-ghost:hover { box-shadow: 6px 6px 0 var(--blue-300); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.social { display: flex; gap: 10px; margin-top: 26px; }
.social a {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--blue-100);
  transition: background .2s, transform .15s;
}
.social a:hover { background: var(--blue-500); transform: translateY(-3px); }
.social a:hover svg { fill: #fff; }
.social svg { width: 20px; height: 20px; fill: var(--ink); }

/* Mini flujo del hero */
.mini-flow { position: relative; display: flex; flex-direction: column; align-items: center; padding: 10px 0 84px; }
.mini-node {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 18px; font: 600 16px var(--font-head);
  background: #fff; border: 2px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--blue-300);
}
.mini-node:nth-child(3) { transform: translateX(14px); }
.mini-node:nth-child(5) { transform: translateX(-6px); }
.chip-sq { width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: 5px; flex: none; }
.sq-yellow { background: var(--yellow); } .sq-blue { background: var(--blue-500); } .sq-green { background: var(--green); }
.mini-wire { width: 2px; height: 30px; background-image: linear-gradient(var(--ink) 55%, transparent 55%); background-size: 2px 8px; }
.sticky {
  background: var(--yellow); border: 2px solid var(--ink); padding: 12px 14px;
  font: 600 14px/1.35 var(--font-head); max-width: 200px;
  transform: rotate(-4deg); box-shadow: 4px 4px 0 rgba(14,34,54,.18);
  position: absolute; right: 4px; bottom: 10px;
}

/* ---------- Secciones ---------- */
.section { padding: 56px 0; }
.section-head { margin-bottom: 36px; max-width: 640px; }
.section-head h2 { font-size: clamp(30px, 4vw, 44px); letter-spacing: -.02em; }
.section-head p { color: var(--muted); font-size: 18px; }
.tag {
  display: inline-block; margin-bottom: 10px; padding: 3px 10px;
  font: 600 13px ui-monospace, Menlo, Consolas, monospace;
  background: var(--ink); color: #fff; border-radius: 6px;
}

/* ---------- Proyectos ---------- */
.grid-projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 36px; }
.project { display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.project:hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--blue-300); }
.project .port { top: 38%; }
.shot { display: block; overflow: hidden; border-bottom: 2px solid var(--ink); border-radius: 16px 16px 0 0; background: var(--blue-100); }
.shot.has-fallback { position: relative; aspect-ratio: 16 / 10; }
.shot.has-fallback img { position: absolute; inset: 0; height: 100%; }
.shot-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, #2f9bf5, #1769b8);
}
.shot-fallback svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.shot-fallback strong { position: relative; font: 700 34px var(--font-head); color: #fff; letter-spacing: -.01em; }
.shot img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; transition: transform .4s; }
.project:hover .shot img { transform: scale(1.04); }
.project .node-body { display: flex; flex-direction: column; flex: 1; }
.project h3 { font-size: 24px; margin-bottom: 8px; }
.project p { color: var(--muted); font-size: 16px; }
.project .for { font-size: 15px; color: var(--ink); margin-top: auto; }
.link {
  align-self: flex-start; margin-top: 6px; font-weight: 600; text-decoration: none;
  border-bottom: 2px solid var(--blue-500); padding-bottom: 1px;
}
.link:hover { background: var(--blue-100); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chips li {
  padding: 3px 12px; font: 500 13px var(--font-body);
  background: var(--blue-100); border: 1.5px solid var(--ink); border-radius: 999px;
}
.chips .chip-beta { background: var(--yellow); }
.chips-lg li { font-size: 15px; padding: 5px 14px; background: #fff; }

/* ---------- Stack ---------- */
.flow {
  display: flex; align-items: stretch; justify-content: center; flex-wrap: wrap;
  gap: 10px; margin-bottom: 44px;
}
.flow-node {
  flex: 1 1 160px; max-width: 200px; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px; background: #fff; border: 2px solid var(--ink); border-radius: 14px;
  box-shadow: 4px 4px 0 var(--blue-300);
}
.flow-node b { font: 700 19px var(--font-head); }
.flow-node small { font-size: 14px; color: var(--muted); line-height: 1.35; }
.arrow { align-self: center; font: 700 24px var(--font-head); color: var(--blue-500); }
.before { max-width: 820px; margin-inline: auto; }
.before p { margin: 18px 0 0; color: var(--muted); }

/* ---------- Sobre mí ---------- */
.about { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 44px; align-items: center; }
.photo { position: relative; margin: 0; }
.photo img {
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
}
.sticky-sm { right: -10px; bottom: -14px; max-width: none; font-size: 13px; padding: 8px 12px; }
.about-node .node-body p { color: var(--ink); }
.about-node .node-body p:last-child { margin-bottom: 0; }

/* ---------- CV ---------- */
.timeline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; margin-bottom: 40px; }
.tl h3 { font-size: 22px; margin-bottom: 2px; }
.tl .role { font-weight: 600; color: var(--blue-700); margin-bottom: 8px; }
.tl .node-body p:last-child { margin-bottom: 0; color: var(--muted); font-size: 16px; }

/* ---------- Contacto ---------- */
.contact { max-width: 860px; margin-inline: auto; text-align: center; background: var(--blue-100); box-shadow: 8px 8px 0 var(--blue-500); }
.contact .node-head { background: #fff; justify-content: center; }
.contact .node-body { padding: 40px 28px 44px; }
.contact h2 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -.02em; }
.contact p { color: var(--muted); font-size: 18px; max-width: 52ch; margin-inline: auto; }
.contact .cta { justify-content: center; margin-top: 22px; }

/* ---------- Footer ---------- */
.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 40px 0 48px; font-size: 15px; color: var(--muted);
}
.footer p { margin: 0; }
.footer a { font-weight: 600; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ---------- Animación de entrada ---------- */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-in { opacity: 1; transform: none; }
.js .grid-projects .reveal:nth-child(even) { transition-delay: .1s; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding-top: 40px; }
  .mini-flow { max-width: 360px; margin-inline: auto; width: 100%; }
  .grid-projects { grid-template-columns: 1fr; max-width: 560px; margin-inline: auto; }
  .project .port { display: none; }
  .about { grid-template-columns: 1fr; gap: 36px; }
  .photo { max-width: 280px; margin-inline: auto; }
  .timeline { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .menu { display: none; }
  .topbar { border-radius: 18px; }
  .arrow { display: none; }
  .flow-node { max-width: none; flex-basis: 45%; }
  .hero-node .node-body { padding: 24px 20px 26px; }
  .node-body { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .project, .shot img, .social a { transition: none; }
}
