/*
 * island.css — «Isla» de avisos (island.js), efecto AirPods / Dynamic Island.
 *
 * Cápsula negra que aparece bajo la barra de pestañas (island.js ajusta --island-top a la
 * barra real; 112 px es el respaldo). Nunca tapa la cabecera (PARO, banner de alarma) y queda
 * por debajo de los modales: la ficha (.overlay) va en 60 y .bm-overlay en 950.
 * El tamaño de la cápsula (.island-bg) lo anima island.js con un muelle; aquí solo va el
 * aspecto. El estado nunca va solo en el color: ✓ · ● · ▲ siempre acompañan al texto.
 */
.island {
  --island-top: 112px;
  --island-ok: #36e27a;
  --island-info: #8ab4ff;
  --island-warn: #e8a33d;
  position: fixed;
  top: var(--island-top);
  left: 50%;
  width: 0;
  height: 0;
  z-index: 59;
  pointer-events: none;
  color: #fff;
  font-family: var(--font, 'Inter', -apple-system, system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.island[data-state='hidden'] {
  visibility: hidden;
}

/* Envoltorio para la respuesta al pulsar (no choca con las animaciones de island.js) */
.island-press {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
.island[data-state='open'] .island-bg {
  pointer-events: auto;
}
.island.is-clickable .island-bg {
  cursor: pointer;
}
.island[data-state='open'] .island-press:active {
  transform: scale(0.97);
}

/* La cápsula */
.island-bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 120px;
  height: 38px;
  box-sizing: border-box;
  transform: translateX(-50%);
  overflow: hidden; /* recorta el contenido mientras la cápsula crece o encoge */
  border-radius: 999px;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 24px 48px -12px rgba(0, 0, 0, 0.7),
    0 10px 20px -6px rgba(0, 0, 0, 0.45),
    0 2px 4px rgba(0, 0, 0, 0.35);
  transition:
    border-color 200ms ease,
    box-shadow 200ms ease;
}
.island[data-tone='warn'] .island-bg {
  border-color: rgba(232, 163, 61, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 3px rgba(232, 163, 61, 0.1),
    0 24px 48px -12px rgba(0, 0, 0, 0.7),
    0 10px 20px -6px rgba(0, 0, 0, 0.45),
    0 2px 4px rgba(0, 0, 0, 0.35);
}
body[data-theme='light'] .island-bg {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 40px -14px rgba(0, 0, 0, 0.45),
    0 6px 14px -6px rgba(0, 0, 0, 0.3);
}

/* Contenido: [3D 52×52] [título / sub] [glifo], centrado dentro de la cápsula. Con la cápsula
   abierta (64 px) el hueco del 3D es concéntrico con su extremo (6 px alrededor). */
.island-body {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 62px;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 19px 0 5px;
  white-space: nowrap;
}
.island-media {
  flex: none;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
}
.island-canvas {
  display: block;
  width: 52px;
  height: 52px;
}
.island-media > svg {
  width: 40px;
  height: 40px;
  overflow: visible;
}
.island-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}
.island-title {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: #fff;
}
/* Texto que no cabe ni con la cápsula al máximo: el título usa dos líneas (y solo entonces «…») */
.island.is-wrap .island-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  font-size: 14px;
  line-height: 17px;
}
.island-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 17px;
  font-weight: 450;
  color: rgba(235, 235, 245, 0.62);
}
.island-glyph {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}
.island-glyph[hidden] {
  display: none;
}
.island-glyph > svg {
  width: 22px;
  height: 22px;
  overflow: visible;
}

/* ✓ que se dibuja */
.ig-tick {
  fill: none;
  stroke: var(--island-ok);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 21;
  stroke-dashoffset: 21;
  animation: island-draw 360ms cubic-bezier(0.23, 1, 0.32, 1) 420ms forwards;
}
/* ● que late (info) */
.ig-info {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--island-info);
}
.ig-info::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: island-ping 1.6s cubic-bezier(0, 0, 0.2, 1) 300ms infinite;
}
/* ▲ con «!» (glifo y grande) */
.ib-tri {
  fill: var(--island-warn);
}
.ib-bang {
  fill: none;
  stroke: #1b1103;
  stroke-width: 2.6;
  stroke-linecap: round;
}
.ig-warn .ib-bang {
  stroke-width: 2;
}
.ib-dot {
  fill: #1b1103;
}

/* Iconos grandes (kind check / warn): entran con un pequeño rebote; el check se dibuja */
.ib {
  animation: island-pop 460ms cubic-bezier(0.34, 1.45, 0.64, 1) 140ms both;
}
.ib-disc {
  fill: var(--island-ok);
}
.ib-tick {
  fill: none;
  stroke: #04150b;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 23;
  stroke-dashoffset: 23;
  animation: island-draw 380ms cubic-bezier(0.23, 1, 0.32, 1) 380ms forwards;
}

/* Respaldo plano (sin WebGL) */
.island-media .fl-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.island-media .fl-thin {
  stroke-width: 1.2;
  opacity: 0.55;
}
.island-media .fl-solid {
  fill: rgba(255, 255, 255, 0.88);
}
.island-media .fl-amber {
  fill: var(--island-warn);
}
.island-media .fl-amber-line {
  fill: none;
  stroke: var(--island-warn);
  stroke-width: 2.4;
  stroke-linecap: round;
}
.island-media .fl-green {
  fill: #39ff7a;
}
.island-media .fl-green-line {
  fill: none;
  stroke: #39ff7a;
  stroke-width: 2.4;
  stroke-linecap: round;
}

/* Solo para lectores de pantalla */
.island-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes island-draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes island-pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes island-ping {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  75%,
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}
@keyframes island-fade {
  from {
    opacity: 0;
  }
}

/* Menos movimiento: sin muelle ni giro (lo hace island.js), sin latido; solo fundidos */
@media (prefers-reduced-motion: reduce) {
  .island-press {
    transition: none;
  }
  .island[data-state='open'] .island-press:active {
    transform: none;
  }
  .ib {
    animation: island-fade 200ms ease both;
  }
  .ig-tick,
  .ib-tick {
    animation: none;
    stroke-dashoffset: 0;
  }
  .ig-info::after {
    animation: none;
    display: none;
  }
}
