/* Primadonna song converter. The look is the game's "word roll" direction:
   manila paper, ink, and the perforation (a short round-ended slot) as the one
   repeated detail. Palette and type from games/primadonna/research/d1_direction. */

:root {
    --paper: #ece4d1;
    --surface: #e2d8c1;
    --line: #cdbfa3;
    --ink: #29231c;
    --ink-2: #5e5445;
    --rule: rgba(41, 35, 28, 0.14);
    --green: #2a7552;
    --green-deep: #1f6244;
    --red: #a8321d;
    --focus: var(--ink);
    --skip-bg: var(--ink);
    --skip-fg: var(--paper);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --r: 4px;
    --wrap: 1120px;
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --mono:
        ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

body.paper {
    background: var(--paper);
    color: var(--ink);
    font: 400 17px/1.5 var(--serif);
    font-variant-numeric: tabular-nums;
}

::selection {
    background: var(--green-deep);
    color: var(--paper);
}

a {
    color: inherit;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 600;
}
h2 {
    font-size: 22px;
    line-height: 1.25;
}
h3 {
    font-size: 17px;
    line-height: 1.3;
}
p {
    margin: 0;
}

header.site,
main,
.site-foot {
    max-width: var(--wrap);
    margin: 0 auto;
    padding-inline: 32px;
}

/* ------------------------------------------------------------- masthead */

header.site nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    color: var(--ink-2);
    font-size: 15px;
}
header.site a {
    text-decoration: none;
}
header.site a:hover {
    text-decoration: underline;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-weight: 500;
}
.brand img {
    image-rendering: pixelated;
}

.masthead {
    padding: 24px 0 24px;
}
.masthead h1 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 16px;
    font-size: 24px;
    font-weight: 500;
    color: var(--ink-2);
}
.logotype {
    display: block;
    width: 344px;
    height: auto;
}
.masthead h1 span {
    position: relative;
    top: -8px;
}
.lead {
    margin-top: 8px;
    color: var(--ink-2);
}

/* -------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1.5px solid var(--ink);
    border-radius: var(--r);
    background: transparent;
    color: var(--ink);
    font: 500 15px/1.2 var(--serif);
    cursor: pointer;
    transition:
        background-color 0.12s var(--ease),
        color 0.12s var(--ease),
        transform 0.12s var(--ease);
}
.btn:hover {
    background: rgba(41, 35, 28, 0.08);
}
.btn:active {
    transform: scale(0.98);
}
.btn.primary {
    background: var(--ink);
    color: var(--paper);
}
.btn.primary:hover {
    background: #40372c;
}
.btn.small {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 14px;
}
.btn.wide {
    width: 100%;
}
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}
.btn[disabled]:hover {
    background: transparent;
}

.notice {
    max-width: 68ch;
    margin: 16px 0;
    padding: 4px 0 4px 16px;
    border-left: 3px solid var(--red);
}
.notice-title {
    color: var(--red);
    font-weight: 600;
}
.notice p + p {
    margin-top: 4px;
    color: var(--ink-2);
}

.fine {
    max-width: 64ch;
    margin-bottom: 12px;
    color: var(--ink-2);
    font-size: 15px;
    line-height: 1.45;
}
.hint {
    margin-top: 8px;
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.4;
}

/* ----------------------------------------------------------- the strips */

/* One piece of roll: paper with a row of track holes along each edge. */
.drop,
.roll {
    --lane-ink: var(--ink);
    --lane-off: #bcae92;
    --lane-rule: rgba(41, 35, 28, 0.13);
    position: relative;
    background: var(--surface);
}
.drop::before,
.drop::after,
.roll::before,
.roll::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 12px;
    background-image: radial-gradient(
        circle at 10px 6px,
        var(--paper) 2.5px,
        transparent 3px
    );
    background-size: 20px 12px;
    pointer-events: none;
}
.drop::before,
.roll::before {
    top: 4px;
}
.drop::after,
.roll::after {
    bottom: 4px;
}

.drop {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
    margin: 8px 0 24px;
    padding: 48px 32px;
}
.drop-title {
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
    max-width: 21ch;
}
.drop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.drop-note {
    margin-top: 16px;
    color: var(--ink-2);
    font-size: 15px;
}
.drop-file {
    min-width: 0;
    overflow: hidden;
    color: var(--ink-2);
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ghost {
    display: grid;
    gap: 0;
    --lane-ink: var(--ink);
}
.ghost canvas {
    display: block;
    width: 100%;
    height: 56px;
    border-top: 1px solid var(--rule);
}
.ghost canvas:first-child {
    border-top: 0;
}

.drop[data-compact] {
    grid-template-columns: 1fr;
    padding: 28px 32px;
}
.drop[data-compact] .ghost,
.drop[data-compact] .drop-note {
    display: none;
}
.drop[data-compact] .drop-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
}
.drop[data-compact] .btn.primary {
    background: transparent;
    color: var(--ink);
}
.drop[data-compact] .btn.primary:hover {
    background: rgba(41, 35, 28, 0.08);
}
.drop[data-compact] .drop-actions {
    flex: none;
}

.veil {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    place-items: center;
    padding: 16px;
    background: rgba(236, 228, 209, 0.94);
    pointer-events: none;
}
.veil p {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border: 3px dashed var(--ink);
    border-radius: var(--r);
    font-size: 28px;
    font-weight: 600;
}
body.dragging .veil {
    display: grid;
}

/* ------------------------------------------------------------ the bench */

.bench-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 48px;
    align-items: start;
    margin-top: 8px;
}
.voices {
    margin-top: 48px;
}
.help {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 40px;
}
.help .fine {
    margin-bottom: 8px;
}
.help strong {
    color: var(--ink);
    font-weight: 600;
}
.bench section,
.rail,
.more section {
    padding-top: 16px;
    border-top: 2px solid var(--ink);
}
.bench-main section + section {
    margin-top: 40px;
}
.bench h2,
.rail h2,
.more h2 {
    margin-bottom: 12px;
}

.fields {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px 24px;
}
.field label {
    display: block;
    color: var(--ink-2);
    font-size: 13px;
}
.field input {
    width: 100%;
    padding: 4px 0 6px;
    border: 0;
    border-bottom: 1.5px solid var(--ink);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: 500 22px/1.3 var(--serif);
}
.field input:focus-visible {
    outline-offset: 4px;
}

.readout {
    display: grid;
    grid-template-columns: repeat(4, auto);
    justify-content: start;
    gap: 12px 48px;
    margin: 24px 0 0;
}
.readout dt {
    color: var(--ink-2);
    font-size: 13px;
}
.readout dd {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
    line-height: 1.3;
}

.warnings ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.warnings li {
    position: relative;
    max-width: 68ch;
    padding: 6px 0 6px 20px;
}
.warnings li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 15px;
    width: 8px;
    height: 4px;
    border-radius: 2px;
    background: var(--ink);
}
.warnings li strong {
    display: block;
}
.warnings li span {
    color: var(--ink-2);
}
.warnings details {
    margin-top: 8px;
    color: var(--ink-2);
    font-size: 15px;
}
.warnings summary {
    cursor: pointer;
    padding: 4px 0;
}
.warnings details ul {
    margin-top: 4px;
}
.warnings details li::before {
    top: 14px;
    background: var(--ink-2);
}

/* ------------------------------------------------- transport and the roll */

.roll {
    --cols: 56px minmax(160px, 232px) minmax(0, 1fr) 88px;
}
.transport {
    display: grid;
    grid-template-columns: var(--cols);
    column-gap: 12px;
    align-items: center;
    padding: 0 16px 12px;
}
.play {
    grid-column: 1 / 3;
    justify-self: start;
    min-width: 108px;
}
.transport input[type="range"] {
    grid-column: 3;
}
.pos {
    grid-column: 4;
    justify-self: end;
    font-size: 15px;
    white-space: nowrap;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    min-width: 0;
    height: 32px;
    margin: 0;
    background: transparent;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        var(--ink) var(--p, 0%),
        var(--line) var(--p, 0%)
    );
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 6px;
    height: 24px;
    margin-top: -10px;
    border: 0;
    border-radius: 1px;
    background: var(--green);
}
input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: var(--line);
}
input[type="range"]::-moz-range-progress {
    height: 4px;
    border-radius: 2px;
    background: var(--ink);
}
input[type="range"]::-moz-range-thumb {
    width: 6px;
    height: 24px;
    border: 0;
    border-radius: 1px;
    background: var(--green);
}

.melody {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.roll {
    margin-top: 8px;
    padding: 24px 0 20px;
}
.roll-head,
.voice {
    display: grid;
    grid-template-columns: var(--cols);
    column-gap: 12px;
    align-items: center;
    padding-inline: 16px;
}
.roll-head {
    padding-block: 4px 6px;
    color: var(--ink-2);
    font-size: 13px;
}
.h-ctl {
    justify-self: end;
}
.voice-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.voice {
    min-height: 72px;
    padding-block: 8px;
    border-top: 1px solid var(--rule);
}
.voice[data-melody="true"] {
    background: #e9e1cc;
    box-shadow: inset 3px 0 0 var(--green);
}

.v-pick {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    cursor: pointer;
}
.v-pick input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.mark {
    flex: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    transition: background-color 0.12s var(--ease);
}
.v-pick input:checked + .mark {
    border-color: var(--green-deep);
    background: var(--green-deep);
    box-shadow: inset 0 0 0 3px #e9e1cc;
}
.v-pick input:focus-visible + .mark {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}
.v-pick:hover .mark {
    background: rgba(41, 35, 28, 0.1);
}
.pick-text {
    display: none;
    font-size: 13px;
}

.v-name {
    font-size: 15px;
    font-weight: 500;
    line-height: 20px;
    overflow-wrap: anywhere;
}
.guess {
    display: inline-block;
    white-space: nowrap;
    margin-left: 8px;
    color: var(--green-deep);
    font-size: 13px;
    font-weight: 400;
}
.v-meta {
    color: var(--ink-2);
    font-size: 13px;
    line-height: 18px;
}
.voice[data-audible="false"] .v-name {
    color: var(--ink-2);
    font-weight: 400;
}

.v-lane {
    position: relative;
    height: 48px;
    cursor: pointer;
    touch-action: pan-y;
}
.v-lane canvas {
    display: block;
    width: 100%;
    height: 100%;
}
.ph {
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: -1px;
    width: 2px;
    background: var(--green);
    pointer-events: none;
}

.v-ctl {
    display: flex;
    gap: 4px;
    justify-self: end;
}
.tog {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1.5px solid rgba(41, 35, 28, 0.5);
    border-radius: var(--r);
    background: transparent;
    color: var(--ink);
    font: 600 14px/1 var(--serif);
    cursor: pointer;
    transition:
        background-color 0.12s var(--ease),
        color 0.12s var(--ease);
}
.tog:hover {
    background: rgba(41, 35, 28, 0.1);
}
.tog[aria-pressed="true"] {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper);
}
.tog[aria-label^="Solo"][aria-pressed="true"] {
    border-color: var(--green-deep);
    background: var(--green-deep);
}

/* ------------------------------------------------------------- the rail */

.rail {
    min-width: 0;
}
.code-len {
    margin: 8px 0 12px;
    color: var(--ink-2);
    font-size: 15px;
}
.code {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--ink);
    font: 12px/1.4 var(--mono);
    overflow-wrap: anywhere;
    word-break: break-all;
    resize: vertical;
}
.rail-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.rail-actions .btn:last-child {
    grid-column: 1 / -1;
}
.link-field {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 6px 8px;
    border: 1.5px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--ink);
    font: 12px/1.4 var(--mono);
}
.status {
    min-height: 24px;
    margin-top: 12px;
    color: var(--green-deep);
    font-size: 15px;
}
.steps {
    margin: 12px 0 0;
    padding-left: 24px;
}
.steps li {
    padding-left: 4px;
}
.steps li + li {
    margin-top: 4px;
}
.steps li::marker {
    font-weight: 600;
}
kbd {
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--surface);
    font: 500 14px/1.4 var(--serif);
}

/* ---------------------------------------------------------- more band */

.more {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 48px;
    margin-top: 64px;
}
.finding {
    grid-column: 1 / -1;
}
.empty {
    color: var(--ink-2);
    font-size: 15px;
}
.song-list {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}
.song-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 0;
    border-top: 1px solid var(--rule);
}
.song-row > div:first-child {
    min-width: 0;
}
.sr-title {
    font-weight: 500;
    overflow-wrap: anywhere;
}
.sr-meta {
    color: var(--ink-2);
    font-size: 13px;
}
.sr-actions {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.paste .code {
    margin-bottom: 12px;
}
.finding-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 48px;
    margin-bottom: 16px;
}
.finding h3 {
    margin-bottom: 8px;
}
.finding p {
    max-width: 60ch;
}
.finding .fine {
    margin-bottom: 0;
}
.finding ul {
    margin: 0;
    padding-left: 20px;
}
.finding li + li {
    margin-top: 4px;
}

.site-foot {
    padding-block: 56px 32px;
    color: var(--ink-2);
    font-size: 13px;
}

/* ---------------------------------------------------------------- phones */

@media (max-width: 880px) {
    .bench {
        display: flex;
        flex-direction: column;
        gap: 40px;
    }
    .bench-top {
        display: contents;
    }
    .bench-main {
        order: 1;
    }
    .voices {
        order: 2;
        margin-top: 0;
    }
    .rail {
        order: 3;
    }
    .help {
        grid-template-columns: 1fr;
    }
    .more {
        grid-template-columns: minmax(0, 1fr);
        gap: 40px;
    }
    .more {
        margin-top: 48px;
    }
    .drop {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .finding-cols {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body.paper {
        font-size: 16px;
    }
    header.site,
    main,
    .site-foot {
        padding-inline: 16px;
    }
    .masthead h1 span {
        top: 0;
    }
    .logotype {
        width: 260px;
    }
    .drop {
        padding: 40px 16px;
    }
    .drop-title {
        font-size: 24px;
    }
    .ghost canvas {
        height: 32px;
    }
    .drop[data-compact] {
        padding: 32px 16px;
    }
    .fields {
        grid-template-columns: 1fr;
    }
    .readout {
        grid-template-columns: repeat(2, auto);
        gap: 16px 32px;
    }
    .transport {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "play pos"
            "seek seek";
        row-gap: 4px;
        padding-inline: 12px;
    }
    .play {
        grid-area: play;
    }
    .pos {
        grid-area: pos;
    }
    .transport input[type="range"] {
        grid-area: seek;
    }
    .roll-head {
        display: none;
    }
    .voice {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "pick info ctl"
            "lane lane lane";
        row-gap: 8px;
        padding-inline: 12px;
    }
    .voice > :nth-child(1) {
        grid-area: pick;
        align-self: start;
    }
    .voice > :nth-child(2) {
        grid-area: info;
    }
    .voice > :nth-child(3) {
        grid-area: lane;
    }
    .voice > :nth-child(4) {
        grid-area: ctl;
        align-self: start;
    }
    .v-pick {
        flex-direction: column;
        gap: 2px;
        min-height: 44px;
        min-width: 44px;
        justify-content: center;
    }
    .pick-text {
        display: block;
    }

    .v-lane {
        height: 40px;
    }
    .song-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .sr-actions {
        justify-content: flex-start;
    }
    .veil p {
        font-size: 22px;
    }
}

@media (pointer: coarse) {
    .tog {
        width: 44px;
        height: 44px;
    }
    .v-ctl {
        gap: 8px;
    }
    input[type="range"] {
        height: 44px;
    }
}

::placeholder {
    color: var(--ink-2);
    opacity: 0.7;
}

/* ------------------------------------------------------------- arranger */

.choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 32px;
    margin-bottom: 8px;
}
.choice label {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    cursor: pointer;
}
.choice input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.choice-name {
    font-weight: 500;
}
.box {
    flex: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--ink);
    border-radius: 3px;
    transition: background-color 0.12s var(--ease);
}
.choice input:checked + .box {
    border-color: var(--green-deep);
    background: var(--green-deep)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.5 9.5l3 3 6-7' fill='none' stroke='%23ece4d1' stroke-width='2'/%3E%3C/svg%3E")
        center / 100% no-repeat;
}
.choice input:focus-visible + .box {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}
.choice .hint {
    margin: 0 0 0 28px;
}
.arrange #arrange-lines {
    margin-top: 8px;
}
.arrange #arrange-lines li {
    color: var(--ink-2);
    font-size: 15px;
}
.plus {
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 400;
}
@media (max-width: 640px) {
    .choices {
        grid-template-columns: 1fr;
    }
}
.arrange #arrange-lines li {
    padding-block: 2px;
    line-height: 1.4;
}
