/* Ebook print-ready bilingual layout — Alfie Ip
   Loads design tokens, then layers booklet styles + print rules. */
@import url('../colors_and_type.css');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #d4cfc2;             /* viewer-only — print bg is ivory */
  color: var(--fg-1);
  font-family: var(--font-body);
  font-size: 11pt;
  line-height: 1.6;
}

/* ── Booklet (page) ────────────────────────────────────────────── */
.page {
  width: 210mm;
  min-height: 297mm;
  margin: 16mm auto;
  background: var(--ivory);
  padding: 22mm 22mm 18mm;
  position: relative;
  box-shadow: 0 4px 32px rgba(20, 22, 26, 0.18);
  page-break-after: always;
  break-after: page;
  display: flex;
  flex-direction: column;
}
.page:last-child { page-break-after: auto; }

.page-running {
  position: absolute;
  top: 12mm;
  left: 22mm;
  right: 22mm;
  display: flex;
  justify-content: space-between;
  font-size: 8.5pt;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--char-400);
  font-weight: 600;
}
.page-running .num {
  font-family: var(--font-display);
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gold-700);
  font-size: 10pt;
}

.page-footer {
  margin-top: auto;
  padding-top: 12mm;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 8pt;
  letter-spacing: 0.15em;
  color: var(--char-400);
  text-transform: uppercase;
  font-weight: 600;
  border-top: 0.75px solid var(--border);
  padding-top: 4mm;
}

/* ── Cover ─────────────────────────────────────────────────────── */
.cover {
  background: var(--ink-900);
  color: var(--ivory);
  padding: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
  overflow: hidden;
}
.cover::before {
  content: "";
  position: absolute;
  inset: 14mm;
  border: 0.75px solid rgba(184, 148, 95, 0.55);
  pointer-events: none;
}
.cover-top, .cover-mid, .cover-bot {
  position: relative;
  z-index: 1;
  padding: 22mm 28mm;
}
.cover-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.cover-eyebrow {
  font-size: 9pt;
  letter-spacing: 0.32em;
  color: var(--gold-400);
  font-weight: 600;
  text-transform: uppercase;
}
.cover-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14pt;
  color: var(--gold-300);
}
.cover-mid {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 12mm;
}
.cover-title-en {
  font-family: var(--font-display);
  font-size: 64pt;
  line-height: 0.95;
  letter-spacing: -0.02em;
  font-weight: 500;
  margin: 0;
  color: var(--ivory);
}
.cover-title-zh {
  font-family: var(--font-zh-display);
  font-size: 28pt;
  color: var(--gold-300);
  letter-spacing: 0.06em;
  font-weight: 500;
  margin: 0;
}
.cover-rule {
  width: 80mm;
  height: 1px;
  background: var(--gold-500);
}
.cover-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14pt;
  color: rgba(250, 250, 247, 0.85);
  line-height: 1.4;
  max-width: 130mm;
  font-weight: 400;
}
.cover-sub-zh {
  font-family: var(--font-zh-body);
  font-size: 11pt;
  color: rgba(250, 250, 247, 0.7);
  line-height: 1.8;
  max-width: 130mm;
}
.cover-bot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 8.5pt;
  letter-spacing: 0.22em;
  color: rgba(250, 250, 247, 0.6);
  font-weight: 600;
  text-transform: uppercase;
}
.cover-bot .wordmark {
  font-family: var(--font-display);
  font-size: 18pt;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ivory);
  font-weight: 500;
}

/* ── TOC ───────────────────────────────────────────────────────── */
.toc {
  display: flex;
  flex-direction: column;
  gap: 8mm;
}
.toc-title-eyebrow {
  font-size: 9pt;
  letter-spacing: 0.28em;
  color: var(--gold-700);
  font-weight: 600;
  text-transform: uppercase;
}
.toc-title {
  font-family: var(--font-display);
  font-size: 32pt;
  color: var(--ink-800);
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-weight: 500;
  margin: 0;
}
.toc-zh {
  font-family: var(--font-zh-display);
  font-size: 14pt;
  color: var(--char-500);
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-top: -4mm;
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 6mm 0 0;
  display: flex;
  flex-direction: column;
}
.toc-list li {
  display: grid;
  grid-template-columns: 12mm 1fr auto;
  column-gap: 6mm;
  padding: 4mm 0;
  border-bottom: 0.5px solid var(--border);
  align-items: baseline;
}
.toc-list .num {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--gold-600);
  font-size: 12pt;
}
.toc-list .title {
  font-size: 11pt;
  color: var(--ink-800);
  font-weight: 500;
}
.toc-list .title-zh {
  font-family: var(--font-zh-body);
  font-size: 10pt;
  color: var(--char-500);
  margin-top: 2px;
}
.toc-list .page-num {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--char-400);
  font-size: 11pt;
}

/* ── Chapter pages ─────────────────────────────────────────────── */
.chapter {
  padding-top: 26mm;
}
.chapter-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14pt;
  color: var(--gold-600);
  font-weight: 400;
}
.chapter-title-en {
  font-family: var(--font-display);
  font-size: 30pt;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink-800);
  margin: 3mm 0 1mm;
  font-weight: 500;
}
.chapter-title-zh {
  font-family: var(--font-zh-display);
  font-size: 17pt;
  letter-spacing: 0.04em;
  color: var(--char-700);
  font-weight: 600;
  margin: 0 0 6mm;
}
.chapter-divider {
  width: 24mm;
  height: 1px;
  background: var(--gold-500);
  margin-bottom: 8mm;
}
.chapter-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 12mm;
}
.chapter-body .lang-label {
  font-size: 8pt;
  letter-spacing: 0.28em;
  color: var(--gold-700);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 3mm;
}
.chapter-body .en p,
.chapter-body .zh p {
  margin: 0 0 3mm;
  font-size: 10pt;
  text-wrap: pretty;
}
.chapter-body .en p { line-height: 1.62; max-width: none; }
.chapter-body .zh p {
  font-family: var(--font-zh-body);
  line-height: 1.85;
  max-width: none;
}
.chapter-body strong {
  font-weight: 700;
  color: var(--ink-800);
}
.chapter-body .callout {
  margin: 3mm 0 4mm;
  padding: 4mm 5mm;
  background: var(--paper);
  border-left: 1.5px solid var(--gold-500);
  font-size: 9.5pt;
  line-height: 1.55;
  color: var(--char-700);
}
.chapter-body .callout-zh {
  font-family: var(--font-zh-body);
  line-height: 1.85;
}
.chapter-body .ask {
  margin-top: 5mm;
  padding-top: 4mm;
  border-top: 0.5px dashed var(--border-strong);
  font-size: 9pt;
  font-style: italic;
  color: var(--accent-ink);
  font-family: var(--font-display);
}
.chapter-body .ask-zh {
  font-family: var(--font-zh-display);
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* ── Intro / outro long-form page ──────────────────────────────── */
.essay {
  padding-top: 24mm;
}
.essay h2 {
  font-family: var(--font-display);
  font-size: 26pt;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink-800);
  font-weight: 500;
  margin: 0 0 2mm;
}
.essay h2.zh {
  font-family: var(--font-zh-display);
  font-size: 16pt;
  color: var(--char-700);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 8mm;
}
.essay .essay-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 12mm;
}
.essay .essay-body p {
  font-size: 10pt;
  line-height: 1.65;
  margin: 0 0 3mm;
  text-wrap: pretty;
}
.essay .essay-body .zh p {
  font-family: var(--font-zh-body);
  line-height: 1.85;
}

/* ── Backmatter / colophon ────────────────────────────────────── */
.colophon {
  padding-top: 26mm;
  text-align: center;
}
.colophon .seal {
  width: 36mm;
  height: 36mm;
  margin: 0 auto 8mm;
}
.colophon h2 {
  font-family: var(--font-display);
  font-size: 24pt;
  color: var(--ink-800);
  font-weight: 500;
  margin: 0 0 6mm;
  letter-spacing: -0.01em;
}
.colophon .compliance {
  margin-top: 12mm;
  padding-top: 6mm;
  border-top: 0.5px solid var(--border);
  font-size: 8pt;
  color: var(--char-400);
  letter-spacing: 0.04em;
  line-height: 1.7;
  max-width: 130mm;
  margin-left: auto;
  margin-right: auto;
}

/* ── Print rules ───────────────────────────────────────────────── */
@page {
  size: A4 portrait;
  margin: 0;
}
@media print {
  body { background: var(--ivory); }
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .page {
    margin: 0;
    box-shadow: none;
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
  }
}
