/* Acciones y foco. El indicador de teclado se dibuja dentro del control.
   Los colores están en estandares.md. El verde de la mesa y el oro de las fichas no cambian. */

body {
  --palos-rojo: #c22a40;
  --palos-oscuro: #992235;
  --accion: #8d4b32;
  --accion-hover: #7a4030;
  --accion-tinta: #fff8f2;
  --secundaria: #e6e1d8;
  --secundaria-borde: #c7beb5;
  --secundaria-tinta: #292d33;
  --secundaria-hover: #ddd6cb;
  --icono-hover: color-mix(in srgb, var(--accion) 14%, transparent);
  /* El fondo del botón queda vacío; la placa redonda la pinta ::before. */
  --icono-placa: none;
  --icono-radio: 6px;
  --anillo: #8d4b32;
  --anillo-suave: color-mix(in srgb, var(--anillo) 50%, transparent);
  --trio-copper: var(--accion);
  --trio-on-copper: var(--accion-tinta);
}

body[data-home-theme="dark"] {
  --palos-rojo: #ff4a5c;
  --palos-oscuro: #d03347;
  --accion: #d4926a;
  --accion-hover: #e0a36e;
  --accion-tinta: #2a1812;
  --secundaria: #3a2c2d;
  --secundaria-borde: #4d3b3c;
  --secundaria-tinta: #f3f0e5;
  --secundaria-hover: #4a3839;
  --icono-hover: color-mix(in srgb, var(--accion) 14%, transparent);
  --anillo: #d4926a;
  --trio-copper: var(--accion);
  --trio-on-copper: var(--accion-tinta);
}

/* El contorno no se quita nunca: Chromium pinta un cuadrado blanco durante un instante si
   `outline` pasa a none o a 0, sobre todo con offset negativo, al soltar el foco o al cerrar un modal. */
html body :where(a, button, input, select, textarea, summary, dialog, [tabindex], [role="button"], [role="tab"], [role="switch"], [role="checkbox"], [role="radio"], [role="menuitem"]) {
  outline: 2px solid transparent !important;
  outline-offset: 0 !important;
  transition: outline-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

html body :where(a, button, input, select, textarea, summary, [tabindex], [role="button"], [role="tab"], [role="switch"], [role="checkbox"], [role="radio"], [role="menuitem"]):focus-visible {
  outline-color: var(--foco-control, var(--anillo)) !important;
  outline-offset: -3px !important;
}

html body :focus:not(:focus-visible),
html body [data-foco-puntero]:focus {
  outline: 2px solid transparent !important;
  outline-offset: 0 !important;
}

html body button.primary { --foco-control: var(--accion-tinta); }

@media (forced-colors: active) {
  html body { --anillo: Highlight; }
  html body button.primary { --foco-control: Highlight; }
}

.copia-contenido {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  gap: 6px;
}
.copia-icono {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--tamano-copia);
  height: var(--tamano-copia);
}
.copia-contenido .copia-icono svg {
  display: block;
  width: var(--tamano-copia);
  height: var(--tamano-copia);
}
[data-estado-copia="copiado"] .copia-icono { color: var(--accion); }
[data-estado-copia="error"] .copia-icono { color: var(--group-danger, var(--accion)); }

html body button.primary {
  background: var(--accion);
  border-color: var(--accion);
  color: var(--accion-tinta);
}

html body button.primary:hover:not(:disabled) {
  background: var(--accion-hover);
  border-color: var(--accion-hover);
}

html body button.secondary,
html body button.primary-outline {
  background: var(--secundaria);
  border-color: var(--secundaria-borde);
  color: var(--secundaria-tinta);
}

html body button.secondary:hover:not(:disabled),
html body button.primary-outline:hover:not(:disabled) {
  background: var(--secundaria-hover);
  border-color: var(--secundaria-borde);
}

/* Botón que solo lleva un icono (cerrar, compartir, ojo, volver).
   Un solo hover: tinte de cobre, sin el marrón #342628, el gris #333 ni el verde #18d487.
   La campana, el menú de la cabecera, las filas y el botón flotante tienen el suyo. */
html body button:is(
  .reference-icon,
  .icon-button,
  .modal-cerrar,
  .campo-ojo,
  .nav-compartir,
  .nav-cuenta-inicio,
  .club-web-update,
  .union-back-button,
  .ctw-sheet-close,
  .ctw-back
):not(
  .reference-profile-row,
  .reference-floating,
  .reference-chip-requests,
  .cabecera-clubes-campana,
  .cabecera-clubes-menu,
  .cabecera-clubes-perfil-compacto,
  .reference-table-menu-toggle,
  .reference-table-notices
) {
  position: relative;
  isolation: isolate;
}
html body button:is(
  .reference-icon,
  .icon-button,
  .modal-cerrar,
  .campo-ojo,
  .nav-compartir,
  .nav-cuenta-inicio,
  .club-web-update,
  .union-back-button,
  .ctw-sheet-close,
  .ctw-back
):not(
  .reference-profile-row,
  .reference-floating,
  .reference-chip-requests,
  .cabecera-clubes-campana,
  .cabecera-clubes-menu,
  .cabecera-clubes-perfil-compacto,
  .reference-table-menu-toggle,
  .reference-table-notices
)::before {
  content: "";
  position: absolute;
  /* Detrás del trazo. La capa existe siempre: crearla solo al pasar el cursor la pinta blanca un instante. */
  z-index: -1;
  inset: 4px;
  border-radius: var(--icono-radio);
  background: transparent;
  pointer-events: none;
}
html body button:is(
  .reference-icon,
  .icon-button,
  .modal-cerrar,
  .campo-ojo,
  .nav-compartir,
  .nav-cuenta-inicio,
  .club-web-update,
  .union-back-button,
  .ctw-sheet-close,
  .ctw-back
):not(
  .reference-profile-row,
  .reference-floating,
  .reference-chip-requests,
  .cabecera-clubes-campana,
  .cabecera-clubes-menu,
  .cabecera-clubes-perfil-compacto,
  .reference-table-menu-toggle,
  .reference-table-notices
):is(:hover, :active):not(:disabled) {
  background: var(--icono-placa);
  border-color: transparent;
  color: var(--accion);
  box-shadow: none;
  transform: none;
}
html body button:is(
  .reference-icon,
  .icon-button,
  .modal-cerrar,
  .campo-ojo,
  .nav-compartir,
  .nav-cuenta-inicio,
  .club-web-update,
  .union-back-button,
  .ctw-sheet-close,
  .ctw-back
):not(
  .reference-profile-row,
  .reference-floating,
  .reference-chip-requests,
  .cabecera-clubes-campana,
  .cabecera-clubes-menu,
  .cabecera-clubes-perfil-compacto,
  .reference-table-menu-toggle,
  .reference-table-notices
):is(:hover, :active):not(:disabled)::before {
  background: var(--icono-hover);
}

/* Las flechas de Mis clubes ya cambian el círculo entero. La placa interior no va ahí. */
html body .club-rail-nav > button.icon-button::before {
  content: none;
}

/* Un icono dentro de una caja es el trazo. La caja conserva su fondo. */
html body morph-icon {
  background: none;
  border: 0;
  box-shadow: none;
}

html body :is(div, article, section, aside, header, footer, li, span, p, a):has(> morph-icon):not(:has(> :not(morph-icon))) {
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}
