/* ==================================================================
   Fuentes
   ================================================================== */
@font-face {
  font-family: "determination";
  src:
    url("../fonts/determination.woff2") format("woff2"),
    url("../fonts/determination.woff") format("woff"),
    url("../fonts/determination.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IosevkaTerm Nerd Font";
  src:
    url("../fonts/IosevkaTermNerdFont-Regular.woff2") format("woff2"),
    url("../fonts/IosevkaTermNerdFont-Regular.woff") format("woff"),
    url("../fonts/IosevkaTermNerdFont-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto Condensed";
  src:
    url("../fonts/Roboto-Condensed.woff2") format("woff2"),
    url("../fonts/Roboto-Condensed.woff") format("woff"),
    url("../fonts/Roboto-Condensed.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ==================================================================
   Custom Properties (Design Tokens)
   ================================================================== */
:root {
  /* --- Colores --- */
  --green: #6e915f;
  --steel-blue: #6693bf;
  --cyan-soft: #d7e3d8;
  --orange: #e98a00;
  --cream: #fdfefe;
  --paper: #e4d794;
  --ink: #545464;
  --grid-color: rgb(84 84 100 / 0.18);
  --grid-size: 50px;

  /* --- Tipografia --- */
  --font-body: Helvetica, sans-serif;
  --font-display: "IosevkaTerm Nerd Font";
  --font-title: determination;

  /* --- Medidas --- */
  --nav-height: 80px;
  --photo-size: 150px;
  --container-width: 1200px;
  --section-gap: 70px; /* separación vertical uniforme entre secciones */
}

/* ==================================================================
   Reset
   ================================================================== */
* {
  margin: 0;
  padding: 0;
  color: var(--ink);
  box-sizing: border-box;
}

*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
  font-family: var(--font-body);
}

body {
  background-color: var(--cream);
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size); /* Tamaño de cada celda */
}

/* ==================================================================
   Layout general: caja contenedora centrada
   ==================================================================
   Todo el contenido vive dentro de .container: una columna con ancho
   máximo fijo centrada con márgenes automáticos. Cada sección interna
   conserva su propio padding, pero TODAS comparten el mismo ancho de
   contenido y el mismo centro horizontal en pantallas de escritorio.
   ================================================================== */
.container {
  max-width: var(--container-width);
  margin-inline: auto;
}

/* =============== Nav =============== */
nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: sticky;
  top: 10px;
  width: fit-content;
  margin: 10px auto 0;
  padding: 8px;
  border-radius: 50px;
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 40%, transparent);
  box-shadow: 0 4px 18px rgb(0 0 0 / 0.12);
  backdrop-filter: blur(8px);
  z-index: 9999;

  .nav-item {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--ink);
    text-decoration: none;
    padding: 10px 22px;
    border-radius: 50px;
    white-space: nowrap;
    transition:
      background 0.25s ease,
      color 0.25s ease;
  }

  .nav-item:hover {
    background: #000;
    color: #fff;
  }
}

/* =============== Hero =============== */
header {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: center;
  padding: 50px 125px 5px;
  gap: 40px;
  margin-bottom: var(--section-gap);

  .hero-profile {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .hero-photo {
    display: block;
    width: var(--photo-size);
    height: var(--photo-size);
    border-radius: 50%;
    border: 2px solid var(--orange);
    box-shadow: 0 0 45px color-mix(in srgb, var(--orange) 35%, transparent);
    -webkit-user-drag: none; /* Chrome, Safari, Edge */
    -khtml-user-drag: none; /* Konqueror */
    -moz-user-drag: none; /* Firefox antiguo */
    -o-user-drag: none; /* Opera antiguo */
    user-drag: none;
  }

  .hero-about {
    max-width: 800px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-flow: row wrap;
    gap: 5px;
    flex: 1;

    .hero-title {
      font-size: 42px;
      padding-bottom: 10px;
      font-family: "Roboto Condensed";

      .hero-name,
      .hero-nickname {
        font-family: var(--font-title);
        font-size: 52px;
      }

      .hero-name {
        color: var(--orange);
      }

      .hero-nickname {
        color: var(--green);
      }
    }

    .hero-role {
      font-family: var(--font-display);
      font-size: 24px;
      text-shadow:
        0 0 4px color-mix(in srgb, currentColor 55%, transparent),
        0 0 12px color-mix(in srgb, currentColor 25%, transparent);
    }

    .hero-role--dev {
      color: var(--green);
    }

    .hero-role--ai {
      color: var(--orange);
    }

    .hero-bio {
      max-width: 700px;
      font-size: 20px;
    }

    .hero-actions {
      display: flex;
      flex-flow: row wrap;
      gap: 14px;
      margin-top: 12px;
      width: 100%;
    }

    .hero-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 12px 22px;
      font-family: var(--font-display);
      font-size: 18px;
      color: var(--ink);
      text-decoration: none;
      border: 1px solid color-mix(in srgb, var(--green) 60%, transparent);
      border-radius: 10px;
      background: transparent;
      transition:
        background 0.25s ease,
        color 0.25s ease,
        box-shadow 0.25s ease;

      svg {
        width: 22px;
        height: 22px;
        fill: currentColor;
      }
    }

    .hero-btn:hover {
      background: #000;
      color: #fff;
      box-shadow: 0 0 14px rgb(0 0 0 / 0.35);
    }

    .hero-btn:hover span,
    .hero-btn:hover svg {
      color: #fff;
      fill: #fff;
    }
  }
}

/* =============== Layout del main =============== */
main {
  display: block;
  padding: 0 150px 50px;
}

/* =============== Títulos de sección =============== */
/* Base compartida: hover solo en el texto + underline L→R */
.skills-title,
.stack-title,
.projects-title,
.sobremi-title {
  position: relative;
  width: fit-content;
  font-family: var(--font-title);
  font-size: 44px;
  margin-bottom: 15px;
}

.skills-title::after,
.stack-title::after,
.projects-title::after,
.sobremi-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.skills-title:hover::after,
.stack-title:hover::after,
.projects-title:hover::after,
.sobremi-title:hover::after {
  transform: scaleX(1);
}

/* =============== Proyectos =============== */
.projects {
  margin-bottom: var(--section-gap);

  .projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
  }

  .project-card {
    display: grid;
    /* Opción A: la imagen es un banner full-width arriba */
    grid-template-areas:
      "image"
      "title"
      "description"
      "buttons";
    grid-template-columns: 1fr;
    align-items: center;
    gap: 12px 16px;
    padding: 18px 16px;
    border: 1px solid color-mix(in srgb, var(--green) 40%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--green) 8%, transparent);
    transition:
      box-shadow 0.3s ease,
      transform 0.3s ease;
  }

  .project-card:hover {
    box-shadow: 0 0 14px color-mix(in srgb, var(--steel-blue) 45%, transparent);
    transform: translateY(-3px);
  }

  .project-image {
    grid-area: image;
    width: 100%;
    aspect-ratio: 16 / 9; /* banner full-width, proporción de captura ancha */
    align-self: start;
    object-fit: cover; /* rellena el banner sin deformar, recortando lo que sobre */
    border: 1px solid color-mix(in srgb, var(--steel-blue) 35%, transparent);
    border-radius: 10px;
  }

  .project-title {
    grid-area: title;
    font-family: var(--font-display);
    font-size: 28px; /* más jerarquía visual: "peso" por tamaño, sin faux-bold */
    color: var(--ink);
    line-height: 1.1; /* evita que el título grande rompa el grid */
  }

  .project-description {
    grid-area: description;
    font-size: 15px;
    line-height: 1.45;
  }

  .project-buttons {
    grid-area: buttons;
    display: flex;
    flex-flow: row wrap;
    gap: 10px;
  }

  .project-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 18px;
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid color-mix(in srgb, var(--green) 60%, transparent);
    border-radius: 10px;
    background: transparent;
    transition:
      background 0.25s ease,
      color 0.25s ease,
      box-shadow 0.25s ease;
  }

  .project-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
  }

  .project-btn:hover {
    background: #000;
    color: #fff;
    box-shadow: 0 0 14px rgb(0 0 0 / 0.35);

    svg {
      fill: #fff; /* igual que el hero: icono blanco garantizado en hover */
    }
  }
}

/* =============== Skills =============== */
.skills {
  margin-bottom: var(--section-gap);

  .skills-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    list-style: none;
  }

  .skills-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 12px;
    text-align: center;
    font-size: 18px;
    border: 1px solid color-mix(in srgb, var(--orange) 40%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--orange) 8%, transparent);
    transition:
      box-shadow 0.3s ease,
      transform 0.3s ease;
  }

  .skills-item:hover {
    box-shadow: 0 0 14px color-mix(in srgb, var(--orange) 45%, transparent);
    transform: translateY(-3px);
  }

  .skills-icon {
    font-family: var(--font-display);
    font-size: 52px;
  }
}

/* =============== Stack =============== */
.stack {
  margin-bottom: var(--section-gap);

  .stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
  }

  .stack-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 16px;
    border: 1px solid color-mix(in srgb, var(--green) 40%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--green) 8%, transparent);
    transition:
      box-shadow 0.3s ease,
      transform 0.3s ease;
  }

  .stack-card:hover {
    box-shadow: 0 0 14px color-mix(in srgb, var(--steel-blue) 45%, transparent);
    transform: translateY(-3px);
  }

  .stack-area {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--ink);
  }

  .stack-pills {
    display: flex;
    flex-flow: row wrap;
    gap: 8px;

    img {
      height: 28px;
      border-radius: 6px;
    }
  }
}

/* =============== Sobre mí =============== */
footer {
  display: flex;
  flex-flow: column wrap;
  align-content: center;
  justify-content: center;
  padding: 0 150px 50px;
  gap: 15px;
  margin-bottom: var(--section-gap);

  .sobremi {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 40px;
    align-items: center;

    .sobremi-title {
      margin-bottom: 10px;
    }

    .sobremi-paragraph {
      max-width: 600px;
      font-size: 24px;
      line-height: 1.5;
      padding-bottom: 12px;
    }

    .sobremi-name {
      color: var(--orange);
    }

    .sobremi-nickname {
      color: var(--green);
    }

    .sobremi-photo {
      display: flex;
      justify-content: center;
      padding: 10px;
      transform: rotate(10deg);

      img {
        width: 100%;
        max-width: 300px;
        height: auto;
        padding: 14px 14px 50px;
        background: var(--cream);
        border-radius: 6px;
        box-shadow:
          0 12px 24px rgb(0 0 0 / 0.25),
          0 4px 8px rgb(0 0 0 / 0.15);
      }
    }
  }
}

/* =============== End (cierre de página) =============== */
.end {
  background-color: #06080f;
  background-image:
    linear-gradient(rgb(106 192 181 / 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgb(106 192 181 / 0.18) 1px, transparent 1px);
  background-size: 30px 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px 150px;

  .end-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap; /* si no entra en una fila, centra el texto bajo la imagen */
    gap: 10px;

    img {
      width: 160px;
      height: auto; /* respeta la proporción intrínseca 640x512 del logo */
      max-width: 100%;
      -webkit-user-drag: none; /* Chrome, Safari, Edge */
      -khtml-user-drag: none; /* Konqueror */
      -moz-user-drag: none; /* Firefox antiguo */
      -o-user-drag: none; /* Opera antiguo */
      user-drag: none;
    }

    .end-title {
      font-family: var(--font-title);
      font-size: 40px;
      color: var(--cyan-soft);
    }
  }
}

/* ==================================================================
   Media Queries — Responsive
   ==================================================================
   Estrategia: desktop-first. El CSS base está pensado para escritorio;
   estos bloques con `max-width` ajustan el layout cuando la pantalla
   se encoge por debajo de cada breakpoint.

   IMPORTANTE: van AL FINAL del archivo para que, con la misma
   especificidad, la cascada haga que estos valores ganen a los base.

   Breapoints elegidos:
   · ≤ 1024px — tablets / laptops pequeños: se recortan los márgenes.
   · ≤ 768px  — tablets en vertical / móviles grandes: tipografía menor,
                Sobre mí pasa de 2 columnas a 1.
   · ≤ 480px  — móviles pequeños: nav y texto en escala mínima.
   ================================================================== */

/* ---------- ≤ 1024px (tablets y laptops pequeños) ---------- */
@media (max-width: 1024px) {
  header {
    padding: 40px 40px 5px;
  }

  main {
    padding: 0 40px 50px;
  }

  footer {
    padding: 0 40px 50px;
  }

  .end {
    padding: 25px 40px;
  }
}

/* ---------- ≤ 768px (tablets verticales y móviles grandes) ---------- */
@media (max-width: 768px) {
  nav {
    display: grid; /* una sola fila aunque la pantalla sea angosta */
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 4px;
    width: min(100%, 520px);

    .nav-item {
      font-size: clamp(12px, 2.4vw, 15px);
      padding: 9px 6px;
      text-align: center;
    }
  }

  header {
    flex-direction: column; /* foto arriba, texto abajo */
    padding: 35px 20px 5px;
    gap: 25px;
    margin-bottom: var(--section-gap);

    .hero-about {
      width: 100%;
      align-items: flex-start;
    }

    .hero-title {
      font-size: 34px;

      .hero-name,
      .hero-nickname {
        font-size: 40px;
      }
    }

    .hero-role {
      font-size: 20px;
    }

    .hero-bio {
      font-size: 17px;
    }

    .hero-btn {
      font-size: 16px;
      padding: 10px 18px;
    }
  }

  .skills-title,
  .stack-title,
  .projects-title,
  .sobremi-title {
    font-size: 38px;
  }

  footer .sobremi {
    grid-template-columns: 1fr; /* 2 columnas → 1 */
    gap: 30px;
    justify-items: center;
    text-align: center;

    .sobremi-paragraph {
      font-size: 20px;
    }

    .sobremi-photo {
      transform: rotate(6deg);
    }
  }

  .end .end-logo {
    img {
      width: 120px;
    }

    .end-title {
      font-size: 30px;
    }
  }

  /* Card de proyecto: de 2 columnas a 1 (imagen arriba) */
  .projects .project-card {
    grid-template-areas:
      "image"
      "title"
      "description"
      "buttons";
    grid-template-columns: 1fr;
    align-items: start;
  }

  .projects .project-image {
    justify-self: center;
  }
}

/* ---------- ≤ 480px (móviles pequeños) ---------- */
@media (max-width: 480px) {
  :root {
    /* Se sobreescribe un design token: hereda en todos los usos */
    --photo-size: 120px;
  }

  nav {
    display: grid; /* una sola fila aunque la pantalla sea angosta */
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 4px;
    width: min(100%, 440px);

    .nav-item {
      font-size: clamp(10px, 2.6vw, 13px);
      padding: 9px 4px;
      text-align: center;
    }
  }

  header {
    padding: 30px 16px 5px;
    gap: 20px;
    margin-bottom: var(--section-gap);

    .hero-title {
      font-size: 26px;

      .hero-name,
      .hero-nickname {
        font-size: 32px;
      }
    }

    .hero-role {
      font-size: 17px;
    }

    .hero-bio {
      font-size: 16px;
    }

    .hero-btn {
      font-size: 15px;
      gap: 8px;

      svg {
        width: 18px;
        height: 18px;
      }
    }
  }

  main {
    padding: 0 16px 40px;
  }

  .skills {
    .skills-title {
      font-size: 32px;
    }

    .skills-list {
      grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
      gap: 12px;
    }

    .skills-item {
      font-size: 15px;
      padding: 16px 10px;
    }

    .skills-icon {
      font-size: 42px;
    }
  }

  .stack {
    .stack-title {
      font-size: 32px;
    }

    .stack-area {
      font-size: 18px;
    }

    .stack-pills img {
      height: 24px;
    }
  }

  .projects {
    .projects-title {
      font-size: 32px;
    }

    .project-card {
      padding: 12px;
      gap: 8px 10px;
    }

    .project-image {
      width: 100%;
      max-width: 200px;
      height: auto;
    }

    .project-title {
      font-size: 24px; /* mantiene el peso del título también en ≤768px */
    }

    .project-description {
      font-size: 14px;
    }

    .project-btn {
      font-size: 14px;
      padding: 7px 14px;
    }
  }

  footer {
    padding: 0 16px 50px;

    .sobremi-title {
      font-size: 32px;
    }

    .sobremi-paragraph {
      font-size: 17px;
    }

    .sobremi-photo img {
      max-width: 230px;
    }
  }

  .end {
    padding: 20px 16px;

    .end-logo {
      img {
        width: 90px;
      }

      .end-title {
        font-size: 30px;
      }
    }
  }
}
