/* === Homepage tour (js/tour.js) ===
   A scrim over the page; the part a step is about glows on top of it, with a
   card beside it. The glow sits on one element hugging that part, and that
   element's spread shadow IS the scrim, so the two can never drift. Homepage only (row 1 of the dashboard).

   Motion follows the No-Settle Standard: the card carries text, so it moves
   by opacity and whole-pixel translate only and holds its compositor layer
   for its whole mounted life. The hole and the progress line carry no text
   and may animate size and scale. */

.rc-tour {
  --rc-tour-scrim: rgba(4, 4, 12, 0.72);
  --rc-tour-glow: rgba(0, 212, 170, 0.55);
  position: fixed;
  inset: 0;
  /* Above the shared header and the consent bar (both 1000), the search dim
     (900), the year overlay and calendar (100). The header's search dropdown
     (9999) only opens from a focused input, and the page is inert. */
  z-index: 1100;
  touch-action: none;
  overscroll-behavior: contain;
  animation: rc-tour-in var(--rc-ease) ease;
  transition: opacity var(--rc-ease) ease;
}
.rc-tour--closing {
  opacity: 0;
  pointer-events: none;
}
@keyframes rc-tour-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* The lit element's plate. 100vmax of spread reaches every edge from any corner. */
.rc-tour-spot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  box-shadow:
    0 0 0 0 transparent,
    0 0 0 100vmax var(--rc-tour-scrim);
}
.rc-tour-spot[data-lit='true'] {
  box-shadow:
    0 0 22px 2px var(--rc-tour-glow),
    0 0 0 100vmax var(--rc-tour-scrim);
}
/* Geometry is tweened frame by frame in tour.js on the card's clock; a CSS
   transition here would restart on every frame's write and trail the card. */
.rc-tour--ready .rc-tour-spot {
  transition: box-shadow var(--rc-ease) ease;
}

/* While the contamination badge is lit, the charge readout beside it drops
   back so the badge is the one bright thing inside the hole. The step id is
   on <html> for the step's life (tour.js applyStep / teardown). */
#hp-head-readout {
  transition: opacity var(--rc-ease-medium) ease, box-shadow var(--rc-ease-medium) ease;
}
html[data-rc-tour='contamination'] #hp-head-readout {
  opacity: 0.22;
  box-shadow: none;
}
/* The mirror case: the badge sits on the readout's corner (and, on a narrow
   phone, on the date block's), so it straddles those holes. It drops back
   until its own step. */
#contam-badge {
  transition: opacity var(--rc-ease-medium) ease;
}
html[data-rc-tour='today'] #contam-badge,
html[data-rc-tour='charge'] #contam-badge {
  opacity: 0.22;
}

/* The founder's essay pill (js/founders-essay-toast.js) stays out of sight
   while the tour runs, and on a first visit from load until the tour is done
   (tour.js sets data-rc-tour-pending). Its idle timer keeps running, so a pill
   that came due meanwhile fades in as the tour closes. */
html[data-rc-tour] #rc-essay-toast,
html[data-rc-tour-pending] #rc-essay-toast {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

/* == The card ============================================
   Inverted against the page: a light card on the dark scrim, so the copy
   reads as the one bright thing on screen next to the lit element. Only the
   card's own tokens flip; the progress line keeps the chakra spectrum. */
.rc-tour-card {
  --rc-tour-card-bg: #eeeef4;
  --rc-tour-card-text: #1a1a2a;
  --rc-tour-card-dim: #5a5a70;
  --rc-tour-card-bright: #0a0a14;
  --rc-tour-card-border: rgba(10, 10, 20, 0.14);
  --rc-tour-card-track: #d4d4de;
  position: absolute;
  left: 0;
  top: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  background: var(--rc-tour-card-bg);
  border: 1px solid var(--rc-tour-card-border);
  border-radius: var(--rc-radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 26px rgba(0, 212, 170, 0.12);
  color: var(--rc-tour-card-text);
  font-family: var(--rc-font);
  touch-action: manipulation;
  will-change: transform;
}
.rc-tour--ready .rc-tour-card {
  transition: transform var(--rc-ease-medium) cubic-bezier(0.4, 0, 0.15, 1);
}
/* Phone: a sheet across the width, docked top or bottom (tour.js placeCard). */
@media (max-width: 599.98px) {
  .rc-tour-card {
    width: calc(100vw - 32px);
    max-width: none;
  }
}

/* Progress: the chakra spectrum, the same line the splash bar draws. */
.rc-tour-progress {
  height: 3px;
  background: var(--rc-tour-card-track);
}
.rc-tour-progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(to right, #9933ff, #3388ff, #33cc55, #ffbb33, #ff3333);
  transform-origin: left center;
  transition: transform var(--rc-ease-medium) cubic-bezier(0.4, 0, 0.15, 1);
}

/* Each step's copy arrives with a short rise; the class is re-added per step. */
.rc-tour-card-inner {
  padding: 16px 20px 18px;
  will-change: transform;
}
.rc-tour-card-inner--in {
  animation: rc-tour-step-in var(--rc-ease) ease;
}
@keyframes rc-tour-step-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rc-tour-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  margin-bottom: 4px;
}
.rc-tour-count {
  font-family: var(--rc-font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rc-tour-card-dim);
}
.rc-tour-skip {
  margin-right: -6px;
  padding: 2px 6px;
  border: 0;
  border-radius: var(--rc-radius-sm);
  background: transparent;
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--rc-tour-card-dim);
  cursor: pointer;
  transition: color var(--rc-ease) ease;
}
.rc-tour-skip[hidden] { display: none; }
.rc-tour-skip:hover {
  color: var(--rc-tour-card-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rc-tour-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--rc-tour-card-bright);
}
.rc-tour-body {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--rc-tour-card-text);
}

.rc-tour-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.rc-tour-btn {
  padding: 7px 14px;
  border: 1px solid rgba(10, 10, 20, 0.3);
  border-radius: var(--rc-radius-md);
  background: transparent;
  font-family: var(--rc-font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--rc-tour-card-text);
  cursor: pointer;
  transition:
    color var(--rc-ease) ease,
    background-color var(--rc-ease) ease,
    border-color var(--rc-ease) ease;
}
.rc-tour-btn:hover {
  border-color: var(--rc-tour-card-bright);
  background-color: rgba(10, 10, 20, 0.06);
  color: var(--rc-tour-card-bright);
}
.rc-tour-btn:active {
  transition-duration: var(--rc-ease-fast);
  background-color: rgba(10, 10, 20, 0.1);
}
.rc-tour-btn--primary {
  border-color: var(--rc-tour-card-bright);
  background: var(--rc-tour-card-bright);
  color: var(--rc-text-bright);
}
.rc-tour-btn--primary:hover {
  border-color: var(--rc-bg-card);
  background: var(--rc-bg-card);
  color: #ffffff;
}
.rc-tour-btn--primary:active {
  background: var(--rc-tour-card-bright);
}
.rc-tour-btn:focus-visible,
.rc-tour-skip:focus-visible {
  outline: 2px solid var(--rc-tour-card-bright);
  outline-offset: 2px;
}

/* Read by screen readers as each step arrives, never seen. */
.rc-tour-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* == "Take the tour" pill under the homepage headline ========
   Drawn to match the Time Machine toggle (.traj-tm-toggle), so the two
   instrument-chrome pills read as one family. */
.site-tour-row {
  margin: 1.1rem 0 0;
  padding: 0 1rem;
  text-align: center;
}
.site-tour-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 1.05rem 0.42rem 0.6rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%);
  border: 1px solid var(--rc-border);
  border-radius: 999px;
  font-family: var(--rc-font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rc-text-dim);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--rc-ease) ease, border-color var(--rc-ease) ease, background var(--rc-ease) ease;
}
.site-tour-btn:hover {
  color: var(--rc-text-bright);
  border-color: var(--rc-border-ui);
  background: var(--rc-accent-subtle);
}
.site-tour-btn:focus-visible {
  outline: 2px solid var(--rc-accent);
  outline-offset: 2px;
}
.site-tour-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

@media (pointer: coarse) {
  .rc-tour-btn,
  .rc-tour-skip {
    min-height: 44px;
  }
  .rc-tour-btn {
    padding-left: 18px;
    padding-right: 18px;
  }
  .site-tour-btn {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rc-tour,
  .rc-tour-card-inner--in {
    animation: none;
  }
  .rc-tour,
  .rc-tour--ready .rc-tour-spot,
  .rc-tour--ready .rc-tour-card,
  .rc-tour-progress-fill {
    transition: none;
  }
}
