/* ============================================================
   DEEP DIVE LIBRARY — extra styles on top of style.css
   ============================================================ */

:root { --read-size: 1.12rem; --font-read: "Literata", Georgia, serif; }

.deep-main { max-width: 1180px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 5vw, 3rem); min-height: 70vh; }

/* reading progress bar */
.read-bar { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 30; pointer-events: none; }
.read-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--shine-seafoam)); }

.text-size { display: flex; gap: 4px; margin-left: auto; }
.text-size + .level { margin-left: 0; }
.ts { border: 1px solid var(--surface-border); background: var(--surface); color: var(--text-dim); font: 700 0.85rem var(--font-mono); padding: 0.3rem 0.6rem; border-radius: 999px; cursor: pointer; }
.ts:hover { color: var(--accent); }

.crumbs { font: 0.85rem var(--font-mono); color: var(--text-dim); margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.crumbs a { color: var(--blue); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* LIBRARY */
.lib-hero { margin-bottom: 1.8rem; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.book {
  display: flex; flex-direction: column; gap: 0.35rem; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; transition: transform 0.12s, border-color 0.12s; position: relative; overflow: hidden;
}
.book:hover { transform: translateY(-3px); border-color: var(--accent); }
.book .e { font-size: 2.6rem; line-height: 1; }
.book h3 { margin: 0.2rem 0 0; font-size: 1.5rem; }
.book p { margin: 0; color: var(--text-dim); font-size: 0.95rem; }
.book .meta { font: 0.78rem var(--font-mono); color: var(--text-dim); margin-top: auto; padding-top: 0.5rem; }
.book .bar { max-width: none; height: 8px; margin-top: 0.4rem; }
.book.soon { opacity: 0.55; }
.book.done::after { content: "✓ finished"; position: absolute; top: 12px; right: 12px; font: 700 0.72rem var(--font-mono); color: #032; background: var(--good); padding: 0.15rem 0.45rem; border-radius: 6px; }

/* STORY HOME */
.story-head { display: grid; gap: 0.4rem; margin-bottom: 1.4rem; }
.story-head .e { font-size: 3.6rem; line-height: 1; }
.story-intro { font-family: var(--font-read); font-size: var(--read-size); max-width: 70ch; line-height: 1.75; }
.story-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.6rem 0 1.4rem; }
.story-actions .btn { margin-top: 0; }
.toc { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.toc a, .toc .off {
  display: grid; grid-template-columns: 3rem 1fr auto; gap: 0.8rem; align-items: center; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: 0.65rem 0.9rem;
}
.toc a:hover { border-color: var(--accent); }
.toc .num { font: 700 1.1rem var(--font-mono); color: var(--accent); text-align: center; }
.toc b { display: block; }
.toc small { color: var(--text-dim); font-family: var(--font-mono); font-size: 0.75rem; }
.toc .st { font-size: 1.1rem; }
.toc .off { opacity: 0.45; }
.toc .read { border-color: rgba(93, 242, 192, 0.45); }
.extras { margin-top: 2rem; display: grid; gap: 0.8rem; }
.extras details { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 14px; padding: 0.8rem 1rem; }
.extras summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.extras dl { margin: 0.6rem 0 0; display: grid; gap: 0.45rem; }
.extras dt { font-weight: 700; }
.extras dd { margin: 0 0 0 1rem; color: var(--text-dim); }

/* CHAPTER */
.chapter { max-width: 760px; margin: 0 auto; }
.ch-head { margin-bottom: 1.2rem; }
.ch-head h1 { font-size: clamp(2rem, 5.5vw, 3.1rem); }
.ch-head .meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.nutshell { border-left: 4px solid var(--shine-seafoam); background: rgba(93, 242, 192, 0.07); border-radius: 0 14px 14px 0; padding: 0.8rem 1.1rem; margin: 1rem 0 1.6rem; }
.nutshell b { color: var(--shine-seafoam); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }
.nutshell p { margin: 0.25rem 0 0; font-size: 1.08rem; }
.prose { font-family: var(--font-read); font-size: var(--read-size); line-height: 1.8; }
.prose h2 { font-family: var(--font-name); font-weight: 700; font-size: 1.6em; color: var(--accent-bright); margin: 1.8em 0 0.4em; }
.prose p { margin: 0 0 1.05em; }
.pic { margin: 1.6rem 0; }
.pic img { width: 100%; max-height: 480px; object-fit: contain; background: #0b1838; border-radius: 14px; border: 1px solid var(--surface-border); }
.pic figcaption { font: 0.78rem var(--font-body); color: var(--text-dim); margin-top: 0.4rem; }
.pic figcaption a { color: var(--text-dim); }
.dd { margin: 2rem 0; background: rgba(95, 212, 255, 0.07); border: 1px solid rgba(95, 212, 255, 0.35); border-radius: 16px; padding: 0.9rem 1.2rem; }
.dd summary { cursor: pointer; font-weight: 700; color: var(--blue); }
.dd p { font-family: var(--font-read); font-size: calc(var(--read-size) * 0.95); line-height: 1.75; margin: 0.7rem 0 0; }
.fun { margin: 1.6rem 0; padding: 0.9rem 1.2rem; border-radius: 16px; background: rgba(255, 184, 77, 0.1); border: 1px solid rgba(255, 184, 77, 0.4); }
.fun b { color: var(--accent); }
.check { margin: 1.6rem 0; }
.check .q-text { margin: 0.2rem 0 0; }
.sources { margin-top: 2rem; font-size: 0.9rem; }
.sources ol { padding-left: 1.3rem; color: var(--text-dim); }
.sources li { margin: 0.3rem 0; }
.sources a { color: var(--blue); word-break: break-word; }
.ch-nav { display: flex; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin-top: 2.2rem; padding-top: 1.2rem; border-top: 1px dashed var(--surface-border); }
.ch-nav a { flex: 1 1 220px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--surface-border); border-radius: 14px; padding: 0.7rem 1rem; }
.ch-nav a:hover { border-color: var(--accent); }
.ch-nav small { display: block; color: var(--text-dim); font-family: var(--font-mono); font-size: 0.75rem; }
.ch-nav .next { text-align: right; }
.end-mark { height: 1px; }

@media (max-width: 760px) {
  .text-size { display: none; }
  .toc a, .toc .off { grid-template-columns: 2.2rem 1fr auto; gap: 0.5rem; }
}
