/* Shared components and explicit RTL navigation states. Colours are theme tokens. */
html[data-theme] body.home-page #library-main-nav[data-polished="true"] {
 display:block!important;position:fixed!important;inset:auto!important;
 top:calc(82px + 10px + env(safe-area-inset-top,0px))!important;
 right:max(14px,env(safe-area-inset-right,0px))!important;left:auto!important;
 width:min(340px,calc(100vw - 28px))!important;
 max-height:calc(100dvh - 112px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));
 overflow-y:auto;overscroll-behavior:contain;
 background:var(--card)!important;color:var(--text)!important;border-color:var(--border)!important;
 box-shadow:var(--shadow)!important;opacity:0!important;visibility:hidden!important;
 transform:translateX(calc(100% + 32px))!important;pointer-events:none!important;z-index:80;
 transition:transform .2s,opacity .2s,visibility .2s;
}
/* Retire the homepage catalog, including legacy template copies. */
html body #live-catalog,html body section.live-catalog {display:none!important;margin:0!important;padding:0!important;box-shadow:none!important;border:0!important}
/* Suggestion chips own their surface/text pair even over the hero image. */
html[data-theme] :is(#site-theme,body) #search-hints a,
html[data-theme] :is(#site-theme,body) #search-hints a:visited {
 display:inline-flex;align-items:center;
 background:var(--card)!important;color:var(--text)!important;
 -webkit-text-fill-color:var(--text)!important;
 border:1px solid var(--border)!important;
 opacity:1!important;text-shadow:none!important;
}
html[data-theme] :is(#site-theme,body) #search-hints a:hover {
 background:var(--surface)!important;color:var(--link)!important;
 -webkit-text-fill-color:var(--link)!important;border-color:var(--link)!important;
}
html[data-theme] :is(#site-theme,body) #search-hints > span {
 color:var(--text-on-image)!important;text-shadow:0 1px 4px var(--image-text-shadow);
}
:root {--footer-whatsapp-text:#e1e9f3;--footer-whatsapp-surface:#1b3048;--footer-whatsapp-border:#405570}
html[data-theme] .site-footer a.footer-social-whatsapp,
html[data-theme] .site-footer a.footer-social-whatsapp:visited,
html[data-theme] .site-footer a.footer-social-whatsapp:hover {
 color:var(--footer-whatsapp-text)!important;
 background:var(--footer-whatsapp-surface)!important;
 border-color:var(--footer-whatsapp-border)!important;opacity:1!important;
}
html[data-theme] .site-footer a.footer-social-whatsapp span {color:inherit!important}
html[data-theme] .site-footer a.footer-social-whatsapp svg {fill:currentColor!important}
:root {--study-action-ink:#0c1420}
html[data-theme] .library-book-actions > a {
 background-color:var(--primary-bg)!important;color:var(--primary-contrast)!important;
}
html[data-theme="light"] :is(#site-theme,body) :is(.masters-specialty-grid,.phd-specialty-grid) > a > b {
 color:var(--study-action-ink)!important;-webkit-text-fill-color:var(--study-action-ink)!important;
}
html[data-theme] body.home-page #library-main-nav[data-polished="true"].open {
 opacity:1!important;visibility:visible!important;transform:none!important;pointer-events:auto!important;
}
html[data-theme] #library-main-nav :is(a,button,.public-nav-label,.public-nav-group-title,.public-nav-heading b) {color:var(--text)!important}
html[data-theme] #library-main-nav :is(small,.public-nav-arrow) {color:var(--text-muted)!important}
html[data-theme] #library-main-nav a:hover {background:var(--surface)!important;color:var(--primary)!important}
html[data-theme] :is(.site-header,.library-header,.notification-panel,.dropdown-menu) {background-color:var(--surface)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-theme] :is(.book-detail-page,.book-facts>div,.library-empty,.published-book-empty,.subject-picker>a,.study-grid>a) {background-color:var(--card)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-theme] :is(.library-crumb a,.library-footer a,.reset-card .brand b) {color:var(--primary)!important}
html[data-theme] :is(.brand small,.library-results-head>span,.library-results-head>small,.published-book-count,.published-book-empty,.library-empty,.notification-item time,.notification-push-settings,.notification-push-settings p,.notification-empty,.library-heading>p) {color:var(--text-muted)!important}
html[data-theme] :is(.category-icon,.notification-item,.notification-push-settings,.user-menu,#notifications-toggle) {background-color:var(--surface)!important;border-color:var(--border)!important}
html[data-theme] :is(.book-detail-page h1,.book-detail-page p,.book-facts dd,.notification-item strong) {color:var(--text)!important}
html[data-theme] .book-detail-page dt {color:var(--text-muted)!important}
html[data-theme] .library-nav a {color:var(--text)!important}
html[data-theme] .reset-card :is(a,b,small) {color:var(--text)!important}
html[data-theme] :is(.search-no-results,.live-result-message,.search-no-results) {color:var(--text-muted)!important}
html[data-theme] :is(button,input,select,textarea):disabled {opacity:1!important;color:var(--text-muted)!important;background-color:var(--surface)!important}
html[data-theme] a {color:var(--primary)}
html[data-theme] a.active {background-color:var(--primary-bg)!important;color:var(--primary-contrast)!important}
@media(max-width:700px){html[data-theme] body.home-page #library-main-nav[data-polished="true"]{top:calc(76px + 10px + env(safe-area-inset-top,0px))!important}}
@media(prefers-reduced-motion:reduce){html[data-theme] body.home-page #library-main-nav[data-polished="true"]{transition:none}}
html[data-theme] a.topic-back-button {
 display:inline-flex;align-items:center;justify-content:center;
 width:46px;height:46px;min-width:46px;min-height:46px;flex:0 0 46px;
 padding:0;border-radius:50%;border:1px solid var(--border);
 background:var(--surface);color:var(--primary);box-shadow:var(--shadow);
 text-decoration:none;transition:background-color .18s ease,border-color .18s ease,transform .18s ease;
}
html[data-theme] a.topic-back-button svg {display:block;flex:none;transition:transform .18s ease}
html[data-theme] a.topic-back-button:hover {background:var(--card);border-color:var(--primary);transform:translateY(-2px)}
html[data-theme] a.topic-back-button:hover svg {transform:translateX(2px)}
html[data-theme] a.topic-back-button:active {transform:translateY(0)}
html[data-theme] a.topic-back-button:focus-visible {outline:2px solid var(--primary);outline-offset:4px}
@media(prefers-reduced-motion:reduce){html[data-theme] a.topic-back-button,html[data-theme] a.topic-back-button svg{transition:none;transform:none}}
/* Keep return icons independent of each page's button and SVG rules. */
html[data-theme] a.topic-back-button {
 box-sizing:border-box!important;display:inline-flex!important;
 align-items:center!important;justify-content:center!important;
 width:46px!important;height:46px!important;min-width:46px!important;min-height:46px!important;
 max-width:46px!important;max-height:46px!important;flex:0 0 46px!important;
 padding:0!important;gap:0!important;border-radius:50%!important;
 line-height:1!important;text-indent:0!important;letter-spacing:0!important;
 color:var(--primary)!important;background:var(--surface)!important;
}
html[data-theme] a.topic-back-button::before,html[data-theme] a.topic-back-button::after {content:none!important}
html[data-theme] a.topic-back-button > svg {
 width:24px!important;height:24px!important;min-width:24px!important;
 max-width:24px!important;max-height:24px!important;flex:0 0 24px!important;
 display:block!important;margin:0!important;padding:0!important;
 fill:none!important;stroke:currentColor!important;stroke-width:1.8!important;
 stroke-linecap:round!important;stroke-linejoin:round!important;pointer-events:none;
}
html[data-theme] a.topic-back-button > svg path {fill:none!important;stroke:currentColor!important}
html[data-theme] a.topic-back-button:hover {background:var(--card)!important}
:root {--hero-heading-text:#f3f7ff;--hero-heading-accent:#f4d69e}
html[data-theme] body.home-page .hero h1,
html[data-theme] body .hero h1 {
 color:var(--hero-heading-text)!important;
 -webkit-text-fill-color:var(--hero-heading-text)!important;
}
html[data-theme] body .hero h1 em {
 color:var(--hero-heading-accent)!important;
 -webkit-text-fill-color:var(--hero-heading-accent)!important;
}
/* The original logo has an opaque white canvas: present it as an intentional badge. */
:root {--logo-badge-bg:var(--surface);--logo-badge-padding:0px;--logo-badge-radius:10px}
html[data-theme] :is(#site-theme,body) .brand-mark {
 background-color:var(--logo-badge-bg)!important;
 background-origin:content-box;background-repeat:no-repeat;
 border:0!important;box-shadow:none!important;outline:none!important;
 border-radius:var(--logo-badge-radius)!important;
 padding:var(--logo-badge-padding)!important;box-sizing:content-box!important;
 overflow:visible!important;flex-shrink:0;
}
html[data-theme] :is(#site-theme,body) .brand-mark:has(img[src*="college-logo"]) {
 background-image:none!important;
}
html[data-theme] :is(#site-theme,body) .brand-mark > img[src*="college-logo"] {
 background:transparent!important;border:0!important;box-shadow:none!important;outline:none!important;
 object-fit:contain!important;
}

html[data-theme] :is(#site-theme,body) .brand-mark {
 background-color:transparent!important;box-shadow:none!important;border:0!important;
}
html[data-theme] :is(#site-theme,body) .brand-mark:not(:has(img)) {
 background-image:url("/assets/college-logo-transparent.png")!important;
 background-size:contain;background-position:center;background-repeat:no-repeat;
}

:root {--college-logo-size:52px}
@media(max-width:700px){:root{--college-logo-size:40px}}
html[data-theme] :is(#site-theme,body) .brand-mark {
 width:var(--college-logo-size)!important;height:var(--college-logo-size)!important;
 min-width:var(--college-logo-size)!important;flex:0 0 var(--college-logo-size)!important;
 padding:0!important;line-height:0;
}
html[data-theme] :is(#site-theme,body) .brand-mark > img[src*="college-logo"] {
 display:block;width:100%!important;height:100%!important;
 object-fit:contain!important;padding:0!important;margin:0!important;
}

html[data-theme] #library-main-nav #logout-btn.public-nav-logout {
 display:flex;align-items:center;justify-content:flex-start;gap:10px;
 width:100%!important;height:auto!important;min-height:44px;
 padding:11px 12px!important;border-radius:10px;
 background:var(--surface)!important;color:var(--text)!important;
 border:1px solid var(--border)!important;font:inherit;font-size:13px;text-align:right;
}
html[data-theme] #library-main-nav #logout-btn.public-nav-logout svg {width:19px;height:19px;flex:none}
html[data-theme] #library-main-nav #logout-btn.public-nav-logout:hover {background:var(--danger-bg)!important;color:var(--danger)!important;border-color:var(--danger)!important}
html[data-theme] #library-main-nav #logout-btn.public-nav-logout.hidden {display:none!important}

/* Physical-left drawer; its contents retain Arabic RTL direction. */
html[data-theme] body.home-page .site-header #library-main-nav[data-polished="true"] {
 left:0!important;right:auto!important;top:0!important;bottom:0!important;
 width:min(360px,88vw)!important;max-width:88vw!important;
 height:100dvh!important;max-height:100dvh!important;box-sizing:border-box;
 border-radius:0 18px 18px 0!important;border-left:0!important;
 padding-top:calc(20px + env(safe-area-inset-top,0px))!important;
 padding-bottom:calc(20px + env(safe-area-inset-bottom,0px))!important;
 transform:translateX(-100%)!important;transform-origin:left center;
 direction:rtl;z-index:160!important;
 transition:transform .25s ease,opacity .2s ease,visibility .25s!important;
}
html[data-theme] body.home-page .site-header #library-main-nav[data-polished="true"].open {
 transform:translateX(0)!important;opacity:1!important;visibility:visible!important;pointer-events:auto!important;
}
@media(prefers-reduced-motion:reduce){
 html[data-theme] body.home-page .site-header #library-main-nav[data-polished="true"] {transition:none!important}
}

html[data-theme] #library-main-nav .public-nav-heading {
 background:transparent!important;color:var(--text)!important;
 border-color:var(--border)!important;box-shadow:none!important;
}
html[data-theme] #library-main-nav .public-nav-heading b {color:var(--text)!important}
html[data-theme] #library-main-nav .public-nav-close {
 background:var(--surface)!important;color:var(--text)!important;border-color:var(--border)!important;
}

html[data-theme] body.home-page #about.about-section {padding-bottom:24px!important}
html[data-theme] body.home-page #support-callout {margin-top:12px!important}
@media(max-width:700px){
 html[data-theme] body.home-page #about.about-section {padding-bottom:18px!important}
}

html[data-theme] :is(#site-theme,body) #hero-search.search-box,
html[data-theme] :is(#site-theme,body) #hero-search.search-box input {
 background:var(--card)!important;color:var(--text)!important;
}
html[data-theme] :is(#site-theme,body) #hero-search.search-box {border:1px solid var(--border)!important}
html[data-theme] :is(#site-theme,body) #hero-search.search-box input {box-shadow:none!important;border:0!important}
html[data-theme] :is(#site-theme,body) #hero-search.search-box input:focus {outline:none!important}
html[data-theme] :is(#site-theme,body) #hero-search.search-box:focus-within {outline:2px solid var(--primary);outline-offset:3px}
html[data-theme] :is(#site-theme,body) #hero-search.search-box input::placeholder {color:var(--text-muted)!important;opacity:1!important}
html[data-theme] :is(#site-theme,body) #hero-search.search-box > svg {color:var(--text-muted)!important;stroke:currentColor}

/* Support remains accessible through the side menu. */
html[data-theme] body.home-page #support-callout {display:none!important;margin:0!important;padding:0!important}

.book-card-shell {display:flex;flex-direction:column;gap:10px;min-width:0}
.book-card-shell>.published-book-card {flex:1}
.book-card-tools {display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.book-card-tools>.btn {flex:1;min-height:40px;font-size:11px;white-space:normal;text-align:center}
html[data-theme] .book-card-status {margin:0;color:var(--text-muted);font-size:11px;line-height:1.8}
html[data-theme] .book-card-tools>.btn {background:var(--surface)!important;color:var(--text)!important;border-color:var(--border)!important}
html[data-theme] .book-card-tools>.btn[aria-pressed="true"] {background:var(--success-bg)!important;color:var(--success)!important;border-color:var(--success)!important}

html[data-theme] :is(.book-card-tools > .btn,.live-book-item > [data-favorite-book],.live-book-item > [data-report-book]) {
 width:40px!important;height:40px!important;min-width:40px!important;min-height:40px!important;
 flex:0 0 40px!important;padding:9px!important;font-size:0!important;gap:0!important;
 display:inline-flex;align-items:center;justify-content:center;border-radius:10px;
}
html[data-theme] :is(.book-card-tools > .btn,.live-book-item > [data-favorite-book],.live-book-item > [data-report-book])::before {
 content:"";display:block;width:20px;height:20px;background:currentColor;
 -webkit-mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%203h12v18l-6-4-6%204z%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;
 mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M6%203h12v18l-6-4-6%204z%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;
}
html[data-theme] :is(.book-card-tools > a,.live-book-item > [data-report-book])::before {
 -webkit-mask-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%2021V3m0%201c5-4%209%204%2014%200v10c-5%204-9-4-14%200%22%2F%3E%3C%2Fsvg%3E");
 mask-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.8%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%2021V3m0%201c5-4%209%204%2014%200v10c-5%204-9-4-14%200%22%2F%3E%3C%2Fsvg%3E");
}
.book-card-tools {justify-content:flex-start}

html[data-theme] :is(#site-theme,body) main.admin-login-wrap > section.admin-login {
 background:var(--card)!important;color:var(--text)!important;
 border:1px solid var(--border)!important;box-shadow:var(--shadow)!important;
 border-radius:18px;backdrop-filter:none;
}
