/*
 * Guide — the cards of a guide (Tour) over the page (shared/_guide.html.erb, guide_controller.js).
 * A modal <dialog> as large as the screen: the spotlight is a hole over the element a step talks about, its huge
 * shadow darkening the rest; with no element, the dialog itself darkens and the card sits in the middle.
 */
.guide {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;

  &::backdrop {
    background: transparent;
  }

  &[data-centered] {
    display: grid;
    place-items: center;
    background: var(--color-overlay);
  }

  [hidden] {
    display: none;
  }
}

.guide__spotlight {
  position: fixed;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 100vmax var(--color-overlay), 0 0 0 3px var(--toucan-mustard);
  pointer-events: none;
}

.guide__card {
  position: fixed;
  width: min(22rem, calc(100vw - var(--space-8)));
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);

  .guide[data-centered] & {
    position: static;
    width: min(26rem, calc(100vw - var(--space-8)));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .guide__spotlight,
  .guide__card {
    transition: top var(--duration-fast) var(--ease-out), left var(--duration-fast) var(--ease-out),
      width var(--duration-fast) var(--ease-out), height var(--duration-fast) var(--ease-out);
  }

  .guide[open] {
    animation: guide-in var(--duration-fast) var(--ease-out);
  }
}

@keyframes guide-in {
  from {
    opacity: 0;
  }
}

.guide__progress {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-subtle);
}

.guide__title {
  margin-top: var(--space-1);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);

  &:focus {
    outline: none;
  }
}

.guide__body {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
  white-space: pre-line;
}

.guide__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.guide__nav {
  display: flex;
  gap: var(--space-2);
}
