/* ============================================================
   PORTFOLIO — Adrián March Ramón
   Hoja de estilos única. CSS moderno, sin frameworks.

   ÍNDICE
   ------------------------------------------------------------
   01. Tipografías (@font-face, auto-alojadas)
   02. Variables de diseño (tema claro y oscuro)
   03. Reset y base
   04. Utilidades (container, kicker, mono, iconos, botones…)
   05. Cabecera y navegación
   06. Hero
   07. Cabeceras de sección
   08. Sobre mí
   09. Línea de tiempo (educación / experiencia)
   10. Proyectos
   11. Habilidades
   12. Contacto y formulario
   13. Footer y volver-arriba
   14. Animaciones (carga del hero + reveal al hacer scroll)
   15. Responsive
   16. Accesibilidad, impresión y movimiento reducido
   ============================================================ */


/* ============================================================
   01 · TIPOGRAFÍAS  (variables, subconjunto latino, ~210 KB total)
   ============================================================ */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('assets/fonts/fraunces-300-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url('assets/fonts/fraunces-300-700-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('assets/fonts/hanken-grotesk-300-800.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('assets/fonts/ibm-plex-mono-500.woff2') format('woff2');
}


/* ============================================================
   02 · VARIABLES DE DISEÑO
   Paleta: papel crema + tinta cálida + ocre como único acento.
   ============================================================ */
:root {
  color-scheme: light;

  /* Superficies */
  --bg:        #FAF6ED;   /* fondo general (papel) */
  --bg-alt:    #F4EDDE;   /* secciones alternas */
  --bg-elev:   #FFFDF7;   /* tarjetas y paneles */
  --bg-tint:   #F0E7D2;   /* rellenos suaves */

  /* Tinta */
  --ink:   #221B11;
  --ink-2: #57503F;
  --ink-3: #8B816C;

  /* Líneas (filetes finos, marca de la casa) */
  --line:        rgba(34, 27, 17, .12);
  --line-strong: rgba(34, 27, 17, .22);

  /* Ocre */
  --accent:        #BC8420;  /* gráficos, marcadores, botón primario */
  --accent-strong: #A87214;  /* hover del botón primario */
  --accent-deep:   #8C5E10;  /* texto pequeño en ocre (contraste AA) */
  --accent-ink:    #221703;  /* texto sobre fondo ocre */

  --shadow: 0 22px 50px -24px rgba(122, 86, 24, .3);

  /* Tipografías */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'Courier New', monospace;

  /* Métricas */
  --header-h: 4.5rem;
  --radius: 8px;
  --container: 1120px;

  /* Grano de papel (textura SVG en data-URI) */
  --grain-opacity: .035;
}

/* Tema oscuro: tinta y papel se invierten, el ocre se aviva */
[data-theme="dark"] {
  color-scheme: dark;

  --bg:        #161210;
  --bg-alt:    #1B1612;
  --bg-elev:   #211B14;
  --bg-tint:   #2A2318;

  --ink:   #EFE7D7;
  --ink-2: #BFB49D;
  --ink-3: #8C826C;

  --line:        rgba(239, 231, 215, .1);
  --line-strong: rgba(239, 231, 215, .2);

  --accent:        #D8A845;
  --accent-strong: #E2B65A;
  --accent-deep:   #D8A845;
  --accent-ink:    #221703;

  --shadow: 0 24px 50px -22px rgba(0, 0, 0, .55);

  --grain-opacity: .05;
}


/* ============================================================
   03 · RESET Y BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  overflow-x: clip;
  transition: background-color .35s ease, color .35s ease;
}

/* Textura de papel sobre todo el sitio (muy sutil) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; }

p, li, dd { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

::selection { background: var(--accent); color: var(--accent-ink); }

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

/* Barra de desplazamiento discreta */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 22%, transparent);
  border-radius: 99px;
  border: 3px solid var(--bg);
}

/* Enlace «saltar al contenido» (accesibilidad) */
.skip-link {
  position: fixed;
  top: .75rem; left: .75rem;
  z-index: 300;
  padding: .6rem 1rem;
  background: var(--ink);
  color: var(--bg);
  font-size: .875rem;
  border-radius: 6px;
  translate: 0 -300%;
  transition: translate .25s ease;
}
.skip-link:focus-visible { translate: 0 0; }


/* ============================================================
   04 · UTILIDADES
   ============================================================ */
.container {
  width: min(100% - 3rem, var(--container));
  margin-inline: auto;
}

/* Texto monoespaciado pequeño (metadatos, etiquetas) */
.mono {
  font-family: var(--font-mono);
  font-size: .8125rem;
  font-weight: 400;
  letter-spacing: .01em;
}

.dim { color: var(--ink-3); }

/* Etiqueta superior de cada bloque: «01 ◆ SOBRE MÍ» */
.kicker {
  font-family: var(--font-mono);
  font-size: .8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--accent-deep);
}
.kicker-num { color: var(--ink-3); }

/* Iconos (sprite SVG, estilo Lucide) */
.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -.18em;
}
.icon-sm { width: .85em; height: .85em; }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem 1.4rem;
  border-radius: 99px;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: .8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  transition: background-color .25s ease, border-color .25s ease,
              color .25s ease, translate .25s ease, box-shadow .25s ease;
}
.btn:active { translate: 0 1px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: color-mix(in srgb, var(--accent) 80%, var(--ink));
}
.btn-primary:hover {
  background: var(--accent-strong);
  translate: 0 -2px;
  box-shadow: var(--shadow);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  translate: 0 -2px;
}

/* Enlace de texto con subrayado animado */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font-mono);
  font-size: .8125rem;
  font-weight: 500;
  color: var(--accent-deep);
  position: relative;
}
.text-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.text-link:hover::after { transform: scaleX(1); }
.text-link .icon-sm { transition: translate .25s ease; }
.text-link:hover .icon-sm { translate: 2px -2px; }

/* Botón cuadrado de icono (tema, menú, redes del footer) */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--ink-2);
  transition: color .25s ease, background-color .25s ease, border-color .25s ease;
}
.icon-btn:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-color: var(--line);
}
.icon-btn .icon { width: 1.15rem; height: 1.15rem; }

/* Chips de tecnologías */
.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 0;
  margin-top: 1rem;
}
.chips li {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .03em;
  color: var(--ink-2);
  padding: .28rem .7rem;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}


/* ============================================================
   05 · CABECERA Y NAVEGACIÓN (fija)
   ============================================================ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  transition: background-color .3s ease, border-color .3s ease, backdrop-filter .3s ease;
  border-bottom: 1px solid transparent;
}
/* Al hacer scroll, la cabecera se vuelve translúcida con desenfoque */
.header.scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom-color: var(--line);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: -.02em;
  line-height: 1;
}
.logo-dot { color: var(--accent); }

.nav { margin-left: auto; }
.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.9rem;
  padding: 0;
}
.nav-link {
  font-size: .9375rem;
  font-weight: 500;
  color: var(--ink-2);
  position: relative;
  padding: .25rem 0;
  transition: color .25s ease;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.nav-link:hover { color: var(--ink); }
.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }
.nav-link.active { color: var(--ink); }

/* El botón de CV dentro del panel solo aparece en móvil */
.nav-cv { display: none; }

.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: .5rem;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: .15rem;
  font-family: var(--font-mono);
  font-size: .8125rem;
  margin-right: .25rem;
}
.lang-btn {
  padding: .35rem .4rem;
  color: var(--ink-3);
  font-weight: 400;
  border-radius: 6px;
  transition: color .2s ease;
}
.lang-btn:hover { color: var(--ink); }
.lang-btn.active { color: var(--accent-deep); font-weight: 500; }
.lang-sep { color: var(--line-strong); }

/* Interruptor de tema: luna en modo claro, sol en modo oscuro */
#theme-toggle .icon-sun { display: none; }
[data-theme="dark"] #theme-toggle .icon-sun { display: block; }
[data-theme="dark"] #theme-toggle .icon-moon { display: none; }

.header-cv { padding: .6rem 1.1rem; margin-left: .5rem; }

.menu-toggle { display: none; }
.menu-toggle .icon-close { display: none; }
html.nav-open .menu-toggle .icon-open { display: none; }
html.nav-open .menu-toggle .icon-close { display: block; }

/* Barra de progreso de lectura bajo la cabecera */
.scroll-progress {
  position: absolute;
  left: 0; bottom: -1px;
  width: 100%; height: 2px;
  background: var(--accent);
  transform: scaleX(var(--sp, 0));
  transform-origin: left;
}


/* ============================================================
   06 · HERO
   ============================================================ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: calc(var(--header-h) + 2rem);
}

/* Arcos concéntricos: el motivo gráfico del sitio */
.hero-arcs {
  position: absolute;
  top: 0; right: 0;
  width: min(620px, 58vw);
  height: auto;
  pointer-events: none;
  transform-origin: 100% 0;
  animation: arcs-in 1.6s cubic-bezier(.2, .65, .25, 1) both,
             arcs-drift 26s ease-in-out 1.6s infinite alternate;
}
.hero-arcs .arc { stroke: var(--accent); stroke-width: 1.3; }
.hero-arcs .arc-1 { opacity: .6; }
.hero-arcs .arc-2 { opacity: .42; }
.hero-arcs .arc-3 { opacity: .3; stroke-dasharray: 5 9; }
.hero-arcs .arc-4 { opacity: .2; }
.hero-arcs .arc-5 { opacity: .12; }
.hero-arcs .arc-dot { fill: var(--accent); }
.hero-arcs .arc-diamond { fill: var(--accent); opacity: .85; }

.hero-inner {
  margin-block: auto;
  padding-block: 3rem;
  position: relative;
}

.hero-title {
  margin-top: 1.75rem;
  font-size: clamp(3.1rem, 9.5vw, 6.6rem);
  font-weight: 600;
  line-height: .98;
  letter-spacing: -.022em;
}
.hero-line { display: block; }
.hero-line + .hero-line { padding-left: clamp(0rem, 4vw, 3.5rem); }
.accent-dot { color: var(--accent); }

.hero-sub {
  margin-top: 2.25rem;
  max-width: 56ch;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.65;
  color: var(--ink-2);
}
.hero-sub strong {
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.hero-sub sup { font-size: .6em; }

.hero-cta {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
}

.hero-social {
  list-style: none;
  padding: 0;
  margin-top: 2.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
}
.social-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-mono);
  font-size: .8125rem;
  color: var(--ink-3);
  transition: color .25s ease;
}
.social-link:hover { color: var(--accent-deep); }

.hero-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-block: 1.4rem 2rem;
}
.hero-foot .mono {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink-2);
}
.scroll-cue {
  color: var(--ink-3);
  transition: color .25s ease;
}
.scroll-cue:hover { color: var(--accent-deep); }
.scroll-cue .icon { animation: bob 2.6s ease-in-out infinite; }


/* ============================================================
   07 · CABECERAS DE SECCIÓN
   ============================================================ */
.section { padding-block: clamp(4.5rem, 11vw, 7.5rem); }

/* Secciones alternas: papel ligeramente más oscuro y filetes */
.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--line);
  --surface: var(--bg-alt);
}
.section { --surface: var(--bg); }

.section-head { margin-bottom: clamp(2.75rem, 6vw, 4.25rem); }

.section-title {
  margin-top: 1.1rem;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  letter-spacing: -.018em;
  line-height: 1.04;
}
.section-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent-deep);
}


/* ============================================================
   08 · SOBRE MÍ
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}

/* Retrato con marco ocre desplazado */
.portrait { position: relative; }
.portrait-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--bg-tint);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  overflow: hidden;
}
.portrait::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  aspect-ratio: 4 / 5;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  translate: 14px 14px;
  z-index: -1;
  opacity: .75;
}
.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.94) contrast(1.02);
}
/* Monograma de respaldo si aún no hay foto */
.portrait-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--bg-tint), color-mix(in srgb, var(--accent) 16%, var(--bg-tint)));
}
/* El display:grid de arriba anularía el atributo hidden; lo restauramos */
.portrait-fallback[hidden] { display: none; }
.portrait-fallback span {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 4.5rem;
  color: var(--accent-deep);
  letter-spacing: .02em;
}
.portrait-arcs {
  position: absolute;
  right: 0; bottom: 0;
  width: 65%;
  stroke: var(--accent);
  opacity: .35;
}
.portrait figcaption { margin-top: .9rem; }

.about-body p {
  max-width: 62ch;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink-2);
}
.about-body p + p { margin-top: 1.25em; }
.about-body strong { color: var(--ink); font-weight: 600; }

/* Datos rápidos */
.facts {
  margin-top: 2.6rem;
  border-top: 1px solid var(--line-strong);
}
.fact {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
}
.fact dt {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  color: var(--ink-3);
  padding-top: .15em;
}
.fact dd { font-weight: 500; color: var(--ink); }


/* ============================================================
   09 · LÍNEA DE TIEMPO (educación y experiencia)
   Tipográfica: raíl fino + rombos ocre, sin cajas.
   ============================================================ */
.timeline {
  list-style: none;
  padding: 0;
  position: relative;
  max-width: 60rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 4px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--line-strong);
}
.t-item {
  position: relative;
  padding: 0 0 3rem 2.6rem;
}
.t-item:last-child { padding-bottom: 0; }

.t-marker {
  position: absolute;
  left: 0; top: .3em;
  width: 9px; height: 9px;
  background: var(--accent);
  rotate: 45deg;
  box-shadow: 0 0 0 5px var(--surface);
}

.t-meta {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .75rem;
}

.t-icon {
  position: absolute;
  right: 0; top: -.4rem;
  display: grid;
  place-items: center;
  width: 2.6rem; height: 2.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--accent-deep);
  background: var(--bg-elev);
}
.t-icon .icon { width: 1.2rem; height: 1.2rem; }

.t-title {
  margin-top: .8rem;
  font-size: 1.45rem;
  letter-spacing: -.01em;
}
.t-org {
  margin-top: .3rem;
  font-weight: 550;
  font-size: .95rem;
  color: var(--accent-deep);
}
.t-desc, .t-list {
  margin-top: .7rem;
  max-width: 62ch;
  color: var(--ink-2);
  font-size: .975rem;
  line-height: 1.7;
}
.t-list {
  list-style: none;
  padding: 0;
}
.t-list li {
  position: relative;
  padding-left: 1.2rem;
}
.t-list li + li { margin-top: .5em; }
.t-list li::before {
  content: "";
  position: absolute;
  left: 0; top: .58em;
  width: 6px; height: 6px;
  background: var(--accent);
  rotate: 45deg;
  opacity: .7;
}


/* ============================================================
   10 · PROYECTOS
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
}

.project {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  transition: translate .35s ease, border-color .35s ease, box-shadow .35s ease;
}
.project:hover, .project:focus-within {
  translate: 0 -5px;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong));
  box-shadow: var(--shadow);
}

/* Portadas generativas: cada tarjeta tiene su tono de fondo */
.project:nth-of-type(1) { --cover-bg: color-mix(in srgb, var(--accent) 16%, var(--bg-elev)); }
.project:nth-of-type(2) { --cover-bg: color-mix(in srgb, var(--accent) 8%,  var(--bg-elev)); }
.project:nth-of-type(3) { --cover-bg: color-mix(in srgb, var(--accent) 12%, var(--bg-elev)); }
.project:nth-of-type(4) { --cover-bg: color-mix(in srgb, var(--accent) 6%,  var(--bg-elev)); }
.project:nth-of-type(5) { --cover-bg: color-mix(in srgb, var(--accent) 13%, var(--bg-elev)); }

.project-cover {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.project-cover svg {
  width: 100%;
  height: 100%;
  transition: transform .6s cubic-bezier(.2, .65, .25, 1);
}
.project:hover .project-cover svg { transform: scale(1.04); }

.cv-bg     { fill: var(--cover-bg); }
.cv-line   { stroke: color-mix(in srgb, var(--ink) 38%, transparent); stroke-width: 1.5; }
.cv-accent { stroke: var(--accent); }
.cv-fill   { fill: var(--accent); stroke: none; }
.c-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .05em;
  fill: color-mix(in srgb, var(--ink) 62%, transparent);
}
.c-mono.dim-t { fill: color-mix(in srgb, var(--ink) 40%, transparent); }
.c-serif {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 64px;
  fill: var(--ink);
}

.project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.5rem 1.6rem 1.7rem;
}
.project-meta {
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .72rem;
  color: var(--ink-3);
}
.project-title { margin-top: .6rem; font-size: 1.45rem; letter-spacing: -.01em; }
.project-desc {
  margin-top: .7rem;
  color: var(--ink-2);
  font-size: .975rem;
  line-height: 1.65;
}
.project-links {
  margin-top: auto;
  padding-top: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

/* Etiqueta de estado «roadmap» (Planificado / En curso / Terminado) */
.project-status {
  --dot: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
}
/* Proyecto ya en marcha: verde «vivo» en vez del ocre de «planificado» */
.project-status.is-active {
  --dot: #23a06a;
  color: color-mix(in srgb, var(--dot) 72%, var(--ink-2));
}
.status-dot {
  width: 7px; height: 7px;
  flex: none;
  border-radius: 99px;
  background: var(--dot);
  animation: pulse 2.8s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--dot) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Cita «idea central» del proyecto destacado */
.project-idea {
  margin: 1.4rem 0 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--accent);
}
.project-idea .idea-label {
  display: block;
  margin-bottom: .4rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent-deep);
}
.project-idea p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.08rem;
  line-height: 1.45;
  color: var(--ink);
  max-width: 46ch;
}

/* Proyecto destacado: ocupa todo el ancho, portada a la izquierda */
.project-featured { grid-column: 1 / -1; flex-direction: row; }
.project-featured .project-cover {
  flex: 1.15;
  aspect-ratio: auto;
  min-height: 330px;
  border-bottom: none;
  border-right: 1px solid var(--line);
}
.project-featured .project-body { flex: 1; padding: 2.2rem 2.4rem; justify-content: center; }
.project-featured .project-title { font-size: 1.9rem; }
.project-featured .project-links { margin-top: 1.4rem; flex: none; }

/* Texto introductorio de la sección (hoja de ruta) */
.projects-lead {
  margin-top: 1.3rem;
  max-width: 62ch;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink-2);
}

.projects-more {
  margin-top: 2.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .6rem;
  color: var(--ink-3);
}


/* ============================================================
   11 · HABILIDADES
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem 2rem;
}

.skill-group {
  border-top: 1px solid var(--line-strong);
  padding-top: 1.4rem;
}
.skill-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}
.skill-ico {
  display: grid;
  place-items: center;
  width: 2.2rem; height: 2.2rem;
  border-radius: 9px;
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.skill-ico .icon { width: 1.05rem; height: 1.05rem; }

.skill-list {
  list-style: none;
  padding: 0;
  margin-top: 1.1rem;
}
.skill-list li {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .52rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: .95rem;
}
.skill-list li:last-child { border-bottom: none; }
.skill-list li::before {
  content: "";
  flex: none;
  width: 6px; height: 6px;
  background: var(--accent);
  rotate: 45deg;
  opacity: .65;
}

.skills-note { margin-top: 2.75rem; color: var(--ink-3); }


/* ============================================================
   12 · CONTACTO Y FORMULARIO
   ============================================================ */
#contacto { position: relative; overflow: hidden; }

.contact-arcs {
  position: absolute;
  left: -30px; bottom: -30px;
  width: 360px;
  stroke: var(--accent);
  opacity: .22;
  pointer-events: none;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: clamp(2.5rem, 6vw, 4.5rem);
  align-items: start;
  position: relative;
}

.contact-lead {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 46ch;
}

.contact-cards {
  list-style: none;
  padding: 0;
  margin-top: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color .3s ease, translate .3s ease;
}
.contact-card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line-strong));
  translate: 0 -2px;
}
.cc-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.5rem; height: 2.5rem;
  border-radius: 10px;
  color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.cc-body { min-width: 0; }
.cc-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .68rem;
  color: var(--ink-3);
}
.cc-value {
  font-weight: 550;
  font-size: .975rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
a.cc-value:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }
.cc-arrow { margin-left: auto; color: var(--ink-3); }
.copy-btn { margin-left: auto; }
.copy-btn .icon-check { display: none; color: var(--accent-deep); }
.copy-btn.copied .icon-copy { display: none; }
.copy-btn.copied .icon-check { display: block; }

/* Formulario (abre el cliente de correo del visitante) */
.contact-form {
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: var(--shadow);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}
.form-field { margin-bottom: 1.15rem; }
.form-field label {
  display: block;
  margin-bottom: .45rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .7rem;
  font-weight: 500;
  color: var(--ink-3);
}
.form-field input,
.form-field textarea {
  width: 100%;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: .72rem .9rem;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--ink-3); opacity: .75; }
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.form-field input:user-invalid,
.form-field textarea:user-invalid { border-color: #B3422E; }
.form-field textarea { resize: vertical; min-height: 8rem; }

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.form-note {
  font-size: .72rem;
  color: var(--ink-3);
  max-width: 24rem;
}
.form-status {
  width: 100%;
  font-size: .78rem;
  color: var(--accent-deep);
  min-height: 1em;
}


/* ============================================================
   13 · FOOTER Y VOLVER ARRIBA
   ============================================================ */
.footer {
  border-top: 1px solid var(--line);
  padding: 3.5rem 0 2.25rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.footer-brand .mono { margin-top: .6rem; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
}
.footer-nav a {
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: color .25s ease;
}
.footer-nav a:hover { color: var(--accent-deep); }

.footer-social {
  list-style: none;
  padding: 0;
  display: flex;
  gap: .4rem;
}

.footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .75rem 1.5rem;
}
.footer-bottom .mono { font-size: .75rem; }

.back-top {
  position: fixed;
  right: 1.5rem; bottom: 1.5rem;
  z-index: 90;
  width: 3rem; height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--bg-elev) 90%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ink-2);
  opacity: 0;
  visibility: hidden;
  translate: 0 12px;
  transition: opacity .3s ease, translate .3s ease, visibility .3s,
              color .25s ease, border-color .25s ease;
}
.back-top.show { opacity: 1; visibility: visible; translate: 0 0; }
.back-top:hover { color: var(--accent-deep); border-color: var(--accent); }


/* ============================================================
   14 · ANIMACIONES
   ============================================================ */

/* Entrada escalonada del hero al cargar la página */
.hero-item {
  opacity: 0;
  translate: 0 26px;
  animation: rise .85s cubic-bezier(.2, .65, .25, 1) var(--d, 0s) forwards;
}
.hero .kicker        { --d: .05s; }
.hero-line:nth-child(1) { --d: .14s; }
.hero-line:nth-child(2) { --d: .22s; }
.hero-sub            { --d: .34s; }
.hero-cta            { --d: .44s; }
.hero-social         { --d: .52s; }
.hero-foot           { --d: .66s; }

@keyframes rise {
  to { opacity: 1; translate: 0 0; }
}

@keyframes arcs-in {
  from { opacity: 0; transform: scale(.92) rotate(-5deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes arcs-drift {
  from { transform: rotate(0deg); }
  to   { transform: rotate(5deg); }
}

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 4px; }
}

/* Aparición al hacer scroll (gestionada con IntersectionObserver) */
.reveal {
  opacity: 0;
  translate: 0 28px;
  transition: opacity .7s ease var(--d, 0s),
              translate .7s cubic-bezier(.2, .65, .25, 1) var(--d, 0s);
}
.reveal.in { opacity: 1; translate: 0 0; }


/* ============================================================
   15 · RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  /* La navegación pasa a panel desplegable */
  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    margin: 0;
    padding: 1.5rem 1.5rem 2rem;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 30px 50px -30px rgba(0, 0, 0, .25);
    opacity: 0;
    visibility: hidden;
    translate: 0 -10px;
    transition: opacity .3s ease, translate .3s ease, visibility .3s;
  }
  html.nav-open .nav {
    opacity: 1;
    visibility: visible;
    translate: 0 0;
  }
  html.nav-open body { overflow: hidden; }
  html.nav-open .header {
    background: var(--bg-elev);
    border-bottom-color: var(--line);
  }

  .nav-list {
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
  }
  .nav-link {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    padding: .45rem 0;
  }
  .nav-cv { display: inline-flex; margin-top: 1.25rem; }
  .header-cv { display: none; }
  .menu-toggle { display: inline-grid; }
  /* Con el nav fuera de flujo, los controles se alinean a la derecha */
  .header-actions { margin-left: auto; }

  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 360px; }

  .project-featured { flex-direction: column; }
  .project-featured .project-cover {
    aspect-ratio: 16 / 10;
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .project-featured .project-body { padding: 1.5rem 1.6rem 1.7rem; }
  .project-featured .project-title { font-size: 1.45rem; }

  .skills-grid { grid-template-columns: repeat(2, 1fr); }

  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .projects-grid { grid-template-columns: 1fr; }
  .t-icon { display: none; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .container { width: min(100% - 2.5rem, var(--container)); }

  .hero-foot { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .hero-sub { margin-top: 1.75rem; }

  .fact { grid-template-columns: 1fr; gap: .15rem; }

  .skills-grid { grid-template-columns: 1fr; gap: 2rem; }

  .form-row { grid-template-columns: 1fr; gap: 0; }

  .footer-bottom { flex-direction: column; }

  .back-top { right: 1rem; bottom: 1rem; }
}


/* ============================================================
   16 · ACCESIBILIDAD, IMPRESIÓN Y MOVIMIENTO REDUCIDO
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .hero-item, .reveal { opacity: 1; translate: 0 0; }
}

@media print {
  .header, .back-top, .scroll-cue, .contact-form,
  .hero-arcs, .contact-arcs, body::after { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding-block: 2rem; }
  .hero { min-height: 0; padding-top: 1rem; }
  a { color: #000; }
}
