/* ============================================================
   Componentes — navegacion, listas de especificacion, figuras,
   formulario y dialogos. Sin tarjetas: el contenido se apoya en el
   fondo y se separa con filetes de 1px.
   ============================================================ */

/* ---------- Cabecera ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  border-bottom: 1px solid transparent;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}

.site-header.is-stuck {
  background: var(--bg);
  border-bottom-color: var(--rule-soft);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  height: var(--header-h);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.28rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand .brand-dot {
  color: var(--live);
}

.nav-links {
  display: flex;
  align-items: baseline;
  gap: 26px;
}

.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  gap: 5px;
  padding-block: 6px 5px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.06em;
  color: var(--ink-3);
  transition: color 0.3s var(--ease);
}

/* El numero lleva el color del tema de su seccion; apagado en reposo,
   encendido al pasar o cuando esa seccion esta a la vista. */
.nav-links a sup {
  font-size: 0.62em;
  line-height: 1;
  color: var(--ink-4);
  opacity: 0.75;
  transition: opacity 0.3s var(--ease), text-shadow 0.3s var(--ease);
}

.nav-links a[href="#proyectos"] sup,
.nav-links a[href="#contacto"] sup {
  color: var(--sig-live);
}

.nav-links a[href="#infraestructura"] sup,
.nav-links a[href="#stack"] sup,
.nav-links a[href="#perfil"] sup {
  color: var(--sig-tech);
}

.nav-links a[href="#trayectoria"] sup {
  color: var(--sig-next);
}

.nav-links a:hover sup,
.nav-links a.is-active sup {
  opacity: 1;
  text-shadow: 0 0 10px currentColor;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--ink);
  scale: 0 1;
  transform-origin: left;
  transition: scale 0.35s var(--ease);
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--ink);
}

.nav-links a:hover::after,
.nav-links a.is-active::after {
  scale: 1 1;
}

/* El subrayado activo adopta el color del tema de la seccion */
.nav-links a[href="#proyectos"].is-active::after,
.nav-links a[href="#contacto"].is-active::after {
  background: var(--sig-live);
  box-shadow: 0 0 8px var(--sig-live-soft);
}

.nav-links a[href="#infraestructura"].is-active::after,
.nav-links a[href="#stack"].is-active::after,
.nav-links a[href="#perfil"].is-active::after {
  background: var(--sig-tech);
  box-shadow: 0 0 8px var(--sig-tech-soft);
}

.nav-links a[href="#trayectoria"].is-active::after {
  background: var(--sig-next);
  box-shadow: 0 0 8px var(--sig-next-soft);
}

.nav-actions {
  display: flex;
  align-items: baseline;
  gap: 22px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.06em;
}

.nav-actions button,
.nav-actions a {
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.nav-toggle i {
  position: relative;
  display: block;
  width: 20px;
  height: 1px;
  background: currentColor;
  transition: background 0.2s var(--ease);
}

.nav-toggle i::before,
.nav-toggle i::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 1px;
  background: currentColor;
  transition: translate 0.3s var(--ease), rotate 0.3s var(--ease);
}

.nav-toggle i::before {
  translate: 0 -6px;
}

.nav-toggle i::after {
  translate: 0 6px;
}

.nav-toggle[aria-expanded="true"] i {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] i::before {
  translate: 0 0;
  rotate: 45deg;
}

.nav-toggle[aria-expanded="true"] i::after {
  translate: 0 0;
  rotate: -45deg;
}

/* Panel movil */
.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 55;
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--gutter) 15vh;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mobile-menu.is-open {
  display: flex;
}

.mobile-link {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 9vw, 2.6rem);
  line-height: 1;
  color: var(--ink);
}

.mobile-link .num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

/* Mismo codigo de color que en escritorio */
.mobile-link[href="#proyectos"] .num,
.mobile-link[href="#contacto"] .num {
  color: var(--sig-live);
}

.mobile-link[href="#infraestructura"] .num,
.mobile-link[href="#stack"] .num,
.mobile-link[href="#perfil"] .num {
  color: var(--sig-tech);
}

.mobile-link[href="#trayectoria"] .num {
  color: var(--sig-next);
}

.mobile-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  margin-top: 36px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.06em;
}

/* ---------- Lista de especificacion: etiqueta / valor ---------- */

.spec {
  border-top: 1px solid var(--rule);
}

.spec-row {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 12px 40px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}

.spec-row dt,
.spec-row .spec-key {
  padding-top: 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.spec-row dd,
.spec-row .spec-val {
  max-width: 62ch;
  color: var(--ink-2);
}

.spec-row dd strong,
.spec-row .spec-val strong {
  color: var(--ink);
  font-weight: 500;
}

/* ---------- Figuras e imagenes ---------- */

.figure {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--bg-lift);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.4s var(--ease);
}

.figure:hover,
.figure:focus-visible {
  border-color: var(--ink-4);
}

.figure img {
  display: block;
  width: 100%;
}

/* Al pasar por la imagen se subraya su pie, como cualquier otro enlace del
   sitio. No hay lupa ni acercamiento: el gesto es "abrir", no "ampliar". */
.figure + .figure-caption span:first-child {
  position: relative;
  transition: color 0.3s var(--ease);
}

.figure + .figure-caption span:first-child::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: currentColor;
  scale: 0 1;
  transform-origin: left;
  transition: scale 0.4s var(--ease);
}

.figure:hover + .figure-caption span:first-child,
.figure:focus-visible + .figure-caption span:first-child {
  color: var(--ink);
}

.figure:hover + .figure-caption span:first-child::after,
.figure:focus-visible + .figure-caption span:first-child::after {
  scale: 1 1;
}

.figure-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

/* El dato de la derecha es contexto decorativo: sobra en pantallas angostas. */
@media (max-width: 560px) {
  .figure-caption span[aria-hidden] {
    display: none;
  }
}

/* Tira de miniaturas: imagenes desnudas, sin marco ni pie */
.strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

@media (min-width: 620px) {
  .strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.strip button {
  padding: 0;
  border: 1px solid var(--rule-soft);
  overflow: hidden;
  opacity: 0.74;
  cursor: pointer;
  transition: border-color 0.35s var(--ease), opacity 0.35s var(--ease);
}

.strip button:hover,
.strip button:focus-visible {
  opacity: 1;
  border-color: var(--ink-4);
}

.strip img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--bg-lift);
}

.strip img.is-centered {
  object-position: center;
}

/* ---------- Formulario ---------- */

.field {
  display: block;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.3s var(--ease);
}

.field:focus-within {
  border-bottom-color: var(--ink);
}

.field > span {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.6;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-3);
}

.field input:focus,
.field textarea:focus {
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

/* Trampa antispam: recortada del flujo visual y fuera del orden de tabulacion,
   sin desplazamientos negativos que puedan ensanchar la pagina. */
.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

.form-status {
  min-height: 1.3em;
  font-size: var(--fs-small);
  color: var(--ink-3);
}

.form-status[data-state="error"] {
  color: #e8a598;
}

.form-status[data-state="ok"] {
  color: var(--live);
}

/* Accion: texto con filete, no pastilla */
.action {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 500;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

.action:hover,
.action:focus-visible {
  background: var(--ink);
  color: var(--bg);
}

.action--quiet {
  border-color: var(--rule);
  color: var(--ink-2);
}

.action--quiet:hover,
.action--quiet:focus-visible {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

/* ---------- Dialogos ---------- */

.dialog {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 48px);
}

.dialog.is-open {
  display: flex;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 9, 0.94);
}

.dialog-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 34px;
  border: 1px solid var(--rule);
  background: var(--bg);
}

.dialog-panel h3 {
  font-size: 1.7rem;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: color 0.25s var(--ease);
}

.dialog-close:hover {
  color: var(--ink);
}

/* Visor de imagenes */
.lightbox .dialog-panel {
  max-width: min(1320px, 100%);
  padding: 0;
  border: 0;
  background: transparent;
}

.lightbox-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(52vh, 440px);
  max-height: 80vh;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--bg-lift);
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  user-select: none;
  transition: transform 0.25s var(--ease);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 46px;
  height: 46px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 1rem;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.lightbox-nav:hover {
  color: var(--ink);
  border-color: var(--ink-4);
}

.lightbox-nav.prev {
  left: 14px;
}

.lightbox-nav.next {
  right: 14px;
}

.lightbox-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 16px;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.05em;
  color: var(--ink-3);
}

.lightbox-zoom {
  display: flex;
  align-items: center;
  gap: 18px;
}

.lightbox-zoom button {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.08em;
  color: var(--ink-3);
  transition: color 0.25s var(--ease);
}

.lightbox-zoom button:hover {
  color: var(--ink);
}

/* ---------- Puntos de quiebre ---------- */

@media (max-width: 1024px) {
  .nav-links,
  .nav-actions .is-desktop {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }
}

@media (max-width: 560px) {
  .spec-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 18px 0;
  }

  .dialog-panel {
    padding: 26px;
  }

  .lightbox-nav {
    width: 38px;
    height: 38px;
  }
}
