/* Bridges board in the Puzzle Box: the game's islands, rings and bridges on the cabinet's paper and ink. Luke Steuber. */
.bx-bridges{position:relative;flex:none;margin:auto;width:calc(var(--cell)*var(--w));height:calc(var(--cell)*var(--h));color:var(--ink);touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.bx-bridges *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.bx-bridges svg.routes{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;fill:none;stroke:currentColor}

/* Islands. Complete clues settle to the guide tone; the full ring says the same without hue. */
.bx-bridges .island{position:absolute;display:grid;place-items:center;left:calc((var(--x) + .5)*var(--cell));top:calc((var(--y) + .5)*var(--cell));transform:translate(-50%,-50%);width:calc(var(--cell)*.8);height:calc(var(--cell)*.8);min-width:24px;min-height:24px;max-width:84px;max-height:84px;padding:0;border:2px solid var(--ink);border-radius:50%;background:var(--bg);color:var(--ink);font:500 clamp(14px,calc(var(--cell)*.31),30px)/1 var(--mono);touch-action:none;cursor:pointer;transition:background-color .7s,color .7s,border-color .7s}
.bx-bridges .island:focus-visible{z-index:3;outline:none}
.bx-bridges .island:focus-visible .island-label{text-decoration:underline;text-underline-offset:5px}
.bx-bridges .fullness{position:absolute;inset:3px;width:calc(100% - 6px);height:calc(100% - 6px);fill:none;stroke:currentColor;pointer-events:none;transition:opacity .6s}
.bx-bridges .fullness-track{stroke-width:2;opacity:.14}
.bx-bridges .fullness-fill{stroke-width:4}
.bx-bridges .fullness-port{stroke-width:2}
.bx-bridges .island.overfull .fullness-fill{stroke-dasharray:4 3}
.bx-bridges .island.satisfied{color:var(--guide);border-color:var(--guide)}
.bx-bridges .island.selected{background:var(--line);border-width:3px}
.bx-bridges .island.evidence{border-style:dashed;border-width:3px}
.bx-bridges .island.region{outline:4px double currentColor;outline-offset:3px}
.bx-bridges .island.rule-error{outline:2px dashed currentColor;outline-offset:5px}
.bx-bridges .island.hint-target{outline:3px solid var(--ink);outline-offset:6px;animation:bx-bridges-pulse 650ms 2}
.bx-bridges .island-label{transition:opacity .65s}

/* Bridges, previews and marks, in board units. */
.bx-bridges .route{stroke-width:.028;stroke-linecap:round}
.bx-bridges .route.candidate-guide{stroke-dasharray:.025 .09;stroke-width:.018;opacity:.3}
.bx-bridges .route.evidence-route{stroke-dasharray:.09 .06;stroke-width:.045}
.bx-bridges .route.hint-route{stroke-dasharray:.07 .06;stroke-width:.07;animation:bx-bridges-pulse 650ms 2}
.bx-bridges .route.illegal{stroke-dasharray:.05 .05;stroke-width:.06}
.bx-bridges .preview{stroke-dasharray:.08 .07;stroke-width:.045;opacity:.7}
.bx-bridges .preview.removing{opacity:.25;stroke-dasharray:.02 .12}
.bx-bridges .cross-mark{stroke-width:.05}
.bx-bridges .route-lock{stroke:var(--ink);stroke-width:.014;fill:var(--bg);pointer-events:none}
.bx-bridges .route-lock path{fill:none}

/* The + controls on a selected island's open routes. */
.bx-bridges .route-control{position:absolute;transform:translate(-50%,-50%);width:44px;height:44px;display:grid;place-items:center;z-index:4;padding:0;border:0;background:transparent;color:var(--ink);touch-action:manipulation;font:500 14px/1 var(--mono)}
.bx-bridges .route-control[hidden]{display:none}
.bx-bridges .route-control span{display:grid;place-items:center;width:26px;height:26px;border:1px solid var(--guide);border-radius:5px;background:var(--bg)}
.bx-bridges .route-control:hover span,.bx-bridges .route-control:active span{border-color:var(--ink);background:var(--lit)}
.bx-bridges .route-control[data-count="1"] span,.bx-bridges .route-control[data-count="2"] span{visibility:hidden}
.bx-bridges .route-control:focus-visible{outline-offset:0}

/* Solved: the network stands in solid ink, rods taut, posts blank. */
.bx-bridges.solved .island{background:var(--ink);border-color:var(--ink);color:var(--bg);cursor:default}
.bx-bridges.solved .island-label,.bx-bridges.solved .fullness{opacity:0}
.bx-bridges.solved .route{stroke-width:.042}
.bx-bridges.unlocking .island,.bx-bridges.unlocking .island-label,.bx-bridges.unlocking .fullness{transition:none}
.bx-bridges .pulse{stroke:var(--ink);stroke-width:.045;stroke-linecap:butt;stroke-dasharray:1 1;stroke-dashoffset:1}

@keyframes bx-bridges-pulse{50%{opacity:.3}}
@media(prefers-reduced-motion:reduce){.bx-bridges *{animation:none!important;transition:none!important}}
:root[data-motion=reduce] .bx-bridges *{animation:none!important;transition:none!important}
@media(forced-colors:active){.bx-bridges .island{forced-color-adjust:none;background:Canvas;color:CanvasText;border-color:CanvasText}.bx-bridges.solved .island{background:CanvasText;color:Canvas}.bx-bridges .island.selected{background:Highlight;color:HighlightText}.bx-bridges .routes{color:CanvasText}}
