/*
 * Demo mode (lot 17, D019): the entry page /demo (public site), the demo band of the shell, the conversion and sign-out
 * dialogs, and the simulated e-mails. Colours, radii and motion come from tokens.css.
 */

/* ==========================================================================
   Entry page: copy and form on the left; on the desk, the letterhead of the sample company whose files are ticked one
   after the other while the demo is prepared (the only motion of the page).
   ========================================================================== */
.yb-demo {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
}

.yb-demo__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--yb-space-12);
  align-items: stretch;
  min-height: min(680px, calc(100svh - var(--yb-site-header, 64px)));
}

.yb-demo__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(48px, 2rem + 4vw, 104px);
}

.yb-demo__title {
  max-width: 18ch;
  font-size: var(--yb-mkt-page-title);
  line-height: 1.06;
  font-weight: 660;
  letter-spacing: -0.038em;
  text-wrap: balance;
}

.yb-demo__lead {
  max-width: 48ch;
  margin-top: var(--yb-space-5);
  color: var(--yb-text-muted);
  font-size: var(--yb-mkt-lead);
  line-height: 1.55;
}

.yb-demo__form {
  margin-top: var(--yb-space-8);
}

.yb-demo__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--yb-space-3) var(--yb-space-4);
  margin-top: var(--yb-space-8);
}

/* Honeypot: out of sight and out of the accessibility tree, but still a text field for naive bots. */
.yb-demo__trap {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.yb-demo__start.mud-button-root {
  min-width: 15rem;
  justify-content: center;
}

/* The title says what is happening while the demo is prepared. */
.yb-demo__title-busy,
.yb-demo__title-open,
.yb-demo[data-demo-state="working"] .yb-demo__title-idle,
.yb-demo[data-demo-state="open"] .yb-demo__title-idle {
  display: none;
}

.yb-demo[data-demo-state="working"] .yb-demo__title-busy,
.yb-demo[data-demo-state="open"] .yb-demo__title-open {
  display: inline;
}

.yb-demo__start-busy {
  display: none;
  align-items: center;
  gap: var(--yb-space-3);
}

.yb-demo[data-demo-state="working"] .yb-demo__start-idle {
  display: none;
}

.yb-demo[data-demo-state="working"] .yb-demo__start-busy {
  display: inline-flex;
}

.yb-demo[data-demo-state="working"] .yb-demo__start.mud-button-root {
  cursor: progress;
  background: var(--yb-primary-hover);
}

.yb-demo__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid color-mix(in srgb, var(--yb-on-primary) 35%, transparent);
  border-top-color: var(--yb-on-primary);
  border-radius: 50%;
  animation: yb-demo-spin 0.8s linear infinite;
}

.yb-demo__facts {
  display: grid;
  gap: var(--yb-space-2);
  margin-top: var(--yb-space-6);
  padding: 0;
  list-style: none;
  color: var(--yb-text-muted);
  font-size: var(--yb-mkt-small);
}

.yb-demo__facts li {
  display: flex;
  align-items: flex-start;
  gap: var(--yb-space-2);
}

.yb-demo__facts .mud-icon-root {
  flex: none;
  margin-top: 1px;
  color: var(--yb-success);
}

/* The desk and the letterhead. */
.yb-demo__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(40px, 2rem + 2vw, 64px) 0 clamp(40px, 2rem + 2vw, 72px) clamp(24px, 1rem + 2vw, 56px);
}

.yb-demo__stage::before {
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--yb-bleed, 0px)) 0 0;
  z-index: -1;
  border-radius: 0 0 0 32px;
  background: var(--yb-brand-surface);
}

.yb-demo__sheet {
  width: min(100%, 420px);
  padding: 28px 28px 22px;
  border-radius: 8px;
  background: var(--yb-surface);
  color: var(--yb-text);
  box-shadow: var(--yb-shadow-lg);
}

.yb-demo__letterhead {
  display: flex;
  align-items: center;
  gap: var(--yb-space-4);
}

.yb-demo__logo {
  display: block;
  flex: none;
  width: 52px;
  height: 52px;
}

.yb-demo__logo svg {
  display: block;
  width: 100%;
  height: 100%;
}

.yb-demo__company {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.yb-demo__company strong {
  font-size: 1.0625rem;
  font-weight: var(--yb-weight-strong);
  letter-spacing: -0.01em;
}

.yb-demo__company span {
  color: var(--yb-text-muted);
  font-size: 0.8125rem;
}

.yb-demo__iban {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px var(--yb-space-3);
  margin-top: var(--yb-space-5);
  padding: var(--yb-space-3) var(--yb-space-4);
  border-radius: var(--yb-radius-sm);
  background: var(--yb-bg-sunken);
  color: var(--yb-text-muted);
  font-size: 0.8125rem;
}

.yb-demo__mono {
  color: var(--yb-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.yb-demo__perforation {
  margin-block: var(--yb-space-5) var(--yb-space-4);
}

.yb-demo__perforation .yb-perforation__scissors.mud-icon-root {
  background: var(--yb-surface);
}

.yb-demo__steps-title {
  color: var(--yb-text-muted);
  font-size: 0.8125rem;
  font-weight: var(--yb-weight-strong);
}

.yb-demo__steps {
  display: grid;
  gap: var(--yb-space-1);
  margin: var(--yb-space-3) 0 0;
  padding: 0;
  list-style: none;
}

.yb-demo__steps li {
  display: flex;
  align-items: center;
  gap: var(--yb-space-3);
  min-height: 36px;
  font-size: 0.9375rem;
}

.yb-demo__tick {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px dashed var(--yb-border-input);
  border-radius: 50%;
  color: transparent;
}

.yb-demo__tick .mud-icon-root {
  font-size: 15px;
}

.yb-demo__live {
  min-height: 1.4em;
  margin-top: var(--yb-space-3);
  color: var(--yb-text-muted);
  font-size: 0.8125rem;
}

/* Preparing: each file of the company is ticked in turn; the last one waits for the server. */
.yb-demo[data-demo-state="working"] .yb-demo__tick {
  animation: yb-demo-tick 0.36s var(--yb-ease) both;
  animation-delay: calc(0.4s + var(--yb-step) * 0.6s);
}

.yb-demo[data-demo-state="working"] .yb-demo__steps li:last-child .yb-demo__tick {
  animation: yb-demo-wait 1.2s ease-in-out calc(0.4s + 3 * 0.6s) infinite;
}

/* Ready: every file is ticked, the button opens the demo. */
.yb-demo[data-demo-state="open"] .yb-demo__tick {
  border-style: solid;
  border-color: var(--yb-success);
  background: var(--yb-success);
  color: var(--yb-surface);
}

.yb-demo[data-demo-state="open"] .yb-demo__live {
  color: var(--yb-text);
  font-weight: var(--yb-weight-strong);
}

@keyframes yb-demo-tick {
  from {
    transform: scale(0.6);
  }

  to {
    border-style: solid;
    border-color: var(--yb-success);
    background: var(--yb-success);
    color: var(--yb-surface);
    transform: scale(1);
  }
}

@keyframes yb-demo-wait {
  0%,
  100% {
    border-style: solid;
    border-color: var(--yb-accent);
    background: transparent;
  }

  50% {
    border-style: solid;
    border-color: var(--yb-accent);
    background: var(--yb-accent-soft);
  }
}

@keyframes yb-demo-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .yb-demo[data-demo-state="working"] .yb-demo__tick {
    animation-duration: 0.01s;
  }

  .yb-demo[data-demo-state="working"] .yb-demo__steps li:last-child .yb-demo__tick {
    animation: none;
    border-style: solid;
    border-color: var(--yb-accent);
  }

  .yb-demo__spinner {
    animation-duration: 2.4s;
  }
}

.yb-demo__problem .yb-demo__title {
  max-width: 22ch;
}

@media (max-width: 1023px) {
  .yb-demo__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-height: 0;
  }

  .yb-demo__copy {
    padding-block: var(--yb-space-12) var(--yb-space-10);
  }

  .yb-demo__stage {
    margin-inline: calc(-1 * var(--yb-site-gutter, 16px));
    padding: var(--yb-space-10) var(--yb-site-gutter, 16px) var(--yb-space-12);
  }

  .yb-demo__stage::before {
    inset: 0;
    border-radius: 0;
  }
  /* Phones and tablets: while the demo is prepared, the copy steps aside so that the ticking sheet comes into view. */
  .yb-demo[data-demo-state="working"] .yb-demo__lead,
  .yb-demo[data-demo-state="working"] .yb-demo__facts,
  .yb-demo[data-demo-state="open"] .yb-demo__lead,
  .yb-demo[data-demo-state="open"] .yb-demo__facts {
    display: none;
  }

  .yb-demo[data-demo-state="working"] .yb-demo__copy,
  .yb-demo[data-demo-state="open"] .yb-demo__copy {
    padding-block: var(--yb-space-10) var(--yb-space-8);
  }
}

@media (max-width: 479px) {
  .yb-demo__sheet {
    padding: 22px 18px 16px;
  }

  .yb-demo__start.mud-button-root {
    width: 100%;
  }
}

/* ==========================================================================
   Shell: the demo band. Same geometry as the other banners, on the brand ink so that it reads as the state of the whole
   session rather than a passing notice; its single filled action is saffron (the page keeps the petrol primary).
   ========================================================================== */
.yb-banner.yb-banner--demo {
  border-color: transparent;
  background: var(--yb-brand-surface);
  color: var(--yb-on-brand);
}

.yb-banner--demo .yb-banner__icon {
  color: var(--yb-accent);
}

.yb-banner--demo .yb-banner__text {
  font-size: var(--yb-text-body);
  line-height: var(--yb-leading-body);
}

.yb-banner--demo .yb-banner__actions {
  gap: var(--yb-space-2);
}

.yb-banner--demo__short {
  display: none;
}

.yb-banner--demo__link {
  display: inline-flex;
  align-items: center;
  gap: var(--yb-space-1);
  min-height: 32px;
  padding: 0 var(--yb-space-2);
  border-radius: var(--yb-radius-sm);
  color: var(--yb-on-brand);
  font-size: var(--yb-text-caption);
  font-weight: var(--yb-weight-medium);
  text-decoration: underline;
  text-decoration-color: var(--yb-on-brand-muted);
  text-underline-offset: 4px;
}

.yb-banner--demo__link:hover {
  color: var(--yb-on-brand);
  text-decoration-color: currentColor;
}

.yb-banner--demo__link:focus-visible,
.yb-banner--demo__convert.mud-button-root:focus-visible {
  outline: 2px solid var(--yb-accent);
  outline-offset: 2px;
}

.yb-banner--demo__convert.mud-button-root,
.yb-banner--demo__convert.mud-button-root:hover {
  min-height: 32px;
  background: var(--yb-accent);
  color: var(--yb-on-accent);
  font-weight: var(--yb-weight-strong);
  white-space: nowrap;
}

.yb-banner--demo__convert.mud-button-root:hover {
  background: color-mix(in srgb, var(--yb-accent) 82%, #ffffff);
}

@media (max-width: 1199px) {
  .yb-banner--demo .yb-banner--demo__long {
    display: none;
  }

  .yb-banner--demo .yb-banner--demo__short {
    display: inline;
  }
}

@media (max-width: 767px) {
  .yb-banner--demo .yb-banner__text {
    flex: 1 1 calc(100% - 40px);
    font-size: var(--yb-text-caption);
  }

  .yb-banner--demo .yb-banner__actions {
    flex: 1 1 100%;
    justify-content: space-between;
    margin-left: 28px;
  }
}

.yb-avatar.yb-avatar--demo {
  background: var(--yb-accent-soft);
  color: var(--yb-on-accent-soft);
}

/* ==========================================================================
   Dialogs: conversion, leaving the demo, preview of a simulated e-mail.
   ========================================================================== */
.yb-demo-convert__fields {
  display: grid;
  gap: var(--yb-space-4);
  margin-top: var(--yb-space-4);
}

.yb-demo-convert__taken {
  display: flex;
  gap: var(--yb-space-2);
  padding: var(--yb-space-3);
  border-radius: var(--yb-radius-md);
  background: var(--yb-info-soft);
  color: var(--yb-text);
  font-size: var(--yb-text-caption);
  line-height: var(--yb-leading-caption);
}

.yb-demo-convert__taken .mud-icon-root {
  flex: none;
  color: var(--yb-info);
}

.yb-demo-convert__taken p {
  display: grid;
  gap: 2px;
}

.yb-demo-convert__taken a {
  justify-self: start;
  font-weight: var(--yb-weight-strong);
}

.yb-demo-convert__terms {
  display: grid;
  gap: var(--yb-space-1);
}

.yb-demo-convert__terms .mud-checkbox {
  margin-left: -8px;
}

.yb-demo-convert__links {
  padding-left: 34px;
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
}

.yb-demo-convert__done {
  display: flex;
  align-items: flex-start;
  gap: var(--yb-space-4);
  padding-block: var(--yb-space-2);
}

.yb-demo-convert__stamp {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--yb-success-soft);
  color: var(--yb-success);
}

.yb-demo-leave {
  display: flex;
  gap: var(--yb-space-4);
}

.yb-demo-leave__icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--yb-warning-soft);
  color: var(--yb-warning);
}

.yb-demo-leave p + p {
  margin-top: var(--yb-space-2);
}

.yb-demo-leave__keep {
  font-weight: var(--yb-weight-strong);
}

.yb-demo-leave__form {
  display: contents;
}

.yb-demo-leave__spacer {
  flex: 1;
}

@media (max-width: 599px) {
  .yb-demo-dialog .mud-dialog-actions {
    flex-wrap: wrap;
  }

  .yb-demo-leave__spacer {
    display: none;
  }
}

.yb-demo-mail__note {
  display: flex;
  align-items: center;
  gap: var(--yb-space-2);
  padding: var(--yb-space-2) var(--yb-space-3);
  border-radius: var(--yb-radius-md);
  background: var(--yb-accent-soft);
  color: var(--yb-on-accent-soft);
  font-size: var(--yb-text-caption);
}

.yb-demo-mail__envelope {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--yb-space-1) var(--yb-space-4);
  margin: var(--yb-space-4) 0;
  font-size: var(--yb-text-caption);
}

.yb-demo-mail__envelope dt {
  color: var(--yb-text-muted);
}

.yb-demo-mail__envelope dd {
  margin: 0;
}

.yb-demo-mail__subject {
  font-weight: var(--yb-weight-strong);
}

.yb-demo-mail__files {
  display: flex;
  flex-wrap: wrap;
  gap: var(--yb-space-2);
}

.yb-demo-mail__file {
  display: inline-flex;
  align-items: center;
  gap: var(--yb-space-1);
  max-width: 100%;
  padding: 2px var(--yb-space-2);
  border: 1px solid var(--yb-border);
  border-radius: var(--yb-radius-sm);
  background: var(--yb-bg-sunken);
}

.yb-demo-mail__file .mud-icon-root {
  color: var(--yb-error);
}

/* The message as the client receives it: always on white, like a mail client. */
.yb-demo-mail__frame {
  display: block;
  width: 100%;
  height: min(60vh, 560px);
  border: 1px solid var(--yb-border);
  border-radius: var(--yb-radius-md);
  background: #ffffff;
}

/* After a send in the demo (confirmation of the send dialog): nothing left, the e-mail opens as the client would see it. */
.yb-demo-sent {
  display: flex;
  align-items: center;
  gap: var(--yb-space-2) var(--yb-space-3);
  max-width: 30rem;
  margin-bottom: var(--yb-space-2);
  padding: var(--yb-space-2) var(--yb-space-2) var(--yb-space-2) var(--yb-space-3);
  border-radius: var(--yb-radius-md);
  background: var(--yb-accent-soft);
  color: var(--yb-on-accent-soft);
  font-size: var(--yb-text-caption);
  line-height: var(--yb-leading-caption);
  text-align: left;
}

.yb-demo-sent__icon.mud-icon-root {
  flex: none;
}

.yb-demo-sent__text {
  flex: 1;
  min-width: 0;
}

.yb-demo-sent__action.mud-button-root {
  flex: none;
  background: var(--yb-surface);
}

@media (max-width: 479px) {
  .yb-demo-sent {
    flex-wrap: wrap;
  }

  .yb-demo-sent__action.mud-button-root {
    width: 100%;
  }
}

/* Timeline of a document: a simulated send says so, and opens its e-mail. */
.yb-pill.yb-timeline__tag {
  height: 20px;
  margin-left: var(--yb-space-2);
  background: var(--yb-accent-soft);
  color: var(--yb-on-accent-soft);
  vertical-align: 1px;
}

button.yb-timeline__link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--yb-primary);
  font: inherit;
  font-size: var(--yb-text-caption);
  font-weight: var(--yb-weight-medium);
  cursor: pointer;
}

button.yb-timeline__link:hover {
  color: var(--yb-primary-hover);
}

button.yb-timeline__link:focus-visible {
  outline: 2px solid var(--yb-focus);
  outline-offset: 2px;
  border-radius: var(--yb-radius-sm);
}

/* ==========================================================================
   Simulated e-mails page and settings notes.
   ========================================================================== */
.yb-demo-mails__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.yb-demo-mails__list li + li {
  border-top: 1px solid var(--yb-border);
}

.yb-demo-mails__row {
  display: flex;
  align-items: center;
  gap: var(--yb-space-3);
  width: 100%;
  min-height: 64px;
  padding: var(--yb-space-3) var(--yb-space-4);
  border: 0;
  background: none;
  color: var(--yb-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.yb-demo-mails__row:hover {
  background: var(--yb-hover);
}

.yb-demo-mails__row:focus-visible {
  outline: 2px solid var(--yb-focus);
  outline-offset: -2px;
}

.yb-demo-mails__icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--yb-radius-md);
  background: var(--yb-primary-soft);
  color: var(--yb-on-primary-soft);
}

.yb-demo-mails__main {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.yb-demo-mails__subject {
  font-weight: var(--yb-weight-strong);
}

.yb-demo-mails__to {
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
}

.yb-demo-mails__meta {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--yb-space-3);
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
  font-variant-numeric: tabular-nums;
}

.yb-demo-mails__chevron.mud-icon-root {
  flex: none;
  color: var(--yb-text-muted);
}

@media (max-width: 599px) {
  .yb-demo-mails__row {
    flex-wrap: wrap;
  }

  .yb-demo-mails__meta {
    order: 3;
    width: 100%;
    padding-left: calc(36px + var(--yb-space-3));
  }

  .yb-demo-mails__chevron.mud-icon-root {
    display: none;
  }
}

.yb-demo-note {
  margin-bottom: var(--yb-space-4);
  container-type: inline-size;
}

.yb-demo-note__body {
  display: flex;
  align-items: flex-start;
  gap: var(--yb-space-4);
}

.yb-demo-note__icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--yb-radius-md);
  background: var(--yb-accent-soft);
  color: var(--yb-on-accent-soft);
}

.yb-demo-note__text {
  display: grid;
  flex: 1;
  gap: var(--yb-space-2);
  min-width: 0;
  max-width: 64ch;
}

.yb-demo-note__muted {
  color: var(--yb-text-muted);
  font-size: var(--yb-text-caption);
}

.yb-demo-note__action.mud-button-root {
  flex: none;
  align-self: center;
}

/* Narrow panel (phone, tablet with the settings list beside it): the action goes under the text. */
@container (max-width: 560px) {
  .yb-demo-note__body {
    flex-wrap: wrap;
  }

  .yb-demo-note__text {
    flex-basis: calc(100% - 40px - var(--yb-space-4));
  }

  .yb-demo-note__action.mud-button-root {
    margin-left: calc(40px + var(--yb-space-4));
  }
}

@container (max-width: 400px) {
  .yb-demo-note__action.mud-button-root {
    width: calc(100% - 40px - var(--yb-space-4));
  }
}
