/* One stylesheet for every book series page.
 *
 * Each series page -- The Hand Series, The Curiosity Series, The Religions
 * Series and the rest -- is the same page with a different series in it, so
 * the look lives here once instead of being copied into each one. A page
 * carries only its own words; everything about how it is drawn is in this
 * file and in /js/series-page.js.
 */
:root {
  --white: #ffffff; --bg-main: #f8fafc; --bg-subtle: #f1f5f9;
  --border-color: #cbd5e1; --text-main: #0f172a; --text-muted: #475569; --text-light: #64748b;
  --accent-blue: #0284c7; --accent-blue-hover: #0369a1;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius-5: 5px;
  --shadow-warm-md: 0 10px 25px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-stack); background: var(--bg-main); color: var(--text-main); line-height: 1.5; }
.bay { max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; }
header { width: 100%; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; background: rgba(255,255,255,0.96); z-index: 50; }
header .bay { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: 0.85rem; padding-bottom: 0.85rem; }
@font-face { font-family: "Brand Marker"; src: url("/fonts/PermanentMarker-Regular.ttf") format("truetype"); font-display: swap; }
header a.logo { font-family: "Brand Marker", var(--font-stack); font-size: 1.35rem; color: var(--text-main); text-decoration: none; display: flex; align-items: center; gap: 0.55rem; }
header a.logo img { width: 26px; height: 26px; border-radius: 6px; display: block; }
header a.back-link { font: 700 0.78rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); text-decoration: none; }
header a.back-link:hover { color: var(--accent-blue); }
.page-section { padding: clamp(2rem, 4vw, 3rem) 0; }

/* The shared title section: the accent bar, the name, the uppercase
   tagline under it and one sentence saying what the page is for. */
.page-title-block { border-left: 4px solid var(--accent-blue); padding: 0.2rem 0 0.2rem 1rem; margin: 0 0 1.5rem; }
.page-title-block h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.page-title-block .tagline { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-blue); margin: 0.2rem 0 0.4rem; }
.page-title-block p { margin: 0 0 0.5rem; color: var(--text-muted); max-width: 70ch; }
.page-title-block p:last-child { margin-bottom: 0; }

/* The badge saying plainly that a program wrote these books. It is the
   first thing on the page because it is the first thing a reader needs. */
.ai-badge { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--font-mono); font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; background: #fef3c7; color: #92400e; border-radius: 999px; padding: 0.22rem 0.6rem; margin: 0 0 0.55rem; }

/* The folded how-to block, in the same shape every other page uses. */
details.howto { background: var(--white); border: 1px solid var(--border-color); border-radius: var(--radius-5); padding: 0.9rem 1.2rem; margin: 0 0 2rem; box-shadow: var(--shadow-warm-md); }
details.howto summary { cursor: pointer; font-size: 0.98rem; }
details.howto h3 { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 1.1rem 0 0.4rem; }
details.howto ul { margin: 0; padding-left: 1.1rem; }
details.howto li { margin: 0 0 0.35rem; max-width: 72ch; }

/* The two halves of the page: the list of books down the left, and the
   back of whichever one is chosen on the right. */
.series-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; }

/* The sidebar sticks below the header, so the list of books stays on
   screen the whole way down a long back cover. */
.book-rail { position: sticky; top: 5rem; max-height: calc(100vh - 6.5rem); overflow-y: auto; overscroll-behavior: contain; background: var(--white); border: 1px solid var(--border-color); border-radius: var(--radius-5); padding: 1rem; box-shadow: var(--shadow-warm-md); }
.book-rail h2 { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 0 0 0.7rem; }
.book-rail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.book-rail a { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 0.6rem; align-items: center; padding: 0.5rem 0.6rem; border-radius: var(--radius-5); text-decoration: none; color: var(--text-main); font-size: 0.93rem; font-weight: 700; border: 1px solid transparent; }
.book-rail a:hover { background: var(--bg-subtle); border-color: var(--border-color); color: var(--accent-blue); }
.book-rail a.current { background: var(--accent-blue); border-color: var(--accent-blue); color: var(--white); }
.book-rail svg { width: 18px; height: 18px; display: block; }
.book-rail .rail-order { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-light); display: block; font-weight: 700; }
.book-rail a.current .rail-order { color: rgba(255,255,255,0.8); }
.rail-note { margin: 0.9rem 0 0; padding-top: 0.8rem; border-top: 1px solid var(--border-color); font-size: 0.82rem; color: var(--text-muted); }

/* The back of the book: the half of the page the chosen book fills. */
.book-panel { background: var(--white); border: 1px solid var(--border-color); border-radius: var(--radius-5); padding: clamp(1.1rem, 2.5vw, 1.8rem); box-shadow: var(--shadow-warm-md); }
.book-panel .panel-eyebrow { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-blue); margin: 0 0 0.3rem; }
.book-panel h2 { margin: 0 0 0.9rem; font-size: clamp(1.3rem, 2.4vw, 1.6rem); }
.book-panel .summary { margin: 0 0 1.3rem; padding: 0.9rem 1.1rem; background: var(--bg-subtle); border-left: 4px solid var(--accent-blue); border-radius: var(--radius-5); font-size: 0.93rem; line-height: 1.7; color: var(--text-main); }
.section-label { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 0 0 0.5rem; }
.back-cover p { margin: 0 0 0.85rem; line-height: 1.75; font-size: 0.96rem; }
.back-cover p:last-child { margin-bottom: 0; }
.editions { border-top: 1px solid var(--border-color); margin: 1.3rem 0 0; padding: 1.1rem 0 0; display: flex; flex-direction: column; gap: 0.9rem; }
.edition-row h4 { margin: 0 0 0.2rem; font-size: 0.95rem; }
.edition-row .meta { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-light); margin: 0 0 0.3rem; }
.edition-row p.blurb { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.3rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--border-color); }
/* One sentence under the buttons saying what the download is for, shown
   only to somebody who really has the book. */
.panel-note { margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--text-muted); max-width: 72ch; }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 0.85rem; border-radius: var(--radius-5); font: 700 0.78rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.03em; text-decoration: none; border: 1px solid var(--border-color); color: var(--text-main); background: var(--white); }
.btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.btn-primary { background: var(--accent-blue); border-color: var(--accent-blue); color: var(--white); }
.btn-primary:hover { background: var(--accent-blue-hover); color: var(--white); }
.meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-light); }
.error-text { color: #b91c1c; }

footer { border-top: 1px solid var(--border-color); padding: 1.5rem 0; margin-top: 2rem; }
footer .bay { font: 700 0.7rem var(--font-mono); letter-spacing: 0.04em; color: var(--text-light); }

/* Below this width there is no room for two halves, so the list of books
   sits above the book itself and stops being its own scrolling box. */
@media (max-width: 860px) {
  .series-layout { grid-template-columns: 1fr; }
  .book-rail { position: static; max-height: none; overflow: visible; }
}

/* The box at the top saying how many books are unlocked and which two the
   next payment opens, with the two pickers that choose them. It is the one
   thing the /books/ shelf did that is not about a single book, so it sits
   above the two halves rather than inside the chosen book. */
.series-account { background: var(--white); border: 1px solid var(--border-color); border-left: 4px solid var(--accent-blue); border-radius: var(--radius-5); padding: 1rem 1.2rem; margin: 0 0 2rem; box-shadow: var(--shadow-warm-md); }
.series-account .account-line { margin: 0; font-size: 0.9rem; }
.series-account .panel-actions { margin: 0.8rem 0 0; padding-top: 0; border-top: 0; }
.next-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem; margin: 0.9rem 0 0; }
.next-pick label { display: flex; flex-direction: column; gap: 0.3rem; font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
/* A dropdown is given the same height as the fields and the buttons beside
   it, because a browser otherwise gives it a line height of its own and the
   row stops reading as one straight line. */
.next-pick select { height: 36px; min-width: 240px; padding: 0 0.6rem; border: 1px solid var(--border-color); border-radius: var(--radius-5); font: inherit; font-size: 0.85rem; text-transform: none; color: var(--text-main); background: var(--white); }
.next-pick .btn { cursor: pointer; height: 36px; }
.next-pick-status { flex-basis: 100%; margin: 0; font-size: 0.8rem; }

/* A book this account may not read yet. It is a word, not a button, because
   there is nothing to press. */
.btn-locked { background: var(--bg-subtle); color: var(--text-light); border-color: var(--border-color); cursor: not-allowed; }
