/* ==========================================================================
   Faivra HTML — shell layouts and HTML-only helpers
   faivra.css (compiled Tailwind + the design system) loads first.

   Every page carries the three desktop layouts; <html data-layout="…">
   (set by assets/js/prefs.js) decides which one shows:
     dock     floating glass rail + floating top bar + bottom command bar
     sidebar  classic fixed sidebar
     topnav   menus in a second row under the top bar
   Phones and tablets always use the slide-in menu.

   1. Shell spacing   2. Layout visibility   3. Top bar variants
   4. Pip position    5. Helpers
   ========================================================================== */

/* 1. Shell spacing ------------------------------------------------------- */
.fh-shell {
  min-height: 100dvh;
  /* height of everything above the page; full-height screens subtract it */
  --shell-top: 3.5rem;
}
html.fh-role-preview .fh-shell { --shell-top: 5.5rem; }

@media (min-width: 1024px) {
  html[data-layout="dock"] .fh-shell { padding-left: 88px; --shell-top: 4.25rem; }
  html[data-layout="dock"].fh-role-preview .fh-shell { --shell-top: 6.25rem; }
  html[data-layout="sidebar"] .fh-shell { padding-left: 15rem; }
  html[data-layout="topnav"] .fh-shell { --shell-top: 6.5rem; }
  html[data-layout="topnav"].fh-role-preview .fh-shell { --shell-top: 8.5rem; }
}

/* 2. Layout visibility --------------------------------------------------- */
html:not([data-layout="dock"]) .fh-dock,
html:not([data-layout="dock"]) .fh-commandbar,
html:not([data-layout="sidebar"]) .fh-sidebar,
html:not([data-layout="topnav"]) .fh-topnav,
html:not([data-layout="topnav"]) .fh-topbar-logo {
  display: none !important;
}

/* 3. Top bar: floats as a glass pill in the dock layout ------------------ */
@media (min-width: 1024px) {
  html[data-layout="dock"] .fh-topbar {
    top: 0.75rem;
    margin: 0.75rem 0.75rem 0;
    border: 1px solid var(--glass-edge);
    border-radius: 1rem;
    padding-inline: 1rem;
    box-shadow: var(--glass-shadow);
  }
  html[data-layout="dock"] .fh-topbar::before { display: none; }
}

/* 4. Pip: keeps clear of the dock / sidebar ------------------------------ */
@media (min-width: 1024px) {
  html[data-layout="dock"] .fh-pip[data-corner="bl"] { left: 96px; }
  html[data-layout="sidebar"] .fh-pip[data-corner="bl"] { left: 264px; }
  html[data-layout="topnav"] .fh-pip[data-corner="bl"] { left: 1.5rem; }
}
.fh-pip[data-corner="bl"] { bottom: 1.25rem; left: 1rem; }
.fh-pip[data-corner="br"] { bottom: 1.25rem; right: 1.5rem; }
.fh-pip[data-corner="tr"] { top: 5rem; right: 1.5rem; }

/* 5. Helpers ------------------------------------------------------------- */

/* Smooth page-to-page transitions between template pages (Chrome, Edge, Safari 18+) */
@view-transition {
  navigation: auto;
}

/* Elements kept in the page for scripts (menus, dialogs, alternate views) */
[hidden] { display: none !important; }

/* Lock page scroll while a dialog or drawer is open */
html.fh-lock { overflow: hidden; }

/* No transitions while the page applies saved preferences */
html.fh-preload *,
html.fh-preload *::before,
html.fh-preload *::after {
  transition: none !important;
}

/* Pip's drawing (assets/js/faivra.js renders the SVG per mood) */
.fh-pip-stop-top { stop-color: color-mix(in srgb, var(--color-primary) 70%, white); }
.fh-pip-stop-bottom { stop-color: var(--color-primary); }
.fh-pip-shadow { fill: color-mix(in srgb, var(--color-ink) 22%, transparent); }
.fh-pip-screen { fill: color-mix(in srgb, #0b1226 86%, var(--color-primary)); }

/* ---- crm2.css ---- */
/* crm2 pages: clients, client, calls, calendar, tasks, automations, automation, reports */

/* rotating sweep of the client health map must not widen the page on phones */
.fh-clip-x { overflow-x: clip; }

/* ---- inbox.css ---- */
/* Inbox: React renders the contact context as an aside only from xl (1280px); below that it is a drawer. */
@media (max-width: 1279.98px) {
  .fh-inbox-ctx { display: none; }
}


/* ---- RedPhantom Brand Mark & Topbar Switcher Helpers ---- */
.rpt-mark-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: #0e1013;
  border: 1px solid rgba(200, 16, 46, 0.42);
  box-shadow: 0 2px 8px -2px rgba(200, 16, 46, 0.35);
  padding: 3px;
  flex-shrink: 0;
}
.rpt-mark-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.fs-pal-phantom-1 { background-color: #f4f5f7; }
.fs-pal-phantom-2 { background-color: #0e1013; }
.fs-pal-phantom-3 { background-color: #C8102E; }
.fs-pal-phantom-4 { background-color: #1FA463; }
.fs-pal-phantom-5 { background-color: #2563eb; }

/* Corridor animated route dashes */
@keyframes rpRouteFlow {
  to { stroke-dashoffset: -28; }
}
.rp-route-active {
  stroke-dasharray: 8 6;
  animation: rpRouteFlow 1.2s linear infinite;
}
.rp-hash-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- Polygon Blockchain Explorer (Linear × Polygonscan × Faivra Bento) ---- */
.rp-stepper-wrap {
  position: relative;
}
.rp-stepper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
  position: relative;
  z-index: 1;
}
@media (min-width: 640px) {
  .rp-stepper-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .rp-stepper-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
  }
  .rp-stepper-wrap::before {
    content: "";
    position: absolute;
    left: 3rem;
    right: 3rem;
    top: 1.55rem;
    height: 2px;
    background: linear-gradient(90deg, var(--color-ai) 0%, color-mix(in srgb, var(--color-ai) 45%, var(--color-line-strong)) 65%, var(--color-primary) 100%);
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
  }
}
.rp-step-node {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 0.75rem;
  border-radius: 0.875rem;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease, background-color 150ms ease;
  cursor: pointer;
}
.rp-step-node:hover {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-line));
  transform: translateY(-1px);
}
.rp-step-node[data-active="true"] {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary-soft) 55%, var(--color-surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 14%, transparent);
}
.rp-ledger-table {
  width: 100%;
  border-collapse: collapse;
}
.rp-ledger-row {
  transition: background-color 140ms ease;
}
.rp-ledger-row:hover {
  background-color: var(--color-surface-2);
}
.rp-ledger-row[data-active="true"] {
  background-color: color-mix(in srgb, var(--color-primary-soft) 45%, var(--color-surface));
}
.rp-hash-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-line);
  background: var(--color-surface-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.rp-kv-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .rp-kv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Standalone Public Explorer & Cinematic 3D Moving-Blocks Hero ---- */
.fh-pip, .pip, #fh-tryme, .fh-commandbar {
  display: none !important;
}

.rp-public-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-canvas);
  color: var(--color-ink);
}

.rp-hero-3d-shell {
  position: relative;
  border-radius: 1.25rem;
  overflow: hidden;
  background:
    radial-gradient(90% 95% at 15% 10%, rgba(200, 16, 46, 0.24) 0%, rgba(200, 16, 46, 0) 58%),
    radial-gradient(80% 90% at 85% 18%, rgba(31, 164, 99, 0.22) 0%, rgba(31, 164, 99, 0) 60%),
    radial-gradient(70% 75% at 50% 100%, rgba(37, 99, 235, 0.18) 0%, rgba(15, 23, 42, 0) 65%),
    linear-gradient(180deg, #070a12 0%, #0b101d 54%, #090d16 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px -18px rgba(7, 10, 18, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.rp-hero-3d-stage {
  position: relative;
  width: 100%;
  height: 350px;
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
}
.rp-hero-3d-stage:active {
  cursor: grabbing;
}
@media (max-width: 767.98px) {
  .rp-hero-3d-stage {
    height: 330px;
  }
}

#rp-chain-3d {
  display: block;
  width: 100%;
  height: 100%;
}

.rp-hero-glass-bar {
  background: rgba(11, 16, 29, 0.76);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.rp-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.68rem;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.rp-star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  height: 2rem;
  border-radius: 0.55rem;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  color: var(--color-ink-3);
  transition: all 140ms ease;
  cursor: pointer;
}
.rp-star-btn[data-lit="true"] {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
}
html.dark .rp-star-btn[data-lit="true"] {
  color: #fbbf24;
}
