/* ============================================================
   MAGIC UI — Industrial Solar Design System Port
   Pure CSS & Vanilla JS adaptations of Magic UI components
   Optimized for SST (High Performance, 60fps, Zero Dependencies)
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS Properties for Border Beam Animation
   ------------------------------------------------------------ */
@property --border-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* ------------------------------------------------------------
   2. MAGIC UI: SHIMMER BUTTON (.btn--shimmer)
   Continuous luminous specular sweep around button edge
   ------------------------------------------------------------ */
.btn--shimmer {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.85rem 1.85rem;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
  color: #ffffff !important;
  background: linear-gradient(135deg, #FF6B00 0%, #E05300 100%);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(255, 107, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.btn--shimmer::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent 0deg,
    transparent 280deg,
    rgba(255, 255, 255, 0.8) 320deg,
    transparent 360deg
  );
  animation: magic-shimmer-spin 3.5s linear infinite;
  z-index: -1;
  pointer-events: none;
}

.btn--shimmer::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: linear-gradient(135deg, #FF6B00 0%, #D44E00 100%);
  border-radius: inherit;
  z-index: -1;
  transition: background 0.3s ease;
}

.btn--shimmer:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px rgba(255, 107, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.btn--shimmer:hover::after {
  background: linear-gradient(135deg, #FF7D1A 0%, #E65A00 100%);
}

.btn--shimmer:active {
  transform: translateY(0) scale(0.98);
}

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

/* Secondary Blue Shimmer Button */
.btn--shimmer-blue {
  background: linear-gradient(135deg, #0A2463 0%, #061845 100%);
  box-shadow: 0 4px 20px rgba(10, 36, 99, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.btn--shimmer-blue::after {
  background: linear-gradient(135deg, #0A2463 0%, #081B4E 100%);
}

.btn--shimmer-blue:hover {
  box-shadow: 0 8px 30px rgba(10, 36, 99, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.btn--shimmer-blue:hover::after {
  background: linear-gradient(135deg, #13337C 0%, #0A2463 100%);
}

/* ------------------------------------------------------------
   3. MAGIC UI: BORDER BEAM (.magic-border-beam)
   Luminous ray tracing along the card border
   ------------------------------------------------------------ */
.magic-border-beam-card {
  position: relative;
  border-radius: var(--radius-xl);
  z-index: 1;
}

.magic-border-beam {
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  padding: 1.5px;
  pointer-events: none;
  z-index: 2;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  background: conic-gradient(
    from var(--border-angle),
    transparent 0%,
    transparent 70%,
    rgba(255, 107, 0, 0.3) 80%,
    var(--sst-orange) 90%,
    #FFA726 95%,
    transparent 100%
  );
  animation: magic-beam-spin 4s linear infinite;
}

/* Blue variation of Border Beam */
.magic-border-beam--blue {
  background: conic-gradient(
    from var(--border-angle),
    transparent 0%,
    transparent 70%,
    rgba(30, 58, 123, 0.4) 80%,
    #0A2463 90%,
    #38BDF8 95%,
    transparent 100%
  );
  animation: magic-beam-spin 4.5s linear infinite;
}

@keyframes magic-beam-spin {
  0% { --border-angle: 0deg; }
  100% { --border-angle: 360deg; }
}

/* Fallback for browsers not supporting @property */
@supports not (background: paint(something)) {
  .magic-border-beam {
    border: 1px solid rgba(255, 107, 0, 0.3);
  }
}

/* ------------------------------------------------------------
   4. MAGIC UI: INFINITE MARQUEE (.magic-marquee)
   Frictionless continuous horizontal loop with edge fade masks
   ------------------------------------------------------------ */
.magic-marquee {
  position: relative;
  width: 100%;
  overflow: hidden;
  display: flex;
  user-select: none;
  padding: var(--space-4) 0;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 8%,
    black 92%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 8%,
    black 92%,
    transparent 100%
  );
}

.magic-marquee__track {
  display: flex;
  flex-shrink: 0;
  gap: var(--space-6);
  align-items: center;
  justify-content: space-around;
  min-width: 100%;
  animation: magic-marquee-scroll 32s linear infinite;
}

.magic-marquee--reverse .magic-marquee__track {
  animation-direction: reverse;
}

.magic-marquee--slow .magic-marquee__track {
  animation-duration: 45s;
}

.magic-marquee--fast .magic-marquee__track {
  animation-duration: 20s;
}

.magic-marquee:hover .magic-marquee__track {
  animation-play-state: paused;
}

@keyframes magic-marquee-scroll {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(calc(-100% - var(--space-6)));
  }
}

/* Marquee Card Styling */
.magic-marquee-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 1rem 1.4rem;
  background: var(--white);
  border: 1px solid rgba(10, 36, 99, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(10, 36, 99, 0.04);
  white-space: nowrap;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  flex-shrink: 0;
}

.magic-marquee-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(10, 36, 99, 0.09);
  border-color: rgba(255, 107, 0, 0.3);
}

.magic-marquee-card__logo-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(10, 36, 99, 0.03);
  border: 1px solid rgba(10, 36, 99, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  overflow: hidden;
}

.magic-marquee-card__logo-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: grayscale(15%);
  transition: filter 0.25s ease;
}

.magic-marquee-card:hover .magic-marquee-card__logo-wrap img {
  filter: grayscale(0%);
}

.magic-marquee-card__info {
  display: flex;
  flex-direction: column;
}

.magic-marquee-card__title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--charcoal);
  margin: 0;
}

.magic-marquee-card__meta {
  font-size: var(--text-xs);
  color: var(--sst-orange);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ------------------------------------------------------------
   5. MAGIC UI: DOT MATRIX & TECH GRID PATTERNS
   Modern radial-faded procedural background patterns
   ------------------------------------------------------------ */
.magic-dot-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1.2px, transparent 1.2px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 65% 55% at 50% 50%, #000 35%, transparent 100%);
  mask-image: radial-gradient(ellipse 65% 55% at 50% 50%, #000 35%, transparent 100%);
}

.magic-dot-pattern--light {
  background-image: radial-gradient(rgba(10, 36, 99, 0.12) 1.2px, transparent 1.2px);
}

.magic-grid-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 100%);
}

/* ------------------------------------------------------------
   6. MAGIC UI: METEOR SHOWER EFFECT (.magic-meteors)
   Angled high-speed streak particles for industrial energy feel
   ------------------------------------------------------------ */
.magic-meteors {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.magic-meteor {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.5px;
  height: 1.5px;
  background-color: #FFA726;
  border-radius: 9999px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 0 8px 1px #FF6B00;
  transform: rotate(215deg);
  animation: magic-meteor-fall 6s linear infinite;
  opacity: 0;
}

.magic-meteor::before {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, #FF6B00, transparent);
}

@keyframes magic-meteor-fall {
  0% {
    transform: rotate(215deg) translateX(0);
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: rotate(215deg) translateX(-600px);
    opacity: 0;
  }
}

/* ------------------------------------------------------------
   7. MAGIC UI: INTERACTIVE SPOTLIGHT CARD (.magic-spotlight)
   Card with cursor-tracking ambient light cone
   ------------------------------------------------------------ */
.magic-spotlight {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.magic-spotlight::before {
  content: "";
  position: absolute;
  top: var(--spotlight-y, -1000px);
  left: var(--spotlight-x, -1000px);
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 107, 0, 0.15) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.magic-spotlight:hover::before {
  opacity: 1;
}

/* ------------------------------------------------------------
   8. MAGIC UI: NUMBER TICKER & STAT HIGHLIGHTS
   Gradient glowing numerals for scale validation
   ------------------------------------------------------------ */
.magic-ticker {
  font-family: var(--font-display);
  font-weight: 900;
  background: linear-gradient(135deg, #FF6B00 0%, #FF9F43 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  line-height: 1;
}

.magic-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255, 107, 0, 0.08);
  border: 1px solid rgba(255, 107, 0, 0.2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--sst-orange);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

