/* film.mywords.io — restrained black/white literary typography + ruby */
:root {
  --ink: #111;
  --paper: #fafafa;
  --muted: #444;
  --measure: 38rem;
  --body-size: 1.125rem;
  --rt-size: 0.55em;
  --line: 2.15;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
}

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

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    "Songti SC",
    "Songti TC",
    "Noto Serif CJK TC",
    "Noto Serif TC",
    "Source Han Serif TC",
    "PingFang HK",
    "PingFang TC",
    "Hiragino Sans GB",
    "Microsoft JhengHei",
    serif;
  font-size: var(--body-size);
  line-height: var(--line);
  font-weight: 400;
}

.site-header {
  text-align: center;
  padding: calc(var(--pad) * 1.75) var(--pad) calc(var(--pad) * 1.1);
  max-width: var(--measure);
  margin: 0 auto;
}

.title {
  margin: 0;
  font-size: clamp(1.65rem, 5vw, 2.15rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.35;
}

.byline {
  margin: 0.85rem 0 0;
  font-family:
    "Iowan Old Style",
    "Palatino Linotype",
    Palatino,
    "Book Antiqua",
    Georgia,
    serif;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.essay {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--pad) calc(var(--pad) * 2.5);
  text-align: left;
}

.essay p {
  margin: 0 0 1.35em;
  text-wrap: pretty;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Per-character ruby — must wrap at character boundaries */
ruby {
  ruby-position: over;
  ruby-align: center;
  display: inline-ruby;
  line-height: 1;
  /* Keep units atomic for selection while allowing line wrap between rubies */
}

rt {
  font-family:
    "Helvetica Neue",
    Helvetica,
    Arial,
    "PingFang HK",
    sans-serif;
  font-size: var(--rt-size);
  font-weight: 400;
  font-style: normal;
  line-height: 1.1;
  color: var(--muted);
  letter-spacing: 0;
  user-select: none;
  -webkit-user-select: none;
  text-transform: none;
}

/* Extra leading so rt above glyphs does not collide across lines */
@supports (ruby-position: over) {
  .essay p {
    line-height: 2.35;
  }
}

@media (max-width: 420px) {
  :root {
    --body-size: 1.05rem;
    --rt-size: 0.5em;
    --line: 2.25;
  }

  .essay p {
    line-height: 2.45;
  }
}

@media (min-width: 1280px) {
  :root {
    --body-size: 1.2rem;
    --measure: 40rem;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  rt {
    color: #333;
  }
}
