/*
 * Zyrenicus Fictioneer chapter compatibility — final chapter-page authority.
 *
 * This file preserves Fictioneer-owned behaviour while protecting the bespoke
 * chapter UI across reader settings, narrow widths, colour modes, accessibility
 * preferences, and print. Section order is deliberate.
 */

/* ==========================================================================
   FUNCTIONAL AND INTERACTION SAFEGUARDS
   ========================================================================== */
/* Zyrenicus Fictioneer usability hardening v1.49.0.
 * A final, deliberately narrow compatibility layer. It preserves Fictioneer's
 * functional containers and hooks, enlarges touch targets, and simplifies only
 * decorative bespoke elements when the actual chapter panel becomes cramped.
 */

/* Hide the parent site's visual identity on chapter pages without removing the
 * entire header element. Fictioneer and plugins may attach useful output to the
 * header hook before the content block. Empty header shells collapse naturally. */
body.single-fcn_chapter.zy-cohesion-view :is(.header, .top-header) {
  display: block !important;
  min-height: 0 !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

body.single-fcn_chapter.zy-cohesion-view :is(.header__title, .top-header__title) {
  display: none !important;
}

/* Let keyboard focus remain visibly outside bespoke rounded surfaces. */
body.single-fcn_chapter.zy-cohesion-view :is(
  .chapter__actions a,
  .chapter__actions button,
  .zy-chapter-constellation__link,
  .zy-chapter-audio button,
  .zy-chapter-audio a
):focus-visible {
  outline: 2px solid rgba(255, 226, 160, 0.68) !important;
  outline-offset: 3px !important;
}

/* Coarse pointers need usable hit areas even when the visible ornament stays
 * compact. These rules also apply to a narrow panel on a desktop browser. */
@media (hover: none), (pointer: coarse) {
  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(
    .button,
    a.button,
    button,
    .popup-menu-toggle,
    .zy-chapter-cosmos-toggle
  ) {
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding-block: 0.45rem !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(.button, a.button) {
    min-height: 44px !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__link {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    touch-action: manipulation;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__node {
    scroll-snap-align: center;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__viewport {
    scroll-snap-type: x proximity;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__play {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }


  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__range {
    height: 32px;
  }
}

/* Panel-responsive simplification. The chapter map remains functional, but its
 * decorative line drawing and secondary facts disappear before they crowd the
 * actual chapter controls. */
@container zy-reader (max-width: 560px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cosmos-toggle {
    display: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__lines,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__viewport::before,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__viewport::after {
    display: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__viewport {
    mask-image: none !important;
    -webkit-mask-image: none !important;
  }
}

@container zy-reader (max-width: 480px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__facts,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__eyebrow {
    display: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__header {
    display: flex;
    justify-content: center;
    margin-bottom: 0.15rem;
    text-align: center;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__meta {
    margin: 0;
    white-space: normal;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__readout {
    min-height: 0;
    padding-block: 0.28rem;
  }

}

/* Viewport fallbacks for browsers/settings where the named container is not
 * active, and for genuine phone layouts outside the standard chapter shell. */
@media (max-width: 560px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cosmos-toggle {
    display: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__lines,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__viewport::before,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__viewport::after {
    display: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__viewport {
    mask-image: none !important;
    -webkit-mask-image: none !important;
  }
}

@media (max-width: 480px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__facts,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__eyebrow {
    display: none !important;
  }
}

/* On a short landscape phone the cinematic still consumes most of the usable
 * viewport. Omit that optional artwork while retaining title, map, audio and all
 * reading controls. */
@media (orientation: landscape) and (max-height: 480px) and (max-width: 920px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cinematic {
    display: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-visual-rail {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__link,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-nav-button,
  body.single-fcn_chapter.zy-cohesion-view .chapter__actions :is(a, button) {
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  body.single-fcn_chapter.zy-cohesion-view :is(.header, .top-header) {
    display: none !important;
  }
}

/* ==========================================================================
   TYPOGRAPHY ISOLATION
   ========================================================================== */
/* Zyrenicus Fictioneer typography compatibility v1.49.2.
 *
 * Pass 3 ownership rule:
 * - Fictioneer remains the sole owner of prose font family, size, weight,
 *   letter spacing, line height, paragraph spacing, alignment, and indentation.
 * - Bespoke chapter UI uses its own stable interface typography so extreme
 *   reader settings do not leak into controls or become constrained by fixed
 *   heights and one-line assumptions.
 */

body.single-fcn_chapter.zy-cohesion-view {
  --zy-ui-font: "Lato", var(--ff-base, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  --zy-ui-display-font: "Cinzel", Georgia, serif;
}

/* Isolate child-owned interface components from Fictioneer's prose settings.
 * Keep sizing in rem so browser zoom and user agent text scaling still work. */
body.single-fcn_chapter.zy-cohesion-view :is(
  .zy-chapter-visual-wrapper,
  .zy-chapter-constellation,
  .zy-chapter-audio,
  .zy-chapter-cosmos-toggle,
  .zy-chapter-utility-lane,
  .zy-chapter-footer-whisper,
  .zy-chapter-nav-button
) {
  font-family: var(--zy-ui-font);
  font-size: 1rem;
  font-style: normal;
  font-variant: normal;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: normal;
  text-indent: 0;
}

body.single-fcn_chapter.zy-cohesion-view :is(
  .zy-chapter-constellation__eyebrow,
  .zy-chapter-audio__label,
  .zy-chapter-cosmos-toggle__label,
  .zy-chapter-nav-button__eyebrow
) {
  font-family: var(--zy-ui-display-font);
}

/* Long Fictioneer identity strings must wrap rather than enlarge or clip the
 * reading panel. These rules do not alter Fictioneer's prose typography. */
body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > :is(
  .chapter__story-link,
  .chapter__title,
  .chapter__author
),
body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__author a {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__title {
  text-wrap: balance;
}

/* Top reader actions may become taller when browser text is enlarged. A fixed
 * height is unsafe because Fictioneer can expose translated or plugin-added
 * labels here. */
body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top {
  overflow: visible;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(
  .button,
  a.button,
  .popup-menu-toggle,
  .zy-chapter-cosmos-toggle
) {
  height: auto !important;
  min-height: 2.04rem !important;
  line-height: 1.2;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(
  .button,
  a.button,
  .popup-menu-toggle,
  .zy-chapter-cosmos-toggle
) :is(.button__label, .label, .text, .zy-chapter-cosmos-toggle__label, .zy-chapter-cosmos-toggle__note) {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* Keep the one-rail audio design, but let that single rail grow if text is
 * enlarged instead of clipping or forcing horizontal page overflow. */
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio {
  min-width: 0;
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__rail {
  grid-template-columns: auto minmax(0, auto) minmax(3.5rem, 1fr);
  min-width: 0;
  min-height: 36px;
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__label {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-wrap: balance;
  white-space: normal;
}

/* Constellation copy is secondary to chapter navigation. Permit copy to wrap,
 * while the star links keep their own stable hit areas and scroll track. */
body.single-fcn_chapter.zy-cohesion-view :is(
  .zy-chapter-constellation__eyebrow,
  .zy-chapter-constellation__meta,
  .zy-chapter-constellation__readout,
  .zy-chapter-constellation__fact,
  .zy-chapter-constellation__tooltip
) {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__header {
  flex-wrap: wrap;
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__meta {
  white-space: normal;
}

/* Footer/navigation text should remain readable at large text sizes instead of
 * being permanently constrained to one line and an ellipsis. */
body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button {
  height: auto !important;
  white-space: normal;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(
  .zy-chapter-nav-button__copy,
  .zy-chapter-nav-button__eyebrow
) {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

body.single-fcn_chapter.zy-cohesion-view :is(
  .zy-extra-nav-button,
  .zy-extra-nav-button__label
) {
  min-width: 0;
  max-width: 100%;
}

body.single-fcn_chapter.zy-cohesion-view .zy-extra-nav-button {
  height: auto;
  min-height: 42px;
}

body.single-fcn_chapter.zy-cohesion-view .zy-extra-nav-button__label {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

/* When the actual reader becomes narrow, stop line-clamping the footer handoff.
 * Browser zoom naturally reduces the CSS-pixel container and enters this rule. */
@container zy-reader (max-width: 760px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-footer-whisper__body {
    display: block;
    -webkit-box-orient: initial;
    -webkit-line-clamp: initial;
    overflow: visible;
    text-overflow: clip;
  }

  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(
    .button,
    a.button,
    .popup-menu-toggle,
    .zy-chapter-cosmos-toggle
  ) {
    height: auto !important;
  }
}

@container zy-reader (max-width: 520px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__rail {
    grid-template-columns: auto minmax(0, 1fr) minmax(3.25rem, 1.2fr);
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__label {
    font-size: clamp(0.62rem, 3.1cqi, 0.74rem);
    letter-spacing: 0.025em;
  }
}

@media (max-width: 760px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-footer-whisper__body {
    display: block;
    -webkit-box-orient: initial;
    -webkit-line-clamp: initial;
    overflow: visible;
    text-overflow: clip;
  }
}

/* Coarse-pointer targets may grow, but must not be fixed-height text boxes. */
@media (pointer: coarse) {
  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(
    .button,
    a.button,
    .popup-menu-toggle,
    .zy-chapter-cosmos-toggle
  ),
  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(.button, a.button),
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-utility-lane .zy-extra-nav-button {
    height: auto !important;
    min-height: 44px !important;
  }
}

/* Text-only enlargement fallback for browsers without container queries. */
@media (max-width: 520px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__rail {
    grid-template-columns: auto minmax(0, 1fr) minmax(3.25rem, 1.2fr);
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__label {
    white-space: normal;
  }
}

/* ==========================================================================
   FICTIONEER CONTROL RESPONSIVENESS
   ========================================================================== */
/* Zyrenicus Pass 7: Fictioneer controls and responsive hardening v1.49.6.
 *
 * Fictioneer owns every native control and its behaviour. This late chapter-only
 * layer does not replace or reorder those controls; it only removes child-theme
 * clipping/nowrap assumptions and lets current, translated, plugin-added, and
 * future controls wrap inside the live Fictioneer reader width.
 */

/* Shared intrinsic-size safety. Popovers and keyboard outlines must not be cut
 * off by the decorative action rails. */
body.single-fcn_chapter.zy-cohesion-view :is(
  .chapter__actions,
  .chapter__actions-container,
  #tts-interface,
  #tts-interface .tts-interface__wrapper,
  #tts-interface .tts-interface__controls,
  #paragraph-tools,
  #paragraph-tools .paragraph-tools__actions,
  .suggestion-tools,
  .chapter__support,
  .chapter__support-links,
  .chapter__comments,
  .comment-respond,
  .comment-form
) {
  min-width: 0;
  max-width: 100%;
}

body.single-fcn_chapter.zy-cohesion-view :is(
  .chapter__actions,
  .chapter__actions-container,
  #tts-interface .tts-interface__wrapper,
  #tts-interface .tts-interface__controls,
  #paragraph-tools,
  #paragraph-tools .paragraph-tools__actions,
  .suggestion-tools,
  .chapter__support-links
) {
  overflow: visible;
}

/* Top reader actions: preserve Fictioneer's left/centre/right ownership while
 * allowing every group and every direct control to wrap. */
body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr) !important;
  align-items: center !important;
  gap: clamp(0.28rem, 0.8cqi, 0.46rem) !important;
  overflow: visible !important;
}

body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) > .chapter__actions-container {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: clamp(0.24rem, 0.7cqi, 0.38rem) !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: visible !important;
}

body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) > .chapter__actions-left {
  grid-column: 1;
  justify-content: flex-start !important;
}

body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) > .chapter__actions-center {
  grid-column: 2;
  justify-content: center !important;
}

body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) > .chapter__actions-right {
  grid-column: 3;
  justify-content: flex-end !important;
}

body.single-fcn_chapter.zy-cohesion-view :is(
  :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top),
  .chapter__footer.chapter__actions--bottom
) > .chapter__actions-container:empty {
  display: none !important;
}

body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) :is(
  .button,
  a.button,
  button,
  .popup-menu-toggle,
  .zy-chapter-cosmos-toggle
),
body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) > .chapter__actions-container > :is(
  a,
  input,
  select,
  textarea,
  [role="button"]
) {
  flex: 0 1 auto !important;
  width: auto;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal !important;
}

body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) :is(
  .button,
  a.button,
  button,
  .popup-menu-toggle,
  .zy-chapter-cosmos-toggle
) :is(span, .button__label, .label, .text, [class$="__label"]) {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal !important;
}

/* The footer contains three sibling Fictioneer action containers. Define the
 * grid on the footer itself, not on each group, then let every group wrap. */
body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: var(--zy-footer-nav-gap, clamp(0.48rem, 1.35cqi, 0.78rem)) !important;
  overflow: visible !important;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-container {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.42rem;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: visible !important;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-left {
  grid-column: 1;
  justify-content: flex-end !important;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-center {
  grid-column: 2;
  justify-content: center !important;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-right {
  grid-column: 3;
  justify-content: flex-start !important;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(
  .button,
  a.button,
  button,
  .popup-menu-toggle
):not(.zy-chapter-nav-button),
body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-container > :is(
  a,
  input,
  select,
  textarea,
  [role="button"]
):not(.zy-chapter-nav-button) {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: auto;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(
  .button,
  a.button,
  button,
  .popup-menu-toggle
):not(.zy-chapter-nav-button) :is(span, .button__label, .label, .text, [class$="__label"]) {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

/* Native TTS remains Fictioneer-owned. The controls may wrap rather than
 * overflowing when translations, browser zoom, or larger text increase labels. */
body.single-fcn_chapter.zy-cohesion-view #tts-interface .tts-interface__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem;
}

body.single-fcn_chapter.zy-cohesion-view #tts-interface .tts-interface__controls > .button {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  height: auto;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* Paragraph, suggestion, support, and comment controls are parent systems too.
 * Only intrinsic sizing and wrapping are normalized; visibility and behaviour
 * remain entirely with Fictioneer. */
body.single-fcn_chapter.zy-cohesion-view #paragraph-tools .paragraph-tools__actions,
body.single-fcn_chapter.zy-cohesion-view .chapter__support-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem;
}

body.single-fcn_chapter.zy-cohesion-view :is(
  #paragraph-tools .paragraph-tools__actions > .button,
  .suggestion-tools > .button,
  .chapter__support-links > a,
  .chapter__comments button,
  .chapter__comments .button,
  .chapter__comments a,
  .comment-form button,
  .comment-form .button,
  .comment-form a
) {
  min-width: 0;
  max-width: 100%;
  height: auto;
  overflow-wrap: anywhere;
  white-space: normal;
}

body.single-fcn_chapter.zy-cohesion-view :is(
  .chapter__global-note,
  .chapter__foreword,
  .chapter__afterword,
  .chapter__warning,
  .chapter__support-message,
  .chapter__comments,
  .comment-form
) {
  overflow-wrap: anywhere;
}

body.single-fcn_chapter.zy-cohesion-view .comment-form :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  box-sizing: border-box;
  max-width: 100%;
}

/* Keep focus visible across native readers, floating tools, comments, and
 * modals. These outlines use the Pass 4 token when it is available. */
body.single-fcn_chapter.zy-cohesion-view :is(
  .chapter__actions,
  #tts-interface,
  #paragraph-tools,
  .suggestion-tools,
  .chapter__support,
  .chapter__comments,
  .comment-form,
  .modal
) :is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--zy-reader-ui-focus, currentColor) !important;
  outline-offset: 3px !important;
}

/* Reader width, not browser width, decides when the three native action groups
 * need to stack. No core control is hidden at any breakpoint. */
@container zy-reader (max-width: 760px) {
  body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) > .chapter__actions-container {
    grid-column: 1 !important;
    width: 100% !important;
    justify-content: center !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-left {
    grid-column: 1;
    grid-row: 1;
    justify-content: stretch !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-right {
    grid-column: 2;
    grid-row: 1;
    justify-content: stretch !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-center {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@container zy-reader (max-width: 520px) {
  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > :is(
    .chapter__actions-left,
    .chapter__actions-center,
    .chapter__actions-right
  ) {
    grid-column: 1 !important;
    grid-row: auto !important;
    width: 100% !important;
    justify-content: stretch !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > :is(
    .chapter__actions-left,
    .chapter__actions-center,
    .chapter__actions-right
  ) > :is(.button, a.button, button, .popup-menu-toggle) {
    flex: 1 1 100%;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button {
    width: 100% !important;
    max-width: none !important;
  }
}

/* Viewport fallbacks for browsers without container-query support. */
@media (max-width: 760px) {
  body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.single-fcn_chapter.zy-cohesion-view :is(header.chapter__headline.layout-links > .chapter__actions--top, .chapter__article > .chapter__actions--top) > .chapter__actions-container {
    grid-column: 1 !important;
    width: 100% !important;
    justify-content: center !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-left {
    grid-column: 1;
    grid-row: 1;
    justify-content: stretch !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-right {
    grid-column: 2;
    grid-row: 1;
    justify-content: stretch !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-center {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 520px) {
  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > :is(
    .chapter__actions-left,
    .chapter__actions-center,
    .chapter__actions-right
  ) {
    grid-column: 1 !important;
    grid-row: auto !important;
    width: 100% !important;
    justify-content: stretch !important;
  }
}

@media (hover: none), (pointer: coarse) {
  body.single-fcn_chapter.zy-cohesion-view :is(
    .chapter__actions,
    #tts-interface,
    #paragraph-tools,
    .suggestion-tools,
    .chapter__support,
    .chapter__comments,
    .comment-form,
    .modal
  ) :is(a, button, .button, .popup-menu-toggle, input[type="button"], input[type="submit"], input[type="reset"]) {
    min-width: 44px;
    min-height: 44px !important;
    height: auto !important;
    touch-action: manipulation;
  }
}

@media (forced-colors: active) {
  body.single-fcn_chapter.zy-cohesion-view :is(
    .chapter__actions,
    #tts-interface,
    #paragraph-tools,
    .suggestion-tools,
    .chapter__support,
    .chapter__comments,
    .comment-form,
    .modal
  ) :is(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline-color: Highlight !important;
  }
}

/* ==========================================================================
   COLOUR, MODE, ACCESSIBILITY AND PRINT
   ========================================================================== */
/* Zyrenicus Pass 4: Fictioneer colour/mode/accessibility compatibility.
 * Loaded last on chapter pages. Fictioneer remains the colour authority; this
 * layer maps bespoke UI surfaces onto the parent theme's live palette outputs.
 */
body.single-fcn_chapter.zy-cohesion-view {
  color-scheme: dark;

  /* Parent-owned palette bridge. --page-bg-color, --bg-900, --fg-500 and
   * --primary already respond to Fictioneer hue/saturation/lightness controls. */
  --zy-reader-ui-page: var(--page-bg-color, var(--bg-900, #151922));
  --zy-reader-ui-text: var(--fg-500, #ece9e1);
  --zy-reader-ui-muted: color-mix(in srgb, var(--zy-reader-ui-text) 68%, transparent);
  --zy-reader-ui-faint: color-mix(in srgb, var(--zy-reader-ui-text) 46%, transparent);
  --zy-reader-ui-surface: color-mix(in srgb, var(--zy-reader-ui-page) 88%, var(--zy-reader-ui-text) 12%);
  --zy-reader-ui-surface-raised: color-mix(in srgb, var(--zy-reader-ui-page) 80%, var(--zy-reader-ui-text) 20%);
  --zy-reader-ui-surface-hover: color-mix(in srgb, var(--zy-reader-ui-page) 72%, var(--zy-reader-ui-text) 28%);
  --zy-reader-ui-border: color-mix(in srgb, var(--zy-reader-ui-text) 16%, transparent);
  --zy-reader-ui-border-strong: color-mix(in srgb, var(--zy-reader-ui-text) 28%, transparent);
  --zy-reader-ui-track: color-mix(in srgb, var(--zy-reader-ui-text) 15%, transparent);
  --zy-reader-ui-shadow: color-mix(in srgb, var(--bg-900, #000) 38%, transparent);
  --zy-reader-ui-accent: color-mix(in srgb, var(--primary, #d7c38b) 34%, #d7c38b 66%);
  --zy-reader-ui-accent-soft: color-mix(in srgb, var(--zy-reader-ui-accent) 22%, transparent);
  --zy-reader-ui-accent-border: color-mix(in srgb, var(--zy-reader-ui-accent) 34%, transparent);
  --zy-reader-ui-focus: color-mix(in srgb, var(--zy-reader-ui-accent) 72%, var(--zy-reader-ui-text) 28%);
  --zy-reader-ui-danger: color-mix(in srgb, #d96b6b 72%, var(--zy-reader-ui-text) 28%);

  /* Repoint the established cohesion vocabulary rather than duplicating every
   * parent-control selector. Brand gold remains; surfaces/text follow Fictioneer. */
  --zy-cohesion-title: var(--zy-reader-ui-text);
  --zy-cohesion-title-soft: var(--zy-reader-ui-muted);
  --zy-cohesion-gold: var(--zy-reader-ui-accent);
  --zy-cohesion-gold-border: var(--zy-reader-ui-accent-border);
  --zy-cohesion-gold-border-strong: color-mix(in srgb, var(--zy-reader-ui-accent) 48%, transparent);
  --zy-cohesion-glass-top: color-mix(in srgb, var(--zy-reader-ui-text) 10%, transparent);
  --zy-cohesion-glass-bottom: color-mix(in srgb, var(--zy-reader-ui-text) 4%, transparent);
  --zy-cohesion-surface: linear-gradient(180deg, var(--zy-reader-ui-surface-raised), var(--zy-reader-ui-surface));
  --zy-cohesion-surface-hover: linear-gradient(180deg, var(--zy-reader-ui-surface-hover), var(--zy-reader-ui-surface-raised));
  --zy-cohesion-shadow: 0 10px 24px var(--zy-reader-ui-shadow), inset 0 1px 0 color-mix(in srgb, var(--zy-reader-ui-text) 7%, transparent);
  --zy-cohesion-pill-shadow: inset 0 1px 0 color-mix(in srgb, var(--zy-reader-ui-text) 7%, transparent), 0 8px 18px var(--zy-reader-ui-shadow);

  --zy-chapter-nav-bg: linear-gradient(180deg, var(--zy-reader-ui-surface-raised), var(--zy-reader-ui-surface));
  --zy-chapter-nav-bg-hover: linear-gradient(180deg, var(--zy-reader-ui-surface-hover), var(--zy-reader-ui-surface-raised));
  --zy-chapter-nav-border: var(--zy-reader-ui-border);
  --zy-chapter-nav-border-next: var(--zy-reader-ui-accent-border);
  --zy-chapter-nav-text: var(--zy-reader-ui-text);
  --zy-chapter-nav-accent: var(--zy-reader-ui-accent);
  --zy-chapter-nav-shadow: 0 12px 25px var(--zy-reader-ui-shadow), inset 0 1px 0 color-mix(in srgb, var(--zy-reader-ui-text) 6%, transparent);
}

/* Reading surface: keep Fictioneer's selected page colour literal and opaque. */
body.single-fcn_chapter.zy-cohesion-view .main__wrapper {
  background-color: var(--zy-reader-ui-page) !important;
}

/* Parent chapter controls inherit the live reader palette. */
body.single-fcn_chapter.zy-cohesion-view .chapter__actions :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle) {
  --button-secondary-background: var(--zy-cohesion-surface);
  --button-secondary-background-hover: var(--zy-cohesion-surface-hover);
  --button-secondary-color: var(--zy-reader-ui-text);
  --button-secondary-color-hover: var(--zy-reader-ui-text);
  --button-secondary-border: 1px solid var(--zy-reader-ui-border);
  --button-secondary-border-hover: 1px solid var(--zy-reader-ui-border-strong);
  color: var(--zy-reader-ui-text);
  border-color: var(--zy-reader-ui-border);
}

body.single-fcn_chapter.zy-cohesion-view .chapter__actions :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle):focus-visible,
body.single-fcn_chapter.zy-cohesion-view :is(.zy-extra-nav-button, .zy-chapter-footer-whisper--link):focus-visible {
  outline-color: var(--zy-reader-ui-focus) !important;
}

/* Single-rail audio. */
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio {
  --zy-audio-accent: var(--zy-reader-ui-accent);
  --zy-audio-border: var(--zy-reader-ui-accent-border);
  --zy-audio-surface: var(--zy-reader-ui-surface);
  --zy-audio-surface-2: var(--zy-reader-ui-surface-raised);
  --zy-audio-muted: var(--zy-reader-ui-muted);
  color: var(--zy-reader-ui-text);
  box-shadow: 0 8px 22px var(--zy-reader-ui-shadow);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__play {
  color: var(--zy-reader-ui-text);
  background: var(--zy-reader-ui-accent-soft);
  border-color: var(--zy-reader-ui-accent-border);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__play:not(:disabled):hover,
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__play:not(:disabled):focus-visible {
  color: var(--zy-reader-ui-text);
  background: color-mix(in srgb, var(--zy-reader-ui-accent) 30%, transparent);
  border-color: color-mix(in srgb, var(--zy-reader-ui-accent) 58%, transparent);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__range {
  accent-color: var(--zy-reader-ui-accent);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__range::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--zy-reader-ui-accent) 0 var(--zy-audio-progress), var(--zy-reader-ui-track) var(--zy-audio-progress) 100%);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__range::-moz-range-track,
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__track {
  background: var(--zy-reader-ui-track);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__range::-webkit-slider-thumb,
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__range::-moz-range-thumb {
  background: var(--zy-reader-ui-text);
  border-color: var(--zy-reader-ui-accent);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__track i {
  background: linear-gradient(90deg, color-mix(in srgb, var(--zy-reader-ui-accent) 58%, transparent), color-mix(in srgb, var(--zy-reader-ui-accent) 16%, transparent));
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio.has-error {
  border-color: var(--zy-reader-ui-danger);
}

/* Constellation and cinematic side panel. The image itself remains photographic;
 * all framing and copy respond to the reader palette. */
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation {
  --zy-constellation-line-color: color-mix(in srgb, var(--zy-reader-ui-accent) 30%, transparent);
  color: var(--zy-reader-ui-text);
  background: linear-gradient(180deg, var(--zy-reader-ui-surface-raised), var(--zy-reader-ui-surface));
  border-color: var(--zy-reader-ui-accent-border);
  box-shadow: 0 18px 42px var(--zy-reader-ui-shadow), inset 0 1px 0 color-mix(in srgb, var(--zy-reader-ui-text) 5%, transparent);
}

body.single-fcn_chapter.zy-cohesion-view :is(
  .zy-chapter-constellation__eyebrow,
  .zy-chapter-constellation__readout,
  .zy-chapter-constellation__tooltip
) {
  color: var(--zy-reader-ui-text);
}

body.single-fcn_chapter.zy-cohesion-view :is(
  .zy-chapter-constellation__meta,
  .zy-chapter-constellation__fact,
  .zy-chapter-constellation__number
) {
  color: var(--zy-reader-ui-muted);
}

body.single-fcn_chapter.zy-cohesion-view :is(
  .zy-chapter-constellation__readout,
  .zy-chapter-constellation__fact
) {
  background: color-mix(in srgb, var(--zy-reader-ui-text) 5%, transparent);
  border-color: var(--zy-reader-ui-border);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--zy-reader-ui-text) 5%, transparent);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__tooltip {
  background: linear-gradient(180deg, var(--zy-reader-ui-surface-raised), var(--zy-reader-ui-surface));
  border-color: var(--zy-reader-ui-border-strong);
  box-shadow: 0 10px 24px var(--zy-reader-ui-shadow);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__link:focus-visible {
  outline-color: var(--zy-reader-ui-focus);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment {
  stroke: var(--zy-constellation-line-color);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment.is-traversed,
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment.is-next {
  stroke: color-mix(in srgb, var(--zy-reader-ui-accent) 56%, transparent);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment.is-future {
  stroke: color-mix(in srgb, var(--zy-reader-ui-text) 22%, transparent);
}

/* Footer handoff, progress and chapter navigation. */
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-footer-whisper {
  color: var(--zy-reader-ui-text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--zy-reader-ui-text) 6%, transparent), color-mix(in srgb, var(--zy-reader-ui-text) 2%, transparent));
  border-color: var(--zy-reader-ui-border);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--zy-reader-ui-text) 5%, transparent);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-footer-whisper__label {
  color: var(--zy-reader-ui-accent);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-footer-whisper__body {
  color: var(--zy-reader-ui-muted);
}

body.single-fcn_chapter.zy-cohesion-view .progress {
  background: var(--zy-reader-ui-track);
  box-shadow: none;
}

body.single-fcn_chapter.zy-cohesion-view .progress__bar {
  background: linear-gradient(90deg, color-mix(in srgb, var(--zy-reader-ui-accent) 74%, var(--zy-reader-ui-page)), var(--zy-reader-ui-accent) 58%, color-mix(in srgb, var(--zy-reader-ui-accent) 50%, var(--zy-reader-ui-text)));
  box-shadow: 0 0 10px color-mix(in srgb, var(--zy-reader-ui-accent) 24%, transparent);
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button:hover,
body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button:focus-visible {
  border-color: var(--zy-reader-ui-accent-border);
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button:focus-visible {
  outline-color: var(--zy-reader-ui-focus);
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button__icon {
  color: var(--zy-reader-ui-accent);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--zy-reader-ui-accent) 20%, transparent), color-mix(in srgb, var(--zy-reader-ui-accent) 5%, transparent) 56%, color-mix(in srgb, var(--zy-reader-ui-page) 86%, transparent));
  border-color: var(--zy-reader-ui-accent-border);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--zy-reader-ui-text) 8%, transparent);
}

/* Fictioneer palette changes already flow into the UI tokens above. Apply the
 * same reader darkening/saturation intent to optional ambience, without touching
 * the opaque reading surface. */
:root:not([data-mode="light"]) body.single-fcn_chapter.zy-cohesion-view .zy-shell-starfield--canvas,
:root:not([data-mode="light"]) body.single-fcn_chapter.zy-cohesion-view .zy-shell-starfield--image {
  filter: saturate(var(--saturation, 1)) brightness(var(--darken, 1));
}

/* Light mode no longer needs a parallel bespoke palette; only tune decorative
 * depth so light surfaces remain crisp rather than muddy. */
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view {
  color-scheme: light;
  --zy-reader-ui-shadow: color-mix(in srgb, var(--bg-900, #6b5a43) 14%, transparent);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view :is(
  .zy-chapter-audio,
  .zy-chapter-constellation,
  .zy-chapter-footer-whisper,
  .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button
) {
  text-shadow: none;
}

/* System high-contrast mode: remove every gradient-text dependency and let the
 * operating system choose colours. Navigation remains visible and functional. */
@media (forced-colors: active) {
  body.single-fcn_chapter.zy-cohesion-view {
    --zy-reader-ui-page: Canvas;
    --zy-reader-ui-text: CanvasText;
    --zy-reader-ui-muted: CanvasText;
    --zy-reader-ui-surface: Canvas;
    --zy-reader-ui-surface-raised: Canvas;
    --zy-reader-ui-surface-hover: Canvas;
    --zy-reader-ui-border: CanvasText;
    --zy-reader-ui-border-strong: CanvasText;
    --zy-reader-ui-track: GrayText;
    --zy-reader-ui-accent: Highlight;
    --zy-reader-ui-accent-border: Highlight;
    --zy-reader-ui-focus: Highlight;
  }

  body.single-fcn_chapter.zy-cohesion-view :is(
    .chapter__story-link,
    .chapter__title,
    .chapter__author,
    .chapter__author a
  ) {
    background: none !important;
    background-image: none !important;
    color: CanvasText !important;
    -webkit-text-fill-color: CanvasText !important;
    text-shadow: none !important;
    filter: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view :is(
    .main__wrapper,
    .chapter__actions,
    .zy-chapter-audio,
    .zy-chapter-constellation,
    .zy-chapter-constellation__readout,
    .zy-chapter-constellation__fact,
    .zy-chapter-constellation__tooltip,
    .zy-chapter-footer-whisper,
    .zy-chapter-nav-button,
    .zy-extra-nav-button,
    .zy-chapter-cosmos-toggle
  ) {
    forced-color-adjust: auto;
    color: CanvasText !important;
    background: Canvas !important;
    background-image: none !important;
    border-color: CanvasText !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view :is(
    .zy-chapter-audio__play,
    .zy-chapter-nav-button__icon
  ) {
    color: ButtonText !important;
    background: ButtonFace !important;
    border-color: ButtonText !important;
  }

  body.single-fcn_chapter.zy-cohesion-view :is(
    .zy-chapter-audio__range,
    .zy-chapter-constellation__link
  ):focus-visible {
    outline: 2px solid Highlight !important;
    outline-offset: 3px;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment {
    stroke: CanvasText !important;
    filter: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view :is(
    .zy-shell-starfield,
    .zy-shell-starfield--canvas,
    .zy-shell-starfield--image,
    .zy-chapter-cinematic::after,
    .zy-chapter-constellation::before,
    .zy-chapter-constellation::after,
    .progress__bar::after
  ) {
    display: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .progress {
    background: Canvas !important;
    border: 1px solid CanvasText !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .progress__bar {
    background: Highlight !important;
    box-shadow: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.single-fcn_chapter.zy-cohesion-view :is(
    .zy-chapter-audio,
    .zy-chapter-audio *,
    .zy-chapter-constellation,
    .zy-chapter-constellation *,
    .zy-chapter-footer-whisper,
    .zy-chapter-footer-whisper *,
    .chapter__actions,
    .chapter__actions *,
    .zy-chapter-nav-button,
    .zy-chapter-nav-button *
  ) {
    animation: none !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body.single-fcn_chapter.zy-cohesion-view {
    color: #000 !important;
    background: #fff !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .main__wrapper {
    width: 100% !important;
    max-width: none !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view :is(
    .zy-chapter-visual-wrapper,
    .zy-shell-starfield,
    .chapter__actions,
    .zy-chapter-audio,
    .zy-chapter-constellation,
    .zy-chapter-footer-whisper,
    .progress,
    .chapter__footer.chapter__actions--bottom
  ) {
    display: none !important;
  }

  /* Match the deliberately specific screen-layout selectors from the native
   * control hardening layer. Without this, their !important grid declaration
   * can outrank the generic print suppression and leave action rails on paper. */
  body.single-fcn_chapter.zy-cohesion-view :is(
    header.chapter__headline.layout-links > .chapter__actions--top,
    .chapter__article > .chapter__actions--top,
    .chapter__footer.chapter__actions--bottom
  ) {
    display: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view :is(
    .chapter__story-link,
    .chapter__title,
    .chapter__author,
    .chapter__author a
  ) {
    background: none !important;
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
    text-shadow: none !important;
  }

  body.single-fcn_chapter.zy-cohesion-view #chapter-content,
  body.single-fcn_chapter.zy-cohesion-view #chapter-content * {
    color: #000 !important;
    text-shadow: none !important;
  }
}

/* Match the specificity of legacy light-mode rules so the shared token bridge,
 * not the old parallel palette, remains authoritative. */
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view {
  --zy-chapter-nav-bg: linear-gradient(180deg, var(--zy-reader-ui-surface-raised), var(--zy-reader-ui-surface));
  --zy-chapter-nav-bg-hover: linear-gradient(180deg, var(--zy-reader-ui-surface-hover), var(--zy-reader-ui-surface-raised));
  --zy-chapter-nav-border: var(--zy-reader-ui-border);
  --zy-chapter-nav-border-next: var(--zy-reader-ui-accent-border);
  --zy-chapter-nav-text: var(--zy-reader-ui-text);
  --zy-chapter-nav-accent: var(--zy-reader-ui-accent);
  --zy-chapter-nav-shadow: 0 12px 25px var(--zy-reader-ui-shadow), inset 0 1px 0 color-mix(in srgb, var(--zy-reader-ui-text) 10%, transparent);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio {
  --zy-audio-accent: var(--zy-reader-ui-accent);
  --zy-audio-border: var(--zy-reader-ui-accent-border);
  --zy-audio-surface: var(--zy-reader-ui-surface);
  --zy-audio-surface-2: var(--zy-reader-ui-surface-raised);
  --zy-audio-muted: var(--zy-reader-ui-muted);
  color: var(--zy-reader-ui-text);
  box-shadow: 0 8px 22px var(--zy-reader-ui-shadow);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__play {
  color: var(--zy-reader-ui-text);
  background: var(--zy-reader-ui-accent-soft);
  border-color: var(--zy-reader-ui-accent-border);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-audio__range::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--zy-reader-ui-accent) 0 var(--zy-audio-progress), var(--zy-reader-ui-track) var(--zy-audio-progress) 100%);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view :is(
  .zy-chapter-audio__range::-moz-range-track,
  .zy-chapter-audio__track
) {
  background: var(--zy-reader-ui-track);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation {
  color: var(--zy-reader-ui-text);
  background: linear-gradient(180deg, var(--zy-reader-ui-surface-raised), var(--zy-reader-ui-surface));
  border-color: var(--zy-reader-ui-accent-border);
  box-shadow: 0 18px 42px var(--zy-reader-ui-shadow), inset 0 1px 0 color-mix(in srgb, var(--zy-reader-ui-text) 9%, transparent);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment.is-traversed,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment.is-next {
  stroke: color-mix(in srgb, var(--zy-reader-ui-accent) 56%, transparent);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment.is-future {
  stroke: color-mix(in srgb, var(--zy-reader-ui-text) 22%, transparent);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .progress {
  background: var(--zy-reader-ui-track);
  box-shadow: none;
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .progress__bar {
  background: linear-gradient(90deg, color-mix(in srgb, var(--zy-reader-ui-accent) 74%, var(--zy-reader-ui-page)), var(--zy-reader-ui-accent) 58%, color-mix(in srgb, var(--zy-reader-ui-accent) 50%, var(--zy-reader-ui-text)));
  box-shadow: 0 0 10px color-mix(in srgb, var(--zy-reader-ui-accent) 20%, transparent);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__story-link,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__author,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__author a {
  color: var(--zy-reader-ui-muted) !important;
  -webkit-text-fill-color: var(--zy-reader-ui-muted) !important;
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__title {
  color: color-mix(in srgb, var(--zy-reader-ui-accent) 78%, var(--zy-reader-ui-text)) !important;
  -webkit-text-fill-color: color-mix(in srgb, var(--zy-reader-ui-accent) 78%, var(--zy-reader-ui-text)) !important;
}

@media (forced-colors: active) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cinematic {
    display: none !important;
  }
}
