/* 书籍频道统一外壳 · A 方案「编辑部书脊轨道」
   首页与详情页共用。只调整 chrome 与阅读轴，不覆盖单本书的内容组件。 */

body.lys-books-index,
body.lys-books-unified{
  overflow-x:hidden;
}

body.lys-books-index ::selection,
body.lys-books-unified ::selection{
  color:var(--bg-card);
  background:var(--accent);
}

/* ─────────────── 书库首页 ─────────────── */
body.lys-books-index .cat-wrap{
  display:grid;
  grid-template-columns:minmax(260px,292px) minmax(0,1fr);
  width:100%;
  max-width:none;
  min-height:calc(100vh - 56px);
  margin:0;
  padding:0;
}

body.lys-books-index .cat-hero{
  position:sticky;
  top:56px;
  align-self:start;
  height:calc(100vh - 56px);
  overflow:auto;
  margin:0;
  padding:clamp(34px,4vw,52px) 28px 32px;
  border:0;
  border-right:1px solid var(--border);
  background:color-mix(in srgb,var(--bg-secondary) 88%,transparent);
}

body.lys-books-index .cat-kicker{
  display:flex;
  align-items:center;
  gap:10px;
  margin:0 0 16px;
  color:var(--accent);
  font:700 12px/1 var(--serif);
  letter-spacing:.22em;
  text-transform:uppercase;
}

body.lys-books-index .cat-kicker::before{
  content:"";
  width:28px;
  height:4px;
  flex:none;
  border-radius:2px;
  background:var(--accent);
}

body.lys-books-index .cat-title{
  max-width:4em;
  margin:0 0 18px;
  color:var(--text-primary);
  font:700 clamp(42px,4.4vw,62px)/1.02 var(--serif);
  letter-spacing:-.05em;
}

body.lys-books-index .cat-lede{
  max-width:28em;
  margin:0 0 24px;
  color:var(--text-secondary);
  font-size:14px;
  line-height:1.8;
  text-wrap:pretty;
}

.lys-books-search{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:9px;
  width:100%;
  min-height:50px;
  padding:4px 8px 4px 14px;
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  background:var(--bg-card);
}

.lys-books-search:focus-within{
  outline:2px solid var(--accent);
  outline-offset:3px;
}

.lys-books-search-label{
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip:rect(0 0 0 0);
  white-space:nowrap;
}

.lys-books-search input{
  min-width:0;
  min-height:40px;
  padding:0;
  border:0;
  outline:0;
  color:var(--text-primary);
  background:transparent;
  font:14px/1.4 var(--sans);
}

.lys-books-search input::placeholder{color:var(--text-muted)}

.lys-books-search::before{
  content:"⌕";
  color:var(--accent);
  font:700 18px/1 var(--serif);
}

.lys-books-search-key{
  padding:4px 7px;
  border:1px solid var(--border-light);
  border-radius:var(--radius-sm);
  color:var(--text-muted);
  font:10px/1 var(--mono);
}

.lys-books-filters{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:20px 0 0;
}

.lys-books-filters button{
  min-height:34px;
  padding:7px 11px;
  border:1px solid var(--border);
  border-radius:var(--radius-full);
  color:var(--text-secondary);
  background:var(--bg-card);
  font:12px/1 var(--sans);
}

.lys-books-filters button:hover,
.lys-books-filters button:focus-visible{
  color:var(--accent);
  border-color:var(--accent);
}

.lys-books-filters button.is-active{
  color:var(--accent-2);
  border-color:var(--accent);
  background:var(--accent-soft);
}

body.lys-books-index .cat-meta{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin:30px 0 0;
  padding:20px 0 0;
  border-top:1px solid var(--border);
}

body.lys-books-index .cat-chip{
  display:block;
  min-width:0;
  padding:0;
  border:0;
  border-radius:0;
  color:var(--text-muted);
  background:transparent;
  font-size:11px;
  line-height:1.45;
}

body.lys-books-index .cat-chip b{
  display:block;
  margin-bottom:5px;
  color:var(--accent);
  font:700 26px/1 var(--serif);
}

body.lys-books-index .cat-chip small{
  display:block;
  font-size:11px;
}

.lys-books-catalog{
  width:100%;
  max-width:1120px;
  min-width:0;
  padding:clamp(42px,6vw,84px) clamp(24px,5vw,72px) 96px;
}

.lys-books-catalog-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:24px;
  padding:0 0 28px;
  border-bottom:1px solid var(--border);
}

.lys-books-catalog-head .cat-kicker{margin-bottom:14px}

.lys-books-catalog-head h2{
  margin:0;
  color:var(--text-primary);
  font:700 clamp(32px,4vw,50px)/1.15 var(--serif);
  letter-spacing:-.035em;
}

.lys-books-result{
  flex:none;
  margin:0 0 3px;
  color:var(--text-muted);
  white-space:nowrap;
  font-size:13px;
}

.lys-books-result b{
  color:var(--accent);
  font:700 22px/1 var(--serif);
}

body.lys-books-index .cat-list{
  margin:0;
  padding:0;
  list-style:none;
}

body.lys-books-index .cat-list > li{
  margin:0;
  padding:0;
  border:0;
}

body.lys-books-index .cat-list > li[hidden]{display:none!important}

body.lys-books-index .cat-item{
  position:relative;
  display:grid;
  grid-template-columns:58px minmax(0,1fr) auto;
  gap:18px;
  align-items:start;
  min-height:138px;
  padding:28px 10px;
  border:0;
  border-bottom:1px solid var(--border-light);
  border-radius:0;
  color:inherit;
  background:transparent;
  box-shadow:none;
  text-decoration:none;
  transition:background-color .2s ease;
}

body.lys-books-index .cat-item::before{
  content:"";
  position:absolute;
  top:18px;
  bottom:18px;
  left:0;
  width:3px;
  border-radius:2px;
  background:var(--accent);
  opacity:0;
  transition:opacity .2s ease;
}

body.lys-books-index .cat-item:hover,
body.lys-books-index .cat-item:focus-visible{
  background:color-mix(in srgb,var(--accent) 4%,transparent);
  transform:none;
}

body.lys-books-index .cat-item:hover::before,
body.lys-books-index .cat-item:focus-visible::before{opacity:1}

body.lys-books-index .cat-no{
  color:var(--accent);
  font:700 22px/1 var(--serif);
}

body.lys-books-index .cat-body{min-width:0}

body.lys-books-index .cat-name{
  margin:0 0 4px;
  color:var(--text-primary);
  font:700 clamp(21px,2vw,26px)/1.25 var(--serif);
  letter-spacing:-.015em;
}

body.lys-books-index .cat-by{
  margin:0 0 7px;
  color:var(--text-muted);
  font-size:12px;
}

body.lys-books-index .cat-desc{
  max-width:650px;
  margin:0;
  color:var(--text-secondary);
  font-size:14px;
  line-height:1.75;
  text-wrap:pretty;
}

body.lys-books-index .cat-side{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:max-content;
}

body.lys-books-index .cat-tags{display:flex;gap:6px}

body.lys-books-index .cat-tag{
  padding:5px 9px;
  border:0;
  border-radius:var(--radius-xs);
  color:var(--accent-2);
  background:var(--accent-soft);
  font-size:11px;
  font-weight:700;
}

body.lys-books-index .cat-go{
  color:var(--accent);
  font-size:13px;
  font-weight:700;
}

.lys-books-empty{
  padding:64px 10px;
  border-bottom:1px solid var(--border);
  color:var(--text-secondary);
}

.lys-books-empty strong{
  display:block;
  margin-bottom:8px;
  color:var(--text-primary);
  font:700 26px/1.25 var(--serif);
}

body.lys-books-index .cat-foot{
  grid-column:2;
  width:min(100% - 48px,976px);
  margin:0 auto;
  padding:36px 0 72px;
  border-top:1px solid var(--border);
  text-align:left;
}

/* ─────────────── 书籍详情共享阅读轨道 ─────────────── */
body.lys-books-unified{
  padding-left:288px!important;
}

.lys-books-rail{
  position:fixed;
  z-index:1000;
  top:56px;
  bottom:0;
  left:0;
  width:288px;
  overflow:auto;
  padding:30px 24px 24px;
  border-right:1px solid var(--border);
  color:var(--text-primary);
  background:color-mix(in srgb,var(--bg-secondary) 94%,transparent);
  overscroll-behavior:contain;
}

.lys-books-rail-back{
  display:inline-flex;
  align-items:center;
  gap:7px;
  margin-bottom:20px;
  color:var(--accent);
  font-size:12px;
  font-weight:700;
  text-decoration:none;
}

.lys-books-rail-overline{
  display:flex;
  align-items:center;
  gap:9px;
  margin:0 0 11px;
  color:var(--accent);
  font:700 11px/1 var(--serif);
  letter-spacing:.18em;
  text-transform:uppercase;
}

.lys-books-rail-overline::before{
  content:"";
  width:24px;
  height:4px;
  flex:none;
  border-radius:2px;
  background:var(--accent);
}

.lys-books-rail h2{
  margin:0;
  color:var(--text-primary);
  font:700 clamp(28px,2.6vw,39px)/1.1 var(--serif);
  letter-spacing:-.035em;
  text-wrap:balance;
}

.lys-books-rail-lede{
  margin:12px 0 19px;
  color:var(--text-secondary);
  font-size:12px;
  line-height:1.7;
}

.lys-books-rail .lys-books-search{
  min-height:46px;
  margin-bottom:14px;
  padding-left:11px;
}

.lys-books-rail .lys-books-search-key{display:none}

.lys-books-rail-tabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
  margin:0 0 17px;
}

.lys-books-rail-tabs button{
  min-height:34px;
  padding:7px 9px;
  border:1px solid var(--border);
  border-radius:var(--radius-full);
  color:var(--text-secondary);
  background:var(--bg-card);
  font-size:11px;
}

.lys-books-rail-tabs button[aria-selected="true"]{
  color:var(--accent-2);
  border-color:var(--accent);
  background:var(--accent-soft);
}

.lys-books-rail-pane[hidden]{display:none!important}

.lys-books-rail-label{
  display:block;
  margin:0 0 8px;
  color:var(--text-muted);
  font:700 10px/1 var(--mono);
  letter-spacing:.14em;
  text-transform:uppercase;
}

.lys-books-outline,
.lys-books-mini-library{
  display:grid;
  gap:2px;
}

.lys-books-outline a,
.lys-books-mini-library a{
  display:grid;
  grid-template-columns:26px minmax(0,1fr);
  gap:8px;
  align-items:start;
  padding:8px 9px;
  border-radius:var(--radius-md);
  color:var(--text-secondary);
  font-size:12px;
  line-height:1.45;
  text-decoration:none;
}

.lys-books-outline a span,
.lys-books-mini-library a span{
  color:var(--text-muted);
  font:10px/1.5 var(--mono);
}

.lys-books-outline a:hover,
.lys-books-outline a:focus-visible,
.lys-books-mini-library a:hover,
.lys-books-mini-library a:focus-visible{
  color:var(--accent);
  background:var(--bg-hover);
}

.lys-books-outline a.is-active,
.lys-books-mini-library a[aria-current="page"]{
  color:var(--accent);
  background:var(--bg-card);
  font-weight:700;
}

.lys-books-mini-empty{
  margin:8px 0;
  color:var(--text-muted);
  font-size:12px;
}

.lys-books-rail-summary{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:18px;
  padding-top:15px;
  border-top:1px solid var(--border);
  color:var(--text-muted);
  font-size:10px;
}

.lys-books-mobile-toggle{
  position:fixed;
  z-index:10003;
  top:68px;
  left:14px;
  display:none;
  align-items:center;
  gap:8px;
  min-height:38px;
  padding:8px 13px;
  border:1px solid var(--border);
  border-radius:var(--radius-full);
  color:var(--text-primary);
  background:var(--bg-card);
  box-shadow:var(--shadow-sm);
  font-size:12px;
  font-weight:700;
}

.lys-books-mobile-toggle::before{
  content:"☰";
  color:var(--accent);
}

.lys-books-rail-overlay{
  position:fixed;
  z-index:999;
  inset:56px 0 0;
  display:none;
  background:color-mix(in srgb,var(--text-primary) 28%,transparent);
}

body.lys-books-unified .lys-books-legacy-nav,
body.lys-books-unified .ls-sidebar,
body.lys-books-unified .ls-mobile-toggle{
  display:none!important;
}

body.lys-books-unified .ls-chapter{
  display:block!important;
  min-height:0!important;
}

body.lys-books-unified .ls-main{
  width:min(calc(100% - 56px),940px)!important;
  max-width:940px!important;
  margin:0 auto!important;
  padding:clamp(30px,4vw,52px) 0 88px!important;
}

body.lys-books-unified .wrap,
body.lys-books-unified header.hero:not(.wrap),
body.lys-books-unified .hero:not(.wrap):not(.ls-chapter-hero),
body.lys-books-unified footer{
  width:min(calc(100% - 56px),940px)!important;
  max-width:940px!important;
  margin-right:auto!important;
  margin-left:auto!important;
  box-sizing:border-box;
}

body.lys-books-unified main,
body.lys-books-unified article,
body.lys-books-unified section,
body.lys-books-unified .wrap{
  min-width:0;
}

body.lys-books-unified .hero h1,
body.lys-books-unified .ls-chapter-hero h1,
body.lys-books-unified h1.ls-hero{
  max-width:13em;
  font-family:var(--serif)!important;
  font-size:clamp(40px,5vw,64px)!important;
  line-height:1.08!important;
  letter-spacing:-.04em!important;
  text-wrap:balance;
}

body.lys-books-unified .hero .sub,
body.lys-books-unified .hero .lede,
body.lys-books-unified .hero .lead,
body.lys-books-unified .ls-chapter-hero .lede{
  max-width:680px;
  font-size:16px;
  line-height:1.9;
  text-wrap:pretty;
}

body.lys-books-unified img,
body.lys-books-unified svg,
body.lys-books-unified canvas{
  max-width:100%;
}

.lys-books-referral-host{
  width:min(calc(100% - 56px),940px);
  max-width:940px;
  min-height:1px;
  margin:0 auto;
  padding:10px 0 80px;
}

.lys-books-referral-host:empty{display:none}

@media (max-width:1120px){
  body.lys-books-unified{padding-left:0!important}
  .lys-books-rail{
    z-index:10002;
    width:min(320px,88vw);
    transform:translateX(-104%);
    box-shadow:var(--shadow-lg);
    transition:transform .24s ease;
  }
  body.lys-books-rail-open .lys-books-rail{transform:translateX(0)}
  .lys-books-mobile-toggle{display:inline-flex}
  body.lys-books-rail-open .lys-books-mobile-toggle::before{content:"×"}
  body.lys-books-rail-open .lys-books-rail-overlay{display:block}
  body.lys-books-unified .ls-main,
  body.lys-books-unified .wrap,
  body.lys-books-unified header.hero:not(.wrap),
  body.lys-books-unified .hero:not(.wrap):not(.ls-chapter-hero),
  body.lys-books-unified footer,
  .lys-books-referral-host{
    width:min(calc(100% - 48px),940px)!important;
  }
}

@media (max-width:900px){
  body.lys-books-index .cat-wrap{grid-template-columns:1fr}
  body.lys-books-index .cat-hero{
    position:static;
    height:auto;
    overflow:visible;
    padding:36px 24px 30px;
    border-right:0;
    border-bottom:1px solid var(--border);
  }
  body.lys-books-index .cat-title{max-width:none}
  body.lys-books-index .cat-lede{max-width:680px}
  body.lys-books-index .cat-meta{max-width:320px}
  .lys-books-catalog{padding-top:36px}
  body.lys-books-index .cat-foot{grid-column:1}
}

@media (max-width:620px){
  body.lys-books-index .cat-hero{padding:28px 18px 26px}
  body.lys-books-index .cat-title{font-size:clamp(42px,14vw,58px)}
  .lys-books-search-key{display:none}
  .lys-books-filters{
    flex-wrap:nowrap;
    overflow:auto;
    padding-bottom:4px;
    scrollbar-width:none;
  }
  .lys-books-filters::-webkit-scrollbar{display:none}
  .lys-books-filters button{min-width:max-content}
  .lys-books-catalog{padding:30px 18px 72px}
  .lys-books-catalog-head{display:block}
  .lys-books-result{margin-top:12px}
  body.lys-books-index .cat-item{
    grid-template-columns:38px minmax(0,1fr);
    gap:12px;
    min-height:0;
    padding:22px 2px;
  }
  body.lys-books-index .cat-side{
    grid-column:2;
    justify-content:space-between;
    min-width:0;
  }
  body.lys-books-index .cat-desc{font-size:13px}
  body.lys-books-index .cat-foot{width:calc(100% - 36px)}
  body.lys-books-unified .ls-main,
  body.lys-books-unified .wrap,
  body.lys-books-unified header.hero:not(.wrap),
  body.lys-books-unified .hero:not(.wrap):not(.ls-chapter-hero),
  body.lys-books-unified footer,
  .lys-books-referral-host{
    width:calc(100% - 36px)!important;
  }
  body.lys-books-unified .hero h1,
  body.lys-books-unified .ls-chapter-hero h1,
  body.lys-books-unified h1.ls-hero{
    font-size:clamp(36px,11vw,50px)!important;
  }
}

@media (prefers-reduced-motion:reduce){
  .lys-books-rail,
  .lys-books-mobile-toggle,
  body.lys-books-index .cat-item,
  body.lys-books-index .cat-item::before{
    scroll-behavior:auto!important;
    transition:none!important;
  }
}

@media print{
  body.lys-books-unified{padding-left:0!important}
  .lys-books-rail,
  .lys-books-mobile-toggle,
  .lys-books-rail-overlay{display:none!important}
}
