:root {
    color-scheme: light;
    --paper: #f6edd9;
    --ink: #24160f;
    --ink-soft: #655443;
    --accent: #7b2f16;
    --page-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
    --title-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
    --chart-font: "Marker Felt", "Bradley Hand", "Chalkboard SE", "Segoe Print", "Comic Sans MS", cursive;
    --ui-font: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: #d0bea0;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.45), transparent 38%),
        linear-gradient(180deg, #eadfc8 0%, #dac9ac 46%, #ccb794 100%);
    color: var(--ink);
    font-family: var(--page-font);
    line-height: 1.5;
}

a {
    color: inherit;
}

.wrap {
    width: min(960px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    padding: 1rem 0 0.85rem;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(36, 22, 15, 0.18);
}

.site-title {
    text-decoration: none;
    font-family: var(--ui-font);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.site-nav {
    display: flex;
    gap: 1rem;
    font-family: var(--ui-font);
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.site-nav a {
    color: var(--ink-soft);
    text-decoration: none;
}

.site-nav-placeholder {
    color: rgba(101, 84, 67, 0.6);
}

.site-nav a:hover {
    color: var(--accent);
}

main {
    padding: 1.5rem 0 3rem;
}

.page {
    position: relative;
    padding: 2rem 2rem 2.25rem;
    margin-bottom: 1rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0) 5.5rem),
        linear-gradient(180deg, rgba(150, 120, 84, 0.08), rgba(150, 120, 84, 0) 2rem),
        var(--paper);
    border: 1px solid rgba(86, 63, 40, 0.18);
    box-shadow:
        0 12px 30px rgba(44, 26, 10, 0.12),
        0 2px 0 rgba(255, 255, 255, 0.6) inset;
}

.page::before {
    content: "";
    position: absolute;
    inset: 1rem;
    border: 1px solid rgba(86, 63, 40, 0.08);
    pointer-events: none;
}

.page-index {
    max-width: 760px;
    overflow-anchor: none;
}

.fakebook-sheet {
    max-width: 860px;
}

.page-kicker {
    margin: 0 0 0.6rem;
    color: var(--ink-soft);
    font-family: var(--ui-font);
    font-size: 0.8rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.page-heading,
.title-block {
    padding-bottom: 1.1rem;
    margin-bottom: 1.3rem;
    border-bottom: 2px solid rgba(36, 22, 15, 0.16);
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

h1 {
    margin: 0;
    font-family: var(--title-font);
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.search-form label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--ink-soft);
    font-family: var(--ui-font);
    font-size: 0.84rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.search-form {
    margin-bottom: 1.35rem;
}

.search-row {
    display: flex;
    gap: 0.75rem;
}

.filter-group {
    margin-top: 1rem;
}

.filter-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--ink-soft);
    font-family: var(--ui-font);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.52rem 0.78rem;
    border: 1px solid rgba(86, 63, 40, 0.2);
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.filter-chip input {
    margin: 0;
    accent-color: var(--accent);
}

.filter-chip input:checked + span {
    color: var(--accent);
    font-weight: 700;
}

.search-reset-row {
    margin: 0.8rem 0 0;
    min-height: 1.35rem;
}

.search-reset-row.is-hidden {
    visibility: hidden;
}

.search-reset {
    color: var(--ink-soft);
    font-family: var(--ui-font);
    font-size: 0.84rem;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
}

.search-reset:hover {
    color: var(--accent);
}

input,
button {
    font: inherit;
}

input {
    flex: 1;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(86, 63, 40, 0.24);
    background: rgba(255, 255, 255, 0.72);
}

input:focus {
    outline: 2px solid rgba(123, 47, 22, 0.18);
    outline-offset: 2px;
}

button {
    padding: 0.75rem 1.05rem;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff7ef;
    font-family: var(--ui-font);
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
}

button:hover {
    background: #662511;
}

.song-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid rgba(36, 22, 15, 0.14);
}

.song-results {
    transition: opacity 120ms ease;
    overflow-anchor: none;
}

.song-results.is-loading {
    opacity: 0.84;
}

.song-list li {
    border-bottom: 1px solid rgba(36, 22, 15, 0.12);
}

.song-link {
    display: flex;
    align-items: baseline;
    padding: 0.85rem 0;
    text-decoration: none;
}

.song-link:hover .song-title {
    color: var(--accent);
}

.song-title {
    font-size: 1.2rem;
}

.page-note,
.muted,
.empty,
.back-link {
    color: var(--ink-soft);
}

.page-note {
    margin: 0.35rem 0 0;
    max-width: 28rem;
}

.empty {
    margin: 0.4rem 0 0;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    text-decoration: none;
    font-family: var(--ui-font);
    font-size: 0.84rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.back-link:hover {
    color: var(--accent);
}

.chart-sheet {
    padding-bottom: 2.5rem;
}

.practice-page {
    max-width: 860px;
}

.practice-module-list {
    display: grid;
    gap: 1rem;
}

.practice-module-card,
.practice-card {
    padding: 1.15rem;
    border: 1px solid rgba(36, 22, 15, 0.14);
    background: rgba(255, 255, 255, 0.42);
}

.practice-module-kicker {
    margin: 0 0 0.3rem;
    color: var(--ink-soft);
    font-family: var(--ui-font);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.practice-module-card h2,
.practice-card h2 {
    margin: 0;
    font-size: 1.55rem;
}

.practice-module-copy,
.practice-prompt {
    margin: 0.55rem 0 0;
    max-width: 38rem;
}

.practice-module-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem 1rem;
    margin: 0.9rem 0 0;
    color: var(--ink-soft);
    font-family: var(--ui-font);
    font-size: 0.84rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.practice-module-next {
    margin: 0.9rem 0 0;
}

.practice-link,
.practice-secondary-link a {
    color: var(--accent);
    text-decoration: none;
}

.practice-link:hover,
.practice-secondary-link a:hover {
    color: #662511;
}

.practice-card {
    margin-top: 1rem;
}

.practice-card-empty {
    text-align: center;
}

.practice-checklist {
    margin: 1rem 0 0;
    padding-left: 1.15rem;
}

.practice-checklist li + li {
    margin-top: 0.35rem;
}

.practice-link-button {
    display: inline-block;
    padding: 0.75rem 1.05rem;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff7ef;
    font-family: var(--ui-font);
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-decoration: none;
    text-transform: uppercase;
}

.practice-link-button:hover {
    background: #662511;
    color: #fff7ef;
}

.practice-secondary-link {
    margin: 1rem 0 0;
}

.songbook-tools {
    max-width: 860px;
}

.songbook-sheet {
    display: grid;
    gap: 2rem;
}

.songbook-entry + .songbook-entry {
    padding-top: 1.75rem;
    border-top: 1px solid rgba(36, 22, 15, 0.14);
}

.songbook-entry-header {
    padding-bottom: 0.7rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid rgba(36, 22, 15, 0.14);
}

.songbook-entry-header h2 {
    margin: 0;
    font-size: 1.65rem;
}

.preferred-recordings,
.backing-track-section {
    padding: 1.1rem 1.15rem 1.25rem;
    margin-bottom: 1.6rem;
    border: 1px solid rgba(36, 22, 15, 0.14);
    background: rgba(255, 255, 255, 0.34);
}

.example-section {
    padding: 1.1rem 1.15rem 1.25rem;
    margin-bottom: 1.6rem;
    border: 1px solid rgba(36, 22, 15, 0.14);
    background: rgba(255, 255, 255, 0.34);
}

.recordings-header {
    padding-bottom: 0.7rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid rgba(36, 22, 15, 0.14);
}

.recordings-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.recording-list {
    display: grid;
    gap: 1rem;
}

.recording-card {
    padding: 0.95rem;
    border: 1px solid rgba(36, 22, 15, 0.12);
    background: rgba(255, 255, 255, 0.54);
}

.recording-provider {
    margin: 0 0 0.2rem;
    color: var(--ink-soft);
    font-family: var(--ui-font);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.recording-title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

.recording-embed {
    overflow: hidden;
    border: 1px solid rgba(36, 22, 15, 0.14);
    background: #fff;
}

.recording-embed iframe {
    display: block;
    width: 100%;
    border: 0;
}

.recording-embed-youtube {
    aspect-ratio: 16 / 9;
}

.recording-embed-youtube iframe {
    height: 100%;
}

.recording-embed-spotify iframe {
    height: 152px;
}

.recording-audio {
    width: 100%;
}

.recording-video {
    display: block;
    width: 100%;
    max-height: 28rem;
    border: 1px solid rgba(36, 22, 15, 0.14);
    background: #000;
}

.recording-link {
    margin: 0.7rem 0 0;
    font-size: 0.95rem;
}

.recording-link a {
    color: var(--ink-soft);
}

.recording-link a:hover {
    color: var(--accent);
}

.chart-sections {
    display: grid;
    gap: 1.45rem;
}

.chart-section {
    padding-top: 0.35rem;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.55rem;
}

.section-heading::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid rgba(36, 22, 15, 0.14);
}

.section-label {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--ink);
    background: rgba(255, 255, 255, 0.52);
    color: var(--ink);
    font-family: var(--chart-font);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    transform: rotate(-1.5deg);
}

.lead-sheet-row {
    margin-top: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
}

.bar-grid {
    display: grid;
    grid-template-columns: repeat(var(--bar-count), minmax(8rem, 1fr));
    min-height: 4.85rem;
    border-top: 2px solid rgba(36, 22, 15, 0.48);
    border-bottom: 1px solid rgba(36, 22, 15, 0.18);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)),
        linear-gradient(90deg, rgba(123, 47, 22, 0.03), rgba(123, 47, 22, 0));
}

.bar {
    position: relative;
    border-left: 2px solid rgba(36, 22, 15, 0.48);
}

.bar:last-child {
    border-right: 2px solid rgba(36, 22, 15, 0.48);
}

.bar.double-end::after,
.bar.repeat-end::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0.32rem;
    width: 1px;
    background: var(--ink);
}

.bar.repeat-start,
.bar.repeat-end {
    border-color: var(--ink);
}

.bar.repeat-start {
    border-left-width: 4px;
}

.bar.repeat-end {
    border-right: 4px solid var(--ink);
}

.bar.repeat-start::before,
.bar.repeat-end::before {
    content: "";
    position: absolute;
    top: 1.5rem;
    width: 0.34rem;
    height: 0.34rem;
    border-radius: 999px;
    background: var(--ink);
    box-shadow: 0 0.72rem 0 var(--ink);
}

.bar.repeat-start::before {
    left: 0.48rem;
}

.bar.repeat-end::before {
    right: 0.62rem;
}

.bar-content {
    display: grid;
    height: 100%;
    padding-top: 0.45rem;
}

.bar-content.single {
    grid-template-columns: 1fr;
}

.bar-content.split {
    grid-template-columns: 1fr 1fr;
}

.bar-content.split .chord-symbol:first-child {
    border-right: 1px solid rgba(36, 22, 15, 0.18);
}

.chord-symbol,
.repeat-symbol {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0.35rem 0.4rem;
    font-family: var(--chart-font);
    font-size: clamp(1.25rem, 2.8vw, 1.7rem);
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.chord-symbol:nth-child(odd) {
    transform: rotate(-1.2deg);
}

.chord-symbol:nth-child(even) {
    transform: rotate(0.8deg);
}

.repeat-symbol {
    font-size: 1.8rem;
    transform: rotate(-4deg);
}

.bar.double-end {
    box-shadow: inset -5px 0 0 var(--ink);
}

.bar.repeat-end.double-end {
    box-shadow: none;
}

.bar.repeat-end.double-end::after {
    right: 0.45rem;
}

.lead-sheet-row + .lead-sheet-row {
    margin-top: 0.9rem;
}

.bar-grid,
.lead-sheet-row {
    overflow-x: auto;
}

@media (max-width: 720px) {
    .page {
        padding: 1.35rem 1.1rem 1.6rem;
    }

    .header-row,
    .page-heading,
    .search-row,
    .song-link {
        flex-direction: column;
        align-items: stretch;
    }

    .site-nav {
        justify-content: flex-start;
    }

    .filter-options {
        flex-direction: column;
    }

    .bar-grid {
        grid-template-columns: repeat(var(--bar-count), minmax(6.8rem, 1fr));
        min-height: 4.45rem;
    }

    .practice-module-stats,
    .practice-meta,
    .practice-rating-form {
        flex-direction: column;
    }

    .practice-rating-form button {
        width: 100%;
    }

    .preferred-recordings,
    .backing-track-section {
        padding: 0.9rem;
    }

    .example-section {
        padding: 0.9rem;
    }
}

@media print {
    @page {
        margin: 0.5in;
    }

    body {
        background: #fff;
    }

    .site-header,
    .songbook-tools,
    .back-link {
        display: none;
    }

    main.wrap,
    .wrap {
        width: 100%;
        margin: 0;
    }

    .page,
    .songbook-sheet {
        padding: 0;
        margin: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .page::before {
        display: none;
    }

    .songbook-entry {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .songbook-entry + .songbook-entry {
        margin-top: 0.35in;
        padding-top: 0.25in;
    }
}
