/** @format */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Background Canvas */
.background-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.4;
  filter: blur(0px);
  pointer-events: none;
}

/* Name Display */
.name-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}

.name-text {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 2.5rem;
  font-weight: 300;
  color: rgba(0, 0, 0, 0.3);
  text-align: center;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  margin: 0;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.name-text:hover {
  opacity: 0.9;
}

body {
  background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%);
  overflow: hidden;
  font-family: "Arial", sans-serif;
  cursor: none;
  transition: background 0.3s ease;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: #333;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top: 3px solid #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-content h2 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  font-weight: 300;
}

.loading-content p {
  font-size: 1rem;
  color: #666;
}

/* Accessibility - Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #000;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 6px;
}

/* Visually hidden elements for screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.node {
  position: absolute;
  cursor: grab;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 10;
  border: 2px solid rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
}

.node:hover,
.node:focus {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
  border-color: rgba(0, 0, 0, 0.3);
  outline: 2px solid white;
  outline-offset: 2px;
}

.node:active {
  cursor: grabbing;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Seamless page transition animation */
.node.entering {
  animation: seamlessTransition 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94)
    forwards;
  z-index: 1000;
}

/* Background animation during transition */
.node.entering ~ .background-canvas {
  animation: backgroundBlur 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Connection lines fade during transition */
.node.entering ~ .connections .connection-line {
  animation: connectionFade 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes backgroundBlur {
  0% {
    filter: blur(0px);
    opacity: 0.4;
  }
  100% {
    filter: blur(2px);
    opacity: 0.2;
  }
}

@keyframes connectionFade {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 0.1;
  }
}

@keyframes seamlessTransition {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    filter: grayscale(1) contrast(1.1) blur(0px);
    border-radius: 50%;
  }
  20% {
    transform: scale(1.2) rotate(2deg);
    opacity: 0.95;
    filter: grayscale(0.8) contrast(1.2) blur(1px);
    border-radius: 45%;
  }
  40% {
    transform: scale(1.8) rotate(1deg);
    opacity: 0.9;
    filter: grayscale(0.6) contrast(1.3) blur(2px);
    border-radius: 35%;
  }
  60% {
    transform: scale(3.5) rotate(0deg);
    opacity: 0.8;
    filter: grayscale(0.4) contrast(1.4) blur(3px);
    border-radius: 25%;
  }
  80% {
    transform: scale(8) rotate(-1deg);
    opacity: 0.6;
    filter: grayscale(0.2) contrast(1.5) blur(4px);
    border-radius: 15%;
  }
  100% {
    transform: scale(20) rotate(0deg);
    opacity: 0;
    filter: grayscale(0) contrast(1.6) blur(5px);
    border-radius: 5%;
  }
}

.node img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.1);
  pointer-events: none;
}

.node:hover img,
.node:focus img {
  filter: grayscale(0.5) contrast(1.2);
}

.node-tooltip {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: 100;
  letter-spacing: 0.5px;
}

.node:hover .node-tooltip,
.node:focus .node-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

.node-1 {
  width: 120px;
  height: 120px;
  animation: float1 6s ease-in-out infinite;
}

.node-2 {
  width: 125px;
  height: 125px;
  animation: float2 8s ease-in-out infinite;
}

.node-3 {
  width: 110px;
  height: 110px;
  animation: float3 7s ease-in-out infinite;
}

@keyframes float1 {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-15px) rotate(1deg);
  }
  50% {
    transform: translateY(0px) rotate(0deg);
  }
  75% {
    transform: translateY(-10px) rotate(-1deg);
  }
}

@keyframes float2 {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-18px) rotate(-1.5deg);
  }
  66% {
    transform: translateY(-8px) rotate(0.5deg);
  }
}

@keyframes float3 {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  40% {
    transform: translateY(-12px) rotate(1deg);
  }
  80% {
    transform: translateY(-16px) rotate(-0.5deg);
  }
}

.connections {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.connection-line {
  position: absolute;
  background: rgba(0, 0, 0, 0.6);
  transform-origin: left center;
  border-radius: 1px;
  animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.8;
  }
}

.custom-cursor {
  position: fixed;
  width: 16px;
  height: 16px;
  background: radial-gradient(circle, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.8));
  border-radius: 50%;
  pointer-events: none;
  z-index: 1000;
  transition: transform 0.1s ease;
  border: 2px solid rgba(0, 0, 0, 1);
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
}

/* Page transition overlay */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    visibility 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
  backdrop-filter: blur(0px);
}

.page-transition.active {
  opacity: 1;
  visibility: visible;
  backdrop-filter: blur(3px);
}

/* Mobile Responsiveness - Improved Scaling */
@media (max-width: 768px) {
  body {
    cursor: auto; /* Restore default cursor on mobile */
  }

  .custom-cursor {
    display: none; /* Hide custom cursor on mobile */
  }

  .name-text {
    font-size: 1.8rem;
  }

  .node {
    cursor: pointer;
    /* Increase touch target size for mobile */
    min-width: 60px;
    min-height: 60px;
  }

  .node-1 {
    width: 90px;
    height: 90px;
  }

  .node-2 {
    width: 94px;
    height: 94px;
  }

  .node-3 {
    width: 85px;
    height: 85px;
  }

  .node-tooltip {
    font-size: 11px;
    padding: 4px 8px;
    top: -35px;
  }

  /* Reduce animation intensity on mobile for performance */
  @keyframes float1 {
    0%,
    100% {
      transform: translateY(0px) rotate(0deg);
    }
    50% {
      transform: translateY(-6px) rotate(0.3deg);
    }
  }

  @keyframes float2 {
    0%,
    100% {
      transform: translateY(0px) rotate(0deg);
    }
    50% {
      transform: translateY(-8px) rotate(-0.3deg);
    }
  }

  @keyframes float3 {
    0%,
    100% {
      transform: translateY(0px) rotate(0deg);
    }
    50% {
      transform: translateY(-5px) rotate(0.2deg);
    }
  }

  /* Seamless transition for mobile */
  @keyframes seamlessTransition {
    0% {
      transform: scale(1) rotate(0deg);
      opacity: 1;
      filter: grayscale(1) contrast(1.1) blur(0px);
      border-radius: 50%;
    }
    20% {
      transform: scale(1.15) rotate(1deg);
      opacity: 0.95;
      filter: grayscale(0.8) contrast(1.2) blur(1px);
      border-radius: 45%;
    }
    40% {
      transform: scale(1.6) rotate(0deg);
      opacity: 0.9;
      filter: grayscale(0.6) contrast(1.3) blur(2px);
      border-radius: 35%;
    }
    60% {
      transform: scale(2.8) rotate(-1deg);
      opacity: 0.8;
      filter: grayscale(0.4) contrast(1.4) blur(3px);
      border-radius: 25%;
    }
    80% {
      transform: scale(6) rotate(0deg);
      opacity: 0.6;
      filter: grayscale(0.2) contrast(1.5) blur(4px);
      border-radius: 15%;
    }
    100% {
      transform: scale(12) rotate(0deg);
      opacity: 0;
      filter: grayscale(0) contrast(1.6) blur(5px);
      border-radius: 5%;
    }
  }
}

@media (max-width: 480px) {
  .name-text {
    font-size: 1.5rem;
  }

  .node-1 {
    width: 70px;
    height: 70px;
  }

  .node-2 {
    width: 81px;
    height: 81px;
  }

  .node-3 {
    width: 65px;
    height: 65px;
  }

  .node-tooltip {
    font-size: 10px;
    padding: 3px 6px;
    top: -30px;
  }

  /* Seamless transition for small screens */
  @keyframes seamlessTransition {
    0% {
      transform: scale(1) rotate(0deg);
      opacity: 1;
      filter: grayscale(1) contrast(1.1) blur(0px);
      border-radius: 50%;
    }
    20% {
      transform: scale(1.1) rotate(1deg);
      opacity: 0.95;
      filter: grayscale(0.8) contrast(1.2) blur(1px);
      border-radius: 45%;
    }
    40% {
      transform: scale(1.4) rotate(0deg);
      opacity: 0.9;
      filter: grayscale(0.6) contrast(1.3) blur(2px);
      border-radius: 35%;
    }
    60% {
      transform: scale(2.2) rotate(-1deg);
      opacity: 0.8;
      filter: grayscale(0.4) contrast(1.4) blur(3px);
      border-radius: 25%;
    }
    80% {
      transform: scale(4.5) rotate(0deg);
      opacity: 0.6;
      filter: grayscale(0.2) contrast(1.5) blur(4px);
      border-radius: 15%;
    }
    100% {
      transform: scale(8) rotate(0deg);
      opacity: 0;
      filter: grayscale(0) contrast(1.6) blur(5px);
      border-radius: 5%;
    }
  }
}

/* Tablet landscape adjustments */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
  .node {
    cursor: pointer;
  }

  .custom-cursor {
    display: none;
  }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .node {
    border-width: 1px;
  }

  .connection-line {
    height: 0.5px;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .node {
    animation: none;
  }

  .connection-line {
    animation: none;
    opacity: 0.6;
  }

  .node-tooltip {
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .loading-spinner {
    animation: none;
  }

  @keyframes seamlessTransition {
    0% {
      transform: scale(1) rotate(0deg);
      opacity: 1;
      filter: grayscale(1) contrast(1.1) blur(0px);
      border-radius: 50%;
    }
    50% {
      transform: scale(1.05) rotate(0deg);
      opacity: 0.8;
      filter: grayscale(0.5) contrast(1.2) blur(1px);
      border-radius: 40%;
    }
    100% {
      transform: scale(1.1) rotate(0deg);
      opacity: 0;
      filter: grayscale(0) contrast(1.3) blur(2px);
      border-radius: 30%;
    }
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    transition: background 0.3s ease;
  }

  .loading-screen {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  }

  .loading-content {
    color: #f0f0f0;
  }

  .loading-spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: #f0f0f0;
  }

  .loading-content p {
    color: #ccc;
  }

  .node {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }

  .node:hover,
  .node:focus {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
  }

  .connection-line {
    background: rgba(255, 255, 255, 0.6);
  }

  .custom-cursor {
    background: radial-gradient(
      circle,
      rgba(255, 255, 255, 0.6),
      rgba(255, 255, 255, 0.2)
    );
    border-color: rgba(255, 255, 255, 0.3);
  }
}
