:root {
  --bg: #0d1015;
  --bg-alt: #12161d;
  --panel: #171c24;
  --line: #232a35;
  --line-strong: #2f3846;
  --text: #e8eaee;
  --text-dim: #9aa3b2;
  --text-faint: #5c6675;
  --orange: #ff6a2b;
  --orange-dim: #b34d20;
  --mono: "IBM Plex Mono", monospace;
  --sans: "Inter", sans-serif;
  --display: "Archivo", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--orange); color: #0d1015; }

h1, h2, h3 { font-family: var(--display); font-stretch: 110%; line-height: 1.05; }
h2 { font-size: clamp(30px, 4.5vw, 48px); font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 20px; font-weight: 700; }
a { color: inherit; text-decoration: none; }

/* ---------- NAV ---------- */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
#nav.scrolled { background: rgba(13,16,21,0.88); backdrop-filter: blur(12px); border-color: var(--line); }
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 18px 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--mono); font-weight: 500; font-size: 18px; letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 10px;
}
.logo-mark {
  width: 30px; height: 30px; display: block; flex-shrink: 0;
  color: var(--text); transition: color 0.25s ease, transform 0.25s ease;
}
.nav-logo:hover .logo-mark { color: var(--orange); transform: translateY(-1px); }
.logo-word { display: inline-block; }
.blink { color: var(--orange); animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.nav-links { display: flex; gap: 28px; align-items: center; font-size: 14px; color: var(--text-dim); }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  border: 1px solid var(--orange); color: var(--orange) !important;
  padding: 8px 18px; border-radius: 2px; font-family: var(--mono); font-size: 13px;
  transition: background 0.2s, color 0.2s;
}
.nav-cta:hover { background: var(--orange); color: #0d1015 !important; }
.nav-resume {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 13px; color: var(--text-dim);
  transition: color 0.2s;
}
.nav-resume svg { transition: transform 0.2s; }
.nav-resume:hover { color: var(--text); }
.nav-resume:hover svg { transform: translateY(2px); }
.nav-burger { display: none; background: none; border: none; cursor: pointer; flex-direction: column; gap: 5px; }
.nav-burger span { width: 24px; height: 2px; background: var(--text); display: block; }

/* ---------- HERO ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; align-items: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(13,16,21,0.4) 0%, rgba(13,16,21,0.65) 45%, var(--bg) 94%),
    url('img/hero-bg.jpg') center 35% / cover no-repeat;
}
.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 40%, black 30%, transparent 75%);
  opacity: 0.5;
}
.hero-inner { position: relative; max-width: 1200px; margin: 0 auto; padding: 140px 32px 80px; width: 100%; }
.hero-eyebrow { font-family: var(--mono); font-size: 13px; color: var(--orange); letter-spacing: 0.08em; margin-bottom: 24px; }
.hero-title { font-size: clamp(42px, 8vw, 96px); font-weight: 900; letter-spacing: -0.02em; text-transform: none; }
.hero-title .line { display: block; }
.hero-title em, h2 em { font-style: normal; color: var(--orange); }
.hero-sub { max-width: 640px; color: var(--text-dim); margin-top: 28px; font-size: 18px; }
.hero-stats { display: flex; gap: 48px; margin-top: 56px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat-num, .stat-plus { font-family: var(--display); font-weight: 800; font-size: 40px; display: inline; }
.stat-num { color: var(--text); }
.stat-plus { color: var(--orange); }
.stat > .stat-num { display: inline-block; }
.stat-label { font-family: var(--mono); font-size: 12px; color: var(--text-faint); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 4px; }
.hero-coords {
  position: absolute; bottom: 24px; left: 0; right: 0;
  display: flex; justify-content: space-between; max-width: 1200px; margin: 0 auto; padding: 0 32px;
  font-family: var(--mono); font-size: 11px; color: var(--text-faint); letter-spacing: 0.1em;
}

/* ---------- MARQUEE ---------- */
.marquee { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; padding: 14px 0; background: var(--bg-alt); }
.marquee-track { display: flex; white-space: nowrap; animation: scroll 40s linear infinite; font-family: var(--mono); font-size: 13px; color: var(--text-dim); letter-spacing: 0.1em; }
.marquee-track span { padding-right: 12px; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- SECTIONS ---------- */
.section { max-width: 1200px; margin: 0 auto; padding: 110px 32px; }
.section-alt { max-width: none; background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-alt > * { max-width: 1200px; margin-left: auto; margin-right: auto; }
.section-eyebrow { font-family: var(--mono); font-size: 13px; color: var(--orange); letter-spacing: 0.08em; margin-bottom: 14px; }
.section-head { margin-bottom: 56px; }
.section-sub { color: var(--text-dim); margin-top: 14px; max-width: 520px; }

/* ---------- FILTERS ---------- */
.filters { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.filter {
  font-family: var(--mono); font-size: 13px; color: var(--text-dim);
  background: none; border: 1px solid var(--line-strong); border-radius: 2px;
  padding: 8px 16px; cursor: pointer; transition: all 0.2s;
}
.filter:hover { border-color: var(--text-dim); color: var(--text); }
.filter.active { background: var(--orange); border-color: var(--orange); color: #0d1015; }

/* ---------- PROJECTS ---------- */
.projects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.project {
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  overflow: hidden; transition: transform 0.3s ease, border-color 0.3s ease;
  display: flex; flex-direction: column;
}
.project:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.project.hidden { display: none; }
.project-media { overflow: hidden; border-bottom: 1px solid var(--line); }
.project-media img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block;
  transition: transform 0.5s ease;
}
.project:hover .project-media img { transform: scale(1.04); }
.portrait { width: 100%; border: 1px solid var(--line); border-radius: 4px; display: block; }
.ph {
  aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--text-faint);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 24px, rgba(255,255,255,0.02) 24px, rgba(255,255,255,0.02) 25px),
    linear-gradient(160deg, #1a212b, #12161d);
  border-bottom: 1px solid var(--line);
  transition: transform 0.5s ease;
}
.project:hover .ph { transform: scale(1.03); }
.ph-portrait { aspect-ratio: 4/5; border: 1px solid var(--line); border-radius: 4px; }
.project-body { padding: 26px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.project-meta { display: flex; justify-content: space-between; align-items: center; }
.coords { font-family: var(--mono); font-size: 11px; color: var(--text-faint); letter-spacing: 0.08em; }
.badge { font-family: var(--mono); font-size: 11px; color: var(--orange); border: 1px solid var(--orange); border-radius: 2px; padding: 2px 8px; }
.project-role { font-family: var(--mono); font-size: 12px; color: var(--orange); letter-spacing: 0.03em; }
.project-body > p:not(.project-role) { color: var(--text-dim); font-size: 14.5px; }
.project-facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.project-facts li {
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  background: var(--bg); border: 1px solid var(--line); border-radius: 2px; padding: 4px 10px;
}

/* ---------- GANTT ---------- */
.gantt { padding: 0 32px; }
.gantt-years {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 12px; color: var(--text-faint);
  margin-left: 240px; margin-bottom: 12px; letter-spacing: 0.08em;
}
.gantt-rows { display: flex; flex-direction: column; gap: 10px; }
.gantt-row { display: flex; align-items: center; gap: 20px; }
.gantt-label { width: 220px; flex-shrink: 0; font-size: 13px; color: var(--text-dim); text-align: right; }
.gantt-track {
  flex: 1; height: 34px; position: relative;
  background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 20%);
  border-radius: 2px;
}
.gantt-bar {
  position: absolute; top: 4px; bottom: 4px;
  left: var(--s); width: var(--w);
  background: var(--orange); border-radius: 2px;
  display: flex; align-items: center; overflow: visible;
  transform-origin: left; transform: scaleX(0); transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.gantt.visible .gantt-bar { transform: scaleX(1); }
.bar-gray { background: var(--line-strong); }
.gantt-bar span {
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  white-space: nowrap; padding-left: calc(100% + 10px);
}
.gantt-bar:hover { filter: brightness(1.2); }

/* ---------- ABOUT ---------- */
.about-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 64px; align-items: start; }
.about-text p:not(.section-eyebrow) { color: var(--text-dim); margin-top: 18px; }
.about-text h2 { margin-bottom: 8px; }
.about-langs { display: flex; gap: 10px; margin-top: 32px; flex-wrap: wrap; }
.lang { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line-strong); border-radius: 2px; padding: 6px 12px; color: var(--text-dim); }
.events-block { margin-top: 32px; }
.events-block .skill-title { margin-bottom: 12px; }
.event-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.event-badge {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-dim);
  background: var(--panel); border: 1px solid var(--line); border-radius: 2px;
  padding: 6px 12px; transition: border-color 0.2s, color 0.2s;
}
.event-badge:hover { border-color: var(--orange); color: var(--text); }
.about-side { display: flex; flex-direction: column; gap: 24px; }
.skill-block { border: 1px solid var(--line); border-radius: 4px; padding: 22px; background: var(--panel); }
.skill-title { font-family: var(--mono); font-size: 12px; color: var(--orange); letter-spacing: 0.08em; margin-bottom: 10px; }
.skill-block p:not(.skill-title) { color: var(--text-dim); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); background: var(--bg); border: 1px solid var(--line); border-radius: 2px; padding: 5px 10px; }

/* ---------- SERVICES ---------- */
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 0 32px; }
.service { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 30px; transition: border-color 0.25s, transform 0.25s; }
.service:hover { border-color: var(--orange); transform: translateY(-3px); }
.service-num { font-family: var(--mono); font-size: 12px; color: var(--orange); letter-spacing: 0.1em; }
.service h3 { margin: 14px 0 10px; }
.service p { color: var(--text-dim); font-size: 14.5px; }
.service-cta { display: flex; flex-direction: column; justify-content: center; gap: 18px; background: transparent; border-style: dashed; }
.service-cta p { color: var(--text); font-size: 16px; }
.btn {
  display: inline-block; background: var(--orange); color: #0d1015; font-weight: 600;
  font-size: 15px; padding: 13px 26px; border-radius: 2px; border: none; cursor: pointer;
  transition: transform 0.15s, filter 0.2s; align-self: flex-start;
  font-family: var(--sans);
}
.btn:hover { filter: brightness(1.1); transform: translateY(-2px); }

/* ---------- CONTACT ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.contact-links { margin-top: 40px; display: flex; flex-direction: column; gap: 4px; }
.contact-link {
  display: flex; align-items: baseline; gap: 18px; padding: 16px 0;
  border-bottom: 1px solid var(--line); font-size: 17px; transition: color 0.2s, padding-left 0.25s;
}
.contact-link:hover { color: var(--orange); padding-left: 8px; }
.cl-label { font-family: var(--mono); font-size: 11px; color: var(--text-faint); letter-spacing: 0.1em; width: 72px; flex-shrink: 0; }
.contact-form { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.contact-form label { font-family: var(--mono); font-size: 12px; color: var(--text-dim); letter-spacing: 0.06em; display: flex; flex-direction: column; gap: 8px; }
.contact-form input, .contact-form textarea {
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 2px;
  color: var(--text); font-family: var(--sans); font-size: 15px; padding: 12px 14px;
  transition: border-color 0.2s;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--orange); }
.btn-full { align-self: stretch; text-align: center; }
.form-note { font-size: 12.5px; color: var(--text-faint); }

/* ---------- FOOTER ---------- */
footer { border-top: 1px solid var(--line); }
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 28px 32px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-family: var(--mono); font-size: 12px; color: var(--text-faint); letter-spacing: 0.06em;
}

/* ---------- FIELD MAP ---------- */
.map-wrap { position: relative; padding: 0 32px; }
.worldmap { width: 100%; height: auto; display: block; overflow: visible; }
.graticule line { stroke: var(--line); stroke-width: 1.4; }
.site { cursor: pointer; }
.site .halo { fill: url(#glow); opacity: 0.85; transition: opacity 0.35s ease; }
.site .dot { fill: var(--orange); }
.site .pulse {
  fill: none; stroke: var(--orange); stroke-width: 1.5;
  transform-box: fill-box; transform-origin: center;
  animation: sitePulse 3.2s ease-out infinite;
}
.site:nth-child(2n) .pulse { animation-delay: 0.5s; }
.site:nth-child(3n) .pulse { animation-delay: 1.1s; }
.site:nth-child(5n) .pulse { animation-delay: 1.8s; }
@keyframes sitePulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  70% { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(2.6); opacity: 0; }
}
.site:hover .dot { r: 8.5; }
.site:hover .halo { opacity: 1; }
.map-tip {
  position: absolute; pointer-events: none; opacity: 0;
  transform: translate(-50%, -170%); transition: opacity 0.18s ease;
  background: var(--bg); border: 1px solid var(--orange); border-radius: 2px;
  padding: 7px 12px; font-family: var(--mono); font-size: 12px; color: var(--text);
  white-space: nowrap; z-index: 5;
}
.map-tip.on { opacity: 1; }
.map-legend {
  list-style: none; margin: 40px auto 0; padding: 0 32px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 28px;
}
.map-legend li {
  font-size: 13.5px; color: var(--text-dim);
  padding: 8px 0; border-bottom: 1px solid var(--line);
  display: flex; gap: 10px; align-items: baseline;
}
.lg-city {
  font-family: var(--mono); font-size: 12px; color: var(--orange);
  min-width: 88px; flex-shrink: 0;
}

/* ---------- REVEAL ANIMATIONS ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }
.d1 { transition-delay: 0.1s; } .d2 { transition-delay: 0.2s; }
.d3 { transition-delay: 0.3s; } .d4 { transition-delay: 0.4s; } .d5 { transition-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .marquee-track { animation: none; }
  .gantt-bar { transform: none; transition: none; }
  .site .pulse { animation: none; opacity: 0.5; }
  html { scroll-behavior: auto; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .projects-grid, .contact-grid, .about-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: 1fr 1fr; }
  .about-grid { gap: 40px; }
  .gantt-label { width: 130px; font-size: 11px; }
  .gantt-years { margin-left: 150px; }
}
@media (max-width: 640px) {
  /* logo: mark only, wordmark would crowd the burger */
  .logo-word, .nav-logo .blink { display: none; }
  .logo-mark { width: 34px; height: 34px; }

  /* map: use full width and scale markers up so they stay tappable */
  .map-wrap { padding: 0; }
  .map-legend { padding: 0 20px; }
  .site .dot { r: 13; }
  .site .pulse { r: 18; stroke-width: 3; }
  .site .halo { r: 90; }
  .site:hover .dot, .site.active .dot { r: 17; }
  .map-tip { font-size: 11px; padding: 6px 10px; }

  /* gantt: stack label above bar so the track gets full width */
  .gantt-years { margin-left: 0; font-size: 10px; }
  .gantt-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .gantt-label { width: auto; text-align: left; font-size: 12px; }
  .gantt-track { height: 22px; }
  .gantt-rows { gap: 16px; }

  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    flex-direction: column; padding: 24px 32px; gap: 20px; align-items: flex-start;
  }
  .nav-links.open { display: flex; }
  .nav-burger { display: flex; }
  .services-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 28px; }
  .stat-num, .stat-plus { font-size: 30px; }
  .hero-coords { display: none; }
  .gantt { padding: 0 16px; }
  .gantt-bar span { display: none; }
  .section { padding: 80px 20px; }
}
