/* ============================================================
   COMPONENTES — Cabecera, botones, etiquetas, formulario, cursor
   ============================================================ */

/* ------------------------------------------------------------
   1. Cabecera fija
   Arriba del todo es invisible; al bajar se vuelve un velo
   semitransparente (20 %) que difumina lo que pasa por debajo.
   ------------------------------------------------------------ */
.cabecera {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--alto-cabecera);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-inline: var(--margen);
  background: transparent;
  transition: background var(--tr-media), backdrop-filter var(--tr-media), -webkit-backdrop-filter var(--tr-media);
}
.cabecera.esta-desplazada { background: rgba(32, 13, 9, 0.92); }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cabecera.esta-desplazada {
    background: rgba(32, 13, 9, 0.2);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }
}

/* En el inicio, la barra algo más opaca al bajar: con el cuadro claro y terracota
   pasando por debajo, ESP/ENG y el logotipo se perdían. Solo cambia la transparencia. */
.cabecera--inicio.esta-desplazada { background: rgba(32, 13, 9, 0.74); }

/* ------------------------------------------------------------
   1b. Logotipo: el cuadro 1:1
   Tercio superior claro y, debajo, terracota con carlos / ramos /
   diseño UX. Todo se mide en proporción al propio cuadro, así que
   es igual en el hero (grande) y en la barra (pequeño).
   ------------------------------------------------------------ */
.cuadro {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  container-type: size;            /* las medidas de dentro salen del tamaño del cuadro */
  overflow: hidden;
  border-radius: var(--radio-lg);
  background: linear-gradient(to bottom, var(--c-100) 0 33.3333%, var(--c-500) 33.3333% 100%);
}
.cuadro--mini { width: 100%; height: 100%; border-radius: 6px; }

/* Margen interior: 5,5 % del lado. Tamaño de letra: lo que cabe a lo ancho.
   Así «carlos» queda justo bajo la franja clara. */
.cuadro__nombre {
  position: absolute;
  left: 5.5cqi;
  right: 5.5cqi;
  bottom: 5.5cqi;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05em;                     /* misma separación entre carlos, ramos y UX */
  font-family: var(--fuente-sans);
  font-size: 31.7cqi;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--c-950);             /* 4,3:1 sobre el terracota, texto muy grande */
}
.cuadro__linea { display: block; white-space: nowrap; }
/* Cajas ceñidas a las letras (medidas de Be Vietnam y Source Serif 4) */
.cuadro__linea--carlos { margin: -0.22em 0 -0.03em; }    /* de la «l» a la línea base */
.cuadro__linea--ramos  { margin: -0.441em 0 -0.03em; }   /* de la altura de la «x» a la línea base */
.cuadro__linea--rol {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;         /* «diseño» alineado arriba con «UX» */
  gap: 0.035em;
}
.cuadro__diseno {
  font-size: 0.31em;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: -0.219em;
}
.cuadro__ux {
  font-family: var(--fuente-serif);
  font-size: 0.62em;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: -0.198em 0 -0.15em;
  color: var(--c-100);             /* 4,45:1 sobre el terracota */
}

/* En la barra: siempre en su sitio (fijo, dentro de la cabecera fija) y solo
   cambia su opacidad, así que no puede dar saltos al hacer scroll.
   Oculto, no se ve, no se enfoca y no se lee. */
.cabecera__logo {
  order: -2;                       /* en móvil, el selector de idioma tiene order -1 */
  margin-right: auto;
  flex: 0 0 auto;
  display: block;
  width: 64px;
  height: 64px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 0s linear 160ms;
}
.cabecera__logo.esta-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 260ms var(--curva-entrada),
    transform 260ms var(--curva-entrada),
    visibility 0s linear 0s;
}
.cabecera__logo:focus-visible { outline-offset: 4px; border-radius: 2px; }
@media (max-width: 860px) {
  .cabecera__logo { width: 52px; height: 52px; }
}

.nav__grupo {
  display: flex;
  align-items: center;
  gap: var(--e-2);
}

.nav__lista {
  display: flex;
  align-items: center;
  gap: var(--e-2);
}

.nav__enlace,
.pie__arriba {
  display: inline-flex;
  align-items: center;
  gap: var(--e-3);
  min-height: 44px;
  padding: var(--e-2) var(--e-4);
  border: 2px solid transparent;
  border-radius: var(--radio-pill);
  font-family: var(--fuente-serif);
  font-size: var(--txt-md);
  font-weight: 900;
  color: var(--texto);
  white-space: nowrap;
  transition: background var(--tr-rapida), color var(--tr-rapida);
}
.nav__enlace:hover,
.pie__arriba:hover { background: var(--fondo-elevado-2); }

/* Halo oscuro tras el texto: mantiene la lectura cuando pasa contenido claro por debajo del velo */
.cabecera.esta-desplazada .nav__enlace:not([aria-current="true"]) { text-shadow: 0 0 14px rgba(32, 13, 9, 0.95), 0 0 4px rgba(32, 13, 9, 0.9); }

/* Sección activa: caja redondeada, fondo y marco del tono 100, texto 950 */
.nav__enlace[aria-current="true"] {
  background: var(--c-100);
  border-color: var(--c-100);
  color: var(--c-950);
}

/* Botón que copia el correo */
.boton-copiar {
  display: inline-flex;
  align-items: center;
  gap: var(--e-2);
  min-height: 44px;
  padding: var(--e-2) var(--e-4);
  background: var(--c-500);
  border: none;
  border-radius: var(--radio-pill);
  color: var(--c-950);
  font-family: var(--fuente-serif);
  font-size: var(--txt-md);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--tr-rapida);
}
.boton-copiar:hover { background: var(--c-400); }
.boton-copiar__icono { width: 26px; height: 18px; flex: 0 0 auto; }
.boton-copiar.esta-copiado { background: var(--c-200); }

/* Selector de idioma: dos opciones apiladas en vertical, solo texto.
   Activa: en negrita y en el color del texto. Inactiva: en gris (5,6:1 sobre el fondo,
   cumple AA porque sigue siendo pulsable) hasta que se elige. */
.idioma {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: var(--e-2);
}
.idioma__opcion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 24px;   /* tamaño mínimo de objetivo táctil de WCAG 2.2 */
  padding: 1px var(--e-2);
  border: none;
  border-radius: var(--radio-sm);
  background: transparent;
  color: #9C8884;
  font-family: var(--fuente-sans);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  cursor: pointer;
  transition: color var(--tr-rapida);
}
.idioma__opcion:hover { color: var(--c-100); text-decoration: underline; text-underline-offset: 3px; }
.idioma__opcion[aria-pressed="true"] {
  color: var(--c-100);
  font-weight: 800;
  text-decoration: none;
  cursor: default;
}
/* Con la cabecera desplazada, el mismo halo oscuro que el menú para que se lea sobre lo que pase por debajo */
.cabecera.esta-desplazada .idioma__opcion { text-shadow: 0 0 14px rgba(32, 13, 9, 0.95), 0 0 4px rgba(32, 13, 9, 0.9); }

/* Botón hamburguesa (solo móvil) */
.nav__hamburguesa {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--e-2);
  min-height: 44px;
  min-width: 44px;
  padding: var(--e-2) var(--e-4);
  background: var(--c-900);
  border: none;
  border-radius: var(--radio-pill);
  color: var(--texto);
  font-family: var(--fuente-serif);
  font-size: var(--txt-sm);
  font-weight: 800;
  cursor: pointer;
}
.nav__barras {
  position: relative;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.nav__barras::before,
.nav__barras::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--tr-rapida);
}
.nav__barras::before { top: -6px; }
.nav__barras::after { top: 6px; }
.nav__hamburguesa[aria-expanded="true"] .nav__barras { background: transparent; }
.nav__hamburguesa[aria-expanded="true"] .nav__barras::before { transform: translateY(6px) rotate(45deg); }
.nav__hamburguesa[aria-expanded="true"] .nav__barras::after { transform: translateY(-6px) rotate(-45deg); }

/* ------------------------------------------------------------
   2. Botones (tipografía con serifa)
   ------------------------------------------------------------ */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--e-2);
  min-height: 48px;
  padding: var(--e-2) var(--e-4);
  border: none;
  border-radius: var(--radio-pill);
  font-family: var(--fuente-serif);
  font-size: var(--txt-md);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--tr-rapida), transform var(--tr-rapida), color var(--tr-rapida);
}
.boton:active { transform: translateY(1px); }

/* Texto oscuro sobre el rojo: 4,36:1. Cumple AA como texto grande (19 px o más en negrita),
   así que estos botones nunca bajan de 19 px, tampoco en el móvil. */
.boton--principal,
.boton--envio { font-size: max(var(--txt-md), 1.1875rem); }
.boton--principal { background: var(--c-500); color: var(--c-950); }
.boton--principal:hover { background: var(--c-400); }

.boton--claro { background: var(--c-100); color: var(--c-950); padding-inline: var(--e-5); }
.boton--claro:hover { background: var(--c-200); }

.boton--envio { background: var(--c-500); color: var(--c-950); padding-inline: var(--e-6); min-height: 56px; }
.boton--envio:hover { background: var(--c-400); }
.boton:disabled { opacity: 0.7; cursor: progress; }

/* Botón con contorno (20 de noviembre de 2026): el aspecto del «Cerrar» del visor de los casos.
   Fondo de la página, borde de 3 px y texto claros (15,6:1). El borde va dentro del relleno
   para que mida lo mismo que el botón principal de al lado. */
.boton--contorno {
  border: 3px solid var(--c-100);
  padding: calc(var(--e-2) - 3px) calc(var(--e-4) - 3px);
  background: transparent;
  color: var(--c-100);
  font-size: max(var(--txt-md), 1.1875rem);
}
.boton--contorno:hover { background: var(--fondo-elevado-2); }
/* Logo dentro de un botón: crece con la letra */
.boton__logo { width: 1.25em; height: 1.25em; flex: 0 0 auto; }

/* ------------------------------------------------------------
   3. Etiquetas
   ------------------------------------------------------------ */
/* Opción M (elegida por Carlos el 5 de octubre de 2026): icono de etiqueta y texto,
   sin caja, para que no se confundan con botones. El icono está dibujado aquí mismo. */
.etiquetas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--e-2) var(--e-5);
}
.etiqueta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--fuente-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--c-200);
}
.etiqueta::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  background: var(--c-400);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7.5' cy='7.5' r='1.5'/%3E%3Cpath d='M3 6v5.17a2 2 0 0 0 .59 1.42l7.71 7.71a2.41 2.41 0 0 0 3.41 0l5.59-5.59a2.41 2.41 0 0 0 0-3.41l-7.71-7.71A2 2 0 0 0 11.17 3H6a3 3 0 0 0-3 3z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7.5' cy='7.5' r='1.5'/%3E%3Cpath d='M3 6v5.17a2 2 0 0 0 .59 1.42l7.71 7.71a2.41 2.41 0 0 0 3.41 0l5.59-5.59a2.41 2.41 0 0 0 0-3.41l-7.71-7.71A2 2 0 0 0 11.17 3H6a3 3 0 0 0-3 3z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ------------------------------------------------------------
   4. Formulario
   Izquierda: nombre, correo y asunto. Derecha: mensaje, con la
   misma altura total que los tres campos. Debajo, alineado a la
   derecha: verificación, botón y aviso.
   ------------------------------------------------------------ */
.formulario { display: grid; gap: var(--e-5); }

.formulario__rejilla {
  display: grid;
  gap: var(--e-5);
}
.formulario__columna { display: grid; gap: var(--e-5); align-content: start; }

@media (min-width: 780px) {
  .formulario__rejilla {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
  }
}

.campo { display: grid; gap: var(--e-2); align-content: start; }
.campo--mensaje { display: flex; flex-direction: column; gap: var(--e-2); }
.campo--mensaje .campo__control { flex: 1 1 auto; }

.campo__etiqueta {
  font-family: var(--fuente-sans);
  font-size: var(--txt-sm);
  font-weight: 600;
}

.campo__control {
  width: 100%;
  min-height: 56px;
  padding: var(--e-3) var(--e-4);
  background: var(--fondo-elevado);
  border: 1px solid var(--borde-campo);
  border-radius: var(--radio-md);
  color: var(--texto);
  font-family: var(--fuente-sans);
  font-size: var(--txt-base);
  transition: background var(--tr-rapida), border-color var(--tr-rapida);
}
.campo__control:hover { background: var(--fondo-elevado-2); }
textarea.campo__control { min-height: 200px; resize: vertical; }

.campo__control[aria-invalid="true"] { border-color: var(--c-400); border-width: 2px; }

/* Icono de aviso: triángulo con exclamación. La información
   nunca depende solo del color: siempre va acompañada de texto. */
.campo__error,
.formulario__aviso--error {
  --icono-aviso: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M10.3 3.2a2 2 0 0 1 3.4 0l8.4 14.6A2 2 0 0 1 20.4 21H3.6a2 2 0 0 1-1.7-3.2L10.3 3.2ZM11 9h2v5.5h-2V9Zm1 7.2a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5Z'/%3E%3C/svg%3E");
}

.campo__error {
  display: none;
  align-items: center;
  gap: var(--e-2);
  color: var(--c-300);   /* 8.7:1 sobre el fondo */
  font-size: var(--txt-sm);
  font-weight: 500;
}
.campo__error:not(:empty) { display: flex; }
.campo__error::before,
.formulario__aviso--error::before {
  content: "";
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--icono-aviso) center / contain no-repeat;
  mask: var(--icono-aviso) center / contain no-repeat;
}

/* Consentimiento e información básica de protección de datos */
.campo--consentimiento { gap: var(--e-2); }
.consentimiento {
  display: flex;
  align-items: flex-start;
  gap: var(--e-3);
  max-width: 62ch;
  font-size: var(--txt-sm);
  line-height: 1.5;
  cursor: pointer;
}
.consentimiento__casilla {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--c-500);
  cursor: pointer;
}
.consentimiento a,
.formulario__legal a { color: inherit; text-decoration: underline; text-underline-offset: 0.2em; }
.consentimiento a:hover,
.formulario__legal a:hover { color: var(--c-200); }

.formulario__legal {
  max-width: 78ch;
  font-size: var(--txt-xs);
  line-height: 1.6;
  color: var(--texto-suave);
}

.formulario__acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--e-4) var(--e-5);
}

.formulario__verificacion { min-height: 65px; }

.formulario__aviso {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--e-2);
  margin-top: calc(var(--e-2) * -1);
  font-size: var(--txt-sm);
  font-weight: 500;
  text-align: right;
}
.formulario__aviso:empty { display: none; }
.formulario__aviso--error { color: var(--c-300); }
.formulario__aviso--exito { color: var(--c-100); }

/* Campo trampa contra robots: invisible y fuera del recorrido del teclado */
.formulario__trampa {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ------------------------------------------------------------
   5. Cursor "Ver caso"
   ------------------------------------------------------------ */
.cursor-caso {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  pointer-events: none;
  transform: translate3d(var(--x, -200px), var(--y, -200px), 0);
}
.cursor-caso__circulo {
  display: grid;
  place-content: center;
  width: 116px;
  height: 116px;
  margin: -58px 0 0 -58px;
  border-radius: 50%;
  background: rgba(224, 63, 31, 0.4);
  color: var(--c-100);
  font-family: var(--fuente-serif);
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity var(--tr-rapida), transform var(--tr-rapida);
}
@supports (backdrop-filter: blur(1px)) {
  .cursor-caso__circulo { backdrop-filter: blur(6px) brightness(0.5); }
}
.cursor-caso.esta-visible .cursor-caso__circulo { opacity: 1; transform: scale(1); }
.cursor-caso__circulo > span { display: block; }

@media (hover: hover) and (pointer: fine) {
  a.caso__medio, .caso__titulo-enlace { cursor: none; }
}

/* ------------------------------------------------------------
   6. Móvil: la navegación pasa a menú desplegable
   ------------------------------------------------------------ */
@media (max-width: 860px) {
  .nav__hamburguesa { display: inline-flex; }
  .idioma { order: -1; margin: 0 var(--e-3) 0 0; }

  .nav__grupo {
    position: absolute;
    top: calc(var(--alto-cabecera) - 12px);
    right: var(--margen);
    left: var(--margen);
    flex-direction: column;
    align-items: stretch;
    gap: var(--e-3);
    padding: var(--e-4);
    background: var(--c-900);
    border-radius: var(--radio-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
  .nav__grupo[hidden] { display: none; }
  .nav__lista { flex-direction: column; align-items: stretch; gap: var(--e-1); }
  .nav__enlace { justify-content: flex-start; min-height: 52px; }
  .boton-copiar { justify-content: center; min-height: 52px; }

  .formulario__acciones { justify-content: flex-start; }
  .formulario__aviso { justify-content: flex-start; text-align: left; }
}
