:root {
  --wood-dark: #3b2a1a;
  --wood: #6b4423;
  --wood-light: #a9744f;
  --tan: #e8d9bf;
  --cream: #f6efe1;
  --green-dark: #2f3b1f;
  --green: #4b5320;
  --green-light: #6b7a3a;
  --olive-soft: #8a9a5b;
  --surface: #fffaf0;
  --border: #d9c6a3;
  --text: #2b2016;
  --text-muted: #6b5a44;
  --shadow: 0 12px 32px rgba(59, 42, 26, 0.16);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  position: relative;
}

img { max-width: 100%; }

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

a { color: inherit; }

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Paratrooper animation layer --- */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.trooper {
  position: absolute;
  top: -160px;
  width: 60px;
  height: 84px;
  color: var(--green-dark);
  opacity: 0.16;
  animation: fall linear infinite, sway ease-in-out infinite;
}

.trooper--1 { left: 8%; animation-duration: 22s, 3.2s; animation-delay: 0s, 0s; }
.trooper--2 { left: 48%; width: 44px; height: 62px; animation-duration: 28s, 4s; animation-delay: 6s, 0.4s; color: var(--wood); }
.trooper--3 { left: 82%; width: 52px; height: 74px; animation-duration: 25s, 3.6s; animation-delay: 12s, 0.8s; }

@keyframes fall {
  0% { top: -160px; }
  100% { top: 110vh; }
}

@keyframes sway {
  0%, 100% { transform: translateX(0) rotate(-3deg); }
  50% { transform: translateX(24px) rotate(3deg); }
}

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 239, 225, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--border);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.navbar__brand {
  font-size: 1.3rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 1px;
  color: var(--wood-dark);
}

.navbar__brand span { color: var(--green); }

.navbar__nav {
  display: flex;
  gap: 26px;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.94rem;
  font-weight: 600;
  position: relative;
  padding: 4px 0;
  transition: color 0.2s ease;
}

.nav-link:hover, .nav-link.active { color: var(--green-dark); }

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--wood);
  border-radius: 2px;
}

.navbar__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.navbar__toggle span {
  width: 24px;
  height: 2px;
  background: var(--wood-dark);
}

/* --- Hero --- */
.hero {
  position: relative;
  z-index: 2;
  padding: 100px 0 76px;
  text-align: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(107, 122, 58, 0.18), transparent 45%),
    radial-gradient(circle at 80% 30%, rgba(107, 68, 35, 0.18), transparent 45%),
    var(--cream);
  border-bottom: 3px solid var(--wood-light);
}

.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.85rem;
  color: var(--green-dark);
  font-weight: 800;
  margin-bottom: 12px;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.1rem);
  margin: 0 0 18px;
  font-weight: 800;
  line-height: 1.18;
  color: var(--wood-dark);
}

.hero__subtitle {
  max-width: 660px;
  margin: 0 auto 32px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero__actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-family: inherit;
}

.btn--primary {
  background: var(--green-dark);
  color: var(--cream);
}

.btn--primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); background: var(--green); }

.btn--ghost {
  background: transparent;
  border-color: var(--wood-light);
  color: var(--wood-dark);
}

.btn--ghost:hover { border-color: var(--green-dark); color: var(--green-dark); }

.btn.is-active svg { transform: rotate(180deg); }
.btn svg { transition: transform 0.2s ease; }

/* --- Sections --- */
.section {
  position: relative;
  z-index: 2;
  padding: 80px 0;
}

.section--alt { background: rgba(107, 122, 58, 0.08); }

.section__eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--wood);
  margin-bottom: 8px;
}

.section__title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 40px;
  font-weight: 800;
  color: var(--wood-dark);
}

.subsection__title {
  margin-top: 48px;
  margin-bottom: 18px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--wood-dark);
}

.section__actions { margin-top: 28px; }

/* --- Datos personales --- */
.datos__grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 44px;
  align-items: start;
}

.photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  border: 4px solid var(--wood);
  box-shadow: var(--shadow);
  background: linear-gradient(160deg, var(--green-dark), var(--wood-dark));
  display: grid;
  place-items: center;
}

.photo-frame img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 2; }

.photo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 3.4rem;
  font-weight: 800;
  color: var(--tan);
  letter-spacing: 2px;
}

.photo-frame.no-photo .photo-fallback { display: flex; }

.photo-rank {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--wood-dark);
  color: var(--tan);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 14px;
  border-radius: 999px;
  z-index: 3;
}

.facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.facts li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.facts li:last-child { border-bottom: none; padding-bottom: 0; }
.facts span { color: var(--text-muted); }
.facts a { color: var(--green-dark); text-decoration: none; font-weight: 700; }

/* --- Tabs (cursos) --- */
.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.tab-btn {
  font-family: inherit;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover { border-color: var(--green-light); }

.tab-btn.is-active {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: var(--cream);
}

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green-light);
  border-radius: 12px;
  padding: 22px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--wood-dark); }

.card__meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--wood);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Timeline (pases) --- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  border-left: 3px solid var(--wood-light);
  max-width: 760px;
}

.timeline__item {
  position: relative;
  padding: 0 0 34px 32px;
  transition: opacity 0.3s ease, max-height 0.3s ease;
}

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

.timeline__dot {
  position: absolute;
  left: -9px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--wood);
  box-shadow: 0 0 0 4px var(--cream);
}

.timeline__dot--current { background: var(--green-dark); }

.timeline__tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(107, 68, 35, 0.14);
  color: var(--wood);
  padding: 3px 10px;
  border-radius: 999px;
  margin-right: 8px;
}

.timeline__tag--current { background: var(--green-dark); color: var(--cream); }

.timeline__date {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.timeline__content h3 {
  margin: 6px 0 0;
  font-size: 1.06rem;
  color: var(--wood-dark);
}

/* Region bars */
.region-bars { display: grid; gap: 16px; max-width: 620px; }

.region-bar {
  display: grid;
  grid-template-columns: 120px 1fr 90px;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.region-bar span { font-weight: 700; color: var(--wood-dark); }
.region-bar em { font-style: normal; color: var(--text-muted); font-size: 0.82rem; text-align: right; }

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-light));
  border-radius: 999px;
}

/* --- Physics table --- */
.table-wrap { overflow-x: auto; }

.physics-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-width: 560px;
}

.physics-table th, .physics-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.physics-table thead th {
  background: var(--green-dark);
  color: var(--cream);
  font-weight: 700;
}

.physics-table tbody tr:hover { background: rgba(107, 122, 58, 0.08); }

.physics-extra { display: none; color: var(--text-muted); }
.physics-table.show-detail .physics-extra { display: table-cell; }

.score {
  position: relative;
  background: var(--border);
  border-radius: 999px;
  height: 22px;
  min-width: 140px;
  overflow: hidden;
}

.score__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--wood), var(--wood-light));
  border-radius: 999px;
}

.score span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--wood-dark);
}

.table-note {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 2;
  border-top: 2px solid var(--border);
  background: var(--wood-dark);
  color: var(--tan);
  padding: 24px 0;
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
}

.back-to-top {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--tan);
  background: transparent;
  color: var(--tan);
  cursor: pointer;
  font-size: 1rem;
}

/* --- Scroll reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 820px) {
  .datos__grid { grid-template-columns: 1fr; }
  .photo-frame { max-width: 260px; margin: 0 auto; }
}

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

  .navbar__nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 16px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .navbar__nav.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .region-bar { grid-template-columns: 90px 1fr 70px; font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
  .trooper { animation: none; opacity: 0.08; }
  .reveal { transition: none; opacity: 1; transform: none; }
}
