/* bookshelf の画面。Ink v1.0（ink.css。2026-10-29 コピー）の上に、本棚に要る部品と寸法だけ足す。
   色・線・角丸・影は ink.css の --ink-* を使い、ここに値を直書きしない（表紙の影と完了チェックの印だけ例外）。
   ライトだけ。Web フォントは読まない（Ink の文字の並びが端末の文字に落ちる） */

html { -webkit-text-size-adjust: 100%; }
html.bs-lock { overflow: hidden; }
.ink-ui a { text-decoration: none; }

/* ページの枠（サイドバーなし。上は白い帯、下は薄いグレーの地） */
.bs { min-height: 100dvh; display: flex; flex-direction: column; }
.bs-wrap { width: 100%; max-width: 1320px; margin: 0 auto; padding-left: 36px; padding-right: 36px; }
.bs-head { background: var(--ink-surface); border-bottom: 1px solid var(--ink-line); padding-top: env(safe-area-inset-top); }
.bs-head .ink-top { margin: 0; padding-top: 18px; padding-bottom: 18px; }
.bs-head-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bs-main { flex: 1; padding-top: 20px; padding-bottom: 56px; }

/* タブ・並び順・メモあり */
.bs-toolbar { flex-wrap: wrap; margin: 0 0 14px; }
.bs-notice { margin-bottom: 14px; }
.bs-count { min-height: 0; margin: -4px 0 12px; color: var(--ink-text-2); font-size: var(--ink-fs-sm); }
.bs-count:empty { display: none; }
.bs-count .ink-link { margin-left: 4px; }

/* 本棚。表紙の枠は正方形で、中の本は「高さいっぱい・切らずに」出すので、どの本も同じ高さになる */
.bs .bs-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
.bs-card { content-visibility: auto; contain-intrinsic-size: auto 290px; -webkit-tap-highlight-color: transparent; }
.bs-card:active { background: var(--ink-hover); }
.bs .ink-card .ink-thumb { height: auto; aspect-ratio: 1 / 1; }
/* 画像は枠に貼り付けて（中身で枠が伸びないように）、余白を残して全体を出す */
.bs-thumb img { inset: 12px 10px; width: calc(100% - 20px); height: calc(100% - 24px); margin: auto;
  filter: drop-shadow(0 1px 2px rgba(16, 16, 16, 0.16)); }
.bs-thumb.is-empty { padding: 14px; text-align: center; line-height: 1.5; overflow-wrap: anywhere; }
.bs-card .ink-card-body { gap: 4px; }
.bs-card .ink-card-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.45; overflow-wrap: anywhere; }
.bs-author { overflow: hidden; color: var(--ink-text-2); font-size: var(--ink-fs-sm); white-space: nowrap; text-overflow: ellipsis; }
.bs-card-props { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; }
.bs-memo { color: var(--ink-text-3); font-size: var(--ink-fs-xs); }

.bs-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px;
  padding-top: 16px; padding-bottom: calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ink-line); color: var(--ink-text-3); font-size: var(--ink-fs-sm); }
.bs-foot a:hover { color: var(--ink-text); }

/* 詳細（右から出るパネル） */
.bs-sheet { animation: bs-fade 0.15s ease-out; }
.bs-drawer { animation: bs-slide 0.18s ease-out; }
.bs-drawer:focus { outline: none; }
.bs-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex: none;
  padding: 12px 16px; border-bottom: 1px solid var(--ink-line); }
.bs-bar .ink-btn .ink-ic { width: 15px; height: 15px; }
.bs-bar-actions { display: flex; gap: 6px; }
.bs-drawer .ink-dr-head h2 { overflow-wrap: anywhere; }
.bs-cover-lg { min-height: 0; height: 240px; margin-bottom: 14px; }
.bs-cover-lg img { max-height: 208px; filter: drop-shadow(0 1px 2px rgba(16, 16, 16, 0.16)); }
.bs-cover-lg:empty { display: none; }
.bs-facts { margin-bottom: 8px; }
.bs-facts dd a { text-decoration: underline; text-decoration-color: var(--ink-line-2); text-underline-offset: 3px; }

/* 本文（Notion のブロック） */
.bs-content { padding-top: 6px; font-size: var(--ink-fs-md); line-height: 1.8; overflow-wrap: anywhere; }
.bs-content > * { margin-top: 2px; margin-bottom: 1px; }
.bs-content p { padding: 2px 0; }
.bs-content .bs-h, .bs-toggle-h > summary { margin-top: 14px; padding: 12px 0 6px; border-top: 1px solid var(--ink-line);
  font-size: var(--ink-fs-md); font-weight: 600; line-height: 1.5; }
/* 一番上の見出しは、上のプロパティの線と重ねない */
.bs-content > .bs-h:first-child, .bs-content > .bs-toggle-h:first-child > summary { margin-top: 0; border-top: 0; }
.bs-content ul, .bs-content ol { margin: 2px 0; padding-left: 1.5em; }
.bs-content li { padding: 2px 0; }
.bs-content li::marker { color: var(--ink-text-3); }
.bs-content ul { list-style: disc; }
.bs-content ul ul { list-style: circle; }
.bs-content ul ul ul { list-style: square; }
.bs-content li > ul, .bs-content li > ol { margin-top: 2px; }
.bs-toggle { padding: 0; }
.bs-toggle > summary { display: flex; align-items: flex-start; gap: 4px; padding: 2px 4px 2px 0; border-radius: var(--ink-r-sm); cursor: pointer; list-style: none; }
.bs-toggle > summary::-webkit-details-marker { display: none; }
.bs-toggle > summary::before { content: ""; flex: none; width: 0; height: 0; margin: 0.6em 7px 0 3px; border-style: solid; border-width: 4.5px 0 4.5px 7px;
  border-color: transparent transparent transparent var(--ink-text-3); transition: transform 0.15s; }
.bs-toggle[open] > summary::before { transform: rotate(90deg); }
.bs-toggle > summary:hover { background: var(--ink-fill); }
.bs-toggle-h > summary { border-radius: 0; }
.bs-toggle-h > summary:hover { background: transparent; color: var(--ink-text-2); }
.bs-toggle-h > summary::before { margin-top: 0.55em; }
.bs-toggle > div { padding-left: 17px; }
.bs-callout { margin: 6px 0; padding: 12px 14px; border-radius: var(--ink-r-ctl); background: var(--ink-fill); white-space: pre-line; }
.bs-callout > div > :not(:first-child) { white-space: normal; }
.bs-content blockquote { margin: 6px 0; padding: 2px 0 2px 12px; border-left: 2px solid var(--ink-line-2); color: var(--ink-text-2); }
.bs-content pre { margin: 6px 0; padding: 12px 14px; overflow-x: auto; border-radius: var(--ink-r-sm); background: var(--ink-fill); font: var(--ink-fs-sm)/1.6 var(--ink-mono); }
.bs-content code { font-family: var(--ink-mono); }
.bs-content :not(pre) > code { padding: 0.15em 0.4em; border-radius: 4px; background: var(--ink-fill-2); font-size: 0.88em; }
.bs-content a { text-decoration: underline; text-decoration-color: var(--ink-line-2); text-underline-offset: 3px; }
.bs-content a:hover { text-decoration-color: var(--ink-text); }
.bs-todo { display: flex; align-items: flex-start; gap: 8px; }
.bs-check { flex: none; width: 15px; height: 15px; margin-top: 0.3em; border: 1.5px solid var(--ink-text-3); border-radius: 4px; }
.bs-check[data-done="1"] { border-color: transparent; background: var(--ink-text) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/11px no-repeat; }
.bs-check[data-done="1"] + span { color: var(--ink-text-3); text-decoration: line-through; }
.bs-muted { color: var(--ink-text-3); font-size: var(--ink-fs-base); }
.bs-loading { height: 12px; margin: 12px 0; border-radius: var(--ink-r-pill); background: var(--ink-fill); }
.bs-loading.bs-short { width: 60%; }

/* ログイン */
.bs-login { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.bs-login-title { font-size: var(--ink-fs-xl); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; margin-bottom: 4px; }
.bs-login-err { display: none; }
.bs-login-err.show { display: block; }

@keyframes bs-fade { from { opacity: 0; } }
@keyframes bs-slide { from { opacity: 0; transform: translateX(16px); } }

@media (min-width: 821px) {
  .bs-drawer { width: min(640px, calc(100vw - 24px)); }
}
@media (max-width: 820px) {
  .bs-wrap { padding-left: 16px; padding-right: 16px; }
  .bs-head .ink-top { padding-top: 14px; padding-bottom: 14px; }
  .bs-head-right { width: 100%; }
  .bs-head-right .ink-search { flex: 1; }
  .bs-main { padding-top: 14px; }
  .bs-bar { padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
  .bs .bs-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
/* スマホ: 3 列。タブは横いっぱいに並べる */
@media (max-width: 620px) {
  .bs-head .ink-title h1 { font-size: 22px; }
  .bs-toolbar { gap: 10px; }
  .bs-toolbar .ink-tabs { flex: 1 1 100%; }
  .bs-toolbar .ink-tab { flex: 1 1 auto; justify-content: center; gap: 5px; padding: 0 8px; font-size: 12.5px; }
  .bs .bs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .bs-card { padding: 4px; border-radius: var(--ink-r-ctl); contain-intrinsic-size: auto 190px; }
  .bs .ink-card .ink-thumb { border-radius: var(--ink-r-sm); }
  .bs-thumb img { inset: 8px 6px; width: calc(100% - 12px); height: calc(100% - 16px); }
  .bs-thumb.is-empty { padding: 8px; font-size: var(--ink-fs-xs); }
  .bs-card .ink-card-body { gap: 3px; padding: 6px 3px 3px; }
  .bs-card .ink-card-title { font-size: 11.5px; line-height: 1.4; }
  .bs-author { display: none; }
  .bs-card .ink-badge { height: 18px; padding: 0 6px; font-size: 10px; }
  .bs-memo { font-size: 10px; }
  .bs-cover-lg { height: 200px; }
  .bs-cover-lg img { max-height: 172px; }
}
@media (max-width: 340px) {
  .bs .bs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
