/* CrystalSky Stylesheet */

/* Montserrat Variable Font - preload helps prevent FOUT */
@font-face {
  font-family: 'Montserrat';
  src: url('https://files.basicsites.ddns.net/generalAssets/fonts/Montserrat/Montserrat-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-display: optional; /* Prevents layout shift - uses fallback if font not ready */
}

/* Font fallback with similar metrics to reduce CLS */
body {
  font-family: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-synthesis: none;
}

/* CSS Variables - Design System */
:root {
  --background: 220 20% 6%;
  --foreground: 210 40% 96%;
  --card: 220 20% 10%;
  --card-foreground: 210 40% 96%;
  --popover: 220 20% 10%;
  --popover-foreground: 210 40% 96%;
  --primary: 0 70% 45%; /* Darkened for WCAG contrast (was 55% lightness) */
  --primary-foreground: 0 0% 100%;
  --secondary: 220 15% 12%;
  --secondary-foreground: 210 40% 96%;
  --muted: 220 15% 15%;
  --muted-foreground: 215 15% 55%;
  --accent: 0 75% 55%;
  --accent-foreground: 0 0% 100%;
  --border: 220 15% 18%;
  --input: 220 15% 18%;
  --ring: 0 75% 55%;
  --radius: 0.75rem;
  --sky-dark: 220 30% 4%;
  --sky-mid: 225 25% 8%;
  --sky-light: 220 20% 15%;
  --crystal-glow: 0 75% 55%;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Montserrat', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
}

/* Hero title bold */
.hero-title {
  font-weight: 700;
}

/* Sky Background Gradient */
.bg-gradient-sky {
  background: linear-gradient(180deg, hsl(var(--sky-dark)), hsl(var(--sky-mid)), hsl(var(--sky-light)));
}

/* Glass Effects */
.glass {
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  background: hsl(var(--background) / 0.6);
  border: 1px solid hsl(var(--border) / 0.5);
}

.glass-heavy {
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  background: hsl(var(--background) / 0.8);
  border: 1px solid hsl(var(--border) / 0.6);
}

/* Custom Shadows */
.shadow-crystal {
  box-shadow: 0 20px 60px -15px hsl(var(--crystal-glow) / 0.2);
}

.shadow-crystal-glow {
  box-shadow: 0 0 80px hsl(var(--crystal-glow) / 0.3);
}

/* Text Gradient */
.text-gradient-crystal {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(0 60% 70%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Keyframe Animations */
@keyframes blob-morph {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  25% { border-radius: 40% 60% 70% 30% / 40% 70% 30% 60%; }
  50% { border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%; }
  75% { border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%; }
}

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

@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes bounce-arrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

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

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

@keyframes scale-up {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

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

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

.animate-bounce-arrow {
  animation: bounce-arrow 1.5s ease-in-out infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-fade-in {
  animation: fade-in 0.6s ease-out forwards;
}

.animate-scale-up {
  animation: scale-up 0.8s ease-out forwards;
}

/* Star animation */
.star { 
  opacity: 0; 
  transform: scale(0); 
  transition: opacity 0.8s ease, transform 0.8s ease; 
}
.star.visible { 
  opacity: 1; 
  transform: scale(1); 
}

/* Moon animation */
.moon { 
  opacity: 0; 
  transform: translateY(20px) scale(0.8); 
  transition: all 1s ease-out 0.3s; 
}
.moon.visible { 
  opacity: 1; 
  transform: translateY(0) scale(1); 
}

/* Blob styling - use transform instead of width/height to prevent CLS */
.blob {
  box-shadow: 0 0 60px hsl(0 70% 45% / 0.15), inset 0 0 60px hsl(220 20% 10% / 0.5);
  /* Use transform for animations - no layout shift */
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
              border-radius 0.8s cubic-bezier(0.25, 0.1, 0.25, 1),
              opacity 0.8s ease-in-out;
  /* Fixed initial size - prevents CLS */
  width: 280px;
  height: 280px;
  will-change: transform, opacity;
}

.blob.expanded {
  transform: scale(1.35); /* 280 * 1.35 ≈ 378px */
}

.blob.fullscreen {
  transform: scale(12); /* Large enough to cover viewport */
  border-radius: 50% !important; /* Keep round during scale */
  animation: none;
}

/* Loader dots */
.loader-dot {
  animation: pulse-glow 2s ease-in-out infinite;
}

.loader-ring {
  animation: pulse-glow 3s ease-in-out infinite;
}

/* Hero content - use visibility + opacity to prevent CLS */
.hero-content {
  opacity: 0;
  visibility: hidden;
  /* No transform on initial state to prevent layout shift */
  transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}

.hero-content.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease, visibility 0s linear 0s;
}

/* Card hover effects */
.feature-card {
  transition: all 0.3s ease;
}

.feature-card:hover {
  box-shadow: 0 20px 60px -15px hsl(var(--crystal-glow) / 0.2);
}

.feature-card:hover .icon-container {
  transform: scale(1.1);
}

.repo-card {
  transition: all 0.3s ease;
}

.repo-card:hover {
  border-color: hsl(var(--primary) / 0.3);
  transform: translateY(-4px);
}

.repo-card:hover .repo-title {
  color: hsl(var(--primary));
}

.repo-card:hover .external-icon {
  color: hsl(var(--primary));
}

/* Button hover */
.btn-primary {
  transition: all 0.3s ease;
}

.btn-primary:hover {
  box-shadow: 0 0 80px hsl(var(--crystal-glow) / 0.3);
  transform: scale(1.05);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Link hover */
.footer-link {
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: hsl(var(--primary));
}

/* Icon container transition */
.icon-container {
  transition: transform 0.3s ease;
}

/* Scroll indicator */
.scroll-indicator {
  opacity: 0;
  transition: opacity 0.5s ease 1.2s;
}

.scroll-indicator.visible {
  opacity: 1;
}

/* Hidden state */
.hidden-element {
  opacity: 0;
  pointer-events: none;
}

/* Footer styles */
.footer-section-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  color: hsl(var(--foreground));
}

.footer-note {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-style: italic;
  margin-top: 0.75rem;
}

/* CS Logo */
.cs-logo {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 700;
  font-size: 2.5rem;
  line-height: 1;
}

.cs-logo .c {
  color: hsl(var(--foreground));
}

.cs-logo .s {
  color: hsl(var(--primary));
}

/* Loading state - prevent scroll */
html.loading,
body.loading {
  height: 100%;
  overflow: hidden;
}

body.loading {
  position: fixed;
  inset: 0;
  width: 100%;
  overscroll-behavior: none;
  touch-action: none;
}
