/* Gated content: the blurred stand-in a visitor who is not signed in sees in
   place of a locked fragment (templatetags/gating.py, and <redacted> spans in
   wiki articles). Plain CSS on purpose — it is loaded under both our Bootstrap
   5 pages and the wiki's bundled Bootstrap 4, so it leans on neither. */

.gated {
  position: relative;
  color: inherit;
}

.gated__veil {
  filter: blur(4px);
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
}

.gated__badge,
.gated__badge:hover,
.gated__badge:focus {
  display: inline-block;
  padding: 0.2em 0.7em;
  font-size: 0.85em;
  line-height: 1.4;
  color: #fff;
  white-space: nowrap;
  text-decoration: none;
  background: rgb(33 29 24 / 85%);
  border-radius: 999px;
}

.gated__badge:hover,
.gated__badge:focus {
  background: rgb(33 29 24 / 100%);
}

/* A panel: rows of blurred bars with the padlock centred over them. */
.gated--block {
  margin: 0.5rem 0 1rem;
}

.gated--block .gated__veil {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.75rem 0;
}

.gated__bar {
  display: block;
  height: 0.9rem;
  background: currentcolor;
  border-radius: 3px;
}

.gated__bar:nth-child(1) { width: 92%; }
.gated__bar:nth-child(2) { width: 78%; }
.gated__bar:nth-child(3) { width: 85%; }
.gated__bar:nth-child(4) { width: 60%; }

.gated--block .gated__badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* A chip in a line of text: one blurred bar, the padlock laid over it. */
.gated--inline {
  display: inline-block;
  vertical-align: baseline;
}

.gated--inline .gated__veil {
  display: inline-block;
  width: 8.5em;
  height: 0.9em;
  vertical-align: middle;
  background: currentcolor;
  border-radius: 3px;
}

.gated--inline .gated__badge {
  position: absolute;
  top: 50%;
  left: 0;
  padding: 0 0.5em;
  font-size: 0.75em;
  transform: translateY(-50%);
}

/* The smallest: a blurred stub with the padlock beside it, for table cells. */
.gated--mini {
  display: inline-flex;
  gap: 0.35em;
  align-items: center;
}

.gated--mini .gated__veil {
  display: inline-block;
  width: 1.5em;
  height: 0.8em;
  background: currentcolor;
  border-radius: 2px;
}

.gated--mini .gated__badge,
.gated--mini .gated__badge:hover,
.gated--mini .gated__badge:focus {
  padding: 0;
  font-size: 0.8em;
  background: none;
}

/* Redacted wiki text in a line: a blurred bar with the padlock centred on
   it. Bucketed by length so the stand-in does not give the exact length of
   the secret away. */
.gated--redaction {
  display: inline-block;
  vertical-align: baseline;
}

.gated--redaction .gated__veil {
  display: inline-block;
  height: 0.9em;
  vertical-align: middle;
  background: currentcolor;
  border-radius: 3px;
}

.gated--redaction .gated__badge {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 0 0.4em;
  font-size: 0.75em;
  transform: translate(-50%, -50%);
}

.gated--short .gated__veil { width: 4em; }
.gated--medium .gated__veil { width: 9em; }
.gated--long .gated__veil { width: 16em; }

/* What a signed-in reader sees instead: the text, marked as hidden from the
   public so an author can tell at a glance. */
.redaction-reveal {
  background: rgb(176 48 48 / 10%);
  border-bottom: 1px dashed rgb(176 48 48 / 60%);
}

div.redaction-reveal {
  padding: 0.25rem 0.75rem;
  margin: 0 0 1rem;
  border-bottom: 0;
  border-left: 3px solid rgb(176 48 48 / 60%);
}
