/* =============================================================================
   Base Styles - Root Variables, Global Styles, Typography
   - Core foundation styles for the Tundra Tech website
============================================================================= */

/* =============================================================================
   Root Variables
   - Define global theme variables such as colors, images, and background settings.
============================================================================= */
:root {
  --text-color: #fff;
  --background-image: url('../Images/Backgrounds/background-dark.png');
  --paragraph-bg: rgba(0, 0, 0, 0.007);
  --heading-color: #fff;
  --h3-bg: #44444401;
  --h3-color: #ddd;
  --settings-color: #3333339b;
  --backtotop-image: url('../Images/Icons/scroll-up-pulsar-dual_dark/icons8-scroll-up-96.png');
  
  /* Z-index hierarchy */
  --z-background: -10;
  --z-background-overlay: -1;
  --z-content: 1;
  --z-fixed-elements: 100;
  --z-navigation: 1000;
  --z-back-to-top: 1001;
  --z-settings-panel: 1002;
  --z-settings-gear: 1003;
  --z-gallery-overlay: 1004;
  --z-modal: 2000;
  --z-modal-content: 2001;
  --z-tooltip: 3000;
}

/* =============================================================================
   Global Styles
   - Base styles applied to HTML elements.
============================================================================= */
html {
  text-align: left; /* Ensure text is aligned to the left by default */
  overflow-x: hidden; /* Prevent horizontal scroll */
  scroll-behavior: smooth; /* Enable smooth scrolling */
}

/* Prevent horizontal overflow on all elements */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Performance optimization for animations */
.animate-logo,
.animate-title,
.page-title,
.back-to-top,
.gear-icon,
.gallery-item img,
.scroll-animate,
.scroll-animate-left,
.scroll-animate-right,
.scroll-animate-scale {
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Respect user's motion preferences */
@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;
  }
  
  .scroll-animate,
  .scroll-animate-left,
  .scroll-animate-right,
  .scroll-animate-scale {
    opacity: 1;
    transform: none;
  }
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* =============================================================================
   Body Styling (Default & Light Mode)
   - Sets default theme for the body including background and text color.
============================================================================= */

/* Default (Dark Theme) */
body {
  background-image: var(--background-image);
  color: var(--text-color);
  transition: background-image 0.5s ease, color 0.5s ease;
}

/* Light Mode Overrides */
body.light-mode {
  --text-color: #000;
  --background-image: url('../Images/Backgrounds/background-light.png');
  --paragraph-bg: rgba(255, 255, 255, 0.15);
  --settings-color: #dcdcdc9b;
  --backtotop-image: url('../Images/Icons/scroll-up-pulsar-dual_light/icons8-scroll-up-96.png');
}

/* =============================================================================
   Typography
   - Styling for text elements including paragraphs, headings, and lists.
============================================================================= */
p,
ul,
ol {
  margin: 1rem 0;
}

ul,
ol {
  padding-left: 1.5rem;
}

p {
  font-family: 'Roboto', sans-serif;
  font-size: 1.2rem;
  line-height: 1.6;
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.6), 0 0 2px rgba(0, 0, 0, 0.3);
}

/* Bold text within paragraphs */
p b {
  text-align: center;
  font-weight: 900;
  font-size: xx-large;
}

/* Headings (h1, h2, h3) share a common text color */
h1,
h2,
h3 {
  color: var(--heading-color);
}

h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 3rem;
  text-align: center;
  font-weight: 700;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3), 0 0 2px rgba(0, 0, 0, 0.8);
  margin-top: 80px;
}

/* h1 Hover Effect */
h1:hover {
  transform: scale(1.02);
  transition: transform 0.3s ease;
}

h2 {
  text-align: center;
  font-weight: 800;
  color: rgb(4, 228, 253);
  font-family: 'Montserrat', sans-serif;
  font-size: 2.2rem;
  margin: 3rem 0 2rem 0;
  text-shadow: 0 2px 8px rgba(0, 255, 255, 0.2), 0 0 2px rgba(0, 0, 0, 0.7);
  position: relative;
}

h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #00ffff, transparent);
  border-radius: 2px;
}

h3 {
  background-color: var(--h3-bg);
  border-radius: 8px;
  padding: 0.5em;
  text-align: center;
  font-weight: 300;
  color: var(--h3-color);
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.6);
}

figcaption {
  background: linear-gradient(145deg, var(--h3-bg), rgba(255, 255, 255, 0.05));
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  font-weight: 400;
  color: var(--h3-color);
  font-style: italic;
  margin-top: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.6);
}

/* =============================================================================
   Animations and Keyframes
============================================================================= */
@keyframes titlePulse {
  0% { 
    transform: scale(1) translateZ(0); 
    opacity: 0.9;
  }
  100% { 
    transform: scale(1.02) translateZ(0); 
    opacity: 1;
  }
}

@keyframes titleUnderline {
  0% { width: 100px; opacity: 0.6; }
  100% { width: 250px; opacity: 1; }
}

@keyframes greetingFade {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes sparkle {
  0%, 100% { opacity: 0.4; transform: translateY(-50%) scale(1); }
  50% { opacity: 1; transform: translateY(-50%) scale(1.2); }
}

@keyframes slideInFromLeft {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeInScale {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Global mobile styles to prevent horizontal scrolling */
@media (max-width: 768px) {
  * {
    max-width: 100vw;
    box-sizing: border-box;
  }
  
  body, html {
    overflow-x: hidden;
    width: 100%;
  }
  
  .container, main, section, div {
    max-width: 100%;
    overflow-x: hidden;
  }
}