/* ==========================================================================
   Causeway component states — deterministic visuals for stateful elements.

   Loaded *after* DaisyUI in the platform shell so source order makes the
   reset and state-driven rules below win against DaisyUI's class-only
   selectors at equal specificity.

   The convention this file enforces:

     1. Visual variants live behind a named state attribute, never behind
        ad-hoc class toggles fighting the cascade. The canonical attribute
        is `data-island-state` (set by TorrentFX at
        `runtime-web/src/index.ts:873` when an island transitions through
        registered → mounting → subscribed → ready → failed/disposed).
        Other surfaces may add `data-cw-state-*` attributes for their own
        state machines.
     2. The base reset includes `[hidden] { display: none !important; }`
        because Causeway is light-DOM + DaisyUI; `display: flex` /
        `display: grid` from utility classes was beating the bare attribute
        selector and silently rendering hidden elements. The !important
        is intentional and documented — `[hidden]` is a *contract*
        (HTML semantics: this thing is not currently relevant), not a
        style preference.
     3. Future work: when SolidElement element classes are extended to
        call `attachInternals()` and surface `:state(name)` selectors, the
        rules in this file move to that scope and the `data-island-state`
        attribute selectors retire. Until then this file is the
        single-source-of-truth for component-state visuals.
   ========================================================================== */

/* ── Base reset ─────────────────────────────────────────────────────────── */

[hidden] { display: none !important; }

/* ── Island phases ──────────────────────────────────────────────────────── */
/* Phase vocabulary mirrors `IslandPhase` in
   `torrentfx/web/framework/runtime-web/src/index.ts`. */

/* `mounting`: the island is loading; show a low-attention placeholder so
    the user doesn't see flash of empty content. */
[data-island-state="mounting"] {
  opacity: 0.6;
  pointer-events: none;
}

/* `subscribed`: bus subscriptions wired but the runtime hasn't marked the
    island ready. Fade in slightly stronger than mounting. */
[data-island-state="subscribed"] {
  opacity: 0.85;
}

/* `ready`: the default; explicit so future rules can target it without
    relying on absence-of-attribute. */
[data-island-state="ready"] {
  opacity: 1;
  pointer-events: auto;
}

/* `failed`: visible but visually de-emphasised, with a hatched warning
    border so the operator knows something didn't come up. */
[data-island-state="failed"] {
  opacity: 0.55;
  outline: 1px dashed var(--rose-500, #c53030);
  outline-offset: -1px;
  pointer-events: none;
}

/* `disposed`: torn-down by the runtime; same effect as [hidden]. */
[data-island-state="disposed"] {
  display: none !important;
}
