@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --accent: #00e5ff;
  --violet: #8b5cf6;
  --pink: #ff3cac;
  --bg: #070b12;
  --surface: #101824;
  --text-muted: #aab4c3;
  --container-max: 1120px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 82px;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: #f8fafc;
  font-family: Inter, sans-serif;
  overflow-x: hidden;
  line-height: 1.65;
}

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

main {
  width: 100%;
  overflow-x: clip;
}

section[id] {
  scroll-margin-top: 96px;
}

.navbar {
  padding-top: max(.42rem, env(safe-area-inset-top));
  z-index: 1030;
}

.navbar .container {
  padding-left: max(.75rem, env(safe-area-inset-left));
  padding-right: max(.75rem, env(safe-area-inset-right));
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
.navbar-brand {
  font-family: "Space Grotesk", sans-serif;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: anywhere;
}

.container {
  width: 100%;
  max-width: var(--container-max);
}

/* Navbar */
.glass-nav {
  background: rgba(7, 11, 18, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-glyph {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  font-size: 11px;
}

.navbar-brand {
  white-space: nowrap;
}

.nav-link {
  color: #b9c2d0 !important;
  transition: color .25s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #fff !important;
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #00b8ff);
  border: 0;
  color: #041016;
  font-weight: 700;
  box-shadow: 0 0 28px rgba(0, 229, 255, .25);
  transition: transform .3s ease, box-shadow .3s ease;
}

.btn-accent:hover,
.btn-accent:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(0, 229, 255, .45);
  color: #041016;
}

/* Hero */
.hero {
  min-height: calc(100svh - 64px);
  padding-top: clamp(32px, 4vh, 56px);
  padding-bottom: clamp(32px, 4vh, 56px);
  background:
    radial-gradient(circle at 78% 35%, rgba(139, 92, 246, .18), transparent 28%),
    radial-gradient(circle at 20% 80%, rgba(0, 229, 255, .08), transparent 30%);
}

.hero .container {
  max-width: var(--container-max);
}

.hero h1 {
  font-size: clamp(2.05rem, 4.1vw, 3.65rem);
  line-height: .99;
  letter-spacing: -.045em;
  max-width: 780px;
}

.hero .lead {
  max-width: 700px;
  font-size: clamp(.94rem, 1.15vw, 1.06rem);
}

.hero-badge,
.section-kicker {
  color: var(--accent);
  background: rgba(0, 229, 255, .08);
  border: 1px solid rgba(0, 229, 255, .22);
  letter-spacing: .08em;
  font-size: .72rem;
}

.section-kicker {
  display: inline-block;
  padding: .45rem .75rem;
  border-radius: 50rem;
}

.gradient-text {
  background: linear-gradient(90deg, var(--accent), #fff, var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .4;
  animation: float 8s ease-in-out infinite;
  pointer-events: none;
}

.orb-one {
  width: clamp(150px, 22vw, 250px);
  height: clamp(150px, 22vw, 250px);
  background: var(--violet);
  right: 3%;
  top: 18%;
}

.orb-two {
  width: clamp(120px, 17vw, 180px);
  height: clamp(120px, 17vw, 180px);
  background: var(--pink);
  left: -5%;
  bottom: 8%;
  animation-delay: -3s;
}

/* Interactive profile */
.profile-stage {
  width: min(100%, 330px);
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  margin-inline: auto;
}

.profile-image {
  width: 82%;
  height: 82%;
  object-fit: cover;
  border-radius: 50%;
  position: relative;
  z-index: 3;
  border: 5px solid rgba(255, 255, 255, .08);
  box-shadow: 0 0 55px rgba(0, 229, 255, .2);
  transition: transform .5s ease, box-shadow .5s ease;
}

.profile-stage:hover .profile-image {
  transform: scale(1.045) rotate(1deg);
  box-shadow: 0 0 100px rgba(139, 92, 246, .4);
}

.profile-ring {
  position: absolute;
  border: 1px solid rgba(0, 229, 255, .35);
  border-radius: 50%;
  animation: spin 18s linear infinite;
  pointer-events: none;
}

.ring-one {
  inset: 3%;
  border-top-color: var(--accent);
  border-right-color: transparent;
}

.ring-two {
  inset: 9%;
  border-color: rgba(255, 60, 172, .35);
  border-bottom-color: var(--pink);
  animation-direction: reverse;
  animation-duration: 12s;
}

.profile-glow {
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet), var(--pink));
  filter: blur(42px);
  opacity: .28;
}

.floating-card {
  position: absolute;
  z-index: 4;
  max-width: min(44%, 180px);
  background: rgba(12, 18, 28, .9);
  border: 1px solid rgba(255, 255, 255, .13);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: .52rem .62rem;
  border-radius: .85rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  animation: float 5s ease-in-out infinite;
  overflow-wrap: anywhere;
}

.floating-card span {
  display: block;
  color: var(--accent);
  font-size: .7rem;
}

.floating-card strong {
  display: block;
  font-size: .95rem;
}

.floating-card small {
  display: block;
  color: #9aa5b5;
  font-size: .72rem;
  line-height: 1.35;
}

.card-code {
  left: -2%;
  top: 20%;
}

.card-security {
  right: -2%;
  bottom: 16%;
  animation-delay: -2s;
}

/* Sections / cards */
.section-pad {
  padding: clamp(46px, 5vw, 68px) 0;
}

.section-pad > .container > p {
  max-width: 820px;
}

.glass-card,
.skill-card,
.project-card {
  background: rgba(16, 24, 36, .72);
  border: 1px solid rgba(255, 255, 255, .08);
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
}

.glass-card:hover,
.skill-card:hover,
.project-card:hover {
  transform: translateY(-7px);
  border-color: rgba(0, 229, 255, .3);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .22);
}

.step {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 229, 255, .1);
  color: var(--accent);
  font-size: .75rem;
}

.icon-bubble {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 229, 255, .15), rgba(139, 92, 246, .2));
  color: var(--accent);
  font-size: 1.1rem;
}

.project-card {
  position: relative;
  overflow: hidden;
}

.project-card:before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--violet), var(--pink));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s ease;
}

.project-card:hover:before {
  transform: scaleX(1);
}

.project-num {
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
}

.project-card h3 {
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  margin: .7rem 0;
}

.project-card .badge {
  background: rgba(255, 255, 255, .06);
  color: #b9c2d0;
  padding: .4rem .58rem;
}

.project-category {
  display: block;
  color: #8e9aab;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .68rem;
  font-weight: 700;
  margin: .35rem 0 .2rem;
}

.project-status {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .35rem .55rem;
  border-radius: 50rem;
  white-space: nowrap;
}

.project-status.completed {
  color: #55f0a6;
  background: rgba(85, 240, 166, .08);
  border: 1px solid rgba(85, 240, 166, .22);
}

.project-status.development {
  color: var(--accent);
  background: rgba(0, 229, 255, .08);
  border: 1px solid rgba(0, 229, 255, .22);
}

.project-state {
  font-size: .72rem;
  font-weight: 600;
}

.completed-text { color: #55f0a6; }
.development-text { color: var(--accent); }

.project-footer {
  min-height: 42px;
}

.project-link {
  color: #fff;
  text-decoration: none;
  font-size: .78rem;
  font-weight: 700;
  transition: color .25s ease, transform .25s ease;
}

.project-link:hover {
  color: var(--accent);
  transform: translateX(2px);
}

.contact-banner {
  background:
    radial-gradient(circle at 85% 20%, rgba(139, 92, 246, .25), transparent 35%),
    linear-gradient(135deg, rgba(0, 229, 255, .08), rgba(255, 60, 172, .08));
  border: 1px solid rgba(255, 255, 255, .1);
}

.contact-banner a[href^="mailto:"] {
  overflow-wrap: anywhere;
}

/* Animations */
.reveal {
  opacity: 1;
  transform: none;
}

/* Animación progresiva solo cuando JavaScript está disponible.
   Si JS falla o tarda en cargar, el contenido sigue siendo visible. */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity .7s ease, transform .7s ease;
}

.js-reveal .reveal.show {
  opacity: 1;
  transform: none;
}

@keyframes float {
  50% { transform: translateY(-12px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* WhatsApp */
.whatsapp-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1055;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: linear-gradient(135deg, #25d366, #0bbf5b);
  color: #fff;
  box-shadow: 0 12px 35px rgba(37, 211, 102, .38);
  transition: transform .3s ease, box-shadow .3s ease;
  overflow: visible;
}

.whatsapp-float:hover {
  transform: translateY(-5px) scale(1.05);
  color: #fff;
  box-shadow: 0 16px 45px rgba(37, 211, 102, .55);
}

.whatsapp-icon {
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  transform: rotate(-12deg);
}

.whatsapp-label {
  position: absolute;
  right: 70px;
  white-space: nowrap;
  padding: .55rem .85rem;
  border-radius: 50rem;
  background: rgba(7, 11, 18, .92);
  border: 1px solid rgba(37, 211, 102, .3);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.whatsapp-float:hover .whatsapp-label {
  opacity: 1;
  transform: none;
}

.whatsapp-pulse {
  position: absolute;
  inset: -7px;
  border: 2px solid rgba(37, 211, 102, .45);
  border-radius: 50%;
  animation: waPulse 2s infinite;
}

.whatsapp-float:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

@keyframes waPulse {
  0% { transform: scale(.88); opacity: .8; }
  70%, 100% { transform: scale(1.25); opacity: 0; }
}

/* Sticky navbar: remains in document flow so it can never cover the Hero. */
.glass-nav {
  position: sticky !important;
  top: 0;
  width: 100%;
}

/* The navbar can grow when the mobile menu opens; the Hero follows it naturally. */
@media (max-width: 991.98px) {
  .navbar-collapse {
    max-height: calc(100svh - 76px);
    overflow-y: auto;
  }
}

/* Tablets */
@media (max-width: 1199.98px) {
  .hero h1 {
    max-width: 760px;
  }

  .profile-stage {
    width: min(68vw, 330px);
  }

  .card-code { left: 0; }
  .card-security { right: 0; }
}

@media (max-width: 991.98px) {
  section[id] {
    scroll-margin-top: 88px;
  }

  .hero {
    min-height: auto;
    padding-top: 34px;
    padding-bottom: 48px;
  }

  .hero .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .profile-stage {
    width: min(60vw, 290px);
  }

  .section-pad {
    padding-block: 48px;
  }
}

/* Phones */
@media (max-width: 767.98px) {
  html {
    scroll-padding-top: 84px;
  }

  .navbar {
    padding-bottom: .42rem;
  }

  .navbar .container {
    padding-inline: 1rem;
  }

  .navbar-collapse {
    margin-top: .45rem;
    padding: .45rem 0 .6rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
  }

  .navbar-nav {
    align-items: stretch !important;
    gap: .15rem !important;
  }

  .navbar-nav .nav-link {
    padding: .55rem .25rem;
  }

  .navbar-nav .btn {
    width: 100%;
    margin-left: 0 !important;
    margin-top: .25rem;
  }

  .hero {
    min-height: auto;
    padding-top: 24px;
    padding-bottom: 38px;
  }

  .hero .row {
    --bs-gutter-y: 1.75rem;
  }

  .hero .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero .row {
    --bs-gutter-x: 1.25rem;
  }

  .hero-badge {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
  }

  .hero h1 {
    font-size: clamp(1.9rem, 8.6vw, 2.55rem);
    line-height: 1.02;
    letter-spacing: -.04em;
  }

  .hero .lead {
    font-size: .96rem;
    line-height: 1.55;
  }

  .hero .btn-lg {
    width: 100%;
  }

  .hero .row-cols-1 > div {
    border-left: 2px solid rgba(0, 229, 255, .16);
    padding-left: .8rem;
  }

  .profile-stage {
    width: min(62vw, 245px);
  }

  .profile-image {
    border-width: 4px;
  }

  .floating-card {
    max-width: 38%;
    padding: .45rem .55rem;
    border-radius: .8rem;
  }

  .floating-card strong {
    font-size: .72rem;
  }

  .floating-card small {
    font-size: .54rem;
  }

  .card-code {
    left: -3%;
    top: 18%;
  }

  .card-security {
    right: -3%;
    bottom: 12%;
  }

  .section-pad {
    padding-block: 48px;
  }

  .section-pad .display-6 {
    font-size: clamp(1.65rem, 7vw, 2.15rem);
    line-height: 1.1;
  }

  .section-pad .display-5 {
    font-size: clamp(1.75rem, 7.5vw, 2.35rem);
    line-height: 1.1;
  }

  .section-pad .fs-5 {
    font-size: 1rem !important;
  }

  .glass-card,
  .skill-card,
  .project-card {
    padding: 1rem !important;
  }

  .project-card:hover,
  .skill-card:hover,
  .glass-card:hover {
    transform: none;
  }

  .project-footer {
    min-height: auto;
    align-items: flex-start !important;
    flex-direction: column;
  }

  .project-status {
    font-size: .6rem;
  }

  .contact-banner {
    border-radius: 1.5rem !important;
    padding: 1rem !important;
  }

  footer .container {
    text-align: center;
  }

  .whatsapp-float {
    right: 14px;
    bottom: 14px;
    width: 56px;
    height: 56px;
  }

  .whatsapp-icon {
    font-size: 28px;
  }

  .whatsapp-label {
    display: none;
  }
}

/* Small phones and narrow portrait screens */
@media (max-width: 575.98px) {
  section[id] {
    scroll-margin-top: 82px;
  }

  .navbar-brand {
    font-size: .95rem;
  }

  .brand-glyph {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .hero {
    padding-top: 22px;
  }

  .hero h1 {
    font-size: clamp(1.85rem, 9vw, 2.35rem);
    line-height: 1.04;
  }

  .hero .lead {
    font-size: .95rem;
  }

  .hero .btn-lg {
    font-size: .95rem;
    padding: .72rem 1rem !important;
  }

  .profile-stage {
    width: min(60vw, 230px);
    margin-top: .25rem;
  }

  .floating-card {
    max-width: 40%;
    padding: .42rem .5rem;
  }

  .card-code {
    left: -2%;
    top: 17%;
  }

  .card-security {
    right: -2%;
    bottom: 10%;
  }

  .section-pad {
    padding-block: 46px;
  }

  .contact-banner .btn {
    width: 100%;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .hero {
    padding-top: 26px;
  }

  .hero h1 {
    font-size: 1.95rem;
  }

  .hero-badge,
  .section-kicker {
    font-size: .62rem;
  }

  .profile-stage {
    width: min(64vw, 215px);
  }

  .floating-card {
    max-width: 44%;
    padding: .4rem .45rem;
  }

  .floating-card span {
    font-size: .54rem;
  }

  .floating-card strong {
    font-size: .68rem;
  }

  .floating-card small {
    display: none;
  }

  .project-status {
    font-size: .55rem;
  }
}

/* Minimalist responsive refinement */
.navbar-brand {
  font-size: 1.05rem;
  letter-spacing: -.02em;
}

.navbar-toggler {
  padding: .28rem .42rem;
}

.navbar .btn-accent {
  padding: .48rem 1rem !important;
  font-size: .88rem;
}

@media (max-width: 767.98px) {
  .hero .container {
    max-width: 680px;
  }

  .hero .row {
    align-items: center;
  }

  .hero .badge {
    font-size: .62rem;
    padding: .38rem .62rem !important;
  }

  .hero .d-flex.gap-3 {
    gap: .65rem !important;
  }

  .hero .row-cols-1 {
    margin-top: 1.2rem !important;
  }

  .hero .row-cols-1 > div {
    padding-left: .65rem;
  }

  .profile-stage {
    margin-bottom: .35rem;
  }

  .section-kicker {
    padding: .34rem .58rem;
  }

  .project-card h3, .skill-card h3 {
    font-size: 1.05rem;
  }
}

@media (max-width: 575.98px) {
  .navbar .container {
    padding-inline: .8rem;
  }

  .hero .container {
    padding-inline: .85rem;
  }

  .hero h1 {
    max-width: 100%;
    letter-spacing: -.035em;
  }

  .hero .lead {
    max-width: 100%;
  }

  .floating-card {
    max-width: 36%;
  }

  .card-code { left: -1%; }
  .card-security { right: -1%; }
}

/* Final compact layout safeguards */
.hero .btn-lg {
  font-size: .92rem;
  padding: .62rem 1rem !important;
}

.section-pad .display-6 {
  font-size: clamp(1.8rem, 3.2vw, 2.55rem);
}

.section-pad .fs-5 {
  font-size: 1rem !important;
}

@media (max-width: 420px) {
  .navbar-brand { font-size: .96rem; }
  .brand-glyph { width: 30px; height: 30px; flex-basis: 30px; }
  .hero { padding-top: 20px; padding-bottom: 34px; }
  .hero h1 { font-size: clamp(1.78rem, 8.8vw, 2.2rem); }
  .hero .lead { font-size: .92rem; }
  .hero .btn-lg { font-size: .88rem; }
  .profile-stage { width: min(58vw, 215px); }
  .floating-card { max-width: 34%; padding: .36rem .42rem; }
  .floating-card span { font-size: .5rem; }
  .floating-card strong { font-size: .62rem; }
  .floating-card small { display: none; }
  .section-pad { padding-block: 44px; }
}

/* Accessibility / reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================
   HERO PROFILE — RESPONSIVE FINAL
   The portrait always has its own visual area. Cards sit beside
   it on desktop and below it on tablet/mobile.
   ========================================================== */
.profile-stage {
  --profile-size: min(100%, 330px);
  width: var(--profile-size);
  aspect-ratio: 1;
  position: relative;
  margin-inline: auto;
}

.profile-core {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
}

.floating-card {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 190px;
  max-width: 190px;
  min-width: 0;
  padding: .72rem .78rem;
  border-color: rgba(255,255,255,.14);
  z-index: 5;
}

.floating-card-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: .65rem;
  font-size: 1.05rem;
  color: var(--accent);
  background: rgba(0,229,255,.07);
  border: 1px solid rgba(0,229,255,.18);
}

.card-security .floating-card-icon {
  color: var(--pink);
  background: rgba(255,60,172,.07);
  border-color: rgba(255,60,172,.2);
}

.floating-card-content { min-width: 0; }
.floating-card-content span,
.floating-card-content strong,
.floating-card-content small {
  display: block;
  overflow-wrap: normal;
  word-break: normal;
}
.floating-card-content span { color: var(--accent); font-size: .68rem; font-weight: 700; }
.card-security .floating-card-content span { color: var(--pink); }
.floating-card-content strong { font-size: .98rem; line-height: 1.15; }
.floating-card-content small { font-size: .69rem; line-height: 1.35; color: var(--text-muted); }

.card-code { left: -36%; top: 25%; }
.card-security { right: -36%; bottom: 19%; }

/* Tablets: stack the cards under the portrait. */
@media (max-width: 991.98px) {
  .profile-stage {
    width: min(88vw, 360px);
    height: auto;
    aspect-ratio: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: .7rem;
  }

  .profile-core { width: 100%; }

  .floating-card {
    position: relative;
    inset: auto !important;
    width: 100%;
    max-width: none;
    min-height: 64px;
    padding: .72rem .85rem;
    border-radius: 1rem;
    animation: none;
  }

  .card-code,
  .card-security { grid-column: 1; }
}

/* Phones */
@media (max-width: 575.98px) {
  .hero { min-height: auto; }
  .profile-stage {
    width: min(92vw, 330px);
    gap: .6rem;
  }

  .profile-image { border-width: 4px; }

  .floating-card {
    min-height: 62px;
    gap: .65rem;
    padding: .65rem .72rem;
  }

  .floating-card-icon {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
    font-size: .9rem;
  }

  .floating-card-content span { font-size: .6rem; }
  .floating-card-content strong { font-size: .84rem; }
  .floating-card-content small { font-size: .62rem; line-height: 1.3; }
}

/* Xiaomi 12 Pro / narrow Android widths and similar devices. */
@media (max-width: 400px) {
  .hero .container { padding-inline: .72rem; }
  .profile-stage { width: min(94vw, 315px); }
  .floating-card { min-height: 58px; padding: .58rem .65rem; }
  .floating-card-content small { font-size: .59rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
