/* /khalwati-public-assets/v16/design-r16.css */
/* Khalwati R16 | additive polish only; keep original palette, layout and Arabic typefaces. */
:root { --kh-r16-tap:44px; }
.site-header .nav-links a,
.site-header [aria-label="قائمة الهاتف"] a,
.footer-links a { min-height:var(--kh-r16-tap); align-items:center; }
.site-header .nav-links a { display:inline-flex; font-size:max(13.5px,.86rem); line-height:1.45; }
:where(.home-refined,.library-page-ui3,.audio-page) .book-card h3,
.book-card h3 { font-size:clamp(15px,1.8vw,17px); line-height:1.6; overflow-wrap:break-word; }
.book-card .cat, .book-card .open { font-size:max(13px,.85rem); line-height:1.45; }
.books-grid .book-card .book-cover-wrap img,
.book-card .book-cover-wrap img { object-fit:contain; max-width:100%; }
.home-refined .community-home .community-card { min-height:var(--kh-r16-tap); }
.home-refined .community-home .community-card strong {font-size:clamp(14px,1.8vw,16px);line-height:1.5;}
.audio-page .audio-hero p {font-size:clamp(15px,1.8vw,17px);line-height:1.75;}
.audio-page button, .audio-page .audio-toolbar a, .audio-page .audio-toolbar button { min-height:var(--kh-r16-tap); }
:where(.home-refined,.library-page-ui3,.audio-page) :is(a,button,input,select):focus-visible,
.site-header a:focus-visible, .book-card:focus-visible,
.app button:focus-visible, .reader-drawer button:focus-visible {
  outline:3px solid #ad8530; outline-offset:3px;
}
.kh-r16-sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
@media (max-width:680px) {
  .home-refined .community-home .community-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .home-refined .community-home .community-card { padding:13px 10px; }
  .home-refined .community-home .community-card strong {font-size:15px;}
  .home-refined .books-grid .book-card h3,
  .library-page-ui3 .books-grid .book-card h3 {font-size:15px;line-height:1.55;}
  .book-card .cat,.book-card .open {font-size:13.5px;}
  .audio-page button {font-size:14px;}
  .app .topbar button,.app .topbar a {min-height:var(--kh-r16-tap);}
  .app .toolbar { overflow-x:auto; overflow-y:hidden; flex-wrap:nowrap; scrollbar-width:thin; padding-bottom:max(6px,env(safe-area-inset-bottom)); }
  .app .toolbar > * {flex-shrink:0;}
  .app .toolbar .tool-button,.app .toolbar .zoom-value,
  .app .toolbar .page-control input {min-height:var(--kh-r16-tap);}
  .app .toolbar #previousButton span,.app .toolbar #nextButton span {font-size:14px;}
  .reader-drawer .panel-action,.reader-drawer .panel-tab {min-height:var(--kh-r16-tap);font-size:14px;}
}
@media (prefers-reduced-motion:reduce) {
  .book-card,.community-card {transition-duration:.01ms!important;animation-duration:.01ms!important;}
}

/* /khalwati-public-assets/v17/design-r17.css */
/* Khalwati R17 | additive layout polish. Same palette, same Tajawal typeface, same components. */
:root{--kh17-green:#07583d;--kh17-deep:#073f34;--kh17-gold:#c99a37;--kh17-line:#e6d6ae;--kh17-paper:#fffdf8;--kh17-cream:#fbf6e9;--kh17-muted:#6e746e;--kh17-tap:44px}

/* 1) Library category filters: 440px-tall 2-column grid on phones -> one swipeable row. */
@media (max-width:680px){
  html body :is(.library-tools.kh-filters-only,.library-tools) .filters{
    display:flex!important;flex-wrap:nowrap!important;grid-template-columns:none!important;
    overflow-x:auto!important;overflow-y:hidden!important;max-width:100%;contain:inline-size;gap:8px!important;padding:2px 2px 10px!important;margin-inline:-4px;
    scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;scrollbar-width:none;
    mask-image:linear-gradient(to left,#000 88%,transparent);-webkit-mask-image:linear-gradient(to left,#000 88%,transparent);
  }
  html body :is(.library-tools.kh-filters-only,.library-tools) .filters::-webkit-scrollbar{display:none}
  html body :is(.library-tools.kh-filters-only,.library-tools) .filters>.filter{
    flex:0 0 auto!important;width:auto!important;min-height:var(--kh17-tap);scroll-snap-align:start;
    display:inline-flex!important;flex-direction:row!important;align-items:center;gap:8px;padding:0 14px!important;border-radius:999px!important;white-space:nowrap;
  }
  html body :is(.library-tools.kh-filters-only,.library-tools) .filters .kh-filter-label{font-size:14px}
  html body :is(.library-tools.kh-filters-only,.library-tools) .filters .kh-filter-count{font-size:12.5px}
}

/* 2) Book page: comfortable tap targets on breadcrumb links. */
.crumbs a{display:inline-block;padding:10px 2px;margin:-10px 0}
.crumbs{line-height:2}

/* 3) Book page: related books (server-rendered by library-book.php R17). */
.kh17-related{margin-top:28px;padding-top:22px;border-top:1px solid var(--kh17-line)}
.kh17-related-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 12px;margin:0 0 14px}
.kh17-related-head h2{margin:0;font-size:clamp(18px,2.2vw,22px);color:var(--kh17-deep);line-height:1.5}
.kh17-related-head a{color:var(--kh17-green);font-weight:800;text-decoration:none;white-space:nowrap;min-height:var(--kh17-tap);display:inline-flex;align-items:center}
.kh17-related-head a:hover{text-decoration:underline}
.kh17-related-grid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:14px}
.kh17-related-grid a{display:flex;flex-direction:column;height:100%;text-decoration:none;color:var(--kh17-deep);background:var(--kh17-paper);border:1px solid var(--kh17-line);border-radius:18px;padding:10px;transition:transform .15s ease,box-shadow .15s ease}
.kh17-related-grid a:hover{transform:translateY(-2px);box-shadow:0 10px 26px rgba(7,63,52,.10)}
.kh17-related-grid a:focus-visible{outline:3px solid #ad8530;outline-offset:3px}
.kh17-related-cover{display:block;aspect-ratio:3/4;border-radius:12px;background:#f4ecd9;overflow:hidden}
.kh17-related-cover img{display:block;width:100%;height:100%;object-fit:contain}
.kh17-related-title{display:block;margin-top:10px;font-weight:800;font-size:15px;line-height:1.6;overflow-wrap:anywhere}
.kh17-related-meta{display:block;margin-top:2px;font-size:13px;color:var(--kh17-muted)}
@media (max-width:600px){
  .kh17-related-grid{display:flex;overflow-x:auto;scroll-snap-type:x proximity;gap:12px;padding-bottom:8px;scrollbar-width:thin}
  .kh17-related-grid li{flex:0 0 42%;scroll-snap-align:start}
}
@media (prefers-reduced-motion:reduce){.kh17-related-grid a{transition:none}}

/* 4) Desktop book page: keep the card from floating in empty space on wide screens. */
@media (min-width:1100px){
  .book-detail .detail-grid{align-items:start}
  .book-detail .detail-cover{position:sticky;top:96px}
}

/* 5) Small-text floor on phones (kickers, notes, footer). */
@media (max-width:680px){
  .app-simple-kicker,.app-simple-note,.kh-sawati-eyebrow,.footer-copy{font-size:13px!important}
}

