/* widget-depth.css - what a widget draws beyond one flat fill: stacked segments, the target mark and its state, and the
   3D look (js/widget-draw.js, js/widget-draw-stack.js, js/gauge.js). Classic and the shared geometry; the Hub's tokens and its
   overrides are hub-widget-depth.css. Colors are the page's tokens (styles.css); the 3D shades are derived from the face
   color with color-mix, so a recolor needs nothing here.

   The 3D look is honest: an oblique extrusion, never a perspective. A bar's VALUE is the length of its FRONT FACE (the
   fill, as wide as it always was, relative to its track); the top face (up and to the right) and the side face (the right
   end) are the same constant depth --wg-d on every bar and carry no value and no text. A ring and a donut are extruded
   straight down (every angle on the face is exact). A number tile is never 3D.

   Light is from the upper left: top lightest, front the base color, side darkest.
   It is ON for every widget (data-3d) except widget.flat === true, and it falls back to the flat drawing under reduced
   motion, forced colors, print and a browser without color-mix: every rule that changes how a widget looks is inside
   ONE guard (the media query and the @supports below), so outside it the extra markup is display none and the widget
   draws as it did before. */

/* ---- not 3D: the target, its state, a chosen color, stacked segments (a new drawing, so no guard) ---- */
.bc-wg{--wg-met:#1a7f37;--wg-near:#946200;--wg-behind:#c62828}
.bc-wg[data-state="met"],.bc-wg [data-state="met"]{--wg-state:var(--wg-met)}
.bc-wg[data-state="near"],.bc-wg [data-state="near"]{--wg-state:var(--wg-near)}
.bc-wg[data-state="behind"],.bc-wg [data-state="behind"]{--wg-state:var(--wg-behind)}
.bc-wg[data-state] .bc-gauge-arc{stroke:var(--wg-state)}
.bc-wg[data-state] .bc-wg-meter > i{background:var(--wg-state)}
.bc-wg-st{margin-left:.4em;font-size:.7rem;font-weight:700;white-space:nowrap;color:var(--wg-state)}
.bc-wg-bar[data-state] > .bc-wg-track{box-shadow:inset -2px 0 0 var(--wg-state)}
.bc-wg-tm{position:absolute;top:-2px;bottom:-2px;width:2px;margin-left:-1px;background:var(--ink);box-shadow:0 0 0 1px var(--surface);pointer-events:none}
.bc-wg-foot{font-size:.72rem;text-align:center;color:var(--ink-2);font-variant-numeric:tabular-nums}
.bc-wg-track > i.bc-wg-sg{border-radius:0;box-shadow:inset 1px 0 0 var(--surface)}
.bc-wg-hatch{background-image:repeating-linear-gradient(45deg,rgb(255 255 255 / .55) 0 2px,transparent 2px 5px)!important}
.bc-wg [role="button"]{cursor:pointer}
.bc-wg [role="button"]:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.bc-wg-bar[role="button"]:hover > .bc-wg-k{color:var(--ink)}
.bc-wg [data-dim]{opacity:.45}
.bc-wg [data-dim] [data-dim]{opacity:1}   /* a segment inside a dimmed bar is dimmed by the bar: 45% in all, not 45% of 45% */
.bc-wg-ex,.bc-wg-sheen,.bc-gauge-ex{display:none}
/* the editor's one color for a widget with no group (same look as a value's color input, js/widget-editor-color.js) */
.bc-wge-colorone{flex:0 0 auto;width:2.2rem;height:1.6rem;padding:0;border:1px solid var(--hairline);border-radius:4px;background:var(--surface);cursor:pointer}

/* ---- the 3D look ---- */
@media screen and (prefers-reduced-motion:no-preference) and (not (forced-colors:active)){
@supports (color:color-mix(in srgb,red,blue)){
  .bc-wg[data-3d]{--wg-d:3px;--wg-lip:rgb(255 255 255 / .5);--wg-groove:rgb(0 0 0 / .14);--wg-cast:rgb(0 0 0 / .18)}
  .bc-wg[data-3d][data-narrow]{--wg-d:2px}

  /* bars and the meter: a recessed slot with a raised block in it. The slot gives up --wg-d above and at its right end
     so the top and side faces stay inside the row (the row's own 3px gap takes the rest of the depth); the front face is as
     long as it was, relative to the slot. */
  .bc-wg[data-3d] :is(.bc-wg-track,.bc-wg-meter){height:8px;border-radius:0;margin:max(0px,calc(var(--wg-d) - 3px)) var(--wg-d) 0 0;box-shadow:inset 1px 1px 0 var(--wg-groove)}
  /* a bar row keeps the height it had: the slot is 3px thicker, so it takes 3px back from the row's bottom (the list's 6px gap) */
  .bc-wg[data-3d] .bc-wg-track{margin-bottom:-3px}
  .bc-wg[data-3d] .bc-wg-meter{margin-right:0}
  .bc-wg[data-3d] .bc-wg-bar[data-state] > .bc-wg-track{box-shadow:inset 1px 1px 0 var(--wg-groove),inset -2px 0 0 var(--wg-state)}
  .bc-wg[data-3d] :is(.bc-wg-track,.bc-wg-meter) > i{border-radius:0;box-shadow:inset 0 1px 0 var(--wg-lip);
    --wg-c:var(--bc-gauge-arc,#a57e09);--wg-top:color-mix(in srgb,var(--wg-c) 68%,white);--wg-side:color-mix(in srgb,var(--wg-c) 70%,black)}
  .bc-wg[data-3d] .bc-wg-bar:is([data-other],[data-blank]) .bc-wg-track > i{--wg-c:var(--ink-2)}
  .bc-wg[data-3d][data-state] .bc-wg-meter > i{--wg-c:var(--wg-state)}
  .bc-wg[data-3d] .bc-wg-track > i.bc-wg-sg{box-shadow:inset 1px 0 0 var(--surface),inset 0 1px 0 var(--wg-lip)}
  /* the top face: the front face's length, up by --wg-d, leaning right by --wg-d (skewed from its bottom-left corner) */
  .bc-wg[data-3d] :is(.bc-wg-track,.bc-wg-meter) > i::before{content:"";position:absolute;left:0;bottom:100%;width:100%;height:var(--wg-d);
    background:var(--wg-top);transform:skewX(-45deg);transform-origin:0 100%;pointer-events:none}
  /* the side face: the right end, --wg-d wide, leaning up by --wg-d; a stack has one, on its last segment */
  .bc-wg[data-3d] :is(.bc-wg-track,.bc-wg-meter) > i:not(.bc-wg-sg)::after,.bc-wg[data-3d] .bc-wg-track > i.bc-wg-end::after{content:"";position:absolute;left:100%;top:0;
    width:var(--wg-d);height:100%;background:var(--wg-side);transform:skewY(-45deg);transform-origin:0 0;box-shadow:1px 1px 0 var(--wg-cast);pointer-events:none}
  .bc-wg[data-3d] :is(.bc-wg-track,.bc-wg-meter) > i[data-zero]::before,.bc-wg[data-3d] :is(.bc-wg-track,.bc-wg-meter) > i[data-zero]::after{display:none}

  /* the flat ring and the donut: the same shape again, straight down, darker, under the face */
  .bc-wg[data-3d] .bc-gauge-ex,.bc-wg[data-3d] .bc-wg-ex{display:inline;filter:brightness(.7)}
  .bc-wg[data-3d] .bc-wg-sheen{display:inline}
  .bc-gauge-ex-track{fill:none;stroke:var(--hairline);stroke-width:6}
  .bc-gauge-ex-arc{fill:none;stroke:var(--bc-gauge-arc,#a57e09);stroke-width:6;stroke-linecap:round}
  .bc-wg[data-state] .bc-gauge-ex-arc{stroke:var(--wg-state)}
  .bc-wg-dn-ex{fill:none;stroke-width:8}
}
}
