/* Shared branding and educational pages. */
.site-header .brand-logo{display:block;flex:0 1 300px;min-width:180px;line-height:0}
.brand-logo img{display:block;width:100%;height:auto;max-height:80px;object-fit:contain;object-position:left center}
.header-links{display:flex;align-items:center;gap:10px;margin-left:auto}
.header-links>a{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:9px 15px;border:1px solid #dfd7c0;border-radius:7px;text-decoration:none;font-size:14px;line-height:1.4;white-space:nowrap;background:#fffef9;color:#38574a}
.header-links>.header-begin,.library-page .begin-button{background:#eed28a;border-color:#d2b566;color:#26493c;font-weight:700}
.header-links>.header-begin span{color:inherit}
.header-links>a[aria-current="page"]{background:#eaf0e4;border-color:#81977b}
.library-page .site-header{height:auto;min-height:105px;padding-top:12px;padding-bottom:12px;gap:20px}
.discovery-links{display:flex;justify-content:center;flex-wrap:wrap;gap:12px 28px;padding:0 20px;margin:0 0 22px;font-size:14px;color:#7c632e}
.discovery-page #library-main{padding:44px clamp(22px,4.2vw,80px) 28px;max-width:1400px;min-width:0}
.discovery-hero{padding:12px 0 32px;border-bottom:1px solid #e4e6db}
.discovery-hero h1{font:clamp(38px,4vw,62px)/1.12 var(--serif);margin:16px 0 20px;color:#193f36;letter-spacing:-1px}
.discovery-hero>p{font:clamp(18px,1.7vw,23px)/1.65 var(--serif);max-width:820px;color:#5b6b64}
.discovery-hero .hero-caption{font:14px/1.7 var(--sans);max-width:760px}
.hero-pills{display:flex;flex-wrap:wrap;gap:9px;margin-top:25px}
.hero-pills a,.outline-button{display:inline-flex;padding:10px 16px;min-height:44px;align-items:center;border:1px solid #d9dece;border-radius:24px;background:#f6f7ef;color:#3b5849;text-decoration:none;font-size:14px}
.fact-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:32px 0 44px}
.fact-grid article{border:1px solid #e4dfce;background:#fcfaf3;border-radius:12px;padding:24px 16px}
.fact-grid strong{font:clamp(29px,3.5vw,48px)/1.2 var(--serif);color:#806321}
.fact-grid h2{font:600 15px/1.5 var(--sans);margin:10px 0 4px}
.fact-grid p{font:12px/1.6 var(--sans);margin:0;color:#63736a}
.discovery-section{padding:22px 0 40px;scroll-margin-top:18px}
.discovery-section>h2{font:clamp(28px,2.7vw,39px)/1.25 var(--serif);margin:13px 0 18px}
.discovery-section>p{font-size:17px;line-height:1.8;max-width:900px;color:#54685a}
.chart-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin:28px 0}
.chart-card{margin:0;border:1px solid #e3e6dc;border-radius:12px;padding:22px;background:white;min-width:0}
.chart-card h3{font:24px/1.3 var(--serif);margin:0 0 6px}
.chart-card figcaption p{font-size:13px;margin:0 0 22px;color:var(--muted)}
.bar-chart{display:grid;gap:11px;margin-top:22px}
.bar-row{display:grid;grid-template-columns:minmax(95px,1.15fr) minmax(50px,1.8fr) 35px;align-items:center;gap:9px;font-size:12px;line-height:1.45}
.bar-row>strong{text-align:right;font-variant-numeric:tabular-nums;font-size:12px}
.bar-track{height:13px;border-radius:3px;background:#f1f3eb;overflow:hidden}
.bar-track>span{display:block;height:100%;border-radius:3px;background:#567963}
.chart-grid .chart-card:nth-child(2) .bar-track>span{background:#c6a253}
.chart-note{font-size:12px!important;line-height:1.75;color:var(--muted);margin-top:22px}
.method-box{background:#f7f8f2;border:1px solid #e0e5d7;border-radius:9px;padding:20px;margin:18px 0;font-size:14px;line-height:1.8;overflow-wrap:anywhere}
.method-box summary{font-weight:600;cursor:pointer}
.method-box h2{font:26px/1.3 var(--serif);margin:0 0 12px}
.method-box table{width:100%;border-collapse:collapse;margin:18px 0;background:white}
.method-box caption{text-align:left;margin-bottom:10px}
.method-box td,.method-box th{padding:8px 10px;text-align:left;border-bottom:1px solid #e3e6da}
.method-box code{font-size:11px;white-space:normal}
.theme-controls{display:flex;gap:14px;flex-wrap:wrap;align-items:center;margin:26px 0 16px}
.theme-controls label{font-size:15px;font-weight:600}
.theme-controls select,.history-controls select{font:inherit;max-width:100%;min-height:44px;padding:9px 12px;background:#fff;border:1px solid #ccd7c5;border-radius:6px;color:#26493c}
#theme-results{background:#fafbf6;border:1px solid #e1e6d9;padding:18px;border-radius:9px}
#theme-results h3{font:25px/1.3 var(--serif);margin:0 0 8px}
.theme-match{padding:12px 0;border-bottom:1px solid #dfe6d8;font-size:14px;line-height:1.8}
.theme-match p{margin:5px 0}
#theme-more{margin-top:12px}
.theme-guides,.context-card-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin:28px 0}
.theme-guides article,.context-card-grid article{border:1px solid #e2e5d8;border-radius:10px;padding:22px;background:#fffefb}
.theme-guides h3,.context-card-grid h3{font:23px/1.3 var(--serif);margin:0 0 13px}
.theme-guides p,.context-card-grid p{font-size:15px;line-height:1.8;color:#58695c}
.verse-links{display:flex;gap:8px;flex-wrap:wrap;margin-top:20px}
.verse-links a{font-size:12px;background:#edf2e6;border-radius:5px;text-decoration:none;padding:7px 10px;min-height:34px;color:#365640}
.context-note{padding:18px 22px;background:#f7f4e9;border-left:3px solid #c5a356;color:#60583e;font-size:14px;line-height:1.8}
.context-note h3{font:25px/1.3 var(--serif);margin:0 0 14px}
.faq-section details{padding:18px 0;border-bottom:1px solid #dfe4d8;font-size:16px;line-height:1.8}
.faq-section summary{cursor:pointer;font-weight:600}
.faq-section details p{color:#54685a}
.discovery-footer,.reader-discovery-nav{display:flex;flex-wrap:wrap;gap:12px 25px;justify-content:space-between;font-size:13px;border-top:1px solid #e2e6da;padding:24px 0;margin-top:28px;color:#58705f}
.reader-discovery-nav{justify-content:center}
.history-viewer{margin-top:30px}
.history-controls{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:18px 0}
.history-controls button{min-height:44px;border:1px solid #d7decd;border-radius:7px;background:#f4f6ec;padding:10px 14px;font-size:14px;color:#395743}
.history-controls #history-play{background:#d5b05b;border-color:#bf9c4d;color:#233e33}
.history-controls label{font-size:12px;color:var(--muted);margin-left:auto}
.history-controls select{font-size:12px;padding:6px}
.history-viewer figure{margin:0}
#history-image{display:block;object-fit:contain;width:100%;height:min(53vw,550px);background:#f1ede3;border-radius:10px}
#history-copy{padding:22px 0}
#history-copy h2{font:clamp(27px,2.6vw,38px)/1.3 var(--serif);margin:12px 0}
#history-copy>p{font-size:17px;line-height:1.8}
#history-copy .context-note{font-size:13px}
.history-thumbs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.history-thumbs button{border:2px solid transparent;padding:4px;border-radius:8px;text-align:left;background:#f5f5ec}
.history-thumbs button[aria-pressed="true"]{border-color:#b48b31;background:#fbf5e3}
.history-thumbs img{width:100%;height:85px;object-fit:cover;border-radius:4px}
.history-thumbs span{display:block;font-size:11px;line-height:1.5;margin:6px}
#history-status{font-size:12px;color:var(--muted);margin-top:18px}
@media(max-width:1150px){.chart-grid{grid-template-columns:1fr}.theme-guides,.context-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.library-page .site-header{padding-left:22px;padding-right:22px}.header-links{gap:7px}.header-links>a{font-size:12px;padding:8px 10px}.site-header .brand-logo{flex-basis:250px;min-width:160px}}
@media(max-width:900px){
 .library-page .site-header{height:auto;padding:15px 20px;flex-wrap:wrap;gap:14px}
 .site-header .brand-logo{flex:0 1 270px;min-width:0}
 .header-links{margin:0;width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .header-links>a,.header-links>.mobile-directory-button{font-size:13px;min-height:44px;width:100%;margin:0}
 .mobile-panels-ready.library-page .header-begin{display:inline-flex}
 .discovery-page #library-main{padding:25px 20px}
 .discovery-page .library-sidebar{height:auto;min-height:500px}
 .mobile-panel .library-sidebar{height:100%}
 .fact-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:24px 0}
 .fact-grid article{padding:18px 14px}.fact-grid strong{font-size:36px}
 .discovery-hero h1{font-size:39px}.discovery-hero>p{font-size:19px}
 .chart-card{padding:18px}.bar-row{grid-template-columns:minmax(100px,1.1fr) minmax(60px,1.5fr) 30px;font-size:11px}
 .theme-guides,.context-card-grid{grid-template-columns:1fr}
 .theme-guides article,.context-card-grid article{padding:20px}
 .history-thumbs{grid-template-columns:repeat(2,minmax(0,1fr))}
 #history-image{height:auto;aspect-ratio:16/9}
 .history-controls button{flex:1;font-size:12px;padding:9px 8px}
 .history-controls label{margin:0;width:100%}
 .discovery-footer{justify-content:flex-start}
 .hero-pills a{font-size:12px;padding:9px 11px}
}
@media(prefers-reduced-motion:reduce){.history-viewer *{transition:none!important}}

/* Warm gold, sand and blue-teal accents from the Graphical Quran palette. */
.header-links>a[href="quran-analytics.html"]{background:#efe2c8;border-color:#c9ad76;color:#6a502b;font-weight:600}
.header-links>a[href="historic-slideshow.html"]{background:#eddfcb;border-color:#ccb28e;color:#694c2e;font-weight:600}
.header-links>a[aria-current="page"]{box-shadow:inset 0 -3px 0 #8c723d}
.fact-grid article:nth-child(4n+1){background:#fbf2db;border-color:#e3cf99}
.fact-grid article:nth-child(4n+2){background:#f3ead8;border-color:#d8c29c}
.fact-grid article:nth-child(4n+3){background:#f1e7da;border-color:#d8c1a4}
.fact-grid article:nth-child(4n+4){background:#f4f1e7;border-color:#d9d1b7}
.fact-grid article:nth-child(4n+2) strong{color:#856738}
.fact-grid article:nth-child(4n+3) strong{color:#926b43}
.chart-card{background:#fffdf8;border-color:#ded6c4}
.chart-grid .chart-card:nth-child(2){background:#f5f0e7;border-color:#dfceb3}
.bar-row:nth-child(4n+1) .bar-track>span{background:#b88c44}
.bar-row:nth-child(4n+2) .bar-track>span{background:#b59b6a}
.bar-row:nth-child(4n+3) .bar-track>span{background:#9b7c58}
.bar-row:nth-child(4n+4) .bar-track>span{background:#799486}
.chart-grid .chart-card:nth-child(2) .bar-row:nth-child(3n+1) .bar-track>span{background:#c5a15b}
.chart-grid .chart-card:nth-child(2) .bar-row:nth-child(3n+2) .bar-track>span{background:#a99069}
.chart-grid .chart-card:nth-child(2) .bar-row:nth-child(3n) .bar-track>span{background:#a58461}
.bar-track{background:#ece9df}
.theme-guides article:nth-child(3n+1),.context-card-grid article:nth-child(3n+1){background:#fbf3e3;border-color:#e3d0a6}
.theme-guides article:nth-child(3n+2),.context-card-grid article:nth-child(3n+2){background:#f8f0df;border-color:#dfcda8}
.theme-guides article:nth-child(3n),.context-card-grid article:nth-child(3n){background:#f4ebe0;border-color:#ddc7ad}
.theme-guides article:nth-child(3n+2) h3,.context-card-grid article:nth-child(3n+2) h3{color:#7c6037}
.theme-guides article:nth-child(3n) h3,.context-card-grid article:nth-child(3n) h3{color:#765539}
.verse-links a{background:#f5e6bf;color:#664f27}
.theme-guides article:nth-child(3n+2) .verse-links a,.context-card-grid article:nth-child(3n+2) .verse-links a{background:#ead8b2;color:#7c6037}
.method-box{background:#f5f0e6;border-color:#ded0b5}
#theme-results{background:#f4f0e8;border-color:#ddd0b9}
.theme-match{border-bottom-color:#ddd1bd}
.hero-pills a:nth-child(1){background:#f8edcf;border-color:#e1cb8e;color:#715b2f}
.hero-pills a:nth-child(2){background:#f3e9d3;border-color:#d4bb8d;color:#775e33}
.hero-pills a:nth-child(3){background:#f0e3d1;border-color:#d5bd9b;color:#715135}

/* Compact caption lead-in above the slideshow image. */
#history-copy{padding:4px 0 18px}
#history-copy h2{margin:9px 0 10px}
#history-copy>p{margin:10px 0}
#history-copy .context-note{padding:10px 15px;margin-bottom:0}
.top-three-section{margin:30px 0 38px;padding:24px;border:1px solid #dfcd9e;border-radius:12px;background:#fcf7eb}
.top-three-section>h2{font:clamp(26px,2.5vw,36px)/1.3 var(--serif);margin:10px 0 12px}
.top-three-section>p{font-size:14px;line-height:1.8;color:#6c614c;max-width:850px}
.top-three-topics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;list-style:none;margin:22px 0 0;padding:0}
.top-three-topics>li{padding:20px;border:1px solid #deca9e;border-radius:9px;background:#f8ecd1}
.top-three-topics>li:nth-child(2){background:#f2e4ce;border-color:#d8bd91}
.top-three-topics>li:nth-child(3){background:#eee7d9;border-color:#d2c5ab}
.topic-rank{display:block;font:32px/1.2 var(--serif);color:#947139}
.top-three-topics h3{font:24px/1.3 var(--serif);margin:12px 0}
.top-three-topics p{font-size:14px;line-height:1.75;color:#645c4b}
.top-three-topics .topic-count{font-size:13px;font-weight:700;color:#785d31}
.top-three-topics a{display:inline-block;padding:8px 0;font-size:13px;color:#795b29}
@media(max-width:900px){.top-three-topics{grid-template-columns:1fr}.top-three-section{padding:18px}.top-three-topics h3{font-size:23px}}

/* More breathing room around the slideshow; sage balances the warm neutrals. */
#history-image{margin-bottom:36px}
.history-thumbs{padding-bottom:16px;margin-bottom:24px}
.fact-grid article:nth-child(4n+1){background:#eef4e6;border-color:#cddbbd}
.fact-grid article:nth-child(4n+1) strong{color:#567147}
.fact-grid article:nth-child(4n+4){background:#f2f6ec;border-color:#d4dfc5}
.chart-grid .chart-card:first-child{background:#f7faf3;border-color:#d5dfc8}
.bar-row:nth-child(4n+2) .bar-track>span{background:#8fa47e}
.chart-grid .chart-card:nth-child(2) .bar-row:nth-child(3n+2) .bar-track>span{background:#9aaa85}
.theme-guides article:nth-child(3n+2),.context-card-grid article:nth-child(3n+2){background:#eff5e8;border-color:#d2dfc4}
.theme-guides article:nth-child(3n+2) h3,.context-card-grid article:nth-child(3n+2) h3{color:#49613d}
.theme-guides article:nth-child(3n+2) .verse-links a,.context-card-grid article:nth-child(3n+2) .verse-links a{background:#dfeacf;color:#486139}
.hero-pills a:nth-child(2){background:#eaf2e0;border-color:#c5d5af;color:#4d663c}
.top-three-topics>li:nth-child(2){background:#edf4e3;border-color:#c8d8b4}
.top-three-topics>li:nth-child(2) .topic-rank,.top-three-topics>li:nth-child(2) h3{color:#4d663c}
.top-three-topics>li:nth-child(2) .topic-count,.top-three-topics>li:nth-child(2) a{color:#50673e}
@media(max-width:900px){#history-image{margin-bottom:28px}.history-thumbs{padding-bottom:12px;margin-bottom:20px}}

.history-filter{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:20px 0}.history-filter select{font:inherit;min-height:44px;padding:8px 12px;max-width:100%;border:1px solid #ccd7c5;border-radius:7px;background:#f6f8f1;color:#26493c}.history-filter label{font-weight:600}
.history-gallery-pages{display:flex;justify-content:space-between;gap:12px;align-items:center;margin:10px 0 30px;font-size:14px}.history-gallery-pages button{min-height:44px;padding:8px 15px;border:1px solid #cbd7bd;border-radius:7px;background:#edf3e5;color:#34513c}.history-gallery-pages button:disabled{opacity:.5}.history-gallery-pages>span{text-align:center}#history-copy{min-height:220px}#history-reader{display:inline-block;padding:8px 0;font-weight:600}.history-thumbs button{min-width:0}.history-thumbs img{display:block}#history-image{object-fit:contain}.gallery-summary{font-weight:600;color:#49613e}
@media(max-width:600px){.history-gallery-pages{font-size:12px;gap:8px}.history-gallery-pages button{padding:8px 10px}#history-copy{min-height:240px}.history-filter select{width:100%}}
