/* celestialsayuki.com
   An overcast sky with glass drifting through it (assets/js/sky.js), and on top of it,
   warm hand-drawn things. Day is pale and rose; night is a storm, cold and blue. */

/* ---------- fonts (subsets built by tools/subset-fonts.mjs) ---------- */
@font-face { font-family: "Sayuki Cormorant"; src: url(../fonts/cormorant.woff2) format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Sayuki Cormorant"; src: url(../fonts/cormorant-italic.woff2) format("woff2"); font-weight: 300 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Sayuki Mincho"; src: url(../fonts/shippori.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Sayuki Mincho"; src: url(../fonts/shippori-medium.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "Sayuki Serif SC"; src: url(../fonts/serif-sc.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Sayuki Serif TC"; src: url(../fonts/serif-tc.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }

/* ---------- tokens: day ---------- */
:root {
  --page: #e9edf2;
  --sky-a: #c3cfdd; --sky-b: #e7ebf0; --sky-c: #f5ede8;
  --edge-top: #c9d4e2; --edge-bottom: #f2e9e4;   /* the sky's top and bottom rows, behind any overscroll */

  --ink: #1f2633;
  --ink-2: #485264;
  --ink-3: #7a8396;
  --rule: rgba(31, 38, 51, 0.12);
  --rule-strong: rgba(31, 38, 51, 0.3);

  --rose: #b03f59;
  --rose-ink: #9c3049;
  --rose-soft: #f4d4db;
  --blob: rgba(232, 160, 178, 0.26);
  --cold: #6a87b0;

  --glass: rgba(255, 255, 255, 0.44);
  --glass-strong: rgba(255, 255, 255, 0.66);
  --glass-edge: rgba(255, 255, 255, 0.72);
  --glass-hi: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 18px 50px -22px rgba(52, 72, 110, 0.32);
  --doodle-bg: #fbfbfc;

  /* the donate pane and the glass it breaks into (donate.js) */
  --pane: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(236, 241, 249, 0.92));
  --pane-shadow: 0 50px 120px -40px rgba(40, 60, 100, 0.45);
  --haze: radial-gradient(90% 70% at 16% -8%, rgba(255, 255, 255, 0.8), transparent 62%),
          linear-gradient(180deg, rgba(206, 218, 234, 0.6), rgba(236, 228, 230, 0.55));
  --ray: rgba(255, 255, 255, 0.42);
  --edge-lo: rgba(96, 126, 176, 0.5);
  --edge-hi: rgba(255, 255, 255, 1);
  --glint: rgba(170, 205, 255, 0.35), rgba(255, 255, 255, 0.9) 50%, rgba(255, 205, 225, 0.3);
  --mote: linear-gradient(135deg, #fff, rgba(160, 192, 240, 0.9));

  --latin: "Sayuki Cormorant", "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --mincho: "Sayuki Mincho", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", serif;
  --display: var(--latin);
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", system-ui, sans-serif;

  --gutter: clamp(20px, 5vw, 56px);
  --measure: 36rem;
  --ease: cubic-bezier(0.2, 0.75, 0.15, 1);

  color-scheme: light;
}

/* ---------- tokens: night (system, unless the visitor picked day) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0b0f19;
    --sky-a: #334363; --sky-b: #2a3854; --sky-c: #212e46;   /* the shader's own top and bottom rows: this gradient shows under Safari's bars */
    --edge-top: #070a12; --edge-bottom: #172032;
    --ink: #e6eaf2; --ink-2: #a9b3c5; --ink-3: #737f95;
    --rule: rgba(196, 214, 255, 0.12); --rule-strong: rgba(196, 214, 255, 0.28);
    --rose: #f09cb0; --rose-ink: #f4b2c2; --rose-soft: #4a2c3a;
    --blob: rgba(140, 172, 236, 0.1); --cold: #9cc0ff;
    --glass: rgba(14, 20, 34, 0.46); --glass-strong: rgba(14, 20, 34, 0.7);
    --glass-edge: rgba(170, 200, 255, 0.13); --glass-hi: rgba(200, 222, 255, 0.12);
    --glass-shadow: 0 18px 60px -20px rgba(0, 0, 0, 0.6);
    --doodle-bg: #172033;
    --pane: linear-gradient(165deg, rgba(34, 45, 72, 0.95), rgba(15, 21, 37, 0.94));
    --pane-shadow: 0 50px 120px -40px rgba(0, 0, 0, 0.8);
    --haze: radial-gradient(90% 70% at 16% -8%, rgba(120, 156, 230, 0.26), transparent 62%),
            linear-gradient(180deg, rgba(5, 8, 16, 0.62), rgba(14, 20, 36, 0.66));
    --ray: rgba(150, 185, 255, 0.11);
    --edge-lo: rgba(130, 170, 240, 0.4);
    --edge-hi: rgba(214, 232, 255, 0.9);
    --glint: rgba(110, 165, 255, 0.22), rgba(214, 232, 255, 0.5) 50%, rgba(255, 160, 205, 0.16);
    --mote: linear-gradient(135deg, rgba(225, 238, 255, 0.95), rgba(110, 150, 230, 0.6));
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0b0f19;
  --sky-a: #334363; --sky-b: #2a3854; --sky-c: #212e46;   /* the shader's own top and bottom rows: this gradient shows under Safari's bars */
  --edge-top: #070a12; --edge-bottom: #172032;
  --ink: #e6eaf2; --ink-2: #a9b3c5; --ink-3: #737f95;
  --rule: rgba(196, 214, 255, 0.12); --rule-strong: rgba(196, 214, 255, 0.28);
  --rose: #f09cb0; --rose-ink: #f4b2c2; --rose-soft: #4a2c3a;
  --blob: rgba(140, 172, 236, 0.1); --cold: #9cc0ff;
  --glass: rgba(14, 20, 34, 0.46); --glass-strong: rgba(14, 20, 34, 0.7);
  --glass-edge: rgba(170, 200, 255, 0.13); --glass-hi: rgba(200, 222, 255, 0.12);
  --glass-shadow: 0 18px 60px -20px rgba(0, 0, 0, 0.6);
  --doodle-bg: #172033;
  --pane: linear-gradient(165deg, rgba(34, 45, 72, 0.95), rgba(15, 21, 37, 0.94));
  --pane-shadow: 0 50px 120px -40px rgba(0, 0, 0, 0.8);
  --haze: radial-gradient(90% 70% at 16% -8%, rgba(120, 156, 230, 0.26), transparent 62%),
          linear-gradient(180deg, rgba(5, 8, 16, 0.62), rgba(14, 20, 36, 0.66));
  --ray: rgba(150, 185, 255, 0.11);
  --edge-lo: rgba(130, 170, 240, 0.4);
  --edge-hi: rgba(214, 232, 255, 0.9);
  --glint: rgba(110, 165, 255, 0.22), rgba(214, 232, 255, 0.5) 50%, rgba(255, 160, 205, 0.16);
  --mote: linear-gradient(135deg, rgba(225, 238, 255, 0.95), rgba(110, 150, 230, 0.6));
  color-scheme: dark;
}

/* ---------- per-language type ---------- */
[lang="en"] {
  --display: var(--latin);
  --body-size: 1.0625rem; --body-lh: 1.65; --track: 0;
}
[lang="zh-Hans"] {
  --display: var(--latin), "Sayuki Serif SC", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --body-size: 1rem; --body-lh: 1.95; --track: 0.03em;
}
[lang="zh-Hant"] {
  --display: var(--latin), "Sayuki Serif TC", "Songti TC", "Noto Serif CJK TC", "Source Han Serif TC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC", sans-serif;
  --body-size: 1rem; --body-lh: 1.95; --track: 0.03em;
}
[lang="ja"] {
  --display: var(--latin), var(--mincho);
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
  --body-size: 1rem; --body-lh: 1.95; --track: 0.03em;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  /* Safari's rubber band shows the root background past the page's ends: switched off where
     overscroll-behavior works, and otherwise the sky's own edge colour, top or bottom (main.js). */
  background: var(--edge-top);
  overscroll-behavior-y: none;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html.past-half { background: var(--edge-bottom); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: transparent;
  font: 400 var(--body-size)/var(--body-lh) var(--sans);
  letter-spacing: var(--track);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-kerning: normal;
  overflow-x: clip;
  transition: color 0.8s var(--ease);
}
img { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--rose) 22%, transparent); }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; border-radius: 6px; }
.i18n-pending main, .i18n-pending .foot { visibility: hidden; }

/* ---------- sky ---------- */
/* iOS 26 Safari won't draw a fixed layer under its status bar and toolbar, but it will draw an absolute
   child of one that hangs past the viewport, as long as it isn't a canvas. So: an empty fixed frame, the
   gradient overhanging it into the bars, and the shader's canvas fading into that gradient at both ends. */
.sky-frame { position: fixed; inset: 0; }   /* no z-index: a negative one stops Safari drawing it under the bars */
#sky { position: absolute; inset: 8px 0; width: 100%; height: calc(100% - 16px);   /* off the edges: Safari hit-tests 4px in to colour its bars, and can't read a canvas */
  -webkit-mask-image: linear-gradient(transparent, #000 48px, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(transparent, #000 48px, #000 calc(100% - 48px), transparent); }
.sky-fallback { position: absolute; inset: calc(-1 * var(--sky-over)) 0; height: auto; }
:root { --sky-over: 160px; }
.sky-fallback {
  z-index: -2;
  /* Only a linear gradient where it runs under the bars: with a radial one there, Safari gives up and paints html's colour. */
  background: linear-gradient(180deg, var(--sky-a), var(--sky-b) 55%, var(--sky-c));
  transition: background 1.2s var(--ease);
}
#sky { z-index: -1; display: block; opacity: 0; transition: opacity 1.6s var(--ease); }
#sky.ready { opacity: 1; }

/* ---------- top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(var(--gutter), env(safe-area-inset-right)) 14px max(var(--gutter), env(safe-area-inset-left));
}
/* The frosting fades in on its own layer: Safari can't animate backdrop-filter, it jumps from none to blurred. */
.bar::before {
  /* Runs up under Safari's status bar (as the sky does), so the glass and the bar above it read as one piece. */
  content: ""; position: absolute; inset: calc(-1 * var(--sky-over)) 0 0 0; z-index: -1; pointer-events: none;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--rule);
  opacity: 0; visibility: hidden;
  transition: opacity 0.5s var(--ease), visibility 0s 0.5s;
}
.bar.solid::before { opacity: 1; visibility: visible; transition: opacity 0.5s var(--ease); }
/* "Celestial紗雪": the same mark sits top left on every page and carries over between them */
.mark {
  display: inline-flex; align-items: baseline; gap: 0;
  text-decoration: none; white-space: nowrap;
  view-transition-name: site-mark;
}
.mk-l { font: italic 400 1.22rem/1 var(--latin); letter-spacing: 0.04em; }
.mk-k { font: 400 1.08rem/1 var(--mincho); letter-spacing: 0.16em; }
.mark:hover .mk-k { color: var(--rose); }
.mk-k { transition: color 0.4s; }
.bar-end { display: flex; align-items: center; gap: 6px; }
.langs { display: flex; gap: 2px; }
.langs button, .theme {
  appearance: none; background: none; border: 0; cursor: pointer;
  min-width: 36px; height: 36px; padding: 0 8px; border-radius: 999px;
  font: 500 0.8rem/1 var(--sans); letter-spacing: 0.04em;
  color: var(--ink-3);
  transition: color 0.3s, background-color 0.3s;
}
.langs button:hover, .theme:hover { color: var(--ink); background: var(--glass); }
.langs button[aria-pressed="true"] { color: var(--ink); }
.langs button[aria-pressed="true"]::after {
  content: ""; display: block; width: 4px; height: 4px; margin: 3px auto -7px; border-radius: 50%; background: var(--rose);
}
.theme { display: grid; place-items: center; width: 36px; padding: 0; margin-left: 4px; }
.theme svg { grid-area: 1 / 1; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.5s var(--ease), transform 0.6s var(--ease); }
.theme .i-moon { opacity: 0; transform: rotate(-40deg) scale(0.7); }
.theme .i-moon .bolt { stroke: var(--cold); }
:root[data-theme="dark"] .theme .i-sun { opacity: 0; transform: rotate(40deg) scale(0.7); }
:root[data-theme="dark"] .theme .i-moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .i-sun { opacity: 0; transform: rotate(40deg) scale(0.7); }
  :root:not([data-theme="light"]) .theme .i-moon { opacity: 1; transform: none; }
}

/* ---------- layout ---------- */
main, .foot { position: relative; }   /* above .sky-frame: a fixed frame is positioned, so it paints over unpositioned content */
main { padding: 0 max(var(--gutter), env(safe-area-inset-left)) 0 max(var(--gutter), env(safe-area-inset-right)); }
.block { max-width: 1120px; margin: 0 auto; padding-block: clamp(96px, 16vh, 180px) 0; }

.head { display: flex; align-items: baseline; gap: 18px; margin: 0 0 clamp(28px, 4vw, 44px); }
.num {
  display: inline-flex; align-items: center; gap: 12px;
  font: italic 400 1.05rem/1 var(--latin); letter-spacing: 0.12em;
  color: var(--rose);
}
.num::after { content: ""; width: clamp(28px, 4vw, 52px); height: 1px; background: currentColor; opacity: 0.55; }
h2 {
  margin: 0;
  font: 500 clamp(1.9rem, 3.6vw, 2.75rem)/1.15 var(--display);
  letter-spacing: 0.01em;
}
:is([lang="zh-Hans"], [lang="zh-Hant"], [lang="ja"]) h2 { font-weight: 600; letter-spacing: 0.1em; font-size: clamp(1.6rem, 3vw, 2.2rem); }

.lede {
  max-width: var(--measure);
  margin: 0;
  font-size: clamp(1.12rem, 1.5vw, 1.3rem);
  line-height: 1.85;
  color: var(--ink-2);
  text-wrap: pretty;
}
[lang="en"] .lede { font: 400 clamp(1.35rem, 2vw, 1.62rem)/1.5 var(--latin); color: var(--ink); max-width: 33rem; }
.sub { margin: -18px 0 24px; color: var(--ink-3); }

/* ---------- hello: tags ---------- */
.tags { list-style: none; margin: 34px 0 0; padding: 0; max-width: 46rem; display: flex; flex-wrap: wrap; gap: 10px 8px; }
.tags li {
  display: inline-flex; align-items: baseline; gap: 0.55em;
  padding: 8px 15px; border-radius: 999px;
  font: 500 0.88rem/1.2 var(--sans); letter-spacing: 0.02em; white-space: nowrap;
  color: var(--ink-2);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  opacity: 0; transform: translateY(10px); filter: blur(4px);
  transition: opacity 0.9s var(--ease), transform 1s var(--ease), filter 0.9s var(--ease);
  transition-delay: calc(0.1s + var(--i, 0) * 50ms);
}
.tags .k { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.tags .like {
  color: var(--rose-ink);
  background: var(--rose-soft); border-color: var(--glass-edge);
}
/* color-mix with a var() in it is not dropped at parse time by Safari < 16.2: it turns invalid when used, and a
   fallback written above it never applies. So it goes behind @supports. */
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .tags .like {
    background: color-mix(in srgb, var(--rose-soft) 62%, transparent);
    border-color: color-mix(in srgb, var(--rose) 16%, transparent);
  }
}
/* facts on one line or more, the things I like on the next */
.tags::after { content: ""; order: 1; flex-basis: 100%; height: 0; }
.tags .like { order: 2; }
.tags.in li { opacity: 1; transform: none; filter: none; }
.hello .lede { max-width: 42rem; text-wrap: balance; }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); filter: blur(6px); transition: opacity 1s var(--ease), transform 1.1s var(--ease), filter 1s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; filter: none; }
/* Glass comes in without the blur: in Safari a filter over a backdrop-filter renders one way while it
   animates and another once it stops, so the frosting and the shadow jump at the end. */
.reveal:is(.card, .actions, .panel) { filter: none; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden; overflow: clip;   /* the diagonal hairline runs past the edges; don't let it widen the page on phones (hidden for Safari < 16, which drops clip and so widens the page) */
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center;
  padding-block: 96px 120px;
}
.hero::before {
  content: ""; position: absolute; left: -20%; right: -20%; top: 74%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule-strong) 35%, var(--rule-strong) 65%, transparent);
  transform: rotate(-11deg); transform-origin: center;
  opacity: 0; animation: fade 2.4s var(--ease) 1.4s forwards;
}
.hero-name {
  display: flex; align-items: flex-start; gap: clamp(18px, 2.4vw, 32px);
  margin: 0; font-weight: 400;
  transform: translate(-9vw, -2vh);   /* left of the middle, with her to the right (.scene-hero) */
}
.kanji {
  writing-mode: vertical-rl;
  font: 400 clamp(6rem, 15vw, 12.5rem)/1 var(--mincho);
  letter-spacing: 0.14em;
  color: var(--ink);
}
.kanji > span { display: inline-block; opacity: 0; filter: blur(18px); transform: translateY(-0.12em); animation: settle 2.2s var(--ease) forwards; }
.kanji > span:nth-child(2) { animation-delay: 0.35s; }
.hero-rule {
  align-self: stretch; width: 1px; margin-top: 0.4em;
  background: linear-gradient(180deg, var(--rule-strong), transparent);
  transform-origin: top; transform: scaleY(0); animation: grow 1.8s var(--ease) 0.9s forwards;
}
.latin {
  writing-mode: vertical-rl;
  margin-top: 0.6em;
  font: italic 300 clamp(1.05rem, 1.7vw, 1.45rem)/1 var(--latin);
  letter-spacing: 0.24em;
  color: var(--ink-2);
  opacity: 0; animation: fade 1.8s var(--ease) 1.2s forwards;
}
.tagline {
  position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%);
  margin: 0; max-width: min(28rem, 80vw); text-align: center;
  font: italic 400 1.2rem/1.6 var(--display); color: var(--ink-2);
}
.cue {
  position: absolute; left: 50%; bottom: max(28px, env(safe-area-inset-bottom));
  display: grid; justify-items: center; gap: 12px;
  transform: translateX(-50%);
  font: 500 0.7rem/1 var(--sans); letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--ink-3); text-decoration: none;
  opacity: 0; animation: fade 1.6s var(--ease) 2s forwards;
}
.cue i { position: relative; width: 1px; height: 44px; overflow: hidden; background: var(--rule); }
.cue i::after { content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 40%; background: var(--ink-2); transform: translateY(-100%); animation: drip 2.6s var(--ease) infinite; }

@keyframes settle { to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes fade { to { opacity: 1; } }
@keyframes grow { to { transform: scaleY(1); } }
@keyframes drip { 0% { transform: translateY(-100%); } 70%, 100% { transform: translateY(250%); } }

/* ---------- small things ---------- */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: clamp(14px, 1.6vw, 22px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.card {
  position: relative;
  padding: 18px 24px 26px;
  border-radius: 24px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  transition: opacity 1s var(--ease), transform 0.9s var(--ease), filter 1s var(--ease), background-color 0.8s, border-color 0.8s;
}
.card:nth-child(4n + 2) { --d: 0.06s; }
.card:nth-child(4n + 3) { --d: 0.12s; }
.card:nth-child(4n) { --d: 0.18s; }
.card h3 { margin: 4px 0 6px; font: 600 1.3rem/1.3 var(--display); letter-spacing: 0.02em; }
[lang="en"] .card h3 { font-weight: 500; font-size: 1.5rem; }
:is([lang="zh-Hans"], [lang="zh-Hant"], [lang="ja"]) .card h3 { letter-spacing: 0.08em; font-size: 1.15rem; }
.card p { margin: 0; color: var(--ink-2); font-size: 0.95em; text-wrap: pretty; }
.quote { margin: 0; }
.quote blockquote { margin: 2px 0 0; font: 500 1.02rem/1.75 var(--mincho); letter-spacing: 0.06em; color: var(--ink); }
.quote blockquote span { display: inline-block; }
.quote .tr { margin-top: 4px; font-size: 0.88em; }
.quote figcaption { margin-top: 8px; font-size: 0.78rem; letter-spacing: 0.04em; color: var(--ink-3); }
.quote figcaption::before { content: "— "; }

.doodle { display: block; width: 100%; max-width: 230px; height: auto; margin: 0 auto 10px; overflow: visible; }
.doodle .bl { fill: var(--blob); stroke: none; }
.doodle .ln, .doodle .ac { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.doodle .ln { stroke: var(--ink); }
.doodle .ln.bg { fill: var(--doodle-bg); }
.doodle .ln.faint { stroke: var(--ink-3); stroke-width: 1.4; }
.doodle .ac { stroke: var(--rose); }
.doodle .fa { fill: var(--rose-soft); stroke: var(--ink); stroke-width: 1.6; }
.doodle .fr { fill: var(--rose); stroke: none; }
.doodle .fi { fill: var(--ink); stroke: none; }
.doodle .ln, .doodle .ac, .doodle .fa, .doodle .fr, .doodle .fi { transition: fill 0.8s, stroke 0.8s; }
.card:hover .doodle { animation: wobble 0.9s var(--ease); }
@keyframes wobble { 30% { transform: rotate(-2deg) translateY(-2px); } 65% { transform: rotate(1.4deg); } }

/* stroke draw-on, prepared by main.js */
.doodle.drawable :is(.ln, .ac) { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); }
.doodle.drawable :is(.fa, .fr, .fi, .bl) { opacity: 0; }
.in .doodle.drawable :is(.ln, .ac) { animation: draw 1.5s var(--ease) forwards; animation-delay: calc(var(--d, 0s) + var(--i, 0) * 45ms); }
.in .doodle.drawable :is(.fa, .fr, .fi, .bl) { animation: fade 1s var(--ease) forwards; animation-delay: calc(var(--d, 0s) + 0.35s + var(--i, 0) * 35ms); }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- poem ---------- */
.poem {
  min-height: 100vh; min-height: 100svh;
  max-width: 1120px; margin: 0 auto;
  display: grid; grid-template-columns: auto auto; justify-content: center; align-items: center;
  column-gap: clamp(48px, 10vw, 180px);
  padding-block: clamp(110px, 16vh, 200px);
}
/* Vertical, right to left, interleaved line by line: the reader's language (large) then the Japanese adaptation (small, beside it),
   pair after pair, like a bilingual book. On the Japanese page the Japanese stands alone, large. The credit is at the far left, at the bottom. */
.poem-words {
  --u: clamp(0.9rem, min(1.45vw, 2.5vh), 1.28rem); /* the large size; the longest line stays within ~78vh */
  display: flex; flex-direction: row-reverse; align-items: flex-start; justify-content: center;
  column-gap: calc(var(--u) * 0.45);
}
.poem-original, .poem-tr { display: contents; } /* their lines become the flex items, so the two can interleave */
.poem-original p, .poem-tr p, .poem-src { writing-mode: vertical-rl; margin: 0; }
/* order: tr1 jp1 tr2 jp2 ... (row-reverse puts the first on the right) */
.poem-tr p:nth-child(1) { order: 1; } .poem-original p:nth-child(1) { order: 2; }
.poem-tr p:nth-child(2) { order: 3; } .poem-original p:nth-child(2) { order: 4; }
.poem-tr p:nth-child(3) { order: 5; } .poem-original p:nth-child(3) { order: 6; }
.poem-tr p:nth-child(4) { order: 7; } .poem-original p:nth-child(4) { order: 8; }
.poem-src { order: 9; }
/* the Japanese: small and light beside its translation */
.poem-original p { font: 500 calc(var(--u) * 0.64)/1.6 var(--mincho); letter-spacing: 0.18em; color: var(--ink-2); }
/* the translation: the main text */
.poem-tr p { color: var(--ink); font: italic 400 calc(var(--u) * 0.95)/1.6 var(--latin); letter-spacing: 0.04em; }
.poem-tr p:lang(zh) { font: normal 500 var(--u)/1.6 var(--display); letter-spacing: 0.2em; }
.poem-tr:not(:has(p:not([hidden]))) { display: none; }
/* alone on the Japanese page: large */
:root:lang(ja) .poem-original p { font: 500 var(--u)/1.5 var(--mincho); letter-spacing: 0.3em; color: var(--ink); }
:root:lang(ja) .poem-original p + p { margin-block-start: calc(var(--u) * 1.6); }
/* gap between pairs */
.poem-tr p + p { margin-block-start: calc(var(--u) * 1.5); }
/* each pair starts at the same height; the lines step down (physical top margin) */
.poem-tr p:nth-child(2), .poem-original p:nth-child(2) { margin-top: calc(var(--u) * 2.2); }
.poem-tr p:nth-child(3), .poem-original p:nth-child(3) { margin-top: calc(var(--u) * 0.9); }
.poem-tr p:nth-child(4), .poem-original p:nth-child(4) { margin-top: calc(var(--u) * 3.1); }
/* fade in, line by line (both of a pair together) */
.poem-original p, .poem-tr p { opacity: 0; filter: blur(10px); transform: translateY(-0.6em); transition: opacity 1.6s var(--ease), filter 1.6s var(--ease), transform 1.8s var(--ease); }
.poem-original p:nth-child(2), .poem-tr p:nth-child(2) { transition-delay: 0.5s; }
.poem-original p:nth-child(3), .poem-tr p:nth-child(3) { transition-delay: 1s; }
.poem-original p:nth-child(4), .poem-tr p:nth-child(4) { transition-delay: 1.5s; }
.poem.in .poem-original p, .poem.in .poem-tr p { opacity: 1; filter: none; transform: none; }
.poem-src { align-self: flex-end; color: var(--ink-2); font: normal 400 calc(var(--u) * 0.62)/1.6 var(--display); letter-spacing: 0.12em; opacity: 0; transition: opacity 1.6s var(--ease) 2.2s; }
.poem.in .poem-src { opacity: 0.85; }
:lang(ja) .poem-src { font-family: var(--mincho); }

/* ---------- works ---------- */
.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.index li { border-bottom: 1px solid var(--rule); }
.index a {
  position: relative;
  display: grid; grid-template-columns: 4.5rem minmax(12rem, 17.5rem) 1fr 2rem; gap: 8px 28px; align-items: baseline;
  padding: 28px 18px;
  text-decoration: none;
  border-radius: 18px;
  isolation: isolate;
}
.index a::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: var(--glass); box-shadow: inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.5s var(--ease), visibility 0s 0.5s;
}
.index a:hover::before { opacity: 1; visibility: visible; transition: opacity 0.5s var(--ease); }
.yr { font: italic 400 1.1rem/1 var(--latin); color: var(--ink-3); letter-spacing: 0.06em; }
.nm { display: grid; gap: 6px; white-space: nowrap; font: 500 clamp(1.6rem, 2.4vw, 2rem)/1.05 var(--latin); letter-spacing: 0.005em; }
.nm small { font: 500 0.68rem/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); }
.nm-app { display: inline-flex; align-items: center; gap: 12px; }
.app-icon {
  width: 34px; height: 34px; border-radius: 8px;
  box-shadow: 0 6px 16px -8px rgba(30, 40, 60, 0.45);
  transition: transform 0.6s var(--ease);
  view-transition-name: plural-icon;
}
.app-name { view-transition-name: plural-name; }
.index a:hover .app-icon { transform: translateY(-2px) rotate(-6deg) scale(1.06); }
/* Frontier's icon: a little drawing of its chart, in the doodles' ink. Small in the list here,
   large on its own page (frontier/frontier.css); the icon and the name fly between the two. */
/* Its shadow is a box-shadow, not filter: drop-shadow, which Safari draws differently mid-animation. */
.fr-icon { view-transition-name: frontier-icon; overflow: visible; border-radius: 29%; }
.fr-icon .ln, .fr-icon .ac { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fr-icon .ln { stroke: var(--ink); stroke-width: 2; }
.fr-icon .ln.bg { fill: var(--doodle-bg); }
.fr-icon .ln.faint { stroke: var(--ink-3); stroke-width: 1.6; }
.fr-icon .ac { stroke: var(--rose); stroke-width: 2.8; }
.fr-icon .fa { fill: var(--rose-soft); stroke: var(--ink); stroke-width: 1.8; }
.fr-icon .fi { fill: var(--ink-3); opacity: 0.55; }
.fr-name { view-transition-name: frontier-name; }
.index .fr-icon { width: 34px; height: 34px; flex: none; box-shadow: 0 6px 16px -8px rgba(30, 40, 60, 0.45); transition: transform 0.6s var(--ease); }
.index a:hover .fr-icon { transform: translateY(-2px) rotate(-6deg) scale(1.06); }
.ds { color: var(--ink-2); text-wrap: pretty; }
.go { justify-self: end; font: 400 1.25rem/1 var(--latin); color: var(--ink-3); transition: transform 0.5s var(--ease), color 0.4s; }
.index a:hover .go, .links a:hover .go { color: var(--rose); transform: translateX(4px); }

/* ---------- before we talk / known issues ---------- */
.talk { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(48px, 7vw, 110px); }
.notes, .issues { margin: 0; padding: 0; list-style: none; }
.notes { counter-reset: n; }
.notes li, .issues li { position: relative; padding: 14px 0 14px 2.4rem; border-top: 1px solid var(--rule); color: var(--ink-2); text-wrap: pretty; }
.notes li:last-child, .issues li:last-child { border-bottom: 1px solid var(--rule); }
.notes li::before {
  counter-increment: n; content: counter(n, decimal-leading-zero);
  position: absolute; left: 0; top: 16px;
  font: italic 400 1rem/1.4 var(--latin); color: var(--cold);
}
.issues li::before {
  content: ""; position: absolute; left: 2px; top: calc(14px + 0.55em);
  width: 13px; height: 13px; border: 1.4px solid var(--rose); border-radius: 4px; opacity: 0.8;
}

/* ---------- feed ---------- */
.feed { text-align: left; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; }
.pill {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 24px; border-radius: 999px;
  font: 500 0.92rem/1 var(--sans); letter-spacing: 0.04em; text-decoration: none;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  transition: transform 0.4s var(--ease), background-color 0.4s, color 0.4s;
}
.pill:hover { transform: translateY(-2px); background: var(--glass-strong); }
.pill.warm { background: var(--rose); border-color: transparent; color: #fff; }
:root[data-theme="dark"] .pill.warm { color: #2a1219; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.warm { color: #2a1219; } }
.pill.warm:hover { background: var(--rose-ink); }
.pill .ico { width: 15px; height: 15px; margin-right: 9px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; opacity: 0.75; }
.pill .go { margin-left: 8px; font: 400 1.05rem/1 var(--latin); color: var(--ink-3); transition: transform 0.5s var(--ease), color 0.4s; }
.pill:hover .go { color: var(--rose); transform: translate(2px, -2px); }

/* ---------- find me ---------- */
.links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 0 48px; }
.links li { border-top: 1px solid var(--rule); }
.links a { display: grid; grid-template-columns: 6.5rem 1fr auto; align-items: baseline; gap: 16px; padding: 20px 4px; text-decoration: none; }
.links .k { font: 500 0.7rem/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); }
.links .v { font: 400 1.3rem/1.2 var(--latin); overflow-wrap: break-word; min-width: 0; }
.links .v[lang="ja"] { font-family: var(--latin), var(--mincho); }

/* ---------- coda ---------- */
.closing {
  min-height: 80vh; min-height: 80svh;
  display: grid; place-content: center; justify-items: center; gap: 28px;
  padding-block: 160px 80px; text-align: center;
}
.closing-line { margin: 0; max-width: 18em; font: 500 clamp(1.5rem, 3.2vw, 2.4rem)/1.5 var(--display); text-wrap: balance; }
:is([lang="zh-Hans"], [lang="zh-Hant"], [lang="ja"]) .closing-line { letter-spacing: 0.1em; font-size: clamp(1.3rem, 2.6vw, 2rem); }
.sign { margin: 0; font: 400 1.05rem/1 var(--mincho); letter-spacing: 0.4em; color: var(--rose); --d: 0.4s; }
.sign::before { content: "— "; letter-spacing: 0; }

/* ---------- footer ---------- */
.foot {
  max-width: 1120px; margin: 0 auto;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 28px;
  padding: 22px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 30px);
  border-top: 1px solid var(--rule);
  font-size: 0.8rem; color: var(--ink-3);
}
.foot p { margin: 0; }
.foot a { color: inherit; text-underline-offset: 3px; }
.foot a:hover { color: var(--ink); }

/* ---------- donate pane ----------
   A pane of glass that gathers out of the wind and breaks back into it (donate.js).
   The haze behind it and the flying pieces are popovers in the top layer, with the dialog between them. */
html:has(dialog.qr[open]) { overflow: hidden; }
dialog.qr {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; border: 0; background: none; color: var(--ink);
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  overflow: hidden; overscroll-behavior: contain;
  z-index: 20;   /* only matters without a top layer (Safari < 15.4): above the bar's 10 */
}
dialog.qr:not([open]) { display: none; }   /* what the browser's own sheet does; Safari < 15.4 has no <dialog>, so the pane would sit open over the page */
dialog.qr[open] { display: grid; place-items: center; }
dialog.qr::backdrop { background: transparent; }
.qr-panel {
  position: relative; overflow: hidden;
  width: min(340px, 100%);
  display: grid; justify-items: center; gap: 16px;
  padding: 28px 24px 22px;
  border-radius: 28px;
  background: var(--pane);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--pane-shadow), inset 0 1px 0 var(--glass-hi);
}
.qr-panel:focus-visible { outline: none; }
.qr-panel h2 { font-size: 1.8rem; }
.qr-code { margin: 0; display: grid; gap: 12px; justify-items: center; }
.qr-code[hidden] { display: none; }
.qr-code img { display: block; width: min(100%, 56vh); height: auto; aspect-ratio: 1; object-fit: contain; padding: 10px; border-radius: 18px; background: #fff; box-shadow: 0 0 0 1px rgba(31, 38, 51, 0.06); }
.qr-code figcaption { font-size: 0.86rem; color: var(--ink-2); }
/* a light passing over the glass once it has formed */
.qr-panel::after {
  content: ""; position: absolute; inset: -30% -70%; pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 42%, var(--ray) 49%, rgba(255, 255, 255, 0.5) 50%, var(--ray) 51%, transparent 58%);
  transform: translateX(-55%);
}
.qr-panel.lit::after { animation: pane-glint 1.5s cubic-bezier(0.3, 0.1, 0.3, 1) both; }
@keyframes pane-glint { 15% { opacity: 1; } to { transform: translateX(55%); opacity: 0; } }

.qr-haze, .qr-fx {
  position: fixed; inset: 0; width: auto; height: auto; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: none; color: inherit;
  overflow: hidden; pointer-events: none;
}
.qr-haze {
  background: var(--haze);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  backdrop-filter: blur(14px) saturate(115%);
}
/* light through the overcast, slowly moving */
.qr-haze::before {
  content: ""; position: absolute; inset: -20% -40%;
  background: linear-gradient(112deg, transparent 18%, var(--ray) 24%, transparent 31%, transparent 41%, var(--ray) 46%, transparent 53%, transparent 63%, var(--ray) 67%, transparent 73%);
  -webkit-mask-image: linear-gradient(180deg, #000 10%, transparent 80%);
  mask-image: linear-gradient(180deg, #000 10%, transparent 80%);
  opacity: 0.8;
  animation: rays 18s ease-in-out infinite alternate;
}
@keyframes rays { from { transform: translateX(-4%); } to { transform: translateX(4%); } }
.qr-fx { perspective: 900px; }
.shard { position: absolute; overflow: hidden; backface-visibility: visible; will-change: transform, opacity; }
.shard .qr-panel { position: absolute; margin: 0; box-shadow: inset 0 1px 0 var(--glass-hi); }
.shard .qr-panel::after { content: none; }
.shard .glint { position: absolute; inset: 0; opacity: 0; background: linear-gradient(var(--a, 120deg), transparent 40%, var(--glint), transparent 60%); }
.shard svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; stroke-linecap: round; }
.shard .lo { stroke: var(--edge-lo); stroke-width: 3; }
.shard .hi { stroke: var(--edge-hi); stroke-width: 1.3; }
.mote { position: absolute; left: 0; top: 0; width: var(--s); height: var(--s); background: var(--mote); will-change: transform, opacity; }
.flash { position: absolute; width: 240px; height: 240px; margin: -120px 0 0 -120px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(200, 222, 255, 0.35) 30%, transparent 62%); mix-blend-mode: plus-lighter; }

/* without popovers, or with reduced motion: a plain fade */
dialog.qr.plain::backdrop { background: var(--haze); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
dialog.qr.plain[open] .qr-panel { animation: pop 0.5s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

/* ---------- scenes ----------
   The same person, a different scene in each part of the page: far off under the sky at the top,
   then waving hello, standing in the wind by the poem, sitting on the list of things she made,
   eating, and saying good night. Each one is carried in by the wind as it comes into view
   (main.js adds .in), drifts a little slower than the page (--py, set from data-depth), and
   breathes. At night the pictures are dimmed and cooled to sit in the dark sky. */
.scene {
  position: relative; pointer-events: none;
  translate: 0 var(--py, 0px);
  transform-origin: 50% 100%;
  animation: breathe 7s ease-in-out infinite alternate;
}
/* The day/night tone goes on the picture, not on the breathing wrapper: browsers don't repaint
   a filter on an element whose own animation is running on the compositor. */
.scene img {
  --tone: drop-shadow(0 22px 34px rgba(52, 72, 110, 0.14));
  display: block; width: auto; max-width: 100%; height: var(--h); object-fit: contain; object-position: 50% 100%;
  user-select: none; -webkit-user-drag: none;
  opacity: 0; translate: -28px -10px; filter: var(--tone) blur(8px);
  transition: opacity 1.6s var(--ease), translate 2s var(--ease), filter 1.6s var(--ease);
  transition-delay: var(--d, 0.15s);
}
.scene.in img { opacity: 1; translate: none; filter: var(--tone) blur(0px); transition-delay: var(--d, 0.15s), var(--d, 0.15s), 0s; }
@keyframes breathe { to { scale: 1 1.006; } }
:root[data-theme="dark"] .scene img { --tone: brightness(0.8) saturate(0.86) drop-shadow(0 0 30px rgba(130, 165, 255, 0.16)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .scene img { --tone: brightness(0.8) saturate(0.86) drop-shadow(0 0 30px rgba(130, 165, 255, 0.16)); }
}

/* Safari renders a drop-shadow one way while the picture fades in and another once it settles,
   so the shadow jumps: there the pictures go without it. (font: -apple-system-body is WebKit's alone.) */
@supports (font: -apple-system-body) and (-webkit-appearance: none) {
  .scene img { --tone: brightness(1) saturate(1); }
  :root[data-theme="dark"] .scene img { --tone: brightness(0.8) saturate(0.86); }
}
@media (prefers-color-scheme: dark) {
  @supports (font: -apple-system-body) and (-webkit-appearance: none) {
    :root:not([data-theme="light"]) .scene img { --tone: brightness(0.8) saturate(0.86); }
  }
}

/* far off: standing on the horizon line, looking up at the light */
/* Beside the name, a little way off: the two make one composition about the middle. She stands on
   the hairline (.hero::before), which crosses the middle at 74% and rises 11° (tan 0.194) to the
   right; 0.21 × her height is half her width. */
.scene-hero {
  position: absolute; z-index: 0;
  --h: clamp(220px, 50vh, 560px); --gap: clamp(56px, 8vw, 170px); --d: 1.5s;
  left: calc(50% + var(--gap));
  bottom: calc(26% + (var(--gap) + var(--h) * 0.21) * 0.194 - 6px);
}
.hero-name { position: relative; z-index: 1; }
/* hello */
.hello-body { display: grid; grid-template-columns: minmax(0, 44rem) minmax(0, 1fr); align-items: end; column-gap: clamp(24px, 4vw, 56px); }
.hello-body .scene, .feed-body .scene { justify-self: center; }
.hello-text { align-self: center; }
.scene-hello { --h: clamp(320px, 58vh, 560px); margin-top: calc(-1 * clamp(60px, 12vh, 150px)); }
.scene-hello img { -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 98%); mask-image: linear-gradient(180deg, #000 70%, transparent 98%); }
/* The fade's mask would cut a drop shadow off at the picture's edges, showing a box: no shadow here. */
.scene-hello img { --tone: brightness(1) saturate(1); }
:root[data-theme="dark"] .scene-hello img { --tone: brightness(0.8) saturate(0.86); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .scene-hello img { --tone: brightness(0.8) saturate(0.86); } }
/* the poem */
.scene-poem { --h: min(82vh, 800px); --d: 0.6s; }
/* sitting on the top line of the list */
.works-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; column-gap: 16px; }
.works-top h2 { white-space: nowrap; }
.scene-works { --h: clamp(140px, 19vw, 240px); margin: 0 clamp(0px, 5vw, 72px) -3px auto; flex: none; }
/* feed */
.feed-body { display: grid; grid-template-columns: minmax(0, 40rem) minmax(0, 1fr); align-items: end; column-gap: clamp(24px, 4vw, 56px); }
.scene-feed { --h: clamp(220px, 34vh, 340px); }
/* good night */
.scene-closing { --h: clamp(220px, 36vh, 380px); margin-bottom: 8px; }

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
  .talk { grid-template-columns: 1fr; }
  .hello-body, .feed-body { grid-template-columns: 1fr; }
  .hello-body .scene, .feed-body .scene { justify-self: end; }
  .hello-text { align-self: start; }
  .scene-hello { --h: min(46vh, 400px); justify-self: end; margin-top: 28px; }
  .scene-feed { --h: 220px; justify-self: end; margin-top: 12px; }
  .poem { grid-template-columns: 1fr; row-gap: 48px; justify-items: center; }
  .scene-poem { --h: min(62vh, 560px); }
  .index a { grid-template-columns: 1fr auto; gap: 10px 16px; padding: 24px 8px; }
  .index .yr { grid-column: 1 / -1; }
  .index .nm { grid-column: 1; }
  .index .go { grid-column: 2; grid-row: 2; }
  .index .ds { grid-column: 1 / -1; }
}
@media (max-width: 360px) {
  .mk-l { font-size: 1.08rem; }
  .mk-k { font-size: 0.96rem; letter-spacing: 0.1em; }
  .langs button { min-width: 26px; padding: 0 4px; }
}
@media (max-width: 520px) {
  .hero-name { transform: translate(-2vw, -3vh); }
  .scene-hero { --h: 22vh; left: auto; right: 6px; bottom: calc(26% + (50vw - 6px - var(--h) * 0.21) * 0.194 - 6px); }
  .scene-works { --h: 104px; }
  .langs button { min-width: 30px; padding: 0 6px; }
  .links a { grid-template-columns: 5.2rem 1fr auto; }
  .links .v { font-size: 1.15rem; }
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scene { animation: none; translate: none; }
  .scene img { translate: none !important; transition: opacity 0.6s ease !important; }
  .reveal, .poem-original p, .poem-tr p, .poem-src, .tags li { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
  .kanji > span, .latin, .hero::before, .cue { animation: none; opacity: 1; filter: none; transform: none; }
  .hero-rule { animation: none; transform: none; }
  .cue i::after { animation: none; transform: translateY(75%); }
  .doodle.drawable :is(.ln, .ac) { stroke-dasharray: none; }
  .doodle.drawable :is(.fa, .fr, .fi, .bl) { opacity: 1; }
  .card:hover .doodle { animation: none; }
  .qr-haze::before { animation: none; }
  dialog.qr.plain[open] .qr-panel { animation: none; }
}

/* ---------- moving between pages ----------
   Same-origin navigations cross-fade (Chrome 126+, Safari 18.2+; elsewhere the page just loads).
   The mark stays put, and Plural's icon and name fly from the list into the Plural page. */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: 0.75s; animation-timing-function: cubic-bezier(0.2, 0.75, 0.15, 1); }
::view-transition-old(root) { animation: vt-leave 0.45s cubic-bezier(0.4, 0, 0.6, 1) both; }
::view-transition-new(root) { animation: vt-arrive 0.75s cubic-bezier(0.2, 0.75, 0.15, 1) 0.08s both; }
@keyframes vt-leave { to { opacity: 0; filter: blur(10px); transform: scale(0.985); } }
@keyframes vt-arrive { from { opacity: 0; filter: blur(10px); transform: scale(1.015); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- switching language ----------
   The text swaps inside a view transition. The page behind stays put; each section is its own layer that glides to its new
   position and height while its words dissolve (the sections and pictures are named by script just for the moment, see lang.js). */
:root.lang-vt [data-vt] { view-transition-name: none; }
:root.lang-vt::view-transition-group(*) { animation-duration: 0.8s; animation-timing-function: cubic-bezier(0.22, 0.8, 0.2, 1); }
:root.lang-vt::view-transition-old(*), :root.lang-vt::view-transition-new(*) { height: 100%; object-fit: none; object-position: 0 0; } /* a section that changes height is moved, never stretched */
:root.lang-vt::view-transition-old(*) { animation: lang-out 0.5s linear both; }   /* same length, linear, added up (plus-lighter): what is the same in both stays solid, only the words dissolve */
:root.lang-vt::view-transition-new(*) { animation: lang-in 0.5s linear both; }
/* the words of a section: the old ones go first, then the new ones arrive (pictures are their own layers, so they stay solid) */
:root.lang-vt::view-transition-old(*.sec) { animation: lang-out 0.24s ease-in both; }
:root.lang-vt::view-transition-new(*.sec) { animation: lang-in 0.46s ease-out 0.2s both; }
:root.lang-vt::view-transition-old(root), :root.lang-vt::view-transition-new(root) { animation: none; }
/* the frosted header keeps its frosting: a layer in the transition can't see through to the sections moving under it by itself */
:root.lang-vt:has(header.solid)::view-transition-group(*.bar) { -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%); }
@keyframes lang-out { to { opacity: 0; } }
@keyframes lang-in { from { opacity: 0; } }
