/* Base y variables */
:root {
  color-scheme: dark;
  --paper: #0c0d0f;
  --paper-light: #131416;
  --ink: #f2f0e9;
  --muted: #a7a49d;
  --line: #3a3b3e;
  --blue: #426bff;
  --blue-text: #6f8fff;
  --blue-surface: #365bdc;
  --green: #b9f451;
  --yellow: #f4ce45;
  --white: #ffffff;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 82px;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

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

a:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--paper);
}

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

h1,
h2,
h3,
p,
figure {
  margin-top: 0;
}

.container {
  width: min(var(--max-width), calc(100% - 48px));
  margin-inline: auto;
}

/* Cabecera */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(12, 13, 15, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.brand strong {
  font-size: 1.35rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.88rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 0.9rem;
}

.main-nav a {
  padding-block: 6px;
  border-bottom: 1px solid transparent;
}

.main-nav a:hover {
  border-color: var(--ink);
}

.main-nav .nav-cv {
  padding: 9px 13px;
  color: #11130e;
  background: var(--green);
  border: 0;
  border-radius: 4px;
}

/* Presentación */
.hero {
  padding: 46px 0 34px;
}

.hero-grid {
  min-height: calc(100vh - 190px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.72fr);
  align-items: center;
  gap: 72px;
}

.overline {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.hero h1 {
  margin-bottom: 22px;
  font-size: 6rem;
  line-height: 0.84;
  font-weight: 800;
}

.hero-statement {
  margin-bottom: 22px;
  color: var(--blue);
  font-size: 2rem;
  line-height: 1.08;
  font-weight: 700;
}

.hero-intro {
  max-width: 640px;
  margin-bottom: 28px;
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 17px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-size: 0.92rem;
  font-weight: 700;
}

.button-primary {
  color: #11130e;
  background: var(--ink);
}

.button-primary:hover {
  color: #11130e;
  background: var(--green);
}

.text-link {
  padding-block: 8px;
  border-bottom: 1px solid var(--ink);
  font-size: 0.9rem;
}

.portrait {
  position: relative;
  margin: 0;
  padding: 0 22px 22px 0;
}

.portrait::after {
  content: "";
  position: absolute;
  inset: 22px 0 0 22px;
  z-index: -1;
  background: var(--blue);
}

.portrait img {
  width: 100%;
  aspect-ratio: 0.88;
  object-fit: cover;
  object-position: center 18%;
}

/* Franja de datos */
.snapshot {
  color: var(--white);
  background: #151618;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.snapshot p {
  min-height: 126px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 0;
  padding: 24px 30px;
  border-left: 1px solid #3d3d3d;
}

.snapshot p:last-child {
  border-right: 1px solid #3d3d3d;
}

.snapshot strong {
  margin-bottom: 5px;
  color: var(--green);
  font-size: 1.25rem;
}

.snapshot span {
  color: #aaa8a2;
  font-size: 0.86rem;
}

/* Secciones compartidas */
.section {
  padding: 112px 0;
  border-bottom: 1px solid var(--line);
}

.section-header {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 28px;
  margin-bottom: 66px;
}

.section-header-single {
  grid-template-columns: 1fr;
}

.section-number {
  margin-bottom: 0;
  font-size: 0.8rem;
  font-weight: 700;
}

.section-header h2,
.profile-heading h2,
.contact h2 {
  margin-bottom: 0;
  font-size: 3.6rem;
  line-height: 0.98;
}

/* Proyectos */
.project-list {
  border-top: 1px solid var(--line);
}

.project-row {
  --project-accent: var(--blue);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: end;
  gap: 28px;
  min-height: 292px;
  padding: 38px 0 38px 28px;
  border-bottom: 1px solid var(--line);
}

.project-row::before {
  content: "";
  position: absolute;
  top: 38px;
  bottom: 38px;
  left: 0;
  width: 5px;
  background: var(--project-accent);
  opacity: 0.45;
  transition: opacity 160ms ease;
}

.project-row:hover::before {
  opacity: 1;
}

.project-row-blue {
  --project-accent: var(--blue);
}

.project-row-green {
  --project-accent: var(--green);
}

.project-row-yellow {
  --project-accent: var(--yellow);
}

.project-meta {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.project-copy h3 {
  margin-bottom: 18px;
  font-size: 4.7rem;
  line-height: 0.9;
}

.project-copy > p:last-child {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
}

.project-link,
.project-status {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 700;
}

.project-status {
  color: var(--muted);
  border-color: var(--line);
}

/* Experiencia */
.experience {
  background: var(--paper-light);
}

.experience-list {
  border-top: 1px solid var(--line);
}

.experience-row {
  display: grid;
  grid-template-columns: 170px 290px minmax(0, 1fr);
  gap: 34px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.experience-row p {
  margin-bottom: 0;
  color: var(--muted);
}

.experience-row h3 {
  margin-bottom: 2px;
  font-size: 1.2rem;
}

.experience-date,
.experience-role {
  font-size: 0.84rem;
}

/* Perfil y formación */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 90px;
}

.profile-heading h2 {
  margin-bottom: 28px;
}

.profile-heading > p:last-child {
  max-width: 520px;
  color: var(--muted);
  font-size: 1.04rem;
}

.skills {
  border-top: 1px solid var(--line);
}

.skills section {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.skills h3,
.skills p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.skills p {
  color: var(--muted);
}

.education {
  grid-column: 1 / -1;
  margin-top: 18px;
  padding-top: 38px;
  border-top: 1px solid var(--line);
}

.education-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 28px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.education-row span {
  color: var(--blue-text);
  font-size: 0.78rem;
  font-weight: 700;
}

.education-row p,
.education-row strong {
  margin-bottom: 0;
}

.education-row strong {
  display: inline-block;
  min-width: 180px;
}

/* Contacto y pie */
.contact {
  padding: 104px 0;
  color: var(--white);
  background: var(--blue-surface);
}

.contact .overline {
  color: var(--white);
}

.contact h2 {
  max-width: 900px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 34px;
  margin-top: 46px;
}

.contact-links a {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--white);
  font-weight: 700;
}

.site-footer {
  color: var(--white);
  background: #08090a;
}

.footer-inner {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-inner p {
  margin-bottom: 0;
  color: #aaa8a2;
  font-size: 0.78rem;
}

/* Adaptación para tablet */
@media (max-width: 920px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 38px;
  }

  .hero h1 {
    font-size: 4.7rem;
  }

  .hero-statement {
    font-size: 1.65rem;
  }

  .section-header h2,
  .profile-heading h2,
  .contact h2 {
    font-size: 3rem;
  }

  .project-copy h3 {
    font-size: 3.8rem;
  }

  .experience-row {
    grid-template-columns: 130px 220px minmax(0, 1fr);
  }

  .profile-grid {
    gap: 48px;
  }
}

/* Adaptación para móvil */
@media (max-width: 700px) {
  section[id] {
    scroll-margin-top: 118px;
  }

  .container {
    width: min(100% - 28px, var(--max-width));
  }

  .header-inner {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px 0;
  }

  .main-nav {
    width: 100%;
    gap: 16px;
    overflow-x: auto;
    font-size: 0.82rem;
  }

  .main-nav a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
  }

  .hero {
    padding-top: 34px;
  }

  .hero-grid {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero h1 {
    font-size: 4rem;
  }

  .portrait {
    width: 100%;
    height: auto;
    max-width: 480px;
    padding: 0 12px 12px 0;
  }

  .portrait img {
    height: auto;
    aspect-ratio: 1 / 1;
    object-position: center 18%;
  }

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

  .snapshot p,
  .snapshot p:last-child {
    min-height: 100px;
    padding-inline: 0;
    border-right: 0;
    border-left: 0;
    border-bottom: 1px solid #3d3d3d;
  }

  .section {
    padding: 76px 0;
  }

  .section-header {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 44px;
  }

  .section-header h2,
  .profile-heading h2,
  .contact h2 {
    font-size: 2.45rem;
  }

  .project-row {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .project-copy h3 {
    font-size: 3rem;
  }

  .project-link,
  .project-status {
    grid-column: auto;
  }

  .experience-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  .education {
    grid-column: auto;
  }

  .skills section,
  .education-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .education-row strong {
    display: block;
    min-width: 0;
    margin-bottom: 4px;
  }

  .contact {
    padding: 76px 0;
  }

  .contact-links {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 20px 0;
  }
}

@media (max-width: 420px) {
  .hero h1 {
    font-size: 3.25rem;
  }

  .hero-statement {
    font-size: 1.45rem;
  }

  .project-row {
    grid-template-columns: 1fr;
  }

  .project-link,
  .project-status {
    grid-column: auto;
  }
}

/* Respeta la preferencia de movimiento del sistema */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
