/* =========================================================
   leafaror.com — Portafolio de Rafael Ortiz
   Paleta: azul noche + verde menta → cian
   ========================================================= */

:root {
  --bg: #070b14;
  --bg-2: #0b1220;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e7edf5;
  --muted: #8d9bb3;
  --accent: #2ee6a8;      /* verde menta */
  --accent-2: #38bdf8;    /* cian / azul */
  --gradient: linear-gradient(120deg, var(--accent), var(--accent-2));
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --font-head: "Sora", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --header-h: 72px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .6em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 5.2vw, 3.8rem); font-weight: 700; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p  { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
::selection { background: var(--accent); color: var(--bg); }

.container { width: min(1160px, 100% - 40px); margin-inline: auto; }
.container.narrow { width: min(820px, 100% - 40px); }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Fondo ---------- */
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}
.bg-orb {
  position: fixed; z-index: -1; pointer-events: none;
  width: 520px; height: 520px; border-radius: 50%;
  filter: blur(110px); opacity: .22;
}
.orb-1 { background: var(--accent); top: -180px; left: -160px; }
.orb-2 { background: var(--accent-2); top: 30%; right: -220px; opacity: .16; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  padding: .85em 1.4em; border-radius: 999px;
  font-weight: 600; font-size: .95rem;
  border: 1px solid transparent;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--gradient); color: #04121a;
  box-shadow: 0 10px 30px -10px rgba(46, 230, 168, .55);
}
.btn-primary:hover { box-shadow: 0 14px 36px -10px rgba(56, 189, 248, .6); }
.btn-ghost { border-color: var(--border-strong); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); background: var(--surface-hover); }
.btn-sm { padding: .55em 1.1em; font-size: .88rem; }
.btn-lg { padding: 1em 1.6em; font-size: 1rem; }
.btn svg { width: 1.1em; height: 1.1em; }

/* ---------- Header ---------- */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  transition: background .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.header.scrolled {
  background: rgba(7, 11, 20, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }

.logo { display: flex; align-items: center; gap: .6rem; font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; }
.logo-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--gradient); color: #04121a; font-weight: 700;
}

.nav { display: flex; align-items: center; gap: 2rem; }
.nav a:not(.btn) { color: var(--muted); font-size: .93rem; font-weight: 500; transition: color .2s; position: relative; }
.nav a:not(.btn):hover, .nav a.active { color: var(--text); }
.nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  border-radius: 2px; background: var(--gradient);
}

.menu-toggle {
  display: none; width: 42px; height: 42px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  flex-direction: column; justify-content: center; align-items: center; gap: 6px; cursor: pointer;
}
.menu-toggle span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .3s ease; }
.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child  { transform: translateY(-4px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--header-h) + 40px) 0 80px;
  position: relative;
}
.hero-inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: 64px; align-items: center; }

.pill {
  display: inline-flex; align-items: center; gap: .55em;
  padding: .4em 1em; margin-bottom: 1.5rem;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); font-size: .85rem; color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(46,230,168,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(46,230,168,0); } 100% { box-shadow: 0 0 0 0 rgba(46,230,168,0); } }

.underline { position: relative; white-space: nowrap; }
.underline::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .02em; height: .14em;
  background: var(--gradient); border-radius: 4px; opacity: .8;
}

.lead { font-size: 1.12rem; color: var(--muted); max-width: 560px; margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 3rem; }

.stats { display: flex; flex-wrap: wrap; gap: 2.5rem; }
.stats li { display: flex; flex-direction: column; }
.stats strong { font-family: var(--font-head); font-size: 1.8rem; font-weight: 600; }
.stats span { font-size: .85rem; color: var(--muted); }

.hero-visual { position: relative; justify-self: center; width: 100%; max-width: 420px; }
.photo-frame {
  position: relative; border-radius: 28px; padding: 3px;
  background: var(--gradient);
  box-shadow: 0 30px 80px -30px rgba(56, 189, 248, .45);
}
.photo-frame img { border-radius: 25px; width: 100%; aspect-ratio: 5 / 6; object-fit: cover; background: var(--bg-2); }

.float-card {
  position: absolute;
  background: rgba(11, 18, 32, .82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-10px); } }

.card-code { left: -48px; bottom: 56px; padding: 12px 16px 14px; font-size: .8rem; }
.card-code .dots { display: flex; gap: 5px; margin-bottom: 8px; }
.card-code .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.card-code .dots i:first-child { background: #ff6b6b; } .card-code .dots i:nth-child(2) { background: #ffd166; } .card-code .dots i:last-child { background: var(--accent); }
.card-code pre { margin: 0; font-family: ui-monospace, "SF Mono", Consolas, monospace; line-height: 1.6; color: var(--text); }
.card-code .k { color: var(--accent-2); } .card-code .f { color: var(--accent); } .card-code .s { color: #ffd166; }

.card-badge { right: -32px; top: 62%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; animation-delay: -3s; }
.card-badge strong { display: block; font-size: .88rem; }
.card-badge small { color: var(--muted); font-size: .78rem; }
.badge-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: rgba(46,230,168,.14); color: var(--accent); }

.scroll-hint {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  width: 26px; height: 42px; border-radius: 20px; border: 2px solid var(--border-strong);
}
.scroll-hint span {
  position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--accent); animation: scroll 1.8s infinite;
}
@keyframes scroll { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ---------- Secciones ---------- */
.section { padding: 110px 0; }
.section-head { max-width: 640px; margin: 0 auto 56px; text-align: center; }
.section-head p:not(.eyebrow) { color: var(--muted); }
.eyebrow {
  display: inline-block; margin-bottom: .9rem;
  font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform .3s ease, border-color .3s ease, background .3s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); background: var(--surface-hover); }

/* Sobre mí */
.about { display: grid; grid-template-columns: .85fr 1.15fr; gap: 72px; align-items: center; }
.about-img { position: relative; }
.about-img img { border-radius: var(--radius); aspect-ratio: 1; object-fit: cover; width: 100%; border: 1px solid var(--border); background: var(--bg-2); }
.about-tag {
  position: absolute; right: 20px; bottom: 20px;
  padding: .5em 1em; border-radius: 999px; font-size: .88rem; font-weight: 500;
  background: rgba(7, 11, 20, .8); border: 1px solid var(--border-strong);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.about-tag .gradient-text { font-weight: 700; }
.about-text > p:not(.eyebrow) { color: var(--muted); }
.about-text strong { color: var(--text); font-weight: 600; }
.values { margin: 1.8rem 0 2.2rem; display: grid; gap: 12px; }
.values li { display: flex; align-items: center; gap: 14px; font-weight: 500; }
.values span {
  font-family: var(--font-head); font-size: .8rem; color: var(--accent);
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
}

/* Servicios */
.service { padding: 30px 28px; }
.service p { color: var(--muted); font-size: .95rem; margin: 0; }
.service .icon {
  width: 50px; height: 50px; border-radius: 14px; margin-bottom: 22px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(46,230,168,.16), rgba(56,189,248,.16));
  border: 1px solid rgba(46,230,168,.25); color: var(--accent);
}
.service .icon svg { width: 24px; height: 24px; }
.service:hover .icon { color: var(--accent-2); border-color: rgba(56,189,248,.4); }

/* Stack */
.stack-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.stack-group { padding: 26px; }
.stack-group h3 { font-size: 1rem; color: var(--muted); font-weight: 500; margin-bottom: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: .4em .9em; border-radius: 999px; font-size: .87rem; font-weight: 500;
  border: 1px solid var(--border-strong); background: rgba(255,255,255,.02);
  transition: border-color .2s, color .2s;
}
.chips li:hover { border-color: var(--accent); color: var(--accent); }

/* Proyectos */
.project { overflow: hidden; display: flex; flex-direction: column; }
.project-img { overflow: hidden; aspect-ratio: 16 / 10; background: var(--bg-2); }
.project-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; filter: saturate(.85); }
.project:hover .project-img img { transform: scale(1.05); filter: saturate(1); }
.project-body { padding: 24px 26px 26px; display: flex; flex-direction: column; flex: 1; }
.project-body p { color: var(--muted); font-size: .94rem; flex: 1; }
.tag {
  align-self: flex-start; margin-bottom: .9rem;
  font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  padding: .3em .8em; border-radius: 999px;
  color: var(--accent); background: rgba(46,230,168,.1); border: 1px solid rgba(46,230,168,.2);
}
.link { font-weight: 600; font-size: .92rem; color: var(--accent-2); transition: color .2s; }
.link:hover { color: var(--accent); }

/* Trayectoria */
.timeline { position: relative; padding-left: 34px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--accent), var(--accent-2), transparent);
  opacity: .5;
}
.timeline > li { position: relative; padding-bottom: 44px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
  content: ""; position: absolute; left: -34px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(46,230,168,.12);
}
.when { font-size: .82rem; font-weight: 600; color: var(--accent); letter-spacing: .03em; }
.timeline h3 { margin: .4rem 0 .2rem; font-size: 1.2rem; }
.where { color: var(--text); opacity: .7; font-size: .92rem; margin-bottom: .5rem; }
.timeline p:not(.where) { color: var(--muted); margin: 0 0 .9rem; }
.timeline .chips li { font-size: .78rem; padding: .3em .8em; color: var(--muted); }
.timeline > li.edu::before { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(56,189,248,.14); border-radius: 4px; transform: rotate(45deg); }
.timeline > li.edu .when { color: var(--accent-2); }

/* Alerta "En construcción" (SweetAlert2) */
.swal2-popup.lf-alert {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 22px;
  font-family: var(--font-body);
}
.lf-alert .swal2-title { font-family: var(--font-head); color: var(--text); }
.lf-alert .swal2-html-container { color: var(--muted); }
.lf-alert .swal2-icon.swal2-info { border-color: rgba(46,230,168,.4); color: var(--accent); }
.lf-alert .lf-alert-btn {
  background: var(--gradient); color: #04121a; border: 0; border-radius: 999px;
  padding: .75em 1.6em; font-weight: 600; font-size: .95rem; cursor: pointer;
}
.lf-alert .lf-alert-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }

/* Más allá del código */
.personal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.personal-card { overflow: hidden; display: flex; flex-direction: column; }
.personal-img { aspect-ratio: 4 / 4.2; overflow: hidden; background: var(--bg-2); }
.personal-img img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; transition: transform .6s ease; }
.personal-card:hover .personal-img img { transform: scale(1.04); }
.personal-body { padding: 24px 26px 28px; display: flex; flex-direction: column; }
.personal-body p { color: var(--muted); font-size: .95rem; margin: 0; }
.tag-fun { color: var(--accent-2); background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.25); }

/* Contacto */
.contact-card {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center;
  padding: 64px 56px; border-radius: 28px;
  background:
    radial-gradient(circle at 0% 0%, rgba(46,230,168,.18), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(56,189,248,.18), transparent 50%),
    var(--bg-2);
  border: 1px solid var(--border-strong);
}
.contact-text h2 { margin-bottom: .4em; }
.contact-text p:not(.eyebrow) { color: var(--muted); margin: 0; font-size: 1.08rem; }
.contact-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.socials { display: flex; gap: 12px; }
.socials a {
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--muted); transition: all .2s ease;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.socials svg { width: 22px; height: 22px; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 28px 0; font-size: .9rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer p { margin: 0; }
.to-top:hover { color: var(--accent); }

/* ---------- Animaciones de aparición (solo con JS) ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; transition-delay: var(--d, 0s); }
.js .reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 1024px) {
  .stack-grid { grid-template-columns: repeat(2, 1fr); }
  .personal-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .hero-inner { gap: 48px; }
  .card-code { left: -20px; }
  .card-badge { right: -16px; }
}

@media (max-width: 860px) {
  .menu-toggle { display: flex; }
  .nav {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 12px 20px 24px;
    background: rgba(7, 11, 20, .96);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: all .25s ease;
  }
  .nav.open { transform: none; opacity: 1; visibility: visible; }
  .nav a:not(.btn) { padding: 14px 4px; border-bottom: 1px solid var(--border); font-size: 1rem; }
  .nav a.active::after { display: none; }
  .nav-cta { margin-top: 18px; justify-content: center; }
  .header.menu-open { background: rgba(7, 11, 20, .96); border-bottom-color: var(--border); }

  .hero { padding-top: calc(var(--header-h) + 32px); }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-text { display: flex; flex-direction: column; align-items: center; }
  .lead { margin-inline: auto; }
  .hero-actions, .stats { justify-content: center; }
  .hero-visual { max-width: 340px; margin-top: 8px; }
  .scroll-hint { display: none; }

  .about { grid-template-columns: 1fr; gap: 44px; }
  .about-img { max-width: 420px; margin-inline: auto; width: 100%; }

  .contact-card { grid-template-columns: 1fr; padding: 44px 28px; text-align: center; }
  .contact-actions { align-items: center; }

  .section { padding: 84px 0; }
}

@media (max-width: 600px) {
  .grid-3, .stack-grid, .personal-grid { grid-template-columns: 1fr; }
  .container, .container.narrow { width: calc(100% - 32px); }
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; width: 100%; }
  .stats strong { font-size: 1.5rem; }
  .stats span { font-size: .78rem; line-height: 1.35; }
  .card-code { left: -8px; bottom: 24px; font-size: .72rem; }
  .card-badge { right: -8px; }
  .btn-lg { font-size: .92rem; padding: .95em 1.3em; }
  .underline { white-space: normal; }
  .footer-inner { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
