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

:root {
  --bg: #08111f;
  --bg-soft: #0d1728;
  --bg-elevated: #111f36;
  --surface: rgb(0, 0, 0);
  --surface-strong: #132540;
  --text: #edf3ff;
  --muted: #9cafc9;
  --brand: #3dd9b3;
  --brand-strong: #1bb98f;
  --brand-soft: rgba(61, 217, 179, 0.16);
  --accent: #7cc7ff;
  --border: rgba(181, 205, 242, 0.16);
  --shadow: 0 24px 80px rgba(3, 10, 21, 0.45);
  --radius: 24px;
  --radius-sm: 16px;
  --page-gradient:
    radial-gradient(
      circle at top left,
      rgba(124, 199, 255, 0.18),
      transparent 28%
    ),
    radial-gradient(
      circle at top right,
      rgba(61, 217, 179, 0.14),
      transparent 30%
    ),
    linear-gradient(180deg, #09111d 0%, #0b1524 50%, #09111d 100%);
  --navbar-bg: rgba(8, 17, 31, 0.78);
  --footer-bg: rgba(12, 23, 40, 0.85);
  --modal-overlay: rgba(14, 191, 159, 0.496);
  --mobile-nav-bg: rgba(10, 20, 36, 0.99);
  --mobile-nav-link-bg: rgba(255, 255, 255, 0.03);
  --mobile-nav-link-hover: rgba(61, 217, 179, 0.12);
  --featured-card-bg: linear-gradient(
    180deg,
    rgba(61, 217, 179, 0.12),
    rgba(17, 31, 54, 0.88)
  );
}

body[data-theme="light"] {
  --bg: #eff4fb;
  --bg-soft: #dfe8f4;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --text: #102033;
  --muted: #57677b;
  --brand: #0e9f8b;
  --brand-strong: #087c6d;
  --brand-soft: rgba(14, 159, 139, 0.12);
  --accent: #176bb3;
  --border: rgba(16, 32, 51, 0.12);
  --shadow: 0 24px 80px rgba(65, 92, 124, 0.18);
  --page-gradient:
    radial-gradient(
      circle at top left,
      rgba(23, 107, 179, 0.12),
      transparent 26%
    ),
    radial-gradient(
      circle at top right,
      rgba(14, 159, 139, 0.12),
      transparent 28%
    ),
    linear-gradient(180deg, #f6f9fd 0%, #e9f0f7 48%, #f7fbff 100%);
  --navbar-bg: rgba(246, 249, 253, 0.82);
  --footer-bg: rgba(255, 255, 255, 0.86);
  --modal-overlay: rgba(135, 160, 190, 0.42);
  --mobile-nav-bg: rgba(255, 255, 255, 0.98);
  --mobile-nav-link-bg: rgba(16, 32, 51, 0.04);
  --mobile-nav-link-hover: rgba(14, 159, 139, 0.12);
  --featured-card-bg: linear-gradient(
    180deg,
    rgba(14, 159, 139, 0.14),
    rgba(255, 255, 255, 0.96)
  );
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: #08111f;
  overscroll-behavior-y: none;
}

body {
  min-height: 100%;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text);
  line-height: 1.6;
  background-color: var(--bg);
  background: var(--page-gradient);
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

body.menu-open,
body.modal-open {
  overflow: hidden;
}

main {
  overflow: hidden;
}

section {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 104px 0;
  scroll-margin-top: 96px;
}

h1,
h2,
h3 {
  line-height: 1.1;
}

h1 {
  font-size: clamp(2.8rem, 6vw, 5rem);
  letter-spacing: -0.05em;
}

h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.04em;
}

h3 {
  font-size: 1.2rem;
}

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

button,
a {
  font: inherit;
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 18px;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 22px;
}

.section-copy {
  max-width: 640px;
  margin-bottom: 28px;
}

.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  background: var(--navbar-bg);
}

.nav-container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.logo {
  font-weight: 800;
  letter-spacing: -0.03em;
}

.logo span span,
.footer-brand span {
  color: var(--brand);
}

nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

nav a {
  color: var(--muted);
  transition: color 0.25s ease;
}

nav a:hover,
nav a.active {
  color: var(--text);
}

.btn-nav,
.btn,
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 999px;
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    background 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
}

.btn-nav,
.btn {
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #051019;
  font-weight: 700;
  box-shadow: 0 12px 32px rgba(61, 217, 179, 0.22);
}

.btn-outline {
  padding: 13px 22px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.btn-nav:hover,
.btn:hover,
.btn-outline:hover {
  transform: translateY(-2px);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--text);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.nav-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 999px;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 136px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 8px 16px;
  margin-bottom: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--accent);
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulse 1.8s infinite;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, 0.9fr);
  gap: 36px;
  align-items: center;
}

.hero-copy {
  max-width: 700px;
}

.typing-text {
  min-height: 52px;
  margin-top: 12px;
  color: var(--accent);
  font-weight: 600;
}

.typing-text::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 8px;
  background: var(--brand);
  animation: blink 0.8s steps(1) infinite;
  vertical-align: middle;
}

.hero-description {
  max-width: 620px;
  margin: 22px 0 32px;
  font-size: 1.06rem;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-panel {
  display: grid;
  gap: 18px;
}

.hero-card,
.value-card,
.project-card,
.skills-group,
.stat-item {
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 28px;
  border-radius: var(--radius);
}

.card-label,
.project-badge {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-card h3 {
  margin: 18px 0 12px;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.stat-item {
  padding: 24px;
  border-radius: 20px;
}

.stat-number {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--brand);
}

.stat-label {
  color: var(--muted);
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 32px;
  align-items: start;
}

.about-copy {
  display: grid;
  gap: 18px;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.value-card {
  padding: 24px;
  border-radius: 22px;
}

.value-card i {
  font-size: 1.4rem;
  color: var(--brand);
  margin-bottom: 16px;
}

.value-card h3 {
  margin-bottom: 10px;
}

.projects {
  position: relative;
}

.projects::before,
.skills::before {
  content: "";
  position: absolute;
  inset: 50px 0 auto;
  height: calc(100% - 100px);
  border-radius: 36px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.01)
  );
  z-index: -1;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.project-card {
  padding: 28px;
  border-radius: 26px;
  transition:
    transform 0.25s ease,
    border-color 0.25s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(124, 199, 255, 0.34);
}

.project-card.featured {
  background: var(--featured-card-bg);
  border-color: rgba(14, 159, 139, 0.24);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.project-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-icon {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(124, 199, 255, 0.12);
  color: var(--accent);
}

.project-card h3 {
  margin-bottom: 12px;
}

.project-tags,
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.project-tags {
  margin-top: 18px;
  margin-bottom: 18px;
}

.project-tags span,
.skills-grid div {
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.92rem;
}

.project-link-icon {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(61, 217, 179, 0.12);
  color: var(--accent);
  border: 1px solid rgba(61, 217, 179, 0.16);
  transition:
    transform 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    background 0.25s ease;
}

.project-link-icon:hover {
  transform: translateY(-2px);
  color: var(--brand);
  border-color: rgba(61, 217, 179, 0.35);
  background: rgba(61, 217, 179, 0.18);
}

.skills {
  position: relative;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--modal-overlay);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.28s ease,
    visibility 0.28s ease;
  z-index: 2000;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  position: relative;
  width: min(92vw, 760px);
  aspect-ratio: 1 / 1;
  max-height: min(92vh, 760px);
  overflow: auto;
  padding: 34px;
  border-radius: 32px;
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(19, 37, 64, 0.98),
    rgba(10, 20, 36, 0.98)
  );
  box-shadow: var(--shadow);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.28s ease;
}

.modal.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  z-index: 2;
}

.modal-copy {
  margin: 10px 0 26px;
}

.skills-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.skills-group {
  padding: 20px;
  border-radius: 22px;
}

.skills-group h3 {
  margin-bottom: 14px;
}

body[data-theme="light"] .modal-content > h2,
body[data-theme="light"] .modal-content > .modal-copy,
body[data-theme="light"] .modal-close {
  color: #edf3ff;
}

.footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 32px;
  padding: 32px;
  border-radius: 30px;
  border: 1px solid var(--border);
  background: var(--footer-bg);
}

.theme-toggle {
  position: fixed;
  left: 22px;
  bottom: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  z-index: 1100;
  transition:
    transform 0.25s ease,
    background 0.25s ease,
    color 0.25s ease;
}

.theme-toggle:hover {
  transform: translateY(-4px) scale(1.03);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 18px;
}

/* LINKS izquierda */
.footer-links {
  display: flex;
  gap: 16px;
}

/* REDES derecha */
.footer-socials {
  display: flex;
  gap: 16px;
}

/* ICONOS */
.footer-socials a {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

/* FOOTER bottom */
.footer-bottom {
  text-align: center;
  opacity: 0.7;
}

.whatsapp-float {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #16a34a);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  box-shadow: 0 18px 34px rgba(22, 163, 74, 0.35);
  z-index: 1100;
  transition: transform 0.25s ease;
}

.whatsapp-float:hover {
  transform: translateY(-4px) scale(1.03);
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.45;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

@media (max-width: 980px) {
  .hero-grid,
  .about-layout,
  .projects-grid,
  .skills-modal-grid,
  .value-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .mini-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .navbar {
    background: color-mix(in srgb, var(--navbar-bg) 96%, transparent);
  }

  section {
    width: min(100% - 24px, 1120px);
    padding: 84px 0;
  }

  .nav-container {
    min-height: 76px;
    position: relative;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .btn-nav {
    display: none;
  }

  nav {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28);
    background: var(--mobile-nav-bg);
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-12px);
    transition:
      opacity 0.25s ease,
      transform 0.25s ease,
      visibility 0.25s ease;
  }

  nav.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  nav a {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--mobile-nav-link-bg);
  }

  nav a:hover,
  nav a.active {
    background: var(--mobile-nav-link-hover);
  }

  .buttons {
    flex-direction: column;
  }

  .btn,
  .btn-outline {
    width: 100%;
  }

  .modal-content {
    width: min(calc(100vw - 24px), calc(100vh - 24px));
    height: min(calc(100vw - 24px), calc(100vh - 24px));
    max-width: none;
    max-height: none;
    aspect-ratio: 1 / 1;
    border-radius: 24px;
    padding: 28px 22px;
  }

  .footer {
    padding: 24px;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 2.45rem;
  }

  .typing-text {
    min-height: 42px;
    font-size: 1.2rem;
  }

  .nav-container {
    gap: 12px;
  }

  .logo {
    font-size: 0.98rem;
  }

  .mini-stats {
    grid-template-columns: 1fr;
  }

  .project-card,
  .hero-card,
  .value-card,
  .skills-group,
  .stat-item {
    padding: 22px;
  }

  .modal {
    padding: 8px;
  }

  .modal-content {
    width: min(calc(100vw - 16px), calc(100vh - 16px));
    height: min(calc(100vw - 16px), calc(100vh - 16px));
    border-radius: 22px;
    padding: 24px 18px;
  }

  .footer-content {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-content {
    align-items: center;
    justify-content: center;
  }

  .footer-bottom {
    justify-content: center;
  }

  .whatsapp-float {
    width: 58px;
    height: 58px;
    right: 16px;
    bottom: 16px;
  }

  .theme-toggle {
    width: 54px;
    height: 54px;
    left: 16px;
    bottom: 16px;
  }
  .detail {
    display: none;
  }
}

/* ================= SCROLLBAR (Chrome / Edge / Safari) ================= */
.modal-content::-webkit-scrollbar {
  width: 10px;
}

/* Track (fondo del scroll) */
.modal-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

/* Thumb (la barrita azul) */
.modal-content::-webkit-scrollbar-thumb {
  background: rgba(16, 91, 202, 0.7);
  border-radius: 10px;
  transition: 0.3s;
}

/* Hover del scroll */
.modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 91, 202, 1);
}

.footer-bottom {
  text-align: center;
}

/* modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--modal-overlay);
  backdrop-filter: blur(10px);
  z-index: 9999;
}

/* cuando se abre */
.modal-overlay.active {
  display: flex;
}

.modal-box {
  width: min(420px, 92vw);
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  transform: translateY(10px) scale(0.98);
  animation: modalIn 0.25s ease forwards;
}

.modal-box h3 {
  margin-bottom: 12px;
  color: var(--text);
}

.modal-box p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* BOTÓN (verde brand gradient como pediste) */
.modal-box button {
  margin-top: 18px;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  font-weight: 700;
  color: #051019;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  box-shadow: 0 12px 28px rgba(61, 217, 179, 0.25);
  transition: transform 0.2s ease;
}

.modal-box button:hover {
  transform: translateY(-2px);
}

/* animación suave */
@keyframes modalIn {
  to {
    transform: translateY(0) scale(1);
  }
}

.blur-name {
  color: var(--brand);
  filter: blur(0.4px);
  text-shadow: 0 0 10px rgba(61, 217, 179, 0.35);
  font-weight: 700;
}

@media (max-width: 768px) {
  .modal-content {
    width: min(92vw, 600px);
    height: auto;
    max-height: 85vh;
    aspect-ratio: unset;
    overflow-y: auto;
  }
}

@media (max-width: 560px) {
  .modal-content {
    width: min(94vw, 560px);
    height: auto;
    max-height: 88vh;
    aspect-ratio: unset;
    overflow-y: auto;
    padding: 22px 16px;
  }
}

/* modal skill */
.modal-content {
  position: relative;
}

/* el botón SIEMPRE visible */
.modal-close {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* skill */
.skills-grid div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.skills-grid i {
  font-size: 1.2rem;
  min-width: 20px;
}

.modal-content h2 {
  font-size: 2rem;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
