/* ==========================================================================
   vaelico.es — Portafolio de Alfonso Piñera Herrera
   Estética: sistemas / terminal / oscuro. Perfil: backend, C++, GNSS, DevOps.
   ========================================================================== */

:root {
  --bg: #0a0e14;
  --bg-alt: #0e141d;
  --bg-card: #0f1620;
  --bg-hover: #131c29;
  --border: #1d2a3a;
  --border-bright: #2b3d54;
  --text: #c8d3e0;
  --text-dim: #7d8ea3;
  --text-faint: #52637a;
  --green: #4ade80;
  --green-dim: #22c55e;
  --cyan: #38bdf8;
  --blue: #60a5fa;
  --yellow: #facc15;
  --red: #f87171;
  --purple: #c084fc;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --nav-h: 60px;
  --topbar-h: 34px;
  --radius: 10px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  scroll-padding-top: calc(var(--nav-h) + 20px);
}

::selection { background: rgba(56, 189, 248, .28); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #223349; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #2d435e; }

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

.mono { font-family: var(--mono); }
.sec { color: var(--text-dim); }
.c-green { color: var(--green); }
.c-cyan { color: var(--cyan); }
.c-blue { color: var(--blue); }
.c-yellow { color: var(--yellow); }
.c-dim { color: var(--text-faint); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--cyan); color: #06121f; padding: 8px 14px;
  font-family: var(--mono); font-size: 13px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ============================== Top bar =================================== */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 120;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; gap: 18px;
}
.led { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.led-green { background: var(--green); box-shadow: 0 0 8px rgba(74, 222, 128, .8); }
.topbar-item.right { margin-left: auto; }

/* ============================== Navbar ==================================== */
.navbar {
  position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 110;
  height: var(--nav-h);
  background: rgba(10, 14, 20, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .2s;
}
.navbar.scrolled { box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
.nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { font-size: 15px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-prompt { color: var(--green); }
.brand-cursor { color: var(--cyan); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  font-family: var(--mono); font-size: 13.5px; color: var(--text-dim);
  padding: 7px 12px; border-radius: 7px; transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--green); background: rgba(74, 222, 128, .08); text-decoration: none; }
.nav-links .nav-gh { color: var(--text); border: 1px solid var(--border); }
.nav-links .nav-gh:hover { border-color: var(--green); color: var(--green); }

/* ============================== Hero ====================================== */
.hero {
  min-height: 100vh;
  padding: calc(var(--topbar-h) + var(--nav-h) + 40px) 24px 60px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 60% 50% at 70% -10%, rgba(56, 189, 248, .10), transparent 60%),
    radial-gradient(ellipse 50% 40% at 15% 110%, rgba(74, 222, 128, .08), transparent 55%),
    var(--bg);
}
.hero-inner { max-width: 980px; width: 100%; }
.terminal-line { font-size: 14px; margin-bottom: 14px; }

.kicker { font-size: 13px; margin-bottom: 14px; }

.hero h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); font-weight: 800; letter-spacing: -.02em; color: #fff; margin-bottom: 10px; }

.typed {
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 600;
  min-height: 1.6em;
  margin-bottom: 16px;
}
.typed::after { content: '█'; color: var(--cyan); animation: blink 1.1s steps(1) infinite; }

.hero-sub { max-width: 660px; color: var(--text-dim); font-size: 1.02rem; margin-bottom: 28px; }
.hero-sub strong { color: var(--text); }
.hero-sub em { color: var(--cyan); font-style: normal; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 9px;
  font-family: var(--mono); font-size: 14px; font-weight: 500;
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-solid { background: var(--green); color: #04130a; box-shadow: 0 6px 22px rgba(74, 222, 128, .25); }
.btn-solid:hover { background: #5eea92; box-shadow: 0 8px 26px rgba(74, 222, 128, .35); }
.btn-ghost { border: 1px solid var(--border-bright); color: var(--text); background: rgba(19, 28, 41, .6); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }

.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-tags .tag { font-size: 12px; color: var(--text-dim); border: 1px solid var(--border); padding: 5px 11px; border-radius: 999px; background: rgba(15, 22, 32, .6); }

/* ============================== Sections ================================== */
.section { max-width: 1180px; margin: 0 auto; padding: 90px 24px; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 40px; flex-wrap: wrap; }
.sec-idx { color: var(--green); font-size: 14px; }
.section-head h2 { font-size: 1.55rem; font-weight: 600; color: #e6eef8; letter-spacing: -.01em; }
.section-head h2::after { content: ''; display: inline-block; width: 7px; height: 7px; background: var(--cyan); margin-left: 8px; border-radius: 2px; }
.section-link { margin-left: auto; font-size: 13px; color: var(--text-dim); }
.section-link:hover { color: var(--cyan); }

/* ============================== About ===================================== */
.about-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 40px; align-items: start; }
.about-copy p { margin-bottom: 16px; color: var(--text-dim); }
.about-copy strong { color: var(--text); }
.about-copy p.no-fullstack {
  border: 1px solid var(--border-bright);
  border-left: 3px solid var(--cyan);
  background: rgba(56, 189, 248, .05);
  padding: 14px 16px; border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color .2s, transform .2s, background .2s;
}
.card:hover { border-color: var(--border-bright); }
.card-title { font-size: 12.5px; color: var(--green); margin-bottom: 12px; }

.profile-card { margin-bottom: 14px; }
.kv { list-style: none; }
.kv li { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.kv li:last-child { border-bottom: none; }
.kv .k { font-family: var(--mono); color: var(--text-faint); min-width: 62px; flex-shrink: 0; }
.kv .v { color: var(--text); word-break: break-word; }

/* ============================== Skills ==================================== */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }
.skill-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: border-color .2s, transform .2s; }
.skill-card:hover { border-color: var(--cyan); transform: translateY(-2px); }
.skill-card h3 { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--cyan); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.skill-card h3 .sc-arrow { color: var(--text-faint); }
.skill-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
  border: 1px solid var(--border-bright); border-radius: 999px;
  padding: 5px 12px; background: var(--bg-alt); transition: border-color .15s, color .15s;
}
.chip:hover { border-color: var(--green); color: var(--green); }
.chip.hl { border-color: var(--green); color: var(--green); background: rgba(74, 222, 128, .07); }

/* ============================== Projects ================================== */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 18px; }
.project-card {
  display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.project-card:hover { border-color: var(--green); transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.pc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pc-name { font-family: var(--mono); font-size: 15px; font-weight: 600; color: #eef4fb; }
.pc-name::before { content: '~/'; color: var(--text-faint); }
.pc-go { color: var(--text-faint); font-size: 14px; }
.project-card:hover .pc-go { color: var(--green); }
.pc-desc { color: var(--text-dim); font-size: 14px; margin-bottom: 14px; flex-grow: 1; }
.pc-meta { font-family: var(--mono); font-size: 12px; color: var(--text-faint); margin-bottom: 10px; }
.pc-meta .stars { color: var(--yellow); }
.pc-meta .fork { color: var(--purple); }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-tags .tag {
  font-family: var(--mono); font-size: 11px; color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, .3); background: rgba(56, 189, 248, .06);
  padding: 3px 9px; border-radius: 6px;
}
.project-card.muted { opacity: .62; }
.project-card.muted:hover { opacity: 1; }

/* ============================== Experience (timeline) ==================== */
.timeline { position: relative; max-width: 860px; padding-left: 26px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(var(--border-bright), var(--border));
}
.tl-item { position: relative; margin-bottom: 26px; }
.tl-dot {
  position: absolute; left: -26px; top: 6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--green);
  box-shadow: 0 0 8px rgba(74, 222, 128, .35);
}
.tl-body { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.tl-body:hover { border-color: var(--border-bright); }
.tl-head { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; margin-bottom: 6px; color: var(--text-dim); }
.tl-role { color: #eef4fb; font-weight: 600; }
.tl-company { color: var(--cyan); }
.tl-period { color: var(--text-faint); }
.tl-place { color: var(--text-faint); }
.tl-highlight { font-size: 14px; color: var(--text-dim); margin-top: 8px; line-height: 1.6; }

/* ============================== Contact =================================== */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: start; }
.contact-cards { display: flex; flex-direction: column; gap: 12px; }
.contact-card { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 12px; }
.contact-card:hover { border-color: var(--green); }
.cc-label { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; }
.cc-value { font-size: 13.5px; color: var(--text); word-break: break-all; }
.cc-arrow { color: var(--text-faint); transition: transform .2s, color .2s; }
.contact-card:hover .cc-arrow { transform: translateX(4px); color: var(--green); }

/* ============================== Footer ==================================== */
.footer { border-top: 1px solid var(--border); background: var(--bg-alt); }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 30px 24px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.footer p { color: var(--text-dim); }
.footer .mono.sec { font-size: 12.5px; }

/* ============================== Responsive ================================ */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .topbar-item.sec { display: none; }
}

@media (max-width: 640px) {
  .nav-links a { padding: 6px 8px; font-size: 12.5px; }
  .brand-prompt { font-size: 13px; }
  .section { padding: 64px 18px; }
  .hero { padding-left: 18px; padding-right: 18px; }
  .projects-grid { grid-template-columns: 1fr; }
  .timeline { padding-left: 18px; }
  .tl-dot { left: -18px; }
}

/* Reduce motion si el usuario lo pide */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}