/* Pear & Sleepy — theme. No external resources: the site must load in mainland China (fonts self-hosted, SIL OFL, see fonts/). */
@font-face { font-family: "Figtree"; src: url("/theme/fonts/figtree.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
:root {
  --black: #000;
  --hero-bg: #f7f4ef;          /* same as the page (Pear, 2026-10-03; was the light logo green #dee7d0) */
  --paper: #f7f4ef;
  --ink: #2a2826;
  --muted: #8d877f;
  --line: #ddd6cc;
  --accent: #4a5a3a;           /* the logo's olive green */
  --left: 28vw;                /* width of the picture column once open (was 34vw; Pear: more room for the page) */
  --banner-h: 84px;            /* the thin top bar: logo left, menu right (Pear's mock-up, 2026-10-03) */
  --t: 1.1s cubic-bezier(.65, 0, .25, 1);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --sans: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--hero-bg); color: var(--ink); font: 17px/1.7 var(--sans); overflow: hidden; }

/* ---- the picture: full screen first, then the left column ---------------- */
#hero {
  position: fixed; inset: 0; width: 100vw; background: var(--hero-bg);
  display: flex; align-items: center; justify-content: center; overflow: visible; /* Sleepy travels outside his frame during the opening */
  z-index: 5; outline: none;            /* above the page and the top bar while he travels */
}
#hero img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; opacity: 0; transition: opacity .8s ease;
  filter: drop-shadow(0 18px 18px rgba(47, 58, 30, .18)); }
#hero img.ready { opacity: 1; }
#hero img.moving { transition: transform var(--t), opacity .8s ease; transform-origin: 50% 50%; }
#hero.empty::after {          /* until a picture is chosen */
  content: ""; width: 38vmin; height: 38vmin; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c9d3b4, #6f7d5c 70%); opacity: .85;
}
body.open #hero { width: var(--left); }

/* ---- the light section on the right ------------------------------------ */
#panel {
  position: fixed; top: 0; bottom: 0; right: 0; left: var(--left);
  background: var(--paper); display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility 0s linear .7s;
  z-index: 2;
}
body.ready #panel { opacity: 1; visibility: visible; transition: opacity .7s ease; }   /* after Sleepy has arrived */

#banner { position: relative; flex: 0 0 var(--banner-h); height: var(--banner-h); display: flex; align-items: center; gap: 28px;
  padding: 0 32px; background: #fff; border-bottom: 1px solid var(--line); }
#banner img { height: 62px; width: auto; display: block; flex: none; }
#banner .name { font: 400 1.4rem/1 var(--serif); letter-spacing: .04em; color: var(--ink); flex: none; }
#banner.has-img .name { display: none; }

/* Option: banner across the whole width, picture column below it */
body.banner-full #banner { position: fixed; top: 0; left: 0; right: 0; height: var(--banner-h); z-index: 4;
  opacity: 0; visibility: hidden; transition: opacity .7s ease, visibility 0s linear .7s; }
body.banner-full.ready #banner { opacity: 1; visibility: visible; transition: opacity .7s ease; }
body.banner-full #panel { padding-top: var(--banner-h); }
body.banner-full.open #hero { top: var(--banner-h); height: calc(100% - var(--banner-h)); }

#menu { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px clamp(14px, 2.2vw, 32px); }
#menu a { color: #2f3a1e; text-decoration: none; font: 500 1rem/1.2 "Figtree", var(--sans); white-space: nowrap;
  padding: 6px 0; border-bottom: 1.5px solid transparent; transition: border-color .2s; }
#menu a:hover, #menu a.on { border-color: #2f3a1e; }
#mmenu a { color: var(--muted); text-decoration: none; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  padding-bottom: 12px; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }

#page { flex: 1; overflow-y: auto; padding: 40px clamp(32px, 4vw, 64px) 32px; outline: none; scroll-behavior: smooth; }
#page > * { max-width: 860px; margin-left: auto; margin-right: auto; }
#page .fade { animation: fade .5s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#page h1 { font: 400 2rem/1.25 var(--serif); margin: 0 0 .9em; letter-spacing: .01em; }
#page h2, #page h3 { font: 400 1.35rem/1.3 var(--serif); margin: 1.6em 0 .5em; }
#page p { margin: 0 0 1.1em; }
#page a { color: var(--accent); text-underline-offset: 3px; }
#page img, #page video { max-width: 100%; height: auto; display: block; margin: 1.4em auto; border-radius: 2px; }
#page audio { width: 100%; margin: 1em 0; }
#page blockquote { margin: 1.4em 0; padding-left: 1.2em; border-left: 1px solid var(--accent); color: #55504a; font-family: var(--serif); font-style: italic; }
#page .date { color: var(--muted); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: .4em; }
#page .tools { display: flex; justify-content: flex-end; margin-bottom: 8px; }
#page .empty { color: var(--muted); font-style: italic; }

button.thin { font: inherit; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
button.thin:hover { color: var(--ink); border-color: var(--ink); }

/* ---- chevrons ------------------------------------------------------------ */
#pager { display: flex; justify-content: space-between; padding: 10px 24px 14px; border-top: 1px solid var(--line); }
#pager a { display: flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-size: .78rem;
  letter-spacing: .1em; text-transform: uppercase; max-width: 45%; }
#pager a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pager a:hover { color: var(--ink); }
#pager { align-items: center; gap: 16px; }
#credit { flex: 1; text-align: center; color: var(--muted); font-size: .72rem; letter-spacing: .04em; }
#credit span { margin: 0 .35em; }
#pager #credit a { display: inline; max-width: none; color: var(--muted); font-size: inherit; letter-spacing: inherit; text-transform: none; text-decoration: underline; text-underline-offset: 2px; }
#pager #credit a:hover { color: var(--ink); }
/* the opening page: the motto, centred in the page */
body.on-hero #page { display: flex; align-items: center; justify-content: center; }
body.on-hero #page > .fade { width: 100%; }
.motto { max-width: 680px; margin: 0 auto; text-align: center; padding: 6vh 0; font-size: calc(var(--fit, 1) * 1rem); }
body.on-hero #page { overflow: hidden; }   /* the opening page never scrolls: its text is fitted instead */
.motto p { margin: 0; }
.motto p:first-child { font: 400 calc(var(--fit, 1) * clamp(1.7rem, 3.4vw, 2.7rem))/1.3 var(--serif); color: var(--ink); letter-spacing: .005em; }
.motto p:first-child:not(:last-child)::after { content: ""; display: block; width: 56px; height: 1px; background: var(--accent); margin: 1.1em auto 1em; opacity: .7; }
.motto p + p { font: italic 400 calc(var(--fit, 1) * clamp(1.15rem, 2vw, 1.5rem))/1.45 var(--serif); color: var(--accent); }
.hero-text { margin: 0 0 2.2em; padding-bottom: 1.6em; border-bottom: 1px solid var(--line); }
.hero-text p { font: 400 clamp(1.25rem, 2vw, 1.6rem)/1.45 var(--serif); color: var(--ink); margin: 0 0 .5em; }
.hero-text p:last-child { color: var(--accent); font-style: italic; margin: 0; }
#pager a.off { visibility: hidden; }
#pager svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1; }

/* ---- blog drawer --------------------------------------------------------- */
#drawer { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10; display: flex; justify-content: flex-end; }
#drawer[hidden] { display: none; }
#drawer .sheet { width: min(420px, 100vw); height: 100%; background: var(--paper); display: flex; flex-direction: column; }
.drawer-head { display: flex; gap: 8px; padding: 18px; border-bottom: 1px solid var(--line); }
#q { flex: 1; font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); }
#close { font: 300 1.6rem/1 var(--sans); background: none; border: 0; color: var(--muted); cursor: pointer; }
#titles { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
#titles li a { display: block; padding: 12px 20px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
#titles li a small { display: block; color: var(--muted); font-size: .75rem; letter-spacing: .08em; }
#titles li a:hover { background: #fff; }
#titles .none { padding: 16px 20px; color: var(--muted); }

/* ---- small screens: the picture becomes a tile that reopens the menu ----- */
#mmenu { position: fixed; inset: 0; background: var(--hero-bg); z-index: 8; display: flex; align-items: center; justify-content: center; }
#mmenu[hidden] { display: none; }
#mmenu nav { display: flex; flex-direction: column; gap: 22px; text-align: center; }
#mmenu a { color: #5d6b49; font-size: .95rem; padding: 0; }
#mmenu a.on { color: #2f3a1e; }

#burger { display: none; position: fixed; top: 10px; right: 10px; z-index: 10; width: 44px; height: 44px; padding: 11px 9px;
  background: none; border: 0; cursor: pointer; }
#burger span { display: block; height: 2px; margin: 0 0 7px; background: var(--ink); border-radius: 2px; }
#burger span:last-child { margin: 0; }
/* ---- phones ---------------------------------------------------------------
   A phone is narrow (portrait) or short (landscape). The bar keeps only the logo
   and the menu button; the menu carries the credit line. Portrait: the page's
   picture sits at the top, the text below it. Landscape: the picture on the left,
   as on a computer. The chevrons float over the page, without text. */
@media (min-width: 761px) and (min-height: 501px), (min-width: 761px) and (orientation: portrait) { #burger { display: none !important; } }
#mmenu .credit { display: none; }

@media (max-width: 760px), (max-height: 500px) and (orientation: landscape) {
  :root { --banner-h: 52px; }
  body.open #burger { display: block; }
  #burger { top: 4px; right: 6px; }
  #menu { display: none; }
  #banner { padding: 0 64px 0 16px; }
  #banner img { height: 36px; }
  #page { padding: 22px 20px 72px; }
  #page h1 { font-size: 1.55rem; }
  body.open #hero img { filter: none; }
  #hero { cursor: default; }

  /* the chevrons: two quiet round buttons over the page, the credit goes to the menu */
  #pager { position: fixed; left: 0; right: 0; bottom: 0; height: 0; padding: 0; border: 0; z-index: 6; }
  #pager #credit { display: none; }
  #pager a#prev, #pager a#next { position: fixed; bottom: calc(14px + env(safe-area-inset-bottom)); width: 42px; height: 42px; max-width: none;
    justify-content: center; border-radius: 50%; background: rgba(247, 244, 239, .72); color: #2f3a1e;
    box-shadow: 0 1px 6px rgba(42, 40, 38, .15); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
  #pager a#prev { left: 12px; }
  #pager a#next { right: 12px; }
  #pager a span { display: none; }
  #mmenu .credit { display: block; position: absolute; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom));
    text-align: center; color: var(--muted); font-size: .72rem; line-height: 1.6; }
  #mmenu .credit a { font-size: inherit; letter-spacing: 0; text-transform: none; padding: 0; text-decoration: underline; }
}

/* portrait: the picture across the top, the page beneath; the opening page gives it more room */
@media (max-width: 760px) and (orientation: portrait) {
  :root { --left: 0px; --pic-h: 30vh; }
  body.on-hero { --pic-h: 38vh; }
  body.no-pic { --pic-h: 0px; }
  #panel { left: 0; }
  body.open #hero, body.banner-full.open #hero { top: var(--banner-h); left: 0; right: 0; width: 100vw; height: var(--pic-h); padding: 10px 0 0; z-index: 3; }
  body.open #page { margin-top: var(--pic-h); padding-top: 14px; }
}

/* landscape: the picture on the left, the bar and the page beside it */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --left: 30vw; }
  body.open #hero { padding: 8px 0; }
  #page { padding: 18px 28px 64px; }
  #pager a#prev { left: calc(var(--left) + 12px); } /* over the page, not behind the picture */
  body.no-pic #pager a#prev { left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --t: 0s; }
  #page .fade { animation: none; }
  #hero img { transition: none; }
  #panel, #banner { transition: none !important; }
}

/* languages: the switch sits last in the menu, set apart by a thin rule */
#menu a.lang { color: var(--muted); padding-left: 14px; border-left: 1px solid var(--line, #d9d4ca); border-bottom-color: transparent; }
#mmenu a.lang { margin-top: 10px; color: var(--muted); }
/* "the version in … is coming soon", in the reader's language */
#page .later { color: var(--muted); font-style: italic; font-size: .9rem; margin: 0 0 1.2em; }
.motto + .later { text-align: center; margin-top: 2em; }
/* the blog has no picture beside it: the page takes the whole width (wide screens only) */
/* the blog has no picture beside it: the page takes the whole width */
#panel, body.ready #panel { transition: opacity .7s ease, left .6s ease; }
#hero { transition: opacity .4s ease; }
body.no-pic #panel { left: 0; }
body.no-pic.open #hero { opacity: 0; pointer-events: none; }

/* ---- Pear's styling marks: {serif large green} at the start of a paragraph, -- and --- as separators.
   Written under #page so they win over the opening page's automatic styles. Sizes follow --fit on the opening page. */
#page .x-serif { font-family: var(--serif); font-style: normal; }
#page .x-sans { font-family: var(--sans); font-style: normal; }
#page .x-figtree { font-family: "Figtree", var(--sans); font-style: normal; }
#page .x-small { font-size: calc(var(--fit, 1) * .88rem); line-height: 1.55; }
#page .x-large { font-size: calc(var(--fit, 1) * clamp(1.3rem, 2.4vw, 1.8rem)); line-height: 1.4; }
#page .x-huge { font-size: calc(var(--fit, 1) * clamp(1.7rem, 3.4vw, 2.7rem)); line-height: 1.3; }
#page .x-italic { font-style: italic; }
#page .x-green { color: var(--accent); }
#page .x-grey { color: var(--muted); }
#page .x-black { color: var(--ink); }
#page .x-center { text-align: center; }
#page hr { border: 0; height: 1px; background: var(--line); margin: 1.8em auto; max-width: 100%; }
#page hr.short { width: 56px; background: var(--accent); opacity: .7; }
.motto hr { margin: 1em auto; }
.motto hr:not(.short) { width: 70%; }
.motto.explicit p:first-child::after { display: none; }   /* she placed her own separators */
.motto p + p, .motto hr + p { margin-top: .2em; }
