/* ==========================================================================
   RedPhantom Institutional Blockchain Explorer Pro Stylesheet
   (assets/css/explorer-pro.css)
   Grounded in Faivra Design System + Blockscout v6 / Celenium / EigenLayer
   + Emil Kowalski UI & Mobile-Native Engineering Standards
   ========================================================================== */

:root {
  --rp-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --rp-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --rp-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* Safe-area awareness for notched phones (paired with viewport-fit=cover) */
.rp-exp-header {
  padding-top: env(safe-area-inset-top, 0px);
}

.rp-exp-footer {
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

/* Strictly ensure zero CRM chrome leaks into standalone Explorer */
.fh-sidebar,
.fh-dock,
.fh-topnav,
.fh-pip,
.pip,
#fh-tryme,
.fh-commandbar {
  display: none !important;
}

/* Tabular numeric discipline so live telemetry, blocks, gas & INR never jitter */
.rp-tabular,
#rp-telemetry-strip,
.rp-ledger-table td,
.rp-hash-mono {
  font-variant-numeric: tabular-nums;
}

/* 1. Top Live Network Telemetry Strip (#rp-telemetry-strip) ---------------- */
#rp-telemetry-strip {
  height: 36px;
  background: color-mix(in srgb, var(--color-surface-2) 88%, var(--color-canvas));
  border-bottom: 1px solid var(--color-line);
  font-size: 11.5px;
  line-height: 1;
}

.dark #rp-telemetry-strip {
  background: rgba(11, 15, 25, 0.92);
}

.rp-telemetry-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
  height: 36px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.rp-telemetry-track::-webkit-scrollbar {
  display: none;
}

.rp-tel-group {
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
}

.rp-tel-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--color-ink-2);
  flex-shrink: 0;
}

.rp-tel-sep {
  width: 1px;
  height: 13px;
  background: var(--color-line-strong);
  opacity: 0.7;
  flex-shrink: 0;
}

.rp-tel-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #1FA463;
  box-shadow: 0 0 0 3px rgba(31, 164, 99, 0.18);
  flex-shrink: 0;
}

.rp-tel-contract-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 24px;
  padding: 0 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-ai) 34%, var(--color-line));
  background: color-mix(in srgb, var(--color-ai-soft) 55%, var(--color-surface));
  color: var(--color-ink);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  transition: transform 120ms var(--rp-ease-out), border-color 150ms ease, background-color 150ms ease;
}

/* Subtle flash on block tick (opacity only — compositor-safe) */
.rp-block-tick {
  transition: color 220ms var(--rp-ease-out), opacity 220ms var(--rp-ease-out);
}
.rp-block-tick[data-tick="1"] {
  color: #1FA463;
}

/* 2. Collapsible 3D Stage & Prefix-Aware Omni-Search ----------------------- */
.rp-hero-3d-stage {
  transition: opacity 180ms var(--rp-ease-out);
}

.rp-hero-3d-shell[data-stage-collapsed="true"] .rp-hero-3d-stage {
  display: none !important;
}

.rp-omni-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

#rp-exp-query {
  height: 44px;
  width: 100%;
  padding-left: 2.5rem;
  padding-right: 11.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 12, 22, 0.84);
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.35;
  transition: border-color 150ms var(--rp-ease-out), box-shadow 150ms var(--rp-ease-out);
}

#rp-exp-query::placeholder {
  font-family: var(--font-sans);
  color: #94a3b8;
}

#rp-exp-query:focus {
  outline: none;
  border-color: #C8102E;
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.28);
}

/* Prevent iOS Safari zoom on input focus without disabling pinch-zoom */
@media (pointer: coarse), (max-width: 767.98px) {
  #rp-exp-query,
  .rp-exp-input,
  .rp-public-shell input,
  .rp-public-shell select,
  .rp-public-shell textarea {
    font-size: 16px !important;
  }
}

@media (max-width: 639.98px) {
  #rp-exp-query {
    padding-right: 8.25rem;
  }
}

.rp-omni-trail {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  pointer-events: auto;
}

.rp-entity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 24px;
  padding: 0 0.5rem;
  border-radius: 0.45rem;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(30, 41, 59, 0.88);
  color: #e2e8f0;
  pointer-events: none;
}

.rp-entity-badge[data-kind="lot"] {
  border-color: rgba(31, 164, 99, 0.5);
  background: rgba(31, 164, 99, 0.2);
  color: #6ee7b7;
}
.rp-entity-badge[data-kind="wallet"] {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
}
.rp-entity-badge[data-kind="tx"] {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
}
.rp-entity-badge[data-kind="ulr"] {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}
.rp-entity-badge[data-kind="gs1"] {
  border-color: rgba(200, 16, 46, 0.6);
  background: rgba(200, 16, 46, 0.25);
  color: #fecdd3;
}

.rp-kbd-slash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.9);
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.rp-omni-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  transition: transform 120ms var(--rp-ease-out), background-color 140ms ease, color 140ms ease;
}

.rp-sample-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 28px;
  padding: 0 0.625rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 120ms var(--rp-ease-out), border-color 140ms ease, background-color 140ms ease;
}

.rp-sample-chip[aria-pressed="true"] {
  border-color: #C8102E;
  background: #C8102E;
  color: #ffffff;
  font-weight: 600;
}

/* 3. 5 Faivra-Native Instant-Switch Explorer Tabs --------------------------
   STRICT MOTION GATE: Tab switches are high-frequency navigation -> animation: none! */
.rp-exp-tablist-wrap {
  border-bottom: 1px solid var(--color-line);
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--glass-edge);
  padding: 0.35rem;
  box-shadow: var(--glass-shadow);
}

.rp-exp-tablist {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.rp-exp-tablist::-webkit-scrollbar {
  display: none;
}

.rp-exp-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 38px;
  padding: 0 0.85rem;
  border-radius: 0.625rem;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-ink-2);
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid transparent;
  /* Zero slide/layout animation on tab switches; only crisp press feedback */
  animation: none !important;
  transition: transform 120ms var(--rp-ease-out);
}

.rp-exp-tab[aria-selected="true"] {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
  box-shadow: 0 1px 2px rgba(15, 26, 51, 0.14);
}

.rp-exp-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  background: color-mix(in srgb, var(--color-ink) 8%, transparent);
  color: inherit;
}

.rp-exp-tab[aria-selected="true"] .rp-exp-tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.rp-exp-tabpanel {
  animation: none !important;
  transition: none !important;
}

/* 4. Filter Chips, Soulbound Status Pills & Copy Feedback ------------------ */
.rp-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 30px;
  padding: 0 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-ink-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 120ms var(--rp-ease-out), border-color 140ms ease, background-color 140ms ease;
}

.rp-filter-chip[aria-pressed="true"] {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary-ink);
}

/* Soulbound ERC-5192 / ERC-1155 Compliance Credit Badges */
.rp-sbt-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.rp-sbt-pill[data-status="LOCKED"] {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.38);
  color: #b45309;
}
.dark .rp-sbt-pill[data-status="LOCKED"] {
  color: #fbbf24;
}

.rp-sbt-pill[data-status="UNLOCKED"],
.rp-sbt-pill[data-status="PAID_INR_NEFT"] {
  background: rgba(31, 164, 99, 0.14);
  border: 1px solid rgba(31, 164, 99, 0.4);
  color: #15803d;
}
.dark .rp-sbt-pill[data-status="UNLOCKED"],
.dark .rp-sbt-pill[data-status="PAID_INR_NEFT"] {
  color: #34d399;
}

/* Copy Button Inline Checkmark Swap (1200ms) */
.rp-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-ink-3);
  flex-shrink: 0;
  transition: transform 120ms var(--rp-ease-out), border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.rp-copy-btn[data-copied="true"] {
  border-color: rgba(31, 164, 99, 0.55) !important;
  background: rgba(31, 164, 99, 0.14) !important;
  color: #1FA463 !important;
}

/* Consumer Star Rating Buttons */
.rp-star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 0.65rem;
  border-radius: 0.55rem;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-ink-2);
  font-size: 12px;
  font-weight: 600;
  transition: transform 120ms var(--rp-ease-out), border-color 140ms ease, background-color 140ms ease;
}

.rp-star-btn[data-lit="true"] {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
}
.dark .rp-star-btn[data-lit="true"] {
  color: #fbbf24;
}

/* Expandable Receipt Drawer Entrance (scale 0.985 + opacity, <200ms ease-out) */
.rp-receipt-drawer {
  transform-origin: top center;
  animation: rpDrawerReveal 170ms var(--rp-ease-out);
}

@keyframes rpDrawerReveal {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 5. Emil Kowalski Tactile Touch, Pointer & Reduced-Motion Baselines ------- */
.rp-public-shell button,
.rp-public-shell a,
.rp-public-shell [role="button"],
.rp-public-shell [role="tab"] {
  touch-action: manipulation;
}

.rp-public-shell button,
.rp-public-shell [role="button"],
.rp-public-shell [role="tab"],
.rp-filter-chip,
.rp-sample-chip,
.rp-sbt-pill {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Immediate :active press feedback (120ms strong ease-out, scale 0.97) */
.rp-public-shell button:not(:disabled):active,
.rp-public-shell a.rp-pressable:active,
.rp-tel-contract-btn:active,
.rp-sample-chip:active,
.rp-exp-tab:active,
.rp-filter-chip:active,
.rp-copy-btn:active,
.rp-star-btn:active,
.rp-step-node:active {
  transform: scale(0.97);
  transition-duration: 120ms;
  transition-timing-function: var(--rp-ease-out);
}

/* Strictly gate ALL :hover effects behind fine-pointer capability */
@media (hover: hover) and (pointer: fine) {
  .rp-tel-contract-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary-ink);
  }
  .rp-omni-clear:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
  }
  .rp-sample-chip:not([aria-pressed="true"]):hover {
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(30, 41, 59, 0.92);
    color: #ffffff;
  }
  .rp-exp-tab:not([aria-selected="true"]):hover {
    background: var(--color-sunken);
    color: var(--color-ink);
  }
  .rp-filter-chip:not([aria-pressed="true"]):hover {
    border-color: color-mix(in srgb, var(--color-primary) 42%, var(--color-line));
    color: var(--color-ink);
  }
  .rp-copy-btn:hover {
    border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-line));
    color: var(--color-primary);
  }
  .rp-actor-chip:not([aria-pressed="true"]):hover {
    border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-line));
    background: var(--color-surface-2);
  }
}

/* Prevent sticky hover lift on touch devices from base stylesheets */
@media (hover: none), (pointer: coarse) {
  .rp-step-node:hover {
    transform: none;
  }
  .card:hover:before,
  .card:hover:after {
    opacity: 0;
  }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .rp-receipt-drawer {
    animation: rpFadeOnly 140ms ease;
  }
  .animate-pulse,
  .animate-ping {
    animation: none !important;
  }
}

@keyframes rpFadeOnly {
  from { opacity: 0; }
  to { opacity: 1; }
}
