/*
  STYLES.CSS — El diseño, organizado de arriba abajo.
  1. Panel de diseño  2. Base  3. Barra superior  4. Introducción
  5. Proyectos  6. Herramientas  7. Contacto  8. Visor  9. Móvil

  TIPOGRAFÍA:
  h1.hero-name = nombre / .hero-role = profesión
  h3.project-title = proyectos
  body y p = texto
  Cada familia está indicada explícitamente; busca el selector con Ctrl+F.
*/

/* Colores, fuentes y tamaños compartidos. */
:root {
  --font-name: "Anybody", Impact, "Arial Narrow", sans-serif;
  --font-headings: "Newsreader", Georgia, serif;
  --font-body: "Manrope", Arial, sans-serif;
  --font-data: "Onest", Arial, sans-serif;
  /* ESCALA TIPOGRÁFICA — cambia aquí los tamaños de cada tipo de texto. */
  --text-section-title: clamp(42px, 5.2vw, 55px);
  --text-project-title: clamp(27px, 2.1vw, 30px);
  --text-subtitle: 18px;
  --text-body: 15px;
  --text-label: 13px;
  --text-note: 12px;
  --paper: #f0f5f3;       /* Salvia: fondo claro verde frío */
  --ink: #203b32;         /* Texto: tinta */
  --accent: #37694f;      /* Acento: verde salvia */
  --soft: #dce8e1;        /* Fondos secundarios */
  --about-background: #e2ece7;        /* Portada, herramientas y contacto */
  --muted: #526b61;
  --line: #bdcec5;
  --header-background: rgb(240 245 243 / .94);
  color-scheme: light;
  --max: 1280px;         /* Ancho máximo de lectura */
  --gutter: clamp(22px, 4.8vw, 76px);
  --header-height: 64px;

  /* GALERÍA: tarjetas iguales, ordenadas de izquierda a derecha. */
  --project-columns: 3;
  --project-gap: 30px;
}


/* 2. BASE — espacio, lectura y accesibilidad */
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  scroll-padding-top: calc(var(--header-height) + 24px);
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.65;
}
body.dialog-open {
  overflow: hidden;
}
h1, h2, h3, p, figure {
  margin: 0;
}
h2 {
  font-family: var(--font-headings);
  font-size: var(--text-section-title);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -.04em;
}
h2 em {
  font-weight: 400;
  color: var(--accent);
}
/* TÍTULOS DE SECCIÓN — textos en index.html; fuente y tamaño heredados de H2. */
.section-title {
  margin-bottom: clamp(30px, 4vw, 52px);
  text-wrap: balance;
}
.projects-heading {
  max-width: 1120px;
  margin-inline: auto;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}
img {
  display: block;
  width: 100%;
}
[hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
::selection {
  background: var(--accent);
  color: var(--paper);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}
.page-width {
  width: min(calc(100% - var(--gutter) * 2), var(--max));
  margin-inline: auto;
}
.section {
  padding-block: 88px 100px;
}
/* 3. BARRA SUPERIOR — fina y siempre visible.
   position: sticky mantiene la barra arriba al desplazarse. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  background: var(--header-background);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  /* script.js toma el fondo de la sección activa, sin duplicar la paleta aquí. */
  transition: background-color .25s ease;
}
.header-inner {
  width: min(calc(100% - var(--gutter) * 2), var(--max));
  height: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.04em;
}
.brand-logo {
  width: auto;
  height: 40px;
  flex: 0 0 auto;
  object-fit: contain;
}
#site-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 42px);
}
#site-nav a {
  font-family: var(--font-body);
  font-size: var(--text-label);
  padding-block: 20px;
  position: relative;
}
#site-nav a::after {
  position: absolute;
  bottom: 12px;
  left: 0;
  width: 100%;
  height: 1px;
  content: "";
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s;
}
#site-nav a:hover::after, #site-nav a[aria-current]::after {
  transform: scaleX(1);
}
.language-selector {
  display: flex;
  align-items: center;
  margin-left: clamp(16px, 2.4vw, 38px);
  padding-left: clamp(16px, 2.4vw, 38px);
  border-left: 1px solid var(--line);
}
.language-select {
  width: auto;
  field-sizing: content;
  appearance: none;
  padding: 7px 27px 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23203b32' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 9px center / 10px 6px;
  font: 400 var(--text-label)/1.2 var(--font-body);
  cursor: pointer;
}
.language-select option { color: var(--ink); background: var(--paper); }
.language-select:hover { color: var(--accent); border-color: var(--accent); }
.menu-button {
  display: none;
}

/* 4. PORTADA — nombre y biografía a la izquierda; retrato a la derecha. */
.hero {
  padding-block: clamp(32px, 4vw, 58px);
  background: var(--about-background);
}
.hero-inner {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: min-content min-content 1fr;
  gap: 12px 32px;
}
.hero-type { grid-column: 1 / 7; grid-row: 2; min-width: 0; }
.hero-name {
  font-family: var(--font-name);
  font-size: clamp(62px, 7.8vw, 112px);
  font-weight: 900;
  font-stretch: condensed;
  text-transform: uppercase;
  line-height: .90;
  letter-spacing: -.025em;
}
.name-first, .name-last { display: block; }
.name-last { color: var(--accent); }
.hero-role {
  grid-column: 1 / 7;
  grid-row: 1;
  font: 500 var(--text-subtitle)/1.4 var(--font-body);
  color: var(--muted);
}
.hero-role::first-letter { text-transform: uppercase; }
.hero-presentation {
  grid-column: 1 / 7;
  grid-row: 3;
  max-width: 490px;
  margin-top: 20px;
  align-self: start;
}
.hero-bio { font: 400 var(--text-body)/1.7 var(--font-body); }
.portrait {
  position: relative;
  width: 100%;
  margin: 0;
  grid-column: 8 / -1;
  grid-row: 1 / 4;
  align-self: start;
  justify-self: end;
}
.portrait-frame {
  position: relative;
  aspect-ratio: 1200 / 1356;
  overflow: hidden;
}
.portrait-frame img {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: var(--portrait-position, 50% 50%);
  filter: grayscale(1);
}
.hero-cv {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 44px;
  margin-top: 24px;
  padding: 10px 20px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 var(--text-body)/1.4 var(--font-body);
  transition: background-color .2s, color .2s;
}
.hero-cv:hover { background: var(--ink); color: var(--paper); }

/* 5. PROYECTOS — action decide si la portada amplía o abre el enlace.
   H3 es el título de cada proyecto; las portadas se configuran en content.js. */
/* Cada fila empieza por la izquierda, incluso si queda incompleta.
   La fórmula resta los huecos y divide el espacio en columnas iguales. */
.project-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 44px var(--project-gap);
  max-width: 1120px;
  margin-inline: auto;
}
.project-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 1120px;
  margin: 0 auto 38px;
}
.project-filter {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: var(--text-label);
  font-weight: 400;
  transition: color .2s, border-color .2s, background-color .2s;
}
.project-filter:hover,
.project-filter[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--accent);
}
.project-filter[aria-pressed="true"] {
  font-weight: 500;
  background: var(--soft);
}
.project-card {
  flex: 0 0 calc((100% - (var(--project-columns) - 1) * var(--project-gap)) / var(--project-columns));
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.project-footer {
  margin-top: auto;
  padding-top: 16px;
}
.project-cover {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  color: var(--ink);
  flex-shrink: 0;
}
.project-zoom {
  cursor: zoom-in;
}
.project-cover-link {
  cursor: pointer;
}
.zoom-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
}
.zoom-icon svg {
  width: 20px;
  height: 20px;
}
.project-title a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.project-visual {
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
  background: var(--soft);
}
.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.project-zoom:hover .project-image,
.project-zoom:focus-visible .project-image,
.project-cover-link:hover .project-image,
.project-cover-link:focus-visible .project-image {
  transform: scale(1.025);
}
.project-meta-line {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin: 20px 0 11px;
  font-family: var(--font-data);
  font-size: var(--text-label);
  font-weight: 400;
  color: var(--muted);
}
.project-category {
  overflow-wrap: anywhere;
  font-weight: 600;
}
.project-title {
  font-family: var(--font-headings);
  font-size: var(--text-project-title);
  font-weight: 400;
  letter-spacing: -.025em;
  line-height: 1.1;
}
.project-description {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.7;
  margin-top: 12px;
  margin-bottom: 6px;
  max-width: 470px;
  color: var(--muted);
}
.project-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  padding: 14px 0 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
/* HERRAMIENTAS — lista tipográfica sencilla, sin cajas ni códigos de color. */
.tool-tag {
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--font-data);
  font-size: var(--text-label);
  font-weight: 400;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.tool-tag:not(:last-child)::after {
  content: "·";
  margin-inline: 8px;
  color: var(--line);
}
.image-unavailable {
  display: grid;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  font: 400 var(--text-note)/1.5 var(--font-body);
  cursor: default;
}
.project-image-missing { text-align: center; }
.empty-state {
  padding-block: 40px;
}
.projects-actions {
  max-width: 1120px;
  margin: 42px auto 0;
  text-align: center;
}
.load-more-projects {
  min-width: 180px;
  padding: 11px 22px;
  /* Misma forma de píldora y borde que los filtros y el selector de idioma. */
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-label);
  font-weight: 400;
  transition: background-color .2s, color .2s, border-color .2s;
}
.load-more-projects:hover {
  background: var(--soft);
  border-color: var(--accent);
  color: var(--ink);
}

/* 6. HERRAMIENTAS — Salvia y habilidades en cinco tramos editables. */
.about.section {
  background: var(--about-background);
  /* Misma distancia por encima y por debajo del bloque de contacto. */
  padding-bottom: 64px;
}
.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 64px;
  max-width: 1120px;
  margin-inline: auto;
}
/* En escritorio, el párrafo arranca junto a la segunda línea del título. */
.about-copy { padding-top: clamp(44px, 5.408vw, 57.2px); }
.about-layout > .section-title { margin-bottom: 0; }
.about-bio {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.7;
}
.toolkit { grid-column: 1 / -1; }
.toolkit-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 12px;
}
.toolkit .tools-heading {
  font-family: var(--font-body);
  font-size: var(--text-subtitle);
  font-weight: 600;
  letter-spacing: -.025em;
  margin: 0;
  padding: 0;
}
.skills-scale {
  font-family: var(--font-body);
  font-size: var(--text-note);
  line-height: 1.6;
  color: var(--muted);
}
.skills-scale { margin-top: 12px; }
.skills {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 48px;
}
.skills li {
  display: grid;
  /* Nombre, mini gráfico y nivel en una sola fila. */
  grid-template-columns: minmax(0, 1fr) 104px 36px;
  align-items: center;
  gap: 12px;
  font-family: var(--font-body);
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.skill-name { grid-column: 1; grid-row: 1; font-size: var(--text-body); font-weight: 500; }
.skill-score { grid-column: 3; grid-row: 1; font-size: var(--text-note); color: var(--muted); text-align: right; }
.skill-score > span { opacity: .7; }
/* Pequeño gráfico escalonado: relleno = nivel; nunca porcentajes inventados. */
.skill-meter {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: end;
  gap: 4px;
  height: 18px;
}
.skill-step {
  flex: 1;
  height: 6px;
  border-radius: 2px;
  background: var(--line);
}
.skill-step:nth-child(2) { height: 9px; }
.skill-step:nth-child(3) { height: 12px; }
.skill-step:nth-child(4) { height: 15px; }
.skill-step:nth-child(5) { height: 18px; }
.skill-step.is-filled { background: var(--accent); }
@media (max-width: 680px) {
  .about-layout { grid-template-columns: 1fr; gap: 24px; }
  .about-copy { padding-top: 0; }
  .about.section { padding-bottom: 40px; }
  .skills { grid-template-columns: 1fr; gap: 0; }
  .skills li { grid-template-columns: minmax(0, 1fr) 80px 32px; gap: 10px; }
  .toolkit-heading { margin-top: 12px; }
}

/* 7. CONTACTO */
.about-contact {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px 64px;
  padding-top: 64px;
  border-top: 1px solid var(--line);
}
.contact-intro h3 {
  font: 600 var(--text-subtitle)/1.4 var(--font-body);
  margin-bottom: 10px;
}
.contact-intro p {
  font-size: var(--text-body);
  line-height: 1.7;
  max-width: 420px;
}
.contact-details { min-width: 0; }
@media (max-width: 680px) {
  .about-contact { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 40px; }
}
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font: 400 var(--text-body)/1.5 var(--font-body);
  overflow-wrap: anywhere;
}
.contact-link:hover { color: var(--accent); border-color: var(--accent); }
.contact-email > [data-field="email"] { min-width: 0; }
.contact-link > [aria-hidden="true"] { flex-shrink: 0; }
.contact-phone { white-space: nowrap; }
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 6px;
}
.contact-pending {
  font-family: var(--font-data);
  color: var(--muted);
  font-size: var(--text-note);
  padding-block: 20px;
}
footer {
  background: var(--about-background);
  border-top: 1px solid var(--line);
}
.footer-inner {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding-block: 22px;
  font: 400 var(--text-note)/1.65 var(--font-data);
}

/* 8. VISOR DE IMAGEN — fondo oscuro, imagen entera, sin recorte ni textos.
   max-height reserva espacio para la X, también en móviles horizontales. */
.image-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 60px 24px 24px;
  border: 0;
  background: transparent;
  overflow: hidden;
}
.image-dialog[open] {
  display: grid;
  place-items: center;
}
.image-dialog::backdrop {
  background: rgb(10 15 12 / .82);
}
.enlarged-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 84px);
  object-fit: contain;
}
.image-close {
  position: absolute;
  top: 8px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.image-close svg {
  width: 28px;
  height: 28px;
}
.image-close:hover {
  background: rgb(255 255 255 / .12);
}
.image-close:focus-visible {
  outline-color: #fff;
}

/* 9. TABLET Y MÓVIL — misma jerarquía, lectura en una columna */
@media (max-width: 900px) {
  :root {
    --project-columns: 2;
    --project-gap: 26px;
  }
  #site-nav {
    gap: 18px;
  }
  .wordmark {
    gap: 8px;
  }
  .section {
    padding-block: 65px;
  }
}
@media (max-width: 680px) {
  :root {
    --header-height: 58px;
    --gutter: 22px;
  }
  .wordmark {
    font-size: 13px;
  }
  .brand-logo {
    height: 34px;
  }
  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Área táctil amplia aunque el icono sea pequeño. */
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 0;
    background: transparent;
    padding: 10px;
  }
  .menu-button svg {
    display: block;
    width: 24px;
    height: 24px;
  }
  #site-nav {
    display: none;
    position: absolute;
    top: calc(var(--header-height) - 1px);
    left: 0;
    right: 0;
    background: var(--header-background);
    transition: background-color .25s ease;
    border-bottom: 1px solid var(--line);
    padding: 16px var(--gutter);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  #site-nav.is-open {
    display: flex;
  }
  #site-nav a {
    padding: 12px 0;
    font-size: var(--text-label);
  }
  #site-nav a::after {
    bottom: 7px;
    width: 24px;
  }
  #site-nav .language-selector {
    margin: 8px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .hero-inner { gap: 12px; grid-template-rows: auto auto auto auto; }
  .hero-role { grid-column: 1 / -1; font-size: 16px; }
  .hero-type { grid-column: 1 / -1; }
  .hero-name { font-size: clamp(50px, 16vw, 108px); }
  .hero-presentation { grid-column: 1 / -1; grid-row: 4; margin-top: 10px; }
  .portrait {
    grid-column: 2 / -1;
    grid-row: 3;
    max-width: 420px;
    margin-top: 18px;
  }
  .section {
    padding-block: 52px;
  }
  .project-grid {
    --project-columns: 1;
    max-width: 420px;
    row-gap: 36px;
  }
  .projects-heading {
    max-width: 420px;
  }
  .project-title { font-size: var(--text-project-title); }
  .project-filters {
    gap: 8px;
    margin-bottom: 30px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
