/* web/hud/bar_looks.css
   Settings' UI bars topic, laid over every bar at once: the bar under the game
   (#hud .bar), a side panel's in Full and Slim (.rd-track) and the Recall
   countdown (.tv-cd). The fill keeps its own colours and fade (DragonHud.paint);
   a texture and a shading go over it as translucent layers, the shading under
   the texture's, drawn across the whole bar's width so a fill and a lost-health
   chunk (web/hud/chunks.js) show one continuous texture. The empty part carries
   the same layers at 45% unless it is set Plain. Flat and None add nothing. */

:root { --bar-texture: none; --bar-shading: none; }

:root[data-bar-texture="smooth"] {
  --bar-texture: linear-gradient(180deg, rgba(255,255,255,.20), rgba(255,255,255,0) 55%, rgba(0,0,0,.22));
}
:root[data-bar-texture="glass"] {
  --bar-texture: linear-gradient(180deg, rgba(255,255,255,.34) 0%, rgba(255,255,255,.12) 46%,
    rgba(255,255,255,0) 50%, rgba(0,0,0,.16) 100%);
}
:root[data-bar-texture="satin"] {
  --bar-texture: linear-gradient(180deg, rgba(0,0,0,.22), rgba(255,255,255,.18) 50%, rgba(0,0,0,.26));
}
:root[data-bar-texture="bevel"] {
  --bar-texture: linear-gradient(180deg, rgba(255,255,255,.30) 0 1px, rgba(255,255,255,.06) 1px,
    rgba(0,0,0,.08) calc(100% - 1px), rgba(0,0,0,.45) calc(100% - 1px));
}
:root[data-bar-texture="falloff"] {
  --bar-texture: linear-gradient(90deg, rgba(255,255,255,.14), rgba(255,255,255,.04) 35%,
    rgba(0,0,0,.12) 65%, rgba(0,0,0,.24));
}
:root[data-bar-texture="tube"] {
  --bar-texture: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.04) 38%,
    rgba(0,0,0,.20) 52%, rgba(0,0,0,.06) 70%, rgba(255,255,255,.06));
}
:root[data-bar-texture="edge"] {
  --bar-texture: linear-gradient(180deg, rgba(255,255,255,.22) 0 1px, rgba(255,255,255,.03) 1px,
    rgba(0,0,0,.06) calc(100% - 2px), rgba(0,0,0,.35) calc(100% - 2px));
}
:root[data-bar-texture="metal"] {
  --bar-texture: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.06) 40%,
    rgba(0,0,0,.10) 62%, rgba(0,0,0,.24));
}

:root[data-bar-shading="faint"] { --bar-shading: linear-gradient(180deg, rgba(255,255,255,.07), rgba(0,0,0,.09)); }
:root[data-bar-shading="gentle"] { --bar-shading: linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.15)); }
:root[data-bar-shading="soft"] {
  --bar-shading: linear-gradient(180deg, rgba(255,255,255,.17), rgba(255,255,255,0) 50%, rgba(0,0,0,.22));
}
:root[data-bar-shading="deep"] { --bar-shading: linear-gradient(180deg, rgba(255,255,255,.22), rgba(0,0,0,.32)); }

/* A bar is the size its layers are measured against: 100cqw is its whole width,
   wherever inside it the fill ends. */
#hud .bar, .rd-track, .tv-cd { container-type: inline-size; }
.tv-cd, .tv-cd > i { position: relative; }
#hud .bar > .fill, .rd-track > .fill, .tv-cd > i { overflow: hidden; }

#hud .bar > .fill::after, .rd-track > .fill::after, .tv-cd > i::after, .bar-chunk::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 100cqw; pointer-events: none;
  background-image: var(--bar-texture), var(--bar-shading);
}

/* The empty part: drawn first in the bar, so the fill and any chunk cover it. */
:root:not([data-bar-empty="plain"]) #hud .bar::before,
:root:not([data-bar-empty="plain"]) .rd-track::before,
:root:not([data-bar-empty="plain"]) .tv-cd::before {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: .45; pointer-events: none;
  background-image: var(--bar-texture), var(--bar-shading);
}

/* A lost-health chunk: the whole bar, clipped by web/hud/chunks.js to what the
   hit took, and placed just before the fill so the fill draws over it. */
.bar-chunk { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; }
