/* ==========================================================================
   Zhongyuan Sun — personal site
   One stylesheet for every page. Colours and sizes live in the tokens below.
   ========================================================================== */

@font-face {
  font-family: "Crimson Pro";
  src: url("/assets/fonts/crimson-pro-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("/assets/fonts/crimson-pro-italic.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Crimson Pro";
  src: url("/assets/fonts/crimson-pro-bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* Only seven characters are included in this file: 孙中源, 真善美 and 影. */
@font-face {
  font-family: "Name SC";
  src: url("/assets/fonts/noto-serif-sc-name.woff?v=3") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+4E2D, U+5B59, U+6E90, U+771F, U+5584, U+7F8E, U+5F71;
}

/* ---------- Tokens ---------- */
:root {
  --paper: #f5f7f9;
  --ink: #1b2532;
  --ink-soft: #4e5a69;
  --rule: #d5dce4;
  --indigo: #2c4877; /* 藍 — links, the name column */
  --indigo-wash: #e3e9f2;
  --ochre: #8a6116; /* golden-hour accent, used only for awards */

  --serif: "Crimson Pro", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --cjk: "Name SC", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;

  --step--1: 0.85rem; /* 17px */
  --step-0: 1rem; /* 20px body */
  --step-1: 1.2rem; /* 24px */
  --step-2: 1.5rem; /* 30px */
  --step-3: 2.6rem; /* 52px */

  --margin-col: 8.5rem; /* left column: the name, section labels */
  --gap: 2.5rem;
  --measure: 34em;
  --page: 70rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1620;
    --ink: #e3e8ef;
    --ink-soft: #9ba7b6;
    --rule: #263241;
    --indigo: #9cb3dd;
    --indigo-wash: #1a2433;
    --ochre: #d6a956;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1620;
  --ink: #e3e8ef;
  --ink-soft: #9ba7b6;
  --rule: #263241;
  --indigo: #9cb3dd;
  --indigo-wash: #1a2433;
  --ochre: #d6a956;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 125%; /* 20px: Crimson Pro has a small x-height */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.6;
  font-variant-numeric: oldstyle-nums proportional-nums;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--indigo);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--indigo) 40%, transparent);
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.15s ease;
}
a:hover {
  text-decoration-color: currentColor;
}
a:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 2px;
}

em,
i,
cite {
  font-style: italic;
}

address {
  font-style: normal;
}

::selection {
  background: var(--indigo-wash);
  color: var(--ink);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.4rem 0.8rem;
  background: var(--ink);
  color: var(--paper);
  z-index: 10;
}
.skip-link:focus {
  top: 1rem;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 2.5rem);
}

/* ---------- Header ---------- */
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.6rem;
  padding-bottom: 1.6rem;
}

.site-name {
  font-size: var(--step-1);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.site-nav {
  margin-left: auto; /* stays on the right on the home page, which has no site name */
}

.site-nav ul {
  display: flex;
  gap: 1.6rem;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover {
  color: var(--ink);
}
.site-nav a[aria-current="page"] {
  color: var(--indigo);
  border-bottom-color: var(--indigo);
}

/* ---------- Page grid: margin column + main column ---------- */
main {
  padding-bottom: 4rem;
}

.band {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  column-gap: var(--gap);
  padding-top: 3.6rem;
}

.band > .label {
  font-size: var(--step-0);
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.35;
  padding-top: 0.1rem;
}

.band > .body {
  max-width: var(--measure);
}

.band .lede {
  margin-bottom: 1.4rem;
}

.note {
  color: var(--ink-soft);
  font-size: var(--step--1);
}

/* ---------- Home: introduction ---------- */
.intro {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr) 15rem;
  grid-template-areas:
    "kanji head photo"
    "kanji text photo";
  grid-template-rows: auto 1fr;
  column-gap: var(--gap);
  padding-top: 2.4rem;
}

.kanji {
  grid-area: kanji;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--cjk);
  font-weight: 600;
  font-size: 4.2rem;
  line-height: 1;
  letter-spacing: 0.12em;
  color: var(--indigo);
  justify-self: start;
  margin-top: 0.35rem;
}
.kanji span {
  display: inline-block;
}

.intro-head {
  grid-area: head;
}

.intro h1 {
  font-size: var(--step-3);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.role {
  margin-top: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.45;
}
.role span {
  display: block;
}

.intro-text {
  grid-area: text;
  max-width: var(--measure);
  margin-top: 2rem;
}
.intro-text p + p {
  margin-top: 0.9rem;
}

.intro-photo {
  grid-area: photo;
  margin-top: 0.4rem;
}
.intro-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: 2px;
  background: var(--indigo-wash);
}
.intro-photo figcaption {
  margin-top: 0.5rem;
  font-size: var(--step--1);
  font-style: italic;
  color: var(--ink-soft);
}

.links,
address {
  font-variant-numeric: lining-nums;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  margin-top: 1.6rem;
}

/* One quiet moment: the name column inks in, character by character. */
@media (prefers-reduced-motion: no-preference) {
  .kanji span {
    opacity: 0;
    animation: ink 0.9s ease-out forwards;
  }
  .kanji span:nth-child(2) {
    animation-delay: 0.25s;
  }
  .kanji span:nth-child(3) {
    animation-delay: 0.5s;
  }
  @keyframes ink {
    from {
      opacity: 0;
      filter: blur(3px);
    }
    to {
      opacity: 1;
      filter: blur(0);
    }
  }
}

/* ---------- Research streams: 真 善 美 ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.streams {
  padding-top: 3.6rem;
}

.stream {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  column-gap: var(--gap);
}
.stream + .stream {
  margin-top: 2.2rem;
}

.stream-mark {
  font-family: var(--cjk);
  font-weight: 600;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--indigo);
  padding-top: 0.2rem;
}

.stream-body {
  max-width: var(--measure);
}
.stream-body h2,
.stream-body h3 {
  font-size: var(--step-1);
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: 0.45rem;
}
.streams-full .stream + .stream {
  margin-top: 4rem;
}
.streams-full .stream-mark {
  font-size: 3.2rem;
}
.streams-full .stream-body h2 {
  font-size: var(--step-2);
}
.streams-full .stream-body .pubs {
  margin-top: 1.6rem;
}
.streams .more {
  margin-top: 1.6rem;
}

.stream-body .ideal {
  display: block;
  font-size: var(--step--1);
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 0.1rem;
}

/* ---------- News ---------- */
.news-year + .news-year {
  margin-top: 1.6rem;
}
.news-year h3 {
  font-size: var(--step-0);
  font-weight: 700;
  color: var(--indigo);
  font-variant-numeric: lining-nums;
  margin-bottom: 0.4rem;
}
.news-year li {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  column-gap: 0.6rem;
  align-items: baseline;
}
.news-year li + li {
  margin-top: 0.55rem;
}
.news-year time {
  color: var(--ink-soft);
  font-size: var(--step--1);
}

/* ---------- Publications ---------- */
.pubs > li + li {
  margin-top: 1.5rem;
}

.pub-title {
  font-size: var(--step-1);
  line-height: 1.3;
}
.pub-title a {
  color: var(--ink);
  text-decoration-color: var(--rule);
}
.pub-title a:hover {
  color: var(--indigo);
  text-decoration-color: currentColor;
}

.pub-authors,
.pub-venue,
.pub-status {
  color: var(--ink-soft);
  margin-top: 0.15rem;
  line-height: 1.45;
}
.pub-authors .me {
  color: var(--ink);
  font-weight: 700;
}

.pub-award {
  margin-top: 0.3rem;
  color: var(--ochre);
  line-height: 1.45;
}
.pub-award::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 0.12em;
}

.more {
  margin-top: 1.8rem;
}

/* ---------- Page heading (Research, CV) ---------- */
.page-head {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  column-gap: var(--gap);
  padding-top: 2.4rem;
}
.page-head > div {
  grid-column: 2;
  max-width: var(--measure);
}
.page-head h1 {
  font-size: var(--step-3);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.page-head p {
  margin-top: 1rem;
  color: var(--ink-soft);
}

/* ---------- Page mark: the large number in the margin of a stream page ---------- */
.page-mark {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--cjk);
  font-weight: 600;
  font-size: 3.2rem;
  line-height: 1;
  color: var(--indigo);
  padding-top: 0.3rem;
}

/* ---------- Theory tree (Readings page) ---------- */
.rl-tree {
  padding-top: 3rem;
}
.rl-tree-figure {
  margin-left: calc(var(--margin-col) + var(--gap));
}
.tree {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--serif);
}
.tree-family {
  font-size: 13px;
  font-style: italic;
  fill: var(--ink-soft);
  stroke: var(--paper);
  stroke-width: 6px;
  stroke-linejoin: round;
  paint-order: stroke; /* a halo so the fan lines pass behind the heading */
}
.tree a {
  text-decoration: none;
}
.tree-edge {
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.2;
  opacity: 0.55;
}
.tree-edge:hover {
  opacity: 1;
  stroke: var(--indigo);
  stroke-width: 2;
}
.tree-arrowhead {
  fill: var(--ink-soft);
}
.tree-node rect {
  fill: var(--paper);
  stroke: var(--indigo);
  stroke-width: 1.2;
}
.tree-node text {
  font-size: 14.5px;
  fill: var(--ink);
}
.tree-node .tree-count {
  font-size: 12px;
  fill: var(--ink-soft);
  font-variant-numeric: lining-nums;
}
.tree-root rect {
  fill: var(--indigo-wash);
}
.tree-node .tree-tab {
  fill: var(--indigo);
  stroke: none;
}
.tree-node .tree-num {
  font-size: 11px;
  font-weight: 700;
  fill: var(--paper);
  font-variant-numeric: lining-nums tabular-nums;
}
.tree-node:hover .tree-tab,
.tree-node:focus-visible .tree-tab {
  fill: var(--indigo);
  stroke-width: 0;
}
.tree-node:hover rect,
.tree-node:focus-visible rect {
  fill: var(--indigo-wash);
  stroke-width: 2;
}
.tree-node:focus-visible {
  outline: none;
}
.rl-tree-note,
.rl-lineage {
  margin-left: calc(var(--margin-col) + var(--gap));
  max-width: var(--measure);
}
.rl-tree-note {
  margin-top: 1rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
  line-height: 1.5;
}
.rl-lineage ul {
  margin-top: 0.6rem;
  font-size: var(--step--1);
}

/* ---------- Reading lists ---------- */
.rl-toc ol {
  columns: 2;
  column-gap: 2.5rem;
}
.rl-toc > .body {
  max-width: none; /* the list of streams uses the full width, unlike the reading lists */
}
.rl-toc li {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  column-gap: 0.4rem;
  align-items: baseline;
  break-inside: avoid;
  margin-bottom: 0.3rem;
}
.rl-no,
.rl-num {
  font-variant-numeric: lining-nums tabular-nums;
}
.rl-toc .rl-no {
  color: var(--ink-soft);
}
.rl-n {
  color: var(--ink-soft);
  font-size: var(--step--1);
  font-variant-numeric: lining-nums;
}

.rl-desc {
  color: var(--ink-soft);
}
.rl-src {
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
  line-height: 1.45;
}

.rl-list {
  margin-top: 1.2rem;
}
.rl-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.6rem;
  column-gap: 1rem;
  align-items: baseline;
  line-height: 1.45;
}
.rl-list li + li {
  margin-top: 0.55rem;
}
.rl-ref {
  padding-left: 1.4em;
  text-indent: -1.4em;
}
.rl-h {
  margin-top: 1.6rem;
  font-size: var(--step-0);
  font-weight: 700;
}
.rl-list li.core .rl-count {
  color: var(--indigo);
  font-weight: 700;
}
.rl-toc .rl-subtoc {
  grid-column: 2;
  columns: auto;
  margin: 0.2rem 0 0.4rem;
  font-size: var(--step--1);
  line-height: 1.35;
}
.rl-toc .rl-subtoc li {
  grid-template-columns: 2.3rem minmax(0, 1fr);
  column-gap: 0.2rem;
  margin: 0 0 0.2rem;
}
.rl-toc .rl-subtoc .rl-n {
  font-size: inherit;
}
.band > .label .rl-num {
  display: block;
  font-style: normal;
  font-size: var(--step-1);
  color: var(--indigo);
  line-height: 1.2;
  margin-bottom: 0.15rem;
}
.rl-h .rl-num {
  margin-right: 0.35em;
  color: var(--indigo);
}
.rl-doi {
  font-size: var(--step--1);
  overflow-wrap: anywhere;
}
.rl-h + .rl-list {
  margin-top: 0.6rem;
}

/* Search */
.rl-search-form {
  margin-top: 1.4rem;
}
.rl-search-form > label:first-child {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
}
.rl-search-row {
  display: flex;
  gap: 0.5rem;
  max-width: 30rem;
}
.rl-search-row input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: var(--step--1);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.rl-search-row input:focus {
  outline: 2px solid var(--indigo);
  outline-offset: 1px;
  border-color: var(--indigo);
}
.rl-search-row button {
  padding: 0.45rem 1rem;
  font: inherit;
  font-size: var(--step--1);
  color: var(--paper);
  background: var(--indigo);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.rl-search-row button:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}
.page-head .rl-check {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.7rem;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.rl-check input {
  accent-color: var(--indigo);
}
.rl-crumb-search {
  margin-left: 1.2rem;
}
.rl-where {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.rl-where a {
  color: var(--ink-soft);
}
.rl-ref .rl-where {
  text-indent: 0; /* under the hanging indent of the reference */
}

/* Readings by decade (stream pages, canon) */
.rl-dec {
  margin: 0;
}
.rl-dec svg {
  display: block;
  width: 100%;
  max-width: 40rem;
  height: auto;
  font-family: var(--serif);
}
.rl-dec-base {
  stroke: var(--rule);
  stroke-width: 1;
}
.rl-dec-bar {
  fill: var(--indigo);
}
.rl-dec-hit {
  fill: transparent;
}
.rl-dec g:hover .rl-dec-bar {
  fill: var(--ink);
}
.rl-dec-lab {
  font-size: 13px;
  fill: var(--ink-soft);
  font-variant-numeric: lining-nums;
}
.rl-dec-val {
  font-size: 13px;
  fill: var(--ink);
  font-variant-numeric: lining-nums;
}
.rl-dec figcaption {
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
}
.rl-decades {
  padding-top: 2.4rem;
}
.page-head p.rl-canon-link {
  margin-top: 1.2rem;
}

/* Co-assignment network */
:root {
  --f-env: #2a78d6;
  --f-inst: #eb6834;
  --f-rel: #1baf7a;
  --f-beh: #eda100;
  --f-strat: #e87ba4;
  --f-econ: #008300;
  --f-found: #6250d6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --f-env: #3987e5;
    --f-inst: #d95926;
    --f-rel: #199e70;
    --f-beh: #c98500;
    --f-strat: #d55181;
    --f-econ: #008300;
    --f-found: #9085e9;
  }
}
:root[data-theme="dark"] {
  --f-env: #3987e5;
  --f-inst: #d95926;
  --f-rel: #199e70;
  --f-beh: #c98500;
  --f-strat: #d55181;
  --f-econ: #008300;
  --f-found: #9085e9;
}
.nw-figure {
  padding-top: 2.4rem;
}
.nw {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--serif);
}
.nw-e {
  stroke: var(--ink-soft);
  stroke-width: 0.6;
  opacity: 0.18;
}
.nw-e.w3 {
  stroke-width: 1.1;
  opacity: 0.3;
}
.nw-e.w4 {
  stroke-width: 1.6;
  opacity: 0.4;
}
.nw-n {
  stroke: var(--paper);
  stroke-width: 1.2;
  cursor: pointer;
}
.f-env { fill: var(--f-env); background: var(--f-env); }
.f-inst { fill: var(--f-inst); background: var(--f-inst); }
.f-rel { fill: var(--f-rel); background: var(--f-rel); }
.f-beh { fill: var(--f-beh); background: var(--f-beh); }
.f-strat { fill: var(--f-strat); background: var(--f-strat); }
.f-econ { fill: var(--f-econ); background: var(--f-econ); }
.f-found { fill: var(--f-found); background: var(--f-found); }
.nw-n:hover,
.nw-n:focus-visible {
  stroke: var(--ink);
  stroke-width: 2;
  outline: none;
}
.nw-l {
  font-size: 11px;
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
  paint-order: stroke;
  pointer-events: none;
}
.nw.has-sel .nw-n:not(.sel):not(.nb) {
  opacity: 0.18;
}
.nw.has-sel .nw-e:not(.on) {
  opacity: 0.05;
}
.nw.has-sel .nw-e.on {
  stroke: var(--ink);
  opacity: 0.7;
  stroke-width: 1.4;
}
.nw.has-sel .nw-n.sel {
  stroke: var(--ink);
  stroke-width: 2.5;
}
.nw.has-sel .nw-l {
  opacity: 0.35;
}
.nw-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.4rem;
  margin: 0.8rem 0 0 calc(var(--margin-col) + var(--gap));
  font-size: var(--step--1);
  color: var(--ink-soft);
}
.nw-sw {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  margin-right: 0.4em;
  vertical-align: -0.02em;
}
.nw-panel {
  margin: 1.4rem 0 0 calc(var(--margin-col) + var(--gap));
  max-width: var(--measure);
  padding: 1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.nw-panel .rl-desc {
  color: var(--ink);
}
.nw-panel .rl-src {
  margin-top: 0.8rem;
}
.nw-panel .rl-list {
  margin-top: 0.5rem;
}
.nw-panel .rl-list li {
  grid-template-columns: minmax(0, 1fr);
}
.nw-table {
  margin-top: 1rem;
  border-collapse: collapse;
  font-size: var(--step--1);
  width: 100%;
}
.nw-table th,
.nw-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.35rem 0.8rem 0.35rem 0;
  border-bottom: 1px solid var(--rule);
}
.nw-table th {
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
}
.nw-table td:first-child {
  font-variant-numeric: lining-nums tabular-nums;
}

/* Writing the paper */
.rl-writing li {
  grid-template-columns: minmax(0, 1fr);
}
.rl-writing li + li {
  margin-top: 0.9rem;
}
.rl-note {
  margin-top: 0.2rem;
  padding-left: 1.4em;
  color: var(--ink-soft);
}
.rl-writing .rl-where {
  display: block;
  padding-left: 1.4em;
  margin-top: 0.1rem;
}
.rl-writing-toc li {
  display: block;
}

/* Writing the paper: the craft streams from the syllabi */
.rl-craft .body {
  max-width: var(--measure);
}
.rl-craft-list {
  margin-top: 1rem;
  columns: 1;
}
.rl-craft-list li {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  column-gap: 0.4rem;
  align-items: baseline;
  margin-bottom: 0.6rem;
}
.rl-craft-list .rl-no {
  color: var(--ink-soft);
  font-variant-numeric: lining-nums tabular-nums;
}

/* Stream pages */
.page-mark.rl-mark {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.05;
  font-variant-numeric: lining-nums;
  padding-top: 1.45rem; /* level with the h1 below the breadcrumb */
}
.page-head p.rl-crumb {
  margin: 0 0 0.6rem;
  font-size: var(--step--1);
}
.page-head p.rl-key,
.page-head p.rl-tree-line,
.page-head p.rl-src {
  margin-top: 0.6rem;
  font-size: var(--step--1);
  line-height: 1.45;
}
.rl-subindex li {
  grid-template-columns: 2.6rem minmax(0, 1fr);
}
.rl-none {
  margin-top: 0.1rem;
  color: var(--ink-soft);
  font-style: italic;
}
.rl-further {
  margin-top: 1rem;
}
.rl-further summary {
  font-size: var(--step--1);
}
.rl-further[open] summary {
  margin-bottom: 0.4rem;
}
.rl-further .rl-list {
  margin-top: 0.4rem;
}
.rl-pager .body {
  grid-column: 2;
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
}
.rl-pager .rl-next {
  margin-left: auto;
  text-align: right;
}

.rl-more {
  margin-top: 1.2rem;
}
.rl-more summary {
  cursor: pointer;
  color: var(--indigo);
  width: fit-content;
}
.rl-more summary:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
}
.rl-more[open] summary {
  margin-bottom: 0.2rem;
}

/* ---------- CV rows ---------- */
.rows > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1.6rem;
  align-items: baseline;
}
.rows > li + li {
  margin-top: 0.7rem;
}
.rows .when {
  color: var(--ink-soft);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: var(--step--1);
  white-space: nowrap;
  text-align: right;
}
.rows .sub {
  display: block;
  color: var(--ink-soft);
}

.cv-group + .cv-group {
  margin-top: 1.4rem;
}
.cv-group h3 {
  font-size: var(--step-0);
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.cites > li + li {
  margin-top: 0.8rem;
}
.cites li {
  padding-left: 1.4em;
  text-indent: -1.4em; /* hanging indent, as in a printed reference list */
}

.cites .sub {
  display: block;
  text-indent: 0;
  color: var(--ink-soft);
}
.cites a {
  font-variant-numeric: lining-nums;
  word-break: break-word;
}

.plain-list li + li {
  margin-top: 0.25rem;
}

.cv-contact {
  font-variant-numeric: lining-nums;
}

.print-only {
  display: none;
}

.nowrap {
  white-space: nowrap;
}

/* ---------- Footer ---------- */
.site-footer {
  color: var(--ink-soft);
  font-size: var(--step--1);
}
.site-footer .wrap {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  column-gap: var(--gap);
  padding-top: 2rem;
  padding-bottom: 2.4rem;
}
.site-footer p {
  grid-column: 2;
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  :root {
    --margin-col: 6rem;
    --gap: 1.8rem;
  }
  .intro {
    grid-template-columns: var(--margin-col) minmax(0, 1fr) 12rem;
  }
  .kanji {
    font-size: 3.4rem;
  }
}

@media (max-width: 760px) {
  html {
    font-size: 118.75%; /* 19px */
  }
  :root {
    --step-3: 2.1rem;
    --gap: 1.2rem;
  }
  .site-header .wrap {
    padding-top: 1rem;
    padding-bottom: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  .site-nav {
    margin-left: 0;
  }
  .site-nav ul {
    gap: 1.1rem;
  }

  .intro {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "kanji head"
      "photo photo"
      "text text";
    grid-template-rows: auto;
    padding-top: 1rem;
  }
  .kanji {
    font-size: 2.6rem;
    margin-top: 0.15rem;
  }
  .role {
    font-size: var(--step--1);
    margin-top: 0.6rem;
  }
  .intro-photo {
    margin-top: 1.6rem;
  }
  .intro-photo img {
    aspect-ratio: 960 / 858;
    object-position: 50% 50%;
  }
  .intro-text {
    margin-top: 1.4rem;
  }

  .band,
  .page-head,
  .site-footer .wrap {
    grid-template-columns: minmax(0, 1fr);
  }
  .band,
  .streams {
    padding-top: 2.6rem;
  }
  .stream {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.9rem;
    align-items: end;
  }
  .stream-body {
    display: contents;
  }
  .stream-body > :not(h2):not(h3) {
    grid-column: 1 / -1;
  }
  .stream-body > p {
    margin-top: 0.5rem;
  }
  .stream-body h2,
  .stream-body h3 {
    margin-bottom: 0;
  }
  .streams-full .stream-mark {
    font-size: 2.3rem;
  }
  .streams-full .stream-body h2 {
    font-size: var(--step-1);
  }
  .stream-mark {
    font-size: 2.3rem;
    padding-top: 0;
  }
  .band > .label {
    margin-bottom: 0.7rem;
  }
  .page-head > div,
  .site-footer p {
    grid-column: 1;
  }
  .page-head {
    padding-top: 1rem;
  }
  .page-mark {
    display: none;
  }
  .rl-toc ol {
    columns: 1;
  }
  .rl-tree:not(.nw-figure) {
    display: none; /* the tree is unreadable at phone width; the stream list below serves instead */
  }
  .nw-legend,
  .nw-panel {
    margin-left: 0;
  }
  .rows > li {
    grid-template-columns: minmax(0, 1fr);
  }
  .rows .when {
    text-align: left;
  }
}

/* ---------- Print (used for the CV PDF) ---------- */
@media print {
  @page {
    size: A4;
    margin: 18mm 18mm 20mm;
  }
  :root {
    --paper: #fff;
    --ink: #000;
    --ink-soft: #333;
    --indigo: #000;
    --ochre: #333;
    --rule: #bbb;
    --margin-col: 30mm;
    --gap: 6mm;
    --measure: none;
  }
  html {
    font-size: 10.5pt;
  }
  body {
    line-height: 1.4;
  }
  .site-header,
  .site-footer,
  .skip-link,
  .no-print {
    display: none !important;
  }
  .print-only {
    display: inline;
  }
  .screen-only {
    display: none;
  }
  .page-head {
    padding-top: 0;
  }
  .band {
    padding-top: 6mm;
    break-inside: auto;
  }
  .band > .label {
    font-style: normal;
    font-weight: 700;
    color: #000;
  }
  .rows > li,
  .cites > li {
    break-inside: avoid;
  }
  a {
    color: inherit;
    text-decoration: none;
  }
}
