/* Customer-tier content gating: sidebar lock styling + locked stub page.
 *
 * The mdbook-disclosure preprocessor prefixes a U+2063 INVISIBLE SEPARATOR
 * to customer chapter names in the public build. static-js/sidebar.js detects
 * that marker, strips it from rendered text, sets `data-locked="true"` on the
 * <li class="chapter-item">, and removes any fold-toggle. The rules below
 * take it from there.
 *
 * The padlock glyphs are SVG masks so they pick up `currentColor` — the icon
 * inherits the theme's text color in both light and dark themes without any
 * per-theme overrides. No emoji, no separate icon assets. */

/* Shared padlock mask. Tweak the SVG once; both sidebar and stub use it. */
:root {
  --gating-lock-mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4.5' y='11' width='15' height='10' rx='2'/%3E%3Cpath d='M8.5 11V7a3.5 3.5 0 0 1 7 0v4'/%3E%3C/svg%3E");
}

/* Sidebar entry for a locked chapter -------------------------------------- */

.app-sidebar li.chapter-item[data-locked="true"] > .chapter-link-wrapper > a:not(.chapter-fold-toggle) {
  /* Soft visual cue that the destination is gated. */
  color: var(--text-muted);
}

.app-sidebar li.chapter-item[data-locked="true"] > .chapter-link-wrapper > a:not(.chapter-fold-toggle)::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 0.45em;
  vertical-align: -1px;
  flex: 0 0 auto;
  background-color: currentColor;
  opacity: 0.7;
  -webkit-mask: var(--gating-lock-mask) no-repeat center / contain;
          mask: var(--gating-lock-mask) no-repeat center / contain;
}

/* A locked item cannot expand — kill any stray fold-toggle the build emits. */
.app-sidebar li.chapter-item[data-locked="true"] > .chapter-link-wrapper > .chapter-fold-toggle,
.app-sidebar li.chapter-item[data-locked="true"] > .chapter-link-wrapper > a.chapter-fold-toggle {
  display: none !important;
}

/* Hover state lifts the text color back to body so users see the row is
   clickable (it navigates to the stub page rather than expanding). */
.app-sidebar li.chapter-item[data-locked="true"] > .chapter-link-wrapper:hover > a:not(.chapter-fold-toggle) {
  color: var(--text-body);
}

/* Locked stub page (in-content) ------------------------------------------- */

.locked-page {
  max-width: 560px;
  margin: 4rem auto;
  padding: 2.5rem 2rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  background: var(--bg-surface);
}

.locked-page__title {
  font-size: 1.6rem;
  margin: 0 0 1rem;
  line-height: 1.25;
  color: var(--text-heading);
}

/* Larger padlock above the title — same SVG mask, same color inheritance. */
.locked-page::before {
  content: "";
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto 1.25rem;
  background-color: currentColor;
  opacity: 0.55;
  -webkit-mask: var(--gating-lock-mask) no-repeat center / contain;
          mask: var(--gating-lock-mask) no-repeat center / contain;
}

.locked-page__summary {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text-body);
  margin: 0 auto 1.25rem;
  max-width: 480px;
}

.locked-page__explanation {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 1.75rem;
}

/* Sign-in CTA: black text on accent yellow. Black-on-yellow is one of the
   highest-contrast pairings; readable in both light and dark themes
   because --accent is the same yellow in both. */
.locked-page__signin {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  background: var(--accent);
  color: #0A0A0A;
  border-radius: var(--radius-sm, 6px);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: filter var(--transition, 120ms ease-out);
}

.locked-page__signin:hover,
.locked-page__signin:focus {
  background: var(--accent-hover, var(--accent));
  color: #0A0A0A;
  text-decoration: none;
}
.locked-page__signin:focus-visible {
  outline: 2px solid var(--text-heading);
  outline-offset: 2px;
}
