/* =====================================================================
   Olympo · estilos — "sala de día": luminoso, limpio y didáctico.
   Papel marfil, acento terracota (cerámica griega), oro para detalles
   y header/footer oscuros como contraste editorial.
   ===================================================================== */
:root {
  /* Fondo y superficies */
  --bg: #faf7f1;
  --bg-deep: #f2ecdf;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --line: rgba(122, 92, 40, .22);
  --line-soft: rgba(122, 92, 40, .12);
  /* Texto */
  --ink: #292116;
  --ink-soft: #4f4335;
  --muted: #6f6250; /* ≥4.5:1 sobre --bg y --surface */
  /* Acentos */
  --accent: #b23f1a;          /* terracota: CTAs y estados activos (AA sobre blanco) */
  --accent-bright: #cd4d22;
  --accent-ink: #ffffff;      /* texto sobre el acento */
  --gold: #8f6b14;            /* oro para detalles y versalitas */
  --gold-bright: #a97e1c;
  /* Header y footer (oscuros, contraste editorial) */
  --bar-bg: rgba(20, 17, 26, .96);
  --bar-ink: #efe9dc;
  --bar-ink-soft: #b6ac9c;
  --bar-line: rgba(201, 162, 39, .25);
  /* Tarjetas y modal */
  --badge-bg: rgba(255, 255, 255, .93);
  --badge-ink: #a63c1a;
  --overlay: rgba(20, 17, 26, .38);
  --img-filter: sepia(.08) contrast(1.01);
  /* Métricas */
  --radius: 14px;
  --shadow: 0 16px 36px rgba(80, 60, 30, .14);
  --shadow-soft: 0 6px 18px rgba(80, 60, 30, .10);
  --maxw: 1180px;
  --bg-decor:
    radial-gradient(1100px 500px at 85% -10%, rgba(194, 69, 30, .05), transparent 60%),
    radial-gradient(800px 460px at 0% 100%, rgba(143, 107, 20, .05), transparent 60%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Sora", "Segoe UI", Verdana, sans-serif;
  font-size: 17px;
  color: var(--ink);
  background: var(--bg-decor), linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  line-height: 1.65;
  min-height: 100vh;
  transition: background .25s ease, color .25s ease;
}

h1, h2, h3, .brand-title, .nav-btn, .btn, .chip, .kicker {
  font-family: "Cinzel", Georgia, serif;
  letter-spacing: .4px;
}

a { color: var(--accent); }

::selection { background: rgba(194, 69, 30, .22); }

/* Etiqueta pequeña en versalitas que precede a los títulos */
.kicker {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- Header (oscuro) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px clamp(16px, 4vw, 44px);
  background: var(--bar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bar-line);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-logo {
  display: block;
  width: 42px; height: 42px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35));
  transition: transform .25s ease;
}
.brand:hover .brand-logo { transform: rotate(-8deg); }
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-size: 21px; font-weight: 700; color: var(--bar-ink); line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--bar-ink-soft); letter-spacing: 2.4px; text-transform: uppercase; }

.nav-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-btn {
  position: relative;
  color: var(--bar-ink-soft);
  text-decoration: none;
  padding: 10px 14px;
  font-size: 13.5px;
  transition: color .18s ease;
}
.nav-btn::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 6px;
  height: 2px;
  background: var(--accent-bright);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}
.nav-btn:hover { color: var(--bar-ink); }
.nav-btn.is-active { color: var(--bar-ink); }
.nav-btn.is-active::after, .nav-btn:hover::after { transform: scaleX(1); }
.nav-btn:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; border-radius: 6px; }

/* Botón hamburguesa (solo visible en móvil) */
.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
}
.nav-toggle:hover .nt-bar { background: var(--accent-bright); }
.nav-toggle:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.nt-bar {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--bar-ink);
  transition: transform .22s ease, opacity .18s ease;
}
.site-header.nav-open .nt-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-header.nav-open .nt-bar:nth-child(2) { opacity: 0; }
.site-header.nav-open .nt-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Layout ---------- */
.content { max-width: var(--maxw); margin: 0 auto; padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 44px) 70px; }
.view { display: none; animation: fade .35s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.view-head { margin: 6px 0 26px; max-width: 720px; }
.view-head h2 { margin: 0 0 8px; font-size: clamp(30px, 5vw, 44px); font-weight: 600; color: var(--ink); line-height: 1.1; }
.view-lead { margin: 0; color: var(--ink-soft); font-size: 18px; }

.section-title { margin: 0; font-size: clamp(20px, 3vw, 26px); font-weight: 600; color: var(--ink); }

/* ---------- Hero: la obra a sangre como fondo, con el copy encima ---------- */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: clamp(480px, 74vh, 800px);
  padding: clamp(24px, 5vw, 60px);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #17131d;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 14%;
  filter: sepia(.10) contrast(1.02);
}
/* Velo oscuro degradado: garantiza el contraste del texto sin tapar la obra */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(97deg, rgba(17, 13, 22, .92) 0%, rgba(17, 13, 22, .76) 36%, rgba(17, 13, 22, .30) 64%, rgba(17, 13, 22, .10) 100%),
    linear-gradient(0deg, rgba(17, 13, 22, .38) 0%, transparent 42%);
}
.hero-copy { position: relative; z-index: 1; max-width: 600px; }
.hero .kicker { color: #e5c672; text-shadow: 0 1px 10px rgba(0, 0, 0, .65), 0 0 2px rgba(0, 0, 0, .5); }
.hero-title {
  margin: 0 0 18px;
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 700;
  line-height: 1.05;
  color: #f7f1e4;
  text-shadow: 0 2px 22px rgba(0, 0, 0, .45);
}
.hero-text {
  max-width: 560px;
  margin: 0 0 26px;
  font-size: clamp(17px, 2.2vw, 20px);
  color: rgba(246, 240, 229, .93);
  text-shadow: 0 1px 12px rgba(0, 0, 0, .4);
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-block;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: transform .12s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: var(--accent-ink);
  border-color: transparent;
}
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.06); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 10px 14px; }
.btn-ghost:hover { color: var(--accent); transform: none; }

/* ---------- Lectura del día ---------- */
.daily { margin-top: 40px; }
.daily-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.daily-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr)); gap: 20px; }

/* ---------- Toolbar (búsqueda + filtros) ---------- */
.toolbar { display: flex; flex-direction: column; gap: 14px; margin-bottom: 26px; }
.search {
  width: 100%;
  padding: 13px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: "Sora", sans-serif;
  font-size: 16px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search::placeholder { color: var(--muted); }
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194, 69, 30, .15); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .8px;
  transition: all .16s ease;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }
.chip.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Grid y tarjetas ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 20px; }
.grid-etim { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  padding: 0;
  color: inherit;
  font: inherit;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, border-color .2s ease, box-shadow .22s ease;
}
.card:hover { transform: translateY(-5px); border-color: var(--line); box-shadow: var(--shadow); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* La obra de la tarjeta */
.card-fig { position: relative; margin: 0; aspect-ratio: 3 / 2; overflow: hidden; background: var(--bg-deep); }
.card-fig img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  filter: var(--img-filter);
  transition: transform .35s ease, filter .35s ease;
}
.card:hover .card-fig img { transform: scale(1.045); filter: none; }
.card-fig::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 62%, var(--overlay) 100%);
  pointer-events: none;
}
/* Badge de categoría, estilo etiqueta didáctica */
.card-cat {
  position: absolute;
  left: 10px; top: 10px;
  z-index: 1;
  font-family: "Cinzel", serif;
  font-size: 10.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--badge-ink);
  background: var(--badge-bg);
  border-radius: 999px;
  padding: 4px 11px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  backdrop-filter: blur(4px);
}

.card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.card-title { margin: 0 0 2px; font-family: "Cinzel", serif; font-size: 19px; font-weight: 600; color: var(--ink); }
.card-alt { color: var(--muted); font-size: 14px; font-style: italic; }
.card-desc {
  margin: 10px 0 0; font-size: 15.5px; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* Tarjeta de etimología (lectura del día): solo texto, con filo de acento */
.card-word { border-left: 3px solid var(--accent); }
.card-word .card-body { padding: 20px 18px; }

/* ---------- Diccionario etimológico A-Z ---------- */
.alpha-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 24px; }
.alpha-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: "Cinzel", serif;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s ease;
}
.alpha-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.alpha-btn:disabled { opacity: .28; cursor: default; }
.alpha-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dict-group { margin: 0 0 30px; }
.dict-letter {
  font-family: "Cinzel", serif;
  font-size: 24px; font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 6px;
  margin: 0 0 14px;
  scroll-margin-top: 90px;
}
.dict-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.dict-entry {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface);
  transition: transform .15s ease, border-color .18s ease, box-shadow .2s ease;
}
.dict-entry:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-soft); }
.dict-entry:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dict-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dict-word { font-family: "Cinzel", serif; font-size: 17px; font-weight: 600; color: var(--ink); }
.dict-tag { font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--accent); }
.dict-origin { font-size: 13.5px; font-style: italic; color: var(--muted); margin-top: 1px; }
.dict-teaser {
  margin: 8px 0 0; font-size: 14.5px; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- Árbol genealógico ---------- */
.tree-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tree-btn {
  min-width: 34px; height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: "Cinzel", serif;
  font-size: 15px;
  cursor: pointer;
  transition: all .15s ease;
}
.tree-btn:hover { border-color: var(--accent); color: var(--accent); }
.tree-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tree-btn-pct { font-size: 12.5px; min-width: 56px; }
.tree-btn-text { font-size: 11.5px; letter-spacing: .8px; text-transform: uppercase; }
.tree-sep { width: 1px; height: 22px; background: var(--line-soft); }
.tree-hint { font-size: 12.5px; color: var(--muted); font-style: italic; margin-left: auto; }

.tree-wrap {
  overflow: auto;
  max-height: 72vh;
  padding: 18px 10px 26px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  /* Cielo con nubes atenuado bajo un velo marfil (~20% de imagen visible) */
  background:
    linear-gradient(rgba(250, 247, 241, .8), rgba(250, 247, 241, .8)),
    url("../img/cielo-nubes.jpg") 0 0 / 960px 960px repeat;
  cursor: grab;
  touch-action: pan-x pan-y;
}
.tree-wrap.dragging { cursor: grabbing; user-select: none; }
.tree { transform-origin: top left; transition: transform .15s ease; min-width: max-content; }
.t-title {
  margin: 26px 0 4px;
  font-family: "Cinzel", serif;
  font-size: 15px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold);
  text-align: center;
}
.t-title:first-child { margin-top: 0; }
/* Disposición en brackets: la raíz a la izquierda, cada rama se abre en
   columna hacia la derecha al pulsar su tarjeta (acordeón entre hermanas). */
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul.t-root { display: flex; flex-direction: column; gap: 14px; min-width: max-content; }
.tree .t-li { position: relative; display: flex; align-items: center; padding: 5px 0; }
.tree .t-li > .t-kids { display: none; }
.tree .t-li.open > .t-kids {
  display: flex;
  flex-direction: column;
  position: relative;
  margin-left: 14px;
  padding-left: 24px;
  animation: branch .3s ease;
}
/* Las tarjetas hijas entran en cascada suave */
.tree .t-li.open > .t-kids > .t-li { animation: branch-item .32s ease backwards; }
.tree .t-li.open > .t-kids > .t-li:nth-child(2) { animation-delay: .05s; }
.tree .t-li.open > .t-kids > .t-li:nth-child(3) { animation-delay: .09s; }
.tree .t-li.open > .t-kids > .t-li:nth-child(4) { animation-delay: .13s; }
.tree .t-li.open > .t-kids > .t-li:nth-child(5) { animation-delay: .16s; }
.tree .t-li.open > .t-kids > .t-li:nth-child(6) { animation-delay: .19s; }
.tree .t-li.open > .t-kids > .t-li:nth-child(7) { animation-delay: .22s; }
.tree .t-li.open > .t-kids > .t-li:nth-child(8) { animation-delay: .24s; }
.tree .t-li.open > .t-kids > .t-li:nth-child(n+9) { animation-delay: .26s; }
@keyframes branch { from { opacity: 0; } to { opacity: 1; } }
@keyframes branch-item {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}
/* filete horizontal desde la tarjeta madre hasta el eje de sus hijos */
.tree .t-li.open > .t-kids::before {
  content: ""; position: absolute; left: -14px; top: 50%; width: 14px; height: 1px; background: var(--line);
}
/* filete horizontal desde el eje hasta cada tarjeta hija */
.tree .t-kids > .t-li::before {
  content: ""; position: absolute; left: -24px; top: 50%; width: 24px; height: 1px; background: var(--line);
}
/* eje vertical del bracket (recortado en la primera y la última) */
.tree .t-kids > .t-li::after {
  content: ""; position: absolute; left: -24px; top: 0; bottom: 0; width: 1px; background: var(--line);
}
.tree .t-kids > .t-li:first-child::after { top: 50%; }
.tree .t-kids > .t-li:last-child::after { bottom: 50%; }
.tree .t-kids > .t-li:only-child::after { display: none; }

.t-node {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: var(--shadow-soft);
  padding: 7px 11px;
  min-width: 150px; max-width: 250px;
  text-align: left;
  transition: border-color .18s ease, box-shadow .2s ease;
}
.t-node.has-kids { cursor: pointer; }
.t-node.has-kids:hover { border-color: var(--accent); box-shadow: var(--shadow); }
/* Código de color por categoría (filo izquierdo del nodo) */
.t-node[data-cat="Primordiales"] { border-left-color: #6d5f9e; }
.t-node[data-cat="Titanes"] { border-left-color: #a0784a; }
.t-node[data-cat="Olímpicos"] { border-left-color: #c9a227; }
.t-node[data-cat="Menores"] { border-left-color: #5e8d87; }
.t-node[data-cat="Héroes"] { border-left-color: var(--accent); }
.t-node[data-cat="Mortales"] { border-left-color: #8b8b8b; }
.t-node[data-cat="Criaturas"] { border-left-color: #7d4a4a; }
.t-info { display: flex; flex-direction: column; min-width: 0; }
.t-img {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 20%;
  border: 1px solid var(--line);
  filter: var(--img-filter);
}
.t-names { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.t-mar { color: var(--muted); font-size: 12px; }
.t-name { font-family: "Cinzel", serif; font-size: 13.5px; font-weight: 600; color: var(--ink); text-decoration: none; }
a.t-name:hover { color: var(--accent); }
a.t-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.t-ext { color: var(--muted); font-weight: 500; }
.t-nota { font-size: 11px; line-height: 1.35; color: var(--muted); font-style: italic; margin-top: 1px; }
.t-toggle {
  margin-left: auto;
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  font-size: 11px; line-height: 1;
  cursor: pointer;
  transition: transform .2s ease, border-color .15s ease;
}
.t-li.open > .t-node .t-toggle { transform: rotate(90deg); border-color: var(--accent); }
.t-toggle:hover { border-color: var(--accent); }
.t-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tree-note { margin-top: 14px; font-size: 13.5px; color: var(--muted); font-style: italic; max-width: 720px; }

/* ---------- Atlas mitológico ---------- */
.map-wrap {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #e9f0f2, #dfe9ec);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
#mapContainer { height: min(62vh, 560px); height: min(62dvh, 560px); min-height: 340px; }
.map-loading { text-align: center; color: var(--muted); font-style: italic; padding: 120px 20px; margin: 0; }
.map-detail {
  margin-top: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px 20px;
}
.map-detail-hint { margin: 0; color: var(--muted); font-style: italic; }
.map-detail-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.map-detail-head h3 { margin: 0; font-family: "Cinzel", serif; font-size: 20px; font-weight: 600; color: var(--ink); }
.map-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; align-self: center; }
.map-hoy { font-size: 13.5px; font-style: italic; color: var(--muted); }
.map-etapa {
  font-family: "Cinzel", serif;
  font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 3px 10px;
  align-self: center;
}
.map-detail > p { margin: 0 0 4px; color: var(--ink-soft); font-size: 16px; }

/* ---------- El proyecto ---------- */
.about { max-width: 780px; }
.about > p { font-size: 17.5px; color: var(--ink-soft); margin: 0 0 16px; }
.about strong { color: var(--ink); }
.about-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 16px;
  margin: 28px 0;
}
.about-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 18px;
}
.about-card h3 { margin: 0 0 8px; font-family: "Cinzel", serif; font-size: 16px; font-weight: 600; color: var(--accent); }
.about-card p { margin: 0; font-size: 15px; color: var(--ink-soft); }

/* Formulario de aportaciones */
.contrib { margin-top: 48px; padding-top: 36px; border-top: 1px solid var(--line-soft); }
.contrib-title { margin: 0 0 10px; font-family: "Cinzel", serif; font-size: 26px; font-weight: 600; color: var(--ink); }
.contrib-lead { margin: 0 0 22px; font-size: 16.5px; color: var(--ink-soft); }
.contrib-form { display: grid; gap: 16px; }
.contrib-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.contrib-field { display: grid; gap: 6px; }
.contrib-label { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.contrib-label em { font-style: normal; text-transform: none; letter-spacing: .2px; }
.contrib-form input,
.contrib-form select,
.contrib-form textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: "Sora", sans-serif;
  font-size: 16px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.contrib-form input::placeholder,
.contrib-form textarea::placeholder { color: var(--muted); }
.contrib-form input:focus,
.contrib-form select:focus,
.contrib-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194, 69, 30, .15); }
.contrib-form textarea { resize: vertical; min-height: 140px; }
.contrib-honey { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.contrib-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.contrib-actions .btn[disabled] { opacity: .6; cursor: wait; transform: none; }
.contrib-status { margin: 0; font-size: 15.5px; color: var(--muted); }
.contrib-status.is-ok { color: var(--accent); }
.contrib-status.is-error { color: #a02c1c; }

.empty { text-align: center; color: var(--muted); padding: 48px 0; font-style: italic; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: clamp(10px, 3vw, 24px); }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(24, 18, 10, .55); backdrop-filter: blur(6px); }
.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: 90vh;
  max-height: 90dvh; /* tiene en cuenta la barra dinámica de los navegadores móviles */
  overflow-y: auto;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(30, 20, 5, .35);
  animation: pop .28s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(12px); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 12px; right: 12px;
  z-index: 5;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--bar-line);
  background: rgba(20, 17, 26, .6);
  color: #efe9dc;
  font-size: 22px; line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.modal-close:hover { border-color: var(--accent-bright); color: var(--accent-bright); }
.modal-close:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* Cabecera de la ficha: la obra entera sobre un fondo difuminado de sí misma */
.m-hero {
  position: relative;
  margin: 0;
  /* width fijo: si solo actuara aspect-ratio, el max-height recalcularía
     el ancho y la cabecera dejaría un hueco a la derecha en escritorio */
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 380px;
  overflow: hidden;
  background: var(--bg-deep);
}
.m-hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: blur(22px) saturate(.85) brightness(.82);
  transform: scale(1.15); /* oculta el halo claro que deja el blur en los bordes */
}
.m-hero .m-hero-img {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  object-fit: contain;
  filter: var(--img-filter) drop-shadow(0 10px 24px rgba(0, 0, 0, .35));
}
.m-hero::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, transparent 68%, rgba(20, 17, 26, .42) 100%);
  pointer-events: none;
}
.m-hero-caption {
  position: absolute; right: 14px; bottom: 10px; z-index: 3;
  font-size: 11.5px; color: rgba(255, 255, 255, .85); font-style: italic;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}
@media (max-width: 520px) {
  .m-hero { aspect-ratio: 4 / 3; max-height: 320px; }
}

.m-content { padding: 20px clamp(20px, 4vw, 38px) 34px; }
.m-content.m-noimg { padding-top: 46px; }
.m-title { margin: 4px 0 2px; font-family: "Cinzel", serif; font-size: clamp(26px, 4vw, 34px); font-weight: 600; color: var(--ink); line-height: 1.15; }
.m-alt { color: var(--muted); font-style: italic; margin: 0 0 8px; font-size: 16px; }
.m-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.m-cat {
  display: inline-block;
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
}
.m-time { font-size: 13px; color: var(--muted); font-style: italic; }
.m-section { margin: 18px 0 0; }
.m-section h4 {
  margin: 0 0 6px; font-family: "Cinzel", serif; font-size: 12px;
  text-transform: uppercase; letter-spacing: 2px; color: var(--gold);
}
.m-section p { margin: 0 0 10px; color: var(--ink-soft); font-size: 16.5px; }
.m-section p:last-child { margin-bottom: 0; }
.m-symbols { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.m-symbols span {
  font-size: 13.5px; color: var(--ink-soft);
  border: 1px solid var(--line-soft); border-radius: 999px; padding: 4px 13px;
}

/* Chips navegables entre entidades */
.m-rels { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.rel-chip {
  cursor: pointer;
  font-family: "Sora", sans-serif;
  font-size: 14px;
  color: var(--ink);
  border: 1px solid var(--line-soft);
  background: rgba(194, 69, 30, .05);
  border-radius: 999px;
  padding: 5px 14px;
  transition: all .15s ease;
}
.rel-chip:hover { border-color: var(--accent); background: rgba(194, 69, 30, .12); transform: translateY(-1px); color: var(--accent); }
.rel-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.m-quote {
  margin-top: 22px; padding: 14px 18px;
  border-left: 2px solid var(--accent);
  background: rgba(194, 69, 30, .06);
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: var(--ink-soft);
}
.m-sources { margin-top: 14px; font-size: 13.5px; color: var(--muted); font-style: italic; }

/* ---------- Footer (oscuro en ambos temas) ---------- */
.site-footer {
  border-top: 1px solid var(--bar-line);
  padding: 30px clamp(16px, 4vw, 44px) 30px;
  text-align: center;
  color: var(--bar-ink-soft);
  font-size: 14.5px;
  background: var(--bar-bg);
}
.site-footer p { max-width: 760px; margin: 0 auto 8px; }
.site-footer strong { color: var(--bar-ink); }
.footer-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(201, 162, 39, .14);
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--bar-ink);
  font-family: "Cinzel", serif;
  font-size: 19px;
  font-weight: 700;
}
.footer-brand img { display: block; }
.footer-copy { margin-top: 14px; font-size: 13px; color: var(--bar-ink-soft); opacity: .85; }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .toolbar { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .toolbar .search { flex: 1 1 260px; }
}
/* Móvil: menú a pantalla completa — marca y cierre arriba, enlaces
   grandes con flecha y separador, y "El proyecto" como botón al pie. */
@media (max-width: 640px) {
  .site-header { padding: 10px 16px; flex-wrap: nowrap; }
  .nav-toggle { display: inline-flex; flex: 0 0 auto; }
  .nav-wrap { flex: 0; min-width: 0; }
  /* Con el menú abierto el header pierde el blur: con backdrop-filter
     activo sería el contenedor del overlay fijo y no llenaría la pantalla. */
  .site-header.nav-open { background: #14111a; backdrop-filter: none; }
  .site-header.nav-open .brand,
  .site-header.nav-open .nav-toggle { position: relative; z-index: 2; }
  body.nav-locked { overflow: hidden; }
  .main-nav {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: none;
    flex-direction: column;
    padding: 84px 20px calc(22px + env(safe-area-inset-bottom));
    background: #14111a;
    overflow-y: auto;
  }
  .site-header.nav-open .main-nav { display: flex; animation: navdrop .22s ease; }
  @keyframes navdrop {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
  }
  .main-nav .nav-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 2px;
    font-family: "Cinzel", serif;
    font-size: 20px;
    color: var(--bar-ink);
    border-bottom: 1px solid var(--bar-line);
  }
  /* Sin el subrayado de escritorio dentro del overlay */
  .main-nav .nav-btn::after { content: none; }
  .main-nav .nav-btn.is-active { color: var(--accent-bright); }
  /* "El proyecto" habla del site, no del contenido: separado al pie,
     con un realce discreto (borde fino, sin relleno) */
  .main-nav .nav-btn-project {
    margin-top: auto;
    justify-content: center;
    border: 1px solid var(--bar-line);
    border-radius: 999px;
    color: var(--bar-ink);
    font-size: 13.5px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    padding: 13px 18px;
  }
  /* Hero en móvil: el copy baja al pie, sobre el velo más oscuro */
  .hero { align-items: flex-end; min-height: clamp(480px, 72vh, 640px); min-height: clamp(480px, 72dvh, 640px); padding: 22px 20px 28px; }
  .hero-bg { object-position: 50% 8%; }
  .hero::after {
    background:
      linear-gradient(0deg, rgba(17, 13, 22, .95) 0%, rgba(17, 13, 22, .88) 42%, rgba(17, 13, 22, .62) 68%, rgba(17, 13, 22, .28) 88%, rgba(17, 13, 22, .30) 100%);
  }
}
@media (max-width: 520px) {
  .brand-sub { display: none; }
  .brand-logo { width: 36px; height: 36px; }
  .nav-btn { padding: 8px 10px; font-size: 12.5px; }
  /* Árbol: nodos e indentación más compactos para que quepan más niveles */
  .t-node { min-width: 132px; max-width: 200px; padding: 6px 9px; gap: 7px; }
  .t-img { width: 30px; height: 30px; flex: 0 0 30px; }
  .t-name { font-size: 12.5px; }
  .tree .t-li.open > .t-kids { margin-left: 10px; padding-left: 18px; }
  .tree .t-li.open > .t-kids::before { left: -10px; width: 10px; }
  .tree .t-kids > .t-li::before { left: -18px; width: 18px; }
  .tree .t-kids > .t-li::after { left: -18px; }
  .tree-hint { flex-basis: 100%; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
