:root {
  /* Soft pastel palette, chosen in OKLCH (converted to sRGB hex with culori). */
  --washi: #fdfaf3;      /* paper,   oklch(0.985 0.009 80) */
  --sumi: #432c2d;       /* ink,     oklch(0.32 0.035 15): 12.3:1 on paper */
  --beni: #a2576a;       /* rose,    oklch(0.55 0.10 5): accent text and focus rings, 4.9:1 on paper */
  --sakura: #fddce7;     /* cherry blossom, oklch(0.925 0.04 355): also the 1918 milestone's --bg */
  --pink: #f9d4e1;       /* buttons, oklch(0.905 0.045 355): ink on it 9.5:1 */
  --pink-deep: #f6c5d6;  /* button hover, oklch(0.87 0.06 355) */
  --coral: #fcd1c6;      /* oklch(0.895 0.05 35) */
  /* The Donate button and scrollbar take the accent of whatever is on screen:
     sakura by default, each milestone's own (--accent) on the timeline. */
  --donate: #fd8fbb;       /* oklch(0.78 0.14 355): ink on it 6:1 */
  --donate-hover: #ec79a8; /* oklch(0.72 0.15 355) */
  --donate-ink: #401528;   /* oklch(0.27 0.07 355): 7.2:1 on --donate, 5.8:1 on hover */
  --header-ink: var(--sumi);  /* each milestone's own ink on the timeline */
  --scroll-track: var(--washi);
  --hover: #faeee4;      /* oklch(0.955 0.018 60) */
  --line: #edded3;
  /*
   * Apple-style ultra-thin material: a mostly clear sheet of paper that
   * blurs and brightens whatever is behind it. Where backdrop-filter isn't
   * supported the sheet is simply more opaque (see the @supports below).
   */
  --material: rgb(253 250 243 / 0.9);
  --material-blur: blur(24px) saturate(1.8);
  --material-edge: rgb(67 44 45 / 0.12);
  --material-hover: rgb(67 44 45 / 0.08);  /* an ink tint, like Apple's fill colors */       /* oklch(0.91 0.022 60) */
  --nav-ink: var(--sumi);
  --header-h: 72px;      /* timeline.js sets the header's real height */
  --display: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', Georgia, serif;
  /* BIZ UDPGothic is a Morisawa universal-design face: open counters, distinct shapes, built for older readers. */
  --text: 'BIZ UDPGothic', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', system-ui, sans-serif;
  /* Seigaiha (blue-sea-wave) tile, drawn in ink at low opacity. */
  --seigaiha: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='30' viewBox='0 0 60 30' fill='none' stroke='%23432c2d' stroke-width='1.2'%3E%3Cg id='w'%3E%3Ccircle cx='30' cy='30' r='28'/%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3Ccircle cx='30' cy='30' r='12'/%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3Cuse href='%23w' x='-30' y='-15'/%3E%3Cuse href='%23w' x='30' y='-15'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; scroll-padding-top: var(--header-h); font-size: 112.5%; }  /* 18px base */
html[data-size="l"] { font-size: 131.25%; }         /* 21px */
html[data-size="xl"] { font-size: 150%; }           /* 24px */

/* Bilingual copy: show only the active language. */
html[lang="ja"] [lang="en"]:not(#lang-btn),
html[lang="en"] [lang="ja"]:not(#lang-btn) { display: none !important; }

body {
  margin: 0;
  background: var(--washi);
  color: var(--sumi);
  font-family: var(--text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="ja"] body { line-break: strict; word-break: normal; overflow-wrap: anywhere; }
button { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Site header ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.45rem clamp(0.75rem, 2vw, 1.5rem);
  background: var(--material);
  -webkit-backdrop-filter: var(--material-blur);
  backdrop-filter: var(--material-blur);
  border-bottom: 1px solid var(--material-edge);
  color: var(--header-ink);
  transition: color 0.5s;
  font-size: 18px;  /* fixed, so the header stays put while the text size changes */
  line-height: 1.2;
}
.brand {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  border-radius: 8px;
}
/* The Y's black logo on washi: the brand guide allows it on a light background. */
.brand img { display: block; height: 48px; width: auto; }
.site-nav {
  display: flex;
  align-items: center;
  margin-left: auto;
}
.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-link,
.menu-btn {
  display: flex;
  align-items: center;
  gap: 0.45em;
  min-height: 48px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.nav-link:hover,
.menu-btn:hover,
.sub-btn[aria-expanded="true"] { background: var(--material-hover); }
.caret {
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-25%) rotate(45deg);
  transition: transform 0.2s;
}
.sub-btn[aria-expanded="true"] .caret { transform: translateY(15%) rotate(-135deg); }
.has-sub { position: relative; }
.sub-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;  /* About sits near the right edge */
  display: none;
  min-width: 17rem;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  border-radius: 12px;
  background: var(--material);
  -webkit-backdrop-filter: var(--material-blur);
  backdrop-filter: var(--material-blur);
  border: 1px solid var(--material-edge);
  box-shadow: 0 10px 28px rgb(67 44 45 / 0.14);
}
.has-sub.open .sub-menu,
html.no-js .has-sub:hover .sub-menu,
html.no-js .has-sub:focus-within .sub-menu { display: block; }
.sub-menu a {
  display: block;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}
.sub-menu a:hover { background: var(--material-hover); }
.menu-btn { display: none; }
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 1.1em;
  height: 2px;
  background: currentColor;
}
.menu-icon { position: relative; }
.menu-icon::before,
.menu-icon::after { content: ''; position: absolute; left: 0; }
.menu-icon::before { top: -0.35em; }
.menu-icon::after { top: 0.35em; }
.donate-btn {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 1.5rem;
  border-radius: 999px;
  background: var(--donate);
  color: var(--donate-ink);
  box-shadow: 0 3px 12px color-mix(in oklch, var(--donate) 55%, transparent);
  transition: background-color 0.5s, color 0.5s, box-shadow 0.5s;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.donate-btn:hover { background: var(--donate-hover); }
.brand:focus-visible,
.nav-link:focus-visible,
.menu-btn:focus-visible,
.sub-menu a:focus-visible,
.donate-btn:focus-visible,
.intro-link:focus-visible {
  outline: 4px solid var(--beni);
  outline-offset: 2px;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --material: rgb(253 250 243 / 0.45); }
}

/* ---------- Scrollbar ---------- */

/* A rounded thumb in the current accent color, on a track that matches the page. */
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb {
  min-height: 56px;
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--donate) padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--donate-hover); }
::-webkit-scrollbar-corner { background: var(--scroll-track); }
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-color: var(--donate) var(--scroll-track); }
}
.reduce .donate-btn { transition: none; }

/* ---------- Intro ---------- */

/*
 * Four variations, picked by html[data-home] (?home=a|b|c|d):
 *   a  Ensō: title, a sakura inside the brush circle, then the address.
 *   b  Scattered blossoms: a centred title with blossoms drifting around it.
 *   c  Split: words on the left, one large blossom on the right.
 *   d  Doorways: the words, then the twin doors and stairs of 1530 Buchanan with a blossom between them.
 * Each .bloom-seed is a sakura-pink cherry blossom. In the animated view it's
 * hidden and timeline.js cuts the same sakura out of the first milestone,
 * which is the same pink, so the blossoms bloom straight into it.
 */
html[data-home="a"] [data-for]:not([data-for~="a"]),
html[data-home="b"] [data-for]:not([data-for~="b"]),
html[data-home="c"] [data-for]:not([data-for~="c"]),
html[data-home="d"] [data-for]:not([data-for~="d"]) { display: none !important; }

.intro {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2vh;
  padding: calc(var(--header-h) + 3vh) 1rem 104px;  /* clear the header and the pager */
  text-align: center;
}
.intro::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--seigaiha) 0 0 / 60px 30px;
  opacity: 0.07;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 30vmin, #000 75vmin);
  mask-image: radial-gradient(circle at 50% 50%, transparent 30vmin, #000 75vmin);
}
.intro-copy { position: relative; z-index: 1; }
.intro-copy > * { margin: 0; }
.intro-eyebrow {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.14em;
  color: var(--beni);
}
.intro-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.25rem, min(9vmin, 8vw), 6.25rem);  /* a logo, so it ignores the text-size setting */
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-wrap: balance;
  word-break: keep-all;  /* ブキャナン stays whole; it breaks only at the <wbr> before YMCA */
  overflow-wrap: normal;
}
.intro-lede {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.2rem, 3vmin, 1.6rem);
  line-height: 1.5;
  text-wrap: balance;
}
.intro-sub {
  font-size: clamp(1rem, 2.4vmin, 1.25rem);
  font-weight: 700;
  line-height: 1.7;
  letter-spacing: 0.06em;
}
.intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}
.intro-hint {
  min-height: 3rem;
  padding: 0.5em 1.6em;
  border: 2px solid var(--sumi);
  border-radius: 999px;
  background: var(--pink);
  color: var(--sumi);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.intro-hint .arrow { display: inline-block; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }
.intro-hint:hover { background: var(--pink-deep); }
.reduce .intro-hint .arrow { animation: none; }
.intro-link {
  color: inherit;
  font-weight: 700;
  text-underline-offset: 0.25em;
  text-decoration-thickness: 2px;
}
.intro-link:hover { color: var(--beni); }

.intro-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 96px;
  width: 100%;
  container-type: size;
  display: grid;
  place-items: center;
}
.intro-art {
  position: relative;
  width: min(56vmin, 100cqh, 100cqw);
  aspect-ratio: 1;
}
.intro-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--sumi);
  stroke-linecap: round;
}
.bloom-seed { fill: var(--sakura); overflow: visible; }
.seed-main { position: absolute; inset: 19.6%; width: 60.8%; height: 60.8%; }
.intro-kanji {
  position: absolute;
  top: 50%;
  right: 100%;
  margin: 0 0.5em 0 0;
  font-family: var(--display);
  font-weight: 700;
  /* Four characters at 1.3em each: never taller than the stage beside it. */
  font-size: min(clamp(1.1rem, 3.6vmin, 2rem), 100cqh / 5.4);
  letter-spacing: 0.3em;
  line-height: 1;
  color: var(--beni);
  writing-mode: vertical-rl;
  translate: 0 -50%;
  white-space: nowrap;
}

/* a: title / ensō / words, one centred column. */
[data-home="a"] .intro-copy { display: contents; }
[data-home="a"] .intro-title { order: 1; }
[data-home="a"] .intro-stage { order: 2; }
[data-home="a"] .intro-lede { order: 3; }
[data-home="a"] .intro-sub { order: 4; }
[data-home="a"] .intro-actions { order: 5; }

/* b: centred words, blossoms scattered around them. */
[data-home="b"] .intro-stage { display: none; }
[data-home="b"] .intro-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  max-width: 44rem;
  margin-block: auto;
}
[data-home="b"] .intro-title { font-size: clamp(2.5rem, min(11vmin, 9vw), 7.5rem); }
.intro-scatter {
  position: absolute;
  inset: var(--header-h) 0 0;
  pointer-events: none;
}
.intro-scatter .bloom-seed {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  translate: -50% -50%;
}
html:not(.js) .intro-scatter .bloom-seed { rotate: calc(var(--r, 0) * 1deg); }

/* c: words on the left, one large blossom on the right. */
[data-home="c"] .intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  column-gap: 4vw;
  padding-inline: max(1rem, 8vw) max(1rem, 5vw);
  text-align: left;
}
[data-home="c"] .intro-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.1rem;
  max-width: 36rem;
}
[data-home="c"] .intro-lede {
  font-family: var(--text);
  font-weight: 400;
  font-size: 1.15rem;
  line-height: 1.7;
  text-wrap: pretty;
}
[data-home="c"] .intro-stage { align-self: stretch; height: 100%; }
[data-home="c"] .seed-main { inset: 0; width: 100%; height: 100%; }
[data-home="c"] .intro-art { width: min(44vw, 92cqh, 88cqw); }
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  [data-home="c"] .intro {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(96px, 1fr);
    row-gap: 3vh;
  }
  [data-home="c"] .intro-art { width: min(56vmin, 100cqh, 100cqw); }
}

/* d: words on top, the twin doorways of 1530 Buchanan below, the main blossom opening between them. */
[data-home="d"] .intro-copy { display: contents; }
[data-home="d"] .intro-eyebrow { order: 0; }
[data-home="d"] .intro-stage { order: 1; }
[data-home="d"] .intro-lede { order: 2; }
[data-home="d"] .intro-sub { order: 3; }
[data-home="d"] .intro-actions { order: 4; }
/* The title is drawn on an arc over the blossom (.intro-arch); the <h1> stays for screen readers. */
[data-home="d"] .intro-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[data-home="d"] .intro-stage { place-items: end center; }
/* The drawing is 2926 × 1254. */
[data-home="d"] .intro-art { width: min(100cqw, 100cqh * 2.333, 80rem); aspect-ratio: 2926 / 1254; }
.intro-doors { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro-arch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--d-red);
  font-family: var(--d-zuume);
  font-weight: 700;
  font-size: 190px;  /* in the drawing's units, so it scales with the doors; about 130° of the circle */
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.intro-arch [lang="ja"] { font-size: 140px; letter-spacing: 0; }  /* Japanese falls back to Shippori Mincho, which is wider */
/* If this moves, move the title circle in index.html (#title-arc) with it. */
[data-home="d"] .seed-main { inset: auto; left: 50%; top: 45%; width: 24%; height: auto; aspect-ratio: 1; translate: -50% -50%; }
.seed-dot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: auto;
  aspect-ratio: 1;
  translate: -50% -50%;
}
html:not(.js) .seed-dot { rotate: calc(var(--r, 0) * 1deg); }

/*
 * d's own palette and type (from its brand board): olive, mustard, terracotta, red on cream,
 * set in Zuume and Garamond. Text uses darker inks in the same hues (checked with culori):
 * every one is at least 7:1 on cream except the red title, which is display size (4.1:1).
 */
html[data-home="d"] {
  --d-olive: #79892b;
  --d-mustard: #f6ad2d;
  --d-terracotta: #d65036;
  --d-red: #d90716;
  --d-cream: #f2dfce;
  --d-coral: #fab8a9;      /* the blossoms: oklch(0.84 0.08 33), a tint of the terracotta; also 1918's --bg here */
  --d-ink: #551306;        /* oklch(0.30 0.10 33): words, 10.9:1 on cream, 7.4:1 on mustard */
  --d-olive-ink: #444d14;  /* oklch(0.40 0.08 118.5): the eyebrow, 7:1 on cream */
  --d-zuume: 'zuume', 'Shippori Mincho', sans-serif;  /* Adobe Fonts kit wtg3cer: 300, 400, 700, 900 */
  --d-garamond: 'EB Garamond', 'Garamond', 'Shippori Mincho', Georgia, serif;
  --sakura: var(--d-coral);
  --pink: #f9d8ab;       /* oklch(0.90 0.07 75.7), a mustard tint: pressed and pager buttons, 9.4:1 with ink */
  --pink-deep: #f7c885;  /* oklch(0.86 0.10 75.7) */
  --washi: var(--d-cream);
  --scroll-track: var(--d-cream);
  --donate: var(--d-mustard);
  --donate-hover: #e29b00;  /* oklch(0.74 0.16 75.7) */
  --donate-ink: var(--d-ink);
}
html[data-home="d"] body { background: var(--d-cream); }
[data-home="d"] .intro { color: var(--d-ink); }
[data-home="d"] .intro-eyebrow {
  font-family: var(--d-zuume);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--d-olive-ink);
}
[data-home="d"] .intro-lede {
  font-family: var(--d-garamond);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(1.35rem, 3.4vmin, 1.9rem);
}
[data-home="d"] .intro-sub {
  font-family: var(--d-garamond);
  font-weight: 400;
  font-size: clamp(1.1rem, 2.6vmin, 1.35rem);
  letter-spacing: 0.03em;
}
[data-home="d"] .intro-hint,
[data-home="d"] .pager.at-intro #next {
  border-color: var(--d-ink);
  background: var(--d-mustard);
  color: var(--d-ink);
  font-family: var(--d-zuume);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
[data-home="d"] .intro-hint:hover,
[data-home="d"] .pager.at-intro #next:hover { background: #e29b00; }

/* ---------- Milestones ---------- */

/*
 * Three stops: a lighter shade, the year's color in the middle, a deeper shade.
 * In the animated view the gradient drifts slowly: its angle turns, the middle
 * color slides along it, and the outer shades lean toward each other and back.
 * Every color stays between --bg-1 and --bg-3, so the ink contrast never drops.
 */
@property --g-angle { syntax: '<angle>'; inherits: false; initial-value: 160deg; }
@property --g-mid { syntax: '<percentage>'; inherits: false; initial-value: 50%; }
@property --g-mix { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
.m {
  background: var(--bg);
  background: linear-gradient(160deg, var(--bg-1, var(--bg)), var(--bg) 50%, var(--bg-3, var(--bg)));
  background: linear-gradient(var(--g-angle),
    color-mix(in oklch, var(--bg-1, var(--bg)), var(--bg-3, var(--bg)) var(--g-mix)),
    var(--bg) var(--g-mid),
    color-mix(in oklch, var(--bg-3, var(--bg)), var(--bg-1, var(--bg)) var(--g-mix)));
  color: var(--ink);
}
.m-inner {
  height: 100%;
  padding-block: calc(var(--header-h) + 1rem) 104px;  /* clear the header and the pager */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.m-year {
  position: relative;
  z-index: 1;
  display: flex;
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: min(26vmin, 20vw, 20rem);
  line-height: 1;
  letter-spacing: 0.02em;
}
.m-kanji {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: max(4vw, 12px);
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.4rem, 5vmin, 3rem);
  letter-spacing: 0.25em;
  writing-mode: vertical-rl;
  transform: translateY(-50%);
}
/* Hanko-style seal under the kanji. */
.m-kanji::after {
  content: '';
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-inline-start: 0.5em;
  border: 0.12em solid currentColor;
  border-radius: 0.12em;
  opacity: 0.8;
}
.m-year .d { display: inline-block; }
.m-caption {
  position: relative;
  z-index: 1;
  max-width: 32rem;
  margin-top: 2vmin;
  padding-inline: 1rem;
}
.m-eyebrow {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.m-title {
  margin: 0.3em 0 0.35em;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.75rem, 4.6vmin, 2.6rem);
  line-height: 1.35;
}
.m-text {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.9;
  text-wrap: pretty;
}
html[lang="en"] .m-text { line-height: 1.6; }
.m-more { margin: 0.7rem 0 0; font-size: 1rem; font-weight: 700; }
.m-more a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
.m-more a:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; border-radius: 4px; }
html[lang="en"] .m-title { line-height: 1.2; }
/* Archive photo, mounted like a print. */
.m-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.m-photo {
  position: relative;
  z-index: 1;
  margin: 0 0 2vmin;
  max-width: min(84vw, 36rem);
}
.m-photo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 30vh;
  margin: 0 auto;
  border: 6px solid #fff;
  box-shadow: 0 6px 24px rgb(62 39 40 / 0.2);
}
.m-figcap {
  max-width: 30rem;
  margin: 0.6rem auto 0;
  font-size: 0.9rem;
  line-height: 1.5;
}
.tight .m-figcap,
.tighter .m-photo { display: none; }
.measuring .m-inner,
.measuring .m-inner * { transform: none !important; translate: none !important; scale: none !important; animation: none !important; }
.measuring .m-shapes { display: none; }

/* Side by side when there is width to spare: photo left, words right. */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .m-inner {
    flex-direction: row;
    gap: 5vw;
    padding-inline: 11vw 9vw;
  }
  .m-photo {
    flex: 0 1 44%;
    max-width: 44%;
    margin: 0;
  }
  .m-photo img { max-height: 58vh; }
  .m-body {
    flex: 1 1 0;
    align-items: flex-start;
    text-align: left;
  }
  .m-year { font-size: min(18vmin, 10vw, 15rem); }
  .m-caption { padding-inline: 0; }
  .m-figcap { margin-inline: 0; }
}

/* At the largest text setting, give the words room by shrinking the big year. */
html[data-size="xl"] .m-year { font-size: min(20vmin, 17vw, 15rem); }
.m-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.m-shapes svg {
  position: absolute;
  overflow: visible;
  fill: currentColor;
  stroke: currentColor;
}
/*
 * The motifs float up forever: each rises from just below the stage to just
 * above it and starts again, at the same slow speed. The negative delay starts
 * each one part-way, at its own slot. This runs on the translate property, so
 * timeline.js can still move them with transform as a milestone assembles.
 */
.js:not(.reduce) .m-shapes svg {
  --rise: 60s;
  animation: m-rise var(--rise) linear infinite;
  animation-delay: calc(var(--lift, 0) * var(--rise) * -1);
}
@keyframes m-rise {
  from { translate: 0 calc((100 - var(--y, 50)) * 1vh + var(--s, 12) * 1vmin); }
  to { translate: 0 calc(var(--y, 50) * -1vh - var(--s, 12) * 1vmin); }
}

html.js:not(.reduce) .m {
  animation: m-drift 24s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -5s);  /* each year starts at a different point */
}
@keyframes m-drift {
  0%, 100% { --g-angle: 160deg; --g-mid: 50%; --g-mix: 0%; }
  25% { --g-angle: 215deg; --g-mid: 38%; --g-mix: 25%; }
  50% { --g-angle: 250deg; --g-mid: 58%; --g-mix: 40%; }
  75% { --g-angle: 120deg; --g-mid: 64%; --g-mix: 15%; }
}
@media (prefers-reduced-motion: reduce) {
  .m { animation: none !important; }
}

/* ---------- Scroll-driven mode ---------- */

.js .stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.js .intro {
  position: absolute;
  inset: 0;
  min-height: 0;
}
/* The paper's wave pattern lies under the blossoms, not over them. */
.js .intro::before { display: none; }
.js .stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--seigaiha) 0 0 / 60px 30px;
  opacity: 0.07;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 30vmin, #000 75vmin);
  mask-image: radial-gradient(circle at 50% 50%, transparent 30vmin, #000 75vmin);
}
.js .bloom-seed { visibility: hidden; }  /* cut out of the first milestone instead */
.js[data-home="a"] .intro-actions,
.js[data-home="b"] .intro-actions,
.js[data-home="d"] .intro-actions { display: none; }  /* the pager's "Begin" button takes their place */
.js .m {
  position: absolute;
  inset: 0;
  visibility: hidden;
  will-change: clip-path;
}
.js .m-year .d,
.js .m-shapes svg,
.js .m-caption,
.js .m-photo,
.js .m-inner {
  will-change: transform, opacity;
}
.js .m-caption,
.js .m-photo,
.js .m-kanji { opacity: 0; }
.track {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  overflow: clip;  /* markers never lengthen the page */
}

/*
 * Caption, photo and kanji fades as CSS scroll-driven animations.
 * timeline.js adds .css-fades when view() timelines are supported, puts one marker
 * per milestone in the track (view-timeline --m0, --m1, …) and sets --tl on its
 * section. A marker's cover range spans local progress p = -0.5 → 1, so a keyframe
 * at p sits at (p + 0.5) / 1.5. Timings match the JS fallback in render():
 *   photo in   p -0.20 → 0     20%     → 33.333%
 *   words in   p -0.10 → 0.08  26.667% → 38.667%
 *   all out    p  0.60 → 0.72  73.333% → 81.333%  (not the last milestone)
 */
.m-tl {
  position: absolute;
  left: 0;
  width: 1px;
}
.css-fades .m-caption { animation: m-caption linear both; }
.css-fades .m-kanji { animation: m-kanji linear both; }
.css-fades .m-photo {
  animation: m-photo linear both, m-photo-scale cubic-bezier(0.33, 1, 0.68, 1) both;
}
.css-fades .m:last-of-type .m-caption { animation-name: m-caption-last; }
.css-fades .m:last-of-type .m-kanji { animation-name: m-kanji-last; }
.css-fades .m:last-of-type .m-photo { animation-name: m-photo-last, m-photo-scale; }
.css-fades .m-caption,
.css-fades .m-kanji,
.css-fades .m-photo {
  animation-timeline: var(--tl);
  animation-range: cover 0% cover 100%;
}
.css-fades .m-photo { animation-range: cover 0% cover 100%, cover 20% cover 33.333%; }

@keyframes m-caption {
  0%, 26.667% { opacity: 0; translate: 0 3vmin; }
  38.667%, 73.333% { opacity: 1; translate: 0 0; }
  81.333%, 100% { opacity: 0; translate: 0 -2vmin; }
}
@keyframes m-caption-last {
  0%, 26.667% { opacity: 0; translate: 0 3vmin; }
  38.667%, 100% { opacity: 1; translate: 0 0; }
}
@keyframes m-kanji {
  0%, 26.667% { opacity: 0; translate: 0 -6vmin; }
  38.667%, 73.333% { opacity: 1; translate: 0 0; }
  81.333%, 100% { opacity: 0; translate: 0 3vmin; }
}
@keyframes m-kanji-last {
  0%, 26.667% { opacity: 0; translate: 0 -6vmin; }
  38.667%, 100% { opacity: 1; translate: 0 0; }
}
@keyframes m-photo {
  0%, 20% { opacity: 0; translate: 0 4vmin; }
  33.333%, 73.333% { opacity: 1; translate: 0 0; }
  81.333%, 100% { opacity: 0; translate: 0 -2vmin; }
}
@keyframes m-photo-last {
  0%, 20% { opacity: 0; translate: 0 4vmin; }
  33.333%, 100% { opacity: 1; translate: 0 0; }
}
@keyframes m-photo-scale {
  from { scale: 0.96; }
  to { scale: 1; }
}

/* ---------- Settings bar (in the header) ---------- */

.tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
  font-size: 16px;  /* fixed, so the controls stay put while the text size changes */
  line-height: 1.2;
}
.tool-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
/* When the header can't fit everything on one line, the settings get their own. */
@media (max-width: 1560px) {
  .tools { flex-basis: 100%; padding: 0.35rem 0 0; border-left: 0; border-top: 2px solid var(--line); }
}
.tool-label {
  padding-inline: 0.5rem 0.25rem;
  font-weight: 700;
}
.tool-btn {
  min-width: 48px;
  min-height: 44px;
  padding: 0 0.8rem;
  border: 2px solid currentColor;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.35);
  color: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tool-btn:hover { background: var(--material-hover); }
.tool-btn[aria-pressed="true"] { background: var(--pink); }
.tool-btn[data-size="l"] { font-size: 1.15em; }
.tool-btn[data-size="xl"] { font-size: 1.3em; }
.tool-btn:focus-visible,
.pager-btn:focus-visible,
.intro-hint:focus-visible {
  outline: 4px solid var(--beni);
  outline-offset: 2px;
}

/* ---------- Sound hint ---------- */

/* Shown once if a bloom plays silently because the browser hasn't been
   given a click or key press yet. */
.sound-hint {
  position: fixed;
  left: 50%;
  bottom: 6.2rem;
  z-index: 1100;
  margin: 0;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: var(--material);
  -webkit-backdrop-filter: var(--material-blur);
  backdrop-filter: var(--material-blur);
  border: 1px solid var(--material-edge);
  color: var(--sumi);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 0.5rem);
  transition: opacity 0.4s, transform 0.4s;
}
.sound-hint.show { opacity: 1; transform: translate(-50%, 0); }
html:not(.js) .sound-hint { display: none; }

/* ---------- Pager ---------- */

.pager {
  position: fixed;
  bottom: 0.75rem;
  left: 50%;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem;
  border-radius: 16px;
  background: var(--washi);
  color: var(--sumi);
  box-shadow: 0 4px 18px rgb(0 0 0 / 0.3);
  transform: translateX(-50%);
  font-size: 18px;
  line-height: 1.2;
}
.pager-btn {
  min-width: 6.5rem;
  min-height: 52px;
  padding: 0 1rem;
  border: 2px solid var(--sumi);
  border-radius: 12px;
  background: var(--pink);
  color: var(--sumi);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.pager-btn:hover:not(:disabled) { background: var(--pink-deep); }
.pager-btn:disabled { background: transparent; color: #806c69; border-color: #ddcdc7; cursor: default; }
.pager .when-intro,
.pager.at-intro .when-step { display: none; }
.pager.at-intro .when-intro { display: inline; }
.pager.at-intro #next { background: var(--coral); }
.pager.at-intro #prev { display: none; }  /* nothing to go back to yet */
.pager-now {
  min-width: 7.5rem;
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35em;
  white-space: nowrap;
}
.pager-now small {
  display: block;
  font-family: var(--text);
  font-weight: 700;
  font-size: 0.7em;
  white-space: nowrap;
}
.pager-now .count { display: block; font-size: 0.85em; }

/* ---------- Dots ---------- */

.dots {
  position: fixed;
  top: 50%;
  right: clamp(6px, 2vw, 24px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateY(-50%);
  color: var(--nav-ink);
  opacity: 0;
  transition: color 0.3s;
}
.dot {
  position: relative;
  width: 44px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transition: transform 0.2s, background-color 0.2s;
}
.dot-home::before { display: none; }
/* Drawn at the rings' stroke weight, larger than them so the house stands
   out as the way home. */
.dot-home svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin: -11.5px 0 0 -11.5px;  /* optical centring: the roof peak reads high, the rings sit half a pixel right */  /* centred optically on the rings (the roof peak reads high; the rings render half a pixel right) */
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;  /* about 2px at this size, like the rings */
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s;
}
.dot-home:hover svg,
.dot-home:focus-visible svg { transform: scale(1.15); }
.dot-home .dot-year { background: var(--washi); color: var(--sumi); }
.dot:hover::before,
.dot:focus-visible::before { transform: scale(1.3); }
.dot[aria-current]::before {
  background: currentColor;
  transform: scale(1.3);
}
.dot:focus-visible { outline: 3px solid currentColor; outline-offset: -3px; border-radius: 8px; }
.dot-year {
  position: absolute;
  top: 50%;
  right: 48px;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 18px rgb(0 0 0 / 0.25);
  opacity: 0;
  transform: translate(8px, -50%);
  transition: opacity 0.2s, transform 0.2s;
}
.dot-year small { font-family: var(--text); font-weight: 700; font-size: 0.8em; margin-left: 0.4em; }
.dot:hover .dot-year,
.dot:focus-visible .dot-year { opacity: 1; transform: translate(0, -50%); }

@media (max-width: 720px) {
  .dots { display: none; }
  .m-kanji { top: 5rem; transform: none; font-size: 1.2rem; }
  .tool-label { display: none; }
  .tools { justify-content: center; }
  .m-inner { padding-block: calc(var(--header-h) + 0.75rem) 96px; }
  .brand img { height: 40px; }
  .site-nav { order: 2; margin-left: 0; }
  .donate-btn { order: 1; margin-left: auto; padding: 0 1rem; }
  .tools { order: 3; }
  .menu-btn { display: flex; }
  html:not(.no-js) .nav-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
    background: var(--material);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    border-bottom: 1px solid var(--material-edge);
    box-shadow: 0 10px 20px rgb(67 44 45 / 0.12);
  }
  html:not(.no-js) .site-nav.open .nav-list { display: flex; }
  .sub-menu { position: static; box-shadow: none; padding: 0 0 0 1rem; }
  .intro-scatter .bloom-seed:nth-child(n+7) { display: none; }
  .js .m-kanji { display: none; }  /* no room beside the text on a phone */
  html[data-size="l"] .m-year { font-size: 18vmin; }
  html[data-size="xl"] .m-year { font-size: 15vmin; }
  .pager { width: calc(100% - 1rem); justify-content: space-between; gap: 0.25rem; }
  .pager-btn { min-width: 0; flex: 0 0 auto; padding: 0 0.7rem; }
  .pager-now { min-width: 0; font-size: 1.2em; }
}
@media (max-width: 720px) {
  html:not(.js) .site-header { position: absolute; }  /* the header scrolls away on a phone */
}

/* ---------- Static / simple view (no JS, reduced motion, or chosen) ---------- */

html:not(.js) .m {
  min-height: 100vh;
  min-height: 100svh;
  padding: 2rem 0;
}
html:not(.js) .m-inner { padding-block: 3rem; }
html:not(.js) .m-photo img { max-height: 70vh; }
html:not(.js) .m-kanji { position: static; transform: none; margin-bottom: 1rem; }
/* The intro becomes a simple stacked page: nothing can overlap at any text size. */
html:not(.js) .intro { justify-content: center; padding-bottom: 3rem; }
html:not(.js) .intro-stage { flex: none; height: min(56vmin, 22rem); }
html:not(.js)[data-home="c"] .intro-stage { height: min(44vmin, 26rem); }
html:not(.js)[data-home="d"] .intro-stage { height: min(40vw, 26rem); }
html:not(.js) .dots,
html:not(.js) .pager,
html:not(.js) .track { display: none; }
html.no-js .tools,
html.no-js .menu-btn,
html.no-js .intro-hint { display: none; }
