/* ============================================================
   Ixil — el despojo de un título comunal
   main.css : variables, base typography, layout
   ============================================================ */

:root {
  /* paleta — modo claro (default) */
  --bg:            #FBF9F4;          /* papel */
  --bg-elev:      #FFFFFF;
  --bg-dark:      #0E1116;           /* hero, mapa */
  --text:         #1A1A1A;
  --text-soft:    #4A4A4A;
  --text-mute:    #6B6B6B;
  --line:         #E5E0D5;
  --line-strong:  #C9C2B0;

  --rojo:         #B2292E;           /* denuncia / violencia */
  --rojo-soft:    #E8CACB;
  --verde:        #2E7D5A;           /* defensa / ejido */
  --verde-soft:   #CDE3D7;
  --dorado:       #B8923D;           /* legal / Art. 8 */
  --dorado-soft:  #ECDEB5;

  /* tipografía */
  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body:    "Newsreader", Georgia, serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  /* escala */
  --fs-xs:   0.78rem;
  --fs-sm:   0.92rem;
  --fs-base: 1.06rem;
  --fs-md:   1.22rem;
  --fs-lg:   1.6rem;
  --fs-xl:   2.4rem;
  --fs-2xl:  3.4rem;
  --fs-3xl:  5rem;

  /* layout */
  --measure:       720px;
  --measure-wide:  960px;
  --gutter:        clamp(16px, 4vw, 32px);

  /* otros */
  --radius:        6px;
  --radius-lg:     14px;
  --shadow-sm:     0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  --shadow-md:     0 4px 14px rgba(0,0,0,.08), 0 10px 30px rgba(0,0,0,.06);
  --t-fast:        .15s ease;
  --t:             .3s ease;
}

/* modo oscuro */
[data-theme="dark"] {
  --bg:           #0E1116;
  --bg-elev:      #161A21;
  --bg-dark:      #06080B;
  --text:         #E8E8E8;
  --text-soft:    #B8B8B8;
  --text-mute:    #8A8A8A;
  --line:         #2A2F38;
  --line-strong:  #3D434E;

  --rojo:         #E04A50;
  --rojo-soft:    #4A1F21;
  --verde:        #4FB287;
  --verde-soft:   #1E3C2F;
  --dorado:       #D9B45D;
  --dorado-soft:  #3F3219;
}

/* ------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  font-feature-settings: "kern", "liga", "onum";
  transition: background var(--t), color var(--t);
}

img, svg { max-width: 100%; display: block; }
a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: var(--line-strong);
  transition: color var(--t-fast);
}
a:hover { color: var(--rojo); text-decoration-color: var(--rojo); }

::selection { background: var(--dorado-soft); color: var(--text); }

/* ------------------------------------------------------------ tipografía */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 .6em;
  color: var(--text);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-2xl); letter-spacing: -0.03em; }
h2 { font-size: var(--fs-xl); margin-top: 2.2em; }
h3 { font-size: var(--fs-lg); margin-top: 1.6em; font-weight: 600; }
h4 { font-size: var(--fs-md); font-weight: 600; }

p { margin: 0 0 1.1em; }
small, .meta { font-size: var(--fs-sm); color: var(--text-mute); }

cite {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-style: normal;
  color: var(--text-mute);
  display: inline-block;
  margin-top: .4em;
}
cite a { color: var(--text-mute); text-decoration-color: var(--line); }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--line);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ------------------------------------------------------------ layout: longform measure */
.wrap        { max-width: var(--measure);      margin-inline: auto; padding-inline: var(--gutter); }
.wrap-wide   { max-width: var(--measure-wide); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-full   { width: 100%; padding-inline: var(--gutter); }

section { padding-block: clamp(48px, 8vw, 96px); }
section + section { border-top: 1px solid var(--line); }
section.no-divider + section { border-top: 0; }

/* ------------------------------------------------------------ nav fijo */
.nav-top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
}
.nav-top .brand { font-weight: 800; letter-spacing: -.01em; }
.nav-top .brand .dot { color: var(--rojo); }
.nav-top nav {
  display: flex; gap: .9rem; margin-left: auto;
  overflow-x: auto; scrollbar-width: none;
}
.nav-top nav::-webkit-scrollbar { display: none; }
.nav-top nav a {
  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
}
.nav-top nav a:hover { color: var(--text); }

/* botón modo oscuro */
.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 100;
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast), background var(--t);
}
.theme-toggle:hover { transform: rotate(15deg); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ------------------------------------------------------------ HERO */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: flex-end;
  background: var(--bg-dark);
  color: #F4F1EA;
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 80% at 20% 100%, rgba(178,41,46,.35), transparent 60%),
    radial-gradient(80% 60% at 80% 0%, rgba(184,146,61,.25), transparent 60%),
    linear-gradient(180deg, #06080B 0%, #0E1116 60%, #1A1F26 100%);
}
.hero::after {
  /* textura sutil (henequén feel) */
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg,  rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
  opacity: .6;
}
.hero-inner { padding: 0 var(--gutter) 80px; max-width: 1100px; margin-inline: auto; width: 100%; }
.hero .kicker {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dorado);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(184,146,61,.45);
  margin-bottom: 28px;
}
.hero h1 {
  font-size: clamp(2.6rem, 7vw, var(--fs-3xl));
  color: #FFFFFF;
  max-width: 16ch;
  margin-bottom: .35em;
}
.hero .subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  color: #D8D2C2;
  max-width: 50ch;
  margin-bottom: 1.4em;
  line-height: 1.45;
}
.hero .meta-line {
  display: flex; flex-wrap: wrap; gap: 1.2rem;
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  color: #B8B2A2;
  margin-bottom: 48px;
}
.hero .meta-line span::before { content: "·"; margin-right: .8rem; color: var(--dorado); }
.hero .meta-line span:first-child::before { display: none; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 28px;
}
.hero-stats .stat .n {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  color: #FFFFFF;
  line-height: 1;
  letter-spacing: -.02em;
  display: block;
}
.hero-stats .stat .n .unit { font-size: .5em; color: var(--dorado); margin-left: 4px; }
.hero-stats .stat .lbl {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #9C9583;
  margin-top: 6px;
  display: block;
}
.hero .scroll-cue {
  position: absolute;
  bottom: 18px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #8C8675;
  opacity: .8;
}
.hero .scroll-cue::after {
  content: ""; display: block; width: 1px; height: 32px;
  background: linear-gradient(180deg, currentColor, transparent);
  margin: 8px auto 0;
  animation: scroll-cue 1.8s ease-in-out infinite;
}
@keyframes scroll-cue {
  0%, 100% { transform: scaleY(.4); transform-origin: top; opacity: .3; }
  50%      { transform: scaleY(1);  transform-origin: top; opacity: .9; }
}

/* ------------------------------------------------------------ TL;DR */
.tldr {
  background: var(--bg-elev);
  border-top: 4px solid var(--rojo);
}
.tldr .wrap { max-width: var(--measure); }
.tldr .label {
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--rojo);
  margin-bottom: 14px;
}
.tldr p {
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}

/* ------------------------------------------------------------ pull quote / tesis */
.pull-quote {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
}
.pull-quote blockquote {
  margin: 0;
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(1.4rem, 3.2vw, 2.2rem);
  line-height: 1.35;
  color: var(--text);
  border-left: 4px solid var(--dorado);
  padding: .2em 0 .2em 28px;
}
.pull-quote blockquote::before {
  content: "“";
  font-family: var(--font-body);
  font-size: 4rem;
  line-height: 0;
  color: var(--dorado);
  vertical-align: -0.4em;
  margin-right: 6px;
}
.pull-quote .attribution {
  margin-top: 24px;
  padding-left: 32px;
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  color: var(--text-mute);
}
.pull-quote .attribution strong { color: var(--text); font-weight: 600; }
.tesis-context { max-width: var(--measure); margin: 40px auto 0; padding: 0 var(--gutter); }
.tesis-context p { color: var(--text-soft); }

/* ------------------------------------------------------------ section header */
.sec-head { max-width: var(--measure); margin: 0 auto 36px; padding: 0 var(--gutter); }
.sec-head .eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-xs);
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--rojo);
  font-weight: 700;
  margin-bottom: 10px;
}
.sec-head h2 { margin: 0 0 .3em; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.sec-head .dek {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--text-soft);
  font-size: var(--fs-md);
  max-width: 60ch;
  margin: 0;
}

/* ------------------------------------------------------------ MAPA / GRAFO */
#map-ixil, #network-ixil {
  width: 100%;
  height: 70vh;
  min-height: 480px;
  background: var(--bg-elev);
  border-block: 1px solid var(--line);
}
#network-ixil { background: var(--bg-dark); }

.map-caption, .net-caption {
  max-width: var(--measure-wide);
  margin: 18px auto 0;
  padding: 0 var(--gutter);
  font-size: var(--fs-sm);
  color: var(--text-mute);
  border-left: 3px solid var(--line-strong);
  padding-left: 14px;
}

/* ------------------------------------------------------------ utilities */
.lede { font-size: var(--fs-md); color: var(--text-soft); }
.callout {
  background: var(--dorado-soft);
  border: 1px solid var(--dorado);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0;
  font-size: var(--fs-sm);
}
.callout strong { color: var(--text); }

.muted { color: var(--text-mute); }
.center { text-align: center; }

/* skip link */
.skip {
  position: absolute; left: -9999px;
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: var(--radius);
  font-family: var(--font-display); font-size: var(--fs-sm);
}
.skip:focus { left: 12px; top: 12px; z-index: 200; }

/* loading / empty */
.loading {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  color: var(--text-mute);
  text-align: center;
  padding: 32px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ------------------------------------------------------------ animations */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s ease, transform .7s ease;
}
.fade-in.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .fade-in { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ------------------------------------------------------------ footer */
footer.site-footer {
  background: var(--bg-dark);
  color: #B8B2A2;
  padding: 64px var(--gutter);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  text-align: center;
}
footer.site-footer a { color: var(--dorado); text-decoration-color: rgba(184,146,61,.4); }
footer.site-footer .credits { max-width: 760px; margin: 0 auto; line-height: 1.7; }
footer.site-footer .updated { margin-top: 18px; color: #807A6A; font-size: var(--fs-xs); letter-spacing: .12em; text-transform: uppercase; }

/* ------------------------------------------------------------ responsive tweaks */
@media (max-width: 720px) {
  :root { --fs-base: 1.02rem; }
  .hero { min-height: 84vh; }
  .hero-inner { padding-bottom: 60px; }
  section { padding-block: 56px; }
  .nav-top nav { gap: .6rem; }
}
