/* The reader's own styles; the header comes from header.css */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    overscroll-behavior: none;
}

body {
    background: var(--bg);
    color: var(--fg);
    font: 16px/1.5 system-ui, sans-serif;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover,
a[aria-current] {
    color: var(--hi);
}

:root {
    --chords-grid-columns: 1;
    interpolate-size: allow-keywords;
}

main {
    padding: 0 1rem 70px;
}

.search {
    position: sticky;
    top: 0;
    z-index: var(--z-search);
    padding: .75rem 0;
    background: var(--bg);
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group > * {
    min-height: var(--tap);
    border: 1px solid var(--control);
    border-radius: 0;
}

.input-group > :not(:first-child) {
    margin-left: -1px;
}

.input-group > :first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.input-group > :last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.input-group > :only-child {
    border-radius: var(--radius);
}

.input-group > :focus-visible {
    position: relative;
    outline-offset: 0;
}

.input-group .addon {
    display: flex;
    align-items: center;
    padding: .375rem .75rem;
    background: var(--bar);
    color: var(--muted);
    white-space: nowrap;
}

.input-group .count {
    font-variant-numeric: tabular-nums;
}

.input-group input {
    flex: 1;
    min-width: 0;
    font: inherit;
    padding: .375rem .75rem;
    background: var(--bg);
    color: inherit;
}

.song {
    scroll-margin-top: calc(var(--tap) + 1.5rem);
    padding-left: .5rem;
    border-bottom: 1px solid var(--line);
    border-left: .25rem solid transparent;
}

.song[open] {
    border-left-color: var(--accent);
}

.song > summary {
    min-height: var(--tap);
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: .5rem 0;
    cursor: pointer;
    list-style: none;
}

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

.song > summary::after {
    content: "";
    margin: 0 .5rem 0 auto;
    align-self: center;
    width: .6em;
    height: .6em;
    border: solid var(--muted);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    transition: transform .25s;
}

.song[open] > summary::after {
    transform: rotate(225deg);
}

.song::details-content {
    block-size: 0;
    overflow: hidden;
    transition: block-size .25s ease, content-visibility .25s allow-discrete;
}

.song[open]::details-content {
    block-size: auto;
}

.song h2,
.num {
    font-size: min(2rem, calc(1.325rem + .9vw));
    font-weight: 500;
    line-height: 1.2;
    margin: 0;
}

.song h2 {
    display: inline;
}

.song small {
    color: var(--muted);
}

.song.archived h2,
.song.archived .num {
    color: var(--hi);
}

.num {
    min-width: 1.8em;
}

.tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin: .25rem 0 .5rem;
}

.stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--control);
    border-radius: var(--radius);
}

.stepper .sb-btn {
    border: 0;
}

.stepper output {
    min-width: 2.5em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.tools .gap {
    margin-left: auto;
}

.capo {
    padding: .25rem .75rem;
    border-radius: var(--radius-pill);
    background: var(--line);
    font-weight: 600;
    white-space: nowrap;
}

.song-text {
    padding: 1rem 0;
    column-count: var(--chords-grid-columns);
    column-gap: 5em;
    width: fit-content;
    max-width: 100%;
    font-size: 1.0625rem;
    line-height: 1.7;
}

.song-text p {
    break-inside: avoid-column;
}

.song-text ruby {
    ruby-position: over;
    ruby-align: start;
}

.chord {
    font-size: .95em;
    font-weight: 700;
    color: var(--accent);
}

span.chord {
    position: relative;
    top: -.5em;
    line-height: 0;
}

rt.chord {
    line-height: 1.2;
}

.hide-chords .chord {
    display: none;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 2rem 0;
}

.progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-panel);
    height: 3px;
    overflow: hidden;
    opacity: 0;
    animation: show 0s .3s forwards;
}

.progress.centered {
    position: static;
    width: min(20rem, 80%);
    height: .5rem;
    margin: 4rem auto .5rem;
    border-radius: var(--radius);
    background: var(--line);
}

.progress-caption {
    margin: 0 0 4rem;
    text-align: center;
    color: var(--muted);
}

.progress > div {
    height: 100%;
    background: var(--accent);
    transform-origin: left;
    transition: transform .2s linear;
}

.progress.indeterminate > div {
    width: 40%;
    animation: slide 1.2s ease-in-out infinite;
}

@keyframes slide {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(250%);
    }
}

@keyframes show {
    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .song::details-content,
    .song > summary::after {
        transition: none;
    }

    .progress > div {
        transition: none;
    }

    .progress.indeterminate > div {
        width: 100%;
        animation: none;
    }
}

.fab {
    position: fixed;
    right: 20px;
    z-index: var(--z-fab);
    font-size: 1.25rem;
}

.fab-top {
    top: calc(var(--tap) + 2rem);
}
