/* mei.css — 名木 Mei design system v2 (2026-10-03)
   Paper · ink · four seasons · gold hairline · red seal · curves.
   Rules: the paper is always paper; a season colour appears in five places only (chapter kanji,
   the hairline under a name, the 見頃 pill, the section wave, the poster corner); gold belongs to
   the signature tier; red belongs to the seal. The plaque is the one square thing. */

:root {
  --paper: #F6F2EA;
  --surface: #ECE7DC;
  --hairline: #D9D2C4;
  --hairline-soft: #E9E4D9;      /* lines INSIDE a section: plaque rows, list rows — quieter than the frame hairline */
  --ink: #1C1A17;
  --muted: #5E5952;
  --seal: #B5402F;
  --gold-line: #B08D57;
  --gold-text: #8A6A3A;
  --spring: #955460; --spring-tint: #F1E4E6;
  --summer: #4F6B4A; --summer-tint: #E8ECE2;
  --autumn: #9E4B2C; --autumn-tint: #F2E2D8;
  --winter: #3F5563; --winter-tint: #E4E9EC;
  --accent: var(--summer);
  --ph: #E6E0D3;

  --r-0: 0; --r-1: 6px; --r-2: 12px; --r-3: 20px; --r-pill: 999px;

  --f-sans: system-ui, "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --f-sans-ja: system-ui, "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
  --f-serif: "Noto Serif SC", "Noto Serif JP", serif;
  --f-serif-ja: "Noto Serif JP", serif;
  --f-dzh: "Ma Shan Zheng", "Noto Serif SC", serif;      /* the brush of the 名木 wordmark carries every Chinese title (owner, 2026-10-03) */
  --f-dja: "Shippori Mincho B1", "Noto Serif JP", serif;
  --f-brush: "Ma Shan Zheng", "Noto Serif SC", serif;
  --f-latin: "Cormorant Garamond", Georgia, serif;

  --gutter: 16px;
  --max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-sans); font-size: 16px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
:lang(ja) { font-family: var(--f-serif-ja); }
:lang(ja).sans, :lang(ja) .sans { font-family: var(--f-sans-ja); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #3E563A; }
img, svg, video { display: block; max-width: 100%; }
h1, h2, h3, p, dl, dt, dd, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* type voices */
.serif { font-family: var(--f-serif); }
.dzh { font-family: var(--f-dzh); letter-spacing: 0.04em; }
.dja { font-family: var(--f-dja); letter-spacing: 0.04em; }
.brush { font-family: var(--f-brush); }
.latin { font-family: var(--f-latin); font-style: italic; }
.en { font-family: var(--f-latin); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.lbl { font-size: 11px; letter-spacing: 0.18em; color: var(--muted); }
.vert { writing-mode: vertical-rl; text-orientation: mixed; }

/* season colours */
.s-spring { --season: var(--spring); --season-tint: var(--spring-tint); }
.s-summer { --season: var(--summer); --season-tint: var(--summer-tint); }
.s-autumn { --season: var(--autumn); --season-tint: var(--autumn-tint); }
.s-winter { --season: var(--winter); --season-tint: var(--winter-tint); }
.season-ink { color: var(--season); }

/* layout */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 900px) { :root { --gutter: 40px; } }
.stack { display: flex; flex-direction: column; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; } .grid4 { gap: 12px; } }

/* header / footer */
.hdr { height: 56px; display: flex; align-items: center; justify-content: space-between; }
.hdr nav { display: flex; gap: 16px; font-size: 13px; letter-spacing: 0.04em; }
.hdr nav a { color: var(--muted); }
.hdr nav a[aria-current="page"] { color: var(--ink); }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.brand .brush { font-size: 22px; line-height: 1; }
.ftr { padding: 26px 0 28px; display: flex; flex-direction: column; gap: 10px; font-size: 12px; color: var(--muted); }
.ftr .row { display: flex; justify-content: space-between; align-items: center; }
.ftr nav { display: flex; gap: 16px; }
.ftr nav a { color: var(--muted); }

/* seal — the red 落款, two characters stacked */
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--seal); color: #fff; border-radius: 4px; line-height: 1;
  font-family: var(--f-dja); writing-mode: vertical-rl; text-orientation: upright; letter-spacing: 0.04em;
  width: 28px; height: 28px; font-size: 12px; flex-shrink: 0;
}
.seal.m { width: 36px; height: 36px; font-size: 16px; }
.seal.l { width: 44px; height: 44px; font-size: 19px; }
.seal.xl { width: 64px; height: 64px; font-size: 28px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill); font-size: 12px; letter-spacing: 0.08em; line-height: 1.2; }
.pill.season { color: #fff; background: var(--season); font-family: var(--f-serif); }
.pill.paper { color: var(--ink); background: rgba(246, 242, 234, 0.88); }
.pill.ghost { border: 1px solid var(--hairline); background: #fff; color: var(--ink); }
.pill.tag { background: rgba(255, 255, 255, 0.82); color: var(--muted); border: 1px solid var(--hairline); font-size: 10px; padding: 3px 8px; letter-spacing: 0.1em; }

/* photo frames + placeholders */
.ph { position: relative; overflow: hidden; background: var(--ph); border-radius: var(--r-2); }
.ph > svg.silhouette { position: absolute; inset: 0; width: 100%; height: 100%; }
.ph > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph .cap { position: absolute; left: 10px; bottom: 8px; font-size: 11px; color: var(--muted); }
.ph.hero { border-radius: 16px; aspect-ratio: 4 / 5; }
.ph.hero .cap { bottom: 48px; }   /* keep the placeholder caption clear of the catalogue pill */
.ph .tl { position: absolute; left: 14px; top: 14px; display: flex; gap: 8px; align-items: center; }
.ph .bl { position: absolute; left: 14px; bottom: 14px; }
.ph .br { position: absolute; right: 14px; bottom: 14px; }
@media (min-width: 900px) { .ph.hero.wide { aspect-ratio: 3 / 2; border-radius: 0 0 24px 24px; } }

/* cards, panels */
.card { border: 1px solid var(--hairline); border-radius: var(--r-2); background: #fff; }
.panel { background: var(--surface); border-radius: var(--r-3); padding: 20px 18px; }
.panel.white { background: #fff; border: 1px solid var(--hairline); }

/* the plaque — the one square thing */
.plaque { display: flex; flex-direction: column; }
.plaque .row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hairline-soft); }
.plaque .row:first-child { border-top: 1px solid var(--hairline); }
.plaque .row:last-child { border-bottom: 1px solid var(--hairline); }
.plaque dt { font-size: 13px; color: var(--muted); }
.plaque dd { font-size: 15px; text-align: right; }
.plaque + .foot { margin-top: 8px; font-size: 11px; color: var(--muted); line-height: 1.6; }

/* export status card with the season arc */
.export { position: relative; padding: 14px 16px 14px 24px; border: 1px solid var(--hairline); border-radius: var(--r-2); background: #fff; display: flex; flex-direction: column; gap: 6px; }
.export .arc { position: absolute; left: 7px; top: 14px; }
.export .zh { font-family: var(--f-dzh); font-size: 16px; line-height: 1.5; }
.export .sub { font-size: 12px; color: var(--muted); }
.export .fixed { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 52px; padding: 0 22px; border-radius: var(--r-pill); border: 0; background: var(--accent); color: #fff; font-size: 16px; letter-spacing: 0.12em; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border: 1px solid var(--ink); color: var(--ink); height: 44px; font-size: 13px; letter-spacing: 0.08em; }
.input { height: 44px; border: 1px solid var(--hairline); border-radius: var(--r-pill); background: #fff; padding: 0 16px; font-size: 14px; width: 100%; }

/* section ornaments (SVG injected by mei.js) — lace for breaks, 墨線 for the text, 枝 for the plaque foot */
.orn { display: block; }
.orn.lace { width: min(320px, 100%); height: 20px; margin: 0 auto; }
.orn.lace-edge { width: 100%; height: 18px; }
.orn.wave { width: 100%; height: 14px; }
.orn.brushline { width: 220px; height: 12px; }
.orn.branch { width: 170px; height: 18px; }

/* chapter head */
.chapter-head { position: relative; padding: 18px 18px 18px 20px; background: var(--season-tint); border-radius: var(--r-3); display: flex; align-items: center; gap: 16px; }
.chapter-head .kanji { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.chapter-head .kanji svg { position: absolute; inset: 0; }
.chapter-head .kanji .brush { position: absolute; left: 16px; top: 10px; font-size: 60px; line-height: 1; color: var(--season); }
.chapter-head .title { font-family: var(--f-dzh); font-size: 17px; letter-spacing: 0.04em; }
.chapter-head .sub { font-size: 11px; color: var(--muted); letter-spacing: 0.1em; font-family: var(--f-latin); }

/* season nav */
.season-nav { display: flex; gap: 8px; }
.season-nav a { flex-grow: 1; justify-content: center; font-family: var(--f-brush); font-size: 18px; padding: 8px 0; border: 1px solid var(--hairline); background: #fff; color: var(--season); border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 6px; }
.season-nav a small { font-family: var(--f-serif); font-size: 10px; color: var(--muted); }
.season-nav a.on { background: var(--season); border-color: var(--season); color: #fff; }
.season-nav a.on small { color: #fff; }

/* tree cards */
.tcard { display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.tcard .name { font-family: var(--f-dzh); font-size: 16px; }
.tcard .name .ja { font-size: 12px; color: var(--muted); }
.tcard .latin { font-size: 13px; color: var(--muted); }
.tcard .meta { font-size: 12px; color: var(--muted); }
.tcard .warn { font-size: 11px; color: var(--autumn); }
.sig { display: flex; flex-direction: column; gap: 10px; color: var(--ink); }
.sig .tier { font-size: 11px; letter-spacing: 0.18em; color: var(--gold-text); }
.sig h2 { font-family: var(--f-dzh); font-size: 34px; font-weight: 400; letter-spacing: 0.04em; }
.rowl { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--hairline-soft); color: var(--ink); }
.rowl:first-child { border-top: 0; }
.rowl:last-child { border-bottom: 1px solid var(--hairline-soft); }
.rowl .ph { height: 56px; border-radius: 8px; }
.rowl.small { grid-template-columns: 44px minmax(0, 1fr) auto; padding: 8px 0; }
.rowl.small .ph { height: 44px; }

/* tree page */
.tree-name h1 { font-family: var(--f-dzh); font-size: 46px; font-weight: 400; line-height: 1.1; letter-spacing: 0.04em; }
.tree-name .species { font-family: var(--f-dzh); font-size: 20px; line-height: 1.5; }
.tree-name .latin { font-size: 19px; color: var(--muted); }
.tree-name .en { font-size: 13px; color: var(--muted); }
.tree-name .vert { font-family: var(--f-dja); font-size: 17px; letter-spacing: 0.22em; color: var(--muted); border-left: 1px solid var(--hairline); padding-left: 10px; justify-self: end; margin-top: 22px; }
.text h2 { font-family: var(--f-dzh); font-size: 24px; font-weight: 400; line-height: 1.45; letter-spacing: 0.02em; }
.text p { font-family: var(--f-serif); font-size: 16px; line-height: 1.9; }
.knowledge { display: flex; flex-direction: column; gap: 12px; }
.knowledge .intro { font-family: var(--f-serif); font-size: 15px; line-height: 1.9; }
.knowledge dl { display: flex; flex-direction: column; gap: 10px; }
.knowledge .k { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
.knowledge dt { font-size: 12px; color: var(--muted); padding-top: 3px; }
.knowledge dd { font-size: 14px; line-height: 1.7; }
.knowledge .links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }
.knowledge .links a { display: inline-flex; align-items: center; padding: 5px 12px; border: 1px solid var(--hairline); border-radius: var(--r-pill); background: #fff; font-size: 12px; color: var(--ink); }
.knowledge .links a:hover { border-color: var(--ink); }
@media (min-width: 900px) {
  .tree-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; }
  .tree-grid .left { grid-column: span 7; }
  .tree-grid .right { grid-column: span 5; position: sticky; top: 24px; align-self: start; }
  .tree-name h1 { font-size: 56px; }
  .knowledge dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; }
}

/* motion */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms ease-out, transform 600ms ease-out; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* sample banner (preview only) · edit mode */
.sample-banner { font-size: 11px; color: var(--muted); text-align: center; padding: 6px 16px; border-bottom: 1px solid var(--hairline-soft); }
.sample-banner:empty { display: none; }
.sample-banner.edit-bar { background: var(--ink); color: #fff; border-bottom: 0; }
.sample-banner.edit-bar a { color: #fff; text-decoration: underline; }
.edit-slot { display: none; }
.edit-btn { position: absolute; right: 10px; top: 10px; z-index: 2; display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--r-pill); background: rgba(28, 26, 23, 0.82); color: #fff; font-size: 11px; letter-spacing: 0.06em; cursor: pointer; }
.edit-btn.busy { opacity: 0.7; }
.edit-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rowl .edit-btn { right: 2px; top: 2px; height: 20px; padding: 0 6px; font-size: 9px; }

/* member pages (入 · 审): form controls shared by the Japanese and Chinese desks */
.lb { font-size: 12px; color: var(--muted); }
.inp { height: 44px; border: 1px solid var(--hairline); border-radius: 8px; background: #fff; padding: 0 12px; font-size: 16px; width: 100%; }   /* not `.in` — that is the reveal state */
textarea.inp { height: auto; padding: 10px 12px; line-height: 1.7; resize: vertical; }
.chip { height: 36px; padding: 0 12px; border: 1px solid var(--hairline); border-radius: var(--r-pill); background: #fff; font-size: 13px; }
.chip.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip.season.on { border-color: var(--season); background: var(--season); }
.status { font-size: 11px; padding: 2px 8px; border: 1px solid var(--hairline); border-radius: var(--r-pill); color: var(--muted); white-space: nowrap; }
.status.review { border-color: var(--winter); color: var(--winter); }
.status.published { border-color: var(--summer); color: var(--summer); }
.status.reserved { border-color: var(--gold-line); color: var(--gold-text); }
.status.sold { border-color: var(--autumn); color: var(--autumn); }
.msg { font-size: 12px; color: var(--muted); min-height: 16px; }
.msg.err { color: var(--autumn); }
.list a, .list button.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 0; border-top: 1px solid var(--hairline-soft); color: var(--ink); font-size: 14px; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; }
.list a.on, .list button.row.on { background: var(--surface); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.gate-list { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.gate-list .ok::before { content: '✓ '; color: var(--summer); }
.gate-list .no::before { content: '✗ '; color: var(--autumn); }
.gate-list .opt { color: var(--muted); }
.thumbs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.thumbs figure { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--ph); }
.thumbs img, .thumbs video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumbs figcaption { position: absolute; left: 4px; bottom: 4px; font-size: 10px; background: rgba(246, 242, 234, 0.85); padding: 1px 4px; border-radius: 4px; }
