/* Animated Coding Background Styles */

/* Fix background cutting issues */
body {
  margin: 0;
  padding: 0;
}

.animated-background {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Ensure header doesn't interfere */
header {
  position: relative;
  z-index: 1000;
}

/* Main animated background container */
.animated-background {
  position: relative;
  width: 100%;
  height: 100vh; /* Full viewport height for better coverage */
  min-height: 600px; /* Increased minimum height for better display */
  background-image: url('../img/bg/coding.png');
  background-size: cover;
  background-position: center top; /* Position to show top of image */
  background-repeat: no-repeat;
  overflow: hidden;
  display: flex;
  align-items: center; /* Center content vertically */
  margin-top: 0; /* Ensure no top margin */
  padding-top: 0; /* Ensure no top padding */
}

/* Monitor overlay positioned over the background */
.monitor-overlay {
  position: absolute;
  top: 5%; /* Adjusted to prevent top cutting */
  left: 11%;
  width: 365px;
  height: 570px;
  background: rgba(0, 0, 0, 0.95);
  border: none;
  border-radius: 3px;
  overflow: hidden;
  transform: perspective(1000px) rotateY(8deg) rotateX(-2deg) rotateZ(1deg);
  box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.2);
  transform-origin: center center;
}

/* Code editor styling */
.code-editor {
  width: 100%;
  height: 100%;
  background: #0d1117;
  color: #c9d1d9;
  padding: 15px 12px 15px 12px; /* Reduced padding to allow more content */
  font-size: 12px; /* Increased font size for better readability */
  line-height: 1.4; /* Increased line height for better spacing */
  overflow: hidden;
  position: relative;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  box-sizing: border-box; /* Ensure padding is included in dimensions */
}

/* Animated code lines */
.code-line {
  opacity: 0;
  white-space: nowrap;
  margin-bottom: 3px; /* Increased margin for better spacing with larger font */
  animation: typewriter 0.2s ease-in-out forwards;
}

.code-line.comment {
  color: #6a9955;
}

.code-line.function {
  color: #dcdcaa;
}

.code-line.keyword {
  color: #569cd6;
}

.code-line.string {
  color: #ce9178;
}

.code-line.variable {
  color: #9cdcfe;
}

/* Blinking cursor */
.cursor {
  display: inline-block;
  width: 8px;
  height: 12px;
  background: #00ff00;
  animation: blink 1s infinite;
  margin-left: 2px;
}

/* Animation keyframes */
@keyframes typewriter {
  0% {
    opacity: 0;
    transform: translateX(-10px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Line numbers styling */
.line-numbers {
  position: absolute;
  left: 0;
  top: 15px; /* Adjusted for new padding */
  width: 35px; /* Slightly wider for better alignment */
  color: #858585;
  font-size: 12px; /* Match the code editor font size */
  text-align: right;
  padding-right: 10px; /* Increased padding for better spacing */
}

.code-content {
  margin-left: 45px; /* Increased to accommodate wider line numbers */
}

/* Hero Content Overlay */
.hero-content-overlay {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 90px 0;
  background: transparent; /* Removed dark overlay for clean look */
}

.hero-content-overlay .main-heading {
  background: transparent; /* Removed white background */
  padding: 40px;
  border-radius: 15px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); /* Added text shadow for readability */
}

.hero-content-overlay .title {
  color: #ffffff; /* White text */
  font-weight: 700;
  margin-bottom: 20px;
}

.hero-content-overlay .title .span {
  color: #00d4ff; /* Bright cyan for accent */
}

.hero-content-overlay p {
  color: #f0f0f0; /* Light gray text */
  font-size: 16px;
  line-height: 1.6;
}

/* Responsive adjustments */

/* Specific fix for common 15.6" laptop resolutions (1366x768, 1920x1080) */
@media (min-width: 1200px) and (max-width: 1400px) and (min-height: 700px) and (max-height: 900px) {
  .animated-background {
    height: 100vh;
    min-height: 500px;
  }

  .monitor-overlay {
    width: 270px;
    height: 360px;
    left: 7%;
    top: 15%;
    transform: perspective(850px) rotateY(5deg) rotateX(-1deg) rotateZ(1deg);
  }

  .code-editor {
    font-size: 9px;
    padding: 10px 8px;
    line-height: 1.25;
  }

  .line-numbers {
    font-size: 9px;
    width: 30px;
    padding-right: 7px;
  }

  .code-content {
    margin-left: 37px;
  }
}

/* Laptop screens - Medium to Large (1024px to 1599px) */
@media (min-width: 1024px) and (max-width: 1599px) {
  .animated-background {
    height: 100vh;
    min-height: 500px;
    background-position: center top;
  }

  .monitor-overlay {
    width: 280px;
    height: 380px;
    left: 8%;
    top: 12%;
    transform: perspective(900px) rotateY(6deg) rotateX(-1deg) rotateZ(1deg);
  }

  .code-editor {
    font-size: 10px;
    padding: 12px 10px;
    line-height: 1.3;
  }

  .line-numbers {
    font-size: 10px;
    width: 32px;
    padding-right: 8px;
  }

  .code-content {
    margin-left: 40px;
  }

  .hero-content-overlay {
    padding: 70px 0;
  }

  .hero-content-overlay .main-heading {
    padding: 35px 25px;
  }
}

/* Small laptops and large tablets (769px to 1023px) */
@media (min-width: 769px) and (max-width: 1023px) {
  .animated-background {
    height: 100vh;
    min-height: 450px;
    background-position: center top;
  }

  .monitor-overlay {
    width: 260px;
    height: 320px;
    left: 6%;
    top: 15%;
    transform: perspective(800px) rotateY(5deg) rotateX(-1deg) rotateZ(1deg);
  }

  .code-editor {
    font-size: 9px;
    padding: 10px 8px;
    line-height: 1.3;
  }

  .line-numbers {
    font-size: 9px;
    width: 30px;
    padding-right: 7px;
  }

  .code-content {
    margin-left: 37px;
  }

  .hero-content-overlay {
    padding: 65px 0;
  }

  .hero-content-overlay .main-heading {
    padding: 32px 22px;
  }
}

@media (max-width: 768px) {
  .animated-background {
    height: 72vh; /* Updated to match main height (72vh) */
    min-height: 432px; /* Proportionally increased minimum height */
    background-position: center top;
  }

  .monitor-overlay {
    width: 240px;
    height: 150px;
    left: 10%;
    top: 15%; /* Adjusted to prevent cutting */
    transform: perspective(800px) rotateY(6deg) rotateX(-1deg) rotateZ(2deg);
  }
    .code-editor {
    font-size: 9px; /* Increased from 7px for better readability on tablets */
    padding: 12px 8px 12px 8px; /* Adjusted padding for tablet */
    line-height: 1.3;
  }

  .line-numbers {
    font-size: 9px; /* Match code editor font size */
    width: 30px;
    padding-right: 8px;
  }

  .code-content {
    margin-left: 38px; /* Adjusted for smaller line numbers */
  }

  .hero-content-overlay {
    padding: 60px 0;
  }

  .hero-content-overlay .main-heading {
    padding: 30px 20px;
  }
}

@media (max-width: 480px) {
  .animated-background {
    height: 72vh; /* Updated to match main height (72vh) */
    min-height: 360px; /* Proportionally increased minimum height */
    background-position: center top;
  }

  .monitor-overlay {
    width: 200px;
    height: 120px;
    left: 8%;
    top: 20%; /* Adjusted to prevent cutting */
    transform: perspective(600px) rotateY(4deg) rotateX(-1deg) rotateZ(1deg);
  }
    .code-editor {
    font-size: 7px; /* Increased from 6px for better readability on mobile */
    padding: 10px 6px 10px 6px; /* Adjusted padding for mobile */
    line-height: 1.2;
  }

  .line-numbers {
    font-size: 7px; /* Match code editor font size */
    width: 25px;
    padding-right: 6px;
    top: 10px;
  }

  .code-content {
    margin-left: 31px; /* Adjusted for smaller line numbers */
  }

  .hero-content-overlay {
    padding: 40px 0;
  }

  .hero-content-overlay .main-heading {
    padding: 25px 15px;
  }

  .hero-content-overlay .title {
    font-size: 24px;
  }

  .hero-content-overlay p {
    font-size: 14px;
  }
}
