/* ELILM — base styles and the shared component system. Tokens come from theme.css.
   Logical properties only (inline-start/end), so one stylesheet serves RTL and LTR.
   Breakpoints: 480 (large phone) · 640 (small tablet) · 768 · 1024 (laptop) · 1280 · 1600 · 1920. */

/* ==========================================================================
   1. Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-total) + var(--s-4)); }
body { margin: 0; font-family: var(--font-ui); font-size: var(--text-md); line-height: var(--leading-body); color: var(--ink); background: var(--bg); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: clip; -webkit-font-smoothing: antialiased; }
main { flex: 1; min-width: 0; }
img, svg { max-width: 100%; display: block; }
img { height: auto; }
a { color: var(--brand); text-decoration: none; text-underline-offset: .2em; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 var(--s-3); line-height: var(--leading-tight); color: var(--ink); font-weight: 700; text-wrap: balance; }
h1 { font-family: var(--font-display); font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }
:lang(ar) h1, [dir="rtl"] h1 { line-height: 1.45; }
p { margin: 0 0 var(--s-4); }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
::selection { background: var(--accent-soft); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 1em; height: 1em; }
/* Directional icons are drawn for RTL reading and mirrored for LTR. */
[dir="ltr"] .icon-dir { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: var(--s-3); top: -80px; background: var(--brand); color: var(--on-dark); padding: var(--s-3) var(--s-4); border-radius: var(--radius-sm); z-index: 500; font-weight: 600; }
.skip-link:focus { top: var(--s-3); }
/* Latin/numeric content (e-mails, dates, ISBN) keeps its own direction but lines up with the page. */
.ltr { direction: ltr; unicode-bidi: isolate; text-align: left; }
[dir="rtl"] .ltr { text-align: right; }
[dir="rtl"] .table .num.ltr { text-align: left; }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.container-reading { max-width: calc(var(--container-reading) + 2 * var(--gutter)); }
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-5); }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: var(--s-3) var(--s-4); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center-row { justify-content: center; }
.eyebrow { display: block; font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--accent-ink); margin-bottom: var(--s-3); }
[dir="rtl"] .eyebrow:not(.ltr) { letter-spacing: 0; font-size: var(--text-sm); }
code, .table code { font-family: var(--font-mono); font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: var(--radius-xs); direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }

/* ==========================================================================
   2. Buttons — one primary per view; everything else steps down
   ========================================================================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--control-h); padding: var(--s-2) var(--s-5); border: 1px solid transparent; border-radius: var(--radius); font-weight: 600; font-size: var(--text-sm); line-height: 1.35; text-decoration: none; text-align: center; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; background: var(--surface-2); color: var(--ink); max-width: 100%; }
.btn:hover { text-decoration: none; background: var(--line); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .icon { width: 1.15em; height: 1.15em; }
.btn-primary { background: var(--brand); color: var(--on-dark); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-accent { background: var(--accent); color: var(--on-dark); }
.btn-accent:hover { background: var(--accent-ink); }
.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { background: var(--surface); border-color: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: var(--on-dark); }
.btn-danger:hover { background: #861a15; }
.btn-danger.btn-quiet { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger.btn-quiet:hover { background: var(--danger-soft); }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: .2em; }
.btn-sm { min-height: 36px; padding: var(--s-1) var(--s-3); font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; padding: var(--s-3) var(--s-6); font-size: var(--text-md); }
.btn-block { width: 100%; }
.btn[aria-pressed="true"], .btn.is-on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-outline.is-loading::after, .btn-ghost.is-loading::after, .btn:not([class*="btn-"]).is-loading::after { border-color: var(--line-strong); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: var(--control-h); height: var(--control-h); border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); flex: none; transition: background-color .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--brand); text-decoration: none; }
.count-dot { position: absolute; top: 4px; inset-inline-end: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-dark); font-size: var(--text-2xs); font-weight: 700; line-height: 18px; text-align: center; }

/* ==========================================================================
   3. Forms
   ========================================================================== */
.field { display: block; margin-bottom: var(--s-4); min-width: 0; }
.field > label, .label { display: block; font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--s-2); color: var(--ink); line-height: var(--leading-snug); }
.field .hint, .hint { display: block; font-size: var(--text-xs); color: var(--muted); margin-top: var(--s-2); line-height: var(--leading-snug); }
.input, .select, .textarea { width: 100%; min-height: var(--control-h); padding: var(--s-2) var(--s-3); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); line-height: 1.5; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none; }
.select { padding-inline-end: var(--s-6); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2336423d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 16px; background-position: right 12px center; }
[dir="rtl"] .select { background-position: left 12px center; }
.textarea { min-height: 132px; resize: vertical; line-height: var(--leading-body); }
.textarea-lg { min-height: 240px; }
.textarea-sm { min-height: 88px; }
.input::placeholder, .textarea::placeholder { color: #8a948f; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 61, 51, .16); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); background: #fffafa; }
.input[aria-invalid="true"]:focus, .textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(168, 35, 28, .16); }
.input:disabled, .select:disabled, .textarea:disabled, .input[readonly] { background: var(--surface-2); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.field-error { display: flex; gap: var(--s-1); color: var(--danger); font-size: var(--text-xs); margin-top: var(--s-2); font-weight: 600; line-height: var(--leading-snug); }
.check { display: flex; gap: var(--s-3); align-items: flex-start; font-size: var(--text-sm); cursor: pointer; line-height: var(--leading-snug); min-height: 28px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.check input:disabled { cursor: not-allowed; }
.form-grid { display: grid; gap: 0 var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.form-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-2); }
.required::after { content: " *"; color: var(--danger); }
.cf-turnstile { min-height: 65px; max-width: 100%; overflow: hidden; }

/* ==========================================================================
   4. Surfaces: cards, badges, alerts
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(var(--s-4), 2.4vw, var(--s-6)); min-width: 0; }
.card-title { font-family: var(--font-ui); font-size: var(--text-lg); margin-bottom: var(--s-4); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.card-title + .card-title, .card .field + .card-title, .card .check + .card-title { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.badge { display: inline-flex; align-items: center; gap: var(--s-1); padding: 2px var(--s-2); border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: 600; line-height: 1.5; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
a.badge:hover { background: var(--line); text-decoration: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand); color: var(--on-dark); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.alert { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-size: var(--text-sm); align-items: flex-start; line-height: var(--leading-snug); }
.alert > .icon { margin-top: 1px; }
.alert p { margin-bottom: var(--s-1); }
.alert .btn { margin-top: var(--s-2); margin-inline-start: var(--s-1); vertical-align: middle; }
.alert-info { background: var(--info-soft); border-color: #c6dbe9; color: #143f5b; }
.alert-success { background: var(--success-soft); border-color: #bcdcc9; color: #134e31; }
.alert-warning { background: var(--warning-soft); border-color: #ecd9ad; color: #5f3d00; }
.alert-danger { background: var(--danger-soft); border-color: #eec4c0; color: #7d1a14; }
.alert a { color: inherit; text-decoration: underline; }
.announcement { background: var(--accent-soft); color: var(--ink); text-align: center; font-size: var(--text-sm); padding: var(--s-2) var(--gutter); border-bottom: 1px solid #ead9b2; }
.noscript { background: var(--warning-soft); color: #5f3d00; text-align: center; padding: var(--s-3); font-size: var(--text-sm); }

/* ==========================================================================
   5. Header, navigation, drawer
   ========================================================================== */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid var(--line); }
.header-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "brand search actions"; align-items: center; gap: var(--s-4) clamp(var(--s-4), 3vw, var(--s-7)); min-height: var(--header-h); }
.header-menu { grid-area: menu; display: none; margin-inline-start: calc(-1 * var(--s-2)); }
.brand { grid-area: brand; display: inline-flex; align-items: baseline; gap: var(--s-2); color: var(--brand); font-weight: 700; font-size: 1.5rem; line-height: 1; letter-spacing: .16em; text-decoration: none; white-space: nowrap; direction: ltr; }
.brand:hover { text-decoration: none; }
.brand .brand-ar { font-family: var(--font-display); color: var(--accent-ink); font-size: 1.375rem; letter-spacing: 0; padding-inline-start: var(--s-2); border-inline-start: 1px solid var(--line-strong); line-height: 1.2; }
.header-search { grid-area: search; position: relative; width: 100%; max-width: 720px; justify-self: center; }
.header-search .input { padding-inline-start: 46px; border-radius: var(--radius-pill); background: var(--surface); border-color: var(--line-strong); min-height: 46px; }
.header-search > .icon { position: absolute; inset-inline-start: var(--s-4); top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; z-index: 1; }
.header-actions { grid-area: actions; display: flex; align-items: center; gap: var(--s-1); justify-self: end; }
.header-account { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--control-h); padding: 0 var(--s-3); border-radius: var(--radius-pill); color: var(--ink); font-size: var(--text-sm); font-weight: 600; background: transparent; border: 0; white-space: nowrap; }
.header-account:hover { background: var(--surface-2); text-decoration: none; }
.header-nav { border-top: 1px solid var(--line); }
.header-nav-inner { display: flex; align-items: center; gap: var(--s-1); min-height: 48px; margin-inline: calc(-1 * var(--s-3)); }
.header-nav a, .nav-toggle-sub { display: inline-flex; align-items: center; gap: var(--s-1); padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; font-size: var(--text-sm); background: none; border: 0; white-space: nowrap; line-height: 1.4; }
.header-nav a:hover, .nav-toggle-sub:hover, .nav-toggle-sub[aria-expanded="true"] { color: var(--brand); background: var(--surface-2); text-decoration: none; }
.header-nav a[aria-current="page"] { color: var(--brand); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.header-nav .nav-end { margin-inline-start: auto; color: var(--muted); }
.nav-toggle-sub .icon { width: 1em; height: 1em; transition: transform .15s; }
.nav-toggle-sub[aria-expanded="true"] .icon { transform: rotate(180deg); }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + var(--s-2)); inset-inline-end: 0; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: var(--s-2); z-index: 120; animation: pop-in .14s var(--ease); }
.dropdown-menu.is-wide { inset-inline: 0 auto; width: min(760px, calc(100vw - 2 * var(--gutter))); display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 var(--s-2); padding: var(--s-3); }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; gap: var(--s-3); align-items: center; padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); color: var(--ink-2); font-size: var(--text-sm); font-weight: 500; background: none; border: 0; text-align: start; white-space: normal; line-height: 1.5; min-height: 40px; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.dropdown-menu .dropdown-all { grid-column: 1 / -1; margin-top: var(--s-2); border-top: 1px solid var(--line); border-radius: 0; padding-top: var(--s-3); color: var(--brand); font-weight: 700; }
.dropdown-menu .badge { margin-inline-start: auto; }
.dropdown-sep { height: 1px; background: var(--line); margin: var(--s-2) var(--s-1); }
.dropdown-head { padding: var(--s-2) var(--s-3) var(--s-3); border-bottom: 1px solid var(--line); margin-bottom: var(--s-2); }
.dropdown-head strong { display: block; font-size: var(--text-sm); }
.dropdown-head span { font-size: var(--text-xs); color: var(--muted); overflow-wrap: anywhere; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.suggest { position: absolute; top: calc(100% + var(--s-2)); inset-inline: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: var(--s-2); z-index: 130; max-height: min(60vh, 420px); overflow: auto; text-align: start; }
.suggest a { display: block; padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); color: var(--ink); font-weight: 600; font-size: var(--text-sm); line-height: var(--leading-snug); }
.suggest a:hover, .suggest a.is-active { background: var(--surface-2); text-decoration: none; }
.suggest small { display: block; color: var(--muted); font-weight: 400; font-size: var(--text-xs); }

/* Drawer (mobile navigation, mobile filters). ui.js toggles .is-open and manages focus. */
.backdrop { position: fixed; inset: 0; background: rgba(10, 20, 17, .5); z-index: 240; opacity: 0; transition: opacity .2s; }
.backdrop.is-open { opacity: 1; }
html.has-overlay { overflow: hidden; }
.drawer { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(88vw, 380px); background: var(--bg); z-index: 250; display: flex; flex-direction: column; visibility: hidden; transform: translateX(-100%); transition: transform .26s var(--ease), visibility 0s linear .26s; box-shadow: var(--shadow-lg); overscroll-behavior: contain; }
[dir="rtl"] .drawer { transform: translateX(100%); }
.drawer.is-open { visibility: visible; transform: none; transition: transform .26s var(--ease), visibility 0s; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); min-height: var(--header-h); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s-3) var(--s-3) var(--s-6); -webkit-overflow-scrolling: touch; }
.drawer-title { margin: var(--s-5) var(--s-3) var(--s-2); font-size: var(--text-xs); font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.drawer-link, .drawer-body summary { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 48px; padding: var(--s-2) var(--s-3); border-radius: var(--radius); color: var(--ink); font-size: var(--text-md); font-weight: 500; background: none; border: 0; text-align: start; line-height: 1.4; }
.drawer-link:hover, .drawer-body summary:hover { background: var(--surface-2); text-decoration: none; }
.drawer-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.drawer-link .icon, .drawer-body summary .icon { color: var(--muted); }
.drawer-link .badge { margin-inline-start: auto; }
.drawer-body summary { cursor: pointer; list-style: none; }
.drawer-body summary::-webkit-details-marker { display: none; }
.drawer-body summary::after { content: ""; margin-inline-start: auto; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 1.7px 1.7px 0; transform: rotate(45deg); transition: transform .15s; margin-inline-end: var(--s-1); }
.drawer-body details[open] > summary::after { transform: rotate(-135deg); }
.drawer-sub { padding-inline-start: var(--s-6); padding-bottom: var(--s-2); }
.drawer-sub .drawer-link { min-height: 42px; font-size: var(--text-sm); color: var(--ink-2); }
.drawer-foot { padding: var(--s-4); border-top: 1px solid var(--line); display: grid; gap: var(--s-2); }
.drawer-foot .tagline { text-align: center; margin-top: var(--s-2); }
.tagline { font-size: var(--text-2xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); direction: ltr; font-weight: 600; margin: 0; }

@media (max-width: 1023px) {
  .header-main { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "menu brand actions" "search search search"; gap: 0 var(--s-2); }
  .header-menu { display: inline-flex; }
  .brand { font-size: 1.25rem; }
  .brand .brand-ar { font-size: 1.1875rem; }
  .header-search { max-width: none; padding-bottom: var(--s-3); }
  .header-search > .icon { top: calc(50% - var(--s-3) / 2); }
  .header-search .input { min-height: var(--control-h); }
  .header-nav { display: none; }
  .header-account span { display: none; }
  .header-account { padding: 0; width: var(--control-h); justify-content: center; }
  .header-actions .dropdown-menu { position: fixed; top: var(--header-h); inset-inline: var(--s-3); min-width: 0; }
}
@media (max-width: 359px) { .brand .brand-ar { display: none; } }

/* ==========================================================================
   6. Footer
   ========================================================================== */
.site-footer { background: var(--brand-strong); color: var(--on-dark-2); margin-top: var(--s-section); font-size: var(--text-sm); }
.site-footer a { color: var(--on-dark-2); }
.site-footer a:hover { color: var(--on-dark); }
.site-footer :focus-visible { box-shadow: 0 0 0 2px var(--brand-strong), 0 0 0 4px var(--on-dark); }
/* One row whatever the number of link columns (the store has five, the authors' site four). */
.footer-grid { display: grid; gap: var(--s-7) var(--s-5); grid-template-columns: minmax(220px, 1.4fr); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding-block: var(--s-8) var(--s-7); }
.footer-grid h3 { color: var(--on-dark); font-size: var(--text-sm); margin-bottom: var(--s-4); letter-spacing: .02em; }
.footer-grid li { margin-bottom: var(--s-3); line-height: var(--leading-snug); }
.footer-brand .brand { color: var(--on-dark); font-size: 1.75rem; }
.footer-brand .brand .brand-ar { color: #d9b56a; border-color: rgba(255, 255, 255, .25); font-size: 1.5rem; }
.footer-brand p { margin: var(--s-4) 0; max-width: 36ch; color: var(--on-dark-2); }
.footer-brand .tagline { color: #d9b56a; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .12); padding-block: var(--s-5); display: flex; gap: var(--s-3) var(--s-5); justify-content: space-between; flex-wrap: wrap; color: var(--on-dark-3); font-size: var(--text-xs); align-items: center; }
.footer-bottom a { color: var(--on-dark); font-weight: 600; }
.footer-pay { display: inline-flex; align-items: center; gap: var(--s-2); }
.footer-pay .icon { width: 14px; height: 14px; }
@media (max-width: 1023px) { .footer-grid { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 639px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6) var(--s-4); padding-block: var(--s-7) var(--s-6); } .footer-bottom { flex-direction: column; align-items: flex-start; } }

/* ==========================================================================
   7. Home: hero, sections, shelves
   ========================================================================== */
.hero { background: var(--brand-strong); color: var(--on-dark); position: relative; overflow: hidden; isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(900px 480px at 100% 0%, rgba(168, 121, 42, .28), transparent 62%), linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%); }
[dir="rtl"] .hero::before { background: radial-gradient(900px 480px at 0% 0%, rgba(168, 121, 42, .28), transparent 62%), linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: var(--s-7); align-items: center; padding-block: clamp(var(--s-7), 6vw, 104px); }
.hero-grid.is-solo { grid-template-columns: minmax(0, 1fr); }
.hero .eyebrow { color: #d9b56a; }
.hero h1 { font-size: var(--text-display); color: var(--on-dark); margin-bottom: var(--s-4); max-width: 16ch; }
.hero-lead { color: var(--on-dark-2); font-size: var(--text-lg); max-width: 52ch; margin-bottom: var(--s-6); line-height: var(--leading-body); }
.hero-search { display: flex; gap: var(--s-2); background: var(--surface); border-radius: var(--radius-pill); padding: 6px; max-width: 600px; box-shadow: var(--shadow-lg); position: relative; }
.hero-search .input { border: 0; background: transparent; min-height: 48px; padding-inline: var(--s-5) var(--s-2); color: var(--ink); box-shadow: none; min-width: 0; }
.hero-search .input:focus { box-shadow: none; }
.hero-search:focus-within { box-shadow: var(--shadow-lg), 0 0 0 3px rgba(217, 181, 106, .55); }
.hero-search .btn { border-radius: var(--radius-pill); padding-inline: var(--s-5); flex: none; min-height: 48px; }
.hero-tags { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-5); font-size: var(--text-sm); align-items: center; color: var(--on-dark-3); }
.hero-tags a { color: var(--on-dark); border: 1px solid rgba(255, 255, 255, .22); border-radius: var(--radius-pill); padding: var(--s-1) var(--s-3); line-height: 1.6; transition: background-color .15s, border-color .15s; }
.hero-tags a:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .5); text-decoration: none; }
.hero :focus-visible { box-shadow: 0 0 0 2px var(--brand-strong), 0 0 0 4px #d9b56a; }
.hero .input:focus-visible { box-shadow: none; }
.hero-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; }
/* A fan of real covers from the catalogue; decorative duplicates of links that exist below. */
.hero-stack { display: flex; justify-content: center; align-items: flex-end; gap: clamp(var(--s-3), 1.6vw, var(--s-5)); min-width: 0; }
.hero-stack a { display: block; flex: 0 1 190px; min-width: 0; border-radius: var(--radius-xs); transition: transform .3s var(--ease); }
.hero-stack a:nth-child(1) { transform: translateY(18px) rotate(-4deg); }
.hero-stack a:nth-child(2) { flex-basis: 230px; z-index: 1; }
.hero-stack a:nth-child(3) { transform: translateY(18px) rotate(4deg); }
.hero-stack a:hover { transform: translateY(-6px); text-decoration: none; }
.hero-stack .cover { box-shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 24px 44px -12px rgba(0, 0, 0, .55); }
.hero-plain { background: var(--surface-2); color: var(--ink); border-bottom: 1px solid var(--line); }
.hero-plain::before { display: none; }
.hero-plain h1 { color: var(--ink); max-width: 20ch; }
.hero-plain .hero-lead { color: var(--ink-2); }
.hero-plain .eyebrow { color: var(--accent-ink); }
@media (max-width: 899px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); padding-block: var(--s-6) var(--s-7); }
  .hero-stack { order: 2; justify-content: flex-start; gap: var(--s-3); }
  .hero-stack a, .hero-stack a:nth-child(2) { flex: 0 1 132px; transform: none; }
  .hero-lead { font-size: var(--text-md); margin-bottom: var(--s-5); }
}
@media (max-width: 479px) { .hero-search .btn span { display: none; } .hero-search .btn { padding-inline: var(--s-4); } .hero-search .input { padding-inline-start: var(--s-4); } }

.quick-nav { border-bottom: 1px solid var(--line); background: var(--surface); }
.quick-nav-inner { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; padding-block: var(--s-3); margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
.quick-nav-inner::-webkit-scrollbar { display: none; }
.quick-nav a { display: inline-flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-radius: var(--radius-pill); color: var(--ink-2); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; border: 1px solid var(--line); background: var(--bg); min-height: 40px; }
.quick-nav a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.quick-nav .icon { color: var(--accent); width: 1.1em; height: 1.1em; }

.section { padding-block: var(--s-section) 0; }
.section-tint { background: var(--surface); border-block: 1px solid var(--line); padding-block: var(--s-section); margin-top: var(--s-section); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); }
.section-head h2 { margin: 0; font-family: var(--font-display); font-size: clamp(var(--text-xl), 1rem + 1.4vw, 2rem); }
.section-head p { margin: var(--s-1) 0 0; color: var(--muted); font-size: var(--text-sm); }
.section-link { display: inline-flex; align-items: center; gap: var(--s-1); font-size: var(--text-sm); font-weight: 600; white-space: nowrap; min-height: 32px; }
.section-link .icon { width: 1em; height: 1em; }

/* Book grid: the column count is set per container width, never by shrinking the cards. */
.book-grid { display: grid; gap: clamp(var(--s-5), 2.4vw, var(--s-6)) clamp(var(--s-3), 2vw, var(--s-5)); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 820px) { .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .book-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .book-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.results .book-grid, .account-main .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .results .book-grid, .account-main .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .results .book-grid, .account-main .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1700px) { .results .book-grid, .account-main .book-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
/* Shelf: one horizontal row. Phones show 2 covers and a deliberate peek of the third. */
.shelf { --cols: 2.25; --gap: var(--s-4); display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); gap: var(--gap); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); padding-block: var(--s-2) var(--s-3); }
.shelf::-webkit-scrollbar { display: none; }
.shelf > * { scroll-snap-align: start; }
@media (min-width: 480px) { .shelf { --cols: 3.25; } }
@media (min-width: 768px) { .shelf { --cols: 4.25; --gap: var(--s-5); } }
@media (min-width: 1024px) { .shelf { --cols: 5; } }
@media (min-width: 1280px) { .shelf { --cols: 6; --gap: var(--s-6); } }
@media (min-width: 1800px) { .shelf { --cols: 7; } }
.shelf.is-ranked { counter-reset: rank; }
.shelf.is-ranked .book-card { counter-increment: rank; }
.shelf.is-ranked .cover::after { content: counter(rank); position: absolute; bottom: 0; inset-inline-start: 0; min-width: 34px; height: 34px; padding-inline: var(--s-2); display: grid; place-items: center; background: var(--surface); color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); line-height: 1; border-start-end-radius: var(--radius-sm); }

/* Book card */
.book-card { position: relative; display: flex; flex-direction: column; gap: var(--s-1); color: inherit; min-width: 0; text-align: start; }
a.book-card:hover { text-decoration: none; }
.cover { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: var(--radius-xs); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-cover); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card .cover { margin-bottom: var(--s-3); }
.book-card:hover .cover, .book-card:focus-within .cover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(21, 29, 26, .16), 0 18px 30px -10px rgba(21, 29, 26, .38); }
.cover-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-2); padding: 14% 12% 10%; color: #fff; background: var(--brand); container-type: inline-size; overflow: hidden; }
.cover-fallback::before { content: ""; position: absolute; inset: 6% 6% auto; height: 1px; background: rgba(255, 255, 255, .35); box-shadow: 0 3px 0 rgba(255, 255, 255, .14); }
.cover-fallback::after { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5%; background: linear-gradient(to right, rgba(0, 0, 0, .28), rgba(0, 0, 0, 0)); }
[dir="rtl"] .cover-fallback::after { background: linear-gradient(to left, rgba(0, 0, 0, .28), rgba(0, 0, 0, 0)); }
.cover-fallback.tone-1 { background: #6d5220; }
.cover-fallback.tone-2 { background: #1d4e6e; }
.cover-fallback.tone-3 { background: #5a3049; }
.cover-fallback.tone-4 { background: #2b3532; }
.cover-fallback b { font-family: var(--font-display); font-size: clamp(.8125rem, 10cqi, 1.75rem); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cover-fallback small { font-size: clamp(.625rem, 6cqi, .875rem); opacity: .85; border-top: 1px solid rgba(255, 255, 255, .3); padding-top: 6%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cover-badge { position: absolute; top: var(--s-2); inset-inline-start: var(--s-2); z-index: 1; box-shadow: var(--shadow-sm); }
.cover:has(.cover-badge) .cover-fallback { padding-top: 26%; }
.book-title { font-weight: 600; font-size: var(--text-sm); line-height: var(--leading-snug); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); overflow-wrap: anywhere; }
.book-card-link { color: inherit; display: block; }
.book-card-link:hover { text-decoration: none; }
.book-card-link:hover .book-title { color: var(--brand); }
.book-card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.book-card-link:focus-visible { box-shadow: none; }
.book-card-link:focus-visible .cover { box-shadow: var(--focus); }
.book-author { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: var(--leading-snug); }
.book-kind { font-size: var(--text-2xs); color: var(--muted); letter-spacing: .02em; line-height: 1.4; }
.book-meta { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-1); flex-wrap: wrap; }
.price { font-weight: 700; color: var(--ink); font-size: var(--text-md); font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.3; }
.price.is-free { color: var(--success); }
.rating-chip { display: inline-flex; align-items: center; gap: 3px; font-size: var(--text-xs); color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rating-chip .star { width: 13px; height: 13px; fill: var(--accent); }
.rating-chip small { color: var(--muted); font-weight: 400; font-size: var(--text-2xs); }
.wish-btn { position: absolute; top: var(--s-2); inset-inline-end: var(--s-2); z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .94); color: var(--ink-2); box-shadow: var(--shadow-sm); transition: color .15s, transform .15s, opacity .15s; }
.wish-btn .icon { width: 18px; height: 18px; }
.wish-btn:hover { color: var(--danger); transform: scale(1.06); }
.wish-btn.is-on { color: var(--danger); }
.wish-btn.is-on .icon { fill: currentColor; }
@media (hover: hover) and (min-width: 1024px) { .wish-btn { opacity: 0; } .book-card:hover .wish-btn, .wish-btn:focus-visible, .wish-btn.is-on { opacity: 1; } }
.stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.star { width: 15px; height: 15px; fill: var(--line-strong); stroke: none; }
.star.is-on { fill: var(--accent); }
.stars-count { color: var(--muted); font-size: var(--text-xs); margin-inline-start: var(--s-1); }
.wish-card { display: grid; gap: var(--s-2); align-content: start; }
.wish-card .btn { justify-self: start; }

/* Categories and authors (secondary sections) */
.category-grid { display: grid; gap: 0 var(--s-6); grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.category-tile { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) 0; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; min-height: 56px; line-height: var(--leading-snug); }
.category-tile:hover { color: var(--brand); text-decoration: none; border-color: var(--brand); }
.category-tile .icon { color: var(--muted); width: 1em; height: 1em; transition: transform .2s var(--ease); }
.category-tile:hover .icon { color: var(--brand); transform: translateX(-4px); }
[dir="ltr"] .category-tile:hover .icon { transform: scaleX(-1) translateX(-4px); }
.category-tile small { display: block; font-weight: 400; color: var(--muted); font-size: var(--text-xs); margin-top: 2px; }
.category-board { display: grid; gap: var(--s-6) var(--s-6); grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.category-block { border-top: 2px solid var(--ink); padding-top: var(--s-4); }
.category-block h2 { font-size: var(--text-lg); font-family: var(--font-ui); margin-bottom: var(--s-3); }
.category-block h2 a { color: var(--ink); display: inline-flex; align-items: center; gap: var(--s-2); }
.category-block h2 a:hover { color: var(--brand); text-decoration: none; }
.category-block h2 .icon { width: .9em; height: .9em; color: var(--muted); }
.category-block li a { display: block; padding: var(--s-2) 0; color: var(--ink-2); font-size: var(--text-sm); line-height: var(--leading-snug); }
.category-block li a:hover { color: var(--brand); }
.tile-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); }
.author-card { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border-radius: var(--radius); color: var(--ink); min-width: 0; border: 1px solid transparent; transition: background-color .15s, border-color .15s; }
.author-card:hover { background: var(--surface); border-color: var(--line); text-decoration: none; }
.author-card strong { display: block; font-size: var(--text-sm); line-height: var(--leading-snug); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-card > span:last-child { min-width: 0; }
.author-card .avatar { width: 52px; height: 52px; font-size: var(--text-lg); }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.5rem; overflow: hidden; flex: none; font-family: var(--font-display); line-height: 1; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 36px; height: 36px; font-size: var(--text-md); }
.avatar-lg { width: clamp(88px, 14vw, 132px); height: clamp(88px, 14vw, 132px); font-size: clamp(2rem, 5vw, 3rem); }
.trust-row { display: grid; gap: var(--s-5) var(--s-6); grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); border-top: 1px solid var(--line); padding-top: var(--s-6); }
.trust-row > div { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s-3); align-items: start; }
.trust-row .icon { width: 22px; height: 22px; color: var(--accent); grid-row: span 2; margin-top: 3px; }
.trust-row strong { color: var(--ink); font-size: var(--text-sm); line-height: var(--leading-snug); }
.trust-row span { font-size: var(--text-sm); color: var(--muted); line-height: var(--leading-snug); }
.for-authors-strip { margin: var(--s-6) 0 0; display: flex; align-items: center; justify-content: center; gap: var(--s-2); flex-wrap: wrap; font-size: var(--text-sm); color: var(--muted); text-align: center; }
.for-authors-strip .icon { width: 16px; height: 16px; }
.for-authors-strip a { font-weight: 600; }
.cta-band { background: var(--brand-strong); color: var(--on-dark-2); border-radius: var(--radius-lg); padding: clamp(var(--s-5), 4vw, var(--s-7)); display: flex; gap: var(--s-5); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cta-band h2 { font-family: var(--font-display); font-size: var(--text-2xl); margin-bottom: var(--s-1); color: var(--on-dark); }
.cta-band p { margin: 0; }
.cta-band .muted { color: var(--on-dark-2); }
.cta-band :focus-visible { box-shadow: 0 0 0 2px var(--brand-strong), 0 0 0 4px #d9b56a; }

/* ==========================================================================
   8. Page furniture: breadcrumbs, page head, toolbar, chips, pagination
   ========================================================================== */
.breadcrumbs { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-2); font-size: var(--text-xs); color: var(--muted); padding-block: var(--s-4) 0; line-height: 1.6; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs li { display: inline-flex; align-items: center; gap: var(--s-2); min-width: 0; }
.breadcrumbs li + li::before { content: "/"; color: var(--line-strong); }
.breadcrumbs [aria-current] { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.page-head { padding-block: var(--s-5) var(--s-5); }
.page-head h1 { margin-bottom: var(--s-1); }
.page-head p { margin: 0; max-width: 70ch; }
.page-head.row-between { align-items: flex-end; }
.page-head + .alert { margin-bottom: var(--s-5); }
.search-inline { display: flex; gap: var(--s-2); width: min(420px, 100%); }
.search-inline .input { min-width: 0; }
.toolbar { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--s-5); }
.toolbar .select { width: auto; min-width: 150px; }
.toolbar-search { max-width: 340px; }
.chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 36px; padding: var(--s-1) var(--s-4); border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-size: var(--text-sm); font-weight: 500; line-height: 1.4; }
.chip:hover { border-color: var(--ink-2); color: var(--ink); text-decoration: none; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }
.chip .icon { width: 1em; height: 1em; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips-scroll .chip { white-space: nowrap; flex: none; }
.pagination { display: flex; gap: var(--s-2); justify-content: center; flex-wrap: wrap; margin-top: var(--s-7); }
.pagination a, .pagination span { min-width: var(--control-h); height: var(--control-h); padding: 0 var(--s-3); display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.pagination a:hover { border-color: var(--ink-2); text-decoration: none; color: var(--ink); }
.pagination .is-current { background: var(--ink); border-color: var(--ink); color: var(--on-dark); }
.pagination .is-gap { border: 0; background: none; min-width: 20px; padding: 0; }

/* Listing: filters beside results on desktop, a bottom sheet on phones/tablets */
.listing-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s-7); align-items: start; }
.filters { position: sticky; top: calc(var(--header-total) + var(--s-4)); max-height: calc(100vh - var(--header-total) - var(--s-6)); overflow-y: auto; }
.filters-head { display: none; }
.filters fieldset { margin: 0 0 var(--s-5); padding-bottom: var(--s-5); border-bottom: 1px solid var(--line); }
.filters legend { font-weight: 700; font-size: var(--text-sm); margin-bottom: var(--s-3); }
.filters .check { margin-bottom: var(--s-2); min-height: 32px; align-items: center; }
.filters .check input { margin: 0; }
.filters-actions { display: grid; gap: var(--s-3); }
.filters-actions a { text-align: center; font-size: var(--text-sm); font-weight: 600; }
.results { min-width: 0; }
.results-bar { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-5); padding-bottom: var(--s-4); border-bottom: 1px solid var(--line); }
.results-count { font-size: var(--text-sm); color: var(--muted); flex: 1; min-width: 120px; }
.results-count strong { color: var(--ink); }
.results-sort { display: flex; align-items: center; gap: var(--s-2); }
.results-sort label { font-size: var(--text-sm); color: var(--muted); white-space: nowrap; }
.results-sort .select { width: auto; min-height: 40px; padding-block: var(--s-1); font-size: var(--text-sm); }
.filters-open { display: none; }
.matched-authors { margin-bottom: var(--s-5); }
.matched-authors h2 { font-size: var(--text-sm); color: var(--muted); font-weight: 600; margin-bottom: var(--s-3); font-family: var(--font-ui); }
@media (max-width: 1023px) {
  .listing-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .filters-open { display: inline-flex; }
  .filters { position: fixed; inset: auto 0 0 0; top: auto; z-index: 250; max-height: 86vh; max-height: 86dvh; background: var(--bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 0 var(--s-4) var(--s-5); box-shadow: var(--shadow-lg); visibility: hidden; transform: translateY(100%); transition: transform .28s var(--ease), visibility 0s linear .28s; overscroll-behavior: contain; }
  .filters.is-open { visibility: visible; transform: none; transition: transform .28s var(--ease), visibility 0s; }
  .filters-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--bg); padding-block: var(--s-3); margin-bottom: var(--s-4); border-bottom: 1px solid var(--line); z-index: 1; }
  .filters-head strong { font-size: var(--text-lg); }
  .filters-actions { position: sticky; bottom: calc(-1 * var(--s-5)); background: var(--bg); padding-block: var(--s-3) var(--s-2); grid-template-columns: auto 1fr; align-items: center; }
  .filters-actions .btn { order: 2; }
  .filters-actions a { padding-inline: var(--s-3); }
}
@media (max-width: 479px) { .results-sort label { display: none; } .results-count { flex-basis: 100%; } .results-sort { flex: 1; } .results-sort .select { width: 100%; } }

/* ==========================================================================
   9. States: empty, skeleton, toast, modal
   ========================================================================== */
.empty { display: grid; justify-items: center; gap: var(--s-2); text-align: center; padding: clamp(var(--s-6), 6vw, var(--s-8)) var(--s-5); color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.empty > .icon { width: 28px; height: 28px; color: var(--brand); box-sizing: content-box; padding: var(--s-4); border-radius: 50%; background: var(--brand-soft); margin-bottom: var(--s-2); }
.empty h2, .empty h3 { color: var(--ink); font-size: var(--text-lg); font-family: var(--font-ui); margin: 0; }
.empty p { margin: 0; max-width: 46ch; font-size: var(--text-sm); }
.empty .btn { margin-top: var(--s-3); }
.empty-inline { border: 0; padding: var(--s-5) var(--s-2); background: none; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, #e9e3d6 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--radius-sm); min-height: 16px; }
.skeleton-row { height: 72px; margin-bottom: var(--s-3); border-radius: var(--radius); }
.skeleton-inline { display: inline-block; width: 72px; height: 22px; vertical-align: middle; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.toasts { position: fixed; bottom: var(--s-5); inset-inline: var(--s-4); z-index: 400; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); pointer-events: none; }
.toast { background: var(--ink); color: var(--on-dark); padding: var(--s-3) var(--s-5); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: var(--text-sm); font-weight: 500; animation: toast-in .22s var(--ease); max-width: min(480px, 100%); pointer-events: auto; line-height: var(--leading-snug); }
.toast.is-error { background: var(--danger); }
.toast.is-success { background: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
body.has-buy-bar .toasts { bottom: calc(var(--s-5) + 72px); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 20, 17, .55); z-index: 300; display: flex; align-items: center; justify-content: center; padding: var(--s-4); animation: fade-in .15s; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: 90vh; max-height: 90dvh; overflow: auto; padding: var(--s-5); animation: toast-in .2s var(--ease); }
.modal h2 { font-size: var(--text-lg); font-family: var(--font-ui); }
.modal p { color: var(--ink-2); overflow-wrap: anywhere; }
.modal-actions { display: flex; gap: var(--s-3); justify-content: flex-end; margin-top: var(--s-5); flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; } }
@media (max-width: 479px) { .modal-backdrop { align-items: flex-end; padding: 0; } .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; width: 100%; } .modal-actions .btn { flex: 1; } }

/* ==========================================================================
   10. Tables — horizontal scroll only as a last resort; phones get stacked rows
   ========================================================================== */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); line-height: var(--leading-snug); }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: var(--text-xs); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fdfcf9; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions, .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.table td .actions { justify-content: flex-end; }
.table .detail-row td { background: var(--bg); white-space: pre-wrap; font-size: var(--text-xs); overflow-wrap: anywhere; }
.table .detail-row p { margin-bottom: var(--s-2); }
.table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }
@media (max-width: 767px) {
  /* ui.js copies each column heading into td[data-label] and adds .is-labelled */
  .table.is-labelled thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table.is-labelled, .table.is-labelled tbody, .table.is-labelled tr, .table.is-labelled td { display: block; width: 100%; }
  .table.is-labelled tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
  .table.is-labelled tr:last-child { border-bottom: 0; }
  .table.is-labelled td { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); padding: var(--s-1) 0; border: 0; text-align: end; min-width: 0; overflow-wrap: anywhere; }
  .table.is-labelled td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: var(--text-xs); font-weight: 600; text-align: start; flex: none; max-width: 45%; }
  .table.is-labelled td:first-child { font-weight: 600; }
  .table.is-labelled td:not([data-label]), .table.is-labelled td[data-label=""] { display: block; text-align: start; }
  .table.is-labelled td:empty { display: none; }
  .table.is-labelled td .actions { justify-content: flex-end; }
  .table.is-labelled td > .row { justify-content: flex-end; flex-wrap: nowrap; text-align: start; }
  .table.is-labelled .detail-row { background: var(--bg); }
  .table.is-labelled tbody tr:hover { background: none; }
}

/* ==========================================================================
   11. Book page
   ========================================================================== */
.book-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); padding-block: var(--s-4) 0; align-items: start; }
.book-cover-col { width: min(62vw, 260px); margin-inline: auto; }
.book-cover-col .cover { border-radius: var(--radius-sm); box-shadow: 0 2px 4px rgba(21, 29, 26, .16), 0 26px 44px -16px rgba(21, 29, 26, .45); }
.book-head h1 { font-size: clamp(1.625rem, 1.2rem + 2vw, 2.625rem); margin-bottom: var(--s-2); }
.book-subtitle { font-size: var(--text-lg); color: var(--ink-2); margin-bottom: var(--s-3); line-height: var(--leading-snug); }
.book-byline { margin-bottom: var(--s-3); color: var(--ink-2); }
.book-byline a { font-weight: 700; }
.book-rating { display: flex; align-items: center; gap: var(--s-2) var(--s-3); flex-wrap: wrap; margin: 0; }
.book-rating a { display: inline-flex; align-items: center; }
.book-rating a:hover { text-decoration: none; }
.buy-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s-5); min-width: 0; }
.buy-price { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.buy-price .price { font-size: var(--text-2xl); font-family: var(--font-ui); }
.buy-price span:last-child { font-size: var(--text-xs); color: var(--muted); }
.format-option { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-3); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--s-2); font-size: var(--text-sm); }
.format-option > div { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.format-option.is-selected { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.format-option .price { font-size: var(--text-sm); }
.buy-actions { display: grid; gap: var(--s-2); margin-top: var(--s-4); }
.buy-actions .alert { margin: 0; }
.buy-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-top: var(--s-3); }
.buy-secondary .btn { padding-inline: var(--s-2); }
.buy-sample { margin-top: var(--s-2); }
.buy-note { display: flex; gap: var(--s-2); align-items: center; justify-content: center; margin: var(--s-4) 0 0; font-size: var(--text-xs); color: var(--muted); text-align: center; line-height: var(--leading-snug); }
.buy-note .icon { width: 14px; height: 14px; }
.book-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0; }
.book-facts > div { background: var(--surface); padding: var(--s-3); text-align: center; min-width: 0; }
.book-facts dt { font-size: var(--text-2xs); color: var(--muted); margin-bottom: 2px; line-height: 1.4; }
.book-facts dd { font-weight: 700; font-size: var(--text-sm); overflow-wrap: anywhere; line-height: 1.4; }
.book-section { padding-top: var(--s-7); }
.book-section > h2 { font-family: var(--font-display); font-size: var(--text-2xl); margin-bottom: var(--s-4); padding-bottom: var(--s-3); border-bottom: 1px solid var(--line); }
.spec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: var(--s-4) var(--s-5); }
.spec-list dt { font-size: var(--text-xs); color: var(--muted); margin-bottom: 2px; }
.spec-list dd { margin: 0; font-weight: 600; font-size: var(--text-sm); overflow-wrap: anywhere; }
.rights-note { display: flex; gap: var(--s-2); margin: var(--s-5) 0 0; font-size: var(--text-xs); color: var(--muted); line-height: var(--leading-snug); }
.rights-note .icon { width: 16px; height: 16px; margin-top: 1px; }
.prose { max-width: 70ch; white-space: pre-line; color: var(--ink-2); line-height: 1.9; overflow-wrap: anywhere; }
[dir="ltr"] .prose { line-height: 1.75; }
.author-box { display: flex; gap: var(--s-4); align-items: flex-start; }
.author-box h3 { margin-bottom: var(--s-1); }
.author-box p { margin: 0; font-size: var(--text-sm); }
.review { padding-block: var(--s-5); border-bottom: 1px solid var(--line); }
.review:first-child { padding-top: 0; }
.review:last-child { border-bottom: 0; padding-bottom: 0; }
.review h3 { font-size: var(--text-md); margin: var(--s-2) 0 var(--s-1); }
.review p { margin-bottom: var(--s-2); }
.review .prose { font-size: var(--text-sm); }
.review-form { margin-bottom: var(--s-5); }
.rating-summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-6); align-items: center; margin-bottom: var(--s-5); }
.rating-summary .center { display: grid; justify-items: center; gap: var(--s-1); }
.rating-summary p { margin: 0; }
.rating-big { font-size: 3.25rem; font-weight: 700; line-height: 1; color: var(--ink); font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.rating-bars { display: grid; gap: var(--s-2); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.rating-bars div { display: grid; grid-template-columns: 16px minmax(0, 1fr) 32px; gap: var(--s-2); align-items: center; }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; display: block; }
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-pill); }
progress::-moz-progress-bar { background: var(--accent); border-radius: var(--radius-pill); }
.star-input { display: inline-flex; flex-direction: row-reverse; gap: var(--s-1); }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { cursor: pointer; padding: var(--s-1); margin: 0; }
.star-input label .star { width: 32px; height: 32px; transition: fill .1s; }
.star-input input:checked ~ label .star, .star-input label:hover .star, .star-input label:hover ~ label .star { fill: var(--accent); }
.star-input input:focus-visible + label { box-shadow: var(--focus); border-radius: var(--radius-sm); }
/* Phone buy bar (ui.js shows it when the buy box is off-screen) */
.buy-bar { position: fixed; inset: auto 0 0 0; z-index: 90; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(21, 29, 26, .1); padding: var(--s-3) var(--gutter) calc(var(--s-3) + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: var(--s-4); transform: translateY(110%); transition: transform .25s var(--ease); }
.buy-bar.is-visible { transform: none; }
.buy-bar-info { min-width: 0; flex: 1; display: grid; }
.buy-bar-info span { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buy-bar .btn { flex: none; max-width: 60%; }
@media (min-width: 768px) {
  .book-top { grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); grid-template-areas: "cover head" "cover buy" "body body"; gap: var(--s-5) var(--s-7); padding-top: var(--s-5); }
  .book-cover-col { grid-area: cover; width: 100%; position: sticky; top: calc(var(--header-total) + var(--s-5)); }
  .book-head { grid-area: head; }
  .buy-col { grid-area: buy; max-width: 480px; }
  .book-body { grid-area: body; }
  .buy-bar { display: none; }
}
@media (min-width: 1180px) {
  .book-top { grid-template-columns: minmax(240px, 320px) minmax(0, 1fr) minmax(300px, 360px); grid-template-areas: "cover head buy" "cover body buy"; grid-template-rows: auto 1fr; gap: 0 var(--s-7); }
  .buy-col { position: sticky; top: calc(var(--header-total) + var(--s-5)); max-width: none; }
  .book-body .book-section:first-child { padding-top: var(--s-6); }
}
@media (max-width: 767px) { .book-head { text-align: center; } .book-rating { justify-content: center; } .book-body { padding-bottom: 0; } .rating-summary { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); } .breadcrumbs.is-book li:not(:nth-last-child(2)) { display: none; } .breadcrumbs.is-book li::before { display: none; } .breadcrumbs.is-book li:nth-last-child(2) a::before { content: "‹ "; } [dir="rtl"] .breadcrumbs.is-book li:nth-last-child(2) a::before { content: "› "; } }

/* Author profile */
.author-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-5) var(--s-6); align-items: center; padding-block: var(--s-5) var(--s-6); border-bottom: 1px solid var(--line); }
.author-hero h1 { margin-bottom: var(--s-1); }
.author-hero .prose { margin: var(--s-3) 0 0; }
.author-hero-meta { display: flex; gap: var(--s-2) var(--s-3); flex-wrap: wrap; align-items: center; margin: 0; color: var(--muted); font-size: var(--text-sm); }
.author-site { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--text-sm); font-weight: 600; margin-top: var(--s-3); overflow-wrap: anywhere; }
@media (max-width: 639px) { .author-hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; } .author-hero-meta { justify-content: center; } .author-hero .prose { text-align: start; } }

/* ==========================================================================
   12. Auth
   ========================================================================== */
.site-auth { background: var(--surface); }
.auth { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.auth-aside { background: var(--brand-strong); color: var(--on-dark-2); padding: var(--s-4) var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); position: relative; overflow: hidden; isolation: isolate; }
.auth-aside::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(700px 420px at 0% 100%, rgba(168, 121, 42, .3), transparent 65%); }
.auth-aside .brand { color: var(--on-dark); }
.auth-aside .brand .brand-ar { color: #d9b56a; border-color: rgba(255, 255, 255, .25); }
.auth-aside .tagline { color: #d9b56a; }
.auth-pitch { display: none; }
.auth-main { display: grid; place-items: center; padding: var(--s-6) var(--gutter) var(--s-7); align-content: center; }
.auth-card { width: min(440px, 100%); }
.auth-card h1 { font-size: var(--text-2xl); margin-bottom: var(--s-2); }
.auth-card > p.muted { margin-bottom: var(--s-5); }
.auth-card form { margin-top: var(--s-5); }
.auth-card .alert { margin-bottom: var(--s-4); }
.auth-links { text-align: center; font-size: var(--text-sm); margin: var(--s-4) 0 0; }
.auth-foot { margin-top: var(--s-7); padding-top: var(--s-4); border-top: 1px solid var(--line); display: flex; gap: var(--s-4); justify-content: center; flex-wrap: wrap; font-size: var(--text-xs); }
.auth-foot a { color: var(--muted); }
@media (min-width: 960px) {
  .auth { grid-template-columns: minmax(360px, 5fr) 7fr; }
  .auth-aside { flex-direction: column; align-items: flex-start; justify-content: space-between; padding: var(--s-7) clamp(var(--s-6), 4vw, var(--s-8)); position: sticky; top: 0; height: 100vh; height: 100dvh; }
  .auth-aside .brand { font-size: 1.75rem; }
  .auth-aside .brand .brand-ar { font-size: 1.5rem; }
  .auth-pitch { display: block; }
  .auth-pitch h2 { font-family: var(--font-display); font-size: clamp(1.75rem, 2.6vw, 2.5rem); color: var(--on-dark); margin-bottom: var(--s-5); max-width: 14ch; line-height: 1.4; }
  .auth-pitch li { display: flex; gap: var(--s-3); align-items: flex-start; margin-bottom: var(--s-4); max-width: 36ch; line-height: var(--leading-snug); }
  .auth-pitch .icon { color: #d9b56a; margin-top: 2px; }
}
@media (max-width: 959px) { .auth-aside .tagline { display: none; } }

/* ==========================================================================
   13. Account
   ========================================================================== */
.account-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: var(--s-7); align-items: start; padding-block: var(--s-6) 0; }
.account-main { min-width: 0; }
.account-main > * + * { margin-top: var(--s-5); }
.account-main > .page-head { padding-top: 0; }
.account-main > header h1, .account-main > .page-head h1 { font-size: var(--text-2xl); }
.side-nav { position: sticky; top: calc(var(--header-total) + var(--s-5)); display: grid; gap: 2px; }
.side-nav-user { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-3) var(--s-4); margin-bottom: var(--s-3); border-bottom: 1px solid var(--line); min-width: 0; }
.side-nav-user div { min-width: 0; }
.side-nav-user strong { display: block; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav-user span:not(.avatar) { display: block; font-size: var(--text-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav-title { margin: 0 var(--s-3) var(--s-2); font-size: var(--text-xs); font-weight: 700; color: var(--muted); }
.side-nav-sep { height: 1px; background: var(--line); margin: var(--s-2) var(--s-3); }
.side-nav a, .side-nav button { display: flex; width: 100%; align-items: center; gap: var(--s-3); min-height: var(--control-h); padding: var(--s-2) var(--s-3); border-radius: var(--radius); color: var(--ink-2); font-weight: 500; font-size: var(--text-sm); background: none; border: 0; text-align: start; line-height: 1.4; }
.side-nav a:hover, .side-nav button:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.side-nav a[aria-current="page"] { background: var(--brand); color: var(--on-dark); font-weight: 600; }
.side-nav .icon { width: 1.2em; height: 1.2em; }
.side-nav .badge { margin-inline-start: auto; }
.quick-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quick { display: grid; gap: 2px; justify-items: start; padding: var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink-2); min-width: 0; transition: border-color .15s; }
.quick:hover { border-color: var(--ink-2); text-decoration: none; }
.quick .icon { width: 20px; height: 20px; color: var(--accent); margin-bottom: var(--s-2); }
.quick strong { font-size: var(--text-2xl); color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.quick span { font-size: var(--text-xs); color: var(--muted); line-height: var(--leading-snug); }
.meta-list { display: grid; gap: var(--s-4) var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); margin: var(--s-4) 0; }
.meta-list dt { font-size: var(--text-xs); color: var(--muted); margin-bottom: 2px; }
.meta-list dd { margin: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; font-size: var(--text-sm); }
.progress-steps { margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s-2); }
.progress-steps li { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) 0 0; border-top: 3px solid var(--line); font-size: var(--text-sm); color: var(--muted); line-height: var(--leading-snug); min-width: 0; }
.progress-steps li span { flex: none; width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: var(--text-xs); }
.progress-steps li.is-done { color: var(--ink-2); border-color: var(--success); }
.progress-steps li.is-done span { background: var(--success-soft); color: var(--success); }
.progress-steps li.is-current { border-color: var(--brand); color: var(--ink); font-weight: 700; }
.progress-steps li.is-current span { background: var(--brand); color: var(--on-dark); }
.progress-steps.is-vertical { grid-auto-flow: row; gap: 0; margin-bottom: var(--s-5); }
.progress-steps.is-vertical li { border-top: 0; padding: var(--s-3) 0; border-bottom: 1px solid var(--line); align-items: flex-start; color: var(--ink-2); font-weight: 400; }
.progress-steps.is-vertical li:last-child { border-bottom: 0; }
.review-row { padding-block: var(--s-4); border-bottom: 1px solid var(--line); }
.review-row:first-child { padding-top: 0; }
.review-row:last-child { border-bottom: 0; padding-bottom: 0; }
.review-row p { margin-bottom: var(--s-2); }
.review-row .actions { margin-top: var(--s-3); }
.order-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding-block: var(--s-3); border-bottom: 1px solid var(--line); font-size: var(--text-sm); flex-wrap: wrap; }
.order-row:last-child { border-bottom: 0; padding-bottom: 0; }
.order-row > span { display: inline-flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.notif-list .notif { display: flex; gap: var(--s-4); align-items: flex-start; padding: var(--s-4) var(--s-3); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.notif-list .notif:last-child { border-bottom: 0; }
.notif.is-unread { background: var(--accent-soft); border-radius: var(--radius); border-bottom-color: transparent; }
.notif p { margin-bottom: var(--s-1); font-size: var(--text-sm); }
.check-list li { display: flex; gap: var(--s-3); align-items: flex-start; padding-block: var(--s-2); line-height: var(--leading-snug); }
.check-list .icon { color: var(--success); margin-top: 2px; }
.bullet { list-style: disc; padding-inline-start: var(--s-5); margin-bottom: var(--s-3); }
.bullet li { margin-bottom: var(--s-1); }
@media (max-width: 1023px) {
  .account-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); padding-top: 0; }
  /* The account menu becomes a tab strip pinned under the header */
  .side-nav { position: sticky; top: var(--header-total); z-index: 40; display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; background: var(--bg); margin-inline: calc(-1 * var(--gutter)); padding: var(--s-3) var(--gutter); border-bottom: 1px solid var(--line); }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav-user, .side-nav-title, .side-nav-sep { display: none; }
  .side-nav a, .side-nav button { width: auto; flex: none; white-space: nowrap; min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius-pill); padding-inline: var(--s-4); background: var(--surface); }
  .side-nav a[aria-current="page"] { border-color: var(--brand); }
  .side-nav .badge { margin-inline-start: 0; }
}
@media (max-width: 639px) { .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .progress-steps { grid-auto-flow: row; gap: 0; } .progress-steps li { border-top: 0; border-inline-start: 3px solid var(--line); padding: var(--s-2) var(--s-3); } }

/* ==========================================================================
   14. Cart & checkout
   ========================================================================== */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: var(--s-6); align-items: start; }
.cart-layout > aside { position: sticky; top: calc(var(--header-total) + var(--s-5)); }
.cart-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0 clamp(var(--s-4), 2.4vw, var(--s-5)); }
.line-item { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding-block: var(--s-4); border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item .cover { width: 72px; box-shadow: var(--shadow-sm); }
.line-item .cover-fallback { padding: 0; }
.line-item .cover-fallback::before { display: none; }
.line-item strong { line-height: var(--leading-snug); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-item a { color: var(--ink); }
.line-item p { margin: 2px 0 0; }
.line-item > .row { flex-wrap: nowrap; gap: var(--s-2); }
.summary-row { display: flex; justify-content: space-between; gap: var(--s-4); padding-block: var(--s-2); font-size: var(--text-sm); align-items: baseline; }
.summary-row > span:first-child { color: var(--muted); flex: none; }
.summary-row > span:last-child { text-align: end; overflow-wrap: anywhere; min-width: 0; }
.summary-total { font-weight: 700; font-size: var(--text-xl); border-top: 1px solid var(--line); margin-top: var(--s-3); padding-top: var(--s-4); margin-bottom: var(--s-4); }
.summary-total > span:first-child { color: var(--ink); font-size: var(--text-md); }
.summary-total > span:last-child { font-variant-numeric: tabular-nums; }
.summary-note { font-size: var(--text-xs); color: var(--muted); line-height: var(--leading-snug); margin: var(--s-3) 0 0; text-align: center; }
.summary-back { display: flex; justify-content: center; margin-top: var(--s-3); font-size: var(--text-sm); font-weight: 600; }
.pay-method { display: grid; gap: var(--s-1); padding: var(--s-3) var(--s-4); margin-block: var(--s-4); border: 1px solid var(--brand); border-radius: var(--radius); background: var(--brand-soft); line-height: var(--leading-snug); }
.checkout-steps { display: flex; gap: var(--s-2); align-items: center; font-size: var(--text-xs); color: var(--muted); margin: 0 0 var(--s-5); flex-wrap: wrap; font-weight: 600; }
.checkout-steps li { display: inline-flex; align-items: center; gap: var(--s-2); }
.checkout-steps li + li::before { content: ""; width: 20px; height: 1px; background: var(--line-strong); }
.checkout-steps .is-current { color: var(--ink); }
.checkout-steps .is-done { color: var(--success); }
.checkout-block + .checkout-block { margin-top: var(--s-4); }
.checkout-block .card-title { font-size: var(--text-md); margin-bottom: var(--s-3); }
.checkout-block .card-title span { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--on-dark); display: inline-grid; place-items: center; font-size: var(--text-xs); flex: none; }
@media (max-width: 899px) { .cart-layout { grid-template-columns: minmax(0, 1fr); } .cart-layout > aside { position: static; } }
@media (max-width: 479px) { .line-item { grid-template-columns: 56px minmax(0, 1fr); } .line-item .cover { width: 56px; } .line-item > .row { grid-column: 2; justify-content: space-between; } }
.status-icon { width: 72px; height: 72px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-bottom: var(--s-4); }
.status-icon .icon { width: 34px; height: 34px; }
.status-icon.is-success { background: var(--success-soft); color: var(--success); }
.status-icon.is-pending { background: var(--warning-soft); color: var(--warning); }
.status-icon.is-failed { background: var(--danger-soft); color: var(--danger); }
.result-card { max-width: var(--container-reading); margin-inline: auto; text-align: center; }
.result-card .table-wrap { margin-block: var(--s-5); text-align: start; }
.result-card > p.muted { max-width: 56ch; margin-inline: auto; }

/* ==========================================================================
   15. Reading pages: legal, FAQ, contact, errors, authors landing
   ========================================================================== */
.legal { max-width: var(--container-reading); margin-inline: auto; }
.legal h2 { margin-top: var(--s-7); font-size: var(--text-xl); }
.legal section:first-of-type h2 { margin-top: var(--s-5); }
.legal p, .legal li { color: var(--ink-2); }
.legal ul { list-style: disc; padding-inline-start: var(--s-5); margin-bottom: var(--s-4); }
.legal li { margin-bottom: var(--s-2); }
.legal .card ul { list-style: none; padding: 0; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; padding-block: var(--s-4); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); line-height: var(--leading-snug); color: var(--ink); }
.faq summary:hover { color: var(--brand); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 9px; height: 9px; border: solid currentColor; border-width: 0 1.8px 1.8px 0; transform: rotate(45deg) translate(-3px, -3px); transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq details p { color: var(--ink-2); max-width: 68ch; }
.legal-foot { margin-top: var(--s-7); padding-top: var(--s-4); border-top: 1px solid var(--line); font-size: var(--text-sm); color: var(--muted); }
.error-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: var(--s-7) var(--gutter); }
.error-page > div { max-width: 520px; }
.error-page .brand { margin-bottom: var(--s-6); }
.error-code { font-family: var(--font-display); font-size: clamp(5rem, 22vw, 9rem); line-height: 1; color: var(--brand); margin: 0 0 var(--s-3); font-variant-numeric: tabular-nums; direction: ltr; }
.error-page h1 { font-size: var(--text-2xl); }
.error-page .row { margin-block: var(--s-5); }
.steps { display: grid; gap: var(--s-6) var(--s-6); grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); counter-reset: step; }
.step { counter-increment: step; border-top: 2px solid var(--ink); padding-top: var(--s-4); }
.step::before { content: counter(step, decimal-leading-zero); display: block; font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; color: var(--accent-ink); line-height: 1; margin-bottom: var(--s-3); direction: ltr; text-align: start; }
[dir="rtl"] .step::before { text-align: right; }
.step p, .feature p { margin: 0; font-size: var(--text-sm); }
.feature > .icon { width: 28px; height: 28px; color: var(--accent); margin-bottom: var(--s-3); }
.hero-ghost { color: var(--on-dark); border-color: rgba(255, 255, 255, .5); }
.hero-ghost:hover { background: rgba(255, 255, 255, .12); }
.cover-mini { width: 40px; flex: none; box-shadow: var(--shadow-sm); border-radius: 2px; display: block; }
.cover-mini .cover-fallback { padding: 0; }
.cover-mini .cover-fallback::before { display: none; }

/* ==========================================================================
   16. Small layout glue
   ========================================================================== */
.listing-layout { margin-top: var(--s-5); }
.chips-scroll + .listing-layout, .matched-authors + .listing-layout { margin-top: var(--s-6); }
.active-filters { margin-bottom: var(--s-5); align-items: center; }
.active-filters .chip { min-height: 32px; padding-inline: var(--s-3); font-size: var(--text-xs); background: var(--surface-2); border-color: transparent; }
.active-filters .chip .icon { width: 12px; height: 12px; }
.table .total-row td { background: var(--bg); font-size: var(--text-md); }
@media (max-width: 767px) {
  .table.is-labelled tr.total-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); background: var(--bg); }
  .table.is-labelled tr.total-row td { width: auto; background: none; }
}
body.has-buy-bar { padding-bottom: 76px; }
@media (min-width: 768px) { body.has-buy-bar { padding-bottom: 0; } }
.account-main .cart-list .line-item .btn { white-space: nowrap; }
.account-main .card > .row-between:first-child { margin-bottom: var(--s-3); }
.account-main .card > .row-between:first-child .card-title { margin: 0; }
.panel .card > .row-between:first-child { margin-bottom: var(--s-4); }
.panel .card > .row-between:first-child .card-title { margin: 0; }
.card .table-wrap { border-radius: var(--radius); }
.card form > .btn, .card > form + p { margin-top: var(--s-2); }
.legal > .card, .legal > form.card { margin-top: var(--s-2); }
.section > .container > .card + .cta-band, .section .cta-band { margin-top: 0; }
.container.section { padding-top: var(--s-6); }
.quick-nav + .section-tint { margin-top: 0; border-top: 0; }
.book-facts { margin-top: var(--s-5); }
@media (min-width: 1024px) { .shelf { margin-inline: 0; padding-inline: 0; scroll-padding-inline: 0; } }
@media (min-width: 1400px) { .results .book-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1800px) { .results .book-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.header-account .count-dot { position: static; margin-inline-start: 2px; }
@media (max-width: 1023px) { .header-account .count-dot { position: absolute; margin: 0; } }
.cart-layout aside .alert { margin-bottom: var(--s-3); }
.row-between > a.small, .section-head a.small { display: inline-flex; align-items: center; gap: var(--s-1); white-space: nowrap; font-weight: 600; }
@media (max-width: 767px) {
  .table.is-labelled td:first-child { justify-content: flex-start; text-align: start; font-size: var(--text-md); padding-bottom: var(--s-2); }
  .table.is-labelled td:first-child::before { display: none; }
  .table.is-labelled td:first-child > .row { justify-content: flex-start; }
}
@media (max-width: 767px) { [dir="rtl"] .table.is-labelled td.ltr:not(:first-child) { flex-direction: row-reverse; } }

/* ==========================================================================
   Payment page (Paddle inline checkout embedded in ELILM's own layout)
   ========================================================================== */
.pay-layout .pay-panel { min-height: 420px; }
.pay-panel .card-title { display: flex; align-items: center; gap: var(--s-2); }
.pay-state { display: grid; gap: var(--s-3); padding-block: var(--s-3); }
.pay-state .skeleton-row { min-height: 48px; }
.pay-declined { margin-bottom: var(--s-3); }
.elilm-pay-frame { min-height: 450px; }
.elilm-pay-frame iframe { width: 100%; min-width: 286px; border: 0; background: transparent; display: block; }
@media (max-width: 1023px) { .pay-layout { grid-template-columns: minmax(0, 1fr); } .pay-layout > aside { position: static; order: -1; } }

/* ==========================================================================
   Book page: discovery tiles, rating bars with labels, report a problem
   ========================================================================== */
.section-more { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.category-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-3); }
.category-tile { display: flex; align-items: center; gap: var(--s-2); min-height: 56px; padding: var(--s-3) var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-weight: 600; }
.category-tile:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.rating-bars div { grid-template-columns: 76px minmax(0, 1fr) 40px; }
.rating-bars div > span:first-child { white-space: nowrap; }
.report-list { display: grid; gap: var(--s-2); margin-bottom: var(--s-4); }
.report-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--radius); font-size: var(--text-sm); }
.report-list li > span { min-width: 0; }
.report-form .fine-print { margin-top: var(--s-3); }
@media (max-width: 479px) { .report-list li { flex-direction: column; align-items: flex-start; } .section-head { flex-wrap: wrap; } }

/* ---- Printed copy (book page, checkout) and print administration ---- */
.print-option { margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--line); display: grid; gap: var(--s-3); }
.print-title { font-size: var(--text-base); display: flex; align-items: center; gap: var(--s-2); margin: 0; }
.print-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2); margin: 0; }
.card-inset { background: var(--surface-2, var(--brand-soft)); border: 1px dashed var(--line); box-shadow: none; margin-block: var(--s-4); }
.check-list .icon use[href="#i-close"] { color: var(--danger); }
[data-print-country] .check-list { list-style: none; padding: 0; margin: 0 0 var(--s-4); }
/* ---- Catalogue filters: rows of choices, one click each (listing and search pages) ---- */
.search-hero { display: flex; align-items: center; gap: var(--s-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-5); box-shadow: 0 6px 24px rgba(10, 42, 35, .06); margin-block: var(--s-5) 0; }
.search-hero .icon { flex: none; color: var(--ink-3); }
.search-hero .input { flex: 1; border: 0; background: transparent; box-shadow: none; min-height: 48px; font-size: var(--text-lg); padding-inline: var(--s-2); }
.search-hero .input:focus { outline: none; box-shadow: none; }
.search-hero .btn { border-radius: var(--radius-pill); padding-inline: var(--s-6); }
.filter-bar { display: grid; gap: var(--s-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s-4) var(--s-5); }
.filter-group { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: var(--s-3); }
.filter-group + .filter-group { border-top: 1px dashed var(--line); padding-top: var(--s-3); }
.filter-label { font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.pills { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.pill { display: inline-flex; align-items: center; min-height: 36px; padding: var(--s-1) var(--s-4); border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); font-size: var(--text-sm); text-decoration: none; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.pill:hover { border-color: var(--ink-2); color: var(--ink); text-decoration: none; }
.pill.is-on { background: var(--brand, #0a2a23); border-color: var(--brand, #0a2a23); color: #fff; font-weight: 600; }
.pill:focus-visible { outline: 2px solid var(--accent, #c9a227); outline-offset: 2px; }
@media (max-width: 639px) {
  .filter-bar { padding: var(--s-3) var(--s-4); }
  .filter-group { grid-template-columns: 1fr; gap: var(--s-2); }
  .pills { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--s-1); scrollbar-width: none; }
  .pills::-webkit-scrollbar { display: none; }
  .search-hero { padding-inline-start: var(--s-4); }
  .search-hero .btn { padding-inline: var(--s-4); }
}

/* Book wizard: the optional publishing data, ticked one by one */
.optional-toggles { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin-block: var(--s-2) var(--s-4); padding: var(--s-3) var(--s-4); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.optional-toggles .check { margin: 0; font-size: var(--text-sm); }


/* Search / category pages: the filters open on demand */
.filter-panel { border: 0; }
.filter-toggle { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 38px; padding: var(--s-1) var(--s-4); border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink-2); font-size: var(--text-sm); font-weight: 600; cursor: pointer; list-style: none; user-select: none; }
.filter-toggle::-webkit-details-marker { display: none; }
.filter-toggle::marker { content: ''; }
.filter-toggle:hover { border-color: var(--ink-2); color: var(--ink); }
.filter-toggle .icon { width: 16px; height: 16px; }
.filter-panel[open] > .filter-toggle { background: var(--brand); border-color: var(--brand); color: #fff; }
.filter-panel[open] > .filter-bar { margin-top: var(--s-3); }
