/* ==========================================================
   Portfolio — Juan J. Morejon A.
   Estilo cyberpunk: fondo oscuro, cian + magenta,
   tipografía monoespaciada, scanlines y rejilla de fondo.
   ========================================================== */

:root {
  --bg: #07070f;
  --bg-panel: rgba(12, 14, 28, 0.78);
  --cyan: #00f0ff;
  --magenta: #ff2a6d;
  --text: #d4dff0;
  --muted: #7d8aa8;
  --line: rgba(0, 240, 255, 0.18);

  --font-body: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-display: "Share Tech Mono", var(--font-body);

  --max-width: 1100px;
  --gutter: clamp(16px, 5vw, 48px);
  --cut: 14px; /* tamaño de las esquinas recortadas */
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);

  /* Rejilla de fondo + halos de color */
  background-image:
    radial-gradient(ellipse at 15% 0%, rgba(255, 42, 109, 0.14), transparent 55%),
    radial-gradient(ellipse at 90% 30%, rgba(0, 240, 255, 0.10), transparent 50%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  background-attachment: fixed;
}

/* Rejilla en perspectiva en la parte inferior */
body::before {
  content: "";
  position: fixed;
  left: -50%;
  right: -50%;
  bottom: 0;
  height: 45vh;
  background-image:
    linear-gradient(rgba(255, 42, 109, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 42, 109, 0.45) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(300px) rotateX(60deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  pointer-events: none;
  z-index: -1;
}

/* Scanlines tipo monitor CRT */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.28) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  pointer-events: none;
  z-index: 100;
}

::selection {
  background: var(--magenta);
  color: var(--bg);
}

a {
  color: var(--cyan);
  text-decoration: none;
}

/* ---------- Navegación ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gutter);
  background: rgba(7, 7, 15, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
}

.cursor {
  color: var(--magenta);
  animation: blink 1s steps(1) infinite;
}

.nav__links {
  display: flex;
  gap: clamp(12px, 3vw, 32px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__links a {
  color: var(--text);
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav__links a span {
  color: var(--magenta);
  margin-right: 4px;
}

.nav__links a:hover {
  color: var(--cyan);
}

/* ---------- Secciones ---------- */

.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(56px, 10vw, 110px) var(--gutter);
}

.section__title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 40px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section__title span {
  color: var(--magenta);
}

.section__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

/* ---------- 01. Sobre mí ---------- */

.about {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  align-items: center;
  gap: clamp(32px, 6vw, 72px);
  min-height: calc(100vh - 70px);
}

.about__hello {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.95rem;
}

.about__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  font-weight: 400;
  line-height: 1.1;
  color: #fff;
  text-shadow:
    2px 0 var(--magenta),
    -2px 0 var(--cyan);
}

.about__role {
  margin: 12px 0 24px;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 600;
  color: var(--magenta);
}

.about__role::before {
  content: "> ";
  color: var(--cyan);
}

.amp {
  color: var(--cyan);
}

.about__bio {
  max-width: 55ch;
  margin: 0 0 16px;
  color: var(--text);
}

.about__location {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 0.9rem;
}

.tag {
  color: var(--cyan);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: inline-block;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  background: rgba(0, 240, 255, 0.05);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  transition: background 0.2s, color 0.2s;
  overflow-wrap: anywhere;
}

.links a:hover,
.links a:focus-visible {
  color: var(--bg);
  background: var(--cyan);
}

.about__avatar {
  position: relative;
  margin: 0;
  justify-self: center;
  width: 100%;
  max-width: 400px;
}

.about__avatar img {
  display: block;
  width: 100%;
  height: auto;
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 28px 100%, 0 calc(100% - 28px));
}

/* Marco desplazado detrás de la imagen */
.about__avatar::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translate(14px, 14px);
  border: 1px solid var(--magenta);
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 28px 100%, 0 calc(100% - 28px));
  z-index: -1;
}

/* Espacio para que el botón flotante no tape los enlaces al cargar */
.about {
  padding-bottom: 140px;
}

/* Botón flotante fijo con forma de chip (punto magenta de "pin 1" en la esquina).
   El JS de index.html le añade .is-up al llegar a Habilidades. */
.scroll-hint {
  position: fixed;
  z-index: 20;
  right: clamp(24px, 4vw, 48px); /* deja sitio a las patillas laterales */
  bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 56px;
  color: var(--cyan);
  border: 2px solid currentColor;
  border-radius: 3px;
  background:
    radial-gradient(circle at 8px 8px, var(--magenta) 2px, transparent 2.5px),
    rgba(7, 7, 15, 0.85);
  animation: float 2s ease-in-out infinite;
  transition: color 0.2s, rotate 0.5s ease;
}

/* Patillas del chip a ambos lados */
.scroll-hint::before,
.scroll-hint::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 7px;
  background: repeating-linear-gradient(
    to bottom,
    currentColor 0 3px,
    transparent 3px 8px
  );
}

.scroll-hint::before { left: -9px; }
.scroll-hint::after  { right: -9px; }

/* Doble flecha que se enciende en cascada */
.scroll-hint__arrow {
  width: 10px;
  height: 10px;
  margin-top: -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  animation: arrow-pulse 1.6s ease-in-out infinite;
}

.scroll-hint__arrow + .scroll-hint__arrow {
  animation-delay: 0.3s;
}

.scroll-hint:hover,
.scroll-hint:focus-visible {
  color: var(--magenta);
}

/* Estado invertido: el chip gira y lleva de vuelta arriba */
.scroll-hint.is-up {
  rotate: 180deg;
}

/* ---------- 02. Habilidades ---------- */

/* Flex en lugar de grid para que la última fila incompleta quede centrada */
.skills__grid {
  --gap: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
}

.skill-group {
  flex: 0 0 calc((100% - 2 * var(--gap)) / 3);
  position: relative;
  padding: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--magenta);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}

.skill-group h3 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--cyan);
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 5px 12px;
  font-size: 0.82rem;
  color: var(--text);
  border: 1px solid rgba(0, 240, 255, 0.45);
  background: rgba(0, 240, 255, 0.04);
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.chips li:hover {
  color: var(--magenta);
  border-color: var(--magenta);
  box-shadow: 0 0 10px rgba(255, 42, 109, 0.35);
}

/* ---------- Footer ---------- */

.footer {
  padding: 32px var(--gutter);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.footer p {
  margin: 0;
}

.footer span {
  color: var(--cyan);
}

/* ---------- Animaciones ---------- */

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

@keyframes arrow-pulse {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor,
  .scroll-hint,
  .scroll-hint__arrow { animation: none; }
  .scroll-hint { transition: color 0.2s; }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .skill-group {
    flex-basis: calc((100% - var(--gap)) / 2);
  }
}

@media (max-width: 800px) {
  .about {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .about__avatar {
    order: -1;
    max-width: 280px;
  }
}

@media (max-width: 600px) {
  .skill-group {
    flex-basis: 100%;
  }
}

@media (max-width: 480px) {
  .nav__logo {
    font-size: 1.2rem;
  }

  .nav__links a span {
    display: none;
  }
}
