/*
 * NCC volume reader (Views/Ncc/Read.cshtml, js/pages/ncc.js). Tokens only (tokens.css).
 *
 *  sidebar   .ncc-volumes > .ncc-volume-grid        volumes I–XLII (current, online, not online)
 *            .ncc-toc .ncc-range                     a reader page: headword range + printed pages
 *            .ncc-toc-entries .toc-item              the current page's entries (scroll-spy)
 *  text      .ncc-entries > .ncc-page-divider        "PAGE 12" where a printed page starts
 *            article.ncc-entry > .ncc-entry-head (.ncc-hw, .ncc-tools) + .prose.ncc-text
 *            abbr.ncc-abbr                           abbreviation (tooltip on hover/focus/tap)
 */

/* ---------------------------------------------------------------------------------------- */
/* Sidebar: volumes                                                                          */
/* ---------------------------------------------------------------------------------------- */
.ncc-volumes { padding: 14px 8px 0; }
.ncc-volumes .toc-heading { margin-top: 0; }
.ncc-volume-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 6px 0 0;
  padding: 0 10px 0 13px;
  list-style: none;
}
.ncc-volume-grid a,
.ncc-volume-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: max(30px, var(--tap-min));
  height: max(26px, var(--tap-min));
  padding: 0 6px;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-variant-numeric: lining-nums;
  letter-spacing: .02em;
  color: var(--text-sidebar);
  border-radius: var(--radius-sm);
}
.ncc-volume-grid a:hover { color: var(--text-title); background: var(--hover-bg); }
.ncc-volume-grid a[aria-current] { color: var(--segment-on-fg); background: var(--segment-on-bg); }
.ncc-volume-grid span[aria-disabled] { color: var(--text-muted); opacity: .55; cursor: default; }

/* ---------------------------------------------------------------------------------------- */
/* Sidebar: contents by reader page                                                          */
/* ---------------------------------------------------------------------------------------- */
.ncc-toc { padding-top: 18px; }
.ncc-range { align-items: baseline; }
.ncc-range-pages {
  flex: none;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: .02em;
}
.toc-group.ncc-range[aria-current] { color: var(--text-title); background: var(--current-bg); }
.ncc-toc-entries { margin: 2px 0 8px; }
.ncc-toc-entries .toc-item { padding-left: 31px; align-items: baseline; }

/* ---------------------------------------------------------------------------------------- */
/* Reading column                                                                            */
/* ---------------------------------------------------------------------------------------- */
.ncc-entries { margin-top: 72px; }
.ncc-entries > .ncc-page-divider:first-child { margin-top: 0; }
.ncc-page-divider { scroll-margin-top: 24px; }
.ncc-page-divider + .ncc-entry { margin-top: 40px; }
.ncc-entry + .ncc-entry { margin-top: 30px; }
.ncc-entry + .ncc-page-divider { margin-top: 64px; }

.ncc-entry {
  position: relative;
  scroll-margin-top: 24px;
}
/* A linked entry (#e12) and the entries of the focused column: a thin accent rule in the margin. */
.ncc-entry:target::before,
.ncc-entry.is-focus::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: -18px;
  width: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.ncc-entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}
.ncc-hw {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 500;
  line-height: 1.25;
  color: var(--text-title);
  overflow-wrap: anywhere;
}
.ncc-hw-deva {
  margin-left: .35em;
  font-family: var(--font-deva);
  font-size: .9em;
  font-weight: 400;
  color: var(--text-sidebar);
  font-synthesis-weight: none;
}
:root[data-script="deva"] .ncc-hw-deva { margin-left: 0; font-size: 1em; color: var(--text-title); }

.ncc-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0;
  margin-left: auto;
  color: var(--text-muted);
}
.ncc-tools .icon-btn { color: var(--text-muted); }
.ncc-tools .icon-btn:hover { color: var(--text-title); }
.ncc-tools .icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.ncc-loc {
  margin-right: 6px;
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-variant-numeric: lining-nums tabular-nums;
  cursor: default;
}

.ncc-text { margin-top: 6px; }
.ncc-text p { margin: 0; }
.ncc-text p + p { margin-top: .5em; }

/* Abbreviations: a quiet dotted rule (entries are dense with them), stronger on hover and focus. */
abbr.ncc-abbr {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: color-mix(in srgb, var(--text-muted) 42%, transparent);
  cursor: help;
}
abbr.ncc-abbr:hover { text-decoration-color: var(--text-muted); }
abbr.ncc-abbr:focus-visible { border-radius: 2px; outline-offset: 1px; text-decoration-color: var(--accent); }
abbr.ncc-abbr.is-expanded { text-decoration-style: dotted; font-style: italic; }

.ncc-pager { margin-top: 72px; }

/* Empty volume. */
.ncc-empty { margin-top: 48px; }

@media (max-width: 767.98px) {
  .ncc-entries { margin-top: 48px; }
  .ncc-hw { font-size: var(--fs-lg); flex-basis: 100%; }
  .ncc-tools { margin-left: 0; }
  .ncc-entry:target::before, .ncc-entry.is-focus::before { left: -12px; }
  .ncc-entry + .ncc-entry { margin-top: 26px; }
  .ncc-pager { margin-top: 48px; }
}
