/* =====================================================
   Pustaka Kata — Design tokens
   Palette: paper cream + logo blue + gold + terracotta accent
   Type: Fraunces (display) / Inter (body) / IBM Plex Mono (data)
   Layout language: dense e-commerce grid (Gramedia-style)
===================================================== */

:root {
  --cream:      #F6F3EA;
  --cream-2:    #ECE6D5;
  --ink:        #201F1C;
  --ink-soft:   #46443E;
  --muted:      #86807A;
  --forest:     #1546A2;
  --forest-2:   #0E3170;
  --gold:       #C9A227;
  --gold-soft:  #E9D9A8;
  --burgundy:   #B5502D;
  --burgundy-2: #8F3D20;
  --line:       #E1DBCB;
  --white:      #FFFFFF;
  --bg-page:    #F3F0E8;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius: 6px;
  --shadow-card: 0 1px 2px rgba(14,49,112,0.07), 0 6px 16px -10px rgba(14,49,112,0.18);
  --shadow-lift: 0 16px 32px -16px rgba(14,49,112,0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-page);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--forest); margin: 0 0 .4em; font-weight: 600; }

/* ---------- Topbar ---------- */
.topbar { background: var(--forest-2); color: var(--cream-2); font-size: .8rem; }
.topbar__inner { display: flex; justify-content: space-between; align-items: center; padding: 7px 20px; gap: 16px; flex-wrap: wrap; }
.topbar__links { display: flex; gap: 18px; }
.topbar a { color: #D7E0F2; font-weight: 500; }
.topbar a:hover { color: var(--gold); }
.topbar__tagline { color: #8AA0C9; font-size: .78rem; }

/* ---------- Header ---------- */
.site-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 0 rgba(14,49,112,.03); }
.site-header__inner { display: flex; align-items: center; gap: 20px; padding: 12px 20px; }

.brand { display: flex; align-items: center; gap: 9px; }
.brand__logo { height: 34px; width: auto; object-fit: contain; flex-shrink: 0; }
.brand__logo--lg { height: 56px; width: auto; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--forest); white-space: nowrap; }
.brand--footer { margin-bottom: 10px; }
.brand--footer .brand__name { color: var(--white); }

.site-search { display: flex; align-items: center; background: var(--cream); border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; flex: 1; max-width: 560px; margin: 0 auto; transition: border-color .15s ease; }
.site-search:focus-within { border-color: var(--forest); background: var(--white); }
.site-search input { border: 0; background: transparent; padding: 10px 6px 10px 18px; font-family: var(--font-body); font-size: .9rem; width: 100%; outline: none; color: var(--ink); }
.site-search button { border: 0; background: var(--forest); color: var(--white); width: 38px; height: 38px; margin: 2px; border-radius: 50%; cursor: pointer; font-size: 1.05rem; flex-shrink: 0; }
.site-search button:hover { background: var(--forest-2); }

.header-cta { display: flex; align-items: center; gap: 7px; background: var(--forest); color: var(--white); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: .86rem; white-space: nowrap; transition: background .15s ease; }
.header-cta:hover { background: var(--forest-2); }
.header-cta__icon { font-size: 1rem; }

.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--forest); display: block; }

/* ---------- Category chip bar ---------- */
.category-bar { background: var(--white); border-bottom: 1px solid var(--line); }
.category-bar__inner { display: flex; gap: 8px; padding: 10px 20px; overflow-x: auto; scrollbar-width: thin; }
.category-bar__inner::-webkit-scrollbar { height: 5px; }
.category-bar__inner::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.chip { flex-shrink: 0; padding: 7px 16px; border-radius: 999px; font-size: .84rem; font-weight: 600; color: var(--ink-soft); background: var(--cream); border: 1px solid transparent; white-space: nowrap; transition: all .15s ease; }
.chip:hover { background: var(--gold-soft); color: var(--forest-2); }
.chip--active { background: var(--forest); color: var(--white); }
.chip--sale { background: rgba(181,80,45,.1); color: var(--burgundy); }
.chip--sale:hover { background: var(--burgundy); color: var(--white); }

/* ---------- Promo banner (beranda) ---------- */
.promo-banner { background: linear-gradient(120deg, var(--forest-2), var(--forest) 65%, #2a63c9); padding: 46px 0; overflow: hidden; position: relative; }
.promo-banner::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 85% 20%, rgba(201,162,39,.25), transparent 45%), radial-gradient(circle at 95% 90%, rgba(255,255,255,.08), transparent 40%);
  pointer-events: none;
}
.promo-banner__inner { position: relative; }
.promo-banner__copy { max-width: 560px; }
.promo-banner__eyebrow { display: inline-block; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-soft); background: rgba(255,255,255,.1); padding: 5px 12px; border-radius: 999px; margin-bottom: 16px; }
.promo-banner h1 { color: var(--white); font-size: clamp(1.7rem, 3.4vw, 2.5rem); line-height: 1.15; letter-spacing: -.01em; margin-bottom: 14px; }
.promo-banner p { color: #C9D6EF; font-size: 1rem; margin-bottom: 26px; max-width: 46ch; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: var(--radius); font-weight: 700; font-size: .88rem; border: 1px solid transparent; cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease; }
.btn--primary { background: var(--forest); color: var(--white); }
.btn--primary:hover { background: var(--forest-2); }
.btn--accent { background: var(--gold); color: var(--forest-2); }
.btn--accent:hover { background: var(--gold-soft); }
.btn--ghost { background: transparent; border-color: var(--forest); color: var(--forest); }
.btn--ghost:hover { background: var(--forest); color: var(--white); }
.btn--block { width: 100%; }
.btn--lg { padding: 14px 26px; font-size: .96rem; }
.btn--disabled, .btn--disabled:hover { background: var(--line); color: var(--muted); cursor: not-allowed; border-color: var(--line); }

/* ---------- Section heads ---------- */
.section-block { margin-bottom: 12px; }
.section-head { margin: 34px 0 16px; }
.section-head--split { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.section-head__eyebrow { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--burgundy); }
.section-head h2 { font-size: 1.35rem; margin-top: 3px; }
.section-head__more { font-weight: 700; font-size: .84rem; color: var(--forest); padding-bottom: 4px; }
.section-head__more:hover { color: var(--burgundy); }
.section-head__count { color: var(--muted); font-size: .88rem; margin: 4px 0 0; }

.filter-bar select { font-family: var(--font-body); font-weight: 600; font-size: .88rem; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--white); color: var(--ink); }

/* ---------- Book grid / horizontal row ---------- */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; padding-bottom: 30px; }

.book-row { display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: 14px; overflow-x: auto; padding: 4px 4px 18px; scrollbar-width: thin; }
.book-row::-webkit-scrollbar { height: 6px; }
.book-row::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.book-card { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); transition: transform .15s ease, box-shadow .15s ease; }
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.book-card--out { opacity: .7; }

.book-card__cover { position: relative; aspect-ratio: 3/4; background: var(--cream-2); }
.book-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 8px; left: 8px; font-family: var(--font-mono); font-size: .66rem; font-weight: 700; letter-spacing: .02em; padding: 3px 8px; border-radius: 4px; color: var(--white); }
.badge--sale { background: var(--burgundy); }
.badge--out { background: var(--ink-soft); left: auto; right: 8px; }

.book-card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.book-card__title { font-family: var(--font-body); font-weight: 600; font-size: .86rem; line-height: 1.3; margin: 0; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.book-card__title a:hover { color: var(--forest); }
.book-card__author { font-size: .76rem; color: var(--muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-card__price { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 2px; flex-wrap: wrap; }
.price { font-family: var(--font-body); font-weight: 800; color: var(--forest-2); font-size: .92rem; }
.price--lg { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 500; }
.price--strike { color: var(--muted); text-decoration: line-through; font-size: .74rem; font-weight: 500; }
.stock-flag { display: inline-block; font-size: .7rem; color: var(--burgundy); font-weight: 600; margin-bottom: 4px; }
.book-card .btn { margin-top: auto; font-size: .76rem; padding: 9px 10px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state p { margin-bottom: 18px; }

/* ---------- Breadcrumb & detail page ---------- */
.breadcrumb { padding: 18px 20px 0; font-size: .82rem; color: var(--muted); }
.breadcrumb--flush { padding: 18px 0 0; }
.breadcrumb a:hover { color: var(--forest); }
.breadcrumb span { margin: 0 6px; }

.detail { display: grid; grid-template-columns: 300px 1fr; gap: 44px; padding: 28px 20px 56px; }
.detail__cover { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); aspect-ratio: 3/4; background: var(--cream-2); }
.detail__cover img { width: 100%; height: 100%; object-fit: cover; }
.detail__category { display: inline-block; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--forest); background: rgba(21,70,162,.08); padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; }
.detail__info h1 { font-size: 1.8rem; margin-top: 6px; }
.detail__author { color: var(--muted); margin-bottom: 16px; }
.detail__price { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.detail__meta { list-style: none; padding: 0; margin: 0 0 22px; border-top: 1px solid var(--line); }
.detail__meta li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.detail__meta li span { color: var(--muted); }
.detail__desc { margin-bottom: 24px; }
.detail__desc h3 { font-size: .98rem; }
.detail__desc p { color: var(--ink-soft); }
.detail__note { font-size: .8rem; color: var(--muted); margin-top: 12px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--forest-2); color: var(--cream-2); margin-top: 50px; padding-top: 48px; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 36px; padding-bottom: 36px; }
.site-footer h4 { color: var(--white); font-size: .9rem; margin-bottom: 14px; letter-spacing: .01em; }
.footer__about { color: #A9BCE0; font-size: .87rem; max-width: 30ch; }
.footer__steps { padding-left: 18px; color: #A9BCE0; font-size: .85rem; display: flex; flex-direction: column; gap: 8px; }
.footer__links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: .87rem; }
.footer__links a { color: #A9BCE0; }
.footer__links a:hover { color: var(--gold); }
.footer__contact { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: .87rem; color: #A9BCE0; }
.footer__contact a:hover { color: var(--gold); }
.footer__bottom { border-top: 1px solid rgba(255,255,255,.12); display: flex; justify-content: space-between; padding: 16px 20px; font-size: .78rem; color: #7C93C2; flex-wrap: wrap; gap: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .detail__cover { max-width: 260px; }
}
@media (max-width: 760px) {
  .site-header__inner { flex-wrap: wrap; padding: 12px 16px; }
  .site-search { order: 3; max-width: 100%; flex-basis: 100%; margin-top: 8px; }
  .header-cta span:last-child { display: none; }
  .header-cta { padding: 10px 12px; }
  .nav-toggle { display: none; }
  .footer__grid { grid-template-columns: 1fr; }
  .book-row { grid-auto-columns: 148px; }
}
