/* ══════════════════════════════════════════════════════════════
   DESIGN TOKENS — extended from visualizador-renfe
══════════════════════════════════════════════════════════════ */
:root {
  --bg:           #0d0f12;
  --bg-panel:     #13161b;
  --bg-card:      #1a1e26;
  --border:       #2a2f3a;
  --border-hi:    #3d4455;
  --text:         #d4dae8;
  --text-dim:     #6b7491;
  --text-muted:   #3f4558;
  --accent:       #3dd6d6;
  --accent-warm:  #e8c84a;
  --green:        #3ecf74;
  --red:          #f04f57;
  --purple:       #a78bfa;
  --font-mono:    'IBM Plex Mono', monospace;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body:    'Inter', sans-serif;
  --radius:       6px;
  --trans:        0.18s ease;
  --max-w:        860px;
}

/* ══════════════════════════════════════════════════════════════ RESET */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ══════════════════════════════════════════════════════════════ SCROLLBAR */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ══════════════════════════════════════════════════════════════ BOOT OVERLAY */
#boot-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 10vw;
  transition: opacity 0.4s ease;
}

#boot-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

#boot-overlay.hidden {
  display: none;
}

#boot-lines {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  line-height: 2;
}

#boot-lines .boot-line {
  opacity: 0;
  animation: boot-appear 0.05s ease forwards;
}

#boot-lines .boot-line.warn {
  color: var(--accent-warm);
}

#boot-cursor {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  animation: blink 0.7s step-end infinite;
  margin-top: 2px;
}

@keyframes boot-appear {
  to { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ══════════════════════════════════════════════════════════════ LANG TOGGLE */
#lang-toggle {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color var(--trans), background var(--trans);
}

.lang-btn.active {
  color: var(--accent);
  background: rgba(61, 214, 214, 0.1);
}

.lang-btn:hover:not(.active) {
  color: var(--text);
}

.lang-sep {
  color: var(--border-hi);
}

/* ══════════════════════════════════════════════════════════════ PIPELINE LINE */
#pipeline-line {
  position: fixed;
  left: calc((100vw - var(--max-w)) / 2 - 32px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  z-index: 10;
  pointer-events: none;
}

#pipeline-fill {
  width: 1px;
  height: 0;
  background: var(--accent);
  transition: height 0.6s ease;
  box-shadow: 0 0 6px rgba(61, 214, 214, 0.4);
}

/* ══════════════════════════════════════════════════════════════ STAGES */
.stage {
  position: relative;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 80px 0 80px 48px;
}

.stage-label {
  position: absolute;
  left: 0;
  top: 80px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg) translateY(-4px);
  user-select: none;
}

/* Pipeline nodes */
.pipeline-node {
  position: absolute;
  left: -40px;
  top: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.node-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-hi);
  border: 1px solid var(--border-hi);
  transition: background var(--trans), border-color var(--trans);
}

.stage.in-view .node-dot {
  background: var(--accent);
  border-color: var(--accent);
}

/* Pulse dot (reused from Renfe) */
.pulse-dot {
  background: var(--green) !important;
  animation: pulse-ring 1.8s ease infinite;
}

.pulse-dot-small {
  width: 6px !important;
  height: 6px !important;
  display: inline-block;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
}

@keyframes pulse-ring {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(62, 207, 116, 0.5);
  }
  50% {
    opacity: 0.8;
    box-shadow: 0 0 0 5px rgba(62, 207, 116, 0);
  }
}

/* Section header */
.section-header {
  margin-bottom: 40px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════════ REVEAL ANIMATIONS */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.reveal-child {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-child.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════ HERO */
.hero-stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 1 !important;
  transform: none !important;
}

#hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

/* Horizontal scan lines */
#hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 3px,
    rgba(61, 214, 214, 0.015) 3px,
    rgba(61, 214, 214, 0.015) 4px
  );
  animation: scan 8s linear infinite;
}

@keyframes scan {
  from { background-position: 0 0; }
  to   { background-position: 0 100px; }
}

#hero-content {
  position: relative;
  z-index: 1;
}

.hero-role {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 88px);
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--text-dim);
  max-width: 560px;
  line-height: 1.5;
  margin-bottom: 40px;
}

.hero-ctas {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.cta-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  padding: 10px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: background var(--trans), color var(--trans), box-shadow var(--trans);
}

.cta-btn:hover {
  background: transparent;
  color: var(--accent);
  box-shadow: 0 0 12px rgba(61, 214, 214, 0.25);
}

.cta-secondary {
  background: transparent;
  color: var(--accent);
}

.cta-secondary:hover {
  background: rgba(61, 214, 214, 0.08);
}

#hero-clock {
  position: absolute;
  bottom: 32px;
  right: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

#clock-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#clock-time {
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* ══════════════════════════════════════════════════════════════ ABOUT */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.neofetch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.neofetch-pre {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-dim);
  white-space: pre;
  overflow-x: auto;
}

.nf-key   { color: var(--accent); }
.nf-val   { color: var(--text); }
.nf-status { color: var(--green); }
.nf-company { color: var(--text-dim); }

.about-prose {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.about-prose p {
  color: var(--text-dim);
  line-height: 1.65;
  font-size: 15px;
}

/* ══════════════════════════════════════════════════════════════ EXPERIENCE */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.exp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
}

.exp-card:hover {
  border-color: var(--accent);
  box-shadow: inset 0 0 40px rgba(61, 214, 214, 0.04);
}

.exp-card.current {
  border-color: var(--border-hi);
}

.exp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 8px;
}

.exp-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.exp-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.exp-stage-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.exp-company {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.exp-dates {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.exp-current-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.08em;
}

.exp-role {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 16px;
}

.exp-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.exp-bullets li {
  display: flex;
  gap: 8px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
}

.bullet-arrow {
  color: var(--accent);
  font-family: var(--font-mono);
  flex-shrink: 0;
  margin-top: 1px;
}

.metric {
  font-family: var(--font-mono);
  color: var(--green);
  font-weight: 600;
}

.exp-stack {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.stack-label {
  color: var(--text-dim);
  margin-right: 6px;
}

/* ══════════════════════════════════════════════════════════════ PROJECTS */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.project-panel {
  display: block;
  text-decoration: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
}

.project-panel:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(61, 214, 214, 0.1);
  border-color: var(--accent);
}

.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.project-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}

.project-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 3px 7px;
  border-radius: 3px;
  flex-shrink: 0;
}

.badge-live {
  color: var(--green);
  background: rgba(62, 207, 116, 0.12);
  border: 1px solid rgba(62, 207, 116, 0.25);
}

.badge-archive {
  color: var(--accent-warm);
  background: rgba(232, 200, 74, 0.10);
  border: 1px solid rgba(232, 200, 74, 0.22);
}

.badge-personal {
  color: var(--purple);
  background: rgba(167, 139, 250, 0.10);
  border: 1px solid rgba(167, 139, 250, 0.22);
}

.project-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.5;
  font-family: var(--font-mono);
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.meta-row {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.meta-key {
  color: var(--accent);
  min-width: 48px;
  flex-shrink: 0;
}

.meta-val {
  color: var(--text-dim);
}

.meta-url {
  color: var(--accent);
  opacity: 0.7;
  transition: opacity var(--trans);
}

.project-panel:hover .meta-url {
  opacity: 1;
}

/* ══════════════════════════════════════════════════════════════ SKILLS */
.skills-wrapper {
  display: flex;
  justify-content: center;
}

.skills-dict {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 32px;
  display: inline-block;
  min-width: 480px;
}

.dict-line {
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: pre;
}

.dict-line.visible {
  opacity: 1;
}

.dict-border-top,
.dict-border-bottom {
  color: var(--border-hi);
}

.dict-empty {
  color: var(--border-hi);
}

.dict-separator {
  color: var(--text-muted);
}

.dict-section-header { }

.dict-heading {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.dict-key   { color: var(--accent); }
.dict-spacer { color: transparent; user-select: none; }
.dict-comment { color: var(--text-dim); }
.dict-tools { color: var(--text-dim); }

/* ══════════════════════════════════════════════════════════════ CONTACT */
.contact-wrapper {
  max-width: 600px;
}

.contact-intro {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 32px;
  line-height: 1.6;
}

.contact-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 48px;
}

.contact-prompt {
  color: var(--accent);
  margin-bottom: 12px;
}

.contact-json {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.json-brace {
  color: var(--text-dim);
}

.json-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0;
}

.json-key   { color: var(--accent-warm); }
.json-colon { color: var(--text-dim); white-space: pre; }
.json-val   { color: var(--green); }

.json-link {
  text-decoration: none;
  color: var(--green);
  transition: color var(--trans);
}

.json-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════════ FOOTER */
.site-footer {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.footer-sep {
  color: var(--border-hi);
}

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

/* ══════════════════════════════════════════════════════════════ RESPONSIVE */
@media (max-width: 860px) {
  #pipeline-line {
    left: 16px;
  }

  .stage {
    padding-left: 40px;
    padding-right: 20px;
  }

  .pipeline-node {
    left: -30px;
  }

  .stage-label {
    display: none;
  }
}

@media (max-width: 640px) {
  .about-grid {
    grid-template-columns: 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .skills-dict {
    min-width: 0;
    width: 100%;
    overflow-x: auto;
    padding: 16px;
  }

  .hero-name {
    font-size: clamp(36px, 10vw, 64px);
  }

  .hero-tagline {
    font-size: 16px;
  }

  #hero-clock {
    display: none;
  }

  #lang-toggle {
    top: 12px;
    right: 12px;
  }
}
