:root {
  --black: #111;
  --white: #fff;
  --yellow: #f5c842;
  --crimson: #9b1b30;
  --header: #4a5568;
  --sub: #718096;
  --paper: #f0ece4;
  --mist: rgba(240, 236, 228, 0.82);
  --line: rgba(255, 255, 255, 0.09);
  --panel-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);

  --f-nav-back: 0.72rem;
  --f-hero-tag: 0.82rem;
  --f-hero-title: clamp(4rem, 10vw, 7.5rem);
  --f-hero-sub: 0.75rem;
  --f-hero-hint: 0.72rem;
  --f-section-num: 0.68rem;
  --f-section-head: clamp(2.1rem, 4.8vw, 3.4rem);
  --f-section-body: 1rem;
  --f-conc-quote: clamp(1.55rem, 3.8vw, 2.5rem);
  --f-conc-author: 0.7rem;
  --f-conc-num: 0.7rem;
  --f-conc-head: clamp(1.8rem, 3vw, 2.5rem);
  --f-conc-body: 1rem;
  --f-footer-name: 1.05rem;
  --f-footer-copy: 0.62rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Libre Baskerville', serif;
  background:
    radial-gradient(circle at top, rgba(245, 200, 66, 0.08), transparent 22%),
    linear-gradient(180deg, #151515 0%, #111 38%, #0d0d0d 100%);
  color: var(--white);
  overflow-x: hidden;
}

a {
  color: inherit;
}

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 400;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--yellow), #fff1b7);
  transition: width 0.2s ease;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 3rem;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.35), transparent);
}

.logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-decoration: none;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.logo::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  margin-bottom: 2px;
}

.back-link {
  font-family: 'Space Mono', monospace;
  font-size: var(--f-nav-back);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.68);
  transition: color 0.2s ease, transform 0.2s ease;
}

.back-link:hover {
  color: var(--white);
  transform: translateX(-2px);
}

.battle-hero {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 7rem 3rem 4rem;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.battle-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 8, 8, 0.2), rgba(8, 8, 8, 0.78)),
    var(--hero-image, radial-gradient(circle at 20% 20%, rgba(245, 200, 66, 0.14), transparent 18%), linear-gradient(135deg, #1c1c1c 0%, #111 55%, #1a1a1a 100%));
  background-size: var(--hero-size, cover);
  background-position: var(--hero-position, center);
  background-repeat: var(--hero-repeat, no-repeat);
  background-color: var(--hero-bg, #121212);
  filter: saturate(0.9) contrast(1.02);
}

.battle-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 48%, rgba(0, 0, 0, 0.55) 100%),
    radial-gradient(circle at 75% 20%, rgba(155, 27, 48, 0.22), transparent 28%);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 880px;
}

.battle-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
  font-family: 'Space Mono', monospace;
  font-size: var(--f-hero-tag);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--crimson);
  font-weight: 700;
}

.battle-tag::before {
  content: '';
  width: 32px;
  height: 1px;
  background: rgba(245, 200, 66, 0.8);
}

.battle-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: var(--f-hero-title);
  font-weight: 300;
  line-height: 0.98;
  color: var(--paper);
  margin-bottom: 0.9rem;
  text-wrap: balance;
}

.battle-title em {
  font-style: italic;
  color: var(--yellow);
}

.battle-subtitle {
  font-family: 'Space Mono', monospace;
  font-size: var(--f-hero-sub);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.52);
  margin-bottom: 2.2rem;
}

.scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-family: 'Space Mono', monospace;
  font-size: var(--f-hero-hint);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}

.scroll-hint::before {
  content: '';
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, 0.28);
}

.fade-divider {
  height: 12vh;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.86) 45%, transparent);
}

.battle-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  padding: 3rem;
  overflow: hidden;
}

.battle-section.right {
  justify-content: flex-end;
}

.section-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(160deg, rgba(74, 85, 104, 0.18), transparent 42%),
    radial-gradient(circle at var(--glow-x, 18%) var(--glow-y, 22%), rgba(245, 200, 66, 0.1), transparent 20%),
    var(--section-image, linear-gradient(135deg, #171717 0%, #1e1e1e 40%, #131313 100%));
  background-size: var(--section-size, cover);
  background-position: var(--section-position, center);
  background-repeat: var(--section-repeat, no-repeat);
  background-color: var(--section-bg-color, #121212);
  transform: var(--section-transform, none);
}

.battle-section.right .section-bg {
  --glow-x: 82%;
}

.section-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.94) 0%, rgba(0, 0, 0, 0.74) 34%, rgba(0, 0, 0, 0.2) 72%, rgba(0, 0, 0, 0.5) 100%);
}

.section-content {
  position: relative;
  z-index: 2;
  max-width: 700px;
  padding: 2.6rem 2.8rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(14, 14, 14, 0.72), rgba(10, 10, 10, 0.84));
  backdrop-filter: blur(4px);
  box-shadow: var(--panel-shadow);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.battle-section.right .section-content {
  text-align: right;
}

.battle-section.right .section-body {
  margin-left: auto;
}

.section-content.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-num {
  display: block;
  margin-bottom: 0.85rem;
  font-family: 'Space Mono', monospace;
  font-size: var(--f-section-num);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--yellow);
}

.section-heading {
  font-family: 'Cormorant Garamond', serif;
  font-size: var(--f-section-head);
  font-weight: 300;
  line-height: 1.08;
  color: var(--paper);
  margin-bottom: 1.2rem;
  text-wrap: balance;
}

.section-body {
  max-width: 58ch;
  font-size: var(--f-section-body);
  line-height: 1.92;
  color: var(--mist);
  text-align: justify;
}

.conclusion {
  min-height: 80vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  padding: 5rem 3rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 18% 30%, rgba(245, 200, 66, 0.06), transparent 22%),
    linear-gradient(180deg, #101010 0%, #0d0d0d 100%);
}

.conclusion-quote {
  font-family: 'Cormorant Garamond', serif;
  font-size: var(--f-conc-quote);
  font-style: italic;
  line-height: 1.45;
  color: var(--paper);
  border-left: 2px solid var(--yellow);
  padding-left: 1.5rem;
}

.conclusion-author {
  display: block;
  margin-top: 1rem;
  font-family: 'Space Mono', monospace;
  font-size: var(--f-conc-author);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--crimson);
}

.conclusion-num {
  display: block;
  margin-bottom: 0.85rem;
  font-family: 'Space Mono', monospace;
  font-size: var(--f-conc-num);
  letter-spacing: 0.2em;
  color: var(--yellow);
}

.conclusion-heading {
  font-family: 'Cormorant Garamond', serif;
  font-size: var(--f-conc-head);
  font-weight: 300;
  line-height: 1.15;
  color: var(--paper);
  margin-bottom: 1.2rem;
}

.conclusion-text {
  font-size: var(--f-conc-body);
  line-height: 1.9;
  color: rgba(160, 168, 176, 0.95);
  text-align: justify;
}

.next-battle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding: 3rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 18, 18, 0.96), rgba(10, 10, 10, 1));
}

.next-label {
  display: block;
  margin-bottom: 0.55rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

.next-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.9rem;
  font-weight: 300;
  color: var(--paper);
}

.next-title em {
  font-style: italic;
  color: var(--yellow);
}

.next-link {
  flex-shrink: 0;
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--white);
  border-bottom: 2px solid var(--yellow);
  padding-bottom: 2px;
  transition: color 0.2s ease;
}

.next-link:hover {
  color: var(--yellow);
}

footer {
  padding: 2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0d0d0d;
}

.footer-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: var(--f-footer-name);
  color: rgba(255, 255, 255, 0.56);
  letter-spacing: 0.06em;
}

.footer-copy {
  font-family: 'Space Mono', monospace;
  font-size: var(--f-footer-copy);
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.3);
}

.map-glow {
  --hero-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.12)),
    url('imagenes/Campaña_de_Hidalgo.6.png');
}

@media (max-width: 768px) {
  header {
    padding: 1rem 1.5rem;
  }

  .battle-hero {
    padding: 6.5rem 1.5rem 3rem;
  }

  .battle-section {
    padding: 1.5rem;
    min-height: 88vh;
  }

  .section-content {
    width: 100%;
    max-width: 100%;
    padding: 2rem 1.5rem;
  }

  .battle-section.right .section-content {
    text-align: left;
  }

  .battle-section.right .section-body {
    margin-left: 0;
  }

  .conclusion {
    grid-template-columns: 1fr;
    gap: 3rem;
    padding: 4rem 1.5rem;
  }

  .next-battle {
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem 1.5rem;
  }

  footer {
    flex-direction: column;
    gap: 0.6rem;
    text-align: center;
    padding: 1.5rem;
  }
}
