/* Self-hosting story book (books app). Uses the portal's colour variables from base.html. */
.book-kicker { margin: 0 0 .6rem; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }

.book-cover { text-align: center; padding: 3rem 1.25rem; border-radius: 20px; margin-bottom: 2rem; color: #fff;
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2) 60%, var(--hero-3)); box-shadow: 0 20px 50px rgba(30, 58, 138, .2); }
.book-cover .book-kicker { color: rgba(255, 255, 255, .85); }
.book-cover h1 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.02em; }
.book-tamil { margin: .4rem 0 0; font-size: 1.25rem; opacity: .95; }
.book-tagline { max-width: 34rem; margin: 1rem auto 1.5rem; opacity: .92; }
.book-cover .btn { background: #fff; color: var(--hero-1); }

.book-contents-h { margin: 0 0 1rem; }
.book-contents { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.story-card { display: flex; gap: 1.1rem; align-items: flex-start; padding: 1.3rem; border-radius: 16px; text-decoration: none; color: var(--fg);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; }
.story-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.story-no { flex: none; font-size: 2.2rem; font-weight: 800; line-height: 1; color: var(--accent); opacity: .85; }
.story-body { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.story-topic { font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.story-title { font-size: 1.2rem; line-height: 1.35; }
.story-epigraph { color: var(--muted); font-size: .95rem; }
.story-meta { font-size: .82rem; color: var(--muted); }
.book-more { text-align: center; margin-top: 2rem; }

/* Chapter reader */
.read-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 50; }
.chapter-layout { display: grid; grid-template-columns: 220px minmax(0, 720px); gap: 2.5rem; justify-content: center; align-items: start; }
.chapter-toc { position: sticky; top: 5rem; font-size: .9rem; max-height: calc(100vh - 7rem); overflow-y: auto; }
.chapter-toc ol { list-style: none; margin: .8rem 0 0; padding: 0; border-left: 2px solid var(--line); }
.chapter-toc li a { display: block; padding: .3rem .8rem; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; margin-left: -2px; }
.chapter-toc li a:hover, .chapter-toc li a.on { color: var(--accent); border-left-color: var(--accent); }
.toc-back { color: var(--muted); text-decoration: none; font-weight: 600; }
.toc-back:hover { color: var(--accent); }

.chapter-head h1 { margin: 0 0 .8rem; font-size: clamp(1.9rem, 4.5vw, 2.7rem); line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
.epigraph { margin: 0 0 1rem; padding-left: 1rem; border-left: 4px solid var(--accent); font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1.15rem; color: var(--muted); }

.story { font-family: Georgia, "Times New Roman", serif; font-size: 1.15rem; line-height: 1.9; overflow-wrap: anywhere; }
.story h2 { font-family: Inter, system-ui, sans-serif; font-size: 1.6rem; margin: 3rem 0 .8rem; line-height: 1.3; padding-top: .5rem; border-top: 1px solid var(--line); scroll-margin-top: 5rem; }
.story h3 { font-family: Inter, system-ui, sans-serif; font-size: 1.2rem; margin: 2rem 0 .6rem; color: var(--accent); scroll-margin-top: 5rem; }
.story p { margin: 0 0 1.2em; }
.story ul, .story ol { padding-left: 1.4rem; margin: 0 0 1.2em; }
.story li + li { margin-top: .35em; }
.story a { color: var(--accent); }
.story hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.story blockquote { margin: 1.4rem 0; padding: .6rem 1.2rem; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; }
.story blockquote p { margin: .4em 0; }
.story figure { margin: 1.8rem 0; text-align: center; }
.story figure img { max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.story figcaption { font-family: Inter, system-ui, sans-serif; font-size: .88rem; color: var(--muted); margin-top: .5rem; }
.story code { font: .85em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--accent-soft); padding: .1em .35em; border-radius: 4px; }
.story pre { position: relative; background: #0e1729; color: #e6edfb; padding: 1rem 1.1rem; border-radius: 10px; overflow-x: auto; font-size: .86rem; line-height: 1.6; margin: 1.2rem 0; }
.story pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.story .tablewrap, .story table { font-family: Inter, system-ui, sans-serif; font-size: .92rem; }
.story table { border-collapse: collapse; display: block; overflow-x: auto; margin: 1.2rem 0; }
.story th, .story td { padding: .5rem .75rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.story th { background: var(--accent-soft); }
.copy-btn { position: absolute; top: .4rem; right: .4rem; font: 600 .72rem Inter, system-ui, sans-serif; padding: .25rem .6rem; border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .1); color: #e6edfb; cursor: pointer; }
.copy-btn:hover { background: rgba(255, 255, 255, .2); }

.chapter-pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); flex-wrap: wrap; }

@media (max-width: 900px) {
  .chapter-layout { grid-template-columns: minmax(0, 1fr); }
  .chapter-toc { display: none; }
  .story { font-size: 1.08rem; }
  .story pre { margin-left: -1rem; margin-right: -1rem; border-radius: 0; }
}
