/* ==========================================================================
   Bloco do Sueltos — letras e cifras
   Página de leitura: papel creme (como o tecido do estandarte), tinta azul-royal,
   detalhes dourados. Feita para ler no celular durante o ensaio.
   ========================================================================== */

:root {
    --navy-950: #050D22;
    --navy-900: #071634;
    --royal: #1E3F9E;
    --royal-deep: #12306E;
    --cream: #F4E8C8;
    --paper: #FBF6E9;
    --paper-deep: #EFE3C4;
    --ink: #1A2440;
    --ink-2: #4A5470;
    --gold: #D4AF37;
    --gold-bright: #FFD700;
    --chord: #8A4B08;
    --chord-bg: #FFF1BF;
    --line: rgba(30, 63, 158, 0.18);

    /* Nomes antigos usados inline por repertorio.js */
    --primary-blue: var(--royal);
    --dark-blue: var(--navy-950);
    --primary-gold: var(--gold);
    --bright-gold: var(--gold-bright);
    --accent-gold: #F6DE8C;
    --bg-color: var(--paper-deep);
    --text-main: var(--ink);
    --text-muted: var(--ink-2);
    --border-color: var(--line);

    --sidebar-width: 340px;
    --font-display: 'Rozha One', 'Bodoni MT', 'Didot', 'Times New Roman', Georgia, serif;
    --font-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
    --radius: 6px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 106.25%;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

@media (min-width: 900px) {
    html { font-size: 112.5%; }
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--paper-deep);
    color: var(--ink);
    line-height: 1.6;
    height: 100vh;
    height: 100dvh;
    display: flex;
    overflow: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 400; }
p { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
button, input { font: inherit; color: inherit; }

::selection { background: var(--gold); color: var(--navy-950); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--paper-deep); }
::-webkit-scrollbar-thumb { background: var(--royal); border-radius: 5px; border: 2px solid var(--paper-deep); }

:focus-visible {
    outline: 3px solid var(--royal);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 500;
    padding: 12px 18px;
    background: var(--gold-bright);
    color: var(--navy-950);
    font-weight: 700;
    border-radius: var(--radius);
    text-decoration: none;
}
.skip-link:focus { top: 12px; }

.icon {
    width: 1.25em;
    height: 1.25em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ---------- Lista lateral ---------- */
aside {
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border-right: 1px solid var(--line);
    box-shadow: 4px 0 24px -12px rgba(0, 0, 0, 0.25);
    z-index: 20;
    transition: transform 0.3s var(--ease-out);
}

.sidebar-header {
    flex-shrink: 0;
    padding: 16px 16px 18px;
    background: var(--navy-900);
    color: var(--cream);
    border-bottom: 8px solid var(--royal);
}

.home-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    margin-left: -6px;
    padding: 6px;
    color: var(--cream);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--radius);
    transition: color 0.15s;
}
.home-link:hover { color: var(--gold-bright); }

.sidebar-header h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold-bright);
    margin: 6px 0 14px;
}

.search-box {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-2);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    min-height: 50px;
    padding: 10px 14px 10px 44px;
    border-radius: var(--radius);
    border: 2px solid var(--gold);
    background: var(--paper);
    color: var(--ink);
    font-size: 1.05rem;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.search-box input::placeholder { color: var(--ink-2); }

.search-box input:focus {
    outline: none;
    border-color: var(--gold-bright);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.4);
}

.search-box input::-webkit-search-cancel-button { cursor: pointer; }

.menu-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.menu-section { border-bottom: 1px solid var(--line); }

.menu-title {
    width: 100%;
    min-height: 54px;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: var(--paper);
    border: none;
    color: var(--royal);
    font-family: var(--font-display);
    font-size: 1.05rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.menu-title:hover { background: var(--cream); }

.menu-title .chev { transition: transform 0.2s var(--ease-out); }
.menu-title[aria-expanded="true"] .chev { transform: rotate(180deg); }

.menu-content {
    display: none;
    background: var(--paper);
    padding-bottom: 6px;
}

.menu-content.open { display: block; }

.menu-loading {
    padding: 12px 18px;
    color: var(--ink-2);
    font-size: 0.95rem;
}

.song-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 52px;
    padding: 10px 18px 10px 30px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(30, 63, 158, 0.08);
    color: var(--ink);
    font-size: 1.05rem;
    text-align: left;
    line-height: 1.3;
    cursor: pointer;
    position: relative;
    transition: background 0.15s, color 0.15s;
}

.song-item::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.15s;
}

.song-item:hover {
    background: var(--cream);
    color: var(--royal);
}

.song-item:hover::before { opacity: 1; }

.song-item.active {
    background: var(--royal);
    color: var(--cream);
    font-weight: 700;
}

.song-item.active::before {
    opacity: 1;
    background: var(--gold-bright);
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    background: var(--cream);
}

.drive-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 2px solid var(--royal);
    background: var(--paper);
    color: var(--royal);
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.drive-btn:hover {
    background: var(--royal);
    color: var(--cream);
}

.drive-btn-block { width: 100%; }

.drive-btn-solid {
    background: var(--royal);
    color: var(--cream);
}

.drive-btn-solid:hover {
    background: var(--royal-deep);
    border-color: var(--royal-deep);
}

/* ---------- Conteúdo ---------- */
main {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--paper-deep);
}

.main-content-wrapper {
    max-width: 880px;
    margin: 0 auto;
    padding: 24px 20px 120px;
    min-height: 100%;
}

.back-btn {
    display: none;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    margin-bottom: 14px;
    padding: 8px 14px;
    background: var(--navy-900);
    color: var(--gold-bright);
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

/* A "página" creme onde a música aparece */
.estandarte-container {
    position: relative;
    width: 100%;
    min-height: 70vh;
    padding: clamp(22px, 4vw, 44px);
    background: var(--paper);
    border-top: 8px solid var(--royal);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.estandarte-container::before {
    /* marca d'água do estandarte no canto */
    content: "";
    position: absolute;
    right: -40px;
    bottom: -60px;
    width: 300px;
    height: 500px;
    background: url('../images/estandarte-cutout.webp') center / contain no-repeat;
    opacity: 0.07;
    pointer-events: none;
}

.estandarte-container::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 12px;
    background: repeating-linear-gradient(90deg, var(--gold) 0 4px, transparent 4px 8px);
}

#content-display {
    position: relative;
    z-index: 1;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 26px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--royal);
}

.header-left {
    display: flex;
    gap: 14px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.header-logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    object-fit: cover;
    flex-shrink: 0;
}

.category-badge {
    display: inline-block;
    margin-bottom: 4px;
    padding: 2px 8px;
    border-radius: 3px;
    background: var(--royal);
    color: var(--cream);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.song-title-display {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3.5vw, 1.9rem);
    line-height: 1.15;
    color: var(--royal);
}

.composers {
    display: block;
    margin-top: 4px;
    color: var(--ink-2);
    font-size: 0.95rem;
}

.header-tools {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.tone-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.tone-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--royal);
    color: var(--cream);
    border: none;
    border-radius: 4px;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s;
}

.tone-btn:hover { background: var(--royal-deep); }

.tone-display {
    min-width: 70px;
    padding: 0 6px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--royal);
    font-variant-numeric: tabular-nums;
}

.zoom-controls {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.zoom-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--royal);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.zoom-btn:hover { background: var(--paper-deep); }

/* Letra e cifra */
.lyrics-display {
    font-size: 1.15rem;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--ink);
    max-width: 70ch;
}

.lyrics-display.chords-mode {
    font-family: var(--font-mono);
    line-height: 1.9;
    max-width: none;
    overflow-x: auto;
}

.chord {
    display: inline-block;
    margin-right: 2px;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--chord-bg);
    border: 1px solid rgba(138, 75, 8, 0.25);
    color: var(--chord);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1em;
}

.chord-block {
    margin: 16px 0;
    padding: 10px 14px;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink-2);
    font-family: var(--font-mono);
    font-size: 0.92em;
    font-style: italic;
}

/* Áudio e vídeo */
.media-player-container {
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.media-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--royal);
}

.media-title::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid var(--royal);
    flex-shrink: 0;
}

.audio-iframe {
    width: 100%;
    height: 90px;
    border: 0;
    border-radius: 4px;
    background: var(--paper);
}

.video-folder-link { margin-bottom: 20px; }

.video-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.video-title {
    margin-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--royal);
}

.video-item-external {
    padding: 16px;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.video-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--navy-950);
}

.video-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Estado inicial */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: clamp(20px, 6vw, 60px) 0;
}

.big-logo {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 4px solid var(--gold);
    margin-bottom: 22px;
    object-fit: cover;
    box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.5);
}

.empty-state h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--royal);
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.empty-state p {
    margin-top: 12px;
    max-width: 44ch;
    color: var(--ink-2);
    font-size: 1.05rem;
}

.empty-state-btn {
    display: none;
    margin-top: 22px;
}

/* ---------- Celular ---------- */
@media (max-width: 768px) {
    aside {
        position: absolute;
        inset: 0;
        width: 100%;
        transform: translateX(0);
    }
    aside.hidden { transform: translateX(-100%); }

    .back-btn { display: inline-flex; }
    .empty-state-btn { display: inline-flex; }

    .main-content-wrapper { padding: 14px 12px 100px; }
    .estandarte-container { padding: 20px 16px 30px; }
    .content-header { flex-direction: column; align-items: stretch; }
    .header-tools { width: 100%; justify-content: space-between; }
    .lyrics-display { font-size: 1.1rem; }
    .estandarte-container::before { width: 200px; height: 330px; right: -50px; bottom: -40px; }
}

@media (prefers-reduced-motion: reduce) {
    aside, .menu-title .chev { transition: none; }
}
