/* ═══════════════════════════════════════════════════════════════
   CARP CITY — the editor's desk.
   鲤城 · the honest version first, then the cut.

   The novel is a desk in Quanzhou: a requisition in red tape, a
   proof struck through in pencil, a notebook of killed sentences
   with a margin ruled down the left, and a hand-copied volume
   older than the office. This page is that desk. The colour comes
   from the Paper & Ink system the volume vendors; what the page
   adds is graphite and one red pen.

   House rule: this page carries the colour, the prose does not.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --cp-pencil:     #8a8378;   /* graphite — opinions, margins */
  --cp-pencil-soft:#b5aca0;
  --cp-red:        #b3342e;   /* the red pen — hard errors, hard rules */
  --cp-rule:       var(--pap-border);
  --cp-sheet:      var(--pap-surface-card);
}

/* ─── nav ─────────────────────────────────────────────────────
   Paper's .pap-nav__brand-mark is a wood-green diamond with no colour
   set, so the seal glyph inherits --pap-fg — near-black on sage in
   light mode (legible), but cream on green in dark mode at 1.99:1,
   which is a seal nobody can read. The desk's red pen stamps it:
   red ground, pale paste. Same fix as A Book to Burn's. */
.pap-nav__brand-mark {
  display: grid;
  place-items: center;
  background: var(--cp-red);
  color: #f6f3ea;
  font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
  font-size: 1.05rem;
  line-height: 1;
}

/* ─── hero — the title page ─────────────────────────────────── */

.cp-hero {
  padding: calc(3.5rem + clamp(3rem, 8vw, 5.5rem)) 0 clamp(2.5rem, 6vw, 4rem);
}

.cp-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(2rem, 6vw, 4.5rem);
  align-items: start;
}

.cp-hero__text { min-width: 0; }

.cp-badge { margin-bottom: 1.4rem; }

.cp-hero__title {
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -.01em;
  margin: 0 0 .4rem;
}

.cp-hero__zh {
  font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  color: var(--cp-pencil);
  margin: 0 0 1.1rem;
  line-height: 1.2;
}

.cp-hero__motto {
  font-family: "EB Garamond", Georgia, serif;
  font-style: italic;
  font-size: 1.02rem;
  color: var(--pap-muted);
  margin: 0 0 1.6rem;
  max-width: 42ch;
}
.cp-hero__motto [lang="zh-Hans"] {
  font-style: normal;
  font-family: "Noto Serif SC", serif;
}

.cp-hero__lede {
  font-size: 1.12rem;
  line-height: 1.65;
  max-width: 52ch;
  margin: 0 0 1.6rem;
}

.cp-facts {
  list-style: none;
  margin: 0 0 1.8rem;
  padding: 1rem 0;
  border-top: 1px solid var(--cp-rule);
  border-bottom: 1px solid var(--cp-rule);
  max-width: 30rem;
}
.cp-facts li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: .3rem 0;
  font-size: .92rem;
}
.cp-facts__k {
  color: var(--pap-muted);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding-top: .18em;
}
.cp-facts__v [lang="zh-Hans"] { font-family: "Noto Serif SC", serif; }

.cp-take { display: flex; flex-wrap: wrap; gap: .6rem; }

.cp-hero__plate { padding-top: .4rem; }

.cp-plate {
  position: relative;
  width: clamp(13rem, 24vw, 17rem);
  box-shadow: var(--pap-shadow-lg);
}
.cp-plate img {
  display: block;
  width: 100%;
  height: auto;
}
.cp-plate__seal {
  position: absolute;
  bottom: .8rem;
  right: .8rem;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  background: var(--cp-red);
  color: #f7f0dc;
  font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
  font-size: 1.3rem;
  border-radius: 3px 5px 4px 5px;
  transform: rotate(-2deg);
}

/* ─── shared section furniture ──────────────────────────────── */

.cp-section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }

.cp-sec-head { margin-bottom: 2.2rem; }

.cp-h2 {
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  margin: .6rem 0 .5rem;
}

.cp-h2__sub {
  color: var(--pap-muted);
  max-width: 60ch;
  margin: 0;
  line-height: 1.6;
}

/* ─── the requisition — a sheet on the desk ─────────────────── */

.cp-sheet {
  max-width: 46rem;
  background: var(--cp-sheet);
  border: 1px solid var(--cp-rule);
  box-shadow: var(--pap-shadow);
  padding: clamp(1.4rem, 4vw, 2.6rem);
  position: relative;
}

.cp-sheet__head {
  font-family: "Inter", sans-serif;
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--pap-muted);
  margin: 0 0 1.4rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--cp-rule);
}

.cp-req p {
  font-size: .95rem;
  line-height: 1.7;
  margin: 0;
  max-width: 58ch;
}
.cp-req strong {
  letter-spacing: .08em;
}

/* the office's own word, underlined in the red pen */
.cp-red-u {
  text-decoration: underline;
  text-decoration-color: var(--cp-red);
  text-decoration-thickness: 1.5px;
  text-underline-offset: .18em;
}

.cp-rule {
  height: 1px;
  background: var(--cp-rule);
  margin: 1.6rem 0;
}

/* the proof — the honest version, struck */

.cp-proof {
  position: relative;
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: 1.2rem;
}

.cp-proof__margin {
  writing-mode: vertical-rl;
  font-family: "Inter", sans-serif;
  font-size: .66rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cp-red);
  margin: 0;
  padding-top: 2.2rem;
  border-left: 1px solid var(--cp-pencil-soft);
  padding-left: .35rem;
  max-height: 16rem;
}

.cp-proof__body { min-width: 0; }

.cp-proof__label {
  font-family: "Inter", sans-serif;
  font-size: .66rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--cp-pencil);
  margin: 0 0 .9rem;
}

.cp-proof__body > p:not(.cp-proof__label):not(.cp-proof__kept):not(.cp-proof__note) {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.75;
  margin: 0;
}

.cp-proof__body del {
  text-decoration-color: var(--cp-pencil);
  text-decoration-thickness: 1.5px;
  color: var(--cp-pencil);
}

.cp-proof__kept {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1.18rem;
  font-style: italic;
  margin: 1.2rem 0 .9rem !important;
  padding-left: 1rem;
  border-left: 2px solid var(--cp-red);
}

.cp-proof__note {
  font-size: .88rem;
  color: var(--pap-muted);
  line-height: 1.6;
  margin: 0 !important;
}

.cp-stamp {
  position: absolute;
  top: -1.1rem;
  right: -1.1rem;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  background: var(--cp-red);
  color: #f7f0dc;
  font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
  font-size: 1.6rem;
  border-radius: 4px 6px 5px 6px;
  transform: rotate(4deg);
  box-shadow: var(--pap-shadow);
}

/* ─── the ledger — the notebook, ruled ──────────────────────── */

.cp-ledger-wrap { max-width: 46rem; }

.cp-ledger {
  width: 100%;
  border-collapse: collapse;
  background: var(--cp-sheet);
  border: 1px solid var(--cp-rule);
}

.cp-ledger td {
  padding: .55rem .9rem;
  border-bottom: 1px solid color-mix(in srgb, var(--cp-rule) 65%, transparent);
  font-size: .95rem;
  vertical-align: baseline;
}

/* the exercise book's red margin, ruled down the left */
.cp-ledger td:first-child {
  width: 3.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
  color: var(--cp-pencil);
  border-right: 1px solid color-mix(in srgb, var(--cp-red) 45%, transparent);
}

.cp-ledger td:last-child {
  width: 5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
  color: var(--pap-muted);
}

/* region class emitted by build/staticize.py (ledger rows) */
.ar-ledger-link {
  color: var(--pap-fg);
  text-decoration: none;
}
.ar-ledger-link:hover {
  color: var(--pap-cta);
  text-decoration: underline;
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
}

.cp-ledger tr:last-child td { border-bottom: none; }

.cp-ledger__between {
  font-size: .88rem;
  color: var(--pap-muted);
  font-style: italic;
  margin: 1rem 0 0;
}

/* ─── the leaves — of the hand-copied volume ────────────────── */

.cp-leaf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.4rem;
  max-width: 62rem;
}

.cp-leaf {
  background: var(--cp-sheet);
  border: 1px solid var(--cp-rule);
  padding: 1.6rem 1.5rem 1.4rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}

.cp-leaf__tag {
  font-family: "Inter", sans-serif;
  font-size: .66rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cp-red);
}
.cp-leaf__tag [lang="zh-Hans"] {
  font-family: "Noto Serif SC", serif;
  text-transform: none;
  letter-spacing: 0;
}

.cp-leaf__title {
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 1.22rem;
  line-height: 1.3;
  margin: 0;
}

.cp-leaf__body {
  font-family: "EB Garamond", Georgia, serif;
  font-size: .98rem;
  font-style: italic;
  line-height: 1.65;
  color: var(--pap-muted);
  margin: 0;
  flex: 1;
}

.cp-leaf__read {
  font-family: "Inter", sans-serif;
  font-size: .8rem;
  letter-spacing: .08em;
  color: var(--pap-fg);
  text-decoration: none;
  border-bottom: 1px solid var(--cp-red);
  align-self: flex-start;
  padding-bottom: .15rem;
}
.cp-leaf__read:hover { color: var(--cp-red); }
.cp-leaf__read .fmt { margin-left: .45rem; color: var(--pap-muted); }

/* ─── the desk — provenance ─────────────────────────────────── */

.cp-desk {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 4rem);
  max-width: 62rem;
}

.cp-desk__left { min-width: 0; }

.cp-colophon { padding: 1.8rem 1.6rem; }
.cp-colophon p { margin: 0 0 .9rem; }
.cp-colophon p:last-child { margin-bottom: 0; }
.cp-colophon__zh {
  font-family: "Noto Serif SC", serif;
  font-size: 1.5rem;
  line-height: 1.5;
}
.cp-colophon__py { font-style: italic; font-size: .92rem; opacity: .75; }
.cp-colophon__en { font-size: .98rem; line-height: 1.6; }
.cp-colophon__attr {
  font-size: .8rem;
  color: var(--pap-muted) !important;
  border-top: 1px solid var(--cp-rule);
  padding-top: .8rem;
}

.cp-desk__right p:first-child {
  font-size: 1.02rem;
  line-height: 1.7;
  margin: 0 0 1.4rem;
}

.cp-note {
  border-left: 2px solid var(--cp-pencil-soft);
  padding-left: 1.1rem;
}
.cp-note p {
  font-size: .9rem;
  line-height: 1.65;
  color: var(--pap-muted);
  margin: 0 0 .9rem;
}
.cp-note p:last-child { margin-bottom: 0; }

/* ─── footer ────────────────────────────────────────────────── */

.cp-foot {
  border-top: 1px solid var(--cp-rule);
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: baseline;
  justify-content: space-between;
}

.cp-foot__meta {
  font-size: .82rem;
  color: var(--pap-muted);
  margin: 0;
}

.cp-foot__links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.4rem;
  margin: 0;
  padding: 0;
}

/* ─── small screens ─────────────────────────────────────────── */

@media (max-width: 880px) {
  .cp-hero__grid { grid-template-columns: 1fr; }
  .cp-hero__plate { order: -1; }
  .cp-plate { width: 11rem; }
  .cp-desk { grid-template-columns: 1fr; }
  .cp-proof { grid-template-columns: 1fr; }
  .cp-proof__margin {
    writing-mode: horizontal-tb;
    max-height: none;
    border-left: none;
    border-bottom: 1px solid var(--cp-pencil-soft);
    padding: 0 0 .5rem;
  }
  .cp-stamp { right: .4rem; }
}
