:root {
  --bg: #f6f4ef; --surface: #ffffff; --text: #191c1b; --muted: #5b615e; --faint: #8a908c;
  --line: #e2ded4; --accent: #146b54; --accent-2: #b4590f; --accent-soft: #e0efe8; --chip: #efece5; --code: #f1eee7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1110; --surface: #151a18; --text: #eaeeec; --muted: #9ba49f; --faint: #6b746f;
    --line: #26302c; --accent: #5cc8a5; --accent-2: #f0a35e; --accent-soft: #15302a; --chip: #1c2320; --code: #121715;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1110; --surface: #151a18; --text: #eaeeec; --muted: #9ba49f; --faint: #6b746f;
  --line: #26302c; --accent: #5cc8a5; --accent-2: #f0a35e; --accent-soft: #15302a; --chip: #1c2320; --code: #121715;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.75 Inter, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 24px; } }

nav { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
nav .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
nav a.home { font-family: Fraunces, Georgia, serif; font-weight: 650; font-size: 17px; color: var(--text); text-decoration: none; margin-right: auto; }
nav a.back { font-size: 14px; color: var(--muted); text-decoration: none; }
.icon-btn { background: var(--surface); border: 1px solid var(--line); color: var(--muted); border-radius: 9px; width: 34px; height: 34px; cursor: pointer; display: grid; place-items: center; }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent); }

header.post { padding: 56px 0 18px; }
.kicker { font: 500 12px/1 "JetBrains Mono", monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
h1 { font-family: Fraunces, Georgia, serif; font-weight: 650; font-size: clamp(32px, 6vw, 46px); line-height: 1.1; letter-spacing: -.02em; margin: 14px 0 14px; }
.dek { font-size: 19px; color: var(--muted); margin: 0 0 22px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; font-size: 14px; color: var(--muted); padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.listen { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--accent);
  background: var(--accent-soft); color: var(--accent); font: 600 14px Inter, sans-serif; cursor: pointer; margin-left: auto; }
.listen svg { width: 15px; height: 15px; }
.listen[hidden], .rate[hidden] { display: none; }
.rate { height: 36px; min-width: 52px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font: 600 13px Inter, sans-serif; cursor: pointer; font-variant-numeric: tabular-nums; }

article { padding: 10px 0 40px; }
article h2 { font-family: Fraunces, Georgia, serif; font-size: 26px; letter-spacing: -.01em; line-height: 1.25; margin: 40px 0 8px; }
article p, article li { color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
article ul, article ol { padding-left: 22px; }
article li { margin: 6px 0; }
article strong { color: var(--text); }
article code { font: 14.5px "JetBrains Mono", monospace; background: var(--code); padding: 2px 5px; border-radius: 5px; }
article pre { background: var(--code); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; overflow-x: auto; font: 13.5px/1.6 "JetBrains Mono", monospace; }
article pre code { background: none; padding: 0; font-size: inherit; }
article blockquote { margin: 24px 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
figure.diagram { margin: 28px 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
figure.diagram svg { display: block; width: 100%; min-width: 520px; height: auto; }
figure.diagram figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.d-box { fill: var(--chip); stroke: var(--line); }
.d-acc { fill: var(--accent-soft); stroke: var(--accent); }
.d-t { fill: var(--text); font: 600 13px Inter, sans-serif; }
.d-s { fill: var(--muted); font: 11px "JetBrains Mono", monospace; }
.d-l { stroke: var(--faint); stroke-width: 1.4; fill: none; }
.d-alt { stroke: var(--accent-2); stroke-dasharray: 5 4; }
.reading { background: var(--accent-soft); border-radius: 6px; outline: 6px solid var(--accent-soft); transition: background .3s; }

.more { border-top: 1px solid var(--line); padding: 28px 0 60px; }
.more h3 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.more a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 600; }
.more a span { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }
footer { border-top: 1px solid var(--line); padding: 22px 0 32px; font-size: 13px; color: var(--muted); }


/* page turn to and from the homepage (cross-document View Transitions) */
@view-transition { navigation: auto; }
h1 { view-transition-name: post-title; }
::view-transition-group(post-title) { animation-duration: .55s; animation-timing-function: cubic-bezier(.6,0,.3,1); }
html[data-mode="anime"]::view-transition-old(root) { animation: pt-out .55s cubic-bezier(.6,0,.3,1) both; transform-origin: left center; }
html[data-mode="anime"]::view-transition-new(root) { animation: pt-in .55s cubic-bezier(.6,0,.3,1) both; }
html[data-mode="anime"]:active-view-transition-type(back)::view-transition-old(root) { animation-name: pt-out-back; transform-origin: right center; }
html[data-mode="anime"]:active-view-transition-type(back)::view-transition-new(root) { animation-name: pt-in-back; }
@keyframes pt-out { to { transform: perspective(1400px) rotateY(-24deg) translateX(-10%); opacity: 0; } }
@keyframes pt-in { from { clip-path: inset(0 0 0 100%); } }
@keyframes pt-out-back { to { transform: perspective(1400px) rotateY(24deg) translateX(10%); opacity: 0; } }
@keyframes pt-in-back { from { clip-path: inset(0 100% 0 0); } }

/* anime view: the post as a manga chapter */
html:root[data-mode="anime"] {
  color-scheme: light;
  --bg: #f4efe4; --surface: #fff; --text: #141414; --muted: #55524b; --faint: #8b867b; --line: #141414;
  --accent: #c0281d; --accent-2: #1f6bff; --accent-soft: #f6dcd8; --chip: #efe8d8; --code: #efe8d8;
}
html[data-mode="anime"] body { background-image: radial-gradient(rgba(17,17,17,.09) 1px, transparent 1.4px); background-size: 7px 7px; }
html[data-mode="anime"] nav { background: #111; border-bottom: 3px solid #c0281d; backdrop-filter: none; }
html[data-mode="anime"] nav a.home { color: #f3f1ea; font-family: "Shippori Mincho B1", serif; letter-spacing: .06em; }
html[data-mode="anime"] nav a.home::before { content: "VOL.1 "; color: #c0281d; }
html[data-mode="anime"] nav a.back { color: #cfc8b8; }
html[data-mode="anime"] #theme { display: none; }
html[data-mode="anime"] .kicker { display: inline-block; background: #111; color: #f4efe4; padding: 5px 9px; }
html[data-mode="anime"] .kicker::before { content: "CHAPTER · "; color: #ff8f86; }
html[data-mode="anime"] h1, html[data-mode="anime"] article h2 { font-family: "Shippori Mincho B1", serif; font-weight: 800; }
html[data-mode="anime"] figure.diagram, html[data-mode="anime"] article pre { border-radius: 0; border: 3px solid #111; box-shadow: 6px 6px 0 #111; }
html[data-mode="anime"] .listen { border-radius: 0; background: #c0281d; color: #fff; border-color: #111; box-shadow: 3px 3px 0 #111; }
html[data-mode="anime"] .rate { border-radius: 0; border-color: #111; }
html[data-mode="anime"] footer { background: #111; color: #b9b4a8; border-top: 3px solid #c0281d; }
@media (prefers-reduced-motion: reduce) {
  html[data-mode="anime"]::view-transition-old(root), html[data-mode="anime"]::view-transition-new(root), ::view-transition-group(post-title) { animation: none !important; }
}
