/**
 * KROT AI Base Styles
 * Minimal overrides - most handled by Bootstrap + variables.css
 */

/* ==========================================================================
   Prevent Horizontal Scroll from Floating Elements
   ========================================================================== */

html,
body {
  overflow-x: clip; /* clip doesn't create scroll container, unlike hidden */
  max-width: 100vw;
}

/* ==========================================================================
   Typography Override
   ========================================================================== */

body {
  font-family: var(--krot-font-primary);
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  position: relative;
  transition: background-color var(--krot-transition-base), color var(--krot-transition-base);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--krot-font-heading);
}

a {
  transition: color var(--krot-transition-base);
}

/* ==========================================================================
   Preloader
   ========================================================================== */

#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  background: var(--bs-body-bg);
}

#preloader::before {
  content: "";
  position: fixed;
  top: calc(50% - 30px);
  left: calc(50% - 30px);
  border: 6px solid var(--bs-secondary-bg);
  border-top-color: var(--bs-primary);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: preloader-spin 1s linear infinite;
}

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

/* ==========================================================================
   Back to Top Button
   ========================================================================== */

.back-to-top {
  position: fixed;
  visibility: hidden;
  opacity: 0;
  right: 15px;
  bottom: 15px;
  z-index: var(--krot-z-fixed);
  background: var(--bs-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--bs-border-radius);
  transition: all var(--krot-transition-base);
}

.back-to-top i {
  font-size: 24px;
  color: #fff;
  line-height: 0;
}

.back-to-top:hover {
  background: var(--krot-accent-light);
}

.back-to-top.active {
  visibility: visible;
  opacity: 1;
}

/* ==========================================================================
   Section Title (Dark Theme)
   ========================================================================== */

.section-header {
  text-align: center;
  padding-bottom: 2.5rem;
}

.section-header h2 {
  font-size: 2rem;
  font-weight: 700;
  position: relative;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
}

.section-header h2::after {
  content: '';
  position: absolute;
  display: block;
  width: 60px;
  height: 3px;
  background: var(--krot-gradient-accent);
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 2px;
}

.section-header p {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 767.98px) {
  .section-header h2 {
    font-size: 1.625rem;
  }

  .section-header p {
    font-size: 1rem;
  }
}

/* Minimum font size for small elements */
small,
.small {
  font-size: 1rem;
}

/* ==========================================================================
   Accessibility: Reduced Motion
   ========================================================================== */

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

  #preloader::before {
    animation: none;
  }
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

@media (max-width: 767.98px) {
  /* Slow down infinite animations on mobile to reduce paint frequency */
  .hiw-glow-primary,
  .hiw-glow-secondary,
  .hiw-glow-center,
  #hero::before,
  #hero::after {
    animation-duration: 20s !important;
  }
}

/* Use will-change for heavy animations */
#hero::before,
#hero::after,
.hiw-glow-primary,
.hiw-glow-secondary,
.hiw-glow-center {
  will-change: transform, opacity;
}
