/* ===== Piano Tunes styles ===== */
/* Mobile first: the basic styles are for phones, and the
   @media section at the bottom changes things for bigger screens. */

/* Colours used across the page */
:root {
    --background: #fdf8f0;   /* soft cream */
    --card: #ffffff;
    --text: #2d2a32;
    --muted: #6b6475;
    --accent: #5b4bdb;       /* purple */
    --accent-light: #ece9ff;
    --easy: #2e9d5b;         /* green */
    --medium: #d98a00;       /* amber */
    --tricky: #d64566;       /* raspberry */
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", Arial, sans-serif;
    background: var(--background);
    color: var(--text);
}

/* ----- Header ----- */
.site-header {
    text-align: center;
    padding: 20px 16px 12px;
    background: var(--accent);
    color: #ffffff;
}

.site-header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.site-header p {
    margin: 4px 0 0;
    opacity: 0.9;
}

/* ----- Page layout ----- */
.layout {
    display: flex;
    flex-direction: column;   /* menu on top, music below (phones) */
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

/* ----- Tune menu ----- */
.menu-toggle {
    width: 100%;
    padding: 12px;
    font: inherit;
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    cursor: pointer;
}

.tune-list {
    display: none;            /* hidden on phones until the button is pressed */
    margin-top: 8px;
    padding: 12px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tune-list.open {
    display: block;
}

.tune-list h2 {
    margin: 12px 0 6px;
    font-size: 0.95rem;
    color: var(--muted);
}

.tune-list h2:first-child {
    margin-top: 0;
}

.tune-button {
    display: block;
    width: 100%;
    margin-bottom: 4px;
    padding: 8px 10px;
    font: inherit;
    text-align: left;
    color: var(--text);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.tune-button:hover {
    background: var(--accent-light);
}

.tune-button.active {
    color: #ffffff;
    background: var(--accent);
}

.message {
    color: var(--muted);
}

/* ----- Sheet music area ----- */
.sheet-area {
    flex: 1;
    min-width: 0;             /* lets the music shrink instead of overflowing */
}

/* Play / Pause bar above the music */
.player {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.play-button {
    min-width: 130px;
    padding: 12px 22px;
    font: inherit;
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff;
    background: var(--easy);
    border: none;
    border-radius: 999px;
    cursor: pointer;
}

.play-button:hover {
    filter: brightness(1.1);
}

.play-button.is-playing {
    background: var(--tricky);
}

.play-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.player-message {
    color: var(--muted);
}

.play-hint {
    font-size: 0.9rem;
    color: var(--muted);
}

/* The music can be tapped, so show a hand pointer and stop the
   phone selecting text or popping up menus on a long press */
.sheet {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* While a finger is held on the music: "let go to start again" */
.sheet.holding {
    outline: 4px solid var(--easy);
    outline-offset: 2px;
}

/* The note that is playing right now lights up */
.sheet .playing,
.sheet .playing * {
    fill: var(--tricky);
    stroke: var(--tricky);
}

.sheet {
    padding: 12px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tune-info {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--card);
    border-radius: 12px;
}

.tune-info p {
    margin: 8px 0 0;
    line-height: 1.5;
}

/* Coloured label showing how hard the tune is */
.level {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #ffffff;
    border-radius: 999px;
}

.level-1 { background: var(--easy); }
.level-2 { background: var(--medium); }
.level-3 { background: var(--tricky); }

/* Previous / Next buttons */
.tune-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.nav-button {
    padding: 10px 16px;
    font: inherit;
    font-weight: bold;
    color: var(--accent);
    background: var(--card);
    border: 2px solid var(--accent);
    border-radius: 999px;
    cursor: pointer;
}

.nav-button:hover {
    background: var(--accent-light);
}

.nav-button:disabled {
    opacity: 0.35;
    cursor: default;
}

/* ----- Bigger screens (tablets and computers) ----- */
@media (min-width: 800px) {
    .layout {
        flex-direction: row;  /* menu on the left, music on the right */
        align-items: flex-start;
    }

    .tune-menu {
        width: 270px;
        flex-shrink: 0;
        position: sticky;
        top: 16px;
    }

    .menu-toggle {
        display: none;        /* no need for the button – the list is always shown */
    }

    .tune-list {
        display: block;
        margin-top: 0;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }
}
