@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Inter:wght@300;400;600&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================================ */
:root {
    --bg-primary:      #FAF9F6;
    --bg-secondary:    #FFFFFF;
    --text-primary:    #2C1E16;
    --text-muted:      #5A4A42;
    --brand-gold:      #D4AF37;
    --brand-gold-dark: #AA8C2C;
    --brand-burgundy:  #4A0E17;
    --accent:          #800020;
    --card-shadow:     0 10px 30px rgba(74, 14, 23, 0.08);
    --border-subtle:   rgba(212, 175, 55, 0.3);
    --font-heading:    'Playfair Display', serif;
    --font-body:       'Inter', sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary:    #120A0B;
        --bg-secondary:  #1F1113;
        --text-primary:  #F0E6D2;
        --text-muted:    #BBAA99;
        --brand-gold:    #E5C158;
        --brand-gold-dark:#D4AF37;
        --brand-burgundy:#2D080E;
        --accent:        #A31535;
        --card-shadow:   0 10px 30px rgba(0,0,0,0.5);
        --border-subtle: rgba(229, 193, 88, 0.15);
    }
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.7;
    transition: background-color 0.4s ease, color 0.4s ease;
}

h1, h2, h3, h4, h5, h6, .font-heading {
    font-family: var(--font-heading);
    color: var(--brand-gold);
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

a { color: var(--brand-gold-dark); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--accent); }

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

/* ============================================================
   HEADER & NAVIGATION
   ============================================================ */
.site-header {
    background: linear-gradient(135deg, var(--brand-burgundy) 0%, var(--accent) 100%);
    color: #fff;
    padding: 0 2rem;
    border-bottom: 4px solid var(--brand-gold);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 999;
}

.site-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    height: 70px;
}

.site-logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--brand-gold) !important;
    text-decoration: none;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    white-space: nowrap;
}

/* Primary Nav — both WP menu and fallback */
.site-nav { display: flex; align-items: center; }

.site-nav ul,
.site-nav .nav-links,
.site-nav .page_item_has_children > ul { display: flex; gap: 0; list-style: none; padding: 0; margin: 0; }

.site-nav li { position: relative; }

.site-nav li a {
    display: block;
    padding: 0 1.1rem;
    height: 70px;
    line-height: 70px;
    color: rgba(255,255,255,0.92);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: color 0.25s, background 0.25s;
    white-space: nowrap;
}

.site-nav li a:hover,
.site-nav li.current-menu-item > a,
.site-nav li.current_page_item > a {
    color: var(--brand-gold);
    background: rgba(255,255,255,0.07);
}

/* Hamburger toggle (mobile) */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 4px;
}
.nav-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s;
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .site-nav {
        display: none;
        position: absolute;
        top: 74px;
        left: 0;
        right: 0;
        background: var(--brand-burgundy);
        border-bottom: 3px solid var(--brand-gold);
        padding: 1rem 0;
        z-index: 998;
    }
    .site-nav.open { display: block; }

    .site-nav ul,
    .site-nav .nav-links { flex-direction: column; }

    .site-nav li a { height: auto; line-height: 1; padding: 0.9rem 2rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
}

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
    background: var(--brand-burgundy);
    color: rgba(255,255,255,0.8);
    padding: 3rem 2rem 1.5rem;
    margin-top: 5rem;
    border-top: 4px solid var(--brand-gold);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: start;
}

.footer-brand .site-logo { font-size: 1.5rem; }
.footer-brand p { color: rgba(255,255,255,0.6); margin-top: 0.5rem; font-size: 0.9rem; }

.footer-nav ul,
.footer-nav .nav-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.footer-nav li a { color: rgba(255,255,255,0.7); font-size: 0.9rem; }
.footer-nav li a:hover { color: var(--brand-gold); }

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
}

@media (max-width: 600px) {
    .footer-inner { grid-template-columns: 1fr; }
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.hymn-main-container,
.single-hymn-layout,
.page-container {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 2rem 140px;
}

.section-hero {
    text-align: center;
    padding: 4rem 2rem;
    margin-bottom: 3rem;
    position: relative;
}

.section-hero h1 { font-size: 3.5rem; margin-bottom: 1rem; }
.section-hero p  { color: var(--text-muted); font-size: 1.15rem; max-width: 600px; margin: 0 auto; }

/* ============================================================
   HYMN LIBRARY GRID
   ============================================================ */
.hymn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.hymn-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.35s ease;
    position: relative;
    overflow: hidden;
}

.hymn-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
    background: linear-gradient(90deg, var(--brand-gold), var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s ease;
}

.hymn-card:hover { transform: translateY(-8px); box-shadow: 0 20px 40px rgba(212, 175, 55, 0.15); }
.hymn-card:hover::before { transform: scaleX(1); }
.hymn-card h2 { font-size: 1.4rem; margin-bottom: 0.4rem; }
.hymn-card h2 a { color: var(--brand-gold); }
.hymn-card .hymn-number-badge {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 2px 12px;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}
.hymn-card .composer { color: var(--text-muted); font-style: italic; font-size: 0.9rem; margin-top: 0.75rem; }

/* ============================================================
   HYMN DETAIL (SINGLE)
   ============================================================ */
.single-hymn-layout { max-width: 1100px; }

.hymn-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
}

.hymn-header::after {
    content: '✧ ✦ ✧';
    display: block;
    margin-top: 1.5rem;
    color: var(--brand-gold);
    font-size: 1rem;
    letter-spacing: 6px;
}

.hymn-number {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 3px 14px;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.hymn-title { font-size: 3rem; margin: 0.5rem 0; }

.hymn-meta { color: var(--text-muted); font-style: italic; margin-top: 0.75rem; }
.hymn-meta a { color: var(--brand-gold); }

/* Community Rating Row */
.hymn-community-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.rating-box {
    background: var(--bg-secondary);
    padding: 8px 18px;
    border-radius: 30px;
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.rating-box .star { color: var(--brand-gold); font-size: 1.2rem; }

.btn-ghost {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    padding: 8px 18px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: border-color 0.3s, color 0.3s;
}
.btn-ghost:hover { border-color: var(--brand-gold); color: var(--brand-gold); }

/* Hymn Body Grid */
.hymn-body {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 2.5rem;
}

@media (max-width: 860px) {
    .hymn-body { grid-template-columns: 1fr; }
    .hymn-title { font-size: 2.2rem; }
    .section-hero h1 { font-size: 2.5rem; }
}

/* Lyrics Panel */
.hymn-lyrics {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-subtle);
    font-size: 1.05rem;
    line-height: 2.1;
    white-space: pre-line;
}

/* Sheet Music Panel */
.hymn-sheet-music {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-subtle);
}

#sheet-music-container {
    width: 100%;
    min-height: 480px;
    background: #fff;
    border-radius: 8px;
    overflow: auto;
}

/* Advertisement Banner */
.hymn-ad-banner {
    margin: 2rem 0;
    text-align: center;
    background: rgba(0,0,0,0.02);
    border: 1px dashed var(--border-subtle);
    padding: 1.5rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================================
   GLASSMORPHIC AUDIO PLAYER
   ============================================================ */
.custom-audio-player {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 820px;
    background: rgba(31, 17, 19, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 50px;
    padding: 1rem 2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    z-index: 1000;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #F0E6D2;
    width: 100%;
}

.player-controls button {
    background: var(--brand-gold);
    color: var(--brand-burgundy);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
}

.player-controls button:hover { transform: scale(1.12); background: #fff; }

#seek-bar { flex-grow: 1; cursor: pointer; accent-color: var(--brand-gold); }

.player-controls select {
    background: transparent;
    color: #F0E6D2;
    border: 1px solid var(--brand-gold);
    padding: 4px 6px;
    border-radius: 4px;
    outline: none;
    font-size: 0.85rem;
}

.btn-download {
    background: transparent;
    color: var(--brand-gold);
    border: 1px solid var(--brand-gold);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-download:hover { background: var(--brand-gold); color: var(--brand-burgundy); }
.btn-download.locked { border-color: #666; color: #666; cursor: not-allowed; }
.btn-download.locked:hover { background: transparent; color: #666; }

@media (max-width: 600px) {
    .custom-audio-player { border-radius: 20px; padding: 1rem; bottom: 1rem; }
    .player-controls { flex-wrap: wrap; justify-content: center; }
}

/* ============================================================
   PREMIUM CTA / PAYWALLS
   ============================================================ */
.premium-cta {
    background: linear-gradient(135deg, var(--brand-burgundy) 0%, var(--accent) 100%);
    border: 1px solid var(--brand-gold);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    margin: 2rem 0;
}

.premium-cta h2 { color: var(--brand-gold); }
.premium-cta p  { color: rgba(255,255,255,0.8); margin: 1rem 0 2rem; }

.btn-primary {
    display: inline-block;
    background: var(--brand-gold);
    color: var(--brand-burgundy);
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 700;
    font-family: var(--font-body);
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
    color: var(--brand-burgundy);
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.dashboard-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--card-shadow);
}

.dashboard-card h3 { font-size: 1.2rem; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.hymn-form-group { margin-bottom: 1.5rem; }
.hymn-form-group label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.hymn-form-group input,
.hymn-form-group select,
.hymn-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.3s;
    outline: none;
}

.hymn-form-group input:focus,
.hymn-form-group textarea:focus { border-color: var(--brand-gold); box-shadow: 0 0 0 3px rgba(212,175,55,0.15); }

/* Star Rating Widget */
.star-rating { display: flex; gap: 4px; justify-content: center; margin: 0.5rem 0; }
.star-rating button {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--border-subtle);
    transition: color 0.2s;
    padding: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    line-height: 1;
}
.star-rating button.active,
.star-rating button:hover { color: var(--brand-gold); background: transparent; transform: none; }

/* ============================================================
   DISCUSSIONS / COMMENTS
   ============================================================ */
.hymn-discussions {
    margin-top: 4rem;
    padding: 2.5rem;
    background: var(--bg-secondary);
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
}

.hymn-discussions h2 { color: var(--brand-gold); margin-bottom: 2rem; }

/* ============================================================
   SEARCH PAGE
   ============================================================ */
.search-bar-wrap {
    display: flex;
    gap: 12px;
    max-width: 700px;
    margin: 2rem auto;
}

.search-bar-wrap input {
    flex: 1;
    padding: 15px 20px;
    border-radius: 8px;
    border: 2px solid var(--brand-gold);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.05rem;
    outline: none;
}

.search-bar-wrap button {
    background: var(--brand-gold);
    color: var(--brand-burgundy);
    border: none;
    padding: 0 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.search-bar-wrap button:hover { opacity: 0.88; }

.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 700px;
    margin: 0 auto 2rem;
}

.search-filters select {
    flex: 1;
    min-width: 150px;
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

/* ============================================================
   COMPOSER PROFILE
   ============================================================ */
.composer-profile-hero {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 3rem;
}

.composer-avatar {
    width: 100px;
    height: 100px;
    background: var(--brand-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--brand-burgundy);
    margin: 0 auto 1.5rem;
    border: 4px solid var(--brand-burgundy);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }

.notice-box {
    padding: 1.5rem 2rem;
    border-radius: 8px;
    border-left: 4px solid var(--brand-gold);
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin: 2rem 0;
}
