:root {
  color-scheme: light dark;
  --banner: url(images/banner/01.jpg);
  --bg: #f7f5f0;
  --text: #22201c;
  --muted: #6b665d;
  --rule: #d9d4c9;
  --focus: #3465a4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1b19;
    --text: #ebe7df;
    --muted: #a59f94;
    --rule: #3a3833;
    --focus: #729fcf;
  }
  /* One-color icons are black: white on a dark background. */
  img.mono {
    filter: invert(1);
  }
}
body {
  display: grid;
  grid-template-columns: minmax(220px, 32vw) 1fr;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.0625rem;
  font-variant-numeric: lining-nums;   /* an old-style 1 looks like an ı */
  line-height: 1.5;
}
/* Han characters and kana come from the font of each language, loaded by its page. */
html:lang(zh-TW) body {
  font-family: "Newsreader", "Noto Serif TC", serif;
}
html:lang(ja) body {
  font-family: "Newsreader", "Noto Serif JP", serif;
}
/* The banner of the blog, standing on the left. */
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--banner) center / cover no-repeat #000;
}
main {
  position: relative;
  box-sizing: border-box;
  padding: 72px 56px 64px;
}
/* As wide as before; only the line under the name goes on to the right edge. */
nav,
section {
  max-width: 29rem;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover .name {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 2px;
}
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
/* The name, over a line that goes through the padding of main to the right edge. */
.masthead {
  position: relative;
  margin: 0 -56px 56px 0;   /* below it, as much room as under nav */
  padding-bottom: 24px;
  border-bottom: 1px solid var(--text);
}
/* The name: a display face, too thin for running text. */
h1 {
  margin: 0;
  font-family: "Cormorant Garamond", "Newsreader", serif;
  font-size: 3rem;
  font-weight: 600;
  line-height: 1.1;
}
.roles {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 1.15rem;
}
/* Under the right end of the line, without taking room. */
.place {
  position: absolute;
  top: 100%;
  right: 56px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
nav ul {
  display: flex;
  gap: 36px;
  margin-bottom: 56px;
}
nav a {
  display: flex;
  align-items: center;
  gap: 10px;
}
nav img {
  width: 28px;
  height: 28px;
}
nav .name {
  font-size: 1.3rem;
  font-weight: 600;
}
h2 {
  margin: 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 600;
}
section + section {
  margin-top: 44px;
}
/* The icon on the left, the name on the right with the year it started at the end, and the summary under the name. */
section a {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  column-gap: 18px;
  padding-top: 18px;
}
section img {
  grid-row: 1 / span 2;
  align-self: start;
  width: 40px;
  height: 40px;
  margin-top: 2px;
}
section .name {
  grid-column: 2;
  align-self: baseline;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}
.year {
  grid-column: 3;
  grid-row: 1;
  align-self: baseline;
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: 0.85rem;
}
.summary {
  grid-column: 2 / span 2;
  color: var(--muted);
}
/* The parts of an item, one per line, under its summary. */
.sub {
  margin: 6px 0 0 58px;
}
.sub a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
}
.sub img {
  width: 22px;
  height: 22px;
  margin: 0;
}
.sub .name {
  font-size: 1.05rem;
  font-weight: 400;
}
.note {
  margin-left: -4px;
  font-size: 0.85rem;
  color: var(--muted);
}
.sub .year {
  margin-left: auto;
}
/* Items without an icon: the name with the year at the end, then the summary. */
.plain a {
  grid-template-columns: 1fr auto;
  padding-top: 14px;
}
.plain .name {
  grid-column: 1;
}
.plain .year {
  grid-column: 2;
}
.plain .summary {
  grid-column: 1 / span 2;
}
.english-only .not-english-only {
  display: none;
}
.english-only:not(:lang(en)) body {
  visibility: hidden;
}
/* The languages of this page, at the top right. */
.languages {
  position: absolute;
  top: 28px;
  right: 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  color: var(--muted);
  font-size: 0.95rem;
}
.languages a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.languages [aria-current] {
  color: var(--text);
  font-weight: 600;
}
/* The box of tooltip.js. */
.tooltip {
  box-sizing: border-box;
  position: fixed;
  z-index: 1;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  width: max-content;
  max-width: min(24rem, calc(100vw - 16px));   /* a long text wraps, and never runs off the window */
  font-size: 0.85rem;
  pointer-events: none;
}
summary {
  width: fit-content;
  margin-top: 14px;
  color: var(--muted);
  cursor: pointer;
}
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: 2px;
}
/* Phones: the banner lies on top, a left column would leave too little room for the text. */
@media (max-width: 720px) {
  body {
    grid-template-columns: 1fr;
  }
  aside {
    position: static;
    height: 140px;
  }
  main {
    padding: 52px 16px 48px;   /* room for the languages above the name */
  }
  .masthead {
    margin: 0 -16px 40px 0;
    padding-bottom: 18px;
  }
  h1 {
    font-size: 2.4rem;
  }
  .place {
    right: 16px;
  }
  .languages {
    top: 16px;
    right: 16px;
  }
  nav ul {
    margin-bottom: 40px;
  }
}
