* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Sarabun", "Segoe UI", Tahoma, sans-serif;
  color: #0f172a;
  background: #ffffff;
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
.container { width: min(1120px, 92%); margin: 0 auto; }
.section { padding: 56px 0; }
.section.alt { background: #f8fafc; }
.title { font-size: clamp(1.4rem, 2.8vw, 2rem); margin: 0 0 20px; font-weight: 800; }
.muted { color: #64748b; }

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #1e40af;
  color: #fff;
  box-shadow: 0 6px 20px rgba(2, 6, 23, 0.18);
}
.topbar-inner {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0;
}
.brand { font-weight: 800; font-size: 1rem; }
.search-inline { flex: 1; display: flex; max-width: 640px; margin: 0 auto; }
.search-inline input {
  flex: 1; border: 0; outline: none; border-radius: 999px 0 0 999px;
  padding: 11px 14px; font-size: .95rem;
}
.search-inline button {
  border: 0; background: #1e3a8a; color: #fff; cursor: pointer;
  border-radius: 0 999px 999px 0; padding: 0 16px; font-weight: 600;
}
.contact-inline { display: flex; gap: 10px; align-items: center; }
.pill-link {
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 7px 12px; font-size: .85rem;
}

.menu-bar { background: #1e3a8a; }
.menu-bar .container { display: flex; flex-wrap: wrap; gap: 8px; padding: 9px 0; }
.menu-item {
  color: #fff; font-size: .9rem; opacity: .92;
  background: rgba(255,255,255,.06); border-radius: 10px; padding: 6px 11px;
}

/* Hero */
.hero {
  position: relative; color: #fff;
  background:
    linear-gradient(100deg, rgba(30,58,138,.92) 0%, rgba(30,58,138,.8) 42%, rgba(30,64,175,.4) 100%),
    url("../images/office.png") center/cover no-repeat;
}
.hero .container { padding: 72px 0 86px; }
.hero h1 { margin: 0; font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.2; }
.hero p { margin-top: 16px; max-width: 720px; color: rgba(255,255,255,.95); }
.hero-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; border-radius: 12px; padding: 11px 16px; font-weight: 700;
}
.btn-light { background: #fff; color: #0f172a; }
.btn-dark { background: rgba(30,58,138,.9); color: #fff; border: 1px solid rgba(255,255,255,.35); }

.search-block {
  margin-top: -26px;
}
.search-box {
  display: flex; overflow: hidden; border-radius: 14px;
  box-shadow: 0 14px 35px rgba(2,6,23,.20);
  background: #fff;
}
.search-box input {
  border: 0; outline: none; flex: 1; padding: 14px 16px; font-size: 1rem;
}
.search-box button {
  border: 0; background: #1e40af; color: #fff; cursor: pointer; padding: 0 18px; font-weight: 700;
}

/* Promo marquee */
.promo-wrap {
  margin-top: 20px;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.92);
  box-shadow: 0 6px 24px rgba(2, 6, 23, 0.08);
}
.promo-marquee {
  display: flex;
  width: max-content;
  gap: 10px;
  padding: 14px 10px;
  animation: promo-marquee 42s linear infinite;
  will-change: transform;
}
.promo-marquee:hover { animation-play-state: paused; }
.promo-item {
  width: 120px;
  height: 168px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 14px rgba(2, 6, 23, 0.1);
  display: block;
  flex: 0 0 auto;
}
.promo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@keyframes promo-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Cards and grids */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: #fff; border: 1px solid rgba(148,163,184,.3);
  border-radius: 16px; padding: 16px;
}
.card h3 { margin: 8px 0 6px; font-size: 1rem; }
.card p { margin: 0; font-size: .92rem; color: #475569; }

.categories .circle {
  width: 90px; height: 90px; border-radius: 50%; background: #1e40af; color: #fff;
  display: grid; place-items: center; margin: 0 auto 10px; font-weight: 700;
}
.categories .cat-item { text-align: center; }

/* Books */
.books-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.book-card {
  border: 1px solid rgba(148,163,184,.35); border-radius: 14px; overflow: hidden; background: #fff;
  box-shadow: 0 6px 20px rgba(2,6,23,.06); cursor: pointer;
}
.book-cover { aspect-ratio: 3/4; background: #f1f5f9; display: grid; place-items: center; }
.book-cover img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.book-body { padding: 12px; }
.book-no { font-size: .74rem; color: #64748b; }
.book-title { margin: 4px 0; font-size: .9rem; font-weight: 700; min-height: 44px; }
.book-edition { font-size: .75rem; color: #475569; min-height: 34px; }
.book-btn {
  margin-top: 9px; width: 100%; border: 0; border-radius: 10px; background: #1e40af; color: #fff;
  padding: 8px 10px; font-size: .82rem; font-weight: 700; cursor: pointer;
}

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .55);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal.open { display: flex; }
.modal-card {
  width: min(640px, 92%); max-height: 84vh; overflow: auto; background: #fff;
  border-radius: 12px; border: 1px solid #e2e8f0; padding: 14px;
}
.modal-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.close-x { border: 0; background: transparent; border-radius: 8px; padding: 4px 8px; cursor: pointer; color:#64748b; }
.close-x:hover { background: #f8fafc; color:#0f172a; }
#modalTitle { font-size: 1.2rem; line-height: 1.35; }
.modal-kicker { margin: 0 0 6px; font-size: .85rem; color:#64748b; }
.modal-tagline { margin: 0 0 10px; font-size: .92rem; color:#334155; line-height: 1.55; }
.modal-meta { margin: 0; padding: 0; list-style: none; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.modal-meta li { display: grid; grid-template-columns: 88px 1fr; gap: 8px; padding: 7px 0; font-size: .9rem; }
.modal-meta li strong { color:#334155; font-weight: 700; }
.modal-section { margin-top: 10px; }
.modal-section h4 { margin: 0 0 4px; font-size: .92rem; font-weight: 700; color:#1e293b; }
.modal-section ul { margin: 0; padding-left: 18px; }
.modal-section li { margin: 2px 0; color:#334155; font-size:.9rem; line-height:1.5; }

/* FAQ */
.faq-item {
  border: 1px solid rgba(148,163,184,.35); border-radius: 14px; background: #fff; margin-bottom: 10px;
}
.faq-q { width: 100%; border: 0; background: transparent; text-align: left; padding: 14px; font-weight: 700; cursor: pointer; }
.faq-a { display: none; padding: 0 14px 14px; color: #475569; }
.faq-item.open .faq-a { display: block; }

/* CTA + footer */
.cta-banner {
  background: #1e40af; color: #fff; border-radius: 16px; padding: 16px;
  display: flex; justify-content: center; align-items: center; gap: 10px; font-weight: 700;
}
footer.main-footer { margin-top: 38px; background: #0f172a; color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.2fr; gap: 20px; padding: 38px 0; }
.footer-bottom { background: #1e3a8a; text-align: center; padding: 12px; font-size: .88rem; }
.footer-list { list-style: none; padding: 0; margin: 0; color: rgba(255,255,255,.78); font-size: .92rem; }
.footer-list li { margin-bottom: 6px; }

.doc-page .doc-wrap {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px;
}
.doc-page h1 { margin-top: 0; }
.doc-page h2 { margin-top: 26px; }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5, .books-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; }
  .search-inline { order: 3; width: 100%; max-width: none; }
  .promo-item { width: 104px; height: 146px; }
  .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr; }
}
