:root {
  --parchment: #edd6a4;
  --parchment-deep: #dcc48a;
  --parchment-edge: #c4a35a;
  --ink: #24150f;
  --ink-soft: #4a3426;
  --wood: #140c09;
  --wood-mid: #2a1810;
  --leather: #3c2116;
  --burgundy: #6d1c28;
  --burgundy-deep: #4a121b;
  --gold: #c9a24a;
  --gold-bright: #e6c56a;
  --gold-dim: #8a6d32;
  --rule: rgba(201, 162, 74, 0.45);
  --shadow: 0 18px 50px rgba(16, 8, 4, 0.35);
  --serif-en: "Cormorant Garamond", "Times New Roman", serif;
  --serif-zh: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, #3a2116 0%, transparent 55%),
    linear-gradient(180deg, #1a0f0b 0%, #0e0806 100%);
  font-family: var(--serif-zh);
  line-height: 1.75;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--burgundy); text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: #8d2433; }

.skip-link {
  position: absolute; left: -999px; top: 8px;
  background: var(--gold); color: var(--wood); padding: 0.4rem 0.8rem; z-index: 20;
}
.skip-link:focus { left: 8px; }

.site-frame {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.1rem 1rem 2.5rem;
}

.health-banner {
  background: var(--burgundy-deep);
  color: #f6e7c2;
  text-align: center;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  padding: 0.4rem 1rem;
  border: 1px solid var(--gold-dim);
}

.masthead {
  background:
    linear-gradient(180deg, rgba(20,12,9,0.2), rgba(20,12,9,0.55)),
    url("../images/hero-library.webp") center 30% / cover no-repeat;
  color: #f6e7c2;
  border: 1px solid var(--gold);
  box-shadow: var(--shadow);
  position: relative;
}
.masthead::after {
  content: "";
  position: absolute; inset: 8px;
  border: 1px solid rgba(230, 197, 106, 0.35);
  pointer-events: none;
}
.masthead-inner {
  position: relative;
  z-index: 1;
  padding: 0.85rem 1rem 0.55rem;
  text-align: center;
  background: linear-gradient(180deg, rgba(16,9,6,0.55), rgba(16,9,6,0.78));
}
.crest {
  width: 58px; height: 58px; margin: 0 auto 0.35rem;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,74,0.18);
  object-fit: cover;
}
.brand-en {
  font-family: var(--serif-en);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-bright);
  font-size: 0.78rem;
  margin: 0;
}
.brand-zh {
  font-size: clamp(1.45rem, 3.2vw, 2.05rem);
  margin: 0.05rem 0 0.1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55), 0 0 24px rgba(201,162,74,0.2);
}
.brand-sub {
  margin: 0;
  color: #e7d3a2;
  font-size: 0.95rem;
}
.ornament {
  width: min(420px, 80%);
  height: 14px;
  margin: 0.45rem auto;
  background:
    linear-gradient(90deg, transparent, var(--gold), transparent);
  position: relative;
}
.ornament::before, .ornament::after {
  content: "◆";
  position: absolute; top: -0.7rem;
  color: var(--gold-bright);
  font-size: 0.75rem;
}
.ornament::before { left: 46%; }
.ornament::after { right: 46%; }

.nav-wrap {
  background: #1b100c;
  border-top: 1px solid var(--gold-dim);
}
.nav-toggle {
  display: none;
  width: 100%;
  background: transparent;
  color: var(--gold-bright);
  border: 0;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem 0.2rem;
  padding: 0.35rem 0.4rem 0.5rem;
}
.site-nav a {
  color: #f6e7c2;
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  font-size: 0.95rem;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  color: var(--gold-bright);
  box-shadow: inset 0 -1px 0 var(--gold);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.2rem;
  margin-top: 1.2rem;
}
.panel {
  background:
    repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(90, 60, 20, 0.06) 29px),
    radial-gradient(1200px 400px at 50% 0%, #f3e2b8, var(--parchment));
  border: 3px solid #b8913c;
  box-shadow: var(--shadow), inset 0 0 80px rgba(90, 50, 20, 0.12);
  position: relative;
}
.panel::before {
  content: "";
  position: absolute; inset: 8px;
  border: 1px solid rgba(138, 109, 50, 0.55);
  pointer-events: none;
}
.panel::after {
  content: "";
  position: absolute; inset: 11px;
  border: 1px solid rgba(201, 162, 74, 0.25);
  pointer-events: none;
}
.article, .sidebar-card, .home-hero, .card {
  position: relative;
  z-index: 1;
}
.article { padding: 1.5rem 1.4rem 2rem; }
.article h1 {
  border-bottom: 1px solid var(--gold);
  padding-bottom: 0.45rem;
  box-shadow: 0 1px 0 rgba(201, 162, 74, 0.25);
}
.crumbs {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 0 0 0.8rem;
}
.kicker {
  font-family: var(--serif-en);
  color: var(--gold-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin: 0;
}
h1, h2, h3, h4 { font-weight: 700; line-height: 1.35; color: var(--burgundy-deep); }
.article h1 { font-size: clamp(1.7rem, 3.5vw, 2.25rem); margin: 0.2rem 0 0.4rem; }
.lede { font-size: 1.08rem; color: var(--ink-soft); }
.meta-line { color: var(--gold-dim); font-size: 0.88rem; margin: 0 0 1rem; }
.figure {
  margin: 1.1rem 0 1.3rem;
  border: 1px solid var(--gold);
  background: #2a1810;
  box-shadow: 0 0 0 3px rgba(201, 162, 74, 0.15);
}
.figure img { width: 100%; max-height: 320px; object-fit: cover; }
.figure figcaption {
  background: #2a1810;
  color: #f0ddb4;
  padding: 0.45rem 0.7rem;
  font-size: 0.86rem;
}
.article p { margin: 0.85rem 0; }
.article ul, .article ol { padding-left: 1.2rem; }
.article li { margin: 0.28rem 0; }
.term { font-family: var(--serif-en); font-style: italic; color: var(--ink-soft); }
.callout {
  border-left: 3px solid var(--gold);
  background: rgba(201, 162, 74, 0.12);
  padding: 0.7rem 0.95rem;
  margin: 1rem 0;
}
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 520px;
}
th, td { border: 1px solid var(--parchment-edge); padding: 0.5rem 0.6rem; text-align: left; vertical-align: top; }
th { background: #3c2116; color: #f6e7c2; font-weight: 600; }
tr:nth-child(even) td { background: rgba(60, 33, 22, 0.05); }
.ad-slot {
  margin: 1.2rem 0;
  min-height: 90px;
  border: 1px dashed var(--gold-dim);
  background: rgba(60, 33, 22, 0.04);
  display: grid;
  place-items: center;
  color: var(--gold-dim);
  font-family: var(--serif-en);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.ad-slot ins { width: 100%; }

.sidebar { display: flex; flex-direction: column; gap: 1rem; }
.sidebar-card { padding: 1rem 1rem 1.1rem; }
.sidebar h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  color: var(--burgundy-deep);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 0.25rem;
}
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { border-bottom: 1px solid rgba(138, 109, 50, 0.25); }
.sidebar a { display: block; padding: 0.38rem 0; text-decoration: none; color: var(--ink); }
.sidebar a:hover { color: var(--burgundy); }

.home-hero { padding: 0; overflow: hidden; }
.home-hero img { width: 100%; max-height: 380px; object-fit: cover; }
.home-copy { padding: 1.3rem 1.4rem 1.6rem; }
.chapter-grid, .card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem;
  margin: 1rem 0 0.4rem;
}
.card {
  background: linear-gradient(180deg, #f8edd4, #efe0b8);
  border: 1px solid var(--gold-dim);
  padding: 0.95rem 1rem 1.05rem;
  text-decoration: none;
  color: inherit;
  display: block;
  min-height: 100%;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 235, 0.4);
}
.card:hover { outline: 1px solid var(--gold); }
.card h3 { margin: 0 0 0.35rem; font-size: 1.08rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.94rem; }

.filters {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0.8rem 0 1rem;
}
.filters input, .filters select, .search-box input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #8a6d32;
  background: #f7e7c2;
  color: var(--ink);
  border-radius: 0;
}
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.8rem; }
.brand-card .tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.5rem 0 0; }
.tag {
  font-size: 0.75rem;
  border: 1px solid var(--gold-dim);
  padding: 0.05rem 0.4rem;
  color: var(--ink-soft);
}
.empty-state, .error-state { padding: 1.2rem; text-align: center; color: var(--ink-soft); }

.faq details {
  border-bottom: 1px solid var(--parchment-edge);
  padding: 0.55rem 0;
}
.faq summary { cursor: pointer; font-weight: 700; color: var(--burgundy-deep); }

.site-footer {
  margin-top: 1.4rem;
  color: #e7d3a2;
  text-align: center;
  font-size: 0.88rem;
  padding: 1.2rem 0.5rem 0.4rem;
}
.site-footer a { color: var(--gold-bright); }
.footer-warning { color: #c9b48a; max-width: 720px; margin: 0.6rem auto; }

.age-gate {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(10, 6, 4, 0.84);
  display: grid; place-items: center;
  padding: 1rem;
}
.age-gate[hidden] { display: none; }
.age-card {
  max-width: 520px;
  background: var(--parchment);
  border: 1px solid var(--gold);
  padding: 1.4rem 1.3rem 1.3rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.age-card h2 { margin-top: 0; }
.age-actions { display: flex; gap: 0.6rem; justify-content: center; margin-top: 1rem; }
.btn {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--gold);
  background: var(--burgundy);
  color: #f6e7c2;
  cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--burgundy-deep); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .nav-toggle { display: block; }
  .site-nav { display: none; flex-direction: column; }
  .site-nav.open { display: flex; }
  .article { padding: 1.15rem 1rem 1.5rem; }
}

@media (max-width: 560px) {
  .filters { grid-template-columns: 1fr; }
  .brand-zh { letter-spacing: 0.06em; }
}
