/* wikimusic - the free music knowledge encyclopaedia
 *
 * SPDX-License-Identifier: MIT
 * Copyright © Josep Bigorra <jjbigorra@gmail.com>
*/

/*
  The interface's own sheet, read after the Olive bundle it is built on.

  Everything the pages are painted with is a utility class, and the bundle in
  `wikimusic.olive.min.css' defines them all.  What is here is the other kind
  of rule: the handful of decisions a utility cannot state -- a property no
  class names (the colour scheme of the browser's own controls, the tab stop
  of a tablature, ligatures that would close it up) and a preference a reader
  states in their browser rather than in the page.  Keeping them together
  keeps the markup about the page rather than about the browser.

  Olive ships first and this sheet second, so a utility in the markup still
  wins over a base rule here: nothing below is !important, and nothing below
  restates a decision the markup can already make.
*/

/* ===== The brand =====

   Two inks, and the type the wordmark is set in.  Everything else the site is
   painted with is a utility class from the bundle; this is the handful of
   decisions that are the *project's* rather than a framework's, so they live
   here, once, and the pages read them by name.

   The pink is Olive's `persia-pink` -- the accent every border, link and
   highlight on the site is already drawn from -- so the wordmark, the mark and
   the favicon are the same colour as the page around them instead of a third
   shade of their own.  The dark theme is not a tint of the light one: it steps
   to the lighter pinks, because a deep pink on a dark page is a smudge. */

:root {
  --wm-brand: oklch(0.6904 0.1399 348.9);
  --wm-brand-hover: oklch(0.6404 0.1399 348.9);
  --wm-ink: oklch(0.2588 0.0044 247.95);
  --wm-paper: oklch(0.987 0.0013 286.37);
}

[data-theme="dark"] {
  --wm-brand: oklch(0.7904 0.1399 348.9);
  --wm-brand-hover: oklch(0.8404 0.1399 348.9);
}

/* The wordmark: the name set tight and slightly heavier than the page's own
   type, with the second half in the brand's ink.  It is the one element that
   says whose site a reader is on, so it is the one element that is not a
   utility class. */

.wm-wordmark {
  font-weight: 600;
  letter-spacing: -0.015em;
}

.wm-wordmark-accent {
  color: var(--wm-brand);
  transition: color 150ms ease;
}

a:hover .wm-wordmark-accent,
a:focus-visible .wm-wordmark-accent {
  color: var(--wm-brand-hover);
}

/* The bar's controls answer the pointer in the brand's ink too.  The rule is on
   the bar rather than on each control because a control is a button-shaped
   span inside an anchor, and every one of them names its own colour: without
   the second rule the ink would stop at the anchor and the glyphs and labels
   inside would keep their own. */

/* An anchor with no colour of its own is painted in the browser's link blue.
   Every control in the bar names its colour on the span inside it, so the
   anchor itself only ever showed that blue in the gaps -- a visited link, a
   selection, a reader's own stylesheet.  The bar's ink is the page's ink. */
.wm-nav a {
  color: inherit;
}

.wm-nav a:hover,
.wm-nav a:focus-visible {
  color: var(--wm-brand);
}

.wm-nav a:hover *,
.wm-nav a:focus-visible * {
  color: inherit;
}

/* The trap an article's comment form carries.

   A spam script that fills every field it finds is caught by a field a reader
   never meets, so the field has to exist in the markup and be out of the
   reader's way at the same time.  It is laid out off the page rather than
   `display: none', because the cheaper kind of bot reads the markup and skips
   what is hidden -- and never `visibility: hidden' either, for the same
   reason.  A screen reader does not reach it: the wrapper is `aria-hidden' and
   the field itself is out of the tab order. */

.wm-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ===== An entity's tile =====

   A list is a shelf of covers, and a cover is a picture with a name under it.
   The tile is therefore one object -- picture, name, credit -- and its surface,
   its edge, its shadow and its two inks are stated once, here, per theme,
   instead of being reassembled from utilities.  A utility that the bundle
   happens not to carry fails silently, which is how the credit line ended up
   in the page's ink on the dark theme and vanished; a token cannot.

   The dark theme is not the light one inverted.  The card lifts off the page
   by being lighter than it, not darker, and its shadow is black rather than a
   tint of the ink, because a shadow of the ink on a dark page is no shadow at
   all. */

.wm-tile {
  --wm-tile-surface: color-mix(in oklch, white 98%, var(--wm-brand));
  --wm-tile-line: color-mix(in oklch, var(--wm-ink) 12%, transparent);
  --wm-tile-ink: color-mix(in oklch, var(--wm-ink) 94%, transparent);
  --wm-tile-quiet: color-mix(in oklch, var(--wm-ink) 58%, transparent);
  border: 1px solid var(--wm-tile-line);
  border-radius: 0.9rem;
  background: var(--wm-tile-surface);
  box-shadow: 0 1px 2px color-mix(in oklch, var(--wm-ink) 7%, transparent),
              0 10px 22px -18px color-mix(in oklch, var(--wm-ink) 65%, transparent);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

[data-theme="dark"] .wm-tile {
  --wm-tile-surface: color-mix(in oklch, var(--wm-ink) 84%, white);
  --wm-tile-line: color-mix(in oklch, white 11%, transparent);
  --wm-tile-ink: color-mix(in oklch, white 94%, var(--wm-ink));
  --wm-tile-quiet: color-mix(in oklch, white 72%, var(--wm-ink));
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.4),
              0 14px 28px -20px rgb(0 0 0 / 0.75);
}

@media (min-width: 640px) {
  .wm-tile {
    border-radius: 1.1rem;
  }
}

/* The lift is for a pointer that can hover; a touch screen would keep the
   raised state stuck after a tap, so there it only gets the border. */
.wm-tile:focus-within {
  border-color: color-mix(in oklch, var(--wm-brand) 45%, transparent);
}

@media (hover: hover) {
  .wm-tile:hover {
    transform: translateY(-2px);
    border-color: color-mix(in oklch, var(--wm-brand) 45%, transparent);
    box-shadow: 0 2px 4px color-mix(in oklch, var(--wm-ink) 9%, transparent),
                0 20px 36px -22px color-mix(in oklch, var(--wm-brand) 50%, transparent);
  }
}

.wm-tile-body {
  padding: 0.6rem 0.75rem 0.7rem;
}

@media (min-width: 640px) {
  .wm-tile-body {
    padding: 0.7rem 0.85rem 0.85rem;
  }
}

.wm-tile-cover {
  position: relative;
}

/* A bright cover and a dark one end on the same edge: the picture is faded
   into the panel it stands on rather than butted against it. */
.wm-tile-cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 16%;
  pointer-events: none;
  background: linear-gradient(to top,
                              color-mix(in oklch, var(--wm-tile-surface) 40%, transparent),
                              transparent);
}

.wm-tile-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--wm-tile-ink);
  font-family: inherit;
  font-size: clamp(0.9rem, 0.82rem + 0.3vw, 1.02rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.012em;
  text-wrap: balance;
  text-decoration: none;
  transition: color 150ms ease;
}

.wm-tile-name:hover {
  color: var(--wm-brand);
}

.wm-tile-by {
  overflow: hidden;
  margin: 0;
  color: var(--wm-tile-quiet);
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.wm-tile-by-link {
  color: inherit;
  border-bottom: 1px solid color-mix(in oklch, currentColor 22%, transparent);
  text-decoration: none;
  transition: color 150ms ease, border-color 150ms ease;
}

.wm-tile-by-link:hover {
  color: var(--wm-brand);
  border-bottom-color: currentColor;
}

/* ===== A song page's sections =====

   Every section of a song page -- the cover, the metronome, the size of the
   tablature, the tablature itself -- starts on the same left edge, so the page
   reads as one column rather than as a stack of blocks that each chose their
   own margin.  A setting is a label and its control on one line, which is what
   it is: one word and the thing it names. */

.wm-song-setting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 1.25rem;
}

.wm-song-setting h3 {
  margin: 0;
  font-size: 0.95rem;
}

.wm-song-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  /* The page's own gutter is the reading column's: the tab, its legend and a
     PDF are the widest things here, and a second gutter on top of the page's
     pushed the first line of a 34-column tab off a 360px screen. */
  padding: 0.5rem 0;
}

/* The sections in the reading column sit closer than they do elsewhere on the
   page: a tab is read line by line, so the space above it is the reader's. */
.wm-song-content .wm-disclosure {
  margin-block: 0.5rem;
}

/* ===== A tablature reads to the edge of the page =====

   A tab is columns, so every pixel of padding is a column, and a phone has no
   reading column to keep: the tab is the page.  On a narrow screen the paper
   therefore reaches back over the shell's own gutter -- the 0.56rem every page
   is inset by -- and keeps a hair of it, its border, and enough room that a
   line of characters does not touch the border it is drawn against.  The paper
   keeps its border and its radius, so the music still sits on something rather
   than floating on the page.

   The reach is a negative margin because the gutter belongs to the shell and
   not to this block: a `pre' cannot unpad the page, and it should not -- the
   paragraphs beside it want that gutter. */

@media (max-width: 639px) {
  pre.wm-ascii {
    padding: 0.35rem 0.2rem;
    margin-inline: -0.4rem;
  }
}

/* A PDF is a page inside a page: inset margins only make the document it shows
   smaller, so on a narrow screen it reaches the same edge the tab does, and
   keeps on a desktop the width of the column it belongs to.  The reach stays
   under the shell's gutter, because a frame wider than its column is a page
   that scrolls sideways. */

.wm-reading-frame {
  display: block;
  width: 100%;
  min-height: 85vh;
  border: 0;
  border-radius: 0.75rem;
}

@media (max-width: 767px) {
  .wm-reading-frame {
    width: calc(100% + 0.8rem);
    margin-inline: -0.4rem;
    min-height: 90vh;
    border-radius: 0;
  }
}

/* ===== Three sizes, three targets =====

   The tile-size chooser is three glyphs on a hairline of border, and at its
   written padding each was a 24px square: legal, and the smallest thing left to
   hit on a phone.  The square grows on a narrow screen while the card waits for
   a pointer that is precise. */

@media (max-width: 639px) {
  .wm-tile-size a {
    min-width: 2.5rem;
    min-height: 2.5rem;
    justify-content: center;
  }
}

/* ===== The language control =====

   A reader who cannot read the page is the one reader this control exists for,
   so its name stays written out beside the menu rather than folded into a
   glyph.  That name, the menu and the button that applies the choice do not fit
   one 360px row: the button was the piece that gave way and landed alone under
   the card, which reads as a stray control rather than as part of the same
   question.  On a phone the menu therefore takes a row of its own and the
   button sits beside it, where a thumb can reach both and neither is orphaned.
   The card itself stops at the width of the column it sits in. */

.wm-locale {
  max-width: 100%;
}

@media (max-width: 479px) {
  /* Two rows, stated rather than left to wrap: wrapping happened to put the
     menu on the first row and the button alone on the second, which is the one
     arrangement that separates the choice from the control that applies it. */
  .wm-locale {
    display: grid;
    width: 100%;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "icon label label"
      "menu menu use";
    row-gap: 0.25rem;
  }

  .wm-locale > i {
    grid-area: icon;
  }

  .wm-locale > label {
    grid-area: label;
    text-align: start;
  }

  .wm-locale > div {
    grid-area: menu;
    min-width: 0;
  }

  .wm-locale div > select {
    width: 100%;
  }

  .wm-locale > button {
    grid-area: use;
    min-height: 2.75rem;
    justify-content: center;
  }
}

/* ===== A bar a thumb can hit =====

   Seven controls on a 360px phone, each of them a word and a glyph: at the
   bar's desktop padding they were 24px tall and their labels 12px, which is
   below the 44px a thumb is usually promised and below the 16px a phone is
   asked not to zoom past.  The size goes up on the small screen and the
   padding follows it; the bar wraps onto a second row rather than squeezing
   the labels, because a wrapped bar is still a bar and a shrunk one is not
   readable. */

@media (max-width: 639px) {
  .wm-nav a {
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
  }

  .wm-nav a > span {
    font-size: 0.9375rem;
  }

  /* Seven controls at a readable size make two rows on a phone, and a bar that
     is pinned to the top of a 640px-tall screen cannot spend 140px of it.  The
     row stays one row and scrolls sideways instead: the next control is always
     half visible, which is what tells a thumb there is more of it.  The scroll
     bar itself is hidden because it would be a second bar under the first. */
  .wm-nav > div:last-child {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .wm-nav > div:last-child::-webkit-scrollbar {
    display: none;
  }
}

/* ===== The size of a tablature =====

   Three things in one pill: a step smaller, the share the tab is drawn at, and
   a step larger.  The middle is a menu of the whole ladder, so a reader who
   wants the largest does not have to press six times -- and it is as wide as
   its widest value in tabular figures, because a control that changed width
   with its own number would move under the pointer that is using it. */

.wm-size-control {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.15rem;
  border: 1px solid color-mix(in oklch, var(--wm-brand) 25%, transparent);
  border-radius: 9999px;
  background: color-mix(in oklch, white 80%, transparent);
  box-shadow: 0 1px 2px color-mix(in oklch, var(--wm-ink) 7%, transparent);
}

[data-theme="dark"] .wm-size-control {
  border-color: color-mix(in oklch, white 13%, transparent);
  background: color-mix(in oklch, var(--wm-ink) 84%, white);
  box-shadow: none;
}

.wm-size-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  border-radius: 9999px;
  color: color-mix(in oklch, var(--wm-ink) 55%, transparent);
  transition: background-color 150ms ease, color 150ms ease;
}

[data-theme="dark"] .wm-size-step {
  color: color-mix(in oklch, white 70%, var(--wm-ink));
}

a.wm-size-step:hover {
  background: color-mix(in oklch, var(--wm-brand) 16%, transparent);
  color: var(--wm-brand);
}

.wm-size-step[aria-disabled="true"] {
  opacity: 0.3;
  cursor: not-allowed;
}

.wm-size-select {
  width: 4.25rem;
  padding: 0.25rem 0.1rem;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--wm-brand);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.wm-size-select:hover {
  background: color-mix(in oklch, var(--wm-brand) 12%, transparent);
}

.wm-size-select:focus-visible {
  outline: 2px solid var(--wm-brand);
  outline-offset: 2px;
}

/* The paper and face menus answer in a word, not in a share, so they are as
   wide as that word instead of as wide as the size's figure. */

.wm-size-select.wm-choice-select {
  width: auto;
  padding-inline: 0.6rem;
}

/* ===== The search =====

   One pill holding the field and the control that sends it: the two share a
   rounded edge instead of sitting beside each other as two boxes, and the
   group says which one has the caret by taking the brand's own border.  The
   field loses its edge inside it, so the only line a reader sees is the
   group's. */

.wm-search {
  border: 2px solid color-mix(in oklch, var(--wm-brand) 40%, transparent);
  border-radius: 9999px;
  overflow: hidden;
  transition: border-color 200ms ease-in-out;
}

.wm-search:focus-within {
  border-color: var(--wm-brand);
}

.wm-search label {
  display: none;
}

.wm-search-field {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  outline: none;
  min-width: 0;
}

.wm-search-field::placeholder {
  color: inherit;
  opacity: 0.55;
}

.wm-search-button {
  border: 0;
  border-left: 2px solid color-mix(in oklch, var(--wm-brand) 35%, transparent);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: background-color 200ms ease-in-out;
}

.wm-search-button:hover {
  background: color-mix(in oklch, var(--wm-brand) 16%, transparent);
}

.wm-search-button:active {
  background: color-mix(in oklch, var(--wm-brand) 24%, transparent);
}

.wm-search-button:focus-visible {
  outline: 2px solid var(--wm-brand);
  outline-offset: -4px;
}

/* ===== A carousel's own controls =====

   The track scrolls with snap points and needs none of this; what is here is
   the part a scrolled list cannot say -- where in the set a reader is.  The
   dot of the slide being looked at is drawn long, so the set has a shape and
   not only a number. */

.wm-carousel-dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding-block: 0.35rem;
}

.wm-carousel-dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: currentColor;
  opacity: 0.25;
  cursor: pointer;
  transition: opacity 200ms ease-in-out, width 200ms ease-in-out;
}

.wm-carousel-dot[aria-current="true"] {
  width: 1.5rem;
  opacity: 0.85;
}

.wm-carousel-dot:focus-visible {
  outline: 2px solid var(--wm-brand);
  outline-offset: 2px;
}

.wm-carousel-count {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
}

.carousel-list {
  /* The dots and the counter already say where in the set the reader is, and a
     native bar under a picture reads as a broken track.  It still scrolls. */
  scrollbar-width: none;
}

.carousel-list::-webkit-scrollbar {
  display: none;
}

.carousel-list-item {
  scroll-snap-align: center;
}

/* ===== The editor =====

   The form is grouped the way a contributor thinks -- the song, the album, the
   words -- rather than as one column of inputs, and the control that saves it
   is pinned to the bottom of the viewport: a long description scrolls the page
   under the form, and the button that ends the job must not scroll with it. */

.wm-editor-group {
  border: 1px solid color-mix(in oklch, var(--wm-brand) 22%, transparent);
  border-radius: 1rem;
  padding: 0.75rem 1rem 1rem;
  margin: 0;
}

.wm-editor-legend {
  padding-inline: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.wm-editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-block: 0.75rem;
  border-top: 1px solid color-mix(in oklch, var(--wm-brand) 22%, transparent);
  background: color-mix(in oklch, var(--wm-paper) 90%, transparent);
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .wm-editor-actions {
  background: color-mix(in oklch, var(--wm-ink) 88%, transparent);
}

/* ===== The scheme the browser's own controls are drawn in =====

   A page styles what it draws and the browser styles the rest: the scrollbar
   of a long page, the list a `select' opens, the spinners of a number field,
   the caret in an input, the highlight of a chosen line.  All of those are
   painted by the browser, and by default they are painted light -- so a
   reader on the dark theme opens a white menu from a dark page.

   `color-scheme' is how a page says which of its two themes it is showing.
   It is read per element and inherited, so the root states it once, and the
   attribute the theme switch already writes (`data-theme', see
   `hygguileToggleDarkTheme') is what selects which. */

:root {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
}

/* ===== A tablature is read as a grid of columns =====

   An ascii tab -- or a chord chart, or a lyric sheet -- is monospaced for a
   reason: a column of characters is a string, and a string that shifts by
   half a character is a different note.  Two things break those columns even
   in a monospaced face:

   - A tab character is not a monospaced character.  It is a jump to the next
     tab stop, and the stop is a browser decision: eight characters by
     default, which puts a stored tab in a different column than the author's
     editor did.  Four is what the editors these tabs were written in used.
   - A ligature is one glyph for two or more characters -- `=>', `|=', `||='.
     JuliaMono, the face the interface is set in, ships them, and a
     ligature is one character wide where its characters were two, so a run
     containing one closes up and every column after it moves.

   So the block is given the stop it was written against and the ligatures
   are turned off. `line-height' stays loose enough to read: leading moves
   the rows, not the glyphs, so it costs the columns nothing. */

/* The columns are held still by four things, and all four have to be here:
   the stop a tab jumps to, the ligatures turned off, the kerning turned off
   (a pair of characters set closer than a monospaced cell is a note moved by
   half a character), and a letter spacing of zero.  `font-variant-numeric' is
   the fifth: the digits of a fret are the widest thing in a tab, and a tab
   that set them at a proportional width would shift every column on the line.
   The leading is loose because a reader scans a tab by its rows, and it costs
   the columns nothing: leading moves the lines, not the glyphs inside one. */

.wm-ascii {
  tab-size: 4;
  line-height: 1.5;
  font-variant-ligatures: none;
  font-variant-numeric: tabular-nums;
  font-kerning: none;
  letter-spacing: 0;
  word-spacing: 0;
  text-rendering: optimizeSpeed;
}

/* ===== A legend, quieter than the tab it explains

   A legend is a key to the marks a tab uses, not the music, and it arrived as
a second sheet of paper the same size and weight as the tab it described.
It is prose, so it is set as prose -- smaller, in the ink the page's own
reading text is set in, and marked by a hairline down its edge instead of by
a border and a fill -- which leaves the tab as the one thing on the page that
looks like a page.  The measure stops at a reading width so a long note does
not run the width of a desk. */

.wm-ascii-legend {
  max-width: 65ch;
  margin-block: 0.5rem 1.5rem;
  padding-inline-start: 1rem;
  border-inline-start: 2px solid color-mix(in oklch, var(--wm-ink) 15%, transparent);
  color: color-mix(in oklch, var(--wm-ink) 72%, transparent);
  font-size: 0.9rem;
  line-height: 1.55;
}

[data-theme="dark"] .wm-ascii-legend {
  border-inline-start-color: color-mix(in oklch, white 15%, transparent);
  color: color-mix(in oklch, white 70%, var(--wm-ink));
}

.wm-ascii-legend > :first-child {
  margin-block-start: 0;
}

.wm-ascii-legend > :last-child {
  margin-block-end: 0;
}

/* ===== The `hidden` attribute means hidden =====

   Every script-driven control on a song page -- the metronome, the tablature's
   own controls, the tuner -- is written into the page with `hidden' and is
   un-hidden by the script that can drive it.  A page's utilities are classes,
   and a class that sets a display wins over the browser's own rule for the
   attribute, which is how a control that had never been turned on was drawn
   anyway.  The attribute is what the page means, so it keeps the last word. */

[hidden] {
  display: none !important;
}

/* ===== A tuner's meter =====

   A line with ticks and a marker that travels along it: the needle is where a
   string is, the middle is where it should be.  The marker's place is the
   `--wm-cents' the script writes, which is the reading in cents, so the shape
   of the meter is this stylesheet's business and the number is the script's.

   The colour is `currentColor' and the ink is the markup's, so the meter is
   painted with the page's palette in either theme; the one colour named here is
   the one that means "in tune", which is not a colour the palette has a name
   for. */

.wm-tuner-meter {
  position: relative;
  height: 3rem;
  margin-block: 0.25rem;
}

.wm-tuner-track {
  position: absolute;
  inset-inline: 0;
  top: 50%;
  height: 2px;
  background: currentColor;
  opacity: 0.2;
}

.wm-tuner-tick {
  position: absolute;
  top: calc(50% - 0.35rem);
  width: 1px;
  height: 0.7rem;
  background: currentColor;
  opacity: 0.3;
}

.wm-tuner-tick-centre {
  top: calc(50% - 0.7rem);
  height: 1.4rem;
  opacity: 0.55;
}

.wm-tuner-needle {
  position: absolute;
  top: calc(50% - 1.15rem);
  left: calc(50% + var(--wm-cents, 0) * 1%);
  width: 0.3rem;
  height: 2.3rem;
  border-radius: 9999px;
  background: currentColor;
  transform: translateX(-50%);
  transition: left 90ms linear;
}

[data-in-tune="true"] .wm-tuner-needle {
  background: #3f6212;
}

[data-theme="dark"] [data-in-tune="true"] .wm-tuner-needle {
  background: #a3e635;
}

/* The string a reader is nearest, and the one being sounded: a ring around the
   string rather than a colour of its own, so the note and its frequency keep
   the ink the rest of the page is read in. */

.wm-tuner-string[data-active="true"] {
  border-color: currentColor;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.wm-tuner-string[data-sounding="true"] {
  border-color: currentColor;
  outline: 2px dashed currentColor;
  outline-offset: 2px;
}

/* ===== Where a skip link lands =====

   The content a reader who skipped the navigation lands on is the top of the
   page's own body, which sits under a bar that stays put.  `scroll-margin'
   is the space the browser leaves between the edge of the viewport and the
   element it scrolls to, so the bar covers this much of the page instead of
   the first line of what was jumped to.  Six rem is the bar at its tallest
   plus the room a heading needs to be read as a heading. */

.wm-skip-target {
  scroll-margin-top: 6rem;
}

/* ===== A disclosure that says it opens =====

   A song page folds its tab, its legend and any PDF into `<details>`, so a
   reader who came for one of them is not made to scroll past the others.
   `<details>` opens and closes with no script, but the browser's own marker
   is a triangle the size and colour of the text, and it does not turn -- a
   section that folds looks exactly like a section that does not.  So the
   marker is dropped and the chevron the markup draws is turned instead, over
   one transition, the way a control that moves should.

   The rules are those two: the summary is the trigger, the mark inside it is
   what turns when the block is open.  Nothing is drawn here that the page
   does not already put in the markup, which is why the mark is the markup's
   own `<span>` rather than a pseudo-element. */

.wm-disclosure > summary {
  list-style: none;
  cursor: pointer;
}

.wm-disclosure > summary::-webkit-details-marker {
  display: none;
}

.wm-disclosure-mark {
  display: inline-flex;
  transition: transform 200ms ease;
}

.wm-disclosure[open] > summary .wm-disclosure-mark {
  transform: rotate(180deg);
}

/* ===== The first control on a page =====

   A way past the navigation, for a reader on a keyboard or a screen reader
   who has already read it on the page they came from.  It sits above the
   viewport until it takes focus and then slides into the corner, which is
   the one place on a page where motion is not decoration: it is how the
   reader sees that the control they pressed is the one now on screen.

   `top: 0' and `inset-inline-start: 0' are the corner in either direction of
   writing, and the z-index puts it above the bar it skips over. */

.wm-skip-link {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  z-index: 96;
  padding: 0.75rem 1rem;
  border-end-end-radius: 0.75rem;
  background: var(--wm-ink);
  color: var(--wm-paper);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-130%);
  transition: transform 160ms ease;
}

[data-theme="dark"] .wm-skip-link {
  background: var(--wm-paper);
  color: var(--wm-ink);
}

.wm-skip-link:focus,
.wm-skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ===== Reduced motion =====

   The motions above are switched off here rather than in each rule, so a
   rule added under one of these headings is covered by the preference
   without having to remember it. */

@media (prefers-reduced-motion: reduce) {
  .wm-disclosure-mark,
  .wm-skip-link,
  .wm-tuner-needle,
  .wm-wordmark-accent {
    transition: none;
  }
}

/* ===== Anchors that travel rather than jump =====

   A page that holds a long tablature and a legend under it is read by
   jumping between them (see the ascii contents and the back-to-the-top
   control), and a jump that arrives in one frame loses the reader's place.
   Smooth scrolling is the difference between "I was scrolled somewhere" and
   "I followed the link".  A reader who has asked their machine for less
   motion gets the instant jump, which is what that preference is for -- the
   media query below is the whole of it, so there is nothing for a
   reduced-motion block to switch back off. */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

