/* css/views/story.css — Story Mode (option 2): table of contents (#/story) and the chapter chrome around the live product.
   guide/story.js sets html[data-story="on"] while the chrome is shown. The product keeps its own shell (top bar, rail,
   footer); the chapter rail and narration header are fixed layers, and .main becomes a framed stage between them. */

/* ---------------- table of contents ---------------- */
.story-toc { max-width: 1040px; margin: 0 auto; padding: 62px 32px 80px; }
.story-toc .st-toc-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.story-toc h1 { font-family: var(--serif); font-weight: 400; font-size: 46px; line-height: 1.1; letter-spacing: -.01em; margin: 12px 0 12px; }
.story-toc h1 i { color: var(--brand); }
.story-toc .sub { font-size: 16.5px; color: var(--mut); max-width: 60ch; margin: 0 0 36px; }
.st-story { display: grid; grid-template-columns: 70px 1fr 220px; gap: 22px; padding: 24px 0; border-top: 1px solid var(--line2); align-items: start; }
.st-story:last-of-type { border-bottom: 1px solid var(--line2); }
.st-story .num { font-family: var(--serif); font-size: 44px; line-height: 1; color: var(--brand); }
.st-story h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 0 0 4px; line-height: 1.15; }
.st-story p { margin: 0 0 12px; color: var(--mut); font-size: 14.5px; max-width: 62ch; }
.st-story .chs { display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; }
.st-story .chs a { color: var(--mut); }
.st-story .chs a:hover { color: var(--ink); text-decoration: underline; }
.st-story .chs a::before { content: attr(data-n) " "; color: var(--brand); font-weight: 600; }
.st-story .rt { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.st-story .rt .mono { font-size: 11px; color: var(--mut2); }
.st-tag { display: inline-flex; align-items: center; font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; border-radius: 20px; padding: 2px 8px; white-space: nowrap; font-weight: 600; background: rgba(0,0,0,.06); color: var(--mut); }
.st-p-full { background: var(--pink-t, #F7E3E3); color: var(--red-d); }
.st-p-light { background: var(--blue-t, #E4EBF1); color: var(--bblue); }
.st-p-touch { background: var(--teal-t, #DCEBE9); color: var(--teal-d, #2F6E6B); }
.st-p-pay { background: var(--amber-t, #F6DDC9); color: var(--amber-d, #8A4210); }
.st-p-risk { background: #EBDDE0; color: var(--brand-d); }
.story-toc .resume { margin-top: 22px; font-size: 13.5px; color: var(--mut); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.story-toc .lnk { background: none; border: 0; padding: 0; font: 600 13.5px var(--sans); color: var(--ink); cursor: pointer; }
.story-toc .lnk.red { color: var(--red); }
.story-toc .lnk:hover { text-decoration: underline; }
.story-opening { padding-top: 120px; }

/* ---------------- chrome: chapter rail + narration ---------------- */
html[data-story="on"] { --story-spine: 300px; --story-narr: 118px; --story-left: var(--rail-w); }
html[data-story="on"]:has(.shell[data-rail="open"]) { --story-left: var(--rail-w-open); }
html[data-story="on"] .main {
  margin: var(--story-narr) 22px calc(var(--footer-h) + 6px) calc(var(--story-spine) + 22px);
  border-radius: 14px; background: var(--bg); box-shadow: 0 0 0 1px rgba(0,0,0,.08), var(--shadow-lg, 0 12px 34px rgba(38,30,20,.12));
}
html[data-story="on"] .view, html[data-story="on"] .drawer { height: 100%; }
html[data-story="on"] .view:not(.view-full) { padding-bottom: 16px; }

.st-spine {
  position: fixed; z-index: 24; top: var(--topbar-h); left: var(--story-left); width: var(--story-spine);
  bottom: calc(var(--footer-h) + var(--app-inset-bottom, 0px)); overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 22px 24px; border-right: 1px solid rgba(0,0,0,.07); background: rgba(255,255,255,.28);
  font-family: var(--sans); color: var(--ink);
}
.st-spine .st-back { font-size: 13px; color: var(--mut); }
.st-spine .st-back:hover { color: var(--ink); }
.st-spine .st-kicker { margin-top: 26px; }
.st-spine h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 6px 0 12px; line-height: 1.1; }
.st-prog { height: 4px; background: rgba(0,0,0,.08); border-radius: 3px; overflow: hidden; margin: 4px 0 6px; }
.st-prog i { display: block; height: 100%; background: var(--red); border-radius: 3px; transition: width .4s; }
.st-progl { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--mut); letter-spacing: .05em; margin-bottom: 18px; }
.st-chs { list-style: none; margin: 0; padding: 0; }
.st-ch { position: relative; padding: 0 0 18px 0; }
.st-ch::before { content: ""; position: absolute; left: 9px; top: 22px; bottom: 0; width: 2px; background: var(--line2); }
.st-ch:last-child::before { display: none; }
.st-ch.done::before { background: var(--ink); }
.st-ch-b { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0 0 0 34px; position: relative; cursor: pointer; color: var(--ink); }
.st-ch-b .nd { position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line2); background: var(--bg); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 9.5px; color: var(--mut); }
.st-ch.done .nd { background: var(--ink); border-color: var(--ink); color: #fff; }
.st-ch.cur .nd { border-color: var(--red); color: var(--red); box-shadow: 0 0 0 4px var(--pink-t, #F7E3E3); }
.st-ch-b .t { display: block; font-family: var(--serif); font-size: 17px; line-height: 1.25; }
.st-ch.cur .st-ch-b .t { font-weight: 600; }
.st-ch-b .s { display: block; font-size: 12px; color: var(--mut); margin-top: 1px; }
.st-ch-b:hover .t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.st-ch .beats { margin: 8px 0 0 34px; padding: 0; list-style: none; font-size: 12.5px; }
.st-ch .beats button { display: inline-flex; gap: 8px; align-items: center; padding: 3px 0; color: var(--mut); background: none; border: 0; text-align: left; cursor: pointer; font: inherit; max-width: 100%; }
.st-ch .beats b { font-family: var(--mono); font-size: 10px; font-weight: 500; width: 22px; flex: none; }
.st-ch .beats li.past button { color: var(--mut2); }
.st-ch .beats li.on button { color: var(--ink); font-weight: 600; }
.st-ch .beats li.on button::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex: none; animation: st-pulse 1.4s infinite; }
.st-ch .beats button:hover { color: var(--ink); }
@keyframes st-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.st-closed { font-size: 12.5px; color: var(--mut); margin: 4px 0 10px; }
.st-foot { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.st-narr {
  position: fixed; z-index: 24; top: var(--topbar-h); left: calc(var(--story-left) + var(--story-spine)); right: 0; height: var(--story-narr);
  padding: 18px 22px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; font-family: var(--sans); color: var(--ink);
}
.st-narr .st-red { color: var(--red-d); }
.st-narr .line { font-family: var(--serif); font-size: 21px; line-height: 1.35; margin-top: 4px; max-width: 70ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-narr .ctl { display: flex; gap: 8px; padding-bottom: 6px; }

@media (max-width: 1100px) {
  html[data-story="on"] { --story-spine: 240px; --story-narr: 112px; }
  .st-narr .line { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .st-ch .beats li.on button::after { animation: none; } .st-prog i { transition: none; } }

/* ---------------- quiet entry points (home front door, My Work header) ---------------- */
.home-head .home-story { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill, 30px); border: 1px solid rgba(0,0,0,.14); background: transparent; color: var(--mut); font: 600 12px var(--sans); cursor: pointer; }
.home-head .home-story:hover { color: var(--ink); border-color: var(--ink); background: rgba(255,255,255,.5); }
.home-head .home-story svg { width: 11px; height: 11px; }
.page-head .wk-story { color: var(--mut); align-self: flex-end; }
.page-head .wk-story:hover { color: var(--ink); }
html[data-story-toc] .gd-root, html[data-story-toc] .gd-root * { visibility: hidden !important; }
