/* Great Times — app-specific styles. Base tokens, layout, and most shared
   components (.item-list, .item-row, .year-badge, .pill-tag, .search-bar,
   .detail-header, .content-section, etc.) come from framework.css. */

/* framework.css doesn't style .header-actions itself — fine when it only
   ever held one button, but now needs to lay two out side by side. */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The publication/decade chip rows (#filter-panel) are collapsed by default
   and revealed by #filter-toggle, the same show/hide-a-row mechanic
   GreatApp.initSearchToggle already uses for #search-bar — no extra spacing
   of its own beyond what each .filter-row already carries. */
.filter-toggle {
  position: relative;
}

.filter-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--bg-surface);
}

.filter-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 7px;
  margin-top: 11px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-row::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.icon-link svg { flex-shrink: 0; }
.icon-link:hover { color: var(--accent); border-color: var(--accent); }

#detail-gap .content-text {
  color: var(--text-muted);
}

/* ── Content (full-text) search results ─── */
.content-results {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.content-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.content-results-header .icon-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

/* Snippets need to wrap and show a few lines of context — framework.css's
   default .item-sub is single-line ellipsis truncation, tuned for a short
   "month • size" line, which would cut off nearly all of a search snippet. */
.content-results .item-sub.snippet {
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.snippet mark {
  background: var(--accent-dim, rgba(124, 111, 255, 0.35));
  color: var(--text);
  border-radius: 2px;
  padding: 0 1px;
}

/* ── In-app PDF viewer ─────────────────── */
/* Top-level sibling of .detail-header/.detail-body (see index.html), not
   nested inside the padded/max-width detail-body column, so it can fill all
   remaining space edge to edge with no extra padding/borders competing with
   the page content. #detail-view is a flex column (framework .view); with
   has-pdf set, .detail-body shrinks to its own content height below and this
   takes the rest. .detail-body's bottom padding and .detail-meta's bottom
   margin (both from framework.css) exist to give breathing room below the
   LAST thing in a normally-scrolling .detail-body — with the viewer as an
   immediate next sibling instead, that default spacing stacks into an
   oversized gap, so .detail-body's is zeroed and .detail-meta keeps one
   small gap of its own above the viewer. */
#detail-view.has-pdf .detail-body {
  flex: 0 0 auto;
  overflow: visible;
  padding-bottom: 0;
}
#detail-view.has-pdf .detail-meta {
  margin-bottom: 12px;
}

.pdf-frame-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #525659; /* matches most native PDF-viewer canvases while loading */
}

.pdf-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.pdf-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d8d8d8;
  font-size: 0.9rem;
}

/* The embedded PDF reader needs the full viewport width so PDF.js can compute
   its "fit width" zoom correctly. Constraining a flex-item ancestor with
   `max-width` + `margin: 0 auto` (the shared framework's default prose-width
   centering) makes it size its initial fit-to-width zoom against a
   mismatched width, so the page renders zoomed in and requires horizontal
   scrolling. Undo that centering only for this view, and re-apply a
   comfortable reading width to the plain-text "gap" notice directly, since it
   (unlike the PDF) is never the iframe's ancestor. */
@media (min-width: 769px) {
  #detail-view .detail-body { max-width: none; margin: 0; }
  #detail-gap { max-width: 900px; margin: 0 auto; }
}
