/* 科判 on compact screens. Each verse group shows its full path on one line:
   ancestors small and muted, its own section strong. A bar keeps the path of
   the passage being read in view. Wide screens keep the gutter outline from
   pu-xian-xing-yuan.css. */
.kepan-bar-holder, .kepan-ancestors { display: none; }

@media (max-width: 1099px) {
  /* The path above each verse already names every branch, so the nested
     headings stay only for assistive navigation. */
  .outline-heading {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .outline-branch, .outline-branch[data-outline-depth="0"] { margin: 0; }
  /* A new top-level part opens with more room above it. */
  .outline-branch[data-outline-depth="0"] + .outline-branch[data-outline-depth="0"] { margin-top: 1.25rem; }

  html[data-layout] .verse-group { padding: 0.75rem 0; scroll-margin-top: 4.5rem; }
  html[data-layout] .verse-outline {
    display: flex; flex-wrap: nowrap; align-items: baseline; gap: 0;
    margin: 0 0 0.375rem; padding: 0; white-space: nowrap; overflow: hidden;
  }
  .kepan-ancestors {
    display: inline; flex: 0 0 auto;
    font: 0.75rem/1.6 var(--sans); color: var(--ink-soft);
  }
  .kepan-level[hidden] { display: none; }
  /* Separators are shared with the bar so both paths have the same rhythm. */
  .kepan-level::after, .kepan-step:not(:last-child)::after {
    content: "›"; margin-inline: 0.375rem; opacity: 0.7;
  }
  .kepan-level.is-repeat { opacity: 0.72; }
  html[data-layout] .verse-outline strong {
    flex: 0 1 auto; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
    font: 600 0.875rem/1.6 var(--sans); color: var(--ink);
  }

  /* Only one sticky bar on compact screens: the title scrolls away and the
     path bar takes its place. */
  .toolbar-wrap { position: static; }

  /* Current-path bar. It takes no space in the flow and appears once the
     reader has scrolled past the first heading. Every level stays visible;
     a long path wraps rather than truncating. */
  .kepan-bar-holder {
    display: block; position: sticky; top: var(--kepan-top, 0px); z-index: 4;
    height: 0;
    visibility: hidden; opacity: 0; transition: opacity 140ms ease, visibility 0s 140ms;
  }
  .kepan-bar-holder.is-visible { visibility: visible; opacity: 1; transition: opacity 140ms ease; }
  .kepan-bar {
    padding: calc(0.625rem + env(safe-area-inset-top)) 0 0.625rem;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 0 0.5rem 1rem -0.75rem oklch(0 0 0 / 25%);
  }
  /* In the app's reader the page sits in a frame under the app's own header,
     yet iOS still reports the phone's top inset inside the frame. The app
     header already clears the notch, so the bar must not add it again. */
  html.embedded .kepan-bar { padding-top: 0.625rem; }
  /* Match the reading column so the path lines up with the verses. */
  .kepan-path {
    width: min(100%, 48rem); margin: 0 auto; padding-inline: 1.5rem;
    font: 0.8125rem/1.6 var(--sans); color: var(--ink-soft);
  }
  /* The bar may wrap, but only between levels, never inside a name. */
  .kepan-step { display: inline-block; white-space: nowrap; }
  .kepan-step.is-current { color: var(--ink); font-weight: 600; }

  .ke-pan-hidden .kepan-bar-holder { display: none; }
  html.ke-pan-hidden .outline-branch { margin: 0; }
}

@media (max-width: 680px) {
  .kepan-path { padding-inline: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .kepan-bar-holder, .kepan-bar-holder.is-visible { transition: none; }
}

@media print {
  .kepan-bar-holder { display: none; }
}
