/* Las variables de color y tipografía viven en temas.css. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--fuente);
  color: var(--texto);
  background: var(--fondo-img), var(--fondo);
  background-attachment: fixed;
  min-height: 100vh;
  /* columna: el pie queda siempre al fondo de la ventana aunque el contenido sea corto */
  display: flex; flex-direction: column;
}
html { background: var(--fondo); }

header { text-align: center; padding: 28px 16px 8px; }
h1, h2, h3, h4 { font-family: var(--fuente-tit); }
h1 {
  margin: 0; color: var(--texto); font-weight: 600;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  letter-spacing: -0.035em; line-height: 1;
}
.lema { margin: 4px 0 18px; color: var(--tenue); }

nav { display: inline-flex; gap: 6px; padding: 5px; background: var(--panel); border: 1px solid var(--borde); border-radius: 999px; }
nav button {
  border: 0; background: transparent; color: var(--texto); font: inherit;
  padding: 8px 18px; border-radius: 999px; cursor: pointer;
}
nav button.activo { background: var(--acento); color: var(--sobre-acento); font-weight: 600; }

main { margin: 0 auto; padding: 10px 16px; width: 100%; flex: 1 0 auto; }
footer { text-align: center; color: var(--tenue); font-size: 0.8rem; padding: 24px 16px 40px; }
footer p { margin: 0 auto 6px; max-width: 900px; }
footer .autoria { opacity: 0.85; }

/* — Controles — */
.controles {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px;
  font-size: 1.1rem; margin: 10px 0;
}
select, input, .controles button {
  font: inherit; font-size: 0.95rem; color: var(--texto);
  background: var(--campo); border: 1px solid var(--borde); border-radius: 10px; padding: 7px 10px;
}
.controles button { cursor: pointer; }
.sel-tam { display: inline-flex; gap: 6px; align-items: center; }
.st-num { width: 7em; }

.ejemplos { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; }
.ejemplos button, .hasta button {
  font: inherit; font-size: 0.85rem; cursor: pointer; color: var(--texto);
  background: var(--panel); border: 1px solid var(--borde); border-radius: 999px; padding: 6px 12px;
}
.ejemplos button:hover, .hasta button:hover { border-color: var(--acento); }
.hasta button.activo { background: var(--acento2); color: var(--fondo); border-color: transparent; }

/* — Héroe — */
.hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px 36px;
  padding: 24px; margin: 8px auto; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  position: relative;
}
.hero figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 150px; }
.hero figure > :first-child { height: 110px; display: inline-flex; align-items: center; justify-content: center; }
.hero figcaption { text-align: center; font-weight: 600; }
.hero figcaption small { display: block; color: var(--tenue); font-weight: 400; }
.igual { font-size: 2.4rem; color: var(--acento-txt); }
.factor { position: absolute; right: 14px; bottom: 10px; font-size: 0.78rem; color: var(--tenue); }
.regla {
  height: 14px !important; border: 2px solid var(--acento2); border-top: 0; display: inline-block !important;
  font-size: 0.75rem; text-align: center; color: var(--acento2); padding-top: 16px; margin-top: 48px;
}

.frase {
  text-align: center; font-size: clamp(1.1rem, 2.4vw, 1.45rem); line-height: 1.5;
  max-width: 900px; margin: 18px auto;
}
.frase b { color: var(--acento-txt); }

/* — Dibujos — */
.esfera {
  display: inline-block; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 34% 30%,
    color-mix(in srgb, var(--c) 35%, white), var(--c) 48%, color-mix(in srgb, var(--c) 45%, black));
}
.esfera.brillo { filter: drop-shadow(0 0 8px var(--c)); }
.esfera.anillo { position: relative; }
.esfera.anillo::after {
  content: ""; position: absolute; left: -38%; right: -38%; top: 38%; bottom: 38%;
  border: max(1px, 0.06em) solid color-mix(in srgb, var(--c) 70%, white); border-radius: 50%;
  transform: rotate(-16deg); border-width: 2px;
}
.esfera.atomo {
  background: radial-gradient(circle, #ff4d6d 0 3%, rgba(142, 202, 230, 0.55) 4%, rgba(142, 202, 230, 0.12) 66%, transparent 70%);
  outline: 1px dashed rgba(142, 202, 230, 0.6); outline-offset: -2px;
}
.esfera.nebulosa {
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 40%, white) 0, var(--c) 22%,
    color-mix(in srgb, var(--c) 35%, transparent) 50%, transparent 70%);
}
.esfera.galaxia {
  transform: rotate(-20deg) scaleY(0.4);
  background: radial-gradient(circle, #fff 0, var(--c) 16%, color-mix(in srgb, var(--c) 40%, transparent) 45%, transparent 70%);
}
.emo { display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex: none; }

/* — Distancias — */
.dist {
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 18px; margin: 14px 0;
}
.dist h3 { margin: 0 0 10px; }
.hasta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.9rem; color: var(--tenue); margin-bottom: 6px; }
.tira { width: 100%; height: auto; display: block; }
.tira text { fill: var(--texto); font-size: 15px; }
.tira .eje { stroke: var(--linea); stroke-width: 2; }
.tira .guia { stroke: var(--linea); }
.dist ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 7px; }
.dist li { line-height: 1.6; }
.dist li > .esfera, .dist li > .emo { vertical-align: middle; margin-right: 4px; }
.dist small, .nota { color: var(--tenue); font-size: 0.82rem; }
.ana { color: var(--acento2); }

/* — Tarjetas — */
.titulo { margin: 28px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }
.tarjeta {
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px;
  display: flex; flex-direction: column; gap: 3px; transition: transform 0.15s, border-color 0.15s;
}
.tarjeta:hover { transform: translateY(-2px); border-color: var(--acento2); }
.lienzo {
  height: 100px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--hundido); border-radius: calc(var(--radio) * 0.7); margin-bottom: 6px; overflow: hidden;
}
.vs { font-size: 0.7rem; color: var(--tenue); }
.tarjeta h4 { margin: 0; font-size: 0.98rem; }
.tarjeta .esc { font-size: 1.15rem; font-weight: 700; color: var(--acento-txt); }
.tarjeta .ana { font-size: 0.88rem; }
.tarjeta .real { font-size: 0.76rem; color: var(--tenue); }

/* — Mapa — */
.mapa-wrap { display: grid; grid-template-columns: 1fr 330px; gap: 12px; }
#mapa { height: 100%; min-height: 0; border-radius: var(--radio); border: 1px solid var(--borde); }
#m-panel {
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px;
  max-height: 100%; overflow: auto;
}
#m-panel h3 { margin: 0 0 6px; }
#m-panel ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
#m-panel li { border-top: 1px solid var(--borde); padding-top: 8px; font-size: 0.92rem; }
.m-nom { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.leaflet-tooltip.etq {
  background: #0b1430e6; color: #fff; border: 1px solid #ffffff40; border-radius: 8px;
  font-weight: 600; padding: 2px 8px; box-shadow: none;
}
.leaflet-tooltip.etq::before { display: none; }

/* — Zoom continuo — */
.zoom-caja {
  position: relative; height: 68vh; min-height: 380px; border-radius: var(--radio); overflow: hidden;
  border: 1px solid var(--borde); background: var(--v-fondo);
}
#zoom-cv { width: 100%; height: 100%; display: block; touch-action: none; cursor: ns-resize; }
.zoom-cat {
  position: absolute; top: 14px; left: 0; right: 0; text-align: center; pointer-events: none;
  font-size: clamp(1.1rem, 3vw, 1.8rem); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.13);
}
.zoom-hud {
  position: absolute; top: 12px; left: 14px; display: flex; flex-direction: column; gap: 1px;
  background: var(--panel-solido); border: 1px solid var(--borde); border-radius: 12px; padding: 8px 12px;
  font-size: 0.8rem; color: var(--tenue); pointer-events: none; max-width: 260px;
}
.zoom-hud b { font-size: 1.25rem; color: var(--acento-txt); }
.zoom-hud .ana { font-size: 0.85rem; }
.zoom-hud em { color: var(--texto); margin-top: 4px; }
.zoom-info {
  position: absolute; right: 14px; bottom: 14px; width: 250px; background: var(--panel-solido);
  border: 1px solid var(--borde); border-radius: 14px; padding: 12px 14px; font-size: 0.9rem;
}
.zoom-info h4 { margin: 0 0 4px; padding-right: 20px; }
.zoom-info .cerrar {
  position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--tenue); font-size: 1.3rem; cursor: pointer;
}
.zoom-info .ir-comparar {
  margin-top: 8px; width: 100%; font: inherit; font-size: 0.85rem; cursor: pointer;
  background: var(--acento); color: var(--sobre-acento); border: 0; border-radius: 10px; padding: 7px;
}
.zoom-botones { position: absolute; top: 12px; right: 14px; display: flex; flex-direction: column; gap: 6px; }
.zoom-botones button {
  width: 38px; height: 38px; font-size: 1.2rem; cursor: pointer; color: var(--texto);
  background: var(--panel-solido); border: 1px solid var(--borde); border-radius: 10px;
}
.zoom-tip {
  position: absolute; bottom: 8px; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: 90%;
  text-align: center; font-size: 0.82rem; color: var(--tenue); background: var(--panel-solido);
  padding: 5px 12px; border-radius: 999px; pointer-events: none; transition: opacity 0.6s;
}
.zoom-tip.oculto { opacity: 0; }
.zoom-barra { position: relative; padding: 12px 6px 34px; }
#zoom-rango { width: 100%; accent-color: var(--acento); padding: 0; background: none; border: 0; }
.hitos { position: relative; height: 22px; }
.hitos button {
  position: absolute; transform: translateX(-50%); white-space: nowrap; cursor: pointer;
  font: inherit; font-size: 0.72rem; color: var(--tenue); background: none; border: 0; padding: 2px 4px;
}
.hitos button:nth-child(even) { top: 16px; }
.hitos button:first-child { transform: none; }
.hitos button:last-child { transform: translateX(-100%); }
.hitos button:hover { color: var(--acento-txt); }

@media (max-width: 820px) {
  .mapa-wrap { grid-template-columns: 1fr; }
  #mapa { height: 60vh; }
  #m-panel { max-height: none; }
}

/* — Pie: autoría y ventana de fuentes — */
footer a { color: var(--acento-txt); }
.ver-fuentes {
  background: none; border: 0; padding: 0; font: inherit; color: var(--acento-txt);
  text-decoration: underline; cursor: pointer;
}
dialog.fuentes {
  width: min(680px, 92vw); max-height: 85vh; overflow: auto; padding: 22px 26px;
  background: var(--panel-solido); color: var(--texto); border: 1px solid var(--linea);
  border-radius: var(--radio); text-align: left; line-height: 1.45;
}
dialog.fuentes::backdrop { background: rgb(0 0 0 / 0.55); }
dialog.fuentes h2 { margin: 0 0 4px; }
dialog.fuentes h3 { margin: 16px 0 6px; font-size: 1rem; color: var(--acento-txt); }
dialog.fuentes ul { margin: 0; padding-left: 18px; }
dialog.fuentes li { margin: 4px 0; font-size: 0.9rem; }
dialog.fuentes a { color: var(--acento-txt); font-weight: 600; }
.fuentes-cerrar {
  position: sticky; top: 0; float: right; background: var(--campo); color: var(--texto);
  border: 1px solid var(--linea); border-radius: 50%; width: 32px; height: 32px; cursor: pointer;
}
