/* ============================================
   IMPORTS
   External resources loaded first
   ============================================ */

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;700&display=swap");


/* ============================================
   CSS RESET & NORMALIZATION
   Ensures consistent behavior across browsers
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100vh;
}


/* ============================================
   BASE STYLES
   Default typography and layout
   ============================================ */

body {
  display: grid;
  place-items: center;
  min-height: 100%;
  font-family: "Montserrat", system-ui, -apple-system, sans-serif;
  font-size: 1.1rem;
  line-height: 1.6;
  background-color: var(--color-bg-dark);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ============================================
   TYPOGRAPHY
   Animated heading with typewriter effect
   ============================================ */

.main__heading {
  /* Layout */
  margin-top: 6.25rem;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 0;
  
  /* Typography */
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2.75rem);
  text-align: center;
  
  /* Gradient text effect using theme variables */
  background: var(--gradient-heading);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  
  /* Typewriter effect setup */
  overflow: hidden;
  white-space: nowrap;
  border-right: 0.125rem solid var(--color-primary);
  width: 0;
  max-width: 30ch;
  
  /* Animations */
  animation:
    typing 2.5s steps(30, end) forwards,
    blink-caret 0.75s step-end 5 forwards;
}

@keyframes typing {
  from { 
    width: 0; 
  }
  to { 
    width: 30ch; 
  }
}

@keyframes blink-caret {
  from, to { 
    border-color: transparent; 
  }
  50% { 
    border-color: var(--primary-color); 
  }
  100% { 
    border-color: transparent; 
  }
}


/* ============================================
   PROJECT DETAILS SECTION
   Content container
   ============================================ */

.project-details {
  padding: 1.25rem;
  line-height: 1.6;
  background-color: var(--bg-color);
  border-radius: 0.9375rem;
  margin-top: 1.25rem;
}


/* ============================================
   IMAGE-TEXT WRAPPER
   Combined content block with image and text
   ============================================ */

.image-text-wrapper {
  /* Layout */
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
  margin: 2rem auto;
  padding: 2rem;
  overflow: hidden;
  
  background: var(--bg-color-darker);
  border-radius: 1rem;
  border: 0.0625rem solid var(--color-primary);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
  
  /* Animation */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-text-wrapper:hover {
  box-shadow: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.2);
  transform: translateY(-0.1875rem);
}


/* ============================================
   IMAGE-TEXT CONTENT
   Flexbox layout for image and text
   ============================================ */

.image-text-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2rem;
  flex: 1;
  flex-wrap: wrap;
}


/* ============================================
   INLINE IMAGE
   Responsive image with hover effect
   ============================================ */

.inline-image {
  /* Layout */
  width: 25%;
  min-width: 12.5rem;
  height: auto;
  
  /* Visual */
  border-radius: 0.75rem;
  box-shadow: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.15);
  
  /* Animation */
  transition: 
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.inline-image:hover {
  transform: scale(1.03);
  box-shadow: 0 0.625rem 1.75rem rgba(0, 0, 0, 0.2);
}

.right-float {
  float: right;
}


/* ============================================
   TEXT CONTENT
   Paragraph styling within image-text blocks
   ============================================ */

.image-text-content p {
  /* Layout */
  flex: 1;
  margin: 0;
  max-width: 100%;
  
  /* Typography - using theme variable */
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-color);
}


/* ============================================
   RESPONSIVE DESIGN
   Mobile optimizations
   ============================================ */

@media (max-width: 48rem) {
  .main__heading {
    font-size: clamp(1.25rem, 3.5vw, 1.5rem);
    margin-top: 5rem;
    max-width: 25ch;
  }

  @keyframes typing {
    from { 
      width: 0; 
    }
    to { 
      width: 25ch; 
    }
  }

  h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .image-text-wrapper {
    margin: 1.5rem auto;
    padding: 1.5rem;
  }

  .image-text-content {
    flex-direction: column;
    align-items: center;
    text-align: left;
    gap: 1.5rem;
  }

  .inline-image {
    width: 80%;
    float: none;
    min-width: auto;
  }

  .image-text-content p {
    padding-top: 1rem;
    width: 100%;
    font-size: 1rem;
  }

  .project-details {
    padding: 1rem;
    margin-top: 1rem;
  }
}

@media (max-width: 36rem) {
  .main__heading {
    margin-top: 4rem;
  }

  .image-text-wrapper {
    margin: 1rem auto;
    padding: 1rem;
  }

  .image-text-content {
    gap: 1rem;
  }

  .inline-image {
    width: 100%;
  }

  .image-text-content p {
    font-size: 0.9375rem;
  }
}
