/* luobobiji.com: the notebook's paper, ink and type (studio-notebook spec, pages/studio-notebooks/page.py).
   The url(font_*) names are replaced by luobo.py's build with the hashed subset files. */
@font-face { font-family: "Luobo Serif"; src: url(/assets/fonts/font_display.ab7d5945.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Luobo Hand"; src: url(/assets/fonts/font_hand.3d13190c.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Luobo En"; src: url(/assets/fonts/font_en.7d770eff.woff2) format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: "Luobo Mono"; src: url(/assets/fonts/font_mono.b4ba9603.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --paper: #f4efe4;
  --ink: #1f1c18;
  --ink-en: #4a4239;
  --rust: #a2451f;
  --rule: #cfc5b3;
  --ochre: #e2b24a;
  --seal: #d40000;
  --shadow: 0 1px 2px rgba(31, 28, 24, .10), 0 8px 24px -10px rgba(31, 28, 24, .28);
  --serif: "Luobo Serif", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", serif;
  --text: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", serif;
  --hand: "Luobo Hand", "Kaiti SC", "STKaiti", "KaiTi", var(--text);
  --en: "Luobo En", "Newsreader", Georgia, serif;
  --mono: "Luobo Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, rgba(31, 28, 24, .13) 1px, transparent 1.4px);
  background-size: 18px 18px;
  color: var(--ink);
  font: 400 17px/1.85 var(--text);
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 max(var(--gutter), env(safe-area-inset-left)) 0 max(var(--gutter), env(safe-area-inset-right)); }

/* labels: the cards' running-head face */
.label, .mark, time, .count, .folio {
  font: 500 12px/1.4 var(--mono);
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}
.mark { color: var(--rust); }
time, .count { color: var(--ink-en); }
.draft {
  font: 700 12px/1 var(--serif);
  color: var(--ink-en);
  border: 1px dashed var(--ink-en);
  border-radius: 4px;
  padding: 3px 6px 2px;
}
.preview-bar {
  background: var(--ink);
  color: var(--paper);
  font: 400 14px/1.5 var(--hand);
  text-align: center;
  padding: 8px var(--gutter);
}

/* ---------------------------------------------------------------- home */
.masthead { text-align: center; padding-top: 48px; padding-bottom: 28px; }
.masthead .seal { width: 88px; height: 88px; margin: 0 auto 18px; opacity: .92; }
.masthead h1 { font: 700 38px/1.2 var(--serif); letter-spacing: .12em; margin: 0 0 14px; padding-left: .12em; }
.bio { font: 400 18px/1.8 var(--hand); color: var(--ink); margin: 0 auto; max-width: 30em; }
.bio span { display: block; text-wrap: balance; }
@media (max-width: 480px) { .bio { font-size: 16px; } }
.bio span:first-child { color: var(--rust); }

.shelf-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font: 700 18px/1.4 var(--serif); letter-spacing: .06em;
  margin: 28px 0 18px; padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
@media (min-width: 720px) { .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; } }
@media (min-width: 960px) { .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ep { display: flex; flex-direction: column; gap: 4px; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.ep-cover {
  display: block; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden;
  background: #e9e2d3; box-shadow: var(--shadow); margin-bottom: 10px;
  transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .25s;
}
.ep-cover img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: hover) {
  .ep:hover .ep-cover { transform: translateY(-3px) rotate(-.4deg); box-shadow: 0 2px 4px rgba(31, 28, 24, .12), 0 16px 32px -12px rgba(31, 28, 24, .35); }
}
.ep:active .ep-cover { transform: scale(.98); }
.ep:focus-visible { outline: none; }
.ep:focus-visible .ep-cover { outline: 2px solid var(--rust); outline-offset: 3px; }
.ep-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 0; }
.ep-title { font: 700 17px/1.4 var(--serif); letter-spacing: .02em; }
.ep-en { font: italic 400 14px/1.35 var(--en); color: var(--ink-en); }
.shelf.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .shelf.small { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- episode */
.bar { border-bottom: 1px solid var(--rule); background: rgba(244, 239, 228, .92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.home-link { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; text-decoration: none; font: 700 17px/1 var(--serif); letter-spacing: .1em; }
.home-link .seal { width: 32px; height: 32px; opacity: .92; }
.ep-head { padding: 28px 0 20px; }
.ep-head .ep-meta { gap: 6px 14px; margin-bottom: 8px; }
.ep-head h1 { font: 700 clamp(28px, 7.4vw, 44px)/1.25 var(--serif); letter-spacing: .03em; margin: 0; text-wrap: balance; }
.ep-head .ep-en { display: block; font-size: clamp(17px, 4.4vw, 22px); margin-top: 6px; }

/* phone: film, book, caption; desktop: film beside the caption, the book across both columns below */
.ep-grid { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "film" "book" "caption"; gap: 28px; }
.ep-grid.no-book { grid-template-areas: "film" "caption"; }
.film { grid-area: film; }
.book { grid-area: book; }
.caption { grid-area: caption; }
@media (min-width: 900px) {
  .ep-grid { grid-template-columns: 380px minmax(0, 1fr); grid-template-areas: "film caption" "book book"; column-gap: 48px; align-items: start; }
  .ep-grid.no-book { grid-template-areas: "film caption"; }
}
@media (max-width: 899px) { .caption { border-top: 1px solid var(--rule); padding-top: 28px; margin-top: 20px; } }
.film { margin: 0; }
.film video {
  width: 100%; max-width: 420px; aspect-ratio: 9 / 16; height: auto; margin: 0 auto;
  border-radius: 10px; background: #1f1c18; box-shadow: var(--shadow);
}
.film .label, .book > .label { margin: 10px 0 0; color: var(--ink-en); text-align: center; }
@media (max-width: 899px) { .film video { width: 100%; max-width: min(100%, calc(82svh * 9 / 16)); } }

.caption { max-width: 36em; }
.caption p { margin: 0 0 1em; text-align: justify; text-justify: inter-ideograph; overflow-wrap: anywhere; }
.caption p.refs { text-align: start; font-size: 14px; line-height: 1.75; color: var(--ink-en); }
.caption p:first-child::first-letter { color: var(--rust); }
@media (min-width: 900px) { .caption { padding-top: 4px; font-size: 16.5px; } }

.book { margin: 20px 0 0; padding-top: 28px; border-top: 1px solid var(--rule); }
.book > .label { margin: 0 0 18px; }
.pages { display: grid; gap: 18px; max-width: 520px; margin: 0 auto; }
.pages .page img { width: 100%; height: auto; aspect-ratio: 3 / 4; border-radius: 3px; box-shadow: var(--shadow); background: #ece5d6; }
/* once book.js has turned the list into a book */
.pages.is-book { display: block; max-width: 960px; gap: 0; }
.pages.is-book .page { background: var(--paper); }
.pages.is-book .page img { border-radius: 0; box-shadow: none; height: 100%; -webkit-user-drag: none; user-select: none; }
.pages.is-book { touch-action: pan-y pinch-zoom; overscroll-behavior-x: contain; -webkit-user-select: none; user-select: none; }
.book-bar { display: flex; align-items: center; justify-content: center; gap: clamp(8px, 3.5vw, 18px); margin-top: 16px; }
.turn svg { width: 22px; height: 22px; }
.turn.full { margin-left: 6px; }
.turn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.turn[aria-pressed="true"]:hover { background: #3a342c; }
.reader-top { display: none; }

/* the full-screen reader: the book as big as the screen allows, the bars above and below */
html.is-reading, html.is-reading body { overflow: hidden; }
.book.is-full {
  position: fixed; inset: 0; z-index: 100; margin: 0; padding: 0; border: 0;
  display: flex; flex-direction: column; overscroll-behavior: contain; touch-action: none;
  background-color: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, rgba(31, 28, 24, .13) 1px, transparent 1.4px); background-size: 18px 18px;
}
.book.is-full > .label, .book.is-full .hint, .book.is-full .turn.full { display: none; }
.book.is-full:focus { outline: none; }
.book.is-full .pages.is-book { margin: auto; touch-action: none; }
.book.is-full .pages.is-book .page img { -webkit-touch-callout: none; }
.book.is-full .reader-top {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
}
.reader-title { flex: 1; min-width: 0; margin: 0; font: 700 17px/1.3 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book.is-full .book-bar { flex: none; margin: 0; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); }
/* a phone on its side: the bars float over the book and step aside after a moment; a tap in the middle brings them back */
.book.is-full.is-short .reader-top, .book.is-full.is-short .book-bar {
  position: absolute; left: 0; right: 0; z-index: 2; background: rgba(244, 239, 228, .94);
  transition: opacity .2s ease, transform .2s ease;
}
.book.is-full.is-short .reader-top { top: 0; }
.book.is-full.is-short .book-bar { bottom: 0; }
.book.is-full.is-short.chrome-off .reader-top { opacity: 0; transform: translateY(-100%); pointer-events: none; }
.book.is-full.is-short.chrome-off .book-bar { opacity: 0; transform: translateY(100%); pointer-events: none; }
.hint.is-edge { color: var(--rust); }
.book-bar[hidden] { display: none; }
.turn {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink); font: 400 28px/1 var(--en); cursor: pointer; display: grid; place-items: center; padding: 0 0 3px;
  -webkit-tap-highlight-color: transparent; transition: background-color .15s, transform .12s;
}
.turn:hover { background: #ebe4d5; }
.turn:active { transform: scale(.94); }
.turn:disabled { opacity: .35; cursor: default; transform: none; }
.turn:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
.folio { min-width: 64px; text-align: center; color: var(--ink); font-size: 14px; }
.hint { text-align: center; color: var(--ink-en); font: 400 14px/1.5 var(--hand); margin: 8px 0 0; }

.series { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--rule); }
.series h2 { font: 700 18px/1.4 var(--serif); letter-spacing: .06em; margin: 0 0 18px; }
.back { margin: 40px 0 0; font: 700 16px/1 var(--serif); }
.back a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--rust); }

.foot { margin-top: 64px; padding: 24px 0 calc(32px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); color: var(--ink-en); font-size: 13px; line-height: 1.7; }
.foot .credit { margin: 0 0 12px; }
.foot .credit a { color: var(--ink-en); }
.sign { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 13px/1 var(--serif); letter-spacing: .08em; }
.seal-xs { width: 20px; height: 20px; opacity: .92; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
