@font-face {
  font-family: 'StarfruitCelesSerif-Bold';
  src: url('../../pdf/assets/fonts/StarfruitCelesSerif-Bold.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
}

:root {
  --brand: #732634;
  --brand-deep: #8c2641;
  --brand-soft: #d9b4be;
  --brand-pink: #faacc4;
  --bg: #faf7f8;
  --card: #ffffff;
  --text: #2d1f22;
  --muted: #6b5258;
  --line: #eddde2;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(115, 38, 52, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main { flex: 1; }

.hero {
  background: linear-gradient(135deg, #732634 0%, #8c2641 45%, #a33d57 100%);
  color: #fff;
  padding: 3rem 0 2.5rem;
  margin-bottom: 1.5rem;
}
.hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  margin: 0 0 .6rem;
}
.hero p {
  margin: 0;
  color: var(--brand-soft);
  max-width: 36rem;
  line-height: 1.7;
}
.hero .badge-soft {
  display: inline-block;
  background: rgba(255,255,255,.12);
  color: var(--brand-pink);
  border: 1px solid rgba(250,172,196,.35);
  border-radius: 999px;
  padding: .25rem .75rem;
  font-size: .85rem;
  margin-bottom: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.filter-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: .4rem .9rem;
  font-size: .9rem;
  cursor: pointer;
  transition: .15s;
}
.filter-btn:hover { border-color: var(--brand-soft); color: var(--brand); }
.filter-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.tpl-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.tpl-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(115, 38, 52, 0.12);
}
.tpl-thumb {
  aspect-ratio: 3/4;
  background: #e8eaed;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  overflow: hidden;
}
.tpl-thumb svg.page-preview {
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
}
.filters { flex-direction: column; align-items: stretch; gap: .65rem; }
.filter-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.filter-btn.bind { background: #f8fafc; }

.size-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.size-bar .size-label {
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  margin-right: .35rem;
}
.size-btn {
  border: 1px solid var(--line);
  background: #faf7f8;
  color: var(--text);
  border-radius: 10px;
  padding: .35rem .65rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  transition: .15s;
}
.size-btn small {
  font-size: .68rem;
  font-weight: 500;
  color: var(--muted);
}
.size-btn:hover { border-color: var(--brand-soft); }
.size-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.size-btn.active small { color: var(--brand-pink); }
.size-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin: .15rem 0 .35rem;
}
.size-chip {
  font-size: .7rem;
  color: var(--muted);
  background: #f1f5f9;
  border-radius: 4px;
  padding: .1rem .35rem;
}
.size-chip.on {
  color: var(--brand);
  background: #f7eef1;
  font-weight: 700;
}
.size-warn {
  font-size: .75rem;
  color: #c05621;
  margin: 0 0 .35rem;
}
.tpl-meta { margin-bottom: .25rem; }
.bind-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  color: var(--brand);
  background: #f7eef1;
  border-radius: 999px;
  padding: .12rem .55rem;
}
.tpl-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  flex: 1;
}
.tpl-body h3 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 700;
}
.tpl-body .desc {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
  flex: 1;
  margin: 0;
}
.tpl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.tpl-tags span {
  font-size: .75rem;
  background: #f7eef1;
  color: var(--brand);
  border-radius: 6px;
  padding: .15rem .45rem;
}
.btn-use {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: .5rem;
  background: var(--brand);
  color: #fff !important;
  text-decoration: none !important;
  border: none;
  border-radius: 10px;
  padding: .65rem .9rem;
  font-weight: 700;
  font-size: .95rem;
  transition: background .15s;
}
.btn-use:hover { background: var(--brand-deep); }

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.empty-state, .loading-state {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}

footer.site-footer {
  background: var(--brand);
  color: #fff;
  margin-top: 3rem;
}
footer.site-footer a { color: var(--brand-pink); text-decoration: none; }
footer.site-footer a:hover { text-decoration: underline; }
