/* Chord Striker: black and white */

:root {
    --ink: #0b0b0b;
    --paper: #f5f4f0;
    --white: #ffffff;
    --grey: #8a8a8a;
    --line: #d6d4ce;
    --display: "Anton", "Impact", "Arial Narrow", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    --shadow: 6px 6px 0 var(--ink);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

.hidden {
    display: none !important;
}

.mono {
    font-family: var(--mono);
}

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

/* ---------- Hero ---------- */

.hero {
    background: var(--ink);
    color: var(--white);
}

.hero__photo {
    position: relative;
    height: clamp(260px, 44vw, 620px);
    overflow: hidden;
}

.hero__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 45%;
    filter: grayscale(1) contrast(1.05);
}

/* fade the bottom of the photo into the black panel below it */
.hero__photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 45%, var(--ink) 100%);
    pointer-events: none;
}

.hero__text {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "title title"
        "lede actions";
    align-items: end;
    gap: 1.75rem 3rem;
    max-width: 1180px;
    margin: clamp(-9rem, -9vw, -3rem) auto 0;
    padding: 0 clamp(1.25rem, 4vw, 2.5rem) clamp(2.5rem, 5vw, 4rem);
}

.hero__title {
    grid-area: title;
    margin: 0;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(3.75rem, 11.5vw, 10.5rem);
    line-height: 0.85;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.hero__title br {
    display: none;
}

.hero__lede {
    grid-area: lede;
    max-width: 46ch;
    margin: 0;
    color: #d9d9d9;
}

.hero__actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ---------- Ticker ---------- */

.ticker {
    overflow: hidden;
    border-bottom: 2px solid var(--ink);
    background: var(--white);
    white-space: nowrap;
}

.ticker__track {
    display: inline-flex;
    animation: ticker 40s linear infinite;
}

.ticker__track span {
    padding: 0.7rem 0;
    font-family: var(--display);
    font-size: 1.15rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ticker__track span::after {
    content: "✱";
    margin: 0 1.4rem;
    font-family: var(--mono);
    font-size: 0.9rem;
    vertical-align: 0.15em;
}

@keyframes ticker {
    to {
        transform: translateX(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ticker__track {
        animation: none;
    }
    html {
        scroll-behavior: auto;
    }
}

/* ---------- Layout ---------- */

.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4rem) 1.25rem 4rem;
}

#generator {
    max-width: 640px;
    margin: 0 auto;
    scroll-margin-top: 1.5rem;
}

#resultsSection {
    margin-top: 4rem;
    scroll-margin-top: 1.5rem;
}

.panel {
    background: var(--white);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow);
    padding: clamp(1.25rem, 4vw, 2rem);
}

.section-title {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    margin: 0 0 1.75rem;
    font-family: var(--display);
    font-weight: 400;
    font-size: 2.4rem;
    line-height: 1;
    text-transform: uppercase;
}

.section-title__num {
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.2rem 0.45rem;
    background: var(--ink);
    color: var(--white);
    transform: translateY(-0.45rem);
}

.panel__title {
    margin: 0 0 1rem;
    font-family: var(--display);
    font-weight: 400;
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
    align-items: start;
}

/* ---------- Form ---------- */

.form {
    display: grid;
    gap: 1.6rem;
}

.field {
    display: grid;
    gap: 0.5rem;
}

.field__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.label {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.field__head .label {
    flex: 1;
}

.value {
    font-weight: 500;
    letter-spacing: 0.04em;
}

.hint {
    margin: 0;
    font-size: 0.75rem;
    color: var(--grey);
}

.input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--white);
    color: var(--ink);
    font: inherit;
}

.input::placeholder {
    color: #a3a3a3;
}

.input:focus {
    outline: none;
    box-shadow: 4px 4px 0 var(--ink);
}

/* Switch (styled checkbox) */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.switch__track {
    position: relative;
    width: 38px;
    height: 20px;
    border: 2px solid var(--ink);
    background: var(--white);
    transition: background 0.15s;
}

.switch__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: var(--ink);
    transition: transform 0.15s, background 0.15s;
}

.switch input:checked + .switch__track {
    background: var(--ink);
}

.switch input:checked + .switch__track::after {
    background: var(--white);
    transform: translateX(18px);
}

.switch input:focus-visible + .switch__track {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

/* Key picker */
.keys {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.4rem;
}

.key-button {
    padding: 0.7rem 0;
    border: 2px solid var(--ink);
    background: var(--white);
    color: var(--ink);
    font: 600 0.95rem var(--mono);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, transform 0.12s;
}

.key-button--accidental {
    background: #ecebe6;
}

.key-button:hover {
    transform: translateY(-2px);
}

.key-button.is-selected {
    background: var(--ink);
    color: var(--white);
}

/* Range sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    margin: 0;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 2px;
    background: var(--ink);
}

input[type="range"]::-moz-range-track {
    height: 2px;
    background: var(--ink);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -8px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--white);
    transition: background 0.12s, transform 0.12s;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--white);
}

input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus-visible::-webkit-slider-thumb {
    background: var(--ink);
    transform: scale(1.15);
}

input[type="range"]:hover::-moz-range-thumb {
    background: var(--ink);
}

input[type="range"]:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

/* Advanced options */
.advanced {
    border-top: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
}

.advanced__toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.9rem 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: 600 0.75rem var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
}

.advanced__icon {
    font-size: 1.3rem;
    line-height: 1;
}

.advanced__body {
    display: grid;
    gap: 1.4rem;
    padding: 0.5rem 0 1.5rem;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 1.4rem;
    border: 2px solid var(--ink);
    background: var(--white);
    color: var(--ink);
    font: 600 0.8rem var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s, background 0.12s, color 0.12s;
}

.btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--ink);
}

.btn:active {
    transform: translate(0, 0);
    box-shadow: none;
}

.btn--primary {
    background: var(--ink);
    color: var(--white);
}

.btn--primary:hover {
    background: var(--white);
    color: var(--ink);
}

.btn--light {
    border-color: var(--white);
    background: var(--white);
    color: var(--ink);
}

.btn--ghost {
    border-color: var(--white);
    background: transparent;
    color: var(--white);
}

.btn--light:hover,
.btn--ghost:hover {
    box-shadow: 4px 4px 0 var(--white);
}

.btn--block {
    width: 100%;
}

#generateButton {
    padding: 1.1rem 1.4rem;
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.06em;
}

.btn:disabled {
    cursor: progress;
    opacity: 0.75;
    transform: none;
    box-shadow: none;
}

.btn--small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

/* ---------- Status ---------- */

.status {
    margin-top: 1.25rem;
    padding: 0.75rem 0.9rem;
    border: 2px solid var(--ink);
    font-size: 0.85rem;
}

.status--error {
    background: var(--ink);
    color: var(--white);
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ---------- Results ---------- */

.sheet {
    aspect-ratio: 210 / 297;
    border: 2px solid var(--ink);
    background: var(--white);
    overflow: hidden;
}

.sheet canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1rem 0;
    font-size: 0.8rem;
}

.player {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.player__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 1.5rem 0;
    border: 2px solid var(--ink);
    background:
        repeating-linear-gradient(90deg, transparent 0 23px, var(--line) 23px 24px);
}

.player__play,
.player__stop {
    display: grid;
    place-items: center;
    border: 2px solid var(--ink);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.12s, background 0.12s, color 0.12s;
}

.player__play {
    width: 76px;
    height: 76px;
    background: var(--ink);
    color: var(--white);
}

.player__stop {
    width: 48px;
    height: 48px;
    background: var(--white);
    color: var(--ink);
}

.player__play:hover,
.player__stop:hover {
    transform: scale(1.06);
}

.player__play:active,
.player__stop:active {
    transform: scale(0.95);
}

.player__status {
    min-height: 1.2em;
    margin: -0.75rem 0 0;
    font-size: 0.8rem;
}

.player__status--error {
    font-weight: 600;
}

.player__status--error::before {
    content: "✕ ";
}

.player__times {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
}

/* ---------- Footer ---------- */

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    padding: 1.25rem clamp(1.25rem, 4vw, 2.5rem);
    background: var(--ink);
    color: #bdbdbd;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------- Small screens ---------- */

@media (max-width: 820px) {
    .hero__photo {
        height: max(260px, 62vw);
    }

    .hero__photo img {
        object-position: 30% 50%;
    }

    .hero__text {
        grid-template-columns: 1fr;
        grid-template-areas:
            "title"
            "lede"
            "actions";
        gap: 1.5rem;
    }

    .hero__title br {
        display: inline;
    }

    .results {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .keys {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
