/*
  "Explain this demo" review layer. Safe to leave linked at launch: nothing here
  renders unless explain-mode.js is enabled in review-config.js.
*/

.xp-bar {
  position: fixed;
  z-index: 150;
  left: max(1rem, env(safe-area-inset-left));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  gap: 0.5rem;
  align-items: center;
  transition: bottom 200ms ease;
}

body.has-sticky-cta .xp-bar {
  bottom: calc(4.9rem + env(safe-area-inset-bottom));
}

.xp-toggle,
.xp-tour {
  display: inline-flex;
  min-height: 2.75rem;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem 1rem;
  color: var(--forest-deep);
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(32, 63, 53, 0.25);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(13, 33, 27, 0.18);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
}

.xp-toggle-dot {
  width: 0.65rem;
  height: 0.65rem;
  border: 2px solid var(--copper);
  border-radius: 50%;
}

.xp-toggle[aria-pressed="true"] {
  color: white;
  background: var(--copper-deep);
  border-color: var(--copper-deep);
}

.xp-toggle[aria-pressed="true"] .xp-toggle-dot {
  background: white;
  border-color: white;
}

.xp-tour {
  color: white;
  background: var(--forest);
  border-color: var(--forest);
}

.xp-layer {
  position: fixed;
  z-index: 140;
  inset: 0 auto auto 0;
  width: 0;
  height: 0;
}

.xp-marker {
  position: fixed;
  display: grid;
  width: 2rem;
  height: 2rem;
  padding: 0;
  place-items: center;
  color: white;
  background: var(--copper-deep);
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(13, 33, 27, 0.35);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
}

.xp-marker:hover,
.xp-marker[aria-current="true"] {
  background: var(--forest-deep);
}

.xp-marker:focus-visible {
  outline: 3px solid var(--forest-deep);
  outline-offset: 2px;
}

.xp-highlight {
  outline: 3px dashed var(--copper) !important;
  outline-offset: 4px;
}

.xp-panel {
  position: fixed;
  z-index: 160;
  top: 1rem;
  right: max(1rem, env(safe-area-inset-right));
  bottom: 1rem;
  width: min(25rem, calc(100vw - 2rem));
  padding: 1.25rem 1.4rem 1.4rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(13, 33, 27, 0.28);
  animation: xp-slide-in 220ms ease;
}

.xp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.xp-count {
  margin: 0;
  color: var(--copper-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.xp-close {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--forest-deep);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.xp-title {
  margin: 0.6rem 0 0.5rem;
  font-size: 1.6rem;
}

.xp-title:focus {
  outline: none;
}

.xp-status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  margin: 0 0 1rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
}

.xp-status::before {
  margin-right: 0.35rem;
}

.xp-status[data-status="verified"] {
  color: #1d4d36;
  background: #dcefe3;
}

.xp-status[data-status="verified"]::before {
  content: "✓";
}

.xp-status[data-status="approval"] {
  color: #6b4100;
  background: #fbe9c8;
}

.xp-status[data-status="approval"]::before {
  content: "!";
}

.xp-status[data-status="placeholder"] {
  color: #65341f;
  background: #f5ded0;
}

.xp-status[data-status="placeholder"]::before {
  content: "○";
}

.xp-fields {
  display: grid;
  gap: 0.2rem;
  margin: 0;
}

.xp-fields dt {
  margin-top: 0.75rem;
  color: var(--forest);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.xp-fields dd {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
}

.xp-nav {
  position: sticky;
  bottom: -1.4rem;
  display: flex;
  gap: 0.5rem;
  padding-block: 0.85rem 0.25rem;
  margin-top: 1.25rem;
  background: var(--paper);
}

.xp-step {
  flex: 1;
  min-height: 2.75rem;
  color: var(--forest-deep);
  background: white;
  border: 1px solid #b9c2bd;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}

.xp-step--primary {
  color: white;
  background: var(--forest);
  border-color: var(--forest);
}

.xp-step:disabled {
  opacity: 0.45;
  cursor: default;
}

@keyframes xp-slide-in {
  from {
    opacity: 0;
    transform: translateX(1.5rem);
  }
}

/* Phones: bottom sheet */
@media (max-width: 45rem) {
  .xp-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: 58svh;
    padding-bottom: max(1.4rem, env(safe-area-inset-bottom));
    border-radius: var(--radius) var(--radius) 0 0;
    animation-name: xp-sheet-in;
  }
  body.xp-panel-open .xp-bar {
    display: none;
  }
  .xp-nav {
    bottom: calc(-1 * max(1.4rem, env(safe-area-inset-bottom)));
    padding-bottom: 0.5rem;
  }
  .xp-toggle span:last-child {
    font-size: 0.76rem;
  }
}

@keyframes xp-sheet-in {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .xp-panel {
    animation: none;
  }
  .xp-bar {
    transition: none;
  }
}

@media print {
  .xp-bar,
  .xp-layer,
  .xp-panel {
    display: none !important;
  }
}
