/* Devotional presentation layer (see devotional-ui.js). Loaded last; it adds
   ornament and atmosphere without changing layout. All motion sits inside
   prefers-reduced-motion: no-preference. */

/* ---- Seva-time palettes ------------------------------------------------ */
:root { --seva-glow: transparent; --seva-from: #f6ecd8; --seva-to: #f6ecd8; }
:root[data-seva="suprabhatam"] { --seva-glow: rgba(240,150,60,.24); --seva-from: #fbf1e2; --seva-to: #f3dfc4; }
:root[data-seva="sandhya"] { --seva-glow: rgba(214,120,40,.26); --seva-from: #f6eadb; --seva-to: #e8d2b6; }
:root[data-seva="ekantha"] { --seva-glow: rgba(231,185,94,.1); --seva-from: #121b18; --seva-to: #121b18; }
body { background: radial-gradient(circle at 80% 0, var(--seva-glow), transparent 32%), linear-gradient(145deg, var(--seva-from), var(--seva-to)) fixed; }
/* Phones repaint fixed backgrounds on every scroll frame; let it scroll there. */
@media (max-width: 650px) { body { background-attachment: scroll; } }
:root[data-seva="ekantha"] .topbar { background: rgba(18,27,24,.92); border-bottom-color: rgba(231,185,94,.22); }
:root[data-seva="ekantha"] .topbar-context small { color: #e7b95e; }
:root[data-seva="ekantha"] .topbar-context b, :root[data-seva="ekantha"] .menu-btn { color: #f3e6c8; }
:root[data-seva="ekantha"] .topbar-context { border-right-color: rgba(231,185,94,.25); }
/* Night is the generated dark theme (night-theme.css, tools/build_night_theme.py). */
:root[data-seva="suprabhatam"] .hero, :root[data-seva="sandhya"] .hero { box-shadow: 0 24px 60px rgba(160,90,30,.18); }
:root[data-seva="sandhya"] .hero::after, :root[data-seva="suprabhatam"] .hero::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(circle at 85% 20%, rgba(255,170,80,.22), transparent 45%); }

/* Sidebar panel for choosing a palette. */
.seva-panel { margin: 18px 4px 6px; padding: 14px 12px; border: 1px solid rgba(231,185,94,.2); border-radius: 16px; background: rgba(255,255,255,.03); }
.seva-panel > small { display: block; margin: 0 2px 8px; color: #9e8658; font: 700 10px var(--sans, sans-serif); letter-spacing: .18em; }
.seva-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.seva-choices button { min-height: 34px; padding: 4px 11px; border: 1px solid rgba(231,185,94,.28); border-radius: 999px; background: transparent; color: #d6cdb4; font: inherit; font-size: 13px; cursor: pointer; }
.seva-choices button[aria-pressed="true"] { background: linear-gradient(145deg, #edc66f, #c98c3f); border-color: #e5b55b; color: #123d3b; }

/* ---- Sacred days ----------------------------------------------------- */
.festival-banner { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; margin: 0 0 14px; padding: 12px 18px; border: 1px solid #d9ad58; border-radius: 16px; background: linear-gradient(100deg, #fff4dc, #fbe3b5); color: #5b2f17; box-shadow: 0 10px 26px rgba(150,90,30,.14); }
.festival-banner img { width: 44px; height: 44px; object-fit: contain; }
.festival-banner b { display: block; font: 400 22px/1.4 var(--display, serif); color: #7a2e1b; }
.festival-banner span { font-size: 15px; }
.festival-jayanti, .festival-vardhanti, .festival-vaikuntha { background: linear-gradient(100deg, #0e4545, #24675f); color: #f8e7c4; border-color: #e7b95e; }
.festival-jayanti b, .festival-vardhanti b, .festival-vaikuntha b { color: #f3cd7d; }
#dailyCard.festival-day { box-shadow: 0 0 0 2px #d9ad58, 0 18px 45px rgba(150,90,30,.18); }

/* ---- Daily card as a temple doorway ---------------------------------- */
#dailyCard { position: relative; isolation: isolate; }
/* Gopuram crowns the నేటి కీర్తన heading (the card clips its own edges). */
.home-daily-feature .section-heading { position: relative; }
.home-daily-feature .section-heading > .daily-gopuram { position: absolute; right: 8px; bottom: 6px; width: 92px; height: 64px; pointer-events: none; background: url('assets/devotional-icons/tirumala-gopuram-v1.png') center bottom/contain no-repeat; filter: drop-shadow(0 4px 6px rgba(80,50,20,.18)); }
/* No kolam on the daily card: its corners met the chips and the action buttons.
   The old ॥ watermark also sat among the buttons in this layout. */
#dailyCard > .kolam-corners { display: none; }
#dailyCard::after { content: none !important; }
#dailyCard > .daily-diya { position: absolute; z-index: 2; top: 12px; right: 16px; width: 44px; height: 44px; pointer-events: none; background: url('assets/devotional-icons/temple-deepam-v1.png') center/contain no-repeat; }
/* Keep the chip row clear of the diya. */
#dailyCard .daily-title-row { padding-right: 52px; }
@media (max-width: 650px) { #dailyCard > .daily-diya { top: 10px; right: 10px; width: 34px; height: 34px; } #dailyCard .daily-title-row { padding-right: 38px; } .home-daily-feature .section-heading > .daily-gopuram { width: 72px; height: 52px; } }
#dailyCard > .daily-diya::after { content: ''; position: absolute; left: 50%; top: 2px; width: 30px; height: 30px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle, rgba(255,196,90,.55), transparent 70%); }

/* ---- Kolam corners and the seven hills ------------------------------- */
.page-intro, #dailyCard { isolation: isolate; }
.page-intro { position: relative; overflow: hidden; }
.kolam-corners { position: absolute; z-index: -1; inset: 8px; pointer-events: none; opacity: .55;
  --kolam: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='46' fill='none' stroke='%23b8843c' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M2 30V8a6 6 0 0 1 6-6h22'/%3E%3Cpath d='M8 30V14a6 6 0 0 1 6-6h16'/%3E%3Ccircle cx='14' cy='14' r='2.2' fill='%23b8843c'/%3E%3Cpath d='M20 20c4-6 10-6 14 0-4 6-10 6-14 0z'/%3E%3Ccircle cx='3' cy='40' r='1.2' fill='%23b8843c'/%3E%3Ccircle cx='40' cy='3' r='1.2' fill='%23b8843c'/%3E%3C/svg%3E");
}
/* Two diagonal corners; the second is rotated so its arcs turn inward. */
.kolam-corners::before, .kolam-corners::after { content: ''; position: absolute; width: 42px; height: 42px; background: var(--kolam) center/contain no-repeat; }
.kolam-corners::before { top: 0; left: 0; }
.kolam-corners::after { right: 0; bottom: 0; transform: rotate(180deg); }
.seven-hills { position: absolute; z-index: -1; left: 0; right: 0; bottom: 0; height: 46%; pointer-events: none; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 120' preserveAspectRatio='none'%3E%3Cpath d='M0 120V86l40-18 38 10 46-34 40 22 44-30 52 26 40-14 58 22 46-36 44 28 46-18 48 26 58-16v74z' fill='%23c9a46a' fill-opacity='.22'/%3E%3Cpath d='M0 120V98l60-14 50 12 70-22 60 16 80-20 70 18 70-14 60 12 80-10v44z' fill='%23b8843c' fill-opacity='.18'/%3E%3C/svg%3E") bottom/100% 100% no-repeat; }

/* ---- Gold hairline on hover ------------------------------------------ */
:is(.keertana-result, .raga-tile, .audio-library-song, .scripture-card, .word-tile, .volume-card, .plate-card) { transition: box-shadow .2s, border-color .2s, transform .2s; }
:is(.keertana-result, .raga-tile, .audio-library-song, .scripture-card, .word-tile, .volume-card, .plate-card):hover { border-color: #d9ad58 !important; box-shadow: 0 0 0 1px rgba(217,173,88,.55), 0 10px 26px rgba(150,100,40,.12) !important; }

/* ---- Copper volume badges -------------------------------------------- */
@media (min-width: 701px) {
  :is(#libraryView, #explanationsView, #journeyView, #collectionsView, #bookmarksView) .song-number { background: linear-gradient(145deg, #c27a43, #8a4a26 60%, #a8602f) !important; border: 1px solid #6d3a1e !important; color: #fbe2bd !important; box-shadow: inset 0 1px 0 rgba(255,220,170,.4), inset 0 -2px 3px rgba(60,25,10,.35), 0 2px 5px rgba(90,45,20,.2) !important; text-shadow: 0 -1px 0 rgba(60,25,10,.6); }
  :is(#libraryView, #explanationsView, #journeyView, #collectionsView, #bookmarksView) .song-number small { color: #f5cf98 !important; }
}
.song-list.grid .song-number { background: linear-gradient(145deg, #c27a43, #8a4a26 60%, #a8602f) !important; color: #fbe2bd !important; border-color: #6d3a1e !important; }

/* ---- Gold-leaf loading shimmer --------------------------------------- */
.skeleton { background: linear-gradient(100deg, #efe2c6 20%, #f9eccc 38%, #e8cf98 50%, #f9eccc 62%, #efe2c6 80%) 0 0/300% 100% !important; border-radius: 14px; }

/* ---- Offering-style bookmark: a flower that blooms when offered ------- */
:root { --bloom: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='black'%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6'/%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6' transform='rotate(72 12 12)'/%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6' transform='rotate(144 12 12)'/%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6' transform='rotate(216 12 12)'/%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6' transform='rotate(288 12 12)'/%3E%3C/g%3E%3Ccircle cx='12' cy='12' r='2.6' fill='white'/%3E%3C/svg%3E");
  --bud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6'/%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6' transform='rotate(72 12 12)'/%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6' transform='rotate(144 12 12)'/%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6' transform='rotate(216 12 12)'/%3E%3Cellipse cx='12' cy='5.5' rx='3.2' ry='4.6' transform='rotate(288 12 12)'/%3E%3C/svg%3E"); }
[data-bookmark]:not(:has(> i)) { font-size: 0 !important; display: inline-grid; place-items: center; }
[data-bookmark]:not(:has(> i))::before, [data-bookmark] > i::before { content: ''; display: block; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--bud) center/contain no-repeat; mask: var(--bud) center/contain no-repeat; }
[data-bookmark] > i { font-size: 0 !important; display: inline-grid; place-items: center; }
[data-bookmark].active::before, [data-bookmark].active > i::before { -webkit-mask-image: var(--bloom); mask-image: var(--bloom); background: linear-gradient(145deg, #f2a33a, #c8441f); }
[data-bookmark].active { color: #c8641f; }
.offering-petals { position: fixed; z-index: 9999; width: 0; height: 0; pointer-events: none; }
.offering-petals i { position: absolute; left: -5px; top: -7px; width: 10px; height: 14px; border-radius: 60% 60% 60% 60% / 80% 80% 40% 40%; background: linear-gradient(160deg, #ffc067, #e2582a); opacity: 0; }

/* ---- Reader: engraved plate --------------------------------------------- */
#readerContent .lyric-manuscript .lyric-card { border-bottom: 0 !important; }
#readerContent .lyric-manuscript .lyric-card + .lyric-card { position: relative; }
#readerContent .lyric-manuscript .lyric-card + .lyric-card::before { content: '❀'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: min(60%, 340px); height: 20px; display: grid; place-items: center; font-size: 14px; line-height: 20px; color: #e3b778; text-shadow: 0 -1px 0 #251309, 0 1px 0 #6b4630;
  background: linear-gradient(90deg, transparent, #d3ad6955 30%, transparent 44%, transparent 56%, #d3ad6955 70%, transparent) center/100% 1px no-repeat; }
#readerContent .lyric-manuscript .pallavi-card .verse-lines { font-size: 1.12em; }
#readerContent .pallavi-initial { display: inline-block; margin-right: 1px; font-size: 1.45em; line-height: 1; vertical-align: -0.06em; color: #f6cf86; -webkit-text-stroke: .3px #fde3ad; text-shadow: 0 -1px 0 #3a1c0b, 0 1px 0 #8a5a33, 0 0 12px rgba(255,190,100,.35); }
#readerContent .lyric-manuscript::after { content: ''; position: absolute; z-index: 3; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse 60% 45% at 50% 18%, rgba(255,205,120,.35), transparent 70%); }

/* ---- Rāga samaya ----------------------------------------------------- */
.raga-samaya { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: 999px; font-style: normal; font-size: 12px; background: #f4ead6; color: #8a5a26; }
.raga-tile[data-samaya="dawn"] { background: linear-gradient(135deg, #fff6e6, #fde6c4) !important; }
.raga-tile[data-samaya="morning"] { background: linear-gradient(135deg, #fffbee, #f8edc8) !important; }
.raga-tile[data-samaya="evening"] { background: linear-gradient(135deg, #fdf0e3, #f2d3b4) !important; }
.raga-tile[data-samaya="night"] { background: linear-gradient(135deg, #eef0fb, #d9dcf2) !important; }
.raga-tile[data-samaya="night"] .raga-samaya { background: #2a2f5a; color: #f3e6c8; }
.raga-tile[data-samaya="evening"] .raga-samaya { background: #f6d9bb; color: #8a3f1a; }

/* ---- Player: bhava-chitra heading the expanded lyrics panel ------------ */
#musicPlayer .music-bhava { min-height: max-content; margin: 0; border: 1px solid rgba(231,185,94,.45); border-radius: 14px; overflow: hidden; background: #0b2f30; }
#musicPlayer .music-bhava img { display: block; width: 100%; height: auto; max-height: 300px; object-fit: contain; background: #0b2f30; }
#musicPlayer .music-bhava figcaption { padding: 6px 12px; font-size: 13px; color: #e7cf9c; }
/* Wide players: painting beside the lyrics, staying in view while they scroll. */
@media (min-width: 900px) {
  #musicPlayer.is-expanded .music-reading:has(> .music-bhava) { grid-template-columns: minmax(240px, 38%) minmax(0, 1fr); }
  #musicPlayer .music-reading > .music-bhava { grid-row: span 2; align-self: start; position: sticky; top: 0; }
}
#musicPlayer:not(.is-expanded) .music-bhava { display: none; }

/* ---- Motion (only when the reader has not asked for less) -------------- */
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: gold-leaf 1.8s ease-in-out infinite; }
  @keyframes gold-leaf { from { background-position: 100% 0; } to { background-position: 0 0; } }
  #dailyCard > .daily-diya::after { animation: diya-flicker 2.6s ease-in-out infinite; }
  @keyframes diya-flicker { 0%, 100% { opacity: .75; transform: translateX(-50%) scale(1); } 40% { opacity: 1; transform: translateX(-52%) scale(1.12); } 70% { opacity: .85; transform: translateX(-48%) scale(.95); } }
  #readerContent .lyric-manuscript::after { animation: lamp-lit 1.8s ease-out .15s 1; }
  @keyframes lamp-lit { 0% { opacity: 0; transform: translateX(-30%); } 45% { opacity: 1; } 100% { opacity: 0; transform: translateX(30%); } }
  .offering-petals i { animation: petal-fall 1.1s cubic-bezier(.2,.7,.4,1) forwards; }
  @keyframes petal-fall { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--spin)); } }
  [data-bookmark].active::before, [data-bookmark].active > i::before { animation: bloom .45s ease-out; }
  @keyframes bloom { 0% { transform: scale(.4) rotate(-40deg); } 70% { transform: scale(1.2) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
}
