:root {
  --bg: #0A0B0D;
  --surface: #111316;
  --border: #23262B;
  --text: #E8EAEC;
  --text-dim: #7C848D;
  --accent: #3ECF8E;
  --accent-text: #0A0B0D;
  --accent-dim: #2B9063;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', sans-serif;
}

[data-theme="light"] {
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --border: #DBD8CE;
  --text: #16181A;
  --text-dim: #666A63;
  --accent: #9e4fe7;
  --accent-dim: #6E37A1;
  --accent-text: #FFFFFF;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
}

a { color: inherit; text-decoration: none; }

[data-i18n] { transition: opacity 0.15s ease; }

::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- Nav ---------- */
header.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
}

.logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.nav-links a::before { content: "› "; color: var(--accent); opacity: 0; }
.nav-links a:hover::before { opacity: 1; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); }

.nav-controls { display: flex; align-items: center; gap: 8px; }

/* ---------- Languages ---------- */
.lang-dropdown { position: relative; }

.lang-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px;
  width: 34px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lang-toggle:hover { border-color: var(--accent); }

.lang-toggle svg, .lang-menu svg {
  width: 22px;
  height: 16px;
  border-radius: 2px;
  display: block;
}

.lang-menu {
  list-style: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 50;
}

.lang-menu.open { display: flex; }

.lang-menu li {
  padding: 5px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 0;
}

.lang-menu li:hover, .lang-menu li:focus-visible { background: var(--border); }
.lang-menu li[aria-selected="true"] { outline: 1px solid var(--accent); }

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
}

.cv-btn {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 5px 10px;
  white-space: nowrap;
}

.cv-btn:hover { background: var(--accent); color: var(--accent-text); }

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 3px;
  font-size: 15px;
  cursor: pointer;
}

/* ---------- Layout ---------- */
main { max-width: 760px; margin: 0 auto; padding: 0 24px; }

section { padding: 56px 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

h1, h2, h3 { font-family: var(--mono); font-weight: 600; letter-spacing: -0.01em; }

.section-label {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

.section-label::before { content: "~/"; color: var(--accent); font-weight: 600; }

/* ---------- About me ---------- */
.hero { padding-top: 48px; }

.hero-name {
  font-family: var(--mono);
  font-size: clamp(30px, 5.5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 10px;
}

.hero-tagline {
  font-family: var(--sans);
  font-size: 17px;
  color: var(--text);
  margin-bottom: 10px;
}

.hero-tagline .accent { color: var(--accent); font-weight: 600; }

.hero-role { font-family: var(--sans); font-size: 15.5px; color: var(--text-dim); margin-bottom: 14px; }

.hero p.lead {
  font-family: var(--sans);
  font-size: 15.5px;
  color: var(--text-dim);
  
  margin-bottom: 22px;
}

.whoami-line {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 26px;
}

.whoami-line .prompt { color: var(--accent); }
.whoami-line .typed-out { color: var(--text); }

.cursor {
  display: inline-block;
  width: 6px;
  height: 13px;
  background: var(--accent);
  vertical-align: middle;
  margin-left: 2px;
  animation: blink 1s step-start infinite;
}

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

.hero-actions { display: flex; gap: 20px; font-family: var(--mono); font-size: 13.5px; }
.hero-actions a { color: var(--text-dim); border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.hero-actions a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Quick facts ---------- */
.quick-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
}

.quick-facts span {
  white-space: nowrap;
}

.quick-facts span:not(:last-child)::after {
  content: "·";
  margin-left: 16px;
  color: var(--border);
}

/* ---------- Timeline ---------- */
.timeline-item {
  display: flex;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:first-child { padding-top: 0; }
.timeline-item:last-child { border-bottom: none; padding-bottom: 0; }

.timeline-date {
  flex: 0 0 120px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  padding-top: 3px;
  white-space: nowrap;
}

.timeline-modality {
  flex: 0 0 120px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  padding-top: 3px;
  white-space: nowrap;
}

.date-container {
  width: 23%;
}

.timeline-content h3 { font-size: 15px; margin-bottom: 3px; }
.timeline-content h3 a:hover { color: var(--accent); text-decoration: underline; }
.timeline-content a:hover { color: var(--accent); text-decoration: underline; }
.timeline-content .org { font-family: var(--sans); font-size: 14px; color: var(--accent); margin-bottom: 4px; }
.timeline-content .meta-line { font-family: var(--mono); font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.timeline-content p { font-family: var(--sans); font-size: 14.5px; color: var(--text-dim); max-width: 48ch; }

.honors-list {
  list-style: none;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.honors-list li a:hover { color: var(--accent); text-decoration: underline; }

.honors-list li {
  font-family: var(--mono);
  font-size: 12.5px;
  /* color: var(--accent); */
}

.honors-list li::before { content: "★ "; }

.tfm-container {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
  margin-left: 25px;
}

.tfm-container a::before { content: "› "; color: var(--accent); }
.tfm-container a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Idiomas ---------- */
.lang-list { display: flex; flex-direction: column; }

.lang-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.lang-row:last-child { border-bottom: none; }

.lang-code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  flex: 0 0 58px;
}

.lang-name { flex: 0 0 auto; min-width: 88px; color: var(--text); }

.lang-level {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 8px;
}

.lang-level.is-native { color: var(--accent); border-color: var(--accent); }

.lang-note { font-size: 12.5px; color: var(--text-dim); }

.lang-cert { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-left: auto; }
.lang-cert:hover { text-decoration: underline; }

/* ---------- Certs ---------- */
.cert-block { margin-top: 30px; }

.cert-sublabel {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.cert-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.cert-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
}

.cert-card:hover { border-color: var(--accent); }

.cert-logo {
  flex: 0 0 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg);
  overflow: hidden;
}

.cert-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.cert-info h4 { font-family: var(--mono); font-size: 13.5px; font-weight: 600; line-height: 1.4; margin-bottom: 3px; }
.cert-meta { font-size: 12.5px; color: var(--text-dim); }
.cert-credential { display: inline-block; margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--accent); }
.cert-credential:hover { text-decoration: underline; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 3px;
}

a.tag:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Miscellaneous ---------- */
.others-group { margin-bottom: 30px; }
.others-group:last-child { margin-bottom: 0; }

.others-sublabel {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}

/* ---------- Skills ---------- */
.skills-list { display: flex; flex-direction: column; gap: 12px; }
.skills-row { display: flex; gap: 16px; font-size: 14.5px; }
.skills-row .label { flex: 0 0 240px; font-family: var(--mono); font-size: 13px; color: var(--accent); }
.skills-row .items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.skills-row .items span {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 3px 7px;
  border-radius: 3px;
}

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

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.project-card:hover { border-color: var(--accent); }

.project-cover {
  height: 120px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.project-cover svg { width: 100%; height: 100%; }
.project-cover img { width: 100%; height: 100%; object-fit: cover; }

.project-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }

.project-body h3 { font-size: 15px; margin-bottom: 6px; }
.project-body h3::before { content: "$ "; color: var(--accent); }

.project-body p {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.project-tags span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 3px 7px;
  border-radius: 3px;
}

.project-link {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  margin-top: auto;
}

.project-link:hover { text-decoration: underline; }

/* ---------- Contact ---------- */
#contacto h2 { font-size: clamp(20px, 3.6vw, 26px); margin-bottom: 10px; }
#contacto p { font-family: var(--sans); color: var(--text-dim); margin-bottom: 20px; max-width: 45ch; }

.contact-links { display: flex; gap: 20px; font-family: var(--mono); font-size: 13.5px; flex-wrap: wrap; }
.contact-links a { color: var(--text-dim); border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.contact-links a:hover { border-color: var(--accent); color: var(--accent); }

footer {
  text-align: center;
  padding: 24px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
}

.footer-copy {
  font-size: 15px;
}

/* ---------- Button to scroll to top ---------- */
.scroll-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--accent); 
  color: var(--accent-text);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 999;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.scroll-top-btn svg {
  width: 24px;
  height: 24px;
}

.scroll-top-btn:hover {
  background-color: var(--accent-dim);
  transform: translateY(-3px);
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .nav-links { display: none; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 18px 24px;
    gap: 14px;
  }
  .hero-actions { flex-wrap: wrap; }
  .projects-grid, .cert-grid { grid-template-columns: 1fr; }
  .timeline-item { flex-direction: column; gap: 4px; }
  .timeline-date { flex: none; }
  .skills-row { flex-direction: column; gap: 4px; }
  .skills-row .label { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
