/* 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");

  /* Slashed eye for internal pages: "not visible outside Exaba". Deliberately
     not a padlock — a padlock means "sign in to see this", which is the
     customer tier. An internal page is not gated, it is absent. */
  --gating-internal-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%3Cpath d='M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6z'/%3E%3Ccircle cx='12' cy='12' r='2.6'/%3E%3Cpath d='M3 21L21 3'/%3E%3C/svg%3E");

  /* Internal marker colour. --color-warning is amber in both themes, so it
     reads as "attention" without colliding with --accent (yellow = link) or
     --color-danger (red = error). */
  --gating-internal-ink: var(--color-warning, #F59E0B);

  /* Pencil for todo pages: the page is unwritten, not confidential. Distinct
     from the slashed eye so the two absences don't read as the same thing. */
  --gating-todo-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%3Cpath d='M4 20h4L20 8a2.8 2.8 0 0 0-4-4L4 16v4z'/%3E%3Cpath d='M14.5 5.5L18.5 9.5'/%3E%3C/svg%3E");

  /* --color-note is blue in both themes: informational, not a problem to fix
     right now. An unwritten page is a known gap, not a fault. */
  --gating-todo-ink: var(--color-note, #3B82F6);
}

/* 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);
}

/* Sidebar entry for an internal chapter ----------------------------------- */
/* Internal build only — a shipped build has no such entry to style. */

.app-sidebar li.chapter-item[data-internal="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: var(--gating-internal-ink);
  -webkit-mask: var(--gating-internal-mask) no-repeat center / contain;
          mask: var(--gating-internal-mask) no-repeat center / contain;
}

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

.app-sidebar li.chapter-item[data-todo="true"] > .chapter-link-wrapper > a:not(.chapter-fold-toggle) {
  /* Muted, because the destination has nothing to read yet. */
  color: var(--text-muted);
}

.app-sidebar li.chapter-item[data-todo="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: var(--gating-todo-ink);
  -webkit-mask: var(--gating-todo-mask) no-repeat center / contain;
          mask: var(--gating-todo-mask) no-repeat center / contain;
}

.app-sidebar li.chapter-item[data-todo="true"] > .chapter-link-wrapper:hover > a:not(.chapter-fold-toggle) {
  color: var(--text-body);
}

/* Internal and todo page banners (in-content) ----------------------------- */
/* Shared box; the two differ only in ink and icon. */

.internal-banner,
.todo-banner {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0 0 2rem;
  padding: 0.85rem 1rem 0.9rem 2.6rem;
  position: relative;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gating-internal-ink);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-surface);
}

.internal-banner::before,
.todo-banner::before {
  content: "";
  position: absolute;
  top: 0.95rem;
  left: 0.95rem;
  width: 15px;
  height: 15px;
}

.internal-banner::before {
  background-color: var(--gating-internal-ink);
  -webkit-mask: var(--gating-internal-mask) no-repeat center / contain;
          mask: var(--gating-internal-mask) no-repeat center / contain;
}

.todo-banner {
  border-left-color: var(--gating-todo-ink);
}

.todo-banner::before {
  background-color: var(--gating-todo-ink);
  -webkit-mask: var(--gating-todo-mask) no-repeat center / contain;
          mask: var(--gating-todo-mask) no-repeat center / contain;
}

.internal-banner__label,
.todo-banner__label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.internal-banner__label {
  color: var(--gating-internal-ink);
}

.todo-banner__label {
  color: var(--gating-todo-ink);
}

.internal-banner__body,
.todo-banner__body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Inline code in a banner sits on the surface the banner already painted, so
   it needs its own ground to stay legible against it. */
.todo-banner__body code {
  background: var(--bg-page);
  padding: 0.05em 0.35em;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.92em;
}

/* 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 0.35rem;
}

/* Keep the full gap between the explanation block and the sign-in CTA;
   the small margin above only tightens the lines within the block. */
.locked-page__explanation:last-of-type {
  margin-bottom: 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;
}
