/* Subscriber stories: reading layout on top of site.css */
.story-title { font-family: var(--display); font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.15; margin-bottom: 1rem; }
.story-section { font-family: var(--display); font-size: 1.5rem; margin: 2.6rem 0 1rem; color: var(--rose); }
.story-sub { font-family: var(--display); font-size: 1.2rem; margin: 2rem 0 .8rem; }
.story p { margin-bottom: 1.15rem; line-height: 1.8; }
.story hr.scene { border: 0; text-align: center; margin: 2.2rem 0; }
.story hr.scene::after { content: "\25C6"; color: var(--dusk); font-size: .8rem; }
.story-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.catalog, .titles { list-style: none; }
.catalog > li { padding: 1.3rem 0; border-bottom: 1px solid var(--line); }
.cat-title { font-family: var(--display); font-size: 1.4rem; font-weight: 600; text-decoration: none; }
.cat-summary { color: var(--dusk); margin-top: .4rem; }
.titles li { color: var(--dusk); padding: .2rem 0; }
.signup label[for="email"] { color: var(--dusk); }
.signout { display: inline; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--rose); cursor: pointer; text-decoration: underline; }
.linkbtn:hover { color: var(--bone); }
.site-nav .signout { margin-left: .4rem; padding-left: 1.2rem; border-left: 1px solid var(--line); }

/* Whole catalog block is clickable */
.catalog > li { position: relative; padding-left: .8rem; padding-right: .8rem; margin: 0 -.8rem; transition: background .15s; }
.catalog > li:hover { background: var(--velvet); }
.cat-title::after { content: ""; position: absolute; inset: 0; }

/* Story pictures: a thumbnail beside the title; a tap opens the lightbox (the dialog styled in site.css) instead of the story */
.cat-pic { position: relative; z-index: 2; float: left; width: 5.2rem; padding: 0; margin: .15rem 1rem .4rem 0; border: 0; background: none; line-height: 0; cursor: zoom-in; }
.cat-thumb { display: block; width: 100%; height: auto; border-radius: 4px; }
.catalog > li.hasimg::after { content: ""; display: block; clear: both; }
dialog.portrait-dialog img { max-width: 100%; max-height: calc(100dvh - 6rem); object-fit: contain; }
dialog.portrait-dialog .pic-title { width: 0; min-width: 100%; box-sizing: border-box; margin: 0 0 .6rem; padding: 0 2.8rem; text-align: center; font-family: var(--display); font-size: 1.3rem; line-height: 1.2; color: var(--bone); }
dialog.portrait-dialog .pic-close { position: absolute; top: .6rem; right: .6rem; width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: rgba(13,10,15,.8); color: var(--bone); font-size: 1.6rem; line-height: 1; cursor: pointer; }
dialog.portrait-dialog .pic-close:hover { border-color: var(--rose); color: #fff; }

/* Reader bar and page view */
.readerbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem 1rem; margin: .6rem 0 1.2rem; color: var(--dusk); }
.readerbar[hidden] { display: none; }
.pager { width: 100%; }
body.paged .pager { overflow: hidden; overscroll-behavior-x: none; touch-action: pan-y; cursor: pointer; user-select: none; -webkit-user-select: none; }
body.paged .story-nav, body.paged .signout-bottom, body.paged .site-footer { display: none; }
body.paged main.section { padding: 1.4rem 0 0; }
body.paged .story .story-title, body.paged .story .story-section { break-after: avoid; }
body.paged .story p { orphans: 2; widows: 2; }

/* Round arrows beside the page, like the book previews on the main page */
.pagerwrap { position: relative; }
.pgnav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; display: none;
  width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(13,10,15,.8); color: var(--bone); font-size: 1.3rem; line-height: 1; cursor: pointer; place-items: center;
}
body.paged .pgnav { display: grid; }
body.paged .pgnav[hidden] { display: none; }
.pgnav:hover { border-color: var(--rose); color: #fff; }
.pgnav.prev { left: .2rem; }
.pgnav.next { right: .2rem; }
@media (min-width: 960px) { .pgnav.prev { left: -3.6rem; } .pgnav.next { right: -3.6rem; } }
body.paged .story { will-change: transform; }
#pageind { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem .8rem; }

/* No browser back/forward swipe while paging */
html.paged, html.paged body { overscroll-behavior-x: none; }

/* Reading frame and the story title in the bar */
.readframe { border: 1px solid var(--line); border-radius: 6px; background: var(--velvet); padding: 1.1rem 1.5rem; }
.bar-title { flex: 1 1 0; min-width: 0; text-align: center; font-family: var(--display); font-weight: 600; font-size: 1.6rem; line-height: 1.2; color: var(--bone); background: none; border: 0; padding: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-title:hover { color: var(--rose); }
@media (max-width: 600px) {
  .readframe { padding: .8rem 1rem; }
  .bar-title { order: 3; flex-basis: 100%; }
}

/* Story hop pills and the page-number jump */
.storypill { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .1rem .85rem; font-size: .95rem; color: var(--dusk); text-decoration: none; background: rgba(13,10,15,.8); white-space: nowrap; }
.storypill:hover { border-color: var(--rose); color: var(--bone); }
.pagejump { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: .22em; text-decoration-color: var(--line); }
.pagejump:hover { color: var(--bone); text-decoration-color: var(--rose); }
.pageinput { width: 4.4rem; background: var(--ink); color: var(--bone); border: 1px solid var(--rose); border-radius: 4px; font: inherit; padding: 0 .4rem; text-align: center; }

/* Quote blocks (logs, notes) and centered ornaments inside stories */
.story blockquote { margin: 1.5rem 0; padding: .1rem 0 .1rem 1.1rem; border-left: 2px solid var(--line); color: var(--dusk); }
.story blockquote p { margin-bottom: .55rem; font-size: .97rem; line-height: 1.6; }
.story p.ornament { text-align: center; color: var(--dusk); margin: 1.8rem 0; }

/* Cursor: hidden while reading, closed hand while dragging */
body.nocursor, body.nocursor * { cursor: none !important; }
body.dragging, body.dragging * { cursor: grabbing !important; }

/* Phones: reading page gets one slim bar instead of the site header, no checkbox, no round arrows */
.phonebar { display: none; }
@media (max-width: 640px) {
  body.reading .site-header, body.reading .toprow { display: none !important; }
  body.reading main.section, body.reading.paged main.section { padding: .5rem 0 0; }
  body.reading .wrap { padding: 0 .8rem; }
  .phonebar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .2rem 0 .5rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; font-size: 1rem; }
  .phonebar .signout { margin-left: auto; }
  body.reading .readerbar { justify-content: center; margin: .2rem 0 .6rem; gap: .2rem; }
  body.reading .bar-title { order: 1; flex-basis: 100%; font-size: 1.2rem; }
  body.reading #pageind { order: 2; justify-content: center; font-size: .95rem; }
  body.reading .readframe { padding: .7rem .8rem; border-radius: 4px; }
  /* small, faint side arrows over the page edges so the text under them stays readable */
  .pgnav { width: 2rem; height: 2rem; font-size: 1.05rem; border: 0; color: rgba(232,226,230,.8); background: rgba(232,226,230,.22); }
  .pgnav:active { background: rgba(232,226,230,.4); }
  .pgnav.prev { left: .1rem; }
  .pgnav.next { right: .1rem; }
}

/* Text size scales with the article's font-size, so headings and quotes inside it use em */
.story .story-title { font-size: clamp(1.7em, 4vw, 2.35em); }
.story .story-section { font-size: 1.26em; }
.story .story-sub { font-size: 1.01em; }
.story blockquote p { font-size: .82em; }

/* Font and size panel */
.readerbar { position: relative; }
.leftctl { display: inline-flex; align-items: center; gap: .9rem; }
.fontbtn { background: rgba(13,10,15,.8); color: var(--dusk); border: 1px solid var(--line); border-radius: 999px; font: inherit; font-size: .95rem; padding: .05rem .8rem; cursor: pointer; }
.fontbtn:hover, .fontbtn[aria-expanded="true"] { border-color: var(--rose); color: var(--bone); }
.fontpanel { position: absolute; left: 0; top: 100%; z-index: 6; width: 21rem; max-width: 100%; margin-top: .3rem; padding: .8rem 1rem; background: var(--velvet); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.fontpanel[hidden] { display: none; }
.fp-row { display: flex; align-items: center; gap: .7rem; margin: .45rem 0; }
.fp-label { width: 2.8rem; color: var(--dusk); font-size: .9rem; }
.fp-val { min-width: 3.2rem; text-align: center; }
.fp-btn { background: rgba(13,10,15,.8); color: var(--bone); border: 1px solid var(--line); border-radius: 999px; font: inherit; padding: .1rem .9rem; cursor: pointer; }
.fp-btn:hover:not(:disabled) { border-color: var(--rose); }
.fp-btn:disabled { opacity: .35; cursor: default; }
.fp-fonts { align-items: flex-start; }
.fp-list { display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.fp-font { text-align: left; background: none; color: var(--bone); border: 1px solid var(--line); border-radius: 999px; font-size: 1.05rem; padding: .15rem .9rem; cursor: pointer; }
.fp-font:hover { border-color: var(--rose); }
.fp-font[aria-pressed="true"] { border-color: var(--rose); background: var(--wine); }
@media (max-width: 640px) {
  body.reading .leftctl { order: 2; }
  body.reading #pageind { order: 3; }
  .fontpanel { right: 0; width: auto; }
  /* phone bar links as rounded buttons */
  .phonebar a, .phonebar .linkbtn { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .95rem; font: inherit; font-size: 1rem; color: var(--dusk); text-decoration: none; background: rgba(13,10,15,.8); white-space: nowrap; }
  .phonebar a:hover, .phonebar .linkbtn:hover { border-color: var(--rose); color: var(--bone); }
  .phonebar { border-bottom: 0; }
}

/* Font names shown in their own faces (inline style attributes are blocked by the page's CSP) */
.fp-font[data-font="eb"] { font-family: 'EB Garamond', Georgia, serif; }
.fp-font[data-font="georgia"] { font-family: Georgia, serif; }
.fp-font[data-font="lora"] { font-family: Lora, Georgia, serif; }
.fp-font[data-font="atkinson"] { font-family: 'Atkinson Hyperlegible', sans-serif; }
.fp-font[data-font="system"] { font-family: system-ui, sans-serif; }

/* Cancel / Apply, Source Sans 3, larger top line on laptops */
.fp-actions { margin-top: .8rem; }
.fp-gap { flex: 1; }
.fp-apply { border-color: var(--rose); background: var(--wine); }
.fp-font[data-font="source"] { font-family: 'Source Sans 3', sans-serif; }
@media (min-width: 641px) { .fine.toprow { font-size: 1.15rem; } }

/* Content notes: pill on the catalog title line and beside the title in the reader */
.catalog li.hasnote .cat-title { display: block; padding-right: 7.6rem; }
.cat-note > summary { position: absolute; top: 1.25rem; right: .8rem; z-index: 2; list-style: none; cursor: pointer; background: rgba(13,10,15,.8); color: var(--dusk); border: 1px solid var(--line); border-radius: 999px; font-size: .95rem; padding: .05rem .8rem; }
.cat-note > summary::-webkit-details-marker { display: none; }
.cat-note > summary:hover, .cat-note[open] > summary { border-color: var(--rose); color: var(--bone); }
.note-body { position: relative; z-index: 2; margin-top: .9rem; padding: .2rem 0 .1rem 1rem; border-left: 2px solid var(--line); }
.note-body h3, .notepanel h3 { font-family: var(--body); font-weight: 500; font-size: 1rem; margin: .9rem 0 .3rem; color: var(--bone); }
.note-body ul, .notepanel ul { padding-left: 1.2rem; color: var(--dusk); font-size: .97rem; }
.note-body li, .notepanel li { margin-bottom: .35rem; }
.note-body p, .notepanel p { color: var(--dusk); font-size: .97rem; margin-top: .6rem; }
.titlerow { display: flex; align-items: center; gap: .7rem; flex: 1 1 0; min-width: 0; }
.notepanel { position: absolute; right: 0; top: 100%; z-index: 6; width: 24rem; max-width: 100%; max-height: 70vh; overflow-y: auto; margin-top: .3rem; padding: .6rem 1rem .8rem; background: var(--velvet); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.notepanel[hidden] { display: none; }
.notebtn { flex: none; white-space: nowrap; }
@media (max-width: 640px) {
  body.reading .titlerow { order: 1; flex-basis: 100%; }
  body.reading .titlerow .bar-title { flex: 1 1 0; order: 0; }
  .notepanel { left: 0; width: auto; }
}

/* Tidy-up from the first phone/laptop look: compact bullets in catalog notes, sign-out as a pill beside the wordmark, title flush left */
.note-body ul, .notepanel ul { list-style: disc; }
.bar-title { text-align: left; }

/* Laptop page view: the bar is crowded on the first and last page (story-hop links), where the story's own heading is on the page anyway.
   Hidden, not removed, so the bar keeps its height and the page frame does not move. The content note shows on page one only. */
@media (min-width: 641px) {
  body.paged .readerbar.at-first .bar-title, body.paged .readerbar.at-last .bar-title { visibility: hidden; }
  body.paged .readerbar:not(.at-first) .notebtn { display: none; }
}
.site-nav .linkbtn { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .9rem; text-decoration: none; color: var(--dusk); background: rgba(13,10,15,.8); }
.site-nav .linkbtn:hover { border-color: var(--rose); color: var(--bone); }
@media (max-width: 640px) {
  .site-header .wrap { position: relative; }
  .site-nav .signout { position: absolute; top: 1.05rem; right: 1.5rem; margin: 0; padding: 0; border: 0; }
}

/* Admin Edit link in the reader bar */
a.fontbtn { display: inline-block; text-decoration: none; }
