/* Connect by JBRH — Power Fit Splash & Logo Animation System
   Used across Website first load, Application boot, Error states, and Task Actions. */

:root {
  --splash-bg: var(--bg, #F2EDE3);
  --splash-ink: var(--ink, #202C46);
  --splash-signal: var(--signal, #D74B36);
  --splash-paper: var(--paper, #F2EDE3);
  --splash-subtle: rgba(32, 44, 70, 0.45);
}

[data-theme="dark"] {
  --splash-bg: var(--bg, #111622);
  --splash-ink: var(--ink, #F2EDE3);
  --splash-signal: var(--signal, #FF5A43);
  --splash-paper: var(--paper, #202C46);
  --splash-subtle: rgba(242, 237, 227, 0.45);
}

[data-theme="mono"] {
  --splash-bg: #FFFFFF;
  --splash-ink: #111111;
  --splash-signal: #111111;
  --splash-paper: #FFFFFF;
  --splash-subtle: #777777;
}

/* 1. Full-Screen Splash Overlay */
.connect-splash-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 999999;
  background: var(--splash-bg);
  color: var(--splash-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.42s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, visibility;
  user-select: none;
  -webkit-user-select: none;
}

.connect-splash-overlay.is-dismissed,
.connect-splash-overlay.is-loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 2. Splash Content Box */
.connect-splash-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 440px;
  width: 100%;
}

/* 3. The Power Fit Mark */
.connect-splash-mark {
  width: min(38vw, 130px);
  aspect-ratio: 1 / 1;
  overflow: visible;
  margin-bottom: 20px;
  filter: drop-shadow(0 12px 24px rgba(32, 44, 70, 0.09));
}

.connect-splash-mark #connector,
.connect-splash-mark .connector-path {
  fill: var(--splash-signal);
  transform-origin: center;
}

.connect-splash-mark #business,
.connect-splash-mark .business-path {
  fill: var(--splash-ink);
  transform-origin: center;
}

/* 4. Phase Badge */
.connect-splash-phase {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 750;
  color: var(--splash-signal);
  margin-bottom: 14px;
  min-height: 18px;
}

/* 5. Brand Lockup Typography */
.connect-splash-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.connect-splash-lockup.show,
.connect-splash-lockup.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.connect-splash-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--splash-ink);
}

.connect-splash-sub {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--splash-subtle);
}

/* 6. Status / Loading Bar */
.connect-splash-status {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--splash-subtle);
  animation: splashFadeIn 0.6s ease 0.6s both;
}

.connect-splash-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(215, 75, 54, 0.22);
  border-top-color: var(--splash-signal);
  border-radius: 50%;
  animation: splashSpin 0.8s linear infinite;
}

@keyframes splashSpin {
  to { transform: rotate(360deg); }
}

@keyframes splashFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 6. Inline Task Action Splash Loader */
.connect-task-loader {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(32, 44, 70, 0.04);
  border: 1px solid rgba(32, 44, 70, 0.12);
  color: var(--splash-ink);
  font-size: 13px;
  font-weight: 600;
}

.connect-task-loader .mark-mini {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  animation: splashPulseMini 1.6s ease-in-out infinite;
}

@keyframes splashPulseMini {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 1; }
}

/* 7. Error Splash View */
.connect-error-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  max-width: 540px;
  margin: 0 auto;
}

.connect-error-splash .error-mark {
  width: 88px;
  height: 88px;
  margin-bottom: 20px;
  filter: drop-shadow(0 8px 18px rgba(215, 75, 54, 0.16));
}

.connect-error-splash .error-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--splash-signal);
  background: rgba(215, 75, 54, 0.08);
  border: 1px solid rgba(215, 75, 54, 0.22);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.connect-error-splash h2 {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 750;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  color: var(--splash-ink);
}

.connect-error-splash p {
  font-size: 14px;
  color: var(--splash-subtle);
  max-width: 420px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.connect-error-splash .error-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.connect-error-splash .btn-retry {
  background: var(--splash-ink);
  color: var(--splash-bg);
  border: none;
  font-size: 14px;
  font-weight: 650;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.connect-error-splash .btn-retry:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  .connect-splash-overlay,
  .connect-splash-mark #connector,
  .connect-splash-mark #business,
  .connect-splash-lockup,
  .connect-splash-status,
  .connect-splash-spinner,
  .connect-task-loader .mark-mini {
    animation: none !important;
    transition: none !important;
  }
}
