:root {
  --bg: #12100c;
  --bg2: #1a1510;
  --bg3: #221b14;
  --gold: #d4a94e;
  --gold-bright: #f0c96a;
  --gold-dim: #8a6d35;
  --cream: #f3e9d2;
  --muted: #a89a7d;
  --line: rgba(212, 169, 78, 0.16);
  --card: #1c1712;
  --radius: 14px;
  --font-my: "Noto Sans Myanmar", "Inter", sans-serif;
  --font-display: "Playfair Display", "Noto Sans Myanmar", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font-my);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-bright); }
::selection { background: var(--gold); color: #1a1408; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(18, 16, 12, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { font-size: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-size: 17px; color: var(--cream); font-style: italic; }
.brand-sub { font-size: 10px; letter-spacing: 4px; color: var(--gold); }
.nav-search { flex: 1; max-width: 420px; margin-left: auto; }
.nav-search input {
  width: 100%; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--cream);
  font-family: var(--font-my); font-size: 14px; outline: none;
}
.nav-search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,169,78,.15); }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 14px; }
.nav-links a:hover { color: var(--gold-bright); }
.nav-cta {
  border: 1px solid var(--gold); color: var(--gold-bright) !important;
  padding: 8px 16px; border-radius: 999px; font-size: 13px !important;
}
.nav-cta:hover { background: var(--gold); color: #1a1408 !important; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; text-align: center; padding: 90px 20px 70px; background: linear-gradient(rgba(18,16,12,.82), rgba(18,16,12,.86)), url('assets/hero.jpg') center center / cover no-repeat; }
.hero-glow {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 300px at 50% -60px, rgba(212,169,78,.16), transparent 70%),
    radial-gradient(900px 500px at 50% 120%, rgba(120,70,20,.10), transparent 70%);
}
.hero-inner { position: relative; max-width: 760px; margin: 0 auto; }
.hero-eyebrow { letter-spacing: 6px; font-size: 12px; color: var(--gold); margin-bottom: 18px; }
.hero-title {
  font-family: var(--font-display); font-size: clamp(38px, 6vw, 64px);
  line-height: 1.35; margin-bottom: 20px;
}
.hero-title em { color: var(--gold-bright); font-style: italic; }
.hero-desc { color: var(--muted); max-width: 560px; margin: 0 auto 34px; font-size: 16px; }
.hero-stats { display: flex; justify-content: center; gap: 48px; margin-bottom: 36px; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-family: var(--font-display); font-size: 34px; color: var(--gold-bright); }
.stat-label { font-size: 13px; color: var(--muted); }
.btn-gold {
  display: inline-block; background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #1a1408; font-weight: 600; padding: 14px 34px; border-radius: 999px;
  text-decoration: none; font-size: 15px;
  box-shadow: 0 8px 30px rgba(212,169,78,.25);
  transition: transform .2s, box-shadow .2s;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(212,169,78,.35); }

/* ---------- Library ---------- */
.library { max-width: 1200px; margin: 0 auto; padding: 30px 20px 70px; }
.library-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.library-head h2 { font-family: var(--font-display); font-size: 30px; font-style: italic; }
.result-count { color: var(--muted); font-size: 14px; }
.filters { margin-bottom: 28px; display: flex; flex-direction: column; gap: 12px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid var(--line); background: var(--bg2); color: var(--muted);
  padding: 8px 18px; border-radius: 999px; font-size: 14px; cursor: pointer;
  font-family: var(--font-my); transition: all .2s;
}
.chip:hover { border-color: var(--gold); color: var(--gold-bright); }
.chip.active { background: var(--gold); border-color: var(--gold); color: #1a1408; font-weight: 600; }
.select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--cream);
  padding: 9px 14px; border-radius: 10px; font-family: var(--font-my); font-size: 14px;
  outline: none; cursor: pointer;
}
.select:focus { border-color: var(--gold); }

/* ---------- Book grid & covers ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 26px 20px;
}
.book { cursor: pointer; transition: transform .25s; }
.book:hover { transform: translateY(-6px); }
.cover {
  aspect-ratio: 3 / 4.2; border-radius: 6px 12px 12px 6px; position: relative;
  overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 14px; text-align: center;
  box-shadow: 0 10px 28px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.06);
  transition: box-shadow .25s;
}
.book:hover .cover { box-shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 1px var(--gold-dim); }
.cover::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 10px;
  background: linear-gradient(90deg, rgba(0,0,0,.45), transparent);
}
.cover::after {
  content: ""; position: absolute; inset: 8px; border: 1px solid rgba(240,201,106,.35);
  border-radius: 3px 8px 8px 3px; pointer-events: none;
}
.cover-imprint {
  font-size: 9px; letter-spacing: 3px; color: rgba(240,201,106,.75);
  font-family: var(--font-display); position: relative; z-index: 1;
}
.cover-title {
  font-family: var(--font-display); font-size: 16px; line-height: 1.6;
  color: #fdf6e3; position: relative; z-index: 1;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-author {
  font-size: 12px; color: rgba(243,233,210,.8); position: relative; z-index: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cover-ornament { color: var(--gold-bright); font-size: 15px; position: relative; z-index: 1; opacity: .9; }
.book-meta { padding: 10px 4px 0; }
.book-title {
  font-size: 14px; font-weight: 500; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.fmt {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; padding: 2px 8px; border-radius: 6px;
  background: rgba(212,169,78,.14); color: var(--gold-bright); border: 1px solid var(--line);
}
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.btn-ghost {
  margin-top: 16px; background: transparent; border: 1px solid var(--gold);
  color: var(--gold-bright); padding: 10px 24px; border-radius: 999px; cursor: pointer;
  font-family: var(--font-my);
}

/* ---------- About ---------- */
.about { border-top: 1px solid var(--line); background: var(--bg2); }
.about-inner { max-width: 1000px; margin: 0 auto; padding: 60px 20px; }
.about-inner h2 { font-family: var(--font-display); font-style: italic; font-size: 28px; margin-bottom: 16px; }
.about-inner > p { color: var(--muted); max-width: 720px; margin-bottom: 34px; }
.about-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.about-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px;
}
.about-card span { font-size: 28px; }
.about-card h3 { font-size: 16px; margin: 10px 0 6px; color: var(--gold-bright); }
.about-card p { font-size: 14px; color: var(--muted); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 40px 20px; text-align: center; }
.footer-brand { font-family: var(--font-display); font-style: italic; font-size: 20px; margin-bottom: 6px; }
.footer p { color: var(--muted); font-size: 13px; }
.footer-links { margin-top: 10px; }
.footer-links a { color: var(--gold); text-decoration: none; }
.footer-links a:hover { color: var(--gold-bright); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,6,4,.78);
  backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 18px;
  max-width: 640px; width: 100%; max-height: 88vh; overflow-y: auto; position: relative;
  padding: 34px;
}
.modal-close {
  position: absolute; top: 14px; right: 14px; background: transparent; border: none;
  color: var(--muted); font-size: 20px; cursor: pointer; width: 36px; height: 36px;
}
.modal-close:hover { color: var(--cream); }
.modal-book { display: flex; gap: 26px; }
.modal-book .cover { width: 180px; flex-shrink: 0; }
.modal-info h2 { font-family: var(--font-display); font-size: 24px; line-height: 1.5; margin-bottom: 8px; }
.modal-author { color: var(--gold-bright); margin-bottom: 14px; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tag {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  background: rgba(212,169,78,.1); border: 1px solid var(--line); color: var(--muted);
}
.modal-meta { font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- AI Librarian ---------- */
.ai-fab {
  position: fixed; bottom: 26px; right: 26px; z-index: 90;
  width: 62px; height: 62px; border-radius: 50%; border: 1px solid var(--gold);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  font-size: 28px; cursor: pointer;
  box-shadow: 0 10px 30px rgba(212,169,78,.4);
  transition: transform .2s;
}
.ai-fab:hover { transform: scale(1.08); }
.ai-panel {
  position: fixed; bottom: 100px; right: 26px; z-index: 90;
  width: min(380px, calc(100vw - 40px)); height: 520px; max-height: 70vh;
  background: var(--bg2); border: 1px solid var(--gold-dim); border-radius: 18px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.ai-panel[hidden] { display: none; }
.ai-head {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, rgba(212,169,78,.12), transparent);
}
.ai-head h3 { font-size: 16px; }
.ai-head p { font-size: 12px; color: var(--muted); }
.ai-head .modal-close { position: static; }
.ai-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg {
  max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.65;
}
.msg.bot { background: var(--bg3); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--gold); color: #1a1408; align-self: flex-end; border-bottom-right-radius: 4px; font-weight: 500; }
.msg .book-link { color: var(--gold-bright); cursor: pointer; text-decoration: underline; }
.msg.user .book-link { color: #1a1408; }
.ai-chips { display: flex; gap: 8px; padding: 0 16px 10px; flex-wrap: wrap; }
.ai-chip {
  font-size: 12px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--muted); font-family: var(--font-my);
}
.ai-chip:hover { border-color: var(--gold); color: var(--gold-bright); }
.ai-input-row { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ai-input-row input {
  flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 16px; color: var(--cream); font-family: var(--font-my); font-size: 14px; outline: none;
}
.ai-input-row input:focus { border-color: var(--gold); }
.ai-input-row button {
  background: var(--gold); border: none; border-radius: 999px; padding: 10px 20px;
  color: #1a1408; font-weight: 600; cursor: pointer; font-family: var(--font-my); font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .nav-inner { flex-wrap: wrap; }
  .nav-search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .nav-links a:not(.nav-cta) { display: none; }
  .hero { padding: 60px 16px 50px; }
  .hero-stats { gap: 28px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 14px; }
  .modal-book { flex-direction: column; }
  .modal-book .cover { width: 150px; }
  .ai-panel { right: 12px; bottom: 100px; }
  .ai-fab { right: 16px; bottom: 20px; }
}

/* ---------- SVG iconography (no emojis) ---------- */
.icon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; fill: none; }
.icon-lg { width: 30px; height: 30px; }
.icon-xl { width: 30px; height: 30px; }
.brand-mark { display: inline-flex; color: var(--gold); }
.brand-logo { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); box-shadow: 0 0 12px rgba(212,169,78,.35); }
.about-ic { display: inline-flex; color: var(--gold); }
.footer-brand .icon { color: var(--gold); }
.ai-fab { display: inline-flex; align-items: center; justify-content: center; color: #1a1408; }
.modal-author .icon, .modal-meta .icon { color: var(--gold); width: 1em; height: 1em; }
.book-link .icon { width: 1em; height: 1em; color: var(--gold); }
.btn-gold .icon { width: 1.1em; height: 1.1em; vertical-align: -0.15em; }

/* ---------- Real cover photos ---------- */
.cover-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
.cover > *:not(.cover-img) { position: relative; z-index: 1; }
.cover:has(.cover-img) .cover-title,
.cover:has(.cover-img) .cover-author,
.cover:has(.cover-img) .cover-imprint,
.cover:has(.cover-img) .cover-ornament { display: none; }
.cover:has(.cover-img)::after { inset: 6px; }

/* ---------- Animations & effects ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes glowPulse {
  from { opacity: .65; }
  to { opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes shineSweep {
  0%, 55% { left: -80%; }
  100% { left: 130%; }
}

/* Hero entrance, staggered. Fill mode is backwards (not both) so the
   button/card hover transforms keep working after the entrance ends. */
.hero-eyebrow { animation: fadeUp .6s ease backwards; }
.hero-title { animation: fadeUp .6s .1s ease backwards; }
.hero-desc { animation: fadeUp .6s .2s ease backwards; }
.hero-stats { animation: fadeUp .6s .3s ease backwards; }
.hero-inner .btn-gold { animation: fadeUp .6s .4s ease backwards; }
.hero-glow { animation: glowPulse 5s ease-in-out infinite alternate; }

/* Gold shine sweeping across the hero button, every few seconds */
.hero-inner .btn-gold { position: relative; overflow: hidden; }
.hero-inner .btn-gold::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg); animation: shineSweep 4.5s ease-in-out infinite;
  pointer-events: none;
}

/* Book cards: staggered entrance on every render + cover zoom on hover */
.book { animation: fadeUp .45s ease backwards; }
.book:nth-child(2) { animation-delay: .04s; }
.book:nth-child(3) { animation-delay: .08s; }
.book:nth-child(4) { animation-delay: .12s; }
.book:nth-child(5) { animation-delay: .16s; }
.book:nth-child(6) { animation-delay: .20s; }
.book:nth-child(7) { animation-delay: .24s; }
.book:nth-child(8) { animation-delay: .28s; }
.book:nth-child(9) { animation-delay: .32s; }
.book:nth-child(10) { animation-delay: .36s; }
.book:nth-child(11) { animation-delay: .40s; }
.book:nth-child(n+12) { animation-delay: .44s; }
.cover-img { transition: transform .35s ease; }
.book:hover .cover-img { transform: scale(1.06); }

/* Chips lift a little on hover */
.chip { transition: background-color .2s, border-color .2s, color .2s, transform .2s; }
.chip:hover { transform: translateY(-1px); }

/* Modal fades + scales in */
.modal-backdrop:not([hidden]) { animation: backdropIn .25s ease backwards; }
.modal { animation: modalIn .3s ease backwards; }

/* Respect users who prefer no motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
