:root {
  color-scheme: light;
  --bg: #f8f9fb;
  --card: #ffffff;
  --card-border: #e2e4e9;
  --text: #1a1d24;
  --muted: #5e6472;
  --accent: #1e3a5f;
  --accent-strong: #16304d;
  --accent-soft: #e8edf3;
  --accent-fill: #1e3a5f;
  --accent-fill-hover: #16304d;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 18px 40px rgba(15, 23, 42, 0.1);
  --radius: 1rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14161b;
  --card: #1c1f26;
  --card-border: #2b2f38;
  --text: #e8e9ec;
  --muted: #9a9fab;
  --accent: #7a9cc4;
  --accent-strong: #9db8d6;
  --accent-soft: rgba(122, 156, 196, 0.14);
  --accent-fill: #35547c;
  --accent-fill-hover: #40638f;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 18px 44px rgba(0, 0, 0, 0.45);
}

/* El sitio es blanco por defecto siempre; el modo oscuro solo se activa
   si la persona lo elige explicitamente con el boton de tema (ver script.js),
   sin seguir la preferencia del sistema operativo. */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.25s ease, color 0.25s ease;
}

svg {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent-fill);
  color: white;
  padding: 0.6rem 1rem;
  border-radius: 0 0 0.5rem 0;
  z-index: 200;
}

.skip-link:focus {
  left: 0;
}

/* Navbar */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
}

.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.6rem;
  background: var(--accent-fill);
  color: white;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

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

.nav-cta {
  background: var(--accent-soft);
  color: var(--accent) !important;
  padding: 0.5rem 1rem;
  border-radius: 999px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
}

.icon-moon {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-moon {
  display: block;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* Hero */

.hero {
  position: relative;
  padding: 4.5rem 1.5rem 3.5rem;
  background: var(--bg);
  color: var(--text);
  border-bottom: 1px solid var(--card-border);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 15% 20%, var(--accent-soft), transparent 40%),
    radial-gradient(circle at 85% 0%, var(--accent-soft), transparent 45%);
  opacity: 0.6;
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0.25rem 0 1rem;
}

.intro {
  font-size: 1.08rem;
  max-width: 720px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.cv-downloads {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--accent-fill);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-fill-hover);
}

.btn-secondary {
  border: 1px solid var(--card-border);
  color: var(--text);
  background: var(--card);
}

.btn-cv {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  font-size: 0.9rem;
  padding: 0.65rem 1.1rem;
}

/* Stat grid (KPI cards, "app dashboard" feel) */

.stat-grid {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}

.stat-value {
  display: block;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
}

.stat-label {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Main sections */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.section {
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 1.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  scroll-margin-top: 5.5rem;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.1rem;
}

.section-head.compact {
  margin-bottom: 0.9rem;
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.65rem;
  background: var(--accent-soft);
  color: var(--accent);
}

.section-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.section-subtitle {
  color: var(--muted);
  margin-top: -0.6rem;
  margin-bottom: 1.25rem;
}

h2 {
  margin: 0;
  font-size: 1.3rem;
}

h3 {
  margin: 0 0 0.5rem;
}

/* Bento grid + cards */

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.bento-grid.two-col {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.bento-card {
  border: 1px solid var(--card-border);
  border-radius: 0.9rem;
  padding: 1.2rem;
  background: var(--card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.bento-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.bento-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: var(--text);
}

.bento-card h3 svg {
  color: var(--accent);
}

.project-card {
  display: flex;
  flex-direction: column;
}

.project-card p {
  color: var(--muted);
  margin: 0;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 1rem;
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}

.project-link svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.15s ease;
}

.project-link:hover svg {
  transform: translateX(3px);
}

/* Chips */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip-list span {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
}

/* Timeline (experience) */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline-item {
  position: relative;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--accent);
  border-radius: 0.9rem;
  padding: 1.1rem 1.25rem;
  background: var(--card);
}

.timeline-item h3 {
  font-size: 1.05rem;
}

.timeline-item ul {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.timeline-item li + li {
  margin-top: 0.35rem;
}

.meta {
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}

/* Education / certifications */

.edu-item + .edu-item {
  margin-top: 0.9rem;
}

.edu-item h3 {
  font-size: 0.98rem;
}

/* Power BI gallery */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.gallery-card {
  margin: 0;
  border: 1px solid var(--card-border);
  border-radius: 0.9rem;
  overflow: hidden;
  background: var(--card);
  cursor: zoom-in;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.gallery-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-bottom: 1px solid var(--card-border);
}

.gallery-card figcaption {
  padding: 0.9rem 1.1rem 1.1rem;
}

.gallery-card h3 {
  font-size: 0.98rem;
}

.gallery-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Power BI live embed */

.powerbi-live {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.25rem 0;
  margin-bottom: 1.5rem;
}

.powerbi-live-info {
  margin-bottom: 1rem;
}

.powerbi-live-info h3 {
  margin: 0.35rem 0 0.35rem;
}

.powerbi-live-info p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #d13438;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-badge::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #d13438;
  animation: powerbi-live-pulse 1.6s infinite;
}

@keyframes powerbi-live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.powerbi-live-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 0.7rem 0.7rem 0 0;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-bottom: none;
}

.powerbi-live-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 640px) {
  .powerbi-live-frame {
    aspect-ratio: 4 / 5;
  }
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 20, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 200;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 0.6rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
}

/* Project detail modal */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 20, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 200;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: var(--shadow-hover);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

.modal-body h3 {
  font-size: 1.25rem;
  margin-top: 0.2rem;
}

.modal-body p {
  color: var(--muted);
}

.modal-body ul {
  color: var(--muted);
  padding-left: 1.2rem;
  margin: 0.75rem 0;
}

.modal-body li + li {
  margin-top: 0.4rem;
}

.modal-body .chip-list {
  margin-top: 1rem;
}

/* Contact */

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.contact-links a svg {
  color: var(--accent);
}

.contact-links a:hover {
  color: var(--accent);
}

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--card-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem 1.5rem;
    gap: 1rem;
    display: none;
  }

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

  .hero {
    padding-top: 3.5rem;
  }

  main {
    padding: 1.25rem 1rem;
  }

  .section {
    padding: 1.25rem;
  }
}
