:root {
  --bg:        #0d0f12;
  --bg2:       #13161b;
  --bg3:       #1a1e25;
  --border:    #252a33;
  --accent:    #00d4aa;
  --accent2:   #0097ff;
  --text:      #e2e8f0;
  --muted:     #64748b;
  --mono:      'IBM Plex Mono', monospace;
  --sans:      'IBM Plex Sans', sans-serif;
}

*, *::before, *::after { 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.7;
}

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

/* ── LAYOUT ── */
.container { max-width: 860px; margin: 0 auto; padding: 0 2rem; }

/* ── NAV ── */
nav {
  position: fixed; top: 0; width: 100%; z-index: 100;
  background: rgba(13,15,18,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.05em;
}
.nav-logo span { color: var(--muted); }
.nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }

/* ── LANG SWITCHER ── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.lang-btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  transition: all 0.2s;
  text-transform: uppercase;
}
.lang-btn:hover { color: var(--accent); }
.lang-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}
.lang-sep {
  color: var(--border);
  font-family: var(--mono);
  font-size: 0.72rem;
  user-select: none;
}

/* ── HERO ── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 5rem;
  position: relative;
  overflow: hidden;
}
#hero::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,212,170,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hero-label::before {
  content: '';
  width: 2rem; height: 1px;
  background: var(--accent);
}
h1 {
  font-family: var(--mono);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}
h1 .dim { color: var(--muted); font-weight: 400; }
.hero-tagline {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 520px;
  margin-bottom: 2.5rem;
  font-weight: 300;
}
.hero-tagline strong { color: var(--text); font-weight: 500; }
.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.btn {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75rem 1.75rem;
  border-radius: 3px;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.btn-primary:hover { background: #00f0c0; transform: translateY(-2px); }
.btn-ghost {
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.hero-stats {
  display: flex;
  gap: 3rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.stat-num {
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--accent);
}
.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ── SECTIONS ── */
section { padding: 6rem 0; }
.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}
.section-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
h2 {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── SKILLS ── */
#skills { background: var(--bg2); }
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.skill-item {
  background: var(--bg2);
  padding: 1.25rem 1.5rem;
  transition: background 0.2s;
}
.skill-item:hover { background: var(--bg3); }
.skill-name {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.skill-cat {
  font-size: 0.72rem;
  color: var(--muted);
}
.skill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-right: 0.5rem;
}
.skill-dot.blue { background: var(--accent2); }
.skill-dot.dim { background: var(--border); }

/* ── PROJECTS ── */
.projects-list { display: flex; flex-direction: column; gap: 1.5rem; }
.project-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
  overflow: hidden;
}
.project-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}
.project-img-wrap {
  margin: -2rem -2rem 1.75rem;
  height: 210px;
  overflow: hidden;
}
.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  display: block;
  filter: grayscale(60%) brightness(0.72);
  transition: filter 0.4s;
}
.project-card:hover .project-img {
  filter: grayscale(20%) brightness(0.85);
}
.project-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
}
.project-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.project-title {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.project-desc {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 1rem;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  background: var(--bg3);
  color: var(--muted);
  border: 1px solid var(--border);
  letter-spacing: 0.05em;
}
.project-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-end;
}
.project-links a {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: all 0.2s;
  white-space: nowrap;
}
.project-links a:hover { color: var(--accent); border-color: var(--accent); }

/* ── FORMACIÓ / EDUCATION ── */
#formacio { background: var(--bg2); }
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: 2.5rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.4rem; top: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg2);
}
.timeline-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}
.timeline-title {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.timeline-where {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.timeline-desc {
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 560px;
}

/* ── CONTACTE ── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.contact-item {
  background: var(--bg);
  padding: 2rem;
  text-decoration: none;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.contact-item:hover { background: var(--bg3); }
.contact-icon {
  font-family: var(--mono);
  font-size: 1.4rem;
  width: 2.5rem;
  text-align: center;
  flex-shrink: 0;
}
.contact-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.15rem;
}
.contact-value {
  font-size: 0.9rem;
  color: var(--text);
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
}
footer p {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
footer .accent { color: var(--accent); }

/* ── VIDEO MODAL ── */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.9);
  align-items: center;
  justify-content: center;
}
.modal.open { display: flex; }
.modal-container {
  position: relative;
  width: calc(100% - 2rem);
  max-width: 860px;
}
.modal-close {
  position: absolute;
  top: -2.75rem;
  right: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
}
.modal-close:hover { color: var(--accent); }
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 4px;
}
.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.6s ease both; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero-stats { gap: 2rem; flex-wrap: wrap; }
  .project-body { grid-template-columns: 1fr; }
  .project-links { flex-direction: row; align-items: flex-start; }
  .contact-grid { grid-template-columns: 1fr; }
}
