/* Invirtiesos v4 · estilos del sitio (fase 3). Paleta y tipo según prompt-web-v4. */

:root {
  --fondo: #07070C;
  --texto: #F4F4F7;
  --texto-secundario: #A8A8B8;
  --texto-nav: #A4A4B3;
  --texto-apoyo: #9393A0;
  --lima: #C6F445;
  --lima-boton-inicio: #D0F85A;
  --lima-boton-fin: #C6F445;
  --borde: rgba(255, 255, 255, 0.1);
  --superficie-inicio: rgba(255, 255, 255, 0.07);
  --superficie-fin: rgba(255, 255, 255, 0.025);
  --resplandor-lima: rgba(198, 244, 69, 0.22);
  --resplandor-verde: rgba(28, 70, 48, 0.40);
  --radio: 16px;
  --radio-boton: 14px;
  --ancho: 1120px;
  --gutter: clamp(1.1rem, 4vw, 3rem);
  --fuente: "Inter", system-ui, sans-serif;
  --fuente-titulo: "Inter Tight", "Inter", system-ui, sans-serif;
  --foco: 0 0 0 2px var(--fondo), 0 0 0 4px var(--lima);
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter.woff2") format("woff2");
  font-weight: 400 650;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter Tight";
  src: url("../fonts/InterTight-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

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

html {
  color-scheme: dark;
  background: var(--fondo);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  position: relative;
  font-family: var(--fuente);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Resplandores ambientales: lima arriba a la derecha, verde abajo a la izquierda. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 48% at 85% 6%, var(--resplandor-lima), transparent 62%),
    radial-gradient(ellipse 50% 45% at 6% 94%, var(--resplandor-verde), transparent 64%);
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--lima);
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(198, 244, 69, 0.6);
  text-underline-offset: 0.18em;
  transition: color 0.15s ease, text-decoration-color 0.2s ease, text-decoration-thickness 0.2s ease, text-underline-offset 0.2s ease;
}

a:hover {
  color: var(--lima-boton-inicio);
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.24em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--foco);
  border-radius: 4px;
}

.saltar {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--lima);
  color: var(--fondo);
  padding: 0.6rem 1rem;
  z-index: 20;
  font-weight: 600;
}

.saltar:focus,
.saltar:focus-visible {
  left: var(--gutter);
  top: 0.6rem;
  z-index: 30;
  box-shadow: var(--foco);
}

.solo-lector {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.envoltorio {
  width: min(var(--ancho), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ——— Cabecera ——— */
/* La barra reserva siempre la misma altura (5,2 rem): compactarse no mueve el contenido (sin CLS). */
.barra {
  position: relative;
  z-index: 15;
  height: 5.2rem;
}

.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
  padding: 1.35rem 0 1.1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 44px;
  text-decoration: none;
  color: var(--texto);
  border-radius: 6px;
}

.logo img {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.logo-nombre {
  font-family: var(--fuente-titulo);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  color: var(--texto);
}

.logo:hover,
.logo:hover .logo-nombre {
  color: var(--texto);
  text-decoration: none;
}

.nav-principal {
  display: flex;
  align-items: center;
  gap: 1.85rem;
}

.nav-principal a {
  color: var(--texto-nav);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.nav-principal a:hover,
.nav-principal a[aria-current="page"] {
  color: var(--texto);
}

.nav-movil {
  display: none;
  position: relative;
}

.nav-movil > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  color: var(--texto-nav);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--superficie-inicio), var(--superficie-fin));
}

.nav-movil > summary::-webkit-details-marker {
  display: none;
}

.nav-movil[open] > summary {
  color: var(--texto);
}

.nav-movil .nav-principal {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-width: 12.5rem;
  padding: 0.45rem;
  border: 1px solid var(--borde);
  border-radius: 12px;
  background: #101014;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--borde);
  z-index: 10;
}

.nav-movil .nav-principal a {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
}

.nav-movil .nav-principal a:hover {
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 720px) {
  .cabecera .nav-escritorio {
    display: none;
  }

  .nav-movil {
    display: block;
  }

  .logo img {
    width: 36px;
    height: 36px;
  }

  .logo-nombre {
    font-size: 1.3125rem;
  }
}

/* ——— Portada: hero ——— */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding: clamp(2.4rem, 7vh, 5.5rem) 0 clamp(3rem, 8vh, 6rem);
}

.hero h1 {
  margin: 0 0 1.15rem;
  font-family: var(--fuente);
  font-weight: 650;
  font-size: clamp(2.15rem, 1.2rem + 4.2vw, 3.55rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--texto);
}

.hero h1 .linea {
  display: inline;
}

@media (min-width: 861px) {
  .hero h1 .linea {
    display: block;
  }
}

.hero .entradilla {
  margin: 0 0 1.85rem;
  color: var(--texto-secundario);
  font-size: clamp(1.02rem, 0.95rem + 0.4vw, 1.15rem);
  line-height: 1.55;
  max-width: 36ch;
}

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.15rem;
  padding: 0.8rem 1.45rem;
  border: 0;
  border-radius: var(--radio-boton);
  background: linear-gradient(180deg, var(--lima-boton-inicio), var(--lima-boton-fin));
  color: var(--fondo);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(198, 244, 69, 0.28), 0 6px 22px rgba(198, 244, 69, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.2s ease;
}

.boton:hover {
  color: var(--fondo);
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(198, 244, 69, 0.5), 0 10px 30px rgba(198, 244, 69, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.boton:active {
  filter: brightness(0.94);
  transform: translateY(1px) scale(0.985);
  box-shadow: 0 0 0 1px rgba(198, 244, 69, 0.4), 0 2px 10px rgba(198, 244, 69, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tarjeta {
  background: linear-gradient(180deg, var(--superficie-inicio), var(--superficie-fin));
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: 0 0 48px rgba(198, 244, 69, 0.045);
}

.tarjeta-grafica {
  padding: 1.25rem 1.25rem 1.05rem;
  min-width: 0;
}

.tarjeta-grafica .cabecera-grafica {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.tarjeta-grafica .etiqueta {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--texto-secundario);
  letter-spacing: -0.01em;
}

.tarjeta-grafica .supuesto {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--texto-apoyo);
}

.etiqueta-hipotetico {
  display: inline-block;
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--texto-secundario);
}

.cifra-hero {
  margin: 0;
  font-size: clamp(1.45rem, 1.05rem + 1.5vw, 2.05rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--lima);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
}

.grafica-hero {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.grafica-hero .rejilla {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.grafica-hero .area {
  fill: url(#degradado-hero);
}

.grafica-hero .curva {
  fill: none;
  stroke: var(--lima);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(198, 244, 69, 0.45));
}

.grafica-hero .punto {
  fill: var(--fondo);
  stroke: var(--lima);
  stroke-width: 2.6;
}

.ejes-hero {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin: 0.35rem 0 0;
  padding: 0 0.15rem;
  font-size: 0.75rem;
  color: var(--texto-apoyo);
}

.ejes-hero span:nth-child(2) {
  text-align: center;
}

.ejes-hero span:nth-child(3) {
  text-align: right;
}

/* ——— Bloques de portada ——— */
.seccion {
  padding: 0 0 4.5rem;
}

.seccion h2 {
  margin: 0 0 0.5rem;
  font-family: var(--fuente);
  font-weight: 600;
  font-size: clamp(1.35rem, 1rem + 1.4vw, 1.75rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.seccion .apoyo {
  margin: 0 0 1.6rem;
  color: var(--texto-secundario);
  max-width: 42rem;
}

.rejilla-dos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.tarjeta-nivel {
  padding: 1.35rem 1.4rem 1.45rem;
  min-width: 0;
}

.tarjeta-nivel h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tarjeta-nivel p {
  margin: 0;
  color: var(--texto-secundario);
  font-size: 0.98rem;
}

.tarjeta-nivel .enlace-nivel {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 0.95rem;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

.tarjeta-nivel .enlace-nivel:hover {
  text-decoration: underline;
}

.insignia {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--borde);
  color: var(--texto-apoyo);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ——— Páginas interiores ——— */
.miga {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.4rem 0 0;
  font-size: 0.875rem;
  color: var(--texto-apoyo);
}

.miga a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--texto-apoyo);
  text-decoration: none;
}

.miga a:hover {
  color: var(--texto);
}

.miga span[aria-current="page"] {
  color: var(--texto-secundario);
}

.ceja {
  display: block;
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lima);
}

.titulo-interior {
  margin: 0 0 1rem;
  font-family: var(--fuente-titulo);
  font-weight: 600;
  font-size: clamp(2rem, 1.2rem + 3.4vw, 3.15rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.concepto {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  column-gap: clamp(1.8rem, 4vw, 3.5rem);
  row-gap: 1.6rem;
  align-items: start;
  padding: clamp(2rem, 5vh, 3.4rem) 0 4.5rem;
}

.concepto:not(.concepto-solo) {
  grid-template-rows: auto auto;
}

.concepto:not(.concepto-solo) .cuerpo {
  grid-column: 1;
  grid-row: 1;
}

.concepto:not(.concepto-solo) .cierre {
  grid-column: 1;
  grid-row: 2;
}

.concepto .cierre {
  min-width: 0;
}

.concepto .cierre > * + * {
  margin-top: 1.6rem;
}

.concepto .lead,
.intro-pagina {
  margin: 0 0 1.4rem;
  color: var(--texto-secundario);
  font-size: 1.12rem;
  line-height: 1.55;
  max-width: 38rem;
}

.concepto .cuerpo > * + * {
  margin-top: 1rem;
}

.tarjeta-ejemplo,
.tarjeta-cita,
.tarjeta-opinion,
.detalle-error,
.aviso-legal-bloque,
.aviso-campo {
  padding: 1.05rem 1.15rem;
}

.tarjeta-ejemplo h2,
.detalle-error summary,
.tarjeta-comparativa h2 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.tarjeta-ejemplo p,
.detalle-error p,
.tarjeta-comparativa p {
  margin: 0;
  color: var(--texto-secundario);
  font-size: 0.98rem;
}

.tarjeta-ejemplo .cifra {
  margin: 0.7rem 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--lima);
  font-variant-numeric: tabular-nums;
}

.lista-silenciosa {
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--texto-secundario);
  font-size: 0.95rem;
}

.lista-silenciosa li {
  padding: 0.28rem 0;
}

.lista-silenciosa strong {
  color: var(--texto);
  font-weight: 600;
}

.detalle-error summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
}

.detalle-error summary::-webkit-details-marker {
  display: none;
}

.detalle-error summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--texto-secundario);
  border-bottom: 1.5px solid var(--texto-secundario);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}

.detalle-error[open] summary::after {
  transform: rotate(225deg);
  translate: 0 0.15rem;
}

.detalle-error .contenido-error {
  margin-top: 0.55rem;
}

.tarjeta-opinion {
  border-left: 3px solid var(--lima);
}

.tarjeta-opinion .etiqueta-opinion {
  margin: 0 0 0.55rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lima);
}

.tarjeta-opinion p {
  margin: 0;
  color: var(--texto-secundario);
  font-size: 0.98rem;
}

.recorrido {
  margin-top: 1.6rem;
  padding: 1.05rem 1.15rem;
}

.recorrido h2 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.recorrido ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: paso;
}

.recorrido li {
  counter-increment: paso;
  color: var(--texto-apoyo);
  font-size: 0.92rem;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  min-height: 44px;
}

.recorrido a {
  display: inline-flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  min-height: 44px;
}

.recorrido li::before {
  content: counter(paso);
  color: var(--texto-apoyo);
  font-variant-numeric: tabular-nums;
  min-width: 1rem;
}

.recorrido li[aria-current="page"] {
  color: var(--texto);
}

.recorrido li[aria-current="page"]::before {
  color: var(--lima);
}

.visual-concepto {
  padding: 1.15rem 1.15rem 1rem;
  position: sticky;
  top: 1.2rem;
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: start;
}

.visual-concepto .enlace-visual {
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
}

.visual-concepto .enlace-visual a {
  color: var(--lima);
  text-decoration: none;
}

.visual-concepto .enlace-visual a:hover {
  text-decoration: underline;
}

.visual-concepto h2 {
  margin: 0 0 0.2rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--texto-secundario);
}

.visual-concepto .supuesto {
  margin: 0 0 0.9rem;
  font-size: 0.8rem;
  color: var(--texto-apoyo);
}

.leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.2rem;
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  color: var(--texto-apoyo);
}

.leyenda i {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.4rem;
  vertical-align: -0.05rem;
}

.leyenda .muestra-aportado {
  background: #6e7280;
}

.leyenda .muestra-intereses {
  background: var(--lima);
}

.leyenda .muestra-simple {
  background: #6e7280;
}

.pie-visual {
  margin: 0.7rem 0 0;
  font-size: 0.75rem;
  color: var(--texto-apoyo);
}

/* ——— Calculadora ——— */
.calculadora {
  padding: clamp(2rem, 5vh, 3.4rem) 0 4.5rem;
}

.rejilla-calculadora {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 1.15rem;
  margin: 1.5rem 0 1.25rem;
  align-items: start;
}

.formulario {
  padding: 1.2rem 1.2rem 1.3rem;
}

.campos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 0.85rem;
}

.campo {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.campo-ancho {
  grid-column: 1 / -1;
}

.campo label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--texto-secundario);
}

.campo input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--texto);
  font-family: inherit;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.campo input::placeholder {
  color: #6d6d7a;
}

.campo input:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.ayuda {
  margin: 0;
  font-size: 0.78rem;
  color: var(--texto-apoyo);
}

.aviso-campo {
  margin-top: 0.85rem;
  color: var(--texto);
  font-size: 0.9rem;
  border-color: rgba(198, 244, 69, 0.28);
}

.aviso-campo[hidden],
.estado-vacio[hidden],
#resultados[hidden] {
  display: none;
}

.acciones {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.boton-secundario {
  background: transparent;
  color: var(--texto-secundario);
  box-shadow: none;
  border: 1px solid var(--borde);
}

.boton-secundario:hover {
  color: var(--texto);
  filter: none;
  background: rgba(255, 255, 255, 0.04);
}

.resultados {
  padding: 1.2rem 1.2rem 1.3rem;
  min-width: 0;
}

.resultados h2 {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.estado-vacio {
  margin: 0;
  color: var(--texto-secundario);
}

.rejilla-metricas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.metrica dt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--texto-apoyo);
}

.metrica dd {
  margin: 0.2rem 0 0;
  font-size: 1.28rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--texto);
  word-break: break-word;
}

.metrica.principal dd {
  color: var(--lima);
  font-size: 1.55rem;
}

.bloque-grafica,
.bloque-tabla {
  margin-top: 1.15rem;
  padding: 1.2rem 1.2rem 1.15rem;
  min-width: 0;
}

.bloque-grafica h2,
.bloque-tabla h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.bloque-grafica .apoyo,
.bloque-tabla .apoyo {
  margin: 0 0 0.9rem;
  font-size: 0.88rem;
}

.reserva-vacia {
  margin: 0;
  font-size: 0.92rem;
  color: var(--texto-apoyo);
}

.reserva-vacia[hidden],
.ayuda-tabla[hidden],
.tabla-desplazable[hidden] {
  display: none;
}

.grafica-calculadora {
  display: block;
  width: 100%;
  height: auto;
}

.grafica-calculadora .rejilla {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.grafica-calculadora .area-aportado {
  fill: rgba(164, 164, 179, 0.28);
}

.grafica-calculadora .area-intereses {
  fill: url(#degradado-intereses);
}

.grafica-calculadora .linea-total {
  fill: none;
  stroke: var(--lima);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grafica-calculadora .eje-texto {
  fill: var(--texto-apoyo);
  font-size: 11px;
  font-family: var(--fuente);
}

.aviso-legal-bloque {
  margin-top: 1.15rem;
  color: var(--texto-secundario);
  font-size: 0.92rem;
}

/* Tabla → tarjetas en móvil */
.tabla-reserva {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.tabla-reserva caption {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 0.88rem;
  color: var(--texto-apoyo);
  margin-bottom: 0.7rem;
}

.tabla-reserva th,
.tabla-reserva td {
  padding: 0.55rem 0.4rem;
  text-align: right;
  border-bottom: 1px solid var(--borde);
}

.tabla-reserva th:first-child,
.tabla-reserva td:first-child {
  text-align: left;
}

.tabla-reserva th {
  font-weight: 500;
  color: var(--texto-apoyo);
  font-size: 0.8rem;
}

.tabla-reserva tbody tr:last-child td {
  border-bottom: 0;
  font-weight: 600;
}

@media (max-width: 640px) {
  .tabla-reserva thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .tabla-reserva,
  .tabla-reserva tbody,
  .tabla-reserva tr,
  .tabla-reserva td {
    display: block;
    width: 100%;
  }

  .tabla-reserva tr {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--borde);
  }

  .tabla-reserva tbody tr:last-child {
    border-bottom: 0;
  }

  .tabla-reserva td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    text-align: right;
    border: 0;
    padding: 0.2rem 0;
  }

  .tabla-reserva td::before {
    content: attr(data-etiqueta);
    color: var(--texto-apoyo);
    text-align: left;
    font-weight: 500;
  }

  .tabla-reserva td:first-child {
    font-weight: 600;
    color: var(--texto);
    margin-bottom: 0.2rem;
  }
}

/* ——— Pie ——— */
.pie {
  padding: 2rem 0 2.4rem;
  border-top: 1px solid var(--borde);
  color: var(--texto-apoyo);
  font-size: 0.84rem;
}

.pie-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
}

.pie a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--texto-apoyo);
  text-decoration: none;
}

.pie a:hover {
  color: var(--texto);
}

.pie .aviso {
  margin: 0.85rem 0 0;
  max-width: 46rem;
  line-height: 1.5;
}

.pagina-breve {
  padding: clamp(2rem, 5vh, 3.4rem) 0 4.5rem;
}

.pagina-breve > * {
  max-width: 40rem;
}

.pagina-breve p {
  color: var(--texto-secundario);
}

.figura-sobre {
  margin: 1.15rem 0 0;
}

.figura-sobre img {
  max-width: 360px;
  margin-inline: auto;
}

.figura-sobre figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--texto-secundario);
  text-align: center;
}

.figura-sobre img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radio);
}

/* ——— Adaptación estrecha ——— */
@media (max-width: 40rem) {
  .figura-sobre img { max-width: 100%; }
}

@media (max-width: 860px) {
  .hero,
  .concepto,
  .rejilla-calculadora,
  .rejilla-dos {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 1.6rem;
    padding-bottom: 3rem;
  }

  .hero h1 {
    max-width: none;
  }

  .hero .entradilla {
    max-width: 34ch;
  }

  .concepto:not(.concepto-solo) .cuerpo,
  .concepto:not(.concepto-solo) .cierre,
  .visual-concepto {
    grid-column: auto;
    grid-row: auto;
  }

  .visual-concepto {
    position: static;
    align-self: auto;
  }

  .cifra-hero {
    font-size: 1.7rem;
  }
}

@media (max-width: 520px) {
  .campos,
  .rejilla-metricas {
    grid-template-columns: 1fr;
  }

  .metrica.principal {
    grid-column: auto;
  }

  .cabecera-grafica {
    flex-direction: column;
  }

  .cifra-hero {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .grafica-hero .curva {
    filter: none;
  }

  .boton {
    transition: none;
  }

  .boton:hover,
  .boton:active {
    transform: none;
  }
}


/* Tabla anual de la calculadora: en móvil, bloque de altura fija y desplazamiento. */
.tabla-desplazable {
  min-width: 0;
}

@media (max-width: 640px) {
  .tabla-desplazable {
    max-height: 28rem;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--borde);
    border-radius: 12px;
    padding: 0.35rem 0.85rem 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .tabla-desplazable:focus,
  .tabla-desplazable:focus-visible {
    outline: none;
    box-shadow: var(--foco);
  }

  .ayuda-tabla {
    margin: 0 0 0.7rem;
    font-size: 0.8rem;
    color: var(--texto-apoyo);
  }
}

@media (min-width: 641px) {
  .ayuda-tabla {
    /* En escritorio la tabla cabe en la página; el aviso de desplazamiento no hace falta. */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

/* Recorrido del nivel Desde cero */
.lista-conceptos {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 3rem;
}

@media (min-width: 800px) {
  .lista-conceptos {
    grid-template-columns: 1fr 1fr;
  }
}

.tarjeta-concepto {
  display: block;
  padding: 1.15rem 1.25rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.tarjeta-concepto:hover {
  color: inherit;
}

.tarjeta-concepto .orden {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lima);
}

.tarjeta-concepto h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tarjeta-concepto p {
  margin: 0;
  color: var(--texto-secundario);
  font-size: 0.98rem;
}

.fuentes {
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--borde);
  font-size: 0.84rem;
  color: var(--texto-apoyo);
}

.fuentes h2 {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--texto-secundario);
}

.fuentes ul {
  margin: 0;
  padding-left: 1.1rem;
}

.fuentes li {
  margin: 0.3rem 0;
}

.fuentes a {
  color: var(--texto-secundario);
}

.fuentes a:hover {
  color: var(--lima);
}

/* Conceptos sin gráfica lateral: una columna de lectura, sin hueco a la derecha. */
.concepto-solo {
  grid-template-columns: minmax(0, 42rem);
}


/* ═══ Efectos (v4.1) ═══════════════════════════════════════════════════════
   Todo lo que se mueve va dentro de prefers-reduced-motion: no-preference.
   Las clases html.js-anim / html.js-cab las pone src/js/efectos.js; sin JS no
   se oculta ni se mueve nada. */

/* Botones secundarios: sin el halo lima del principal. */
.boton-secundario:hover,
.boton-secundario:active {
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.28);
}

.boton-secundario:active {
  filter: none;
  background: rgba(255, 255, 255, 0.08);
}

/* Tarjetas con respuesta: borde lima y halo al pasar el ratón (sin movimiento). */
@media (hover: hover) and (pointer: fine) {
  .tarjeta-nivel:has(a):hover,
  .tarjeta-concepto:hover,
  .tarjeta-grafica:hover,
  .tarjeta-ejemplo:hover,
  .tarjeta-opinion:hover {
    border-color: rgba(198, 244, 69, 0.55);
    box-shadow: 0 0 0 1px rgba(198, 244, 69, 0.12), 0 10px 36px rgba(198, 244, 69, 0.14);
  }
}

/* Tarjeta enlace: el foco de teclado mantiene el anillo y el radio de la tarjeta. */
.tarjeta-concepto:focus-visible {
  border-radius: var(--radio);
  border-color: rgba(198, 244, 69, 0.55);
}

/* Táctil: pequeño efecto al pulsar. */
@media (hover: none), (pointer: coarse) {
  .tarjeta-nivel:has(a):active,
  .tarjeta-concepto:active,
  .tarjeta-grafica:active,
  .tarjeta-ejemplo:active,
  .tarjeta-opinion:active {
    border-color: rgba(198, 244, 69, 0.5);
    box-shadow: 0 0 0 1px rgba(198, 244, 69, 0.1), 0 4px 18px rgba(198, 244, 69, 0.1);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: 5.5rem;
  }

  /* 1 · Transición entre páginas (mismo origen): fundido corto. */
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.2s;
    animation-timing-function: ease;
  }

  /* 2 · Aparición al entrar en pantalla. Solo se oculta lo que JS ha marcado
     con .rev (siempre fuera de la ventana al cargar). */
  html.js-anim .rev {
    opacity: 0;
    transform: translateY(12px);
  }

  html.js-anim .rev.rev-visto {
    opacity: 1;
    transform: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  /* 3 · Tarjetas: elevación, brillo que sigue al cursor, táctil. */
  .tarjeta-nivel,
  .tarjeta-concepto,
  .tarjeta-grafica,
  .tarjeta-ejemplo,
  .tarjeta-opinion {
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  }

  @media (hover: hover) and (pointer: fine) {
    .tarjeta-nivel:has(a):hover,
    .tarjeta-concepto:hover,
    .tarjeta-grafica:hover,
    .tarjeta-ejemplo:hover,
    .tarjeta-opinion:hover {
      transform: translateY(-2px);
      background:
        radial-gradient(circle 240px at var(--x, 50%) var(--y, 50%), rgba(198, 244, 69, 0.11), transparent 70%),
        linear-gradient(180deg, var(--superficie-inicio), var(--superficie-fin));
    }
  }

  @media (hover: none), (pointer: coarse) {
    .tarjeta-nivel:has(a):active,
    .tarjeta-concepto:active,
    .tarjeta-grafica:active,
    .tarjeta-ejemplo:active,
    .tarjeta-opinion:active {
      transform: scale(0.99);
    }
  }

  /* 5 · Cabecera fija que se compacta. Altura de flujo constante (.barra). */
  html.js-cab .barra {
    position: sticky;
    top: 0;
    pointer-events: none;
  }

  html.js-cab .barra::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    z-index: -1;
    background: rgba(7, 7, 12, 0);
    border-bottom: 1px solid transparent;
    transition: height 0.22s ease, background-color 0.22s ease, border-color 0.22s ease;
  }

  html.js-cab .barra .cabecera {
    pointer-events: auto;
    transition: height 0.22s ease, padding 0.22s ease;
  }

  html.js-cab .barra .logo img,
  html.js-cab .barra .logo-nombre {
    transition: width 0.22s ease, height 0.22s ease, font-size 0.22s ease;
  }

  html.js-cab .barra.compacta::before {
    height: 4rem;
    background: rgba(7, 7, 12, 0.82);
    border-bottom-color: var(--borde);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
  }

  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    html.js-cab .barra.compacta::before {
      background: rgba(7, 7, 12, 0.96);
    }
  }

  html.js-cab .barra.compacta .cabecera {
    height: 4rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  html.js-cab .barra.compacta .logo img {
    width: 32px;
    height: 32px;
  }

  html.js-cab .barra.compacta .logo-nombre {
    font-size: 1.25rem;
  }

  /* La gráfica lateral fija queda por debajo de la cabecera fija. */
  html.js-cab .visual-concepto {
    top: 5.4rem;
  }
}

/* Centinela del scroll para la cabecera: fuera del flujo, no afecta a la maquetación. */
.centinela-cabecera {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 32px;
  pointer-events: none;
  visibility: hidden;
}

@media print {
  html.js-anim .rev {
    opacity: 1;
    transform: none;
  }
}

/* ——— Enlaces externos ——— */
.icono-externo {
  display: inline-block;
  margin-left: 0.15em;
  font-size: 0.85em;
  text-decoration: none;
}

.solo-lectores {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
