/* Space Empire Theme - Custom Styles */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@300;400;500;600;700;800&display=swap');

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter Tight', sans-serif;
  background-color: #000000;
  color: #ffffff;
  overflow-x: hidden;
}

/* Selection color */
::selection {
  background: rgba(255, 0, 0, 0.3);
  color: white;
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid #ff0000;
  outline-offset: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #000;
}

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #ff0000;
}

/* Glass morphism */
.glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-strong {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Text gradient */
.text-gradient {
  background: linear-gradient(135deg, #fff 0%, #ff0000 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.3); }
  50% { box-shadow: 0 0 40px rgba(255, 0, 0, 0.6); }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

.animate-pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

.animate-rotate-slow {
  animation: rotate-slow 20s linear infinite;
}

.animate-twinkle {
  animation: twinkle 3s ease-in-out infinite;
}

.animate-fade-in {
  animation: fade-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

/* Animation delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }

/* Star field background */
.stars-bg {
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* Orbit rings */
.orbit-ring {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  animation: rotate-slow 30s linear infinite;
}

.orbit-ring-reverse {
  border: 1px dashed rgba(255, 0, 0, 0.3);
  border-radius: 50%;
  animation: rotate-slow 25s linear infinite reverse;
}

/* Empire orbit system */
.empire-orbit-wrapper {
  display: flex;
  justify-content: center;
  position: relative;
}

.empire-orbit {
  --orbit-radius: clamp(150px, 30vw, 340px);
  --planet-size: clamp(92px, 12vw, 158px);
  --orbit-center-y: 41%;
  position: relative;
  width: min(98vw, 1240px);
  aspect-ratio: 1 / 0.72;
}

.empire-orbit-ring {
  position: absolute;
  left: 50%;
  top: var(--orbit-center-y);
  border-radius: 9999px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.empire-orbit-ring--outer {
  width: calc(var(--orbit-radius) * 2.34);
  height: calc(var(--orbit-radius) * 1.12);
  border: 1px dashed rgba(255, 255, 255, 0.16);
}

.empire-orbit-ring--inner {
  width: calc(var(--orbit-radius) * 1.92);
  height: calc(var(--orbit-radius) * 0.92);
  border: 1px dashed rgba(255, 0, 0, 0.2);
}

.empire-flight-path {
  position: absolute;
  left: 50%;
  top: var(--orbit-center-y);
  width: var(--path-width);
  height: var(--path-height);
  border: 1px dashed rgba(255, 70, 70, 0.24);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(var(--path-rotate));
  pointer-events: none;
}

.empire-flight-path--subtle {
  border-color: rgba(255, 255, 255, 0.14);
}

.empire-core {
  position: absolute;
  left: 50%;
  top: var(--orbit-center-y);
  width: clamp(120px, 19vw, 175px);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.22), rgba(255, 0, 0, 0.18) 42%, rgba(0, 0, 0, 0.86) 78%);
  box-shadow: 0 0 50px rgba(255, 0, 0, 0.25);
}

.empire-core-glow {
  position: absolute;
  inset: -18px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 0, 0, 0.24);
  animation: pulse-glow 3s ease-in-out infinite;
}

.empire-orbit-node {
  position: absolute;
  left: 50%;
  top: var(--orbit-center-y);
  --node-x: 0px;
  --node-y: 0px;
  --node-lift: 0px;
  width: var(--planet-size);
  height: var(--planet-size);
  overflow: visible;
  transform: translate(-50%, -50%) translate(var(--node-x), var(--node-y));
  will-change: transform;
}

.empire-orbit-node-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(var(--node-lift));
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.empire-orbit-node:hover .empire-orbit-node-inner {
  --node-lift: -10px;
}

.empire-orbit-node svg {
  width: 1.4rem;
  height: 1.4rem;
}

.empire-orbit-node-label {
  margin-top: 0.65rem;
  text-align: center;
  min-width: max-content;
}

.empire-hub-indicator {
  position: absolute;
  left: 50%;
  bottom: clamp(30px, 4vw, 54px);
  transform: translateX(-50%);
  z-index: 25;
}

/* Planet card hover effect */
.planet-card {
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.planet-card:hover {
  transform: scale(1.05) translateY(-10px);
}

.planet-card:hover .planet-image {
  transform: scale(1.1);
}

.planet-image {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Magnetic button effect */
.magnetic-btn {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.magnetic-btn:hover {
  transform: scale(1.05);
}

/* Reveal section animation */
.reveal-section {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Line clamp utilities */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Navigation styles */
#navbar.scrolled {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

#navbar.scrolled #nav-container {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 0.75rem 1.5rem;
}

/* Mobile menu */
#mobile-menu.open {
  opacity: 1;
  pointer-events: auto;
}

#mobile-menu.open .mobile-menu-link {
  opacity: 1;
  transform: translateY(0);
}

/* Form styles */
input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* Image loading placeholder */
img {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

/* Responsive typography */
@media (max-width: 1024px) {
  .empire-orbit {
    --orbit-center-y: 45%;
    aspect-ratio: 1 / 0.82;
  }
}

@media (max-width: 640px) {
  html {
    font-size: 14px;
  }

  .empire-orbit {
    --orbit-radius: clamp(112px, 34vw, 152px);
    --planet-size: clamp(56px, 16vw, 82px);
    --orbit-center-y: 46%;
    aspect-ratio: 1 / 1.04;
  }

  .empire-orbit-node {
    transform: translate(-50%, -50%) translate(var(--node-x-mobile, var(--node-x)), var(--node-y-mobile, var(--node-y)));
  }

  .empire-orbit-node-label {
    margin-top: 0.4rem;
    max-width: 7.5rem;
  }

  .empire-orbit-node-label .planet-name-en {
    display: none;
  }

  .empire-orbit-node-label .text-white {
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .empire-core {
    width: clamp(104px, 31vw, 132px);
  }

  .empire-hub-indicator {
    left: 50%;
    bottom: clamp(14px, 6vw, 28px);
    width: min(92vw, max-content);
  }

  .empire-hub-indicator .glass {
    padding: 0.55rem 0.8rem;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }

  .empire-hub-indicator .glass > span:nth-of-type(2) {
    display: none;
  }
}

@media (min-width: 1536px) {
  html {
    font-size: 18px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
