:root {
  --navy: #0f2536;
  --navy-2: #16324a;
  --navy-3: #1c3d59;
  --orange: #e0692c;
  --orange-light: #f0975f;
  --text-light: #eef2f5;
  --text-muted: #b7c2cc;
  --text-dark: #1c2b36;
  --text-body: #334059;
  --max-width: 1100px;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: #f5f7f9;
  color: var(--text-dark);
  line-height: 1.55;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

ul { margin: 0; padding: 0; list-style: none; }

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(15, 37, 54, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-light);
  font-size: 1.05rem;
  white-space: nowrap;
}
.brand span { color: var(--orange); }

.nav-links {
  display: flex;
  gap: 22px;
  margin-left: auto;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav-link:hover { color: var(--text-light); }
.nav-link.active { color: var(--orange-light); border-color: var(--orange); }

.nav-cta {
  white-space: nowrap;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.menu-toggle span {
  width: 22px; height: 2px;
  background: var(--text-light);
  border-radius: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1.5px solid transparent;
  transition: transform .15s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--orange);
  color: #fff;
}
.btn-primary:hover { background: #c85a22; }

.btn-outline {
  border-color: var(--orange);
  color: var(--orange-light);
}
.navbar .btn-outline { color: var(--orange-light); }
.btn-outline:hover { background: var(--orange); color: #fff; }

section .btn-outline { color: var(--orange); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, var(--navy-3), var(--navy) 70%);
  color: var(--text-light);
  padding: 120px 24px 80px;
  position: relative;
}

.hero-inner {
  max-width: 640px;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* evita que los hijos de un flex column con align-items:center se midan
   por su ancho "max-content" y desborden el viewport (bug clásico de flexbox) */
.hero-inner > * {
  max-width: 100%;
}

.hero-photo {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 3px solid var(--orange);
  object-fit: cover;
  background: #fff;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.8rem;
  color: var(--orange-light);
  font-weight: 700;
  margin: 0 0 6px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 14px;
  font-weight: 800;
}

.badge {
  display: inline-block;
  border: 1.5px solid var(--orange);
  color: var(--orange-light);
  border-radius: 999px;
  padding: 5px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.hero-text {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0 0 28px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 1.4rem;
  animation: bob 2s infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ---------- Sections ---------- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 24px;
}
.section.alt {
  max-width: none;
  background: #eef1f4;
}
.section.alt > * {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0 0 32px;
  position: relative;
  padding-bottom: 12px;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 54px; height: 4px;
  background: var(--orange);
  border-radius: 2px;
}

.subgroup-title {
  color: var(--navy);
  font-size: 1.1rem;
  margin: 40px 0 6px;
}
.subgroup-title:first-of-type { margin-top: 0; }
.subgroup-note {
  color: #5a6472;
  font-style: italic;
  font-size: 0.92rem;
  margin: 0 0 20px;
}

.about-text {
  max-width: 720px;
  color: var(--text-body);
  text-align: justify;
  text-indent: 2em;
  font-size: 1rem;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 36px;
}

.about-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 4px 18px rgba(15,37,54,0.06);
}
.about-card h3 {
  margin: 0 0 16px;
  color: var(--navy);
  font-size: 1rem;
}

.lang-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--text-body);
}
.bar {
  height: 22px;
  background: var(--navy-2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--orange), var(--orange-light));
  border-radius: 999px;
  transition: width 1.1s ease;
}
.bar-fill.animate { width: var(--val); }
.bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
  pointer-events: none;
}

.plain-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 10px;
  color: var(--text-body);
  font-size: 0.92rem;
}
.plain-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--orange);
}

/* ---------- Timeline ---------- */
.timeline {
  border-left: 2px solid #d7dde2;
  margin-left: 6px;
  padding-left: 30px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.timeline-item {
  position: relative;
}
.timeline-dot {
  position: absolute;
  left: -37px;
  top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--orange);
  border: 3px solid #eef1f4;
}
.section:not(.alt) .timeline-dot { border-color: #f5f7f9; }

.timeline-content h4 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 1.05rem;
}
.timeline-content .meta {
  margin: 0 0 10px;
  color: #5a6472;
  font-size: 0.88rem;
}
.timeline-content ul li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: var(--text-body);
}
.timeline-content ul li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--orange);
}

/* ---------- Cards ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 4px 18px rgba(15,37,54,0.06);
}
.section.alt .card { background: #fff; }
.card h4 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 1rem;
}
.card p { color: var(--text-body); font-size: 0.92rem; margin: 0; }
.card .meta { color: #5a6472; font-size: 0.85rem; }

.project-card .tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(224,105,44,0.12);
  color: var(--orange);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}
.skill-group h4 {
  color: var(--navy);
  font-size: 0.92rem;
  margin: 0 0 10px;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tags span {
  background: #fff;
  border: 1px solid #dfe4e9;
  color: var(--text-body);
  font-size: 0.82rem;
  padding: 5px 12px;
  border-radius: 999px;
}

/* ---------- Contact ---------- */
.contact-section { text-align: center; }
.contact-lead { color: #5a6472; margin: 0 0 30px; }
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.contact-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  font-weight: 600;
  color: var(--navy);
  box-shadow: 0 4px 18px rgba(15,37,54,0.06);
  transition: transform .15s;
}
a.contact-card:hover { transform: translateY(-3px); }
.contact-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(224,105,44,0.12);
  color: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: var(--text-muted);
  text-align: center;
  padding: 28px 24px 34px;
}
.pi-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  margin-bottom: 14px;
}
.pi-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #888;
}
.pi-dot.online {
  background: #4caf7d;
  box-shadow: 0 0 0 0 rgba(76,175,125,0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(76,175,125,0.5); }
  70% { box-shadow: 0 0 0 7px rgba(76,175,125,0); }
  100% { box-shadow: 0 0 0 0 rgba(76,175,125,0); }
}
.footer-note { margin: 0; font-size: 0.78rem; }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Rocket (scroll companion) ---------- */
.rocket {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 200;
  filter: drop-shadow(0 8px 14px rgba(15,37,54,0.35));
  animation: rocketFloat 3s ease-in-out infinite;
}
.rocket:hover { filter: drop-shadow(0 10px 18px rgba(15,37,54,0.45)); }
.rocket.scrolling { animation: rocketShake .22s ease-in-out infinite; }
.rocket.dragging,
.rocket.returning {
  animation: none;
  cursor: grabbing;
  filter: drop-shadow(0 14px 20px rgba(15,37,54,0.45));
}
.rocket.landing { animation: rocketLand .6s cubic-bezier(.36, 1.4, .4, 1) both; }

.rocket-svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  transition: transform .55s cubic-bezier(.34, 1.56, .64, 1);
}
.rocket.dir-down .rocket-svg { transform: rotate(180deg); }
.rocket.dragging .rocket-svg { transition: none; }

.rocket-flame {
  opacity: 0;
  transform-origin: 32px 60px;
  transition: opacity .18s ease;
}
.rocket.scrolling .rocket-flame,
.rocket.dragging .rocket-flame,
.rocket.returning .rocket-flame {
  opacity: 1;
  animation: flameFlicker .12s infinite alternate;
}
.rocket.landing .rocket-flame {
  opacity: 1;
  animation: flameCutoff .5s ease-out both;
}

.rocket-dust {
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 42px;
  height: 12px;
  transform: translateX(-50%) scale(0.2);
  background: radial-gradient(ellipse at center, rgba(238,242,245,0.9) 0%, rgba(238,242,245,0) 72%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.rocket.landing .rocket-dust {
  animation: dustPuff .6s ease-out both;
}

.rocket-hint {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: #fff;
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15,37,54,0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.rocket-hint::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: #fff;
}
.rocket:hover .rocket-hint,
.rocket:focus-visible .rocket-hint,
.rocket.show-hint .rocket-hint {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.rocket.dragging .rocket-hint,
.rocket.returning .rocket-hint,
.rocket.landing .rocket-hint {
  opacity: 0 !important;
}
.rocket.hint-wiggle .rocket-svg {
  animation: rocketWiggle .9s ease-in-out;
}

@keyframes rocketFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes rocketShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, -1px); }
}
@keyframes flameFlicker {
  0% { transform: scaleY(0.85) scaleX(0.92); }
  100% { transform: scaleY(1.2) scaleX(1.05); }
}
@keyframes rocketLand {
  0%   { transform: translateY(-10px); }
  45%  { transform: translateY(5px); }
  65%  { transform: translateY(-3px); }
  82%  { transform: translateY(1px); }
  100% { transform: translateY(0); }
}
@keyframes flameCutoff {
  0%   { opacity: 1; transform: scaleY(1.3) scaleX(1.1); }
  30%  { opacity: 0.8; transform: scaleY(0.6) scaleX(0.8); }
  100% { opacity: 0; transform: scaleY(0.2) scaleX(0.5); }
}
@keyframes dustPuff {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.2); }
  35%  { opacity: 0.9; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.7); }
}
@keyframes rocketWiggle {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-14deg); }
  40% { transform: rotate(11deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(5deg); }
}
@media (prefers-reduced-motion: reduce) {
  .rocket, .rocket.scrolling, .rocket.landing, .rocket-flame, .rocket-dust, .rocket.hint-wiggle .rocket-svg { animation: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .nav-links {
    position: fixed;
    top: 62px; left: 0; right: 0;
    background: var(--navy);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .nav-links.open { max-height: 420px; }
  .nav-link {
    padding: 14px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    width: 100%;
  }
  .nav-cta { display: none; }
  .menu-toggle { display: flex; }

  .rocket { width: 46px; height: 46px; right: 14px; bottom: 14px; }
}
