/* The sound bell (sound.js): a bronze ASCII bell hanging on a silk thread in
   the top right corner. Glyphs only, on the scene's character grid: one bell
   character is two scene cells across and two down. */

.snd {
  --cell-w: 6px;
  --cell-h: 10px;
  position: fixed;
  top: 0;
  right: 12px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: calc(var(--cell-h) * 2);
  line-height: calc(var(--cell-h) * 2);
}

.snd pre {
  margin: 0;
  font: inherit;
  line-height: inherit;
  white-space: pre;
}

.snd button {
  font: inherit;
  line-height: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.snd-bell { display: block; position: relative; }
/* the glyphs are redrawn as it rings: keep the pointer on the button itself,
   or a click whose glyph was replaced mid-press would be lost */
.snd-bell pre { pointer-events: none; }
/* a pool of shadow behind the bell (as under the relics in decorations.css),
   so the web's strands fall away and its outline reads cleanly */
.snd::before {
  content: "";
  position: absolute;
  inset: calc(var(--cell-h) * var(--silk-rows, 3) * 2 - var(--cell-h) * 2) calc(var(--cell-w) * -6) calc(var(--cell-h) * -2);
  background: radial-gradient(closest-side, rgba(11, 14, 24, 0.97) 0%, rgba(11, 14, 24, 0.93) 70%, rgba(11, 14, 24, 0) 100%);
  pointer-events: none;
  z-index: -1;
}
.snd { isolation: isolate; }
.snd i { font-style: normal; }
.snd .b { color: var(--ornament, #a8844f); }   /* the bronze */
.snd .g { color: var(--gold, #e3ae5f); }       /* clapper and ring */
.snd .s { color: var(--strand, #7f93a6); }     /* silk */

.snd-bell:hover .b,
.snd-bell:focus-visible .b { color: var(--gold, #e3ae5f); }
.snd-bell:focus-visible { outline: 1px dashed var(--gold, #e3ae5f); outline-offset: 2px; }

/* bound in silk: muted, dimmer bronze */
.snd.is-muted .b { color: var(--bronze, #6e4c24); }
.snd.is-muted .snd-bell:hover .b { color: var(--ornament, #a8844f); }

/* the volume, a row of beads under the bell, shown on hover or focus */
.snd-vol {
  display: flex;
  align-items: center;
  color: var(--text-muted, #b9c2d0);
  font-size: calc(var(--cell-h) * 1.4);
  line-height: calc(var(--cell-h) * 2);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.snd:hover .snd-vol,
.snd:focus-within .snd-vol { opacity: 1; pointer-events: auto; }
.snd-meter { color: var(--gold, #e3ae5f); }
.snd-step { padding: 0 calc(var(--cell-w) * 0.8) !important; }
.snd-step:hover, .snd-step:focus-visible { color: var(--gold, #e3ae5f); }
.snd-step:focus-visible { outline: 1px dashed var(--gold, #e3ae5f); }

/* narrow screens: a smaller bell on a shorter thread, above the title */
@media (max-width: 640px) {
  .snd {
    font-size: calc(var(--cell-h) * 1.4);
    line-height: calc(var(--cell-h) * 1.4);
  }
}

@media (hover: none) {
  .snd-vol { display: none; } /* touch: the bell toggles; the device sets the volume */
}
