/* ============================================================
   shelf_styles.css — shared by every page in book_shelf/
   Themes follow customize.js: data-theme on <html> + --accent-color
   Themes: light, dark, dracula, midnight, rose
   ============================================================ */
:root, [data-theme="light"] {
  --bs-bg: #fcfbff; --bs-bg2: #f1efff; --bs-surface: #fff; --bs-ink: #12102e; --bs-muted: #5d5b7a;
  --bs-line: rgba(91, 62, 245, .14); --bs-accent-d: #5b3ef5; --bs-accent2: #2f80ff; --bs-on: #fff;
  --bs-shelf-a: #d8d2f5; --bs-shelf-b: #b9b0e6; --bs-free: #0f9157;
}
[data-theme="dark"] {
  --bs-bg: #0f0e22; --bs-bg2: #171540; --bs-surface: #1d1b3a; --bs-ink: #f1f0ff; --bs-muted: #a9a7cf;
  --bs-line: rgba(255, 255, 255, .12); --bs-accent-d: #8b73ff; --bs-accent2: #4f9bff; --bs-on: #fff;
  --bs-shelf-a: #3a3670; --bs-shelf-b: #292656; --bs-free: #3ddc97;
}
[data-theme="dracula"] {
  --bs-bg: #282a36; --bs-bg2: #21222c; --bs-surface: #343746; --bs-ink: #f8f8f2; --bs-muted: #b4b8d2;
  --bs-line: rgba(189, 147, 249, .25); --bs-accent-d: #bd93f9; --bs-accent2: #ff79c6; --bs-on: #1e1f29;
  --bs-shelf-a: #44475a; --bs-shelf-b: #383a4b; --bs-free: #50fa7b;
}
[data-theme="midnight"] {
  --bs-bg: #070b1f; --bs-bg2: #0c1233; --bs-surface: #121a45; --bs-ink: #eaf0ff; --bs-muted: #9aa7d6;
  --bs-line: rgba(122, 162, 255, .22); --bs-accent-d: #5aa2ff; --bs-accent2: #7cf0ff; --bs-on: #06102a;
  --bs-shelf-a: #1f2b66; --bs-shelf-b: #162052; --bs-free: #5af2b0;
}
[data-theme="rose"] {
  --bs-bg: #fffafc; --bs-bg2: #ffeef5; --bs-surface: #fff; --bs-ink: #3a1226; --bs-muted: #8a5a70;
  --bs-line: rgba(232, 67, 147, .18); --bs-accent-d: #e84393; --bs-accent2: #ff8fb8; --bs-on: #fff;
  --bs-shelf-a: #f6c9dc; --bs-shelf-b: #eaa9c4; --bs-free: #0f9157;
}
:root { --bs-accent: var(--accent-color, var(--bs-accent-d)); --bs-font: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif; --bs-ease: cubic-bezier(.3, .7, .2, 1); }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--bs-font); color: var(--bs-ink); background: var(--bs-bg); -webkit-font-smoothing: antialiased; transition: background .3s, color .3s; }
a { color: inherit; } button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--bs-accent); outline-offset: 3px; }
.bs-sprite { position: absolute; width: 0; height: 0; }
.bs-icon { width: 1.2em; height: 1.2em; flex: none; }
.bs-bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(60% 45% at 92% 0%, color-mix(in srgb, var(--bs-accent) 22%, transparent), transparent),
  radial-gradient(50% 40% at 0% 100%, color-mix(in srgb, var(--bs-accent2) 16%, transparent), transparent), linear-gradient(160deg, var(--bs-bg), var(--bs-bg2)); }
.bs-page { max-width: 1180px; margin: 0 auto; padding: clamp(18px, 3.5vw, 48px) clamp(18px, 4vw, 48px) 0; }

/* header */
.bs-top { display: flex; align-items: center; gap: 16px; margin-bottom: clamp(20px, 3vw, 40px); }
.bs-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.4rem; letter-spacing: -.02em; }
.bs-logo svg { width: 1.6em; height: 1.6em; }
.bs-crumbs { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; font-size: .82rem; color: var(--bs-muted); }
.bs-crumbs a { text-decoration: none; } .bs-crumbs a:hover { color: var(--bs-accent); }
.bs-crumbs span::before { content: "/"; margin-right: 6px; opacity: .5; }
.bs-themebtn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--bs-surface); border: 1px solid var(--bs-line); }
.bs-themebtn:hover { border-color: var(--bs-accent); }

/* customize.js popup (its classes are styled here so the page is self-contained) */
.custom-popup { position: fixed; z-index: 1000; right: 16px; left: auto !important; top: 72px !important; width: 250px; padding: 16px; border-radius: 18px;
  background: var(--bs-surface); border: 1px solid var(--bs-line); box-shadow: 0 24px 50px -20px rgba(0, 0, 30, .55); }
.cp-customize-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cp-customize-title { font-weight: 800; }
.cp-close-btn { width: 28px; height: 28px; border-radius: 50%; background: var(--bs-bg2); }
.cp-section { margin-top: 12px; } .cp-section-label { display: block; margin-bottom: 8px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-muted); }
.cp-theme-row, .cp-accent-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-theme-btn { width: 38px; height: 38px; border-radius: 10px; background: var(--bs-bg2); border: 2px solid transparent; }
.cp-theme-btn.active { border-color: var(--bs-accent); }
.cp-accent-dot { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--bs-surface); box-shadow: 0 0 0 1px var(--bs-line); }
.cp-accent-dot.active { box-shadow: 0 0 0 2px var(--bs-accent); }

/* cover: title card first, real .webp fades in */
.bs-cover { display: block; position: relative; aspect-ratio: 5 / 7; overflow: hidden; border-radius: 12px; container-type: inline-size;
  background: linear-gradient(170deg, hsl(var(--h) 45% 20%), hsl(var(--h) 55% 8%)); box-shadow: 0 24px 40px -22px rgba(20, 10, 80, .7); }
.bs-cover__ph { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; text-align: center; padding: 10%; color: #fff;
  background: radial-gradient(120% 55% at 50% 105%, hsl(var(--h) 85% 55%), transparent 70%); }
.bs-cover__ph strong { font-size: 11cqw; line-height: 1.1; letter-spacing: -.02em; }
.bs-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .5s; }
.bs-js .bs-cover img { opacity: 0; } .bs-js .bs-cover.is-loaded img { opacity: 1; }

/* series heading + shelf */
.bs-kicker { margin: 0 0 10px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-accent); }
.bs-series { margin: 0; font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.bs-lede { margin: 12px 0 0; color: var(--bs-muted); }
.bs-shelf { --lab: 46px; position: relative; display: flex; justify-content: center; gap: clamp(10px, 2.4vw, 32px); padding: 36px 4px 0; margin-bottom: clamp(20px, 3vw, 36px); }
.bs-shelf::after { content: ""; position: absolute; left: 0; right: 0; bottom: calc(var(--lab) - 16px); height: 16px; border-radius: 6px;
  background: linear-gradient(var(--bs-shelf-a), var(--bs-shelf-b)); box-shadow: 0 18px 22px -12px rgba(0, 0, 0, .35); }
.bs-ed { position: relative; z-index: 1; width: clamp(68px, 19vw, 200px); display: flex; flex-direction: column; text-decoration: none; opacity: .88; transition: transform .35s var(--bs-ease), opacity .3s; }
.bs-ed:hover { transform: translateY(-6px); opacity: 1; }
.bs-ed[aria-selected="true"] { transform: translateY(-16px); opacity: 1; }
.bs-ed[aria-selected="true"] .bs-cover { box-shadow: 0 0 0 3px var(--bs-accent), 0 30px 46px -18px var(--bs-accent); }
.bs-ed__l { height: var(--lab); padding-top: 24px; text-align: center; font-size: clamp(.7rem, 1.5vw, .9rem); font-weight: 600; color: var(--bs-muted); }
.bs-ed[aria-selected="true"] .bs-ed__l { color: var(--bs-accent); font-weight: 800; }

/* hero + info */
.bs-hero { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: clamp(24px, 5vw, 64px); align-items: start; }
.bs-hero--series { display: block; }
.bs-hero--series .bs-infos { padding: clamp(22px, 4vw, 44px); border-radius: 26px; background: var(--bs-surface); border: 1px solid var(--bs-line); }
.bs-panel { display: block; }
.bs-js .bs-panel:not(.is-on) { display: none; }
.bs-js .bs-panel.is-on { animation: bs-in .4s var(--bs-ease); }
@keyframes bs-in { from { opacity: 0; transform: translateY(10px); } }
.bs-title { margin: 0 0 8px; font-size: clamp(1.7rem, 4vw, 3.2rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; }
.bs-by { margin: 0 0 18px; font-size: .9rem; color: var(--bs-muted); }
.bs-price { margin: 0 0 14px; font-size: 1.8rem; font-weight: 800; }
.bs-price.is-free { color: var(--bs-free); }
.bs-blurb { margin: 0 0 22px; max-width: 58ch; line-height: 1.65; color: var(--bs-muted); }
.bs-btn { display: inline-block; padding: 14px 28px; border-radius: 999px; text-decoration: none; font-weight: 700; color: var(--bs-on);
  background: linear-gradient(90deg, var(--bs-accent), var(--bs-accent2)); box-shadow: 0 12px 26px -12px var(--bs-accent); transition: transform .2s var(--bs-ease); }
.bs-btn:hover { transform: translateY(-2px); }
.bs-sub { margin: 28px 0 10px; font-size: .95rem; }
.bs-learn { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.bs-learn li { position: relative; padding-left: 28px; line-height: 1.5; }
.bs-learn li::before { content: ""; position: absolute; left: 2px; top: .35em; width: 12px; height: 7px; border-left: 2.5px solid var(--bs-accent); border-bottom: 2.5px solid var(--bs-accent); transform: rotate(-45deg); }

/* sections */
.bs-sec { margin-top: clamp(40px, 6vw, 80px); }
.bs-h { margin: 0 0 20px; padding-left: 14px; border-left: 4px solid var(--bs-accent); font-size: clamp(1.2rem, 2vw, 1.55rem); font-weight: 800; letter-spacing: -.02em; }
.bs-sec p { max-width: 68ch; line-height: 1.7; color: var(--bs-muted); }
.bs-chapters { margin: 0; padding: 0; list-style: none; counter-reset: c; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.bs-chapters li { counter-increment: c; display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 16px; background: var(--bs-surface); border: 1px solid var(--bs-line); font-weight: 600; }
.bs-chapters li::before { content: counter(c, decimal-leading-zero); font-size: .8rem; font-weight: 800; color: var(--bs-accent); }
.bs-dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.bs-dl div { padding: 16px 18px; border-radius: 16px; background: var(--bs-surface); border: 1px solid var(--bs-line); }
.bs-dl dt { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-muted); margin-bottom: 4px; }
.bs-dl dd { margin: 0; font-weight: 700; }
.bs-rel { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px; }
.bs-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.bs-card .bs-cover { margin-bottom: 8px; transition: transform .3s var(--bs-ease); } .bs-card:hover .bs-cover { transform: translateY(-5px); }
.bs-card strong { font-size: .92rem; line-height: 1.25; } .bs-card span { font-size: .8rem; color: var(--bs-muted); }
.bs-foot { margin-top: clamp(48px, 7vw, 96px); padding: 28px clamp(18px, 4vw, 48px); border-top: 1px solid var(--bs-line); display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center; font-size: .85rem; color: var(--bs-muted); }
.bs-foot a { text-decoration: none; } .bs-foot a:hover { color: var(--bs-accent); }

@media (max-width: 720px) {
  .bs-hero { grid-template-columns: 1fr; } .bs-hero > .bs-cover-wrap { width: min(60%, 260px); }
  .bs-crumbs { display: none; } .bs-themebtn { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
