@charset "UTF-8";
/* Hyakusho - stylesheet. ASCII only on purpose (encoding-proof). */

:root {
  --sumi: #000;                          /* ink: the page */
  --sumi-2: #0e0e0d;                     /* raised surface */
  --kami: #f1ede4;                       /* paper: text */
  --kami-2: #aaa69c;                     /* secondary text */
  --kami-3: #807d76;                     /* tertiary text */
  --kei: rgba(241, 237, 228, .15);       /* hairline */
  --kei-2: rgba(241, 237, 228, .34);     /* strong hairline */
  --mincho: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Noto Serif JP", serif;
  --gothic: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic Medium", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --ease: cubic-bezier(.2, .7, .1, 1);
  --intro: 1.15s;                        /* when the title page starts to appear */
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--sumi); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--sumi);
  color: var(--kami);
  font: 500 1rem/1.9 var(--mincho);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 0; }
img { display: block; }
.row-title, .tile-title, .book-title, .readout-title, .state-title, .fb-title, .book-nav span { word-break: auto-phrase; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--kami); outline-offset: 3px; }
::selection { background: var(--kami); color: var(--sumi); }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: fixed; left: 1rem; top: 1rem; z-index: 200;
  padding: .5rem 1rem; background: var(--kami); color: var(--sumi);
  font: .875rem var(--gothic); text-decoration: none;
  transform: translateY(-300%);
}
.skip:focus { transform: none; }

/* ---------- Splash: the book icon comes toward you and opens ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--sumi); color: var(--kami);
  animation: splash-out .4s ease 1s forwards;
}
.splash svg { width: 5.5rem; height: 5.5rem; animation: splash-zoom 1.2s cubic-bezier(.6, 0, .8, .1) forwards; }
.splash path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: splash-draw .55s ease forwards; }
@keyframes splash-draw { to { stroke-dashoffset: 0; } }
@keyframes splash-zoom { 0%, 52% { transform: none; opacity: 1; } 100% { transform: scale(26); opacity: 0; } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
.is-returning .splash { display: none; }
.is-returning { --intro: 0s; }

/* ---------- Tobira: the title page ---------- */
.tobira {
  --fs: min(35svh, 20vw);                /* size of one title glyph */
  --bh: clamp(7.5rem, 23svh, 15rem);     /* height of a book on the belt */
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100svh;
  overflow: clip;
}
.bar {
  grid-column: 1; grid-row: 1;
  display: flex; align-items: center; gap: .25rem clamp(2rem, 5vw, 4.5rem); flex-wrap: wrap;
  padding: 1.125rem var(--pad) 0;
}
.bar-toc { padding: .5rem 0; font-size: .9375rem; letter-spacing: .3em; text-decoration: none; color: var(--kami-2); transition: color .25s; }
.bar-toc:hover { color: var(--kami); }

/* Links to the author's own site (the K mark) and SNS: the same set at the top and at the end of the page.
   Every icon sits in the same 44px target and is drawn to the same optical size (an 18px square). */
.links { display: flex; align-items: center; gap: 0 .375rem; margin-right: -.6875rem; }
.links a {
  position: relative;
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  color: var(--kami-2); transition: color .25s;
}
.links a:hover, .links a:focus-visible { color: var(--kami); }
.ico { display: block; width: 1.3125rem; height: 1.3125rem; }   /* 21px box: Instagram's square and X's glyph read at ~18px */
.ico-home { width: 1.5rem; height: 1.5rem; }                     /* the K frame is 77% of its box: 24px -> 18.4px */
.ico-note { width: 1.125rem; height: 1.125rem; }                 /* a solid square looks heavier: draw it 18px */
.ico-x { width: 1.25rem; height: 1.25rem; }                        /* a diagonal glyph: 20px box -> 18px wide */
/* name of the destination, shown on hover / keyboard focus */
.links a::after {
  content: attr(data-tip);
  position: absolute; left: 50%; top: calc(100% + .125rem);
  padding: .125rem .5rem;
  font: .6875rem/1.5 var(--gothic); letter-spacing: .04em; white-space: nowrap; color: var(--kami);
  background: var(--sumi); border: 1px solid var(--kei-2);
  opacity: 0; transform: translate(-50%, -.25rem); pointer-events: none;
  transition: opacity .2s, transform .25s var(--ease);
}
.links a:hover::after, .links a:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.end .links a::after { top: auto; bottom: calc(100% + .125rem); transform: translate(-50%, .25rem); }
.end .links a:hover::after, .end .links a:focus-visible::after { transform: translate(-50%, 0); }
@media (hover: none) { .links a::after { display: none; } }

.tobira-text {
  --h: max(100svh, 34rem);                       /* column height */
  --pt: clamp(1.5rem, 5svh, 3rem);               /* column top / bottom padding */
  --ten: calc(var(--h) / 2 - var(--fs) - var(--pt));  /* top of the title glyphs: the line every column starts from */
  grid-column: 2; grid-row: 1 / -1;
  writing-mode: vertical-rl;
  height: var(--h);
  padding: var(--pt) clamp(1rem, 2.2vw, 2rem) var(--pt) 0;
}
.spine-latin {
  display: flex; justify-content: space-between;
  font-size: .75rem; line-height: 1; letter-spacing: .32em; color: var(--kami-3);
  margin-left: clamp(.5rem, 1.2vw, 1.25rem);
}
.spine-title {
  font-size: var(--fs); font-weight: 500; line-height: 1; letter-spacing: .02em;
  text-align: center; white-space: nowrap;
}
.spine-title span { display: inline-block; }
.spine-sub {
  font-size: clamp(1.125rem, 2.6svh, 1.625rem); line-height: 1; letter-spacing: .42em;
  padding-top: var(--ten);
  margin: 0 clamp(1.25rem, 2.4vw, 2.5rem) 0 clamp(1.5rem, 3vw, 3rem);
}
.lede {
  padding-top: var(--ten);
  font-size: clamp(.875rem, 1.9svh, 1.0625rem); line-height: 2.3; letter-spacing: .2em;
  color: var(--kami-2);
  line-break: strict;
}
.lede .ln { display: block; }
.tcy { text-combine-upright: all; -webkit-text-combine: horizontal; letter-spacing: 0; }

.belts {
  grid-column: 1; grid-row: 2;
  align-self: center;
  display: grid; gap: clamp(.75rem, 2.4svh, 1.75rem);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 84%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 7%, #000 84%, transparent);
}
.belt {
  overflow: hidden;
  padding-top: 14px;                      /* headroom so a lifted book never touches the row above */
  border-bottom: 1px solid var(--kei);    /* the shelf the books stand on */
  cursor: grab; touch-action: pan-y;
  -webkit-user-select: none; user-select: none;
}
.belt.is-dragging { cursor: grabbing; }
.belt.is-static { overflow-x: auto; scrollbar-width: none; cursor: auto; touch-action: auto; }
.belt-track { display: flex; gap: clamp(.75rem, 1.4vw, 1.25rem); width: max-content; will-change: transform; }
.bk {
  flex: none;
  width: calc(var(--bh) * .7); height: var(--bh);
  display: flex; align-items: flex-end; justify-content: center;
  cursor: pointer;
  transition: transform .4s var(--ease), opacity .4s ease, filter .4s ease;
}
.bk img { max-width: 100%; max-height: 100%; width: auto; height: auto; -webkit-user-drag: none; pointer-events: none; }
.belts.is-filtered .bk:not(.is-match) { opacity: .14; filter: grayscale(1); }
@media (hover: hover) and (pointer: fine) {
  .belt:not(.is-dragging):hover .bk { opacity: .5; }
  .belt:not(.is-dragging) .bk:hover { opacity: 1; transform: translateY(-10px); }
  .belts.is-filtered .belt:hover .bk:not(.is-match):not(:hover) { opacity: .14; }
}

.readout {
  grid-column: 1; grid-row: 3;
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 1.25rem; align-items: baseline;
  min-height: 5.5rem;
  padding: 0 var(--pad) 1.75rem;
}
.readout-no { grid-row: 1 / 3; font-size: 2.25rem; line-height: 1.2; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.readout-no:empty { display: none; }
.readout-title { font-size: 1.0625rem; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout-author { grid-column: 2; font: .8125rem/1.6 var(--gothic); color: var(--kami-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout.is-idle .readout-title { color: var(--kami-3); font: .8125rem/1.6 var(--gothic); letter-spacing: .08em; }

/* One orchestrated entrance, right to left, the way the page is read */
@media (prefers-reduced-motion: no-preference) {
  .spine-title span { animation: rise 1.1s var(--ease) var(--intro) backwards; }
  .spine-title span + span { animation-delay: calc(var(--intro) + .12s); }
  .spine-latin { animation: fade 1s ease calc(var(--intro) + .1s) backwards; }
  .spine-sub   { animation: fade 1s ease calc(var(--intro) + .45s) backwards; }
  .lede        { animation: fade 1s ease calc(var(--intro) + .7s) backwards; }
  .bar, .readout { animation: fade 1s ease calc(var(--intro) + 1s) backwards; }
  .belts       { animation: fade 1.4s ease calc(var(--intro) + .5s) backwards; }
}
@keyframes rise { from { opacity: 0; transform: translateY(18%); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Mokuji: the contents ---------- */
.mokuji {
  max-width: 88rem; margin: 0 auto;
  padding: clamp(5rem, 12vw, 9rem) var(--pad) clamp(4rem, 8vw, 6rem);
  scroll-margin-top: 0;
}
.mokuji:focus { outline: none; }
.mokuji-head { display: flex; align-items: baseline; gap: 1.5rem; }
.mokuji h2 { font-size: clamp(2.25rem, 5vw, 3.75rem); font-weight: 500; line-height: 1.15; letter-spacing: .28em; }
.count { font: .875rem var(--gothic); color: var(--kami-2); letter-spacing: .06em; font-variant-numeric: tabular-nums; }

.tools {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap;
  margin-top: clamp(1.5rem, 4vw, 3rem);
  padding: .875rem 0;
  background: var(--sumi);
  border-bottom: 1px solid var(--kei-2);
}
.chips { display: flex; flex-wrap: wrap; gap: .125rem 1.5rem; min-width: 0; }
.chip {
  position: relative;
  padding: .375rem 0;
  font: .8125rem/1.5 var(--gothic); letter-spacing: .04em; color: var(--kami-2);
  white-space: nowrap;
  transition: color .2s;
}
.chip::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--kami); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.chip:hover { color: var(--kami); }
.chip[aria-pressed="true"] { color: var(--kami); }
.chip[aria-pressed="true"]::after { transform: none; }
.chip-n { margin-left: .375rem; font-size: .6875rem; color: var(--kami-3); font-variant-numeric: tabular-nums; }

.tools-side { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.search { display: flex; align-items: center; gap: .5rem; color: var(--kami-2); border-bottom: 1px solid var(--kei); transition: border-color .2s, color .2s; }
.search:focus-within { color: var(--kami); border-color: var(--kami-2); }
.search svg { width: 1rem; height: 1rem; flex: none; }
.search-icon { display: grid; place-items: center; cursor: text; }
.search-clear { display: grid; place-items: center; width: 2rem; height: 2rem; margin: -.25rem -.5rem -.25rem 0; color: var(--kami-2); transition: color .2s; }
.search-clear:hover { color: var(--kami); }
.search input {
  width: 11rem; padding: .375rem 0;
  font: 1rem/1.5 var(--gothic); color: var(--kami);
  background: none; border: 0; outline: 0; border-radius: 0; -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--kami-3); font-size: .8125rem; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.views { display: flex; font: .8125rem/1.5 var(--gothic); border: 1px solid var(--kei-2); }
.views button { padding: .3125rem .875rem; color: var(--kami-2); transition: color .2s, background-color .2s; }
.views button[aria-pressed="true"] { background: var(--kami); color: var(--sumi); }

.state { padding: 4rem 0; color: var(--kami-2); font: .875rem/1.9 var(--gothic); max-width: 36rem; }
.state-title { font: 500 1.25rem/1.6 var(--mincho); color: var(--kami); margin-bottom: .75rem; }
.state-list { margin: .75rem 0 0; padding: 0; list-style: none; }
.state-list li { padding: .625rem 0; border-top: 1px solid var(--kei); overflow-wrap: anywhere; }
.state-note { margin-top: .875rem; font-size: .75rem; color: var(--kami-3); }
.pick { margin-top: 1.75rem; }
.pickbtn { padding: .8125rem 1.25rem; border: 1px solid var(--kei-2); font: .875rem/1.4 var(--gothic); letter-spacing: .08em; color: var(--kami); transition: background-color .25s, color .25s, border-color .25s; }
.pickbtn:hover { background: var(--kami); color: var(--sumi); border-color: var(--kami); }
.check { padding: 2.5rem 0 1rem; max-width: 44rem; }
.textbtn { font: .8125rem/1.5 var(--gothic); color: var(--kami); padding: .375rem 0; border-bottom: 1px solid var(--kei-2); transition: border-color .2s; }
.textbtn:hover { border-color: var(--kami); }

.row {
  display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 17rem) 8.5rem; column-gap: 1.75rem; align-items: baseline;
  /* the row reaches .75rem past the text on both sides, so its focus ring never touches the text */
  width: calc(100% + 1.5rem); margin: 0 -.75rem; padding: 1.0625rem .75rem;
  text-align: left;
  transition: color .25s;
}
.list li { border-bottom: 1px solid var(--kei); transition: border-color .25s; }
.row-no { font-size: .9375rem; letter-spacing: .1em; color: var(--kami-3); font-variant-numeric: tabular-nums; transition: color .25s; }
.row:focus-visible { outline-offset: -2px; }
.row-title { font-size: clamp(1.0625rem, 1.55vw, 1.375rem); line-height: 1.55; text-wrap: pretty; line-break: strict; transition: transform .45s var(--ease); }
.row-author { font: .8125rem/1.7 var(--gothic); color: var(--kami-2); }
.row-genre { font: .75rem/1.7 var(--gothic); color: var(--kami-3); text-align: right; }
@media (hover: hover) and (pointer: fine) {
  .list:hover .row { color: var(--kami-3); }
  .list:hover .row .row-author { color: var(--kami-3); }
  .list .row:hover { color: var(--kami); }
  .list li:hover { border-color: var(--kei-2); }
  .list .row:hover .row-no { color: var(--kami); }
  .list .row:hover .row-author { color: var(--kami-2); }
  .list .row:hover .row-title { transform: translateX(.75rem); }
}

/* keep a focused row or tile clear of the sticky bar when the keyboard moves through the list */
.list li, .grid li { scroll-margin: 6rem 0 2rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr)); gap: 3rem clamp(1rem, 2.4vw, 2rem); padding-top: 2.5rem; }
.tile { display: block; width: 100%; text-align: left; }
/* Every cover in the grid is drawn at exactly the same height, whatever the proportions of the book:
   the image is pinned to the shelf line and sized by height, never by width. A cover wider than the
   3:4 cell may reach up to 6% into the gap on each side instead of being made shorter. */
.tile-cover { display: block; position: relative; aspect-ratio: 3 / 4; border-bottom: 1px solid var(--kei); transition: transform .45s var(--ease); }
.tile-cover img, .tile-cover .fb { position: absolute; left: 50%; bottom: 0; height: 100%; width: auto; transform: translateX(-50%); }
.tile-cover img { max-width: 112%; object-fit: contain; object-position: center bottom; }
.tile-no { display: block; margin-top: .75rem; font-size: .8125rem; line-height: 1.4; letter-spacing: .1em; color: var(--kami-3); font-variant-numeric: tabular-nums; }
.tile-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .875rem; line-height: 1.6; }
@media (hover: hover) and (pointer: fine) { .tile:hover .tile-cover { transform: translateY(-8px); } }

/* Typeset cover, shown when a book has no image (or the image fails to load) */
.fb {
  position: relative;
  width: 100%; height: 100%; max-height: 100%; aspect-ratio: 7 / 10;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between;
  padding: 9% 9% 8%;
  background: var(--sumi-2); border: 1px solid var(--kei-2);
  overflow: hidden; container-type: inline-size;
}
.fb-title { writing-mode: vertical-rl; flex: 1; min-height: 0; overflow: hidden; font-size: clamp(.6875rem, 9.5cqw, 1.75rem); line-height: 1.45; letter-spacing: .12em; text-align: start; }
.fb-author { align-self: flex-start; max-width: 100%; margin-top: 6%; font: clamp(.5rem, 5.4cqw, .875rem)/1.4 var(--gothic); color: var(--kami-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk .fb { width: auto; height: 100%; }

.peek {
  position: fixed; left: 0; top: 0; z-index: 20;
  width: 11.5rem; pointer-events: none;
  opacity: 0; transition: opacity .25s ease, width .3s var(--ease);
  will-change: transform;
}
.peek.is-on { opacity: 1; }
.peek img { width: 100%; height: auto; box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, .7); }

/* ---------- End of the page ---------- */
.end {
  max-width: 88rem; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 2rem;
  padding: 0 var(--pad) clamp(2rem, 5vw, 3.5rem);
}
.end-top { padding: .5rem 0; font-size: .9375rem; letter-spacing: .3em; text-decoration: none; color: var(--kami-2); transition: color .25s; }
.end-top:hover { color: var(--kami); }

/* ---------- The opened book ---------- */
.book {
  width: min(66rem, calc(100% - 2rem)); height: min(44rem, calc(100dvh - 2rem));
  max-width: none; max-height: none; margin: auto; padding: 0;
  background: var(--sumi-2); color: var(--kami);
  border: 1px solid var(--kei-2);
  overflow: hidden;
  opacity: 0; transform: translateY(1.25rem);
  transition: opacity .4s ease, transform .5s var(--ease), overlay .5s allow-discrete, display .5s allow-discrete;
}
.book[open] { opacity: 1; transform: none; }
@starting-style { .book[open] { opacity: 0; transform: translateY(1.25rem); } }
.book::backdrop { background: rgba(0, 0, 0, 0); transition: background-color .4s ease, overlay .4s allow-discrete, display .4s allow-discrete; }
.book[open]::backdrop { background: rgba(0, 0, 0, .86); }
@starting-style { .book[open]::backdrop { background: rgba(0, 0, 0, 0); } }

.book-in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-rows: minmax(0, 1fr) auto; height: 100%; }
.book-scroll { display: contents; }
.book-cover { grid-row: 1; display: flex; align-items: center; justify-content: center; padding: clamp(1.5rem, 4vw, 3.5rem); background: var(--sumi); min-height: 0; }
.book-cover img { max-width: 100%; max-height: 100%; width: auto; height: auto; box-shadow: 0 2rem 4rem rgba(0, 0, 0, .6); }
.book-cover .fb { width: auto; height: 100%; max-width: 100%; }
.book-body { grid-row: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: clamp(2rem, 4.5vw, 3.75rem) clamp(1.5rem, 4.5vw, 3.75rem) 2rem; overscroll-behavior: contain; }
.book-meta { display: flex; align-items: baseline; gap: 1.25rem; padding-right: 2.5rem; }
.book-no { font-size: 1.5rem; line-height: 1.2; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.book-genre { font: .75rem/1.6 var(--gothic); color: var(--kami-2); letter-spacing: .08em; }
.book-title { margin-top: 1.5rem; font-size: clamp(1.5rem, 2.6vw, 2.25rem); font-weight: 500; line-height: 1.45; letter-spacing: .03em; overflow-wrap: anywhere; text-wrap: balance; line-break: strict; }
.book-title:focus { outline: none; }
.book-author { margin-top: .75rem; font: .875rem/1.7 var(--gothic); color: var(--kami-2); overflow-wrap: anywhere; }
.book-review { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--kei); max-width: 34em; font-size: 1rem; line-height: 2.1; letter-spacing: .04em; white-space: pre-line; overflow-wrap: anywhere; }
.book-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; margin-top: auto; padding-top: 2.5rem; }
.book-link {
  display: inline-flex; align-items: center; gap: .875rem;
  padding: .8125rem 1.25rem; border: 1px solid var(--kei-2);
  font: .875rem/1.4 var(--gothic); letter-spacing: .08em; text-decoration: none;
  transition: background-color .25s, color .25s, border-color .25s;
}
.book-link:hover { background: var(--kami); color: var(--sumi); border-color: var(--kami); }
.book-link svg { width: 1rem; height: 1rem; flex: none; }
.book-host { font-size: .75rem; letter-spacing: .02em; opacity: .62; }
.book-nav { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--kei); }
.book-nav button { display: flex; align-items: center; gap: .75rem; min-width: 0; padding: 1rem 1.25rem; font: .8125rem/1.5 var(--gothic); color: var(--kami-2); transition: color .2s, background-color .2s; }
.book-nav button:hover { color: var(--kami); background: rgba(241, 237, 228, .05); }
.book-nav button + button { justify-content: flex-end; border-left: 1px solid var(--kei); }
.book-nav span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-nav svg { width: 1.125rem; height: 1.125rem; flex: none; }
.book-close { position: absolute; top: .75rem; right: .75rem; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; color: var(--kami-2); transition: color .2s; }
.book-close:hover { color: var(--kami); }
.book-close svg { width: 1.375rem; height: 1.375rem; }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }
::view-transition-group(cover) { animation-duration: .55s; animation-timing-function: var(--ease); }
::view-transition-old(cover), ::view-transition-new(cover) { height: 100%; width: 100%; object-fit: contain; }

.noscript { padding: 2rem var(--pad); font: .875rem/1.9 var(--gothic); color: var(--kami-2); }

/* ---------- 404 ---------- */
.lost { min-height: 100svh; display: grid; place-content: center; justify-items: start; gap: 1.5rem; padding: var(--pad); }
.lost h1 { font-size: clamp(2rem, 7vw, 4rem); font-weight: 500; line-height: 1.3; letter-spacing: .16em; }
.lost p { color: var(--kami-2); font: .875rem/1.9 var(--gothic); }
.lost a { text-decoration: none; border-bottom: 1px solid var(--kei-2); font: .875rem/1.9 var(--gothic); }

/* ---------- Stacked title page: phones, and any portrait screen ---------- */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .tobira {
    --fs: min(27vw, 17svh);
    --bh: clamp(6.5rem, 19svh, 15rem);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  .bar { padding-top: .75rem; }
  .tobira-text {
    grid-column: 1; grid-row: 2;
    height: calc(max(var(--fs) * 2.08, 15rem) + 2.5rem); min-height: 0;
    padding: 1.25rem var(--pad) 1.25rem 0;
  }
  .spine-latin { font-size: .625rem; letter-spacing: .2em; margin-left: .5rem; }
  .spine-sub { font-size: clamp(1rem, 2.5vw, 1.5rem); letter-spacing: .3em; padding-top: 0; margin: 0 clamp(1rem, 3vw, 2rem) 0 clamp(1.25rem, 3.5vw, 2.5rem); }
  .lede { padding-top: 0; font-size: clamp(.8125rem, 1.8vw, 1rem); line-height: 2.1; letter-spacing: .1em; }
  .belts { grid-row: 3; -webkit-mask-image: none; mask-image: none; padding: .5rem 0; }
  .readout { grid-row: 4; min-height: 4rem; padding-bottom: 1.25rem; }
  .readout-no { font-size: 1.5rem; }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  .mokuji h2 { letter-spacing: .2em; }
  .tools { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: .5rem; padding: .625rem 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; gap: 1.25rem; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { padding: .5rem 0; }
  .tools-side { margin-left: 0; min-width: 0; justify-content: space-between; }
  .search { flex: 1; min-width: 0; }
  .search input { width: 100%; }

  .row { grid-template-columns: 2.75rem minmax(0, 1fr); column-gap: .75rem; padding: .9375rem .75rem; }
  .row-no { font-size: .8125rem; }
  .row-author { grid-column: 2; }
  .row-genre { grid-column: 2; text-align: left; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.25rem 1rem; }
  .list li, .grid li { scroll-margin-top: 8.5rem; }

  .book { width: 100%; height: 100dvh; border: 0; }
  .book-in { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
  .book-cover { grid-row: auto; height: 38dvh; padding: 3.25rem 2rem 1.5rem; }
  .book-body { grid-row: auto; overflow: visible; padding: 1.75rem var(--pad) 1.5rem; }
  .book-scroll { display: block; grid-row: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .book-nav { grid-column: 1; padding-bottom: env(safe-area-inset-bottom); }
  .book-title { margin-top: 1rem; }
  .book-actions { padding-top: 2rem; }
  .peek { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .splash { display: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
