/* ============================================================================
 * scripts/docs/help.css — help-site overlay.
 *
 * Assumes static-base.css is loaded first (provides --bs-* and --theme-*
 * tokens plus typographic baseline). This file only adds article-shape
 * layout and directive-specific component styling.
 * ========================================================================== */

.guide-header {
  background-color: rgb(var(--theme-navbar-bg));
  background-image: var(--static-chrome-bg-image, none);
  background-repeat: var(--static-chrome-bg-repeat, repeat-x);
  background-size: auto;
  background-position: 0 0;
  color: rgb(var(--theme-navbar-color));
  border-bottom: 1px solid var(--bs-border-color);
}
.guide-header-inner {
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.guide-header-brand {
  display: inline-flex;
  align-items: center;
}
.guide-header-brand img {
  display: block;
  height: 40px;
  width: auto;
}
/* Driven by the navbar theme tokens — same source as the live navbar's
   font-family/size/weight (see client/src/index.css). */
.guide-header-section {
  font-family: var(--theme-navbar-font-family);
  font-size: var(--theme-navbar-font-size);
  font-weight: var(--theme-navbar-font-weight);
  color: rgb(var(--theme-navbar-color));
  border-left: 1px solid rgba(var(--theme-navbar-color), 0.35);
  padding-left: 1rem;
}
.guide-header a {
  color: rgb(var(--theme-navbar-color));
}
.guide-header a:hover, .guide-header a:focus {
  color: rgb(255, 255, 255);
  text-decoration: none;
}

/* Matches the main site's .container override (client/src/index.css#311):
   1280px cap with 15px gutters — single fluid-but-capped column instead of
   Bootstrap's stepped breakpoints. */
.guide-content {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 15px;
}

.guide-content h1 {
  font-size: 2rem;
  border-bottom: 2px solid var(--bs-border-color);
  padding-bottom: 0.4rem;
  margin-top: 0;
}
.guide-content h2 {
  font-size: 1.45rem;
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--bs-border-color);
  padding-bottom: 0.25rem;
}
.guide-content h3 { font-size: 1.15rem; margin-top: 1.75rem; }
.guide-content h4 { font-size: 1rem; margin-top: 1.25rem; }

.guide-content p, .guide-content li { font-size: 1.02rem; }

.guide-content code {
  font-size: 0.9em;
  background: var(--bs-tertiary-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  border: 1px solid var(--bs-border-color);
}
.guide-content pre {
  background: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
}
.guide-content pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

.guide-content table {
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}
.guide-content th, .guide-content td {
  border: 1px solid var(--bs-border-color);
  padding: 0.45rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.guide-content th {
  background: var(--bs-tertiary-bg);
  font-weight: 600;
}

.guide-content blockquote {
  border-left: 3px solid var(--bs-primary);
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  color: var(--bs-secondary);
  background: var(--bs-tertiary-bg);
}

/* Role-conditioned section (Phase 1: always visible with audience label) */
.guide-role {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--bs-primary);
  background: var(--bs-tertiary-bg);
  border-radius: 0 4px 4px 0;
}
.guide-role-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0 0 0.5rem;
  color: var(--bs-primary);
}

/* Capture markers (screenshot / animation placeholders) */
.guide-capture {
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--bs-secondary);
  background: var(--bs-secondary-bg);
  border-radius: 4px;
}
.guide-capture-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0 0 0.25rem;
  color: var(--bs-secondary);
}
.guide-capture-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--bs-body-color);
}

/* Rendered captures (a :::screenshot / :::animation bound to a real file) */
.guide-figure {
  margin: 1.5rem 0;
}
.guide-figure-media {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.guide-figure-caption {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--bs-secondary-color, var(--bs-secondary));
}

/* Lite YouTube embed (:::video) — poster + play badge until clicked.
   The <a> is position:relative so the badge can center over the poster; once
   the wiring script swaps in the <iframe> it inherits .guide-figure-media and
   needs an explicit aspect-ratio, since an iframe has no intrinsic size. */
.guide-figure--video .guide-video-link {
  position: relative;
  display: block;
  text-decoration: none;
}
.guide-figure--video .guide-figure-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;   /* hqdefault is 4:3 with letterbox bars; crop to 16:9 */
}
.guide-figure--video iframe.guide-figure-media {
  object-fit: unset;
  border: 1px solid var(--bs-border-color);
}
.guide-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.65);
  transition: background 0.15s ease;
  pointer-events: none;   /* the <a> owns the click, not the badge */
}
/* The triangle, drawn with borders so there's no image to load. */
.guide-video-play::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent #fff;
}
.guide-figure--video .guide-video-link:hover .guide-video-play,
.guide-figure--video .guide-video-link:focus-visible .guide-video-play {
  background: rgba(200, 0, 0, 0.85);
}
.guide-figure--video .guide-video-link:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  .guide-video-play { transition: none; }
}

/* Collapsible "under the hood" / advanced detail block */
.guide-details {
  margin: 1.25rem 0;
  padding: 0;
  border: 1px solid var(--bs-border-color);
  border-left: 3px solid var(--bs-secondary);
  border-radius: 0 4px 4px 0;
  background: var(--bs-tertiary-bg);
}
.guide-details-summary {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--bs-secondary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.guide-details-summary::-webkit-details-marker { display: none; }
.guide-details-summary::before {
  content: "▸";
  display: inline-block;
  font-size: 0.7em;
  transition: transform 0.15s ease;
  color: var(--bs-primary);
}
.guide-details[open] > .guide-details-summary::before {
  transform: rotate(90deg);
}
.guide-details-summary:hover { color: var(--bs-primary); }
.guide-details-body {
  padding: 0.25rem 0.85rem 0.75rem;
  font-size: 0.95rem;
  border-top: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
}
.guide-details-body > :first-child { margin-top: 0.5rem; }
.guide-details-body > :last-child { margin-bottom: 0; }

/* Lead-in quote placeholder (sourcing-needed marker) */
.guide-quote-placeholder {
  margin: 1.5rem 0;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--bs-primary);
  background: var(--bs-tertiary-bg);
  border-radius: 4px;
}
.guide-quote-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--bs-primary);
  margin: 0 0 0.35rem;
}
.guide-quote-brief {
  margin: 0;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--bs-secondary);
}

.guide-footer {
  background-color: rgb(var(--theme-footer-bg));
  background-image: var(--static-chrome-bg-image, none);
  background-repeat: var(--static-chrome-bg-repeat, repeat-x);
  color: rgb(var(--theme-footer-color));
  padding: 1.5rem 1.25rem;
  margin-top: 3rem;
  text-align: center;
  font-size: 0.9rem;
}
.guide-footer a {
  color: rgb(var(--theme-footer-color));
}
.guide-footer a:hover {
  color: rgb(255, 255, 255);
}

/* ---------------------------------------------------------------------------
   Guide search (static surface)
   ---------------------------------------------------------------------------
   Deliberately mirrors the SPA nav search (client/src/components/search/
   SearchBar.jsx) so the two surfaces don't read as different products. The SPA
   uses Bootstrap InputGroup + ListGroup; there is no Bootstrap here, so this
   reproduces the same visual result from the SAME underlying custom properties
   Bootstrap resolves to (--theme-form-*, --bs-primary, --bs-border-color).
   Matching the tokens rather than the pixel values is what keeps the two in
   step when a theme changes.

   Placement mirrors the SPA too: search lives in the header, right-aligned,
   pushed there by margin-left:auto on .guide-search.
   --------------------------------------------------------------------------- */
.guide-search {
  position: relative;
  margin-left: auto;
  flex: 0 1 22rem;
  min-width: 0;
}
.guide-search-group {
  display: flex;
  align-items: stretch;
}
/* ⚠️ --theme-* tokens are RGB TRIPLETS ("226 210 174"), not colors — they must
   be wrapped in rgb(). Used bare, the declaration is invalid, the browser drops
   it, and you silently get the UA default (a white input with a grey border) on
   a dark navbar. --bs-* tokens on this surface ARE full colors and are used as
   they are. These declarations mirror .form-control / .form-control:focus in
   client/src/index.css exactly, including the 0.25rem ring — that file is the
   reference if either ever changes. */
.guide-search-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;                        /* Bootstrap size="sm" */
  line-height: 1.5;
  color: rgb(var(--theme-form-color, 0 0 0));
  background-color: rgb(var(--theme-form-bg, 255 255 255));
  border: 1px solid rgb(var(--theme-form-border-color, 222 226 230));
  border-right: 0;
  border-radius: 0.25rem 0 0 0.25rem;
  -webkit-appearance: none;
  appearance: none;
}
.guide-search-input:focus {
  outline: 0;
  background-color: rgb(var(--theme-form-focus-bg, var(--theme-form-bg, 255 255 255)));
  border-color: rgb(var(--theme-form-focus-border-color, var(--bs-primary-rgb)));
  box-shadow: 0 0 0 0.25rem rgb(var(--theme-form-focus-ring-color, var(--bs-primary-rgb)) / 0.25);
}
.guide-search-input::placeholder {
  color: rgb(var(--theme-form-color, 0 0 0) / 0.6);
}
/* Suppress the WebKit "x" — the SPA control has no clear affordance, and the
   two sitting side by side would look like different widgets. */
.guide-search-input::-webkit-search-cancel-button { display: none; }

.guide-search-submit {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  color: #fff;
  background-color: var(--bs-primary);
  border: 1px solid var(--bs-primary);
  border-radius: 0 0.25rem 0.25rem 0;
  cursor: pointer;
}

.guide-search-results {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  width: min(28rem, 92vw);
  max-height: 450px;                          /* same cap as the SPA dropdown */
  overflow-y: auto;
  z-index: 1050;
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.25rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
  text-align: left;
}
.guide-search-head {
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--bs-secondary);
  background-color: var(--bs-tertiary-bg, var(--bs-secondary-bg));
  border-bottom: 1px solid var(--bs-border-color);
}
/* ⚠️ Scoped through .guide-search-results deliberately. The dropdown renders
   INSIDE .guide-header, so `.guide-header a` (specificity 0,1,1) beats a bare
   `.guide-search-item` (0,1,0) and paints every result heading in the pale
   navbar link colour — correct on the dark navbar, invisible on the parchment
   dropdown. Two classes (0,2,0) wins. */
.guide-search-results .guide-search-item {
  display: block;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--bs-border-color);
  color: var(--bs-body-color);
  text-decoration: none;
}
.guide-search-results .guide-search-item:hover,
.guide-search-results .guide-search-item.is-selected {
  background-color: var(--bs-tertiary-bg, var(--bs-secondary-bg));
  color: var(--bs-body-color);
}
/* Dark red, from the theme's own link colour — these headings ARE links, and
   this is what a link looks like everywhere else on the surface. Inheriting the
   body colour made them read as inert black text; inheriting the navbar link
   colour (the earlier bug) made them near-invisible on parchment. */
.guide-search-results .guide-search-item-heading {
  display: block;
  font-weight: 600;
  color: var(--bs-link-color);
}
.guide-search-results .guide-search-item:hover .guide-search-item-heading,
.guide-search-results .guide-search-item.is-selected .guide-search-item-heading {
  color: var(--bs-link-hover-color, var(--bs-link-color));
  text-decoration: underline;
}
.guide-search-results .guide-search-item-crumb,
.guide-search-results .guide-search-item-snippet {
  display: block;
  font-size: 0.8125rem;
  color: var(--bs-secondary);
}
.guide-search-results .guide-search-item-snippet { margin-top: 0.125rem; }
.guide-search-results .guide-search-item mark {
  padding: 0;
  background-color: transparent;
  color: inherit;
  font-weight: 600;
}
.guide-search-empty {
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--bs-secondary);
}
.guide-search-results .guide-search-site {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  text-align: center;
  color: var(--bs-link-color);
  text-decoration: none;
}
.guide-search-results .guide-search-site:hover { background-color: var(--bs-tertiary-bg, var(--bs-secondary-bg)); }

/* The header stacks on narrow screens; give search its own full-width row
   rather than crushing it against the brand. */
@media (max-width: 48rem) {
  .guide-header-inner { flex-wrap: wrap; }
  .guide-search { flex: 1 0 100%; margin-left: 0; }
  .guide-search-results { width: 100%; }
}

/* ---- Audience filter (:::role sections) ---------------------------------
   Facet 3 / task 5 of docs/implemented/user-guide-pages-reconciliation.md.
   Rendered only on pages that carry a GM section, and revealed by
   guide-audience.js — see that file for why this is one toggle and not the
   three-way picker the plan described (every fence in the corpus is
   `:::role gm`; there is no player or applicant content to filter). */

.guide-audience {
  margin: 0 0 1.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.25rem;
  background-color: rgba(var(--theme-card-bg, 191 177 143), 0.35);
  font-size: 0.9375rem;
}

.guide-audience label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin: 0;
}

/* `~=` matches one value in the space-separated list, so this keeps working
   unchanged if a section ever declares `data-roles="gm player"`. */
.guide-hide-gm .guide-role[data-roles~="gm"] {
  display: none;
}
