/* Driver.js tour skin — CommunityDX storefront card.
   Orange punch stripe + navy masthead + cream body + white footer,
   same geometry as surface-card / impact-stats / btn-primary. */

.driver-popover.cdx-driver-popover {
  display: block;
  max-width: min(380px, calc(100vw - 32px));
  padding: 0;
  color: var(--neo-ink);
  background: var(--color-bg);
  border: var(--neo-border-width) solid var(--neo-ink);
  border-radius: 0;
  box-shadow: var(--neo-shadow-deep);
  font-family: var(--font-family);
}

/* Punch stripe: the same orange top edge the storefront footer uses. */
.driver-popover.cdx-driver-popover::before {
  content: "";
  display: block;
  height: 6px;
  background: var(--color-cta);
}

/* The opening explanation belongs to the canvas as a whole, so place it in
   the middle of the map instead of hanging it off one viewport edge. */
.driver-popover.cdx-driver-popover--map-center {
  position: fixed !important;
  inset: auto !important;
  top: 50% !important;
  left: 50% !important;
  max-width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, -50%) !important;
}

.driver-popover.cdx-driver-popover--map-center .driver-popover-arrow {
  display: none;
}

/* The tour's handoff stop out of the Analysis Panel. It is the widest popover
   in the tour (a three-button footer plus a long label) and it talks about the
   panel as a whole, so park it beside the panel rather than letting Driver hang
   it off one section's edge, where a 460px card would ride over the panel.
   --cdx-panel-inset is the panel's rendered width, published on the document
   element by features/demoMode/index.js; 65px is the rail on its own. */
.driver-popover.cdx-driver-popover--panel-left {
  position: fixed !important;
  inset: auto !important;
  top: 50% !important;
  right: calc(var(--cdx-panel-inset, 65px) + 16px) !important;
  max-width: min(460px, calc(100vw - var(--cdx-panel-inset, 65px) - 48px));
  transform: translateY(-50%) !important;
}

/* Settings can dock the panel and toolbar left, and the inset swaps with it. */
body.panel-dock-left .driver-popover.cdx-driver-popover--panel-left {
  right: auto !important;
  left: calc(var(--cdx-panel-inset, 65px) + 16px) !important;
}

.driver-popover.cdx-driver-popover--panel-left .driver-popover-arrow {
  display: none;
}

/* Navy masthead, same fill as the impact band. */
.driver-popover.cdx-driver-popover .driver-popover-title {
  margin: 0;
  padding: 14px 44px 14px 16px;
  color: var(--color-white);
  background: var(--color-brand-navy);
  border-bottom: var(--neo-border-width) solid var(--neo-ink);
  font-family: var(--font-family-heading);
  font-size: 18px;
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.3px;
  line-height: 1.2;
  text-transform: none;
}

.driver-popover.cdx-driver-popover .driver-popover-description {
  padding: 16px;
  color: var(--color-gray-90);
  font-size: 14px;
  line-height: 1.55;
}

/* Bulleted tour copy. Same language as .guide-list in guides.css: square
   markers, teal marker color. Restated here because layout.css strips list
   styling globally. */
.driver-popover.cdx-driver-popover .cdx-tour-list {
  list-style: square;
  margin: 8px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.driver-popover.cdx-driver-popover .cdx-tour-list > li::marker {
  color: var(--color-brand-teal);
}

.driver-popover.cdx-driver-popover .cdx-tour-list strong {
  color: var(--neo-ink);
}

/* Quiet ToC under the tour copy. Same language as .guide-toc: a small
   heading and ruled links, not a second neo card. */
.driver-popover.cdx-driver-popover .cdx-tour-guide-section {
  padding: 12px 0 0;
  margin-top: 14px;
  border-top: 2px solid var(--neo-ink);
  text-transform: capitalize;
}

.driver-popover.cdx-driver-popover .cdx-tour-guide-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
}

.driver-popover.cdx-driver-popover .cdx-tour-guide-label {
  color: var(--color-gray-60);
  font-family: var(--font-family-heading);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.driver-popover.cdx-driver-popover .cdx-tour-guide-note {
  color: var(--color-gray-60);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  text-align: right;
}

.driver-popover.cdx-driver-popover .cdx-tour-guides {
  display: grid;
  gap: 0;
}

.driver-popover.cdx-driver-popover .cdx-tour-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  color: var(--color-gray-60);
  background: none;
  border: none;
  border-left: 3px solid var(--color-gray-20);
  box-shadow: none;
  font-size: 13px;
  font-weight: var(--font-weight-medium);
  line-height: 1.3;
  text-decoration: none;
}

.driver-popover.cdx-driver-popover .cdx-tour-guide:hover {
  color: var(--neo-ink);
  background: var(--color-white);
  border-left-color: var(--color-brand-teal);
}

.driver-popover.cdx-driver-popover .cdx-tour-guide:focus-visible {
  outline: 3px solid var(--color-brand-teal);
  outline-offset: 2px;
}

.driver-popover.cdx-driver-popover .cdx-tour-guide__external {
  flex: 0 0 auto;
  color: var(--color-gray-40);
  font-size: 13px;
  line-height: 1;
}

/* White footer bar: welcome-series ticks + storefront buttons.
   Wraps because a handoff stop carries three buttons (Back, the handoff, Done)
   and they do not fit beside the ticks at this popover width. */
.driver-popover.cdx-driver-popover .driver-popover-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  /* Only bites on the wrapped row, where the buttons sit alone. */
  justify-content: flex-end;
  gap: 10px;
  margin-top: 0;
  padding: 12px 16px;
  background: var(--color-white);
  border-top: var(--neo-border-width) solid var(--neo-ink);
}

/* The ticks take the slack in the footer, which both pushes the buttons right
   and keeps the strip on one line. The 88px floor is what decides the two-row
   footer: below it a three-button group no longer fits beside the ticks, so it
   takes its own row whole instead of shrinking its labels. */
.driver-popover.cdx-driver-popover .driver-popover-progress-text {
  display: flex !important;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 88px;
  align-items: center;
  gap: 4px;
  padding: 0;
  color: inherit;
  background: none;
  border: none;
}

.driver-popover.cdx-driver-popover .cdx-welcome__tick {
  width: 8px;
  height: 8px;
  background: var(--color-gray-20);
  border: 2px solid var(--neo-ink);
  box-shadow: none;
}

.driver-popover.cdx-driver-popover .cdx-welcome__tick.is-current {
  background: var(--color-cta);
  box-shadow: none;
}

.driver-popover.cdx-driver-popover .driver-popover-navigation-btns {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  justify-content: flex-end;
  gap: 8px;
}

.driver-popover.cdx-driver-popover button:not(.driver-popover-close-btn) {
  min-height: 34px;
  padding: 7px 14px;
  /* A handoff label is a phrase ("Tour the toolbar"); broken over two lines it
     reads as two buttons. */
  white-space: nowrap;
  color: var(--neo-ink);
  text-shadow: none;
  background: var(--color-white);
  border: 2px solid var(--neo-ink);
  border-radius: 0;
  box-shadow: var(--neo-shadow-subtle);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease, color 0.1s ease;
}

.driver-popover.cdx-driver-popover button:not(.driver-popover-close-btn):hover {
  background: var(--neo-ink);
  color: var(--color-white);
  box-shadow: var(--neo-shadow);
  transform: translate(-1px, -1px);
}

.driver-popover.cdx-driver-popover button:not(.driver-popover-close-btn):active {
  box-shadow: none;
  transform: translate(2px, 2px);
}

.driver-popover.cdx-driver-popover button:not(.driver-popover-close-btn):focus-visible {
  outline: 2px solid var(--color-brand-teal);
  outline-offset: 0;
}

.driver-popover.cdx-driver-popover .driver-popover-next-btn,
.driver-popover.cdx-driver-popover .driver-popover-done-btn {
  color: var(--color-white);
  background: var(--color-cta);
}

.driver-popover.cdx-driver-popover .driver-popover-next-btn:hover,
.driver-popover.cdx-driver-popover .driver-popover-done-btn:hover {
  background: var(--color-cta-dark);
  color: var(--color-white);
}

/* Sits right of the orange Next on a handoff stop, where Next continues into
   the next tour instead of ending this one. Navy reads as the quieter way out.
   Appended by appendDoneButton in driver/atlas-demo-tour.js, so Driver never
   renders it itself. */
.driver-popover.cdx-driver-popover .cdx-tour-done-btn {
  color: var(--color-white);
  background: var(--color-brand-navy);
}

.driver-popover.cdx-driver-popover .cdx-tour-done-btn:hover {
  background: var(--color-brand-navy-dark);
  color: var(--color-white);
}

.driver-popover.cdx-driver-popover .driver-popover-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 10px;
  right: 8px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  color: var(--color-white);
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.driver-popover.cdx-driver-popover .driver-popover-close-btn:hover,
.driver-popover.cdx-driver-popover .driver-popover-close-btn:active {
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  transform: none;
}

.driver-popover.cdx-driver-popover .driver-popover-close-btn:focus-visible {
  outline: 2px solid var(--color-brand-teal);
  outline-offset: 0;
}

.driver-popover.cdx-driver-popover .driver-popover-arrow {
  border-width: 10px;
}

.driver-popover.cdx-driver-popover .driver-popover-arrow-side-left.driver-popover-arrow {
  border-left-color: var(--neo-ink);
}

.driver-popover.cdx-driver-popover .driver-popover-arrow-side-right.driver-popover-arrow {
  border-right-color: var(--neo-ink);
}

.driver-popover.cdx-driver-popover .driver-popover-arrow-side-top.driver-popover-arrow {
  border-top-color: var(--neo-ink);
}

.driver-popover.cdx-driver-popover .driver-popover-arrow-side-bottom.driver-popover-arrow {
  border-bottom-color: var(--neo-ink);
}

.driver-active-element {
  outline: 2px solid var(--color-brand-teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .driver-popover.cdx-driver-popover button:not(.driver-popover-close-btn) {
    transition: none;
  }

  .driver-popover.cdx-driver-popover button:not(.driver-popover-close-btn):hover,
  .driver-popover.cdx-driver-popover button:not(.driver-popover-close-btn):active {
    transform: none;
  }
}

@media (max-width: 640px) {
  .driver-popover.cdx-driver-popover,
  .driver-popover.cdx-driver-popover--map-center {
    max-width: min(360px, calc(100vw - 24px));
    box-shadow: var(--neo-shadow);
  }

  .driver-popover.cdx-driver-popover .driver-popover-title {
    font-size: 18px;
    padding: 12px 44px 12px 14px;
  }

  .driver-popover.cdx-driver-popover .driver-popover-description,
  .driver-popover.cdx-driver-popover .driver-popover-footer {
    padding-left: 14px;
    padding-right: 14px;
  }
}
