/* ==========================================================================
   SEAMLESS PAGE TRANSITION & WAITING LOADING SCREEN SYSTEM
   Curtain wipe panels, Loading.gif centering, zero-flicker continuity
   ========================================================================== */

#wipe-overlay {
  position: fixed;
  inset: 0;
  z-index: 100002;
  pointer-events: none !important;
}

#wipe-overlay.wipe-entering,
#wipe-overlay.wipe-covered {
  pointer-events: all !important;
}

#wipe-overlay.wipe-exiting {
  pointer-events: none !important;
}

#wipe-overlay .wipe-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  transform: translateX(100%);
}

#wipe-overlay .wipe-panel:nth-child(1) { background: #f43f5e; z-index: 1; }
#wipe-overlay .wipe-panel:nth-child(2) { background: #a855f7; z-index: 2; }
#wipe-overlay .wipe-panel:nth-child(3) { background: #6366f1; z-index: 3; }
#wipe-overlay .wipe-panel:nth-child(4) { background: #050608; z-index: 4; }

/* Curtain Animation Keyframes */
@keyframes curtainIn {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(0%); }
}

@keyframes curtainOut {
  0%   { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

/* Stagger In (Entering page from left) */
#wipe-overlay.wipe-entering .wipe-panel:nth-child(1) { animation: curtainIn 0.5s cubic-bezier(0.76, 0, 0.24, 1) 0.00s both; }
#wipe-overlay.wipe-entering .wipe-panel:nth-child(2) { animation: curtainIn 0.5s cubic-bezier(0.76, 0, 0.24, 1) 0.06s both; }
#wipe-overlay.wipe-entering .wipe-panel:nth-child(3) { animation: curtainIn 0.5s cubic-bezier(0.76, 0, 0.24, 1) 0.12s both; }
#wipe-overlay.wipe-entering .wipe-panel:nth-child(4) { animation: curtainIn 0.5s cubic-bezier(0.76, 0, 0.24, 1) 0.18s both; }

/* Static full coverage on arrived destination page */
#wipe-overlay.wipe-covered .wipe-panel {
  transform: translateX(0%) !important;
  animation: none !important;
}

/* Stagger Out (Exiting page to right) */
#wipe-overlay.wipe-exiting .wipe-panel:nth-child(4) { animation: curtainOut 0.5s cubic-bezier(0.76, 0, 0.24, 1) 0.00s both; }
#wipe-overlay.wipe-exiting .wipe-panel:nth-child(3) { animation: curtainOut 0.5s cubic-bezier(0.76, 0, 0.24, 1) 0.06s both; }
#wipe-overlay.wipe-exiting .wipe-panel:nth-child(2) { animation: curtainOut 0.5s cubic-bezier(0.76, 0, 0.24, 1) 0.12s both; }
#wipe-overlay.wipe-exiting .wipe-panel:nth-child(1) { animation: curtainOut 0.5s cubic-bezier(0.76, 0, 0.24, 1) 0.18s both; }

/* Centered Loading Animation (Loading.gif) */
.wipe-loader-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

#wipe-overlay.wipe-loading .wipe-loader-wrap {
  opacity: 1 !important;
}

.wipe-loader-img {
  width: 320px;
  max-width: 82vw;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(255, 255, 255, 0.18));
  user-select: none;
  pointer-events: none;
}

.wipe-loader-text {
  margin-top: 14px;
  font-family: 'JetBrains Mono', 'Space Mono', Consolas, monospace;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: #94a3b8;
  text-align: center;
  user-select: none;
  pointer-events: none;
  opacity: 0.95;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  transition: opacity 0.2s ease;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wipe-loader-msg {
  display: inline-block;
}

.wipe-loader-dots {
  display: inline-flex;
  align-items: baseline;
  margin-left: 2px;
}

.wipe-loader-dots .dot {
  display: inline-block;
  opacity: 0.2;
  animation: wipeDotPulse 1.4s infinite ease-in-out;
}

.wipe-loader-dots .dot:nth-child(1) {
  animation-delay: 0s;
}

.wipe-loader-dots .dot:nth-child(2) {
  animation-delay: 0.22s;
}

.wipe-loader-dots .dot:nth-child(3) {
  animation-delay: 0.44s;
}

@keyframes wipeDotPulse {
  0%, 100% {
    opacity: 0.2;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-2px);
    color: #f1f5f9;
  }
  70% {
    opacity: 0.2;
    transform: translateY(0);
  }
}

/* ==========================================================================
   ZERO-FLICKER INSTANT COVER FOR NEW PAGE BEFORE FIRST PAINT
   Applied by inline script in <head> if page_nav_transition is active in sessionStorage
   ========================================================================== */
html.page-transitioning {
  background: #050608 !important;
}

html.page-transitioning body {
  background: #050608 !important;
}

html.page-transitioning #wipe-overlay {
  display: block !important;
  opacity: 1 !important;
  pointer-events: all !important;
  z-index: 100002 !important;
}

html.page-transitioning #wipe-overlay .wipe-panel {
  transform: translateX(0%) !important;
  animation: none !important;
}

html.page-transitioning #wipe-overlay .wipe-loader-wrap {
  opacity: 1 !important;
}

/* ==========================================================================
   TINY CIRCLE GRAY DOWNLOAD ICON ANIMATION (BOTTOM LEFT)
   Appears at bottom left of all loading animation screens
   ========================================================================== */
.wipe-download-indicator,
.loading-download-indicator {
  position: absolute;
  bottom: 24px;
  left: 24px;
  z-index: 20;
  pointer-events: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 640px) {
  .wipe-download-indicator,
  .loading-download-indicator {
    bottom: 16px;
    left: 16px;
  }
}

#wipe-overlay.wipe-loading .wipe-download-indicator,
html.page-transitioning #wipe-overlay .wipe-download-indicator,
#portal2-loading-screen.opacity-100 .loading-download-indicator {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.download-circle-badge {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(15, 18, 25, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-spin-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  animation: downloadRingSpin 1.4s linear infinite;
  transform-origin: center;
}

.ring-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.2);
  stroke-width: 2;
}

.ring-fill {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 2;
  stroke-dasharray: 24 64;
  stroke-linecap: round;
  transform-origin: center;
}

@keyframes downloadRingSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.download-arrow-icon {
  width: 13px;
  height: 13px;
  color: #94a3b8;
  position: relative;
  z-index: 2;
  display: block;
}

.download-arrow-icon .arrow-stem-head {
  animation: downloadArrowSlide 1.3s ease-in-out infinite;
  transform-origin: center;
}

@keyframes downloadArrowSlide {
  0%, 100% {
    transform: translateY(-1.5px);
    opacity: 0.75;
  }
  50% {
    transform: translateY(1.5px);
    opacity: 1;
  }
}

/* Theme Changing Mode (Palette Icon) */
.wipe-download-indicator.mode-theme .download-arrow-icon {
  display: none !important;
}

.wipe-download-indicator.mode-theme .theme-palette-icon {
  display: block !important;
}

.theme-palette-icon {
  width: 14px;
  height: 14px;
  color: #94a3b8;
  position: relative;
  z-index: 2;
  display: none;
  animation: themePaletteTilt 1.8s ease-in-out infinite;
  transform-origin: center;
}

@keyframes themePaletteTilt {
  0%, 100% {
    transform: rotate(-10deg) scale(0.96);
    opacity: 0.75;
  }
  50% {
    transform: rotate(10deg) scale(1.05);
    opacity: 1;
    color: #f1f5f9;
  }
}

/* ==========================================================================
   TOP BAR LIVE TIME WIDGET (NEAR HOME BUTTON)
   ========================================================================== */
.navbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, 'Space Mono', Consolas, monospace);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #ffffff;
  user-select: none;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 8px;
  perspective: 360px;
  animation: slowBlink 3.2s ease-in-out infinite;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  font-variant-numeric: tabular-nums;
}

.navbar-time:hover {
  background: rgba(255, 255, 255, 0.07);
}

.navbar-time:active {
  transform: scale(0.96);
}

/* Pause blink briefly during mode switch so changer animation is 100% crisp */
.navbar-time.changer-out,
.navbar-time.changer-in-start,
.navbar-time.changer-in-active {
  animation-play-state: paused;
  opacity: 1 !important;
}

#nav-time-text,
.nav-time-icon {
  display: inline-flex;
  align-items: center;
  transform-origin: center center;
  backface-visibility: hidden;
  will-change: transform, opacity, filter;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease,
              filter 0.2s ease;
}

/* Changer Animation States (3D Flip + Blur Morph) */
.navbar-time.changer-out #nav-time-text,
.navbar-time.changer-out .nav-time-icon {
  transform: translateY(-7px) rotateX(68deg) scale(0.92);
  opacity: 0;
  filter: blur(3px);
  transition: transform 0.14s cubic-bezier(0.4, 0, 1, 1),
              opacity 0.13s ease,
              filter 0.13s ease;
}

.navbar-time.changer-in-start #nav-time-text,
.navbar-time.changer-in-start .nav-time-icon {
  transform: translateY(7px) rotateX(-68deg) scale(0.92);
  opacity: 0;
  filter: blur(3px);
  transition: none !important;
}

.navbar-time.changer-in-active #nav-time-text,
.navbar-time.changer-in-active .nav-time-icon {
  transform: translateY(0) rotateX(0deg) scale(1);
  opacity: 1;
  filter: blur(0px);
}

.nav-time-icon {
  justify-content: center;
  color: #ffffff;
}

/* Keep icon in both standard and digital modes */

@keyframes slowBlink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.32;
  }
}

@media (max-width: 480px) {
  .navbar-left {
    gap: 7px;
  }
  .navbar-time {
    font-size: 10px;
    gap: 4px;
    padding: 4px 6px;
  }
}

/* =========================================================================
   UNIVERSAL LINK FLOATING TOOLTIP ("LEADS TO")
   Liquid-smooth Lerp cursor follower with blur, scale & lift transitions
   ========================================================================= */
#external-link-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999999;
  pointer-events: none;
  visibility: hidden;
  transform: translate3d(-9999px, -9999px, 0);
  transition: visibility 0s linear 0.34s;
  will-change: transform;
  user-select: none;
}
#external-link-tooltip.is-visible {
  visibility: visible;
  transition: visibility 0s linear 0s;
}
.external-tooltip-inner {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5.5px 10px 5.5px 9px;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  transform-origin: 0% 0%;
  opacity: 0;
  transform: translate3d(0, 10px, 0) scale(0.86);
  filter: blur(6px);
  transition:
    opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: min(340px, calc(100vw - 28px));
  white-space: nowrap;
  will-change: transform, opacity, filter;
}
#external-link-tooltip.is-visible .external-tooltip-inner {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  filter: blur(0px);
  transition:
    opacity 0.38s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.46s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}
.external-tooltip-inner i {
  opacity: 0;
  transform: translate3d(-4px, 4px, 0) scale(0.72);
  transition:
    opacity 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}
#external-link-tooltip.is-visible .external-tooltip-inner i {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transition-delay: 0.04s;
}
.external-tooltip-tag {
  font-family: var(--font-mono, 'Space Mono', 'JetBrains Mono', monospace);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  padding-right: 6px;
  margin-right: 1px;
  line-height: 1;
}
.external-tooltip-url {
  font-family: var(--font-mono, 'Space Mono', 'JetBrains Mono', monospace);
  font-size: 11px;
  font-weight: 500;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1.2;
  opacity: 0;
  transform: translate3d(0, 4px, 0);
  filter: blur(3px);
  transition:
    opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.36s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
#external-link-tooltip.is-visible .external-tooltip-inner .external-tooltip-url {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  filter: blur(0px);
  transition-delay: 0.06s;
}
.external-tooltip-url.is-swapping {
  opacity: 0 !important;
  transform: translate3d(0, -3px, 0) !important;
  filter: blur(2px) !important;
  transition:
    opacity 0.08s ease-in,
    transform 0.08s ease-in,
    filter 0.08s ease-in;
}
