/* =========================================================
   Portfolio · Antonio Cuadrado
   Un solo archivo CSS. Colores en variables para cambiarlos fácil.
   ========================================================= */

:root {
  --bg: #0b1222;          /* fondo navy (como mis tarjetas) */
  --bg-soft: #111a2e;     /* fondo de las tarjetas */
  --border: #1f2b45;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;      /* cian */
  --accent-2: #818cf8;    /* índigo para los degradados */
  --orange: #ff6b1a;      /* naranja Krealo3D */
  --radius: 16px;
  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  overflow-x: hidden;
}

img, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.section { padding: 96px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.mono { font-family: var(--mono); }
.accent { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Botones y etiquetas ---------- */
.btn {
  position: relative;
  display: inline-block;
  overflow: hidden;
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04101f;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgb(56 189 248 / 0.35); }

/* Brillo que cruza el botón al pasar el ratón */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgb(255 255 255 / 0.45), transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s;
}
.btn:hover::after { transform: translateX(120%); }

.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); box-shadow: none; }
.btn-small { padding: 8px 16px; font-size: 0.9rem; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li, .chips li {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgb(56 189 248 / 0.06);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.link { color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; }

.kicker {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.2; }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-top: 8px; }
h3 { font-size: 1.2rem; margin-bottom: 8px; }

.section-head { max-width: 720px; margin-bottom: 48px; }
.section-head .muted { margin-top: 12px; }

.gradient-text {
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s linear infinite;
}

/* ---------- Tarjetas ---------- */
.card {
  position: relative;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgb(56 189 248 / 0.5);
  box-shadow: 0 20px 40px rgb(0 0 0 / 0.35);
}
.card p { color: var(--muted); }

.icon, .project-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: rgb(56 189 248 / 0.1);
}
.icon svg, .project-icon svg, .contact-links svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Cabecera ---------- */
.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  transition: background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}
.header.scrolled {
  background: rgb(11 18 34 / 0.8);
  backdrop-filter: blur(12px);
  border-color: var(--border);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 72px; }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.logo-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.nav { display: flex; align-items: center; gap: 28px; margin-left: auto; }
.nav a:not(.btn) { color: var(--muted); font-weight: 500; transition: color 0.2s; }
.nav a:not(.btn):hover, .nav a:not(.btn)[aria-current="page"] { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 12px; }
.lang-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.8rem;
  cursor: pointer;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }

.menu-btn { display: none; flex-direction: column; gap: 5px; padding: 8px; border: 0; background: none; cursor: pointer; }
.menu-btn span { width: 22px; height: 2px; background: var(--text); transition: transform 0.3s, opacity 0.3s; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding: 120px 0 64px;
  overflow: hidden;
  isolation: isolate; /* las luces de fondo (z-index: -1) quedan dentro del hero */
}

/* Rejilla y luces de fondo animadas */
.hero::before, .hero::after {
  content: "";
  position: absolute;
  z-index: -1;
}
.hero::before {
  inset: 0;
  background-image:
    linear-gradient(rgb(56 189 248 / 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgb(56 189 248 / 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, #000, transparent 70%);
}
.hero::after {
  width: 600px;
  height: 600px;
  top: -10%;
  right: -10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(56 189 248 / 0.25), rgb(129 140 248 / 0.12) 40%, transparent 70%);
  filter: blur(40px);
  animation: float 12s ease-in-out infinite;
}

.hero-inner { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 48px; }

.tag {
  display: inline-block;
  padding: 6px 14px;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  background: rgb(56 189 248 / 0.08);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  box-shadow: 0 0 20px rgb(56 189 248 / 0.2);
}

.hero h1 { margin-top: 24px; font-size: clamp(2.6rem, 7vw, 4.5rem); font-weight: 800; letter-spacing: -0.02em; }
.hero-hello { display: block; color: var(--muted); font-size: 0.4em; font-weight: 500; letter-spacing: 0; }
.hero-role { margin-top: 12px; color: var(--accent); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.hero-lead { max-width: 560px; margin-top: 16px; color: var(--muted); font-size: 1.15rem; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }

.hero-visual { position: relative; justify-self: center; }

/* Foto con un anillo de degradado que gira */
.photo-ring {
  position: relative;
  width: min(340px, 70vw);
  aspect-ratio: 1;
  padding: 6px;
  border-radius: 50%;
}
.photo-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--accent), var(--accent-2), transparent, var(--accent));
  animation: spin 8s linear infinite;
}
.photo-ring img {
  position: relative;
  width: 100%;
  height: 100%;
  border: 6px solid var(--bg);
  border-radius: 50%;
  object-fit: cover;
}

.code-card {
  position: absolute;
  right: -24px;
  bottom: -16px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgb(17 26 46 / 0.9);
  backdrop-filter: blur(8px);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  box-shadow: 0 20px 40px rgb(0 0 0 / 0.4);
  animation: float 6s ease-in-out infinite;
}
.c-key { color: var(--accent-2); }
.c-str { color: var(--accent); }

/* ---------- Sobre mí y servicios ---------- */
.about { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; }
.about-text p { margin-bottom: 16px; color: var(--muted); font-size: 1.05rem; }
.services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 48px; }

/* ---------- Proyectos ---------- */
.featured { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; padding: 24px; margin-bottom: 32px; }
.featured-image, .project-image { display: block; overflow: hidden; border-radius: 12px; border: 1px solid var(--border); }
.featured-image { align-self: start; } /* mantiene la proporción de la captura */
.featured-image img, .project-image img {
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  transition: transform 0.6s;
}
.featured:hover img, .project:hover img { transform: scale(1.04); }
.featured-body { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.featured-body h3 { font-size: 1.8rem; margin: 0; }

.badge, .status {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.check-list li { position: relative; padding-left: 28px; margin-bottom: 6px; color: var(--muted); }
/* Lista de puntos fuertes en dos columnas (proyecto destacado) */
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; width: 100%; }

/* Cifra destacada (nota de PageSpeed de Yusera) */
.stat {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 14px 18px;
  border: 1px solid rgb(56 189 248 / 0.35);
  border-radius: 12px;
  background: linear-gradient(135deg, rgb(56 189 248 / 0.1), rgb(129 140 248 / 0.08));
}
.stat-value {
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  animation: shine 6s linear infinite;
}
.stat-label { color: var(--text); font-weight: 600; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.project { display: flex; flex-direction: column; gap: 12px; }
.project h3 { margin: 0; }
.project .project-image img { aspect-ratio: 16 / 9; }
.project .link { margin-top: auto; }

/* ---------- Demos ---------- */
.demo { margin-bottom: 32px; }
.demo:hover { transform: none; } /* no mover la tarjeta mientras se juega */
.demo-head { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.demo-head p { max-width: 720px; }
.demo-head .link { white-space: nowrap; }

.demo-toolbar, .ps-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.demo-toolbar label, .ps-speed { display: flex; align-items: center; gap: 8px; color: var(--muted); }

select, input, textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  transition: border-color 0.2s;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(56 189 248 / 0.25); }
input[type="range"] { padding: 0; accent-color: var(--accent); }

/* so_long */
.sl-hud { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 12px; font-size: 0.9rem; color: var(--muted); }
.sl-hud b { color: var(--text); }
.sl-hud .p1 strong { color: var(--accent); }
.sl-hud .p2 strong { color: var(--orange); }

.sl-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #050a14;
}
.sl-stage:focus-visible { outline-offset: 0; }
.sl-stage canvas { width: 100%; height: auto; image-rendering: auto; }

.sl-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: rgb(5 10 20 / 0.75);
  backdrop-filter: blur(3px);
  text-align: center;
  font-weight: 700;
  font-size: 1.2rem;
  transition: opacity 0.3s;
}
.sl-overlay.hidden { opacity: 0; pointer-events: none; }

.touch-pads { display: none; justify-content: space-between; gap: 16px; margin-top: 16px; }
.pad {
  display: grid;
  grid-template-areas: ". up ." "left label right" ". down .";
  gap: 6px;
}
.pad button {
  width: 52px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 1.1rem;
  touch-action: manipulation;
}
.pad button:active { background: rgb(56 189 248 / 0.2); }
.pad [data-dir="0"] { grid-area: up; }
.pad [data-dir="1"] { grid-area: down; }
.pad [data-dir="2"] { grid-area: left; }
.pad [data-dir="3"] { grid-area: right; }
.pad-label { grid-area: label; display: grid; place-items: center; font-weight: 700; color: var(--accent); }
.pad[data-player="1"] .pad-label { color: var(--orange); }

/* push_swap */
.ps-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.ps-input { display: flex; flex: 1 1 280px; flex-direction: column; gap: 6px; color: var(--muted); font-size: 0.9rem; }
.ps-input input { font-family: var(--mono); }
.ps-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.ps-error { min-height: 1.6em; color: #f87171; font-size: 0.9rem; }
.ps-stats { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 16px; color: var(--muted); font-size: 0.9rem; }
.ps-stats b { color: var(--text); }
.ps-stacks { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ps-stacks figure { border: 1px solid var(--border); border-radius: 12px; background: #050a14; overflow: hidden; }
.ps-stacks figcaption { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }
.ps-stacks canvas { width: 100%; height: 320px; }

/* ---------- Cabecera de las páginas interiores ---------- */
.page-head { position: relative; padding: 150px 0 40px; isolation: isolate; overflow: hidden; }
.page-head::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 500px;
  height: 500px;
  top: -60%;
  left: -10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(56 189 248 / 0.18), transparent 70%);
  filter: blur(40px);
}
.page-head h1 { margin-top: 8px; font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.02em; }
.page-head-inner { display: flex; align-items: center; gap: 32px; }
.avatar { width: 120px; height: 120px; border-radius: 50%; border: 3px solid var(--accent); object-fit: cover; flex-shrink: 0; }
.lead { max-width: 680px; margin-top: 16px; color: var(--muted); font-size: 1.15rem; }
.page-first { padding-top: 150px; }
.section-tight { padding: 48px 0; }
.narrow { max-width: 760px; }

/* ---------- Inicio: enlaces a otras páginas y llamada a la acción ---------- */
.teaser-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.teaser { display: flex; flex-direction: column; gap: 8px; }
.teaser h3 { margin: 0; }
.teaser .link { margin-top: auto; padding-top: 8px; }
#featured-project + .link { display: inline-block; margin-top: 8px; }

.cta {
  padding: 56px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 20% 0%, rgb(56 189 248 / 0.18), transparent 50%),
    radial-gradient(circle at 80% 100%, rgb(129 140 248 / 0.18), transparent 50%),
    var(--bg-soft);
  text-align: center;
}
.cta p { max-width: 560px; margin: 12px auto 28px; color: var(--muted); }

/* ---------- Proyectos: filtros y enlaces ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.filter:hover { color: var(--accent); border-color: var(--accent); }
.filter.active { background: var(--accent); border-color: var(--accent); color: #04101f; font-weight: 700; }
.project-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: auto; }

/* ---------- Sobre mí: experiencia (línea de tiempo) y formación ---------- */
.timeline { position: relative; list-style: none; padding-left: 32px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--accent-2), transparent);
}
.timeline-item { position: relative; padding-bottom: 40px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 6px;
  width: 16px;
  height: 16px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.timeline-item p { color: var(--muted); margin-bottom: 8px; }
.timeline-date { color: var(--accent) !important; font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }

.edu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.edu h3 { font-size: 1.05rem; }
.edu .accent { margin-bottom: 4px; font-weight: 600; }
.extra-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ---------- Stack / aptitudes ---------- */
.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.stack-grid h3 { margin-bottom: 16px; }

/* ---------- Más allá: bloques texto + visual ---------- */
.feature { display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 56px; }
.feature-reverse .feature-text { order: 2; }
.feature-text p { margin-top: 16px; color: var(--muted); }
.feature-text .check-list { margin-top: 20px; }
.feature-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.kicker-orange { color: var(--orange); }
.check-orange li::before { color: var(--orange); }
.btn-orange { background: linear-gradient(135deg, var(--orange), #ff9d4d); }
.btn-orange:hover { box-shadow: 0 8px 28px rgb(255 107 26 / 0.35); }

.feature-visual {
  display: grid;
  place-items: center;
  gap: 24px;
  min-height: 320px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 30%, rgb(56 189 248 / 0.12), transparent 60%), var(--bg-soft);
}
.visual-caption { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }

/* Ecualizador: cada barra sube y baja con un retraso distinto */
.equalizer { display: flex; align-items: flex-end; gap: 10px; height: 160px; }
.equalizer span {
  width: 14px;
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(var(--accent-2), var(--accent));
  transform-origin: bottom;
  animation: equalize 1.2s ease-in-out infinite;
}
.equalizer span:nth-child(2n) { animation-duration: 0.9s; }
.equalizer span:nth-child(3n) { animation-duration: 1.5s; }
.equalizer span:nth-child(1) { animation-delay: -0.2s; }
.equalizer span:nth-child(2) { animation-delay: -0.6s; }
.equalizer span:nth-child(3) { animation-delay: -0.1s; }
.equalizer span:nth-child(4) { animation-delay: -0.9s; }
.equalizer span:nth-child(5) { animation-delay: -0.4s; }
.equalizer span:nth-child(6) { animation-delay: -0.7s; }
.equalizer span:nth-child(7) { animation-delay: -0.3s; }
.equalizer span:nth-child(8) { animation-delay: -1s; }
.equalizer span:nth-child(9) { animation-delay: -0.5s; }

/* Cubo 3D: seis caras colocadas con rotate + translateZ */
.visual-print { background: radial-gradient(circle at 50% 30%, rgb(255 107 26 / 0.14), transparent 60%), var(--bg-soft); }
.visual-print { perspective: 800px; }
.cube { position: relative; width: 140px; height: 140px; transform-style: preserve-3d; animation: cube-spin 10s linear infinite; }
.face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--orange);
  background: #1d1714; /* opaco: así no se ven las letras de la cara de atrás */
  color: var(--orange);
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 700;
}
.front { transform: translateZ(70px); }
.back { transform: rotateY(180deg) translateZ(70px); }
.right { transform: rotateY(90deg) translateZ(70px); }
.left { transform: rotateY(-90deg) translateZ(70px); }
.top { transform: rotateX(90deg) translateZ(70px); }
.bottom { transform: rotateX(-90deg) translateZ(70px); }

/* Terminal con cursor parpadeante */
.terminal { width: 100%; padding: 24px; border-radius: 12px; background: #050a14; font-family: var(--mono); font-size: 0.85rem; line-height: 1.8; overflow-x: auto; }
.cursor { color: var(--accent); animation: blink 1s steps(1) infinite; }
.demo-title { font-size: 1.4rem; margin: 0 0 8px; }

/* ---------- Sobre mí: "¿Por qué programo?" y "Así soy" ---------- */
.why {
  position: relative;
  margin-top: 40px;
  padding: 32px 32px 32px 40px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(90deg, rgb(56 189 248 / 0.08), transparent);
}
/* Comillas grandes decorativas */
.why::before {
  content: "“";
  position: absolute;
  top: -18px;
  right: 24px;
  color: rgb(56 189 248 / 0.25);
  font-size: 7rem;
  line-height: 1;
  font-family: Georgia, serif;
}
.why-text { margin-top: 12px; font-size: 1.25rem; line-height: 1.6; }

.traits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.trait-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: rgb(56 189 248 / 0.1);
  font-size: 1.6rem;
  transition: transform 0.3s;
}
/* Pequeño "saludo" del icono al pasar el ratón */
.trait:hover .trait-icon { transform: rotate(-8deg) scale(1.1); }

/* ---------- Currículum ---------- */
.cv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 28px; }
.cv-note { margin-top: 12px; }
.cv-link { margin-top: 20px; }
/* Contenedor del iframe: su alto lo calcula cv-viewer.js según la escala */
.cv-viewer { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.cv-viewer iframe { display: block; margin: 0 auto; border: 0; transform-origin: top left; }

/* ---------- Contacto ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: start; }
.contact-info .muted { margin: 16px 0 24px; }
.contact-links { display: flex; flex-direction: column; gap: 14px; }
.contact-links a { display: inline-flex; align-items: center; gap: 12px; color: var(--muted); transition: color 0.2s; }
.contact-links a:hover { color: var(--accent); }

.contact-form { display: flex; flex-direction: column; gap: 16px; }
.contact-form:hover { transform: none; }
.contact-form .field { display: flex; flex-direction: column; gap: 6px; }
.contact-form label { color: var(--muted); font-size: 0.9rem; }
.contact-form input.invalid:focus, .contact-form textarea.invalid:focus { box-shadow: 0 0 0 3px rgb(248 113 113 / 0.35); }
.send-btn:disabled { opacity: 0.7; cursor: progress; }
.hp { display: none; } /* campo trampa contra spam */

/* Texto solo para lectores de pantalla */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Botón de WhatsApp */
.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
}
.whatsapp-btn:hover { box-shadow: 0 8px 28px rgb(37 211 102 / 0.35); }
.whatsapp-btn svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.contact-form textarea { resize: vertical; }
.contact-form input.invalid, .contact-form textarea.invalid { border-color: #f87171; }
.field-error { min-height: 1em; color: #f87171; font-size: 0.8rem; }
.form-hint { color: var(--muted); font-size: 0.85rem; }

/* El botón de enviar está oculto hasta que el formulario sea válido */
.send-btn { display: none; width: 100%; animation: pop 0.35s ease-out; }
.send-btn.visible { display: block; }
.form-success { color: var(--accent); font-size: 0.95rem; font-weight: 600; }

/* Etiqueta del mensaje con el contador de caracteres a la derecha */
.label-row { display: flex; justify-content: space-between; gap: 12px; }
.char-count { font-family: var(--mono); font-size: 0.75rem; transition: color 0.2s; }
.char-count.near-limit { color: #fbbf24; }

/* Panel tras enviar: alternativas por si no se abre la aplicación de correo */
.form-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgb(56 189 248 / 0.35);
  border-radius: 12px;
  background: rgb(56 189 248 / 0.06);
  animation: pop 0.35s ease-out;
}
.form-result[hidden] { display: none; }
.fallback-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.text-btn { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; }
.text-btn:hover { text-decoration: underline; }

/* ---------- Pie ---------- */
.footer { padding: 32px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 0.9rem; }

/* ---------- Animación al hacer scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

/* En el hero los elementos aparecen uno detrás de otro */
.hero-text .reveal:nth-child(2) { transition-delay: 0.1s; }
.hero-text .reveal:nth-child(3) { transition-delay: 0.2s; }
.hero-text .reveal:nth-child(4) { transition-delay: 0.3s; }
.hero-text .reveal:nth-child(5) { transition-delay: 0.4s; }
.hero-text .reveal:nth-child(6) { transition-delay: 0.5s; }
.hero-visual.reveal { transition-delay: 0.3s; }

/* ---------- Keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-14px); } }
@keyframes shine { to { background-position: 200% center; } }
@keyframes pop { from { opacity: 0; transform: scale(0.95); } }
@keyframes equalize { 0%, 100% { transform: scaleY(0.2); } 50% { transform: scaleY(1); } }
@keyframes cube-spin { from { transform: rotateX(-20deg) rotateY(0); } to { transform: rotateX(-20deg) rotateY(360deg); } }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner, .about, .featured, .contact { grid-template-columns: 1fr; }
  .hero-visual { order: -1; }
  .services, .teaser-grid, .extra-grid, .feature { grid-template-columns: 1fr; }
  .feature-reverse .feature-text { order: 0; }
  .feature { gap: 32px; }
  .code-card { right: -8px; }
}

/* Menú desplegable (hamburguesa) en tablets y móviles: con 7 enlaces no caben en una fila */
@media (max-width: 1024px) {
  .menu-btn { display: flex; }
  .header-actions { margin-left: auto; }

  .nav {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    background: rgb(11 18 34 / 0.97);
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    visibility: hidden;
    transition: transform 0.35s, visibility 0s 0.35s;
    z-index: -1;
  }
  .nav.open { transform: none; visibility: visible; transition: transform 0.35s; }
  .menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

@media (max-width: 760px) {
  .section { padding: 72px 0; }
  .card { padding: 20px; }
  .demo-head { flex-direction: column; }
  .sl-overlay { gap: 8px; font-size: 0.95rem; }
  .pad button { width: 42px; height: 42px; }
  .ps-stacks canvas { height: 220px; }
  .code-card { display: none; }
  .page-head { padding-top: 120px; }
  .page-head-inner { flex-direction: column; align-items: flex-start; gap: 20px; }
  .avatar { width: 88px; height: 88px; }
  .page-first { padding-top: 120px; }
  .feature-visual { min-height: 240px; }
  .cta { padding: 40px 20px; }
}

/* Los controles táctiles solo aparecen en dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
  .touch-pads { display: flex; }
}

/* Respeta a quien prefiere menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
}

/* "Cómo trabajo": resto de soft skills como etiquetas, debajo de las tarjetas */
.soft-title { margin-top: 40px; margin-bottom: 16px; color: var(--muted); font-size: 1rem; font-weight: 600; }
.soft-skills { margin-top: 0; }

/* Página 404: ocupa casi toda la pantalla */
.not-found { min-height: 70vh; display: flex; align-items: center; }
