/* Shared book reading controls and warm paper surfaces. */
body[data-scripture-reader]{--paper:#f4eedf;--paper2:#ece2cf;--ivory:#fcf7ec;--line:#ddd1bc;background:var(--paper)}
body[data-reader-paper="sepia"]{--paper:#eadcc5;--paper2:#dfceb1;--ivory:#f2e6d3;--line:#ccba9c}
body[data-reader-paper="sage"]{--paper:#eaf0e5;--paper2:#dfe7d8;--ivory:#f2f6ee;--line:#cbd5c4}
body[data-scripture-reader] .gita-study .gita-shloka>h2,body[data-scripture-reader] .gita-study .gita-shloka>.gita-sanskrit{background:var(--paper2)}
body[data-scripture-reader] .gita-study-sidebar{top:112px}
body[data-scripture-reader] .gita-study-chapter-list{max-height:calc(100dvh - 240px)}
body[data-scripture-reader] .gita-study .reader-heading{padding-right:0}
.reader-toolbar .reader-rail>.reader-text-tools{display:flex;flex:1;min-width:0;flex-direction:column;align-items:center;justify-content:center}
.reader-text-tools>[data-reader-text]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:100%;min-height:44px;padding:2px 4px;border:0;background:transparent;color:var(--wine);font-size:.6875rem;line-height:1.25}
.reader-mode-button,.reader-mode-exit{min-height:28px;padding:4px 2px;border:0;border-radius:0;background:transparent;color:var(--wine);font:400 .6875rem/1.4 var(--sans);white-space:nowrap;cursor:pointer}
.reader-mode-setting{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:20px;padding-top:16px;border-top:1px solid var(--line)}
body[data-scripture-reader] #readerSettings .reader-mode-setting h3{font:var(--type-ui-weight) var(--type-subhead-size)/var(--type-ui-line) var(--font-body);margin:0;letter-spacing:0}
body[data-scripture-reader] #main .reader-settings .reader-mode-setting p{margin:4px 0 0;font-size:.8125rem}
.reader-mode-setting .reader-mode-button{flex:none;min-height:44px;padding:8px;font-size:.875rem;text-decoration:underline;text-underline-offset:4px}
body[data-scripture-reader] .gita-study .reader-mode-button:focus-visible,body[data-scripture-reader] .reader-mode-exit:focus-visible{outline:0;text-decoration:underline;text-underline-offset:4px;text-decoration-thickness:2px}
.reader-mode-exit{position:fixed;z-index:200;top:max(12px,env(safe-area-inset-top,0px));right:max(16px,env(safe-area-inset-right,0px));padding:8px;background:var(--paper);font-size:.75rem}
/* Crop the existing logo to its symbol; the viewBox excludes all brand text. */
.reader-mode-watermark{display:none;position:fixed;left:50vw;top:50dvh;transform:translate(-50%,-50%);width:min(320px,56vw);opacity:.055;filter:grayscale(1);pointer-events:none;user-select:none;z-index:-1}
.reader-mode-watermark svg{display:block;width:100%;height:auto;overflow:hidden}
body.reading-mode{padding-bottom:32px!important}
body.reading-mode :is(.header,.topnote,.footer,.floating-socials,.gita-study-sidebar,.reader-toolbar,.mobile-site-nav,.gita-language-controls,.reader-crumb){display:none!important}
body.reading-mode #main{isolation:isolate}
body.reading-mode .reader-mode-watermark{display:block}
body.reading-mode [data-reader-watermark][hidden],body.reading-mode [data-reader-mode-exit][hidden]{display:block!important}
body[data-reader-language="sa"] .gita-meanings,body[data-reader-language="hi"] [data-meaning-language="en"],body[data-reader-language="en"] [data-meaning-language="hi"]{display:none}
body:is([data-reader-language="hi"],[data-reader-language="en"]) .gita-study .gita-meaning-columns{grid-template-columns:minmax(0,1fr)}
body:is([data-reader-language="hi"],[data-reader-language="en"]) .gita-study .gita-meaning-columns>section{border:0;padding-left:0}
body.reading-mode .gita-study{display:block;width:min(1100px,calc(100% - 64px));margin:68px auto 32px}
body.reading-mode #main .gita-study .gita-reading{width:100%;margin:0;padding:0}
body[data-scripture-reader].reading-mode .reader-heading{padding:0;margin:0}
body.reading-mode .reader-heading>h1{display:none}
body.reading-mode [data-reader]:focus{outline:none}
body[data-scripture-reader].reading-mode .gita-study .gita-shloka>h2,body[data-scripture-reader].reading-mode .gita-study .gita-shloka>.gita-sanskrit{background:transparent;border-left:0;padding-left:0;padding-right:0}
/* Plain reading actions retain their touch targets and focus indicators. */
body[data-scripture-reader] .reader-toolbar .reader-rail>:is(a,button,.reader-disabled){border:0;border-radius:0;background:transparent;box-shadow:none}
body[data-scripture-reader] .gita-language-controls button{border:0;border-radius:0;background:transparent;color:var(--muted);padding:8px 10px;min-height:44px}
body[data-scripture-reader] .gita-language-controls button[aria-pressed="true"]{background:transparent;color:var(--wine);font-weight:600;text-decoration:none}
body[data-scripture-reader][data-reader-language] .gita-language-controls button{color:var(--muted);font-weight:400}
body[data-scripture-reader][data-reader-language="both"] button[data-gita-language="both"],body[data-scripture-reader][data-reader-language="hi"] button[data-gita-language="hi"],body[data-scripture-reader][data-reader-language="en"] button[data-gita-language="en"],body[data-scripture-reader][data-reader-language="sa"] button[data-gita-language="sa"]{color:var(--wine);font-weight:600}
body[data-scripture-reader] .reader-size-actions button{border:0;border-radius:0;background:transparent}
body[data-scripture-reader] :is(.reader-mode-button,.reader-mode-exit,.reader-toolbar a,.reader-toolbar button,.reader-size-actions button):hover{background:transparent;color:var(--wine2);text-decoration:underline;text-underline-offset:4px}
.reader-paper-options{margin:20px 0 0;padding:16px 0 0;border:0;border-top:1px solid var(--line);min-width:0}
.reader-paper-options legend{padding:0 8px 0 0;font-size:.875rem;color:var(--ink)}
.reader-paper-options>div{display:flex;justify-content:space-between;gap:8px}
.reader-paper-options label{display:flex;flex:1;min-width:0;flex-direction:column;align-items:center;gap:6px;padding:8px 2px;cursor:pointer;font-size:.75rem;color:var(--ink)}
.reader-paper-options input{accent-color:var(--wine);margin:0;width:16px;height:16px}
.reader-paper-swatch{display:block;width:42px;height:30px;border:1px solid #736c6466;border-radius:3px}
[data-paper-swatch="paper"]{background:#f4eedf}[data-paper-swatch="sepia"]{background:#eadcc5}[data-paper-swatch="sage"]{background:#eaf0e5}
.reader-paper-options input:checked+.reader-paper-swatch{outline:2px solid var(--wine);outline-offset:2px}
@media(min-width:1100px){
 body[data-scripture-reader][data-reader-language]:not(.reading-mode) [data-gita-language-controls][hidden]{display:flex!important}
 body[data-scripture-reader]:not(.reading-mode) .gita-study-content{display:grid;grid-template-columns:minmax(0,1fr) 82px;column-gap:16px;align-items:start}
 body[data-scripture-reader] .gita-study-content>.gita-reading{grid-column:1;grid-row:1}
 body[data-scripture-reader] .gita-study .reader-toolbar .reader-rail>.reader-text-tools{position:sticky;grid-column:2;grid-row:1;top:calc(var(--reader-header-height,88px) + 12px);align-self:start;width:82px}
 body[data-scripture-reader] .gita-study .reader-toolbar::before{content:"";position:fixed;z-index:79;left:max(348px,calc((100% - 1488px)/2 + 316px));right:max(32px,calc((100% - 1488px)/2));bottom:0;height:76px;background:var(--paper);border-top:1px solid var(--line)}
}
@media(min-width:1100px) and (max-width:1399px){body[data-scripture-reader] .gita-study .reader-toolbar::before{left:288px}}
@media(max-width:1099px){
 body[data-scripture-reader] .gita-study .reader-heading{padding-right:0}
 body[data-scripture-reader]:not(.reading-mode){display:flex;flex-direction:column;height:100dvh;min-height:0;overflow:hidden;padding-bottom:var(--reader-controls-height,calc(65px + env(safe-area-inset-bottom,0px)))!important}
 body[data-scripture-reader]:not(.reading-mode)>.topnote,body[data-scripture-reader]:not(.reading-mode)>.header{flex:none}
 body[data-scripture-reader]:not(.reading-mode)>#main{flex:1;min-height:0;overflow-y:auto;overscroll-behavior-y:contain;padding-bottom:16px;scroll-padding-bottom:20px}
 body[data-scripture-reader] .reader-toolbar{left:0;right:0;bottom:0;width:100%;max-width:none;margin:0;transform:none;padding:6px max(8px,env(safe-area-inset-right,0px)) calc(6px + env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));border:0;border-top:1px solid #d5c9b9;border-radius:0;box-shadow:0 -3px 14px #2b27250d;background:var(--ivory)}
 body[data-scripture-reader] .reader-toolbar [aria-expanded="true"]{color:var(--wine);font-weight:600;text-decoration:underline;text-underline-offset:4px}
}
@media(max-width:600px){body.reading-mode .gita-study{width:calc(100% - 32px);margin-top:68px}}
@media print{.reader-mode-button,.reader-mode-exit,.reader-mode-watermark{display:none!important}}

/* Shared Sanskrit ink: semantic language, every current/future scripture reader. */
body[data-scripture-reader]{--reader-sanskrit-ink:#9a5264}
/* Slightly deeper ink keeps small Sanskrit readable on the darker sepia paper. */
body[data-scripture-reader][data-reader-paper="sepia"]{--reader-sanskrit-ink:#864354}
body[data-scripture-reader] #main [data-reader] [lang="sa"],
body[data-scripture-reader] #main [data-reader-book] [lang="sa"],
body[data-scripture-reader] #main [data-reader] .gita-sanskrit{color:var(--reader-sanskrit-ink)}
@media(forced-colors:active){
 body[data-scripture-reader] #main [data-reader] [lang="sa"],
 body[data-scripture-reader] #main [data-reader-book] [lang="sa"],
 body[data-scripture-reader] #main [data-reader] .gita-sanskrit{color:CanvasText}
}
