/* Shared centered banners for public collection tabs. */
.photos-page .page-intro,
.audio-page .page-intro,
.friends-page .page-intro,
.writing-page > .page-intro {
  min-height: 0;
  padding: 12px var(--pad) 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.photos-page .page-intro h1,
.audio-page .page-intro h1,
.friends-page .page-intro h1,
.writing-page > .page-intro h1,
.stats-page::before {
  margin: 0;
  font-size: clamp(34px, 5.2vw, 66px);
  line-height: .78;
  font-weight: 400;
  letter-spacing: -.065em;
}

.writing-page {
  padding-top: var(--header-height);
  display: grid;
  grid-template-rows: clamp(62px, 9vh, 92px) minmax(0, 1fr);
}
.writing-page > .published-story-list { min-height: 0; overflow: hidden; }
.writing-page > .story { display: none; }
.writing-page,
.writing-page * {
  font-family: Aptos, "Segoe UI", Helvetica, Arial, sans-serif !important;
}

.writing-chapter-index {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, .82fr) minmax(420px, 1.18fr);
  overflow: hidden;
}
.writing-chapter-statement {
  padding: clamp(28px, 4.5vh, 48px) var(--pad) clamp(56px, 8vh, 84px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  text-align: left;
}

body[data-active-tab="stats"][data-active-tab="stats"][data-active-tab="stats"] .book-support-banner:not([hidden]) {
  display: block !important;
}
body[data-active-tab="stats"] .stats-shell {
  grid-template-rows: auto auto;
  align-content: start;
  padding-bottom: 120px;
  overflow-y: auto;
}
body[data-active-tab="stats"] .hall-progress { align-self: start; }

/* Collection pages begin directly below the navigation, like Bio. */
.photos-page .page-intro,
.audio-page .page-intro,
.friends-page .page-intro,
.writing-page > .page-intro,
.stats-page::before {
  display: none !important;
}
.photos-page,
.audio-page,
body[data-active-tab="team"] .friends-page,
.writing-page,
body[data-active-tab="stats"] .stats-page {
  grid-template-rows: minmax(0, 1fr) !important;
}

/* Simple, bounded Audio presentation. */
.audio-page .audio-journal { padding: 0 var(--pad) 12px; }
.audio-page .audio-deck { position: relative; grid-template-rows: minmax(0, 1fr); }
.audio-page .audio-deck .deck-stage { height: 100%; }
.audio-page .deck-stage { cursor: default; }
.audio-page .audio-entry {
  width: min(920px, 100%);
  display: block;
  padding: clamp(24px, 5vh, 54px) 0;
}
.audio-page .audio-entry-main,
.audio-page .audio-entry.has-cover .audio-entry-main {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(320px, 1.2fr);
  gap: clamp(34px, 6vw, 76px);
  align-items: center;
}
.audio-page .audio-entry:not(.has-cover) .audio-entry-main {
  grid-template-columns: minmax(0, 620px);
  justify-content: center;
}
.audio-page .audio-cover-column {
  min-width: 0;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.audio-page .audio-entry-cover {
  width: min(100%, 380px);
  height: auto;
  max-height: min(48vh, 380px);
  aspect-ratio: 1;
}
.audio-page .audio-entry-copy header { display: block; }
.audio-page .audio-entry h2 {
  font-size: clamp(22px, 2.7vw, 34px);
  line-height: 1.08;
}
.audio-page .audio-entry-copy header time {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.audio-page .audio-player {
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 18px;
  margin-top: 24px;
}
.audio-page .audio-player > button { width: 48px; height: 48px; }
.audio-page .audio-waveform { height: 46px; }
.audio-deck-controls {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.audio-deck-controls button {
  position: absolute;
  top: 50%;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #555550;
  background: rgba(0,0,0,.82);
  color: var(--white);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transform: translateY(-50%);
}
.audio-deck-controls button:first-child { left: calc(10px - var(--pad)); }
.audio-deck-controls button:last-child { right: calc(10px - var(--pad)); }
.audio-deck-controls button span { margin: 0; }
.audio-deck-controls button:disabled { visibility: hidden; }
.audio-deck-controls button:not(:disabled):hover,
.audio-deck-controls button:not(:disabled):focus-visible {
  border-color: var(--white);
  outline: 0;
  background: var(--white);
  color: var(--black);
}

@media (max-width: 700px) {
  .audio-page .audio-journal { padding: 0 16px 8px; }
  .audio-page .audio-deck { grid-template-rows: minmax(0, 1fr); }
  .audio-deck-controls button:first-child { left: -8px; }
  .audio-deck-controls button:last-child { right: -8px; }
  .audio-page .audio-entry { padding: 18px 0; }
  .audio-page .audio-entry-main,
  .audio-page .audio-entry.has-cover .audio-entry-main {
    grid-template-columns: minmax(105px, .75fr) minmax(0, 1.25fr);
    grid-template-rows: 1fr;
    gap: 18px;
  }
  .audio-page .audio-entry-cover {
    width: 100%;
    max-height: none;
    align-self: center;
  }
  .audio-page .audio-entry h2 { font-size: clamp(18px, 5.5vw, 25px); }
  .audio-page .audio-player { grid-template-columns: 40px minmax(0, 1fr); gap: 10px; margin-top: 16px; }
  .audio-page .audio-player > button { width: 40px; height: 40px; }
  .audio-page .audio-waveform { height: 38px; }
}

/* Simple looping Photos presentation with comments beside the image. */
.photos-page .photo-journal { padding: 0 var(--pad) 12px; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.photos-page .photos-blurb { justify-self: center; margin: 0; padding: 18px 0 10px; color: #d8d7d2; font: italic clamp(12px, .9vw, 14px)/1.4 Georgia, "Times New Roman", serif; text-align: center; }
.photos-page .photo-deck { position: relative; grid-template-rows: minmax(0, 1fr); }
.photos-page .photo-deck .deck-stage { height: 100%; }
.photos-page .photo-entry {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vh, 44px) 0;
  display: grid;
  grid-template-columns: minmax(280px, 1.12fr) minmax(260px, .88fr);
  grid-template-rows: minmax(0, 1fr);
  gap: clamp(32px, 6vw, 82px);
}
.photos-page .photo-visual {
  min-width: 0;
  min-height: 0;
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
.photos-page .photo-entry .photo-frame {
  grid-column: 1;
  grid-row: 1;
}
.media-position {
  margin: 9px 0 0;
  color: #777771;
  font-size: 9px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
  letter-spacing: .08em;
}
.photos-page .photo-side {
  min-width: 0;
  min-height: 0;
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.photos-page .photo-entry figcaption {
  flex: 0 0 auto;
  display: block;
  padding: 0 0 18px;
}
.photos-page .photo-entry figcaption time {
  display: block;
  margin-top: 10px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.photos-page .photo-entry .inline-comments {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.photos-page .photo-comments-empty {
  margin: 0 0 14px;
  color: #73736e;
  font-style: italic;
}
.photos-page .photo-comments-content {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.photos-page .photo-comments-heading {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 0 0 10px;
  color: #8a8a84;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.photos-page .photo-comments-heading b { font-weight: 400; }
.photos-page .photo-comments-toggle { display: none; }
.photos-page .photo-comment-list {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: thin;
}
.photos-page .photo-comment-list p { display: grid; gap: 4px; padding-bottom: 14px; color: var(--white); }
.photos-page .photo-comment-list p b { display: block; color: var(--stats-accent, #d9bd45); font-weight: 500; }
.photos-page .photo-comment-list p span { display: block; color: #fff; }
.photos-page .photo-comment-form {
  position: relative;
  flex: 0 0 auto;
  align-items: stretch;
  margin-top: auto;
  padding-bottom: 28px;
}
.photos-page .photo-comment-form label { display: flex; flex-direction: column; }
.photos-page .photo-comment-form input,
.photos-page .photo-comment-form textarea {
  height: 32px;
  min-height: 32px;
  margin-top: auto;
  line-height: 18px;
}
.photos-page .photo-comment-form > button { align-self: end; }
.photos-page .photo-comment-status {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 0;
  color: #92928c;
  font-size: 10px;
  font-style: italic;
}
.photo-deck-controls {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.photo-deck-controls button {
  position: absolute;
  top: 50%;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #8b8b85;
  background: rgba(0,0,0,.94);
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transform: translateY(-50%);
}
.photo-deck-controls button:first-child { left: calc(10px - var(--pad)); }
.photo-deck-controls button:last-child { right: calc(10px - var(--pad)); }
.photo-deck-controls button span { margin: 0; }
.photo-deck-controls button:hover,
.photo-deck-controls button:focus-visible {
  border-color: var(--white);
  outline: 0;
  background: var(--white);
  color: var(--black);
}

@media (max-width: 700px) {
  .photos-page .photo-journal { padding: 0 16px 8px; }
  .photos-page .photo-deck { grid-template-rows: minmax(0, 1fr); }
  .photo-deck-controls button:first-child { left: -8px; }
  .photo-deck-controls button:last-child { right: -8px; }
  .photos-page .photo-entry {
    padding: 16px 0;
    grid-template-columns: minmax(110px, .82fr) minmax(0, 1.18fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 18px;
  }
  .photos-page .photo-entry .photo-frame,
  .photos-page .photo-visual,
  .photos-page .photo-side { grid-row: 1; }
  .photos-page .photo-entry figcaption { padding-bottom: 12px; }
  .photos-page .photo-entry figcaption strong { font-size: 15px; }
  .photos-page .photo-entry figcaption p { font-size: 10px; line-height: 1.4; }
}

/* Mobile Photos: full-width uncropped images with comments in a drawer below. */
@media (max-width: 700px) {
  .photos-page .photo-journal { min-height: 0; padding: 0 14px 8px; }
  .photos-page .photo-deck,
  .photos-page .photo-deck .deck-stage { min-height: 0; height: 100%; }
  .photos-page .photo-deck .deck-stage { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; cursor: default; }
  .photos-page .photo-entry {
    width: 100%;
    height: auto;
    min-height: 100%;
    padding: 10px 0 26px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 0;
  }
  .photos-page .photo-visual { grid-column: 1; grid-row: 1; display: block; }
  .photos-page .photo-entry .photo-frame {
    width: 100%;
    height: auto;
    min-height: 0;
    display: block;
    overflow: visible;
  }
  .photos-page .photo-entry .photo-frame img {
    position: static;
    width: 100%;
    height: auto;
    max-width: none;
    max-height: none;
    display: block;
    object-fit: contain;
    object-position: center;
  }
  .photos-page .media-position { margin: 8px 0 0; }
  .photos-page .photo-side { grid-column: 1; grid-row: 2; display: block; overflow: visible; }
  .photos-page .photo-entry figcaption { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 13px 0; }
  .photos-page .photo-entry figcaption time { grid-column: 2; grid-row: 1; margin: 2px 0 0; }
  .photos-page .photo-entry figcaption strong { font-size: 17px; }
  .photos-page .photo-entry figcaption p { margin-top: 5px; font-size: 11px; line-height: 1.45; }
  .photos-page .photo-entry .inline-comments { display: block; max-height: none; padding: 0; overflow: visible; font-size: 10px; }
  .photos-page .photo-comments-toggle { display: grid; }
  .photos-page .photo-comments-content { max-height: none; display: block; padding: 14px 0 4px; overflow: visible; }
  .photos-page .photo-comments-content[hidden] { display: none; }
  .photos-page .photo-comments-heading { display: none; }
  .photos-page .photo-comment-list { max-height: 38vh; overflow-y: auto; }
  .photos-page .photo-comment-form { padding-bottom: 28px; }
  .photos-page .photo-deck-controls button { top: min(42vh, 340px); }
}
.writing-chapter-statement p {
  width: 100%;
  max-width: 320px;
  margin: 0 0 1.15em;
  color: #d4d3ce;
  font-size: clamp(13px, 1.15vw, 16px);
  line-height: 1.5;
}
.writing-chapter-statement p:last-child { margin-bottom: 0; }
.writing-chapter-list {
  margin: 0;
  padding: clamp(28px, 5vh, 56px) var(--pad);
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}
.writing-chapter-list li { border-top: 1px solid var(--line); }
.writing-chapter-list li:last-child { border-bottom: 1px solid var(--line); }
.writing-chapter-list button {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border: 0;
  background: transparent;
  color: #d8d7d2;
  font-size: clamp(17px, 1.7vw, 23px);
  line-height: 1.25;
  font-weight: 400;
  letter-spacing: -.045em;
  text-align: left;
  cursor: pointer;
  transition: color .2s, transform .2s;
}
.writing-chapter-title { min-width: 0; font-family: var(--story-title-font, Aptos, "Segoe UI", sans-serif) !important; }
.story-library .library-item strong { font-family: var(--story-title-font, Aptos, "Segoe UI", sans-serif) !important; }
.writing-chapter-list .chapter-tier-badge { width: auto; margin: 0; justify-self: end; color: #aaa9a2; letter-spacing: .08em; }
.writing-chapter-list button:hover,
.writing-chapter-list button:focus-visible {
  outline: 0;
  color: var(--white);
  transform: translateX(6px);
}
.writing-chapter-empty { color: var(--muted); }

body[data-active-tab="team"] .friends-page { grid-template-rows: clamp(62px, 9vh, 92px) minmax(0, 1fr); }
body[data-active-tab="team"] .friends-page .page-intro {
  min-height: 0;
  padding: 12px var(--pad) 10px;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}
body[data-active-tab="team"] .friends-page .page-intro h1 {
  font-size: clamp(34px, 5.2vw, 66px);
  line-height: .78;
  letter-spacing: -.065em;
}
body[data-active-tab="team"] .friends-page .page-intro p { display: none; }

.stats-page { padding-top: var(--header-height); }
.stats-page::before {
  content: "Stats";
  height: clamp(62px, 9vh, 92px);
  padding: 12px var(--pad) 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

/* Keep the Audio slide and its related image compact as a single unit. */
.audio-page .audio-entry {
  width: min(900px, 88%);
  padding-top: clamp(12px, 2.5vh, 28px);
  padding-bottom: clamp(12px, 2.5vh, 28px);
}
.audio-page .audio-entry.has-cover .audio-entry-main {
  grid-template-columns: minmax(180px, .68fr) minmax(0, 1.32fr);
  gap: clamp(24px, 3.5vw, 46px);
}
.audio-page .audio-entry-cover {
  height: min(38vw, 100%);
  max-height: min(44vh, 400px);
}

/* Match the bottom support banner to the compact black banner system. */
body:not([data-active-tab="admin"]) .book-support-banner:not(.is-collapsed):not([hidden]) {
  display: grid !important;
  align-items: center;
  min-height: clamp(62px, 9vh, 92px);
  padding: 14px 52px;
  border-color: #393936;
  background: rgba(12,12,11,.96);
  color: var(--white);
}

.book-support-banner .book-support-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.book-support-banner .book-support-content[hidden] { display: none; }
.book-support-banner .book-support-copy { min-width: 0; }
.book-support-banner .book-support-copy span { color: var(--muted); }
.book-support-banner .book-support-content > button {
  grid-column: 2;
  justify-self: center;
  align-self: center;
  border-color: var(--white) !important;
  background: var(--white) !important;
  color: var(--black) !important;
}
.book-support-banner .book-support-content > button:hover,
.book-support-banner .book-support-content > button:focus-visible {
  border-color: var(--white) !important;
  background: transparent !important;
  color: var(--white) !important;
}

.book-support-banner .book-support-collapse {
  top: 50%;
  right: 10px;
  width: 26px;
  height: 26px !important;
  padding: 0 !important;
  border: 1px solid #555550 !important;
  background: transparent !important;
  color: var(--white) !important;
  font-size: 16px;
  line-height: 1;
  transform: translateY(-50%);
}
.book-support-banner .book-support-collapse span { margin: 0; }
.book-support-banner .book-support-collapse:hover,
.book-support-banner .book-support-collapse:focus-visible {
  border-color: var(--white) !important;
  background: var(--white) !important;
  color: var(--black) !important;
}
.book-support-banner .book-support-sign {
  border-color: #555550 !important;
  background: var(--black) !important;
  color: var(--white) !important;
}
.book-support-banner .book-support-sign > span {
  background: var(--white);
  color: var(--black);
}

body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) #photos,
body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) #audio,
body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) #team,
body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) #writing {
  height: calc(100svh - clamp(62px, 9vh, 92px));
}

body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) #writing {
  height: 100svh;
}
body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) .writing-chapter-list {
  padding-bottom: 120px;
}

@media (max-width: 700px) {
  .photos-page .page-intro,
  .audio-page .page-intro,
  .friends-page .page-intro,
  .writing-page > .page-intro { padding: 9px 18px; }
  .photos-page .page-intro h1,
  .audio-page .page-intro h1,
  .friends-page .page-intro h1,
  .writing-page > .page-intro h1,
  .stats-page::before { font-size: 35px; }
  .writing-page { grid-template-rows: 58px minmax(0, 1fr); }
  .writing-chapter-index { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .writing-chapter-statement {
    padding: 24px 22px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .writing-chapter-statement p { margin: 0; font-size: 13px; line-height: 1.4; }
  .writing-chapter-list { padding: 10px 22px 28px; }
  .writing-chapter-list button { min-height: 44px; font-size: 17px; }
  .stats-page::before { height: 58px; padding: 9px 18px; }
  body[data-active-tab="team"] .friends-page { grid-template-rows: 58px minmax(0, 1fr); }
  body[data-active-tab="team"] .friends-page .page-intro { padding: 9px 18px; }
  body[data-active-tab="team"] .friends-page .page-intro h1 { font-size: 35px; }
  .audio-page .audio-entry { width: min(520px, 100%); }
  .audio-page .audio-entry.has-cover .audio-entry-main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
  }
  .audio-page .audio-entry-cover {
    width: min(100%, 28vh);
    height: auto;
    max-height: 28vh;
  }
}

@media (max-width: 900px) {
  body:not([data-active-tab="admin"]) .book-support-banner:not(.is-collapsed):not([hidden]) {
    min-height: 0;
    padding: 20px 48px;
  }
  .book-support-banner .book-support-content { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .book-support-banner .book-support-content > button { grid-column: 1; }
  .book-support-banner .book-support-copy { display: block; text-align: center; }
  .book-support-banner .book-support-collapse { top: 10px; transform: none; }
}

@media (max-width: 700px) {
  body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) #photos,
  body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) #audio,
  body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) #team,
  body:not([data-active-tab="admin"]):has(.book-support-banner:not(.is-collapsed):not([hidden])) #writing { height: 100svh; }
}

/* Compact writing entries keep the full title available on narrow screens. */
.writing-chapter-list li { overflow-x: auto; }
.writing-chapter-list button { display: flex; width: max-content; min-width: 100%; gap: 8px; }
.writing-chapter-title { flex: none; white-space: nowrap; }
.writing-chapter-meta { flex: none; color: #aaa9a2; font: 400 13px/1.5 Aptos, "Segoe UI", sans-serif; letter-spacing: 0; white-space: nowrap; }
.writing-reader-page > header.single-line-title { width: min(var(--story-title-measure, 588px), calc(100% - 48px)); }
.writing-reader-page > header.single-line-title h1 { padding: .25em 0; white-space: nowrap; overflow-x: auto; overflow-y: hidden; }
.document-sheet .single-line-title .title-input { white-space: nowrap; overflow-x: auto; overflow-y: hidden; }
.document-sheet .story-title-field.single-line-title { width: 100%; }
.writing-publication-date { color: var(--muted); font-size: 13px; }
.chapter-publishing-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; padding: 12px 20px; border-bottom: 1px solid #d4d4ce; background: #f5f5f1; color: #353630; font: 12px/1.5 Aptos, "Segoe UI", sans-serif; }
.chapter-publishing-settings label { display: flex; align-items: center; gap: 8px; }
.chapter-publishing-settings input[type="date"] { padding: 5px; border: 1px solid #bcbdb5; border-radius: 4px; color: #353630; background: white; }
.chapter-library-row { border-bottom: 1px solid var(--line); }
.chapter-library-row .library-item { border-bottom: 0; }
.chapter-library-controls { display: flex; justify-content: flex-end; gap: 6px; padding: 0 14px 10px; }
.chapter-library-controls button { padding: 4px 8px; border: 1px solid #cdcdc7; border-radius: 4px; background: transparent; color: inherit; cursor: pointer; font-size: 11px; }
.chapter-library-controls button:disabled { opacity: .35; cursor: default; }
.sidebar-collapsed .chapter-library-row { display: none; }
.story-body figure:has(audio), .story-content-editor figure:has(audio) { padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.story-body audio, .story-content-editor audio { display: block; width: 100%; max-width: 100%; }
.story-editor .format-toolbar { max-height: none; }

.book-purchase-card { margin: 24px 0; padding: 22px; border: 1px solid var(--line); border-radius: 10px; }
.book-purchase-card h3 { margin: 0 0 10px; font-size: 24px; }
.book-purchase-card p { line-height: 1.5; }
.book-purchase-card form { display: grid; gap: 12px; }
.book-purchase-card label { display: grid; gap: 6px; }
.book-purchase-card input { width: 100%; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 4px; color: inherit; background: transparent; font: inherit; }
.book-purchase-card button, .book-download { display: inline-block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 4px; color: #171815; background: #e4cb79; text-decoration: none; cursor: pointer; }
.book-purchase-card .book-store-note { margin: 0; font-size: 12px; color: var(--muted); }
.book-purchase-card [role="status"] { font-size: 14px; }
[data-book-editor] { margin-bottom: 24px; }
[data-book-upload-form] { display: grid; gap: 14px; margin: 18px 0; }
/* Support keeps memberships and the donation option in one screen. */
body[data-active-tab="support"] { height: 100svh; overflow: hidden; }
body[data-active-tab="support"] .toast:not(.show) { transform: none; }
body[data-active-tab="support"] .site-footer,
body[data-active-tab="support"] .book-support-banner { display: none !important; }
body[data-active-tab="support"] #support { height: 100svh; min-height: 0; overflow: hidden; animation: none; }
#support .support-shell {
  height: 100%; min-height: 0; align-content: center; gap: 0;
  padding: clamp(20px, 4svh, 48px) var(--pad);
}
#support .membership-section { min-height: 0; padding: 0; }
#support .membership-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#support .membership-grid article { min-width: 0; min-height: 280px; }
.donation-card form { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.donation-amount { display: block; margin: 18px 0 14px; }
.donation-amount > span { display: block; margin-bottom: 6px; color: #989892; font-size: 10px; }
.donation-amount > div { display: flex; align-items: center; gap: 8px; }
.donation-amount b { font: 32px Georgia, "Times New Roman", serif; font-weight: 400; }
.donation-amount input { width: 100%; min-width: 0; padding: 7px 10px; border: 1px solid #4b4b46; background: #11110f; color: var(--white); font: 24px Georgia, "Times New Roman", serif; }
.donation-card form button { width: 100%; }
@media (max-width: 700px) {
  #support .support-shell { padding: 12px 18px; }
  #support .membership-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #support .membership-grid article {
    min-height: 0; padding: 12px 16px; display: grid;
    grid-template-columns: minmax(80px, .65fr) minmax(0, 1.35fr);
    grid-template-areas: "name benefits" "price benefits" "action action";
    gap: 4px 14px;
  }
  #support .membership-grid article > p { grid-area: name; align-self: end; }
  #support .membership-grid h3 { grid-area: price; margin: 0; font-size: 28px; line-height: 1.2; }
  #support .membership-grid h3 small { display: block; font-size: 9px; }
  #support .membership-benefits { grid-area: benefits; align-self: center; margin: 0; gap: 4px; font-size: 11px; line-height: 1.3; }
  #support .membership-grid button { grid-area: action; height: 36px; margin-top: 6px; padding: 0 12px; }
  #support .donation-card form { display: contents; }
  #support .donation-amount { grid-area: price; margin: 0; }
  #support .donation-amount > span { margin-bottom: 2px; font-size: 9px; }
  #support .donation-amount b { display: none; }
  #support .donation-amount input { padding: 4px 6px; font-size: 24px; }
}
@media (max-height: 540px) and (min-width: 701px) {
  #support .membership-grid article { min-height: 0; padding: 16px; }
  #support .membership-grid h3 { margin: 8px 0; }
  #support .membership-benefits { margin-bottom: 12px; gap: 4px; font-size: 11px; }
  #support .membership-grid button { height: 36px; }
}

.book-purchase-card form[hidden] { display: none; }
.book-download { margin-bottom: 10px; }

/* Reveal continuation at the end without resizing the reading viewport. */
.writing-reader-scroll { position: relative; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; overflow-anchor: auto; scrollbar-width: thin; }
.writing-reader-scroll > .writing-reader-page { min-height: 100%; overflow: visible; }
.writing-reader.has-next-story { position: relative; grid-template-rows: 48px minmax(0, 1fr); }
.writing-reader.has-next-story .writing-reader-scroll > .writing-reader-page { min-height: 0; }
.writing-reader-navigation { display: flex; align-items: center; gap: 22px; }
.writing-reader-navigation button { padding: 8px 0; border: 0; background: transparent; color: var(--white); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; cursor: pointer; white-space: nowrap; }
.writing-next-dock { display: none; position: absolute; bottom: 0; left: 0; right: 0; z-index: 2; padding: 12px max(24px, calc((100% - 680px) / 2)) max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #10100f; }
.writing-next-dock[hidden] { display: none; }
.writing-next-dock button { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 5px 18px; width: 100%; min-height: 72px; padding: 14px 20px; overflow: hidden; border: 1px solid #e4e0d5; border-radius: 8px; background: #e4e0d5; color: #151510; text-align: left; cursor: pointer; }
.writing-next-dock button::before { content: ''; position: absolute; inset: 0; z-index: -1; background: #d9bd45; transform: scaleX(var(--pull-progress, 0)); transform-origin: left; }
.writing-next-dock button:hover { background: #f5f1e9; }
.writing-next-label { font-size: 12px; font-weight: 600; }
.writing-next-dock strong { grid-column: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: 16px; line-height: 1.3; font-weight: 400; }
.writing-next-arrow { grid-column: 2; grid-row: 1 / 3; align-self: center; justify-self: end; width: 36px; }
.writing-next-arrow svg { display: block; width: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.writing-next-arrow path { animation: reading-chevron 2.6s ease-in-out infinite; }
.writing-next-arrow path + path { animation-delay: .16s; opacity: .45; }
@keyframes reading-chevron { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .writing-next-arrow path { animation: none; } }
.writing-next-dock [data-reader-pull-hint] { display: none; margin: 9px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.writing-next-dock[data-pull-ready] [data-reader-pull-hint] { color: #e4cb79; }
.writing-reading-end { width: min(var(--story-body-measure, 588px), calc(100% - 48px)); margin: 0 auto; padding: 32px 0 60px; border-top: 1px solid var(--line); }
.writing-reading-end p { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.writing-reading-end button { min-height: 48px; padding: 10px 0; border: 0; background: none; color: var(--white); text-decoration: underline; text-underline-offset: 5px; cursor: pointer; }
.writing-author-credit { margin-top: 28px; }
.writing-author-credit .byline { margin: 0; color: var(--muted); font: 14px/1.6 Aptos, "Segoe UI", sans-serif; }
.writing-reader-scroll:focus-visible, .writing-reader-navigation button:focus-visible { outline: 1px solid var(--white); outline-offset: -2px; }
.writing-next-dock button:focus-visible { outline: 3px solid #d9bd45; outline-offset: 3px; }
.writing-reader-page h1:focus { outline: none; }
/* Reading controls must not be covered by the floating signup prompt. */
body[data-active-tab="writing"]:has([data-writing-reader]) .book-support-banner:not([hidden]) { display: none !important; }
body[data-active-tab="writing"] #writing:has([data-writing-reader]) { height: 100svh !important; }
@media (pointer: coarse) { .writing-next-dock [data-reader-pull-hint] { display: block; } }
@media (max-width: 700px) {
  .writing-next-dock:not([hidden]) { display: block; }
  .writing-reader.has-next-story .writing-reader-scroll { padding-bottom: calc(142px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) { .writing-reader-navigation { gap: 12px; }.writing-reader-navigation button { font-size: 8px; letter-spacing: .02em; }.writing-reader-header { gap: 8px; }.writing-reader.has-next-story { grid-template-rows: 42px minmax(0, 1fr); }.writing-next-dock { padding: 10px 16px max(12px, env(safe-area-inset-bottom)); }.writing-next-dock button { min-height: 72px; padding: 12px 16px; } }
.writing-chapter-list li { scrollbar-width: none; }
.writing-chapter-list li::-webkit-scrollbar { display: none; }
.playlist-source { display: block; width: fit-content; margin-top: 3px; font-size: 9px; color: var(--muted); text-decoration: none; }
.playlist-source:hover { color: var(--white); text-decoration: underline; }
.playlist-source[hidden], .playlist-source-settings [hidden] { display: none; }
.playlist-link-form { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; align-items: end; gap: 16px; margin-bottom: 28px; }
.playlist-link-form small, .playlist-link-form [role="status"] { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.playlist-source-settings { display: grid; gap: 12px; }
@media (max-width: 700px) { .playlist-link-form { grid-template-columns: 1fr; } }
