/* ==========================================================================
   Matías Sandoval — Currículum / Portfolio
   Sistema visual: superficies oscuras, acento menta, tarjetas con borde suave.
   ========================================================================== */

:root,
[data-theme="dark"] {
  --night: #04070c;
  --navy: #0b1220;
  --navy-soft: #111a28;
  --line: #17263c;
  --ink: #e8eef6;
  --muted: #94a3b8;
  --brand: #00ffc9;
  --brand-dim: rgba(0, 255, 201, 0.12);
  --brand-strong: #4dffd9;
  --brand-border: rgba(0, 255, 201, 0.32);
  --brand-border-strong: rgba(0, 255, 201, 0.45);
  --brand-shadow: rgba(0, 255, 201, 0.18);
  --brand-ring: rgba(0, 255, 201, 0.14);
  --brand-ink: var(--night);
  --link-hover: #7dffe3;

  --surface-header: rgba(4, 7, 12, 0.8);
  --surface-card: rgba(11, 18, 32, 0.6);
  --surface-card-hover: rgba(17, 26, 40, 0.7);
  --surface-sunken: rgba(4, 7, 12, 0.6);
  --line-soft: rgba(23, 38, 60, 0.6);
  --line-strong: rgba(23, 38, 60, 0.9);
  --glow-1: rgba(0, 255, 201, 0.07);
  --glow-2: rgba(56, 130, 246, 0.06);

  --radius-card: 20px;
  --radius-sm: 12px;
  --container: 1120px;
  --header-h: 68px;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="light"] {
  --night: #f5f7fb;
  --navy: #ffffff;
  --navy-soft: #eef2f8;
  --line: #d5dde8;
  --ink: #0d1726;
  --muted: #52627a;
  --brand: #00795f;
  --brand-dim: rgba(0, 121, 95, 0.1);
  --brand-strong: #005f4b;
  --brand-border: rgba(0, 121, 95, 0.28);
  --brand-border-strong: rgba(0, 121, 95, 0.45);
  --brand-shadow: rgba(0, 121, 95, 0.22);
  --brand-ring: rgba(0, 121, 95, 0.16);
  --brand-ink: #ffffff;
  --link-hover: #005f4b;

  --surface-header: rgba(255, 255, 255, 0.85);
  --surface-card: rgba(255, 255, 255, 0.85);
  --surface-card-hover: #ffffff;
  --surface-sunken: rgba(238, 242, 248, 0.8);
  --line-soft: rgba(213, 221, 232, 0.9);
  --line-strong: rgba(190, 202, 218, 0.9);
  --glow-1: rgba(0, 121, 95, 0.08);
  --glow-2: rgba(56, 130, 246, 0.08);

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--night);
  background-image:
    radial-gradient(60rem 40rem at 15% -10%, var(--glow-1), transparent 60%),
    radial-gradient(45rem 35rem at 100% 10%, var(--glow-2), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

a:hover {
  color: var(--link-hover);
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.6rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

blockquote {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 88px 0;
  border-top: 1px solid var(--line-soft);
}

.section--plain {
  border-top: 0;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand);
}

.section__title {
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.25rem);
  margin-bottom: 12px;
}

.section__lead {
  max-width: 62ch;
  color: var(--muted);
  margin-bottom: 40px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}

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

/* ---------- Header ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--surface-header);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line-soft);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand-dim);
  border: 1px solid var(--brand-border);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  order: 1;
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav a {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav a:hover,
.nav a.is-active {
  color: var(--ink);
}

.nav__toggle {
  order: 3;
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-card-hover);
  color: var(--ink);
  cursor: pointer;
}

.nav__toggle svg {
  margin: 0 auto;
}

.theme-toggle {
  order: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease),
    color 0.3s var(--ease);
}

.theme-toggle:hover {
  border-color: var(--brand-border-strong);
  color: var(--brand);
}

.theme-toggle__icon {
  grid-area: 1 / 1;
}

.theme-toggle__icon--sun {
  display: none;
}

[data-theme="light"] .theme-toggle__icon--moon {
  display: none;
}

[data-theme="light"] .theme-toggle__icon--sun {
  display: block;
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background-color 0.3s var(--ease),
    border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), color 0.3s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 10px 30px var(--brand-shadow);
}

.btn--primary:hover {
  background: var(--brand-strong);
  color: var(--brand-ink);
}

.btn--ghost {
  background: var(--surface-card-hover);
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--brand-border-strong);
  background: var(--navy-soft);
  color: var(--ink);
}

/* ---------- Hero ---------- */

.hero {
  padding: clamp(56px, 8vw, 112px) 0 88px;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  margin-bottom: 22px;
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  background: var(--brand-dim);
  color: var(--brand);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.hero h1 {
  font-size: clamp(2.5rem, 1.6rem + 4vw, 4.25rem);
  line-height: 1;
  margin-bottom: 16px;
}

.hero__role {
  font-size: clamp(1.1rem, 0.9rem + 1vw, 1.5rem);
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 10px;
}

.hero__tags {
  color: var(--brand);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
}

.hero__text {
  max-width: 56ch;
  color: var(--muted);
  margin-bottom: 32px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 36px;
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  font-size: 0.9rem;
  color: var(--muted);
}

.hero__facts li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero__facts svg {
  color: var(--brand);
  flex: none;
}

.hero__portrait {
  position: relative;
  justify-self: center;
  width: min(320px, 100%);
  aspect-ratio: 1;
  border-radius: 28px;
  padding: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--brand-ring), var(--surface-card));
}

.hero__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
}

/* ---------- Tarjetas ---------- */

.card {
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--surface-card);
  padding: 32px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.5s var(--ease), border-color 0.5s var(--ease),
    background-color 0.5s var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-border-strong);
  background: var(--surface-card-hover);
}

.grid {
  display: grid;
  gap: 20px;
}

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

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ---------- Sobre mí ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.about p:last-child {
  margin-bottom: 0;
}

.about__highlights li {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.95rem;
}

.about__highlights li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.about__highlights strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.about__highlights svg {
  color: var(--brand);
  flex: none;
  margin-top: 4px;
}

/* ---------- Experiencia ---------- */

.company {
  margin-bottom: 24px;
}

.company__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.company__name {
  font-size: 1.25rem;
}

.company__meta,
.timeline__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.company__intro {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, var(--brand), var(--line-strong));
}

.timeline__item {
  position: relative;
  padding-bottom: 28px;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 7px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--night);
  border: 2px solid var(--line);
}

.timeline__item--current::before {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}

.timeline__role {
  font-size: 1.02rem;
  margin-bottom: 4px;
}

.timeline__desc {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 8px 0 0;
}

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-dim);
  border: 1px solid var(--brand-border);
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

.experience__more {
  margin-top: 8px;
}

.role-compact {
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 24px;
  align-items: baseline;
}

.role-compact:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.role-compact h4 {
  margin: 0;
  font-size: 1rem;
}

.role-compact p {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Stack ---------- */

.stack__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.stack__title svg {
  color: var(--brand);
}

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

.chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-sunken);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Proyectos ---------- */

.project h3 {
  font-size: 1.1rem;
}

.project__desc {
  color: var(--muted);
  font-size: 0.95rem;
}

.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  font-size: 0.9rem;
  font-weight: 500;
}

.project__links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Educación y certificaciones ---------- */

.edu h3 {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.edu__school {
  color: var(--brand);
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.edu p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.certs__title {
  margin-top: 40px;
  font-size: 1.05rem;
}

.certs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.cert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-card);
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}

.cert:hover {
  border-color: var(--brand-border-strong);
  background: var(--surface-card-hover);
}

.cert h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.cert span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}

.cert__link {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--brand);
}

.cert__link:hover {
  border-color: var(--brand-border-strong);
  background: var(--brand-dim);
}

/* ---------- Referencias ---------- */

.quote p {
  color: var(--muted);
  font-size: 0.95rem;
}

.quote__author {
  margin-top: 18px;
  font-weight: 600;
}

.quote__author span {
  display: block;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--brand);
}

.reference {
  max-width: 560px;
}

.reference .quote__author {
  margin-top: 0;
  color: var(--ink);
}

.reference__contact {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  font-size: 0.95rem;
}

/* ---------- Contacto ---------- */

.contact__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.contact__item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.contact__item svg {
  color: var(--brand);
  flex: none;
  margin-top: 3px;
}

.contact__item h3 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.contact__item p,
.contact__item a {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.contact__item a:hover {
  color: var(--brand);
}

/* ---------- Footer ---------- */

.footer {
  padding: 32px 0 48px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer p {
  margin: 0;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer__links {
  display: flex;
  gap: 12px;
}

.footer__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-card);
  color: var(--muted);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
    background-color 0.3s var(--ease);
}

.footer__icon:hover {
  color: var(--brand);
  border-color: var(--brand-border-strong);
  background: var(--surface-card-hover);
}

/* ---------- Animaciones ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */

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

  .hero__portrait {
    order: -1;
    width: min(220px, 60%);
  }

  .nav__toggle {
    display: grid;
    place-items: center;
  }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 20px;
    background: var(--night);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }

  .nav.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .nav a {
    padding: 14px 8px;
    font-size: 1rem;
    border-bottom: 1px solid var(--line-soft);
  }
}

@media (max-width: 640px) {
  .section {
    padding: 64px 0;
  }

  .card {
    padding: 24px 20px;
  }

  .btn {
    width: 100%;
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .timeline {
    padding-left: 22px;
  }

  .timeline__item::before {
    left: -22px;
  }

  .role-compact {
    grid-template-columns: 1fr;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Selector de idioma ---------- */

.lang-switch {
  order: 2;
  position: relative;
}

.lang-switch__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-card);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}

.lang-switch__toggle:hover,
.lang-switch__toggle[aria-expanded="true"] {
  border-color: var(--brand-border-strong);
  color: var(--brand);
}

.lang-switch__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 150px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--night);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.lang-switch__menu[hidden] {
  display: none;
}

.lang-switch__menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.lang-switch__menu button:hover,
.lang-switch__menu button:focus-visible {
  background: var(--brand-dim);
  color: var(--ink);
}

.lang-switch__menu button[aria-checked="true"] {
  color: var(--brand);
  font-weight: 600;
}

.lang-switch__menu button[aria-checked="true"]::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.theme-toggle {
  order: 3;
}

.nav__toggle {
  order: 4;
}

@media (max-width: 640px) {
  .header__inner {
    gap: 10px;
  }

  .lang-switch__toggle {
    padding: 0 10px;
  }

  .lang-switch__globe {
    display: none;
  }
}
