/* Tokens taken from the app itself (app/Furukara/Design/Theme.swift), so the site
   and the thing it describes are the same object in two places. */
:root {
  --surface: #f2ede3;
  --ink: #33302a;
  --caption: #6b5a45;
  --rule: #8a7a60;
  --surround: #d8d4cb;
  --corner: 5px;
  --measure: 34rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1a1a18;
    --ink: #e8e2d6;
    --caption: #b3a68f;
    --rule: #6b6558;
    --surround: #3a3a38;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 17px/1.6 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
        "Hiragino Mincho ProN", "Yu Mincho", serif;
  padding: 0 1.5rem 5rem;
}

/* The plates are mostly margin; so is this. */
main { max-width: var(--measure); margin: 0 auto; }

header.masthead {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 5rem 0 3rem;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-size: 2.6rem;
  letter-spacing: 0.12em;
  margin: 0;
  font-weight: 400;
}
.romaji {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--caption);
}
.standfirst {
  margin: 1.6rem 0 0;
  font-size: 1.15rem;
  color: var(--ink);
}

h2 {
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--caption);
  font-weight: 400;
  margin: 3.5rem 0 1rem;
}
h3 { font-size: 1.05rem; font-weight: 400; margin: 2rem 0 0.4rem; }
p { margin: 0 0 1rem; }
a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
small, .note { font-size: 0.85rem; color: var(--caption); }

/* A plate: chips butted together in a bar, ruled, the way the book sets them.
   Each chip carries its own numeral so a wrapped caption can never be read against
   the wrong colour. */
.plates { margin: 2.5rem 0 0; }
.plate { margin: 0 0 2rem; }
.bar {
  display: flex;
  height: 76px;
  border: 1px solid var(--rule);
  border-radius: var(--corner);
  overflow: hidden;
}
.bar span { flex: 1; position: relative; }
/* The numeral sits in a small paper tab laid on the chip, the same tab on every
   chip whatever colour is under it. Contrast is then the page's own paper-and-ink
   pair rather than a judgement about each chip's lightness, and the hairline keeps
   the tab legible as a shape on pale colours too. Lining figures, because the
   serif stack's oldstyle ones sit at four different heights. */
.n {
  position: absolute;
  top: 7px;
  left: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  /* Deliberately not the theme tokens. In dark mode --surface is near-black, and a
     near-black tab laid on 栗皮色 or 花淺葱 disappears into them. The tab is paper in
     both modes instead: light enough to read on the dark chips, and held to its edge
     on the pale ones by a hairline that is darker than any of them. */
  background: #f2ede3;
  color: #33302a;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  font-style: normal;
  font-size: 0.7rem;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}

ol.names {
  list-style: none;
  counter-reset: chip;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--caption);
}
ol.names li {
  counter-increment: chip;
  padding: 0.12rem 0 0.12rem 1.6rem;
  text-indent: -1.6rem;
}
ol.names li::before {
  content: counter(chip);
  display: inline-block;
  width: 1.6rem;
  text-indent: 0;
  font-variant-numeric: tabular-nums;
}
/* Three things sit on every caption line and each has to be readable as itself:
   the name the book prints, what that name literally says, and the English name
   Wada took from Ridgway. Script tells the first from the third; the brackets and
   the italic keep the middle one from being taken for either. */
.ja {
  color: var(--ink);
  font-size: 1.05em;   /* CJK needs the extra to match the Latin at this size */
}
.lit {
  color: var(--caption);
  font-style: italic;
}
.lit::before { content: "("; }
.lit::after  { content: ")"; }
.en { color: var(--ink); }
.en::before {
  /* Divides the Japanese side of the line from the English. Escaped, and spaced by
     margin rather than by literal spaces, so it survives a host that serves the
     stylesheet without a charset. */
  content: "\00B7";
  margin: 0 0.4em;
  color: var(--rule);
  font-style: normal;
}

ul.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.plain li { padding: 0.55rem 0; border-bottom: 1px solid var(--surround); }
ul.plain li:last-child { border-bottom: 0; }

.pill {
  display: inline-block;
  margin: 1.4rem 0 0;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: var(--corner);
  text-decoration: none;
  letter-spacing: 0.06em;
}
.pill:hover { background: var(--surround); }

blockquote {
  margin: 1.5rem 0;
  padding: 0 0 0 1.1rem;
  border-left: 2px solid var(--rule);
  color: var(--caption);
  font-style: italic;
}

footer {
  max-width: var(--measure);
  margin: 5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--caption);
}
footer a { color: var(--caption); }

@media (max-width: 480px) {
  body { padding: 0 1.1rem 4rem; }
  header.masthead { padding-top: 3.5rem; }
  .wordmark { font-size: 2.1rem; }
  .bar { height: 62px; }
}
