:root {
  --fondo: #e9edf0;
  --panel: #f6f8f9;
  --tinta: #14202b;
  --suave: #4a5b69;
  --linea: #c5cdd3;
  --acero: #2f5d7c;
  --senal: #d9560b;
  --fuente-titulo: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --fuente-texto: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #10171d;
    --panel: #172029;
    --tinta: #e6ecf0;
    --suave: #9fb0bd;
    --linea: #2c3a46;
    --acero: #7fb2d4;
    --senal: #ff8a47;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font: 400 1.0625rem/1.65 var(--fuente-texto);
}
a { color: var(--acero); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--senal); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--fuente-titulo); line-height: 1.15; margin: 0; }

.barra {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: center; gap: .5rem 1.5rem;
  padding: .9rem clamp(1rem, 5vw, 4rem); background: var(--fondo);
  border-bottom: 1px solid var(--linea);
}
.marca { font: 700 1.1rem var(--fuente-titulo); color: var(--tinta); text-decoration: none; }
.barra nav { display: flex; flex-wrap: wrap; gap: .25rem 1.4rem; }
.barra nav a { color: var(--suave); text-decoration: none; font-size: .95rem; }
.barra nav a:hover { color: var(--tinta); text-decoration: underline; }

main > section { padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 5vw, 4rem); max-width: 76rem; margin: 0 auto; }
main > section + section { border-top: 1px solid var(--linea); }
h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin-bottom: 2rem; }

.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); font-weight: 700; letter-spacing: -.02em; }
.bajada { max-width: 34rem; font-size: 1.2rem; color: var(--suave); margin: 1.4rem 0 2rem; }
.acciones { display: flex; flex-wrap: wrap; gap: .8rem; margin: 0; }
.boton {
  display: inline-block; padding: .75rem 1.3rem; border-radius: 4px; font-weight: 500;
  text-decoration: none; background: var(--tinta); color: var(--fondo); border: 2px solid var(--tinta);
}
.boton.secundario { background: transparent; color: var(--tinta); }
.boton:hover { background: var(--senal); border-color: var(--senal); color: #fff; }

.grafico { margin: 0; background: var(--panel); border: 1px solid var(--linea); border-radius: 6px; padding: 1.2rem; }
#pid { width: 100%; height: auto; display: block; }
#pid .ejes { fill: none; stroke: var(--suave); stroke-width: 1.5; }
#pid .consigna { stroke: var(--senal); stroke-width: 1.5; stroke-dasharray: 6 6; }
#pid .curva { fill: none; stroke: var(--acero); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
#pid.anima .curva { animation: trazo 3.2s cubic-bezier(.3, .6, .4, 1) forwards; }
#pid .rotulo { fill: var(--suave); font: 400 12px var(--fuente-texto); }
@keyframes trazo { to { stroke-dashoffset: 0; } }
figcaption { font-size: .9rem; color: var(--suave); margin-top: .8rem; }
.enlace { background: none; border: 0; padding: 0; font: inherit; color: var(--acero); text-decoration: underline; cursor: pointer; }

.proyecto {
  display: grid; grid-template-columns: minmax(0, 20rem) 1fr; gap: clamp(1.2rem, 4vw, 3rem);
  padding: 2rem 0; border-top: 1px solid var(--linea); align-items: start;
}
.proyecto:first-of-type { border-top: 0; padding-top: 0; }
.proyecto img { width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--linea); background: var(--panel); }
.proyecto h3 { font-size: 1.35rem; margin-bottom: .7rem; }
.proyecto p { margin: 0 0 .8rem; max-width: 42rem; }
.detalle { margin-top: 1rem; }
.detalle summary { cursor: pointer; color: var(--acero); font-weight: 500; width: fit-content; }
.detalle summary:focus-visible { outline: 3px solid var(--senal); outline-offset: 3px; }
.detalle[open] summary { margin-bottom: .9rem; }
.detalle p { margin: 0 0 .8rem; }
.proyecto .galeria { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; }
.proyecto .galeria img { width: min(100%, 14rem); }
.tecnologias { color: var(--suave); font-size: .95rem; }
.enlaces { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }

.linea { list-style: none; margin: 0; padding: 0; }
.linea li { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem 2rem; padding: 1.4rem 0; border-top: 1px solid var(--linea); }
.linea li:first-child { border-top: 0; padding-top: 0; }
.fecha { color: var(--suave); font-size: .95rem; padding-top: .2rem; }
.linea h3 { font-size: 1.15rem; margin-bottom: .4rem; }
.linea p { margin: 0; max-width: 42rem; }

.habilidades { margin: 0; }
.habilidades > div { display: grid; grid-template-columns: 14rem 1fr; gap: .3rem 2rem; padding: 1rem 0; border-top: 1px solid var(--linea); }
.habilidades > div:first-child { border-top: 0; padding-top: 0; }
dt { font-weight: 500; }
dd { margin: 0; color: var(--suave); }

#contacto p { max-width: 36rem; }
#contacto .enlaces { font-size: 1.15rem; gap: .6rem 2rem; }
footer { padding: 2rem clamp(1rem, 5vw, 4rem); border-top: 1px solid var(--linea); color: var(--suave); font-size: .9rem; }
footer p { margin: 0; max-width: 76rem; margin-inline: auto; }

/* Los proyectos aparecen al llegar a ellos; sin JavaScript se ven siempre */
.js .proyecto { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .proyecto.visible { opacity: 1; transform: none; }

@media (max-width: 820px) {
  .hero, .proyecto, .linea li, .habilidades > div { grid-template-columns: 1fr; }
  .proyecto img { max-width: 24rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #pid .curva { stroke-dashoffset: 0; animation: none !important; }
  .js .proyecto { opacity: 1; transform: none; transition: none; }
}
