/* =========================================================================
   interact.css — two layered features for the site3 marketing experience:
     (A) the meta "sticky-note" system (.s3-meta) — a handwritten note per page
         that says, OUT OF BAND, what the visitor is looking at.
     (B) page interactivity — hover/click micro-interactions on the real-looking
         UI (popovers, tooltips, highlights) that teach what the product does.

   Both arm only once a section is settled (body[data-active-section] +
   .page.is-settled, both written by app.js). All visuals here are driven by
   ADDED CLASSES / OVERLAY elements — never by mutating the inline transform/
   opacity the time-based engine owns each frame.
   ========================================================================= */

/* ============================ z-index ladder ============================
   widgets (real UI) < interaction overlays < meta note. Keep the note on top
   so a popover never covers the "what you're seeing" explanation.            */
:root {
  --s3i-pop-z: 60;
  --s3i-meta-z: 80;
}

/* =========================================================================
   FEATURE A — META STICKY NOTE (.s3-meta)
   ========================================================================= */
.s3-meta {
  position: absolute;
  z-index: var(--s3i-meta-z);
  top: 92px;            /* below the controls line, top-right by default */
  right: 40px;
  width: 288px;
  padding: 15px 19px 17px;
  pointer-events: none; /* never blocks scroll; the dismiss btn re-enables itself */
  /* warm off-white paper — deliberately NOT the product --paper/--divider chrome */
  background: linear-gradient(180deg, #fffdf5 0%, #fff8e6 100%);
  border-radius: 5px;
  box-shadow:
    0 10px 28px -10px rgba(102, 99, 253, 0.3),
    0 2px 8px rgba(60, 50, 20, 0.14);
  color: #3a3526;
  /* hidden by default; revealed (fade + rise + settle into tilt) when settled */
  opacity: 0;
  transform: translateY(10px) rotate(0deg);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}
/* revealed: only when its section is settled AND active (set by interact.js) */
.s3-meta.is-on {
  opacity: 1;
  transform: translateY(0) rotate(-1.5deg);
}
/* global session suppression toggle */
body.s3-meta-off .s3-meta {
  opacity: 0 !important;
  transform: translateY(8px) rotate(0deg) !important;
  pointer-events: none !important;
}

.s3-meta__eyebrow {
  display: block;
  font-family: var(--font);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 5px;
}
.s3-meta__text {
  font-family: var(--annot);
  font-size: 1.32rem;
  line-height: 1.28;
  font-weight: 600;
  color: #3a3526;
}
.s3-meta__text b {
  color: var(--purple);
  font-weight: 700;
}

/* tiny dismiss affordance (re-enables pointer events on itself only) */
.s3-meta__dismiss {
  position: absolute;
  top: 3px;
  left: 5px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  pointer-events: auto;
  color: #b6ad8e;
  font-size: 14px;
  line-height: 1;
  background: none;
  transition: color 0.15s ease, background 0.15s ease;
}
.s3-meta__dismiss:hover {
  color: #6b6346;
  background: rgba(0, 0, 0, 0.05);
}

/* hand-drawn SVG arrow (reuses the deck__annot-arrow look) on the hero pages */
.s3-meta__arrow {
  position: absolute;
  width: 64px;
  height: 52px;
  pointer-events: none;
  background: no-repeat center / contain;
}
/* arrow pointing down-left (note sits up-right of the target) */
.s3-meta__arrow[data-dir="downleft"] {
  bottom: -46px;
  left: -34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 52'%3E%3Cpath d='M56 4 C40 8 18 16 10 42' fill='none' stroke='%236663FD' stroke-width='2.4' stroke-linecap='round'/%3E%3Cpath d='M4 30 L9 44 L23 39' fill='none' stroke='%236663FD' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* arrow pointing down (note sits above the target) */
.s3-meta__arrow[data-dir="down"] {
  bottom: -44px;
  left: 50%;
  transform: translateX(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 52'%3E%3Cpath d='M32 4 C28 20 34 30 32 44' fill='none' stroke='%236663FD' stroke-width='2.4' stroke-linecap='round'/%3E%3Cpath d='M24 34 L32 47 L40 34' fill='none' stroke='%236663FD' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* arrow pointing down-right (note sits up-left of the target) */
.s3-meta__arrow[data-dir="downright"] {
  bottom: -46px;
  right: -34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 52'%3E%3Cpath d='M8 4 C24 8 46 16 54 42' fill='none' stroke='%236663FD' stroke-width='2.4' stroke-linecap='round'/%3E%3Cpath d='M41 39 L55 44 L60 30' fill='none' stroke='%236663FD' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* DARK variant for the engine pages (engine/connectors/ledger/model/linking/semantic) */
.s3-meta--dark {
  background: linear-gradient(180deg, rgba(40, 40, 64, 0.92) 0%, rgba(32, 32, 52, 0.94) 100%);
  border: 1px solid rgba(124, 124, 255, 0.32);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.2),
    0 12px 30px -8px rgba(102, 99, 253, 0.4);
  color: rgba(255, 255, 255, 0.82);
}
.s3-meta--dark .s3-meta__text {
  color: rgba(255, 255, 255, 0.88);
}
.s3-meta--dark .s3-meta__text b {
  color: #b9b7ff;
}
.s3-meta--dark .s3-meta__eyebrow {
  color: #b9b7ff;
}
.s3-meta--dark .s3-meta__dismiss {
  color: rgba(255, 255, 255, 0.4);
}
.s3-meta--dark .s3-meta__dismiss:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* placement helpers (set per-page by interact.js via a position class) */
.s3-meta--tl { top: 92px; left: 40px; right: auto; }
.s3-meta--tr { top: 92px; right: 84px; left: auto; } /* clear of the top-right icon buttons (chat/dataapps) */
.s3-meta--bl { top: auto; bottom: 120px; left: 40px; right: auto; }
.s3-meta--br { top: auto; bottom: 120px; right: 40px; left: auto; }

/* reduced motion: appear instantly, still tilted */
@media (prefers-reduced-motion: reduce) {
  .s3-meta {
    transition: opacity 0.01s linear;
    transform: rotate(-1.5deg);
  }
  .s3-meta.is-on {
    transform: rotate(-1.5deg);
  }
}

/* MOBILE (stacked): the note renders as an inline block above the section
   content (matching how .deck__annot goes static); arrows hide; text scales up. */
body.is-stacked .s3-meta {
  position: static;
  display: block;
  width: auto;
  max-width: 100%;
  margin: 0 0 16px;
  top: auto;
  right: auto;
  left: auto;
  bottom: auto;
  opacity: 1;
  transform: rotate(-1.2deg);
  pointer-events: auto;
}
body.is-stacked .s3-meta__arrow {
  display: none;
}
body.is-stacked .s3-meta__text {
  font-size: 1.62rem;
}
body.is-stacked.s3-meta-off .s3-meta {
  display: none !important;
}

/* =========================================================================
   FEATURE B — INTERACTIVITY (popovers / tooltips / highlights)
   Armed only on .is-settled sections (scoped below + guarded in JS).
   ========================================================================= */

/* make interaction targets non-interactive until their section is settled.
   We cannot touch the inline styles the engine owns, so we only flip the
   cursor + pointer affordance via the section's settled state. The JS also
   bails out of handlers when the section isn't settled. */
.page .s3i-hot {
  cursor: default;
}
.page.is-settled .s3i-hot {
  cursor: pointer;
}

/* generic class-driven highlight (added by JS, never inline transform).
   INSET ring: never clipped by ancestor overflow, never shifts layout, and
   matches the element's own box — no weird cut-off rounded outline. */
.page.is-settled .s3i-hi {
  box-shadow: inset 0 0 0 2px rgba(102, 99, 253, 0.55);
  border-radius: 8px;
  transition: box-shadow 0.14s ease, filter 0.14s ease;
}
/* table rows: a soft fill reads better than a ring (and never reflows) */
.page.is-settled tr.s3i-hirow {
  background: var(--purple-08);
}
/* dim siblings when one peer is emphasized */
.page.is-settled .s3i-dim {
  filter: saturate(0.55) opacity(0.45);
  transition: filter 0.18s ease;
}
.page.is-settled .s3i-bright {
  filter: saturate(1.12) brightness(1.04);
  transition: filter 0.18s ease;
}

/* soft pulse on accent elements (callouts / nodes) */
@keyframes s3i-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(102, 99, 253, 0.0); }
  50% { box-shadow: 0 0 0 6px rgba(102, 99, 253, 0.22); }
}
.page.is-settled .s3i-pulse {
  animation: s3i-pulse 1.3s ease-in-out infinite;
  border-radius: 10px;
}
@media (prefers-reduced-motion: reduce) {
  .page.is-settled .s3i-pulse {
    animation: none;
    box-shadow: 0 0 0 4px rgba(102, 99, 253, 0.22);
  }
}

/* faint ghost-tile sketch shown for "+ Widget" */
.s3i-ghost {
  position: absolute;
  z-index: var(--s3i-pop-z);
  border: 2px dashed rgba(102, 99, 253, 0.55);
  border-radius: 10px;
  background: rgba(102, 99, 253, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple);
  font-size: 0.78rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.s3i-ghost.is-on { opacity: 1; }

/* brief "recompute" shimmer over widgets when a filter is applied */
@keyframes s3i-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(220%); }
}
.s3i-shimmer {
  position: absolute;
  inset: 0;
  z-index: var(--s3i-pop-z);
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}
.s3i-shimmer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(102, 99, 253, 0.18), transparent);
  animation: s3i-shimmer 0.7s ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
  .s3i-shimmer::before { animation: none; opacity: 0; }
}

/* KPI card hover lift — applied to the inner .kpi (dashboards) so we don't fight
   the engine, which owns the outer .widget transform. On dataapps the highlight
   lands on .widget--kpi, so style that too (it's settled → engine no longer writes). */
.page.is-settled .kpi.s3i-hi,
.page.is-settled .widget--kpi.s3i-hi {
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(102, 99, 253, 0.45);
  transition: box-shadow 0.15s ease;
}

/* semantic doc-stack: fan the spines on hover */
.sem__stack.s3i-fan .sem__stack-doc--back {
  transform: translate(-26px, -14px) rotate(-7deg);
  transition: transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.sem__stack.s3i-fan .sem__stack-doc--mid {
  transform: translate(-13px, -7px) rotate(-3.5deg);
  transition: transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* "Ask about this account" chip that fades onto a hovered table row */
.s3i-rowchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--purple-08);
  color: var(--purple);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---- the popover / tooltip overlay (one element, repositioned) ---- */
.s3i-pop {
  position: fixed;
  z-index: var(--s3i-pop-z);
  max-width: 280px;
  padding: 11px 13px;
  border-radius: 11px;
  background: #1f1f2b;
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--font);
  font-size: 0.84rem;
  line-height: 1.45;
  box-shadow: 0 14px 36px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 124, 255, 0.3);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transform-origin: top center;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.s3i-pop.is-on {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* a smaller variant used for plain tooltips */
.s3i-pop--tip {
  max-width: 230px;
  font-size: 0.8rem;
  padding: 8px 11px;
}
.s3i-pop__lead {
  display: block;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}
.s3i-pop__lead--accent { color: #b9b7ff; }
.s3i-pop b { color: #fff; font-weight: 600; }

/* little caret on the popover */
.s3i-pop::after {
  content: "";
  position: absolute;
  left: var(--caret-x, 50%);
  width: 10px;
  height: 10px;
  background: #1f1f2b;
  transform: translateX(-50%) rotate(45deg);
}
.s3i-pop[data-place="below"]::after {
  top: -5px;
  box-shadow: -1px -1px 0 0 rgba(124, 124, 255, 0.3);
}
.s3i-pop[data-place="above"]::after {
  bottom: -5px;
  box-shadow: 1px 1px 0 0 rgba(124, 124, 255, 0.3);
}

/* faux content inside popovers (history list, share link, example asks) */
.s3i-pop__list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.s3i-pop__list li {
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.82);
}
.s3i-pop__link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: #cfceff;
}
.s3i-pop__meta {
  display: block;
  margin-top: 6px;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.6);
}
.s3i-pop__ex {
  margin-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.s3i-pop__ex span {
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(102, 99, 253, 0.18);
  font-size: 0.76rem;
  color: #dcdbff;
  font-style: italic;
}

/* value tooltip (small, follows bars/dots) — same look, tighter */
.s3i-vtip {
  position: fixed;
  z-index: var(--s3i-pop-z);
  padding: 4px 8px;
  border-radius: 7px;
  background: #1f1f2b;
  color: #fff;
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 124, 255, 0.3);
}
.s3i-vtip.is-on {
  opacity: 1;
  transform: translate(-50%, -10px);
}

/* guide line + dot for the line chart hover (overlay SVG group is created by JS,
   but the dot is a div for simplicity) */
.s3i-guide {
  position: absolute;
  z-index: var(--s3i-pop-z);
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1.5px dashed rgba(102, 99, 253, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.s3i-guide.is-on { opacity: 1; }
.s3i-dot {
  position: absolute;
  z-index: var(--s3i-pop-z);
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--syn-0);
  box-shadow: 0 0 0 3px rgba(102, 99, 253, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.s3i-dot.is-on { opacity: 1; }

/* MOBILE: keep tooltips within the viewport */
body.is-stacked .s3i-pop,
body.is-stacked .s3i-vtip {
  max-width: min(280px, calc(100vw - 28px));
}
