/* ==========================================================================
   InheritDevs — Portafolio
   Paleta y tipografía tomadas de inheritdevs.com (tokens --bg-0/1/2, --teal,
   --brand-violet, Sora + Inter).
   ========================================================================== */

:root {
  --bg-0: #070b18;
  --bg-1: #0c1226;
  --bg-2: #111833;
  --bg-3: #16203f;

  --teal: #03a8fa;
  --violet: #9800e9;
  --green: #20c997;

  --text: #e8edf7;
  --text-dim: #9fb0cc;
  --text-faint: #6b7c9c;

  --line: rgba(148, 163, 184, 0.12);
  --line-strong: rgba(148, 163, 184, 0.22);

  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 1180px;

  --font-head: "Sora", "Inter", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, "Courier New", monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 0.5em;
}

p { margin: 0 0 1rem; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection {
  background: rgba(3, 168, 250, 0.28);
  color: #fff;
}

/* ---------- Utilidades ---------- */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 24px;
}

.section {
  padding: clamp(72px, 10vw, 132px) 0;
  position: relative;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  border: 1px solid rgba(3, 168, 250, 0.28);
  background: rgba(3, 168, 250, 0.07);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 22px;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal);
}

.section-title {
  font-size: clamp(30px, 4.4vw, 46px);
  max-width: 19ch;
}

.section-lead {
  color: var(--text-dim);
  font-size: clamp(15px, 1.6vw, 18px);
  max-width: 62ch;
  margin-top: 4px;
}

.grad-text {
  background: linear-gradient(100deg, #ffffff 0%, var(--teal) 48%, var(--violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Fondo animado ---------- */

.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(3, 168, 250, 0.16), transparent 60%),
    radial-gradient(1000px 640px at 90% 8%, rgba(152, 0, 233, 0.16), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(32, 201, 151, 0.10), transparent 60%),
    var(--bg-0);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 78%);
}

/* ---------- Navegación ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}

.nav.is-stuck {
  background: rgba(7, 11, 24, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 6px 18px rgba(3, 168, 250, 0.35);
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 14px;
  color: var(--text-dim);
  transition: color 0.2s;
  position: relative;
}

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

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  height: 1px;
  width: 0;
  background: var(--teal);
  transition: width 0.28s var(--ease);
}

.nav-links a:hover::after { width: 100%; }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 100px;
  background: linear-gradient(120deg, var(--teal), var(--violet));
  color: #fff;
  box-shadow: 0 8px 24px rgba(3, 168, 250, 0.3);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
  white-space: nowrap;
}

.nav-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(152, 0, 233, 0.4);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: clamp(120px, 17vh, 190px) 0 clamp(56px, 8vw, 92px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 60px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(38px, 6vw, 66px);
  margin-bottom: 22px;
}

.hero-sub {
  font-size: clamp(16px, 1.9vw, 19px);
  color: var(--text-dim);
  max-width: 54ch;
  margin-bottom: 30px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 38px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  padding: 14px 26px;
  border-radius: 100px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease),
              background 0.22s, border-color 0.22s;
}

.btn-primary {
  background: linear-gradient(120deg, var(--teal), var(--violet));
  color: #fff;
  box-shadow: 0 12px 34px rgba(3, 168, 250, 0.32);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 42px rgba(152, 0, 233, 0.42);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  border-color: rgba(3, 168, 250, 0.5);
  background: rgba(3, 168, 250, 0.08);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  font-size: 13px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  flex: none;
}

/* Panel de código del hero */

.code-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 24, 51, 0.92), rgba(12, 18, 38, 0.92));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.code-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(140deg, rgba(3, 168, 250, 0.55), transparent 42%, rgba(152, 0, 233, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.code-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.code-bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
  display: block;
}

.code-bar i:nth-child(1) { background: #ff5f57; }
.code-bar i:nth-child(2) { background: #febc2e; }
.code-bar i:nth-child(3) { background: #28c840; }

.code-bar span {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.code-body {
  margin: 0;
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.85;
  overflow-x: auto;
}

.tk-key { color: #c792ea; }
.tk-str { color: #c3e88d; }
.tk-fn  { color: #82aaff; }
.tk-cm  { color: #5c6f8f; font-style: italic; }
.tk-num { color: #f78c6c; }
.tk-var { color: #e8edf7; }

.cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--teal);
  vertical-align: -2px;
  animation: blink 1.1s steps(2) infinite;
}

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

/* ---------- Métricas ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: clamp(48px, 7vw, 84px);
}

.metric {
  background: rgba(12, 18, 38, 0.72);
  padding: 30px 26px;
  transition: background 0.3s;
}

.metric:hover { background: rgba(22, 32, 63, 0.9); }

.metric-value {
  font-family: var(--font-head);
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #fff, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}

.metric-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ---------- Servicios ---------- */

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

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 24, 51, 0.62), rgba(12, 18, 38, 0.62));
  padding: 28px;
  overflow: hidden;
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(3, 168, 250, 0.1), transparent 62%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(3, 168, 250, 0.36);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.36);
}

.card:hover::after { opacity: 1; }

.card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(3, 168, 250, 0.18), rgba(152, 0, 233, 0.18));
  border: 1px solid rgba(3, 168, 250, 0.28);
  color: var(--teal);
  margin-bottom: 18px;
}

.card h3 { font-size: 19px; margin-bottom: 9px; }

.card p {
  color: var(--text-dim);
  font-size: 14.5px;
  margin-bottom: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.025);
}

.chip.chip-accent {
  color: var(--teal);
  border-color: rgba(3, 168, 250, 0.35);
  background: rgba(3, 168, 250, 0.08);
}

/* ---------- Portafolio ---------- */

.work {
  margin-top: 48px;
  display: grid;
  gap: 16px;
}

.work-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 26px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(17, 24, 51, 0.6), rgba(12, 18, 38, 0.5));
  padding: 26px 28px;
  transition: border-color 0.3s, transform 0.3s var(--ease), background 0.3s;
}

.work-item:hover {
  border-color: rgba(152, 0, 233, 0.4);
  transform: translateX(4px);
  background: linear-gradient(100deg, rgba(22, 32, 63, 0.8), rgba(12, 18, 38, 0.6));
}

.work-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.work-item h3 { font-size: 18.5px; margin-bottom: 4px; }

.work-module {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--violet);
  opacity: 0.9;
  margin-bottom: 9px;
  word-break: break-word;
}

.work-item p {
  color: var(--text-dim);
  font-size: 14.5px;
  margin: 0;
}

.work-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--green);
  border: 1px solid rgba(32, 201, 151, 0.3);
  background: rgba(32, 201, 151, 0.07);
  padding: 3px 10px;
  border-radius: 100px;
  margin-top: 12px;
}

/* ---------- Stack ---------- */

.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 46px;
}

.stack-col {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 24px;
  background: rgba(12, 18, 38, 0.5);
}

.stack-col h4 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 14px;
  font-weight: 600;
}

.stack-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack-col li {
  font-size: 13.5px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 11px;
}

/* ---------- GitHub / Open source ---------- */

.gh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 46px;
}

.gh-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: rgba(12, 18, 38, 0.6);
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}

.gh-card:hover {
  transform: translateY(-4px);
  border-color: rgba(3, 168, 250, 0.36);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.gh-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.gh-name {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--teal);
  font-weight: 600;
  word-break: break-all;
}

.gh-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  padding: 3px 9px;
  white-space: nowrap;
  flex: none;
}

.gh-card p {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 16px;
  flex: 1;
}

.gh-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
}

.gh-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-weight: 600;
  transition: gap 0.22s var(--ease);
}

.gh-link:hover { gap: 10px; }

.gh-note {
  margin-top: 26px;
  font-size: 14px;
  color: var(--text-faint);
  border-left: 2px solid rgba(3, 168, 250, 0.4);
  padding-left: 16px;
  max-width: 74ch;
}

/* ---------- Proceso ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 46px;
  counter-reset: step;
}

.step {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 24px;
  background: rgba(12, 18, 38, 0.5);
  position: relative;
  counter-increment: step;
}

.step::before {
  content: "0" counter(step);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--teal);
  display: block;
  margin-bottom: 10px;
}

.step h4 { font-size: 16.5px; margin-bottom: 6px; }

.step p { font-size: 14px; color: var(--text-dim); margin: 0; }

/* ---------- CTA ---------- */

.cta-panel {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  padding: clamp(40px, 6vw, 72px);
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(700px 320px at 50% 0%, rgba(3, 168, 250, 0.16), transparent 65%),
    linear-gradient(180deg, rgba(22, 32, 63, 0.9), rgba(12, 18, 38, 0.9));
}

.cta-panel h2 {
  font-size: clamp(28px, 4.4vw, 46px);
  max-width: 22ch;
  margin-inline: auto;
}

.cta-panel p {
  color: var(--text-dim);
  max-width: 56ch;
  margin-inline: auto;
  margin-bottom: 30px;
}

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

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 44px 0 40px;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: var(--text-dim);
}

.footer-links a { transition: color 0.2s; }
.footer-links a:hover { color: var(--teal); }

.footer-copy {
  font-size: 13px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ---------- Reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .work-item { grid-template-columns: 44px minmax(0, 1fr); }
  .work-item > div:last-child { grid-column: 2; }
}

@media (max-width: 720px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 68px;
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    background: rgba(7, 11, 24, 0.97);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 22px;
    backdrop-filter: blur(12px);
  }

  .nav-links.is-open { display: flex; }

  .nav-toggle { display: block; }
  .nav-cta { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { padding: 22px 18px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .code-body { font-size: 12px; }
}
