/* ============================================================
   SONG PAGE (song.php) — new look
   ------------------------------------------------------------
   Loaded after song/style.css, which is kept for the overlays
   and the included parts (chord diagrams, endnotes, donate…).
   Colours use the site theme variables (--nv-*) where they
   exist, so light and dark themes both work.
   !important is used where the site-wide styles for buttons,
   paragraphs and headings would otherwise win.
   ============================================================ */

/* Colours follow the site theme in style.css (:root and
   body.dark-mode), so switching theme updates this page too. */
body {
    --sg-accent:      #e56103;
    --sg-chord:       #9a3a00;                    /* chord names over the lyrics */
    --sg-text:        var(--nv-text, #222222);
    --sg-muted:       var(--nv-muted-text, #666666);
    --sg-card:        var(--nv-section-bg, #ffffff);
    --sg-soft:        var(--nv-background-light1, #f6fbf6);
    --sg-border:      var(--nv-border, #e5e5e5);
    --sg-btn-bg:      var(--nv-section-bg, #ffffff);
    --sg-notice-bg:   #fff9e6;
    --sg-notice-line: #f1d58a;
    --sg-notice-text: #4a3b10;
    --sg-shadow:      rgba(0, 0, 0, .05);
    --sg-radius:      12px;
    --sg-ui:          system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --sg-display:     'Lora', Georgia, 'Noto Sans Malayalam', 'Mukta', serif;
}

body.dark-mode {
    --sg-accent:      #f08a3c;
    --sg-chord:       #ffb26b;                    /* light orange reads well on dark */
    --sg-soft:        var(--nv-background-light1, #292d30);
    --sg-btn-bg:      #222426;
    --sg-notice-bg:   #2b2614;
    --sg-notice-line: #6b5520;
    --sg-notice-text: #efe1b4;
    --sg-shadow:      rgba(0, 0, 0, .4);
}

/* chord diagrams (assets/js/chord-diagrams.js) use the theme's chord colour */
.ctf-chord-canvas { --ctf-chord-color: var(--nv-ctf-chord-color, #525252); }

.hidden { display: none !important; }

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


/* ============================================================
   BANNER
   ============================================================ */

.sg-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 230px;
    margin: 18px 0 0;
    border-radius: var(--sg-radius);
    overflow: hidden;
    background: linear-gradient(135deg, #2e1d12 0%, #7a3410 55%, #e56103 100%);
    color: #fff;
}

.sg-hero-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: 70% 45%;
}

.sg-hero-img::after {               /* keeps the white text readable on any photo */
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .35) 55%, rgba(0, 0, 0, .1) 100%);
}

.sg-hero-body {
    position: relative;
    padding: 26px 30px 24px;
    max-width: 900px;
}

.sg-hero-kicker {
    font: 600 12px/1.4 var(--sg-ui);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #ffc79f;
}

.sg-hero-title {
    margin: 6px 0 2px;
    font: 700 clamp(26px, 4vw, 40px)/1.15 var(--sg-display);
    letter-spacing: -.01em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}

.sg-hero-subtitle {
    font: 600 clamp(17px, 2.4vw, 22px)/1.35 var(--sg-display);
    opacity: .92;
}

.sg-hero-credits {
    margin-top: 10px;
    font: 400 14px/1.5 var(--sg-ui);
    opacity: .9;
}

.sg-hero-credit {
    position: absolute;
    right: 12px;
    top: 10px;
    font: 400 11px/1 var(--sg-ui);
    color: rgba(255, 255, 255, .7);
}


/* ============================================================
   SONG DETAILS ROW
   ============================================================ */

.sg-meta {
    display: flex;
    flex-wrap: wrap;
    margin: 14px 0 28px;
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    background: var(--sg-card);
    overflow: hidden;
}

.sg-meta-item {
    flex: 1 1 130px;
    padding: 12px 18px;
    border-left: 1px solid var(--sg-border);
    margin-left: -1px;            /* no line before the first item on each row */
}

.sg-meta-label {
    display: block;
    font: 600 11px/1.4 var(--sg-ui);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sg-muted);
}

.sg-meta-value {
    display: block;
    margin-top: 2px;
    font: 700 17px/1.35 var(--sg-ui);
    color: var(--sg-text);
}

.sg-meta-value small { font-weight: 400; opacity: .6; font-size: 13px; }
.sg-meta-star { color: #f5a623; }


/* ============================================================
   TWO COLUMNS
   ============================================================ */

/* A grid, so the site's .row / .box rules (wrapping, widths,
   floats, margins) can't push the sidebar below the lyrics. */
.sg .sg-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    flex-wrap: nowrap !important;
}

.sg #song-left,
.sg #song-right {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    float: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Side by side on PC:
   left  = messages, controls, lyrics, rating
   right = chords used, notes, related songs */
@media (min-width: 1260px) {
    .sg .sg-row {
        grid-template-columns: minmax(0, 1fr) minmax(250px, 30%);
        gap: 28px;
    }
}

/* the controls bar adapts to the width of the lyrics column */
.sg #song-left { container-type: inline-size; }

.sg #song-right {
    margin: 0;
    padding: 24px !important;
    border: 1px solid var(--sg-border) !important;
    border-radius: var(--sg-radius);
    background: var(--sg-soft);
}


/* ============================================================
   NOTICES
   ============================================================ */

.sg .sg-notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 0 0 16px;
    padding: 12px 16px;
    border: 1px solid var(--sg-notice-line);
    border-left: 4px solid #f2b600;
    border-radius: 10px;
    background: var(--sg-notice-bg);
    color: var(--sg-notice-text);
    font: 400 14.5px/1.55 var(--sg-ui);
}

.sg .sg-notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.sg .sg-notice a { font-weight: 600; }

.sg .rand-messages {
    border-radius: 10px;
    margin: 0 0 16px;
    font-family: var(--sg-ui);
}


/* ============================================================
   CONTROLS BAR
   ============================================================ */

.sg-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    padding: 8px;
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    background: var(--sg-card);
    position: relative;
    z-index: 20;
}

@media (min-width: 900px) {
    .sg-toolbar {
        position: sticky;
        top: 8px;
        box-shadow: 0 2px 10px var(--sg-shadow);
    }
}

.sg-spacer { flex: 1 1 auto; }

/* a labelled group:  KEY [−] G [+] */
.sg-group {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    height: 40px;
    padding: 0 2px 0 10px;
    border: 1px solid var(--sg-border);
    border-radius: 10px;
    background: var(--sg-btn-bg);
}

.sg-group-label {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
    font: 700 11px/1 var(--sg-ui);
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .6;
}

.sg-group-label svg { width: 18px; height: 18px; }

.sg-sr {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.sg-value {
    display: inline-block;
    min-width: 36px;
    text-align: center;
    font: 700 16px/1 var(--sg-ui);
    color: var(--sg-text);
    white-space: nowrap;
}

.sg-key { color: var(--sg-accent); font-size: 17px; }

/* buttons and links */
.sg-toolbar .sg-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px;
    height: 40px !important;
    min-width: 40px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 1px solid var(--sg-border) !important;
    border-radius: 10px !important;
    background: var(--sg-btn-bg) !important;
    color: var(--sg-text);
    font: 600 14px/1 var(--sg-ui) !important;
    text-decoration: none !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}

.sg-toolbar .sg-btn:hover {
    border-color: var(--sg-accent) !important;
    color: var(--sg-accent);
}

.sg-toolbar .sg-btn:focus-visible {
    outline: 2px solid var(--sg-accent);
    outline-offset: 1px;
}

.sg-toolbar .sg-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    flex: none;
}

/* the small − / + buttons inside a group */
.sg-toolbar .sg-step {
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
}

.sg-toolbar .sg-step:hover { background: var(--sg-soft) !important; }
.sg-toolbar .sg-step svg { width: 18px; height: 18px; }

/* lyrics-only view: transposing does nothing */
.sg-toolbar .sg-step.chords-disabled { opacity: .35; pointer-events: none; }

/* view toggle shows the current view */
.sg-toolbar #toggleChords { min-width: 104px !important; }

.sg-toolbar #toggleChords[aria-pressed="true"] {
    background: var(--sg-accent) !important;
    border-color: var(--sg-accent) !important;
    color: #fff;
}


/* narrower lyrics column: labels give way to icons, so the bar stays on one line */
@container (max-width: 660px) {
    .sg-toolbar a.sg-wide span { display: none; }
}

@container (max-width: 560px) {
    .sg-toolbar #toggleChords span { display: none; }
    .sg-toolbar #toggleChords { min-width: 40px !important; }
}


/* ============================================================
   LYRICS
   ============================================================ */

.sg .sg-lyrics {
    padding: 24px 28px;
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    background: var(--sg-card);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sg .sg-lyrics pre {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--sg-text);
    overflow: visible;
}

.sg .sg-lyrics .line { min-height: 1em; }

/* chord lines (built by assets/js/transposer.js) */
.sg .sg-lyrics .chord-line {
    color: var(--sg-chord);
    font-weight: 700;
}

.sg .sg-lyrics .c { color: var(--sg-chord) !important; }
.sg .sg-lyrics .sub-bracket,
.sg .sg-lyrics .sub-chord { opacity: .8; }

/* substitute chords "[C]": no pill, so the brackets don't overlap the name */
.sg .sg-lyrics .sub-chord {
    padding: 0 !important;
    margin-right: 0 !important;
    background: transparent !important;
}

/* lyrics-only view */
.lyrics-mode .lyrics-en {
    line-height: 1.7;
    font-weight: bold;
    font-family: "Noto Sans Malayalam", "Mukta", sans-serif;
}


/* ============================================================
   RATING
   ============================================================ */

.sg .sg-rating {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 18px 0 30px;
    padding: 14px 18px;
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius);
    background: var(--sg-soft);
}

.sg .sg-rating .rating-label {
    margin: 0;
    font: 600 15px/1.4 var(--sg-ui);
    white-space: normal;
}

.sg-stars { display: inline-flex; gap: 4px; }

.sg .sg-rating .star {
    width: 26px;
    height: 26px;
    transition: transform .12s;
}

.sg .sg-rating .star:hover { transform: scale(1.15); }

.sg .sg-rating-count {
    margin: 0;
    font: 400 14px/1 var(--sg-ui);
    opacity: .6;
}


/* ============================================================
   HELP POPUP
   ============================================================ */

.sg-help { font: 400 15px/1.55 var(--sg-ui); color: var(--sg-text); }

.sg-help-group {
    margin: 18px 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sg-accent);
}

.sg-help-group:first-child { margin-top: 6px; }

.sg-help-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 7px 0;
}

.sg-help-ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--sg-soft);
}

.sg-help-ico svg { width: 18px; height: 18px; }

.sg-help kbd {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    border: 1px solid var(--sg-border);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--sg-soft);
    font: 600 12px/1.5 var(--sg-ui);
    text-align: center;
}


/* ============================================================
   PLAYLIST MESSAGE
   ============================================================ */

.playlist-prompt {
    top: auto !important;
    bottom: 24px;
    transform: translateX(-50%) !important;
    border-radius: 10px !important;
    font: 600 14px/1.4 var(--sg-ui) !important;
}


/* ============================================================
   PDF (assets/js/print-lyrics.js adds .pdf-mode)
   ============================================================ */

.pdf-mode {
    background: #fff;
    color: #000;
}

.pdf-mode h1 {
    position: relative;
    display: inline-block;
    padding-bottom: 6px;
    margin-top: 50px;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 24px;
}

.pdf-mode h1::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background-color: var(--nv-accent);
    border-radius: 1px;
}

.pdf-mode .row { display: block !important; }

.pdf-mode .box.w60,
.pdf-mode .box.w40 { width: 100% !important; }

.pdf-mode .box.w40 {
    background: #f7f8f7 !important;
    padding: 20px 40px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
}

.pdf-mode :is(.sg-hero, .sg-meta, .sg-toolbar, .sg-notice, .song-info-wrapper, .guest-message, .page-message, .rand-messages, h4, .transpose-controls, .featured_img, .rating-row, .donate, .endnotes, .related-songs, .google-auto-placed) {
    display: none !important;
}

.pdf-mode .sg-lyrics {
    padding: 0;
    border: 0;
    background: transparent;
}

.only-pdf { display: none; }
.pdf-mode .only-pdf { display: block; }

.page-title { display: none; }

.pdf-mode .page-title {
    display: block;
    font-size: 28px !important;
    margin-top: 40px !important;
    margin-bottom: 40px !important;
}

.pdf-mode .page-title::first-letter { font-size: 28px !important; }

.pdf-mode pre {
    font-size: 20px !important;
    line-height: 1.1 !important;
    column-count: 2;
    column-gap: 40px;
    column-rule: 1px solid #383d44;
}

.pdf-mode #song-right {
    background: transparent;
    border-left: none;
    margin-top: 80px;
}


/* ============================================================
   SMALL SCREENS
   ============================================================ */

@media (max-width: 768px) {
    .sg #song-right { padding: 18px !important; }
}

@media (max-width: 600px) {

    .sg-hero { min-height: 170px; margin-top: 10px; }
    .sg-hero-body { padding: 18px 18px 16px; }
    .sg-hero-credits { font-size: 13px; }

    .sg-meta-item { flex: 1 1 45%; padding: 10px 14px; }
    .sg-meta-value { font-size: 15px; }

    .sg-toolbar { gap: 6px; padding: 6px; }
    .sg-spacer { display: none; }
    .sg-group { flex: 1 1 auto; justify-content: space-between; }
    .sg-toolbar a.sg-wide span { display: none; }   /* "Present" shows as an icon */
    .sg-toolbar #toggleChords { min-width: 104px !important; }

    /* lyrics flush with the page: no box, no left margin */
    .sg .sg-lyrics {
        padding: 4px 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    .sg .sg-lyrics pre {
        margin-left: 0 !important;
        padding-left: 0 !important;
        text-indent: 0 !important;
    }

    .sg #song-right {
        padding: 0 !important;
        border: 0 !important;
        background: transparent;
    }
}