/* =========================================================
   TOKENS DE DISEÑO
   ========================================================= */
:root {
  --bg: #10151b;
  --surface: #171e26;
  --ink: #ece6d9;
  --ink-dim: #a9b0b8;
  --line: #313b46;
  --accent: #e3b23c;
  --accent-dim: #7a6329;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;

  --max-width: 760px;
  --radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

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

/* =========================================================
   IDIOMA: se oculta lo que no corresponde al idioma activo
   ========================================================= */
html[lang="es"] [lang="en"],
html[lang="en"] [lang="es"] {
  display: none !important;
}

/* =========================================================
   BARRA DE PROGRESO
   ========================================================= */
.progress-track {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 100;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}

/* =========================================================
   BARRA SUPERIOR
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(16, 21, 27, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-mark {
  display: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 9px;
}
.topbar-nav {
  display: flex;
  gap: 16px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-nav::-webkit-scrollbar { display: none; }
.topbar-nav a {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--ink-dim);
  white-space: nowrap;
}
.topbar-nav a:hover { color: var(--ink); }

.topbar-status {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink-dim);
  white-space: nowrap;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #5fae7a;
  box-shadow: 0 0 0 3px rgba(95, 174, 122, 0.18);
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.lang-toggle button {
  background: none;
  border: none;
  color: var(--ink-dim);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 10px;
  cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--accent);
  color: #1a1406;
}

@media (min-width: 640px) {
  .topbar { padding: 16px 32px; gap: 24px; }
  .topbar-mark { display: inline-block; }
  .topbar-nav { gap: 22px; }
}
@media (min-width: 980px) {
  .topbar-status { display: flex; }
}

/* =========================================================
   LAYOUT GENERAL
   ========================================================= */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.section {
  padding: 72px 0 24px;
  border-top: 1px solid var(--line);
}
.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  margin: 0 0 6px;
}
.section-intro {
  color: var(--ink-dim);
  margin: 0 0 28px;
  max-width: 52ch;
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  padding: 88px 0 64px;
}
.hero-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  line-height: 1.05;
  margin: 0 0 12px;
}
.hero-role {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.2rem;
  color: var(--ink-dim);
  margin: 0 0 26px;
  max-width: 40ch;
}
.hero-lede {
  max-width: 60ch;
  color: var(--ink-dim);
  font-size: 1.05rem;
  margin: 0 0 34px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* =========================================================
   BOTONES
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #1a1406; }
.btn-primary:hover { background: #edc35d; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); }

/* =========================================================
   SECCIONES PLEGABLES (timeline y proyectos)
   El contenedor .detail tiene UN solo hijo (.detail-inner)
   para que la animación de altura funcione bien.
   ========================================================= */
.detail {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows 0.25s ease, visibility 0s linear 0.25s;
}
.detail-inner { overflow: hidden; min-height: 0; }

.is-open > .detail {
  grid-template-rows: 1fr;
  visibility: visible;
  transition: grid-template-rows 0.25s ease, visibility 0s;
}

.caret {
  color: var(--ink-dim);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.is-open .caret { transform: rotate(45deg); color: var(--accent); }

.detail-inner ul:not(.stack) {
  list-style: disc;
  padding-left: 20px;
  color: var(--ink-dim);
}
.detail-inner li + li { margin-top: 6px; }
.detail-inner p { margin: 0; color: var(--ink-dim); }

/* =========================================================
   TIMELINE
   ========================================================= */
.timeline {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}
.timeline-item { position: relative; margin-bottom: 6px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 27px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--line);
}
.timeline-item.is-open::before { background: var(--accent); }

.timeline-trigger {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 16px;
  row-gap: 2px;
  background: none;
  border: none;
  color: inherit;
  font-family: var(--font-body);
  text-align: left;
  padding: 16px 8px;
  cursor: pointer;
  border-radius: var(--radius);
}
.timeline-trigger:hover { background: var(--surface); }
.timeline-year { grid-column: 1; grid-row: 1; font-size: 0.8rem; color: var(--accent); }
.timeline-heading { grid-column: 1; grid-row: 2; }
.timeline-heading strong { font-weight: 600; }
.timeline-trigger .caret { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

.timeline-item .detail-inner { padding: 0 8px; }
.timeline-item.is-open .detail-inner { padding-bottom: 18px; }
.timeline-item .detail-inner ul { margin-top: 10px; }

/* =========================================================
   FILTROS Y PROYECTOS
   ========================================================= */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.chip {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 6px 14px;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent-dim); color: var(--ink); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #1a1406; }

.project-grid { display: grid; gap: 14px; }

.project-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.project-card[hidden] { display: none; }
.project-card:hover,
.project-card:focus-within { border-color: var(--accent-dim); }

.project-tab {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 8px;
}
.project-title { margin: 0; font-size: 1.2rem; }
.project-toggle {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  text-align: left;
  cursor: pointer;
}
/* Hace clicable toda la tarjeta, no solo el título */
.project-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
}
.project-toggle:focus-visible { outline-offset: 6px; }

.project-summary { margin: 6px 0 0; color: var(--ink-dim); }
.project-card .detail-inner { position: relative; z-index: 1; }
.project-card .detail-inner ul:first-child,
.project-card .detail-inner ul[lang] { margin-top: 14px; }

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.stack li {
  font-size: 0.78rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px 8px;
}
.detail-inner .stack li + li { margin-top: 0; }
.project-card.is-open .detail-inner { padding-bottom: 4px; }

/* =========================================================
   HABILIDADES
   ========================================================= */
.skills-group { margin-bottom: 26px; }
.skills-label {
  font-size: 0.85rem;
  color: var(--ink-dim);
  font-weight: 500;
  margin: 0 0 12px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--surface);
}

/* =========================================================
   CONTACTO Y FOOTER
   ========================================================= */
.contact-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.copy-feedback {
  min-height: 1.2em;
  color: var(--accent);
  font-size: 0.9rem;
  margin: 14px 0 0;
}
.site-footer {
  text-align: center;
  padding: 48px 24px 64px;
  color: var(--ink-dim);
  font-size: 0.85rem;
}
