:root {
  --bg: #fbf6f1;
  --ink: #3a2e2a;
  --sub: #8a7a72;
  --accent: #b98b98;
  --accent-ink: #ffffff;
  --gold: #c9a45c;
  --card: #ffffff;
  --border: #ecdfd4;
  --shadow: 0 16px 40px rgba(58, 46, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Jost", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

body.km {
  font-family: "Noto Sans Khmer", "Jost", sans-serif;
}

.app {
  max-width: 960px;
  margin: 0 auto;
}

/* ---- Top nav (wordmark left · pill links center · actions right) ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding: 14px 28px;
  background: rgba(251, 246, 241, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: "Jost", sans-serif;
  font-style: italic;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

/* Logo image in the header. The mark is square, so it scales to header height;
   tweak this value to make the logo bigger/smaller. */
.brand-logo {
  height: 48px;
  width: auto;
  display: block;
}

.topbar-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  background: #f1e8df;
  border-radius: 999px;
}

.nav-link {
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--sub);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 999px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 2px 8px rgba(58, 46, 42, 0.08);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.my-btn {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-decoration: none;
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 9px 18px;
  white-space: nowrap;
}

.my-btn:hover {
  background: var(--gold);
  color: #fff;
}

.lang-btn {
  height: 38px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--ink);
  /* Always shows the *other* language's label, so it needs Khmer glyph
     support regardless of body.km — unlike the rest of the page. */
  font-family: "Noto Sans Khmer", "Jost", sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-btn::after {
  content: "⇅";
  font-size: 0.8em;
  opacity: 0.75;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}

/* ---- Desktop: keep brand + nav + actions on a single row ---- */
@media (min-width: 1153px) {
  .topbar {
    flex-wrap: nowrap;
  }
  .topbar-links {
    flex-wrap: nowrap;
  }
}

/* ---- Hamburger (mobile + tablet) ---- */
.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}

.menu-btn span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.topbar.open .menu-btn span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.topbar.open .menu-btn span:nth-child(2) {
  opacity: 0;
}
.topbar.open .menu-btn span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1152px) {
  .menu-btn {
    display: flex;
  }

  /* Collapsed: only brand + hamburger visible */
  .topbar-links,
  .topbar-actions {
    display: none;
  }

  /* Open: links stack full-width below, actions row at the bottom */
  .topbar.open .topbar-links {
    display: flex;
    flex-direction: column;
    width: 100%;
    order: 4;
    gap: 2px;
    padding: 8px;
    border-radius: 20px;
  }

  .topbar.open .nav-link {
    padding: 13px 18px;
  }

  .topbar.open .topbar-actions {
    display: flex;
    width: 100%;
    order: 5;
    justify-content: space-between;
    padding: 2px 10px 6px;
  }
}

/* ---- Hero ---- */
.hero-block {
  scroll-margin-top: 80px;
  text-align: center;
  padding: 68px 24px 32px;
  background: radial-gradient(120% 100% at 50% 0%, #f3e6de 0%, var(--bg) 62%);
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 18px;
}

.headline {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: 3rem;
  line-height: 1.15;
  margin: 0 0 20px;
}

.headline em {
  color: var(--accent);
  font-style: italic;
}

.hero-sub {
  color: var(--sub);
  max-width: 460px;
  margin: 0 auto 34px;
  line-height: 1.7;
  font-size: 0.95rem;
}

.searchbar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.searchbar {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 13px 20px;
  color: var(--sub);
}

.searchbar input {
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  width: 100%;
}

.searchbar input::placeholder {
  color: var(--sub);
}

.chips-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--sub);
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ---- Section headers ---- */
.section-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 24px;
  margin-bottom: 24px;
}

.section-title-left {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.7rem;
  font-weight: 600;
  margin: 0;
}

.view-all {
  font-size: 0.82rem;
  color: var(--sub);
}

.templates-section {
  padding: 56px 0 16px;
}

.loading {
  padding: 0 24px;
  color: var(--sub);
}

/* ---- Template cards ---- */
.catalog {
  display: grid;
  /* auto-fill (not auto-fit) keeps empty columns, so a single card or a
     partial last row stays at normal width instead of stretching wide. */
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
  padding: 0 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.card-preview-link {
  display: block;
  padding: 34px 20px;
  text-align: center;
  color: #fff;
  text-decoration: none;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.3rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.card-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-body h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.3rem;
  font-weight: 600;
}

.card-body p {
  margin: 0;
  color: var(--sub);
  font-size: 0.88rem;
  line-height: 1.6;
  flex: 1;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.price {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--gold);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.preview-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--gold);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
}

.preview-btn:hover {
  background: var(--bg);
}

.buy-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
}

.buy-btn:hover {
  opacity: 0.9;
}

.buy-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.no-results {
  padding: 20px;
  color: var(--sub);
  grid-column: 1 / -1;
  text-align: center;
}

/* ---- Features / Offer ---- */
.section-title {
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 14px;
  position: relative;
  padding-bottom: 20px;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 48px;
  height: 1px;
  background: var(--gold);
}

.features-section,
.offer-section {
  scroll-margin-top: 80px;
  padding: 64px 24px;
  max-width: 780px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  text-align: center;
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f3e6de;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.feature h3 {
  margin: 0 0 8px;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.feature p {
  margin: 0;
  color: var(--sub);
  font-size: 0.86rem;
  line-height: 1.6;
}

.offer-section {
  text-align: center;
}

.offer-copy {
  color: var(--sub);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ---- Reviews (testimonial cards on a warm band) ---- */
.reviews-section {
  scroll-margin-top: 80px;
  background: #f5ede4;
  padding: 72px 24px 84px;
  text-align: center;
}

.reviews-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 14px;
}

.reviews-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 44px;
}

.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  text-align: left;
}

.review-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
}

.review-quote {
  margin: 0;
  font-style: italic;
  font-weight: 300;
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--ink);
}

/* Khmer script doesn't italicize well */
body.km .review-quote {
  font-style: normal;
}

.review-who {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f5ede4;
  border: 1px solid var(--border);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.review-who b {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
}

.review-role {
  display: block;
  color: var(--sub);
  font-size: 0.82rem;
  margin-top: 2px;
}

/* ---- Compare table ---- */
.compare-section {
  scroll-margin-top: 80px;
  padding: 72px 24px;
  text-align: center;
}

.compare-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 14px;
}

.compare-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 2.1rem;
  font-weight: 600;
  margin: 0 0 40px;
}

.compare-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.compare-table {
  width: 100%;
  max-width: 1080px;
  min-width: 640px;
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  text-align: left;
}

.compare-table th,
.compare-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td {
  border-bottom: none;
}

.compare-table thead th {
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sub);
  background: #faf5ef;
}

.compare-table thead th.us {
  color: var(--gold);
}

.compare-table td:first-child {
  font-weight: 500;
  color: var(--ink);
}

/* Our column stands out with a soft gold wash */
.compare-table .us {
  background: rgba(201, 164, 92, 0.10);
}

.compare-table .yes {
  color: var(--gold);
  font-size: 1.05rem;
  font-weight: 600;
}

.compare-table .no {
  color: #c9bdb4;
  font-size: 0.95rem;
}

.compare-table .part {
  color: var(--sub);
}

.compare-table .us .part {
  color: var(--ink);
  font-weight: 500;
}

/* ---- Footer ---- */
.store-footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--sub);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.store-footer a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .topbar {
    justify-content: center;
    padding: 14px 16px;
  }

  .brand {
    order: 1;
  }

  .topbar-actions {
    order: 2;
  }

  .topbar-links {
    order: 3;
    flex-basis: 100%;
    gap: 14px 18px;
  }

  .hero-block {
    padding: 44px 16px 24px;
  }

  .headline {
    font-size: 2.15rem;
  }

  .hero-sub {
    font-size: 0.9rem;
  }

  .section-row {
    padding: 0 16px;
  }

  .templates-section {
    padding: 40px 0 12px;
  }

  .catalog {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }

  .features-section,
  .offer-section {
    padding: 44px 16px;
  }

  .card-actions {
    flex-wrap: wrap;
  }
}
