/*
Theme Name: Duke Report Books
Description: A small theme for dukereportbooks.com: header with Subscribe and Donate, the curriculum shelf, book pages and a support note.
Version: 0.5.2
Requires PHP: 8.0
License: GPLv2 or later
*/

:root {
	/* Matched to The Duke Report on Substack: Roboto Mono body, system sans-serif headings, orange #ff6719. */
	--ink: #363737; --mute: #6b6c6c; --line: #dcdcde; --soft: #f6f7f7;
	--accent: #1f3a5f; --orange: #ff6719; --bg: #fff;
	--mono: "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
	--sans: "SF Pro Display", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--wide: 1320px; --read: 760px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 18px/1.6 var(--mono); }
a { color: var(--orange); }
a:hover { color: #000; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4, h5, h6 { font-family: var(--sans); font-weight: 700; line-height: 1.2; margin: 1.4em 0 .5em; }
h1 { font-size: clamp(28px, 4vw, 40px); margin-top: .6em; }
h2 { font-size: clamp(22px, 3vw, 28px); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; width: auto; height: auto; clip: auto; padding: 8px 12px; background: #fff; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 20px; }
.read { max-width: var(--read); margin: 0 auto; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-name { font-family: var(--sans); font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.brand-tag { color: var(--mute); font: italic 14px var(--mono); }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; }
.site-nav a { text-decoration: none; color: var(--ink); font: 600 16px var(--sans); }
.site-nav a:hover, .site-nav .current-menu-item > a { color: var(--orange); text-decoration: underline; text-underline-offset: 4px; }
.header-actions { display: flex; gap: 8px; }
.btn { display: inline-block; border-radius: 999px; padding: 8px 18px; font: 600 15px/1.2 var(--sans); text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: #000; color: #fff; }
.btn-navy { background: var(--accent); color: #fff; }
.btn-navy:hover { background: #000; color: #fff; }
.btn-line { border-color: var(--accent); color: var(--accent); background: #fff; }
.btn-line:hover { background: var(--accent); color: #fff; }
@media (max-width: 700px) {
	.site-header .wrap { gap: 8px 14px; }
	.brand { width: 100%; flex-direction: column; gap: 0; }
	.brand-name { font-size: 22px; }
	.header-actions { margin-left: auto; }
	.btn { padding: 7px 14px; font-size: 14px; }
}

/* Main */
.site-main { padding: 18px 0 40px; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content iframe, .entry-content video { max-width: 100%; }
.entry-content blockquote { margin: 1.2em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--line); color: var(--mute); }
.entry-content table { border-collapse: collapse; width: 100%; }
.entry-content td, .entry-content th { border: 1px solid var(--line); padding: 6px 8px; }
.entry-meta { color: var(--mute); font-size: 14px; }
.archive-list { list-style: none; padding: 0; }
.archive-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pagination { margin: 28px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Support note and ways to give */
.support { background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); scroll-margin-top: 10px; }
.support .wrap { padding-top: 22px; padding-bottom: 24px; }
.support-inner { max-width: 880px; }
.support h2 { margin: 0 0 8px; font-size: 22px; }
.support p { margin: 0 0 14px; font-size: 16px; }
.give-ways { display: flex; flex-wrap: wrap; gap: 10px; }
.support-top { border-top: 0; }
.support-top .support-inner { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; max-width: none; }
.support-top p { margin: 0; flex: 1 1 420px; font-size: 15px; }

/* Footer */
.site-footer { background: #111820; color: #cfd3d8; font: 15px var(--sans); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 26px; padding-top: 22px; padding-bottom: 26px; align-items: center; }
.site-footer a { color: #fff; }
.site-footer .copy { margin-left: auto; color: #9aa1a9; }
@media (max-width: 700px) { .site-footer .copy { margin-left: 0; width: 100%; } }

/* The shelf's controls stay under nothing else when the page scrolls. */
.drb-shelf .drb-controls { top: 0; }
.admin-bar .drb-shelf .drb-controls { top: 32px; }
@media (max-width: 782px) { .admin-bar .drb-shelf .drb-controls { top: 0; } }

/* The WordPress toolbar, seen only when logged in, can run wider than a phone and make the
   phone shrink the whole page to fit. Clip it sideways; its menus still open downward. */
html, body { overflow-x: clip; }
@media screen and (max-width: 782px) {
	#wpadminbar { overflow-x: clip; max-width: 100vw; }
	#wpadminbar .display-name, #wpadminbar #wp-admin-bar-user-info .username { display: none !important; }
	#wpadminbar #wp-admin-bar-my-account > a { max-width: 52px; overflow: hidden; }
}

/* Buttons, the shelf and other controls use the sans-serif, as Substack's do. */
.drb-shelf, .entry-meta, .pagination, .give-ways { font-family: var(--sans); }
.drb-shelf .drb-search { font-family: var(--sans); }
.support p { font-size: 16px; }
.btn-line { border-color: var(--ink); color: var(--ink); }
.btn-line:hover { background: var(--ink); color: #fff; }

/* ---------- Book page ---------- */
.book-page .wrap { max-width: 1100px; }
.book-hero { display: grid; grid-template-columns: minmax(180px, 300px) 1fr; grid-template-areas: "cover head" "cover info"; grid-template-rows: auto 1fr; column-gap: 32px; align-items: start; margin: 10px 0 24px; }
.book-cover { grid-area: cover; } .book-head { grid-area: head; } .book-info { grid-area: info; }
/* Text-only store links (Anna's Archive, BookFinder…) as plain outlined buttons. */
.book-buy .mbt-book-buybutton { float: left; }
.book-page .book-buy .mbt-book-buybuttons a.mbt-universal-buybutton, .book-page .book-buy .mbt-book-buybuttons a.mbt-universal-buybutton:link, .book-page .book-buy .mbt-book-buybuttons a.mbt-universal-buybutton:visited { display: inline-flex !important; align-items: center; width: auto !important; height: auto !important; min-height: 44px; margin: 0 !important; padding: 8px 16px !important; border: 2px solid var(--ink) !important; border-radius: 6px !important; background: #fff !important; color: var(--ink) !important; font: 700 15px/1.2 var(--sans) !important; text-decoration: none !important; text-shadow: none !important; box-shadow: none !important; white-space: nowrap; }
.book-page .book-buy .mbt-book-buybuttons a.mbt-universal-buybutton:hover { border-color: var(--orange) !important; color: var(--orange) !important; }
.book-cover img { width: 100%; height: auto; border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.book-title { margin: 0 0 6px; }
.book-authors { margin: 0 0 14px; font: 600 18px var(--sans); color: var(--mute); }
.book-authors a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.book-courses { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 16px; font: 14px var(--sans); color: var(--mute); }
.chip { display: inline-block; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); text-decoration: none; font: 600 14px var(--sans); }
.chip:hover { border-color: var(--orange); color: var(--orange); }
.book-jumps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.book-buy .mbt-book-buybuttons { margin: 0; }
.book-buy .mbt-book-buybutton { padding: 0 6px 6px 0 !important; }
.book-section { margin: 34px 0; scroll-margin-top: 16px; }
.book-section > h2 { font-size: 24px; margin: 0 0 14px; padding-bottom: 6px; border-bottom: 2px solid var(--orange); }
.book-listen .audio { margin: 0 0 14px; max-width: 820px; }
.book-listen figcaption, .book-watch figcaption { font: 600 15px var(--sans); margin: 0 0 6px; }
.book-watch figcaption { margin: 8px 0 0; }
.videos { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.videos.one { grid-template-columns: minmax(0, 820px); }
.video { margin: 0; }
.video .yt, .video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; overflow: hidden; background: #000; }
.video .yt { position: relative; padding: 0; cursor: pointer; }
.video .yt img { width: 100%; height: 100%; object-fit: cover; opacity: .9; transition: opacity .2s; }
.video .yt:hover img { opacity: 1; }
.yt-play { position: absolute; left: 50%; top: 50%; width: 68px; height: 48px; margin: -24px 0 0 -34px; border-radius: 12px; background: var(--orange); }
.yt-play::after { content: ""; position: absolute; left: 27px; top: 14px; border-style: solid; border-width: 10px 0 10px 18px; border-color: transparent transparent transparent #fff; }
.book-about .entry-content { max-width: var(--read); }
.book-meta { margin: 30px 0; padding-top: 14px; border-top: 1px solid var(--line); font: 14px/1.6 var(--sans); color: var(--mute); }
.book-meta p { margin: 0 0 4px; }
.book-meta span { font-weight: 700; color: var(--ink); }
.book-next h2 a { color: inherit; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 130px; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.strip-book { scroll-snap-align: start; text-decoration: none; color: var(--ink); font: 13px/1.3 var(--sans); }
.strip-book img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.2); margin-bottom: 6px; }
.strip-book span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 700px) {
	.book-hero { grid-template-columns: 110px 1fr; grid-template-areas: "head head" "cover info"; column-gap: 16px; }
	.book-head { margin-bottom: 14px; }
	.book-buy .mbt-book-buybutton img { max-width: 100%; height: auto; }
	.book-title { font-size: 24px; }
	.book-authors { font-size: 15px; }
	.videos { grid-template-columns: 1fr; }
	.strip { grid-auto-columns: 110px; }
}

.yt-from { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 4px; background: rgba(0,0,0,.7); color: #fff; font: 600 12px var(--sans); }

/* ---------- Search ---------- */
.search-form { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: #fff; overflow: hidden; }
.search-form:focus-within { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(255,103,25,.2); }
.search-field { flex: 1; min-width: 0; border: 0; outline: 0; padding: 8px 4px 8px 14px; font: 15px var(--sans); background: transparent; }
.search-submit { border: 0; background: transparent; color: var(--mute); padding: 6px 12px; cursor: pointer; display: flex; }
.search-submit:hover { color: var(--orange); }
.header-search { width: 260px; }
@media (max-width: 1000px) { .header-search { order: 10; width: 100%; } }
.search-title { margin-bottom: 0; }
.search-count { color: var(--mute); font: 15px var(--sans); margin: 4px 0 12px; }
.search-again { max-width: 520px; margin-bottom: 22px; }
.results { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 480px) { .results { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.result { text-decoration: none; color: var(--ink); font-family: var(--sans); }
.result-cover { display: block; aspect-ratio: 2 / 3; background: #f0f0f1; border-radius: 3px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .2s, box-shadow .2s; }
.result-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result:hover .result-cover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(0,0,0,.22); }
.result-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; font-size: 14px; line-height: 1.3; margin-top: 6px; }
.result-by { display: block; font-size: 13px; color: var(--mute); margin-top: 2px; }

/* ---------- Language switcher ---------- */
.footer-lang { display: flex; align-items: center; gap: 8px; }
.footer-lang select { font: 14px var(--sans); }
.footer-lang .gt_selector { background: #fff; color: var(--ink); border-radius: 4px; padding: 3px 6px; }
/* GTranslate shows flags and a drop-down; the footer keeps the drop-down alone. */
.footer-lang a.glink { display: none !important; }
.footer-lang br { display: none; }
/* Relevanssi live results under the search box. */
.relevanssi-live-search-results { font-family: var(--sans) !important; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); border: 1px solid var(--line); }
.relevanssi-live-search-results a { color: var(--ink) !important; text-decoration: none; }
.relevanssi-live-search-results a:hover { color: var(--orange) !important; }

/* ---------- Buy Me a Coffee: their yellow and cup ---------- */
.btn-bmc { display: inline-flex; align-items: center; gap: 8px; background: #FFDD00; color: #000; border-color: #FFDD00; }
.btn-bmc:hover { background: #ffe94d; color: #000; border-color: #ffe94d; }
.btn-bmc img { width: 14px; height: 20px; }

/* ---------- Language button in the header ---------- */
.lang-menu { position: relative; }
.lang-btn { list-style: none; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; color: var(--ink); cursor: pointer; }
.lang-btn::-webkit-details-marker { display: none; }
.lang-btn:hover, .lang-menu[open] .lang-btn { background: var(--soft); color: var(--orange); }
.lang-pop { position: absolute; right: 0; top: 44px; z-index: 50; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); font: 14px var(--sans); white-space: nowrap; }
.lang-pop a.glink, .lang-pop br { display: none !important; }

/* ---------- First-visit thank-you line ---------- */
.support-bar { background: #fff4ec; border-bottom: 1px solid #ffd9c2; font: 15px/1.45 var(--sans); }
.support-bar .wrap { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.support-bar p { margin: 0; flex: 1; }
.support-bar-link { font-weight: 700; white-space: nowrap; }
.support-bar-close { border: 0; background: transparent; font-size: 16px; color: var(--mute); cursor: pointer; padding: 4px 8px; }
.support-bar-close:hover { color: var(--ink); }

/* ---------- Donate panel ---------- */
.support-panel { max-width: 620px; width: calc(100% - 32px); border: 0; border-radius: 12px; padding: 26px 26px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.support-panel::backdrop { background: rgba(17,24,32,.55); }
.support-panel h2 { margin: 0 0 10px; }
.support-panel p { font-size: 16px; margin: 0 0 18px; }
.support-panel-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 18px; color: var(--mute); cursor: pointer; padding: 6px; }
.support-panel-close:hover { color: var(--ink); }

/* ---------- Book page card ---------- */
.support-card { margin: 30px 0; padding: 18px 20px; border-radius: 10px; background: #fff4ec; border: 1px solid #ffd9c2; max-width: var(--read); }
.support-card p { margin: 0 0 12px; font-size: 16px; }

/* Buy buttons: MyBookTable's store pictures at the height of the other buttons, all in one wrapping row. */
.book-page .book-buy .mbt-book-buybuttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.book-page .book-buy .mbt-book-buybuttons > div[style*="clear"] { display: none; }
.book-page .book-buy .mbt-book-buybutton { float: none !important; padding: 0 !important; margin: 0 !important; width: auto !important; }
.book-page .book-buy .mbt-book-buybutton img { display: block; height: 44px !important; width: auto !important; max-width: none !important; border-radius: 6px; }
.book-page .book-buy .mbt-book-buybuttons a.mbt-universal-buybutton, .book-page .book-buy .mbt-book-buybuttons a.mbt-universal-buybutton:link, .book-page .book-buy .mbt-book-buybuttons a.mbt-universal-buybutton:visited { min-height: 44px; height: 44px !important; padding: 0 14px !important; font-size: 14px !important; }
@media (max-width: 700px) { .book-page .book-buy .mbt-book-buybutton img { height: 40px !important; } }
