/* CrystalSky New Home Stylesheet */

/* Montserrat Variable Font */
@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: swap;
}

/* 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 75% 55%;
  --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%;
  --header: 240 60% 8%;
}

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

html {
  scroll-behavior: smooth;
}

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;
  position: relative;
}

/* 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-header {
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  background: hsl(240 60% 8% / 0.85);
  border: 1px solid hsl(var(--border) / 0.3);
}

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

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

/* 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;
}

/* ========== HEADER STYLES ========== */
.header-full {
  max-width: 100%;
  border-radius: 0;
  border: none;
}

.header-pill {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 9999px;
  background: hsl(240 60% 8% / 0.9);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid hsl(var(--border) / 0.3);
  box-shadow: 0 8px 32px hsl(0 0% 0% / 0.3);
}

/* Smooth header transition without white border flash */
#header-inner {
  transition: max-width 0.4s ease, border-radius 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
  border: 1px solid transparent;
}

#header-inner.header-pill {
  border-color: hsl(var(--border) / 0.3);
}

.cs-logo-small {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
}

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

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

/* ========== ANIMATIONS ========== */

/* Glitch Effect */
.glitch-layer {
  opacity: 0;
  pointer-events: none;
}

.glitch-active .glitch-1 {
  animation: glitch-1 0.3s ease-in-out;
}

.glitch-active .glitch-2 {
  animation: glitch-2 0.3s ease-in-out;
}

@keyframes glitch-1 {
  0%, 100% { opacity: 0; transform: translate(0); }
  20% { opacity: 0.8; transform: translate(-3px, 2px); clip-path: inset(20% 0 60% 0); }
  40% { opacity: 0.6; transform: translate(3px, -2px); clip-path: inset(40% 0 40% 0); }
  60% { opacity: 0.4; transform: translate(-2px, 1px); clip-path: inset(60% 0 20% 0); }
  80% { opacity: 0.2; transform: translate(2px, -1px); clip-path: inset(80% 0 5% 0); }
}

@keyframes glitch-2 {
  0%, 100% { opacity: 0; transform: translate(0); filter: hue-rotate(0deg); }
  20% { opacity: 0.6; transform: translate(3px, -2px); filter: hue-rotate(90deg); clip-path: inset(60% 0 20% 0); }
  40% { opacity: 0.4; transform: translate(-3px, 2px); filter: hue-rotate(180deg); clip-path: inset(20% 0 60% 0); }
  60% { opacity: 0.3; transform: translate(2px, -1px); filter: hue-rotate(270deg); clip-path: inset(40% 0 40% 0); }
  80% { opacity: 0.1; transform: translate(-2px, 1px); filter: hue-rotate(360deg); clip-path: inset(10% 0 80% 0); }
}

/* Typewriter Cursor */
.typewriter-cursor {
  display: inline-block;
  color: hsl(var(--primary));
  animation: blink 1s step-end infinite;
  font-weight: 300;
}

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

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

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

/* Floating Elements */
@keyframes float-slow {
  0%, 100% { transform: translateY(0) translateX(0); }
  25% { transform: translateY(-20px) translateX(10px); }
  50% { transform: translateY(-10px) translateX(-5px); }
  75% { transform: translateY(-25px) translateX(5px); }
}

@keyframes float-medium {
  0%, 100% { transform: translateY(0) translateX(0); }
  33% { transform: translateY(-15px) translateX(-10px); }
  66% { transform: translateY(-25px) translateX(8px); }
}

@keyframes float-fast {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

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

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

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

/* Star Twinkle */
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

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

/* Particle Float */
@keyframes particle-float {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: hsl(var(--primary) / 0.6);
  border-radius: 50%;
  animation: particle-float linear infinite;
}

/* Star styling */
.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); 
}

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

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

/* ========== CARD STYLES ========== */

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

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

.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));
}

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

/* ========== BUTTON STYLES ========== */

.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);
}

/* Magnetic button effect (enhanced via JS) */
.magnetic-btn {
  transition: transform 0.2s ease-out;
}

/* ========== FOOTER STYLES ========== */

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

.footer-link {
  transition: color 0.3s ease;
}

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

/* 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));
}

/* 88x31 web buttons */
.web-button {
  width: 88px;
  height: 31px;
  image-rendering: pixelated;
  object-fit: cover;
  border: 1px solid hsl(var(--border) / 0.5);
}

/* ========== AD BANNER ========== */

.ad-banner {
  display: block;
  border: 1px solid hsl(var(--border) / 0.5);
  transition: all 0.3s ease;
}

.ad-banner:hover {
  border-color: hsl(var(--primary) / 0.3);
  box-shadow: 0 10px 40px hsl(0 0% 0% / 0.3);
}

/* ========== LOADING STATE ========== */

html.loading,
body.loading {
  height: 100%;
  overflow: hidden;
}

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

/* Hidden utility
   NOTE: Tailwind already provides `.hidden`.
   Do NOT use `!important` here, otherwise combinations like `hidden md:flex`
   will stay hidden on desktop (breaking header/footer).
*/
.hidden {
  display: none;
}

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