/*
  6.9.106: censored text. Secret parts of a share link and e-mail addresses are blurred under a drifting
  fine grain. Resting the pointer on them for 0.5 s (or keyboard focus, or a tap) lets the
  cloud fade and the text sharpen; leaving covers it again at once.

  Markup:  <span class="zf-censor" tabindex="0"><span class="zf-censor-t">text</span></span>
  - The text stays in the DOM, so copy buttons and screen readers get the real value.
  - [data-censor-scope] on an ancestor (a row link, the share field) reveals all censored text inside
    when that ancestor is hovered or focused.
  - .zf-censor-js: revealing is left to a script that sets .is-rev (used by Empfänger, where the
    address is fetched from the server and logged).

  6.9.114: while the pointer rests (or focus waits) a thin line fills under the pill in exactly the
  reveal delay, and the grain turns fuzzier and starts to stir, so it is clear that something is about
  to happen. The script variant gets the stirring grain while it has .is-arming (it has its own bar).
*/
:root {
  --zf-censor-delay: .5s;
  --zf-censor-fade: .38s;
  --zf-censor-ease: cubic-bezier(.2, .7, .2, 1);
  --zf-censor-line: #5c8001;
}

.zf-censor {
  --zf-censor-tint: color-mix(in srgb, currentColor 8%, transparent);
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: bottom;
  border-radius: 5px;
  isolation: isolate;
  overflow-wrap: anywhere;
  outline: none;
  /* A barely-there green shadow under the pill. */
  box-shadow: 0 1px 6px -1px rgba(92, 128, 1, .16), 0 0 0 .5px rgba(124, 181, 24, .08);
  transition: box-shadow var(--zf-censor-fade) var(--zf-censor-ease);
}

/* The text itself stays as a soft, readable-as-shape blur, like frosted glass. */
.zf-censor-t {
  display: inline;
  filter: blur(5px);
  opacity: .6;
  user-select: none;
  -webkit-user-select: none;
  transition: filter var(--zf-censor-fade) var(--zf-censor-ease), opacity var(--zf-censor-fade) var(--zf-censor-ease);
}

/* A flat pill with small corners: a faint tint plus fine random grain (SVG noise, no repeating
   pattern) in two layers that drift slowly against each other. */
.zf-censor::before,
.zf-censor::after {
  content: "";
  position: absolute;
  inset: -1px -3px;
  z-index: 1;
  pointer-events: none;
  border-radius: 5px;
  /* Soft edges: the pill fades out over its outer few pixels. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 5px, #000 calc(100% - 5px), transparent), linear-gradient(to bottom, transparent, #000 3px, #000 calc(100% - 3px), transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 5px, #000 calc(100% - 5px), transparent), linear-gradient(to bottom, transparent, #000 3px, #000 calc(100% - 3px), transparent);
  mask-composite: intersect;
  transition: opacity var(--zf-censor-fade) var(--zf-censor-ease), filter .2s ease-out, background-size .2s ease-out;
}
/* ::before carries two layers: the progress line (0 wide at rest, feathered tip) and the grain. */
.zf-censor::before {
  background-color: var(--zf-censor-tint);
  background-image: linear-gradient(to right, var(--zf-censor-line) calc(100% - 8px), transparent), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.11 0 0 0 0 0.14 0 0 0 0 0.09 0 0 0 1.7 -0.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: no-repeat, repeat;
  background-position: 0 calc(100% - 3px), 0 0;
  background-size: 0% 1.5px, 160px 160px;
  opacity: .5;
  animation: zfCensorDriftA 18s linear infinite;
}
.zf-censor::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.11 0 0 0 0 0.14 0 0 0 0 0.09 0 0 0 1.7 -0.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 120px 120px;
  opacity: .35;
  animation: zfCensorDriftB 24s linear infinite;
}
@keyframes zfCensorDriftA { from { background-position: 0 calc(100% - 3px), 0 0; } to { background-position: 0 calc(100% - 3px), 160px 40px; } }
@keyframes zfCensorDriftB { from { background-position: 0 0; } to { background-position: -120px -60px; } }
/* Stirring: the same drift, about eight times faster, the two layers flowing against each other. */
@keyframes zfCensorStirA { from { background-position: 0 calc(100% - 3px), 0 0; } to { background-position: 0 calc(100% - 3px), 200px 50px; } }
@keyframes zfCensorStirB { from { background-position: 0 0; } to { background-position: -150px -75px; } }

/* Revealed: after resting on it for 0.5 s, or set by script. Leaving covers it again immediately. */
.zf-censor:not(.zf-censor-js):hover .zf-censor-t,
.zf-censor:not(.zf-censor-js):focus .zf-censor-t,
[data-censor-scope]:hover .zf-censor:not(.zf-censor-js) .zf-censor-t,
[data-censor-scope]:focus-within .zf-censor:not(.zf-censor-js) .zf-censor-t,
[data-censor-scope]:focus-visible .zf-censor:not(.zf-censor-js) .zf-censor-t {
  filter: blur(0);
  opacity: 1;
  user-select: text;
  -webkit-user-select: text;
  transition-delay: var(--zf-censor-delay);
}
/* Waiting to reveal: the line fills during the delay while the grain stirs and goes soft; then the
   cloud fades. Leaving pulls the line back and covers the text again at once. */
:is(.zf-censor:hover, .zf-censor:focus, [data-censor-scope]:hover .zf-censor, [data-censor-scope]:focus-within .zf-censor, [data-censor-scope]:focus-visible .zf-censor):not(.zf-censor-js)::before,
:is(.zf-censor:hover, .zf-censor:focus, [data-censor-scope]:hover .zf-censor, [data-censor-scope]:focus-within .zf-censor, [data-censor-scope]:focus-visible .zf-censor):not(.zf-censor-js)::after,
.zf-censor.is-arming::before,
.zf-censor.is-arming::after {
  filter: blur(.5px);
  transition:
    opacity var(--zf-censor-fade) var(--zf-censor-ease) var(--zf-censor-delay),
    filter var(--zf-censor-delay) ease-in,
    background-size var(--zf-censor-delay) linear;
}
:is(.zf-censor:hover, .zf-censor:focus, [data-censor-scope]:hover .zf-censor, [data-censor-scope]:focus-within .zf-censor, [data-censor-scope]:focus-visible .zf-censor):not(.zf-censor-js)::before {
  opacity: 0;
  background-size: 100% 1.5px, 200px 200px;
  animation: zfCensorStirA 2.2s linear infinite;
}
:is(.zf-censor:hover, .zf-censor:focus, [data-censor-scope]:hover .zf-censor, [data-censor-scope]:focus-within .zf-censor, [data-censor-scope]:focus-visible .zf-censor):not(.zf-censor-js)::after {
  opacity: 0;
  background-size: 150px 150px;
  animation: zfCensorStirB 2s linear infinite;
}
.zf-censor.is-arming::before { background-size: 0% 1.5px, 200px 200px; animation: zfCensorStirA 2.2s linear infinite; }
.zf-censor.is-arming::after { background-size: 150px 150px; animation: zfCensorStirB 2s linear infinite; }
.zf-censor:not(.zf-censor-js):hover,
.zf-censor:not(.zf-censor-js):focus,
[data-censor-scope]:hover .zf-censor:not(.zf-censor-js),
[data-censor-scope]:focus-within .zf-censor:not(.zf-censor-js) { box-shadow: 0 0 0 0 transparent; transition-delay: var(--zf-censor-delay); }
.zf-censor.is-rev { box-shadow: 0 0 0 0 transparent; }
.zf-censor.zf-censor:focus-visible { box-shadow: 0 0 0 2px var(--ws-ink, #1c2417); transition-delay: 0s; }
.zf-censor.is-rev .zf-censor-t { filter: blur(0); opacity: 1; user-select: text; -webkit-user-select: text; }
.zf-censor.is-rev::before,
.zf-censor.is-rev::after { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  /* No drift, no stirring, no growing line: while waiting the line and the softer grain just appear,
     the reveal still comes after the same delay. */
  .zf-censor::before,
  .zf-censor::after { animation: none !important; }
  .zf-censor-t,
  .zf-censor::before,
  .zf-censor::after { transition-duration: .01s !important; }
}

@media print {
  .zf-censor-t { filter: none; opacity: 1; }
  .zf-censor::before,
  .zf-censor::after { display: none; }
}

/* Share field at the top of a booking page's workspace. */
.zf-share {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--ws-line, #e2e9d8);
  border-radius: 14px;
  background: var(--ws-sheet, #fff);
}
.zf-share-head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.zf-share-head strong { font-size: .86rem; color: var(--ws-ink, #1c2417); }
.zf-share-head small { font-size: .74rem; color: var(--ws-ink5, #61695b); }
.zf-share-url {
  display: block;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--ws-line, #e2e9d8);
  border-radius: 10px;
  background: var(--ws-paper, #f5f8ef);
  color: var(--ws-ink7, #3a4434);
  font-family: var(--zf-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: .78rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  cursor: default;
  outline: none;
}
.zf-share-url:focus-visible { box-shadow: 0 0 0 2px var(--ws-ink, #1c2417); }
.zf-share-url .zf-censor { vertical-align: baseline; margin-left: 4px; }
.zf-share-copy { white-space: nowrap; }
.zf-share-copy.is-done { background: var(--ws-lime-soft, #f1fad8); color: var(--ws-mark4, #26350a); }
@media (max-width: 600px) {
  .zf-share { grid-template-columns: 1fr; padding: 12px; }
  .zf-share-copy { width: 100%; justify-content: center; }
}

/* Empfänger: the hold-progress bar stays above the particle cloud. */
.zf-mask.zf-censor .zf-mask-bar { z-index: 2; }
