/* Herbarium edition of phyee.com (home page, / and /zh/). Generated markup: tools/home.py.
   Folder colours own the page; rag-white mounting sheets sit on them; everything on a sheet is
   something you could find on a real herbarium sheet: stamp, accession number, tape, packet, label. */

:root {
  --sheet: #FBFAF6;
  --ink: #1B1A17;
  --ink-2: #4A463F;
  --violet: #4F3A9E;   /* institutional stamp */
  --red: #C42E27;      /* numbering machine */
  --tape: rgba(238, 232, 214, 0.9);
  --buff: #EEE2C1;     /* packet paper */
  --rule-blue: #9CB6D8;

  --f-intro: #23523E;
  --f-hotel: #6B1D29;
  --f-pet: #E5B53B;
  --f-notes: #CFB27C;

  --ground: var(--f-intro);
  --on: var(--sheet);

  --grot: "Schibsted Grotesk", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --type: "Courier Prime", "Courier New", "Songti SC", monospace;
  --cas: "Libre Caslon Text", "Songti SC", "STSong", Georgia, serif;
  --song: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --gutter: clamp(16px, 4vw, 64px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--ground); color: var(--on);
  font-family: var(--grot); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .9s cubic-bezier(.3,.7,.2,1), color .6s;
}
body[data-on="dark"] { --on: var(--ink); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: .2em; }
::selection { background: var(--violet); color: var(--sheet); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
[lang="zh-Hans"] { font-family: var(--song); font-style: normal; }

/* ---------- cabinet bar ---------- */
.cabinet-bar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px var(--gutter); color: var(--on);
  pointer-events: none;
}
.cabinet-bar > * { pointer-events: auto; }
.cabinet-bar .mark { font-weight: 900; font-size: 26px; letter-spacing: -0.03em; text-decoration: none; }
.cabinet-bar nav { display: flex; gap: 6px; font-family: var(--type); font-size: 14px; font-weight: 700; }
.cabinet-bar nav a { text-decoration: none; padding: 6px 10px; border: 1.5px solid transparent; border-radius: 2px; }
.cabinet-bar nav a:hover { border-color: currentColor; }
.cabinet-bar .lang { border-color: currentColor !important; }
.cabinet-bar .ed .short { display: none; }

/* The way across to the statutory edition, filed at the foot of the index. */
.index .edition a { border-bottom: 0; border-top: 1.5px dashed rgba(27,26,23,.4); margin-top: 6px; padding-top: 11px; }
.index .edition .no { color: var(--violet); }
.index .edition .name::after { content: " →"; }

/* ---------- rows ---------- */
main { padding-top: 76px; }
.row {
  display: grid; grid-template-columns: minmax(260px, 400px) minmax(0, 660px);
  justify-content: center; align-items: start; gap: clamp(28px, 5vw, 96px);
  padding: clamp(32px, 6vw, 96px) var(--gutter);
}
.row.flip { grid-template-columns: minmax(0, 660px) minmax(260px, 400px); }
.row.intro { padding-top: clamp(16px, 3vw, 40px); }
.margin { position: sticky; top: 120px; font-family: var(--cas); font-style: italic; font-size: clamp(20px, 1.8vw, 26px); line-height: 1.35; max-width: 15em; }
.margin p { margin: 0; }
.row.flip .margin { justify-self: start; }

/* ---------- the cabinet card (identity + index) ---------- */
.card, .loan {
  position: relative; background: var(--sheet); color: var(--ink);
  padding: 22px 24px 26px; transform: rotate(-1.6deg);
  box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 22px 40px -18px rgba(0,0,0,.55);
  /* index-card ruling: a red head rule, faint blue lines */
  background-image: linear-gradient(transparent 58px, var(--red) 58px, var(--red) 60px, transparent 60px);
}
.card { position: sticky; top: 96px; }
.card-head, .l-head {
  display: flex; justify-content: space-between; gap: 12px; margin: 0 0 28px;
  font-family: var(--type); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
}
.card h1, .loan h2 {
  font-weight: 900; font-size: clamp(38px, 3.6vw, 54px); line-height: .98; letter-spacing: -0.035em; margin: 0 0 18px;
}
.card .voice { font-size: 17px; line-height: 1.5; margin: 0 0 22px; max-width: 26em; }
.index { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.index a {
  display: grid; grid-template-columns: 3.4em 1fr auto; gap: 10px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid rgba(27,26,23,.18); text-decoration: none;
}
.index .no { font-family: var(--type); font-weight: 700; color: var(--red); font-size: 14px; }
.index .name { font-weight: 600; }
.index .st { font-family: var(--type); font-size: 12px; color: var(--ink-2); }
.index a:hover .name { text-decoration: underline; text-decoration-thickness: 1.5px; }

/* ---------- mounting sheets ---------- */
.sheet {
  position: relative; background: var(--sheet); color: var(--ink);
  aspect-ratio: 0.69; width: 100%;
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 2px 0 rgba(0,0,0,.06), 0 40px 60px -30px rgba(0,0,0,.6), 0 10px 18px -8px rgba(0,0,0,.25);
  container-type: inline-size;
}
.sheet > * { position: absolute; }

.stamp {
  left: 6%; top: 4.5%; color: var(--violet); border: 2.5px solid currentColor; border-radius: 6px;
  padding: .5em .8em .55em; transform: rotate(-4deg); filter: url(#ink); mix-blend-mode: multiply;
  font-family: var(--grot); line-height: 1.15; text-align: center; font-size: clamp(9px, 1.9cqi, 13px);
}
.stamp b { display: block; font-weight: 900; letter-spacing: .14em; font-size: 1.15em; }
.stamp span { display: block; font-family: var(--type); letter-spacing: .1em; }
.acc {
  right: 6%; top: 5%; margin: 0; color: var(--red); font-family: var(--type); font-weight: 700;
  font-size: clamp(12px, 2.6cqi, 18px); letter-spacing: .14em; opacity: .9; mix-blend-mode: multiply;
}

.specimen { left: 10%; top: 15%; width: 80%; height: 50%; }
.specimen .pair { position: absolute; left: 9%; top: 0; width: 82%; filter: saturate(.92) contrast(1.02); }
.specimen .cards { position: absolute; left: 0; top: 66%; width: 48%; height: 42%; }
.specimen .cards img { position: absolute; width: 50%; transform: rotate(var(--r)); box-shadow: 0 2px 3px rgba(0,0,0,.18); border-radius: 6%; }
.specimen .cards img:nth-child(1) { left: 0; top: 10%; }
.specimen .cards img:nth-child(2) { left: 40%; top: 0; }

.tape {
  position: absolute; left: var(--x); top: var(--y); width: 22%; height: 8%;
  transform: translate(-50%, -50%) rotate(var(--r));
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.03) 0 1px, transparent 1px 3px),
    var(--tape);
  box-shadow: 0 1px 1.5px rgba(0,0,0,.18);
  z-index: 2;
}
.tape.small { width: 40%; height: 14%; }

/* Fragment packet: folded buff paper with a flap. */
.packet {
  left: 6%; bottom: 5%; width: 30%; aspect-ratio: .78; z-index: 4;
  appearance: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ink);
  background: var(--buff);
  background-image: repeating-linear-gradient(0deg, rgba(120,90,40,.05) 0 1px, transparent 1px 4px);
  box-shadow: 0 1px 0 rgba(0,0,0,.12), 0 8px 14px -8px rgba(0,0,0,.45);
  transform: rotate(var(--pr, -2deg)); perspective: 600px; text-align: left;
}
.packet .flap {
  position: absolute; inset: 0 0 auto 0; height: 36%; background: #E4D5AE;
  border-bottom: 1px solid rgba(80,60,20,.35); transform-origin: top center;
  transition: transform .7s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 2px 3px -1px rgba(0,0,0,.2);
}
.packet-label {
  position: absolute; left: 10%; right: 10%; bottom: 12%;
  font-family: var(--type); font-weight: 700; font-size: clamp(12px, 2.3cqi, 15px); line-height: 1.35;
  border-top: 1px solid rgba(27,26,23,.5); padding-top: .5em;
}
.packet-label small { display: block; font-weight: 400; font-size: max(11px, .82em); line-height: 1.4; margin-top: .3em; color: var(--ink-2); }
.packet:hover .flap { transform: rotateX(28deg); }
.sheet.open .packet .flap { transform: rotateX(160deg); }
.packet.big { left: 50%; top: 20%; bottom: auto; width: 42%; transform: translateX(-50%) rotate(var(--pr, -2deg)); cursor: default; }
.packet.big .packet-label { font-size: clamp(12px, 3cqi, 19px); }
.packet.still:hover .flap { transform: none; }

/* The packet's contents fan out across the sheet when opened. */
.fragments { left: 6%; top: 40%; width: 88%; height: 24%; z-index: 6; pointer-events: none; }
.fragments img {
  position: absolute; left: 2%; top: 60%; width: 19%; border-radius: 6%;
  box-shadow: 0 3px 6px rgba(0,0,0,.25);
  transform: translateY(80%) rotate(-4deg) scale(.5); opacity: 0;
  transition: transform .8s cubic-bezier(.2,.9,.2,1), opacity .3s;
}
.sheet.open .fragments { pointer-events: auto; }
.sheet.open .fragments img { opacity: 1; }
.sheet.open .fragments img:nth-child(1) { transform: translate(0%, -10%) rotate(-12deg); transition-delay: .05s; }
.sheet.open .fragments img:nth-child(2) { transform: translate(85%, -38%) rotate(-7deg); transition-delay: .1s; }
.sheet.open .fragments img:nth-child(3) { transform: translate(172%, -52%) rotate(-2deg); transition-delay: .15s; }
.sheet.open .fragments img:nth-child(4) { transform: translate(260%, -54%) rotate(3deg); transition-delay: .2s; }
.sheet.open .fragments img:nth-child(5) { transform: translate(348%, -42%) rotate(8deg); transition-delay: .25s; }
.sheet.open .fragments img:nth-child(6) { transform: translate(434%, -18%) rotate(13deg); transition-delay: .3s; }

/* Space reserved on an unmounted sheet: a pencilled box. */
.reserved { left: 14%; top: 15%; width: 72%; height: 44%; border: 1.5px dashed rgba(27,26,23,.28); border-radius: 2px; }
.reserved span { position: absolute; left: 10px; bottom: 8px; font-family: var(--type); font-size: clamp(10px, 2cqi, 13px); color: rgba(27,26,23,.72); }

/* Collector label. */
.label {
  right: 5%; bottom: 4.5%; width: 56%; z-index: 5;
  background: #fff; border: 1px solid rgba(27,26,23,.55); padding: 3.4cqi 3.6cqi 3cqi;
  font-size: clamp(11px, 2.2cqi, 15px); line-height: 1.38;
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
}
.label .l-head { margin-bottom: 1em; font-size: .85em; border-bottom: 1px solid rgba(27,26,23,.4); padding-bottom: .5em; }
.label h2 { margin: 0; font-weight: 400; font-size: 1.35em; line-height: 1.3; }
.label .bin { font-family: var(--cas); font-style: italic; }
.label .auth { font-family: var(--cas); font-size: .78em; color: var(--ink-2); }
.label .common { margin: .2em 0 .9em; font-weight: 800; font-size: 1.12em; letter-spacing: -0.01em; }
.label dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .35em .9em; font-family: var(--type); font-size: .92em; }
.label dt { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: .9em; padding-top: .08em; }
.label dd { margin: 0; }
.label .l-links { display: flex; flex-wrap: wrap; gap: .4em 1.1em; margin: 1em 0 0; padding-top: .7em; border-top: 1px dashed rgba(27,26,23,.45); font-weight: 700; }
.label .l-links a { text-decoration-thickness: 1.5px; }
.label .l-links a:first-child::after { content: " →"; }

.sheet.empty .label { bottom: 6%; }

/* ---------- field notes ---------- */
.row.notes { grid-template-columns: minmax(0, 1100px); }
.notes-head h2 { font-weight: 900; font-size: clamp(44px, 6vw, 92px); letter-spacing: -0.04em; line-height: .95; margin: 0; color: inherit; }
.notes-head p { font-family: var(--cas); font-style: italic; font-size: clamp(19px, 1.7vw, 24px); margin: 10px 0 0; color: inherit; }
.slips { list-style: none; margin: 34px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 18px 20px; }
.slips li {
  background: #fff; color: var(--ink); padding: 12px 18px 13px; transform: rotate(var(--r));
  font-family: var(--type); font-size: 17px; display: flex; gap: 14px; align-items: baseline;
  box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 10px 18px -10px rgba(60,40,10,.5);
  border-top: 2px solid var(--red);
}
.slips li span::before { content: "det. "; color: var(--ink-2); font-size: .85em; }
.slips li i { font-size: 15px; color: var(--ink-2); }

/* ---------- correspondence ---------- */
.row.write { grid-template-columns: minmax(0, 640px); padding-bottom: clamp(64px, 9vw, 140px); }
.loan { transform: rotate(1.2deg); padding-bottom: 32px; }
.loan p { font-size: 18px; margin: 0 0 20px; }
.loan .mail { font-family: var(--type); font-weight: 700; font-size: clamp(17px, 2.2vw, 26px); color: var(--red); word-break: break-all; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 30px; padding: 22px var(--gutter) 30px; font-family: var(--type); font-size: 14px; border-top: 1px solid currentColor; }
.foot p { margin: 0; }

/* ---------- the authored moment: sheets settle onto the stack ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .sheet { transition: transform 1s cubic-bezier(.2,.8,.2,1), box-shadow 1s; }
  .js .sheet.waiting { transform: translateY(46px) rotate(calc(var(--tilt, 0deg) * -2.5)); box-shadow: 0 60px 80px -30px rgba(0,0,0,.35); }
}

/* ---------- phones: declared density steps ---------- */
@media (max-width: 860px) {
  main { padding-top: 64px; }
  .row, .row.flip { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 28px var(--gutter); }
  .row.flip .sheet { order: 2; }
  .card { position: relative; top: 0; }
  .margin { position: static; }
  .cabinet-bar { padding: 12px var(--gutter); position: absolute; }
}
@media (max-width: 560px) {
  /* Step 1: the sheet stops being a fixed-proportion board and becomes a tall mount; labels flow. */
  .sheet { aspect-ratio: auto; padding: 18px 16px 18px; display: flex; flex-direction: column; gap: 16px; }
  .sheet > * { position: relative; inset: auto; }
  .stamp { align-self: flex-start; font-size: 10px; }
  .acc { position: absolute; right: 16px; top: 22px; font-size: 13px; }
  .specimen { left: auto; top: auto; width: 100%; height: auto; aspect-ratio: 1.15; }
  .packet { left: auto; bottom: auto; width: 46%; }
  .packet-label { font-size: 12px; }
  .fragments { position: absolute; left: 4%; top: 30%; width: 92%; height: 22%; }
  .reserved { display: none; }
  .label { right: auto; bottom: auto; width: 100%; font-size: 14px; padding: 14px 14px 12px; }
  .packet.big { left: auto; top: auto; width: 62%; align-self: center; transform: rotate(-2deg); margin: 18px 0 8px; }
  .packet.big .packet-label { font-size: 14px; }
  .sheet.empty .label { bottom: auto; }
  /* Step 2: drop the second specimen card; keep stamp, tape, packet. */
  .specimen .cards img:nth-child(2) { display: none; }
  .slips li { font-size: 15px; padding: 10px 14px; }
  .card h1 { font-size: 40px; }
  .cabinet-bar nav .opt { display: none; }
  .index .edition .st { display: none; }
  .cabinet-bar .ed .long { display: none; }
  .cabinet-bar .ed .short { display: inline; }
}

/* ---------- Simplified Chinese edition ---------- */
html[lang="zh-Hans"] .card h1, html[lang="zh-Hans"] .loan h2, html[lang="zh-Hans"] .notes-head h2 { letter-spacing: 0.01em; line-height: 1.12; }
html[lang="zh-Hans"] .margin, html[lang="zh-Hans"] .notes-head p { font-family: var(--song); font-style: normal; }
html[lang="zh-Hans"] .card .voice, html[lang="zh-Hans"] .loan p { line-height: 1.7; }
html[lang="zh-Hans"] .label dt { text-transform: none; letter-spacing: .1em; }
[lang="en"] { font-family: inherit; }
