/* ARABIC QUANTUM — Etalase Ebook (/ebook), tampilan ala rak buku Google Play Books.
   Warna brand dinamis (--brand, --brand-rgb) di-set inline oleh ebook.php; sisanya dari tokens.css. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
.eb-body {
  --eb-pad: 16px;
  --eb-book-w: 118px;
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
.eb-body a { color: inherit; text-decoration: none; }
.eb-main svg.aq-icon { width: 24px; height: 24px; flex-shrink: 0; }

/* ── Header = header /store (.home-topbar, .home-search, .theme-switch dari store.css/layout.css).
   Di sini hanya penyesuaian kecil: judul "lihat semua", dan baris tab. ── */
.home-topbar-brand { color: inherit; }
.home-topbar .theme-switch { margin-left: auto; } /* tanpa kolom cari di header → toggle tema rata kanan */

.eb-pagebar { display: flex; align-items: center; gap: 12px; padding: 4px var(--eb-pad) 8px; }
.eb-back { width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; margin-left: -8px; color: var(--text); }
.eb-back:hover { background: var(--hover, var(--surface-alt)); }
.eb-top-title { flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: var(--weight-bold, 700); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Baris tab menempel tepat di bawah topbar (tinggi topbar store = 56px) */
.eb-tabbar { position: sticky; top: 56px; z-index: 19; background: var(--surface); border-bottom: 1px solid var(--border); }
.eb-tabbar[hidden] { display: none; }
.eb-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--eb-pad); max-width: 1100px; margin: 0 auto; -webkit-overflow-scrolling: touch; }
.eb-tabs::-webkit-scrollbar { display: none; }
.eb-tab {
  position: relative; flex: 0 0 auto; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 17px;
  font-weight: var(--weight-medium, 500); color: var(--text-secondary, var(--text-muted)); padding: 14px 14px 13px; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.eb-tab.is-active { color: var(--brand); font-weight: var(--weight-semibold, 600); }
.eb-tab.is-active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 4px; background: var(--brand); border-radius: 4px 4px 0 0; }
.eb-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 8px; }

/* ── Konten ── */
.eb-main { max-width: 1100px; margin: 0 auto; padding: 8px 0 24px; }
.eb-panel[hidden] { display: none; }
.eb-section { margin: 20px 0 8px; }
.eb-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 var(--eb-pad); margin-bottom: 14px; }
.eb-section-title {
  margin: 0; font-size: 22px; font-weight: var(--weight-medium, 500); line-height: 1.3; color: var(--text); letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.eb-arrow {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-alt); color: var(--text-secondary, var(--text)); transition: background .15s;
}
.eb-arrow:hover { background: rgba(var(--brand-rgb), .16); color: var(--brand); }
.eb-arrow:focus-visible, .eb-book:focus-visible, .eb-genre:focus-visible, .eb-back:focus-visible, .eb-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Rak geser horizontal */
.eb-rail {
  display: flex; gap: 14px; overflow-x: auto; padding: 2px var(--eb-pad) 8px; scroll-snap-type: x proximity;
  scroll-padding: 0 var(--eb-pad); scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.eb-rail::-webkit-scrollbar { display: none; }
.eb-rail > .eb-book { flex: 0 0 var(--eb-book-w); scroll-snap-align: start; }

/* Kartu buku: cover 2:3, judul 2 baris, penulis, pil harga */
.eb-book { display: flex; flex-direction: column; min-width: 0; -webkit-tap-highlight-color: transparent; }
.eb-cover {
  position: relative; display: block; aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden;
  background: var(--surface-alt); box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 0 0 1px var(--border);
  transition: transform .15s;
}
.eb-book:active .eb-cover { transform: scale(.98); }
.eb-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.eb-cover-ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; text-align: center;
  font-size: 13px; font-weight: var(--weight-bold, 700); line-height: 1.3; color: var(--brand); overflow: hidden;
  background: linear-gradient(160deg, rgba(var(--brand-rgb), .20), rgba(var(--brand-rgb), .05));
}
.eb-rank {
  position: absolute; left: 8px; top: 8px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: var(--weight-bold, 700); box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.eb-tag {
  position: absolute; right: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 3px 9px; border-radius: 10px; background: rgba(0, 0, 0, .72); color: #fff;
  font-size: 11px; font-weight: var(--weight-semibold, 600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eb-book-title {
  margin-top: 10px; font-size: 16px; line-height: 1.3; color: var(--text); font-weight: var(--weight-medium, 500);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.eb-book-author { margin-top: 2px; font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-price {
  align-self: flex-start; margin-top: 8px; padding: 6px 14px; border-radius: 999px; background: var(--surface-alt); color: var(--text-secondary, var(--text-muted));
  font-size: 15px; font-weight: var(--weight-medium, 500); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.eb-price.is-owned { background: rgba(var(--brand-rgb), .16); color: var(--brand); font-weight: var(--weight-semibold, 600); }

/* Grid (Terlaris, Rilis baru, lihat semua) */
.eb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 14px; padding: 12px var(--eb-pad) 8px; }

/* Tab Genre */
.eb-genres { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px var(--eb-pad); }
.eb-genre {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-height: 92px; padding: 14px 16px; border-radius: 16px;
  background: linear-gradient(150deg, rgba(var(--brand-rgb), .20), rgba(var(--brand-rgb), .06)); border: 1px solid var(--border);
  transition: transform .15s, border-color .15s;
}
.eb-genre:hover { border-color: var(--brand); }
.eb-genre:active { transform: scale(.98); }
.eb-genre-name { font-size: 17px; font-weight: var(--weight-semibold, 600); color: var(--text); overflow-wrap: anywhere; }
.eb-genre-count { font-size: 13px; color: var(--text-muted); }

/* Keadaan kosong */
.eb-empty { text-align: center; padding: 64px var(--eb-pad); }
.eb-empty-ico { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(var(--brand-rgb), .14); color: var(--brand); }
.eb-empty-ico svg.aq-icon { width: 34px; height: 34px; }
.eb-empty h2 { margin: 0 0 6px; font-size: 20px; }
.eb-empty p { margin: 0 auto 20px; max-width: 360px; color: var(--text-muted); font-size: 15px; line-height: 1.5; }
.eb-btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 22px; border-radius: 999px; background: var(--brand); color: #fff !important; font-weight: var(--weight-semibold, 600); font-size: 15px; }
.eb-btn:hover { background: var(--brand-hover, var(--brand)); }

/* Tablet & desktop */
@media (min-width: 720px) {
  .eb-body { --eb-pad: 24px; --eb-book-w: 150px; padding-bottom: 32px; }
  .eb-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 20px; }
  .eb-genres { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .eb-section-title { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .eb-cover, .eb-genre, .eb-arrow { transition: none; }
}
