/**
 * Layout Styles - Containerized Background System
 * 
 * This file contains:
 * - Section structure with layered backgrounds
 * - Background layer positioning
 * - Content layer positioning
 * - Container width constraints
 * - Background type variations (solid, gradient, image)
 * 
 * Requirements: 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
 */


/* ============================================
   SECTION BASE STRUCTURE
   ============================================
   Two-layer architecture: background layer + content layer
   This allows swapping backgrounds without affecting content.
*/

.section {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  width: 100%;
}


/* ============================================
   BACKGROUND LAYER
   ============================================
   Absolutely positioned layer for visual backgrounds.
   Supports: solid colors, gradients, images, and future canvas elements.
   
   To swap backgrounds: change the data-bg-type attribute and
   update the corresponding CSS below.
*/

.bg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  
  /* Default: solid color background */
  background: var(--bg-main);
}

/* Make images inside bg-layer stretch to full display */
.bg-layer picture,
.bg-layer img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}


/* ============================================
   CONTENT LAYER
   ============================================
   Relatively positioned layer containing all interactive content.
   This layer is independent of the background layer.
*/

.content-layer {
  position: relative;
  z-index: 1;
  padding: var(--space-lg) var(--space-md);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ============================================
   CONTAINER
   ============================================
   Content width constraint for optimal readability.
*/

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-md);
}


/* ============================================
   BACKGROUND TYPE VARIATIONS
   ============================================
   Different background types controlled by data-bg-type attribute.
   
   To change a section's background:
   1. Update the data-bg-type attribute in HTML
   2. Customize the styles below as needed
*/

/* Solid Color Backgrounds */
.bg-layer[data-bg-type="solid"] {
  background: var(--bg-main);
}

/* Gradient Backgrounds */
.bg-layer[data-bg-type="gradient"] {
  background: linear-gradient(135deg, var(--bg-main) 0%, var(--bg-surface) 100%);
}

/* Image Backgrounds */
.bg-layer[data-bg-type="image"] {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* Set background-image inline or via additional class */
}

/* Canvas Backgrounds (for future WebGL/Three.js integration) */
.bg-layer[data-bg-type="canvas"] {
  /* Canvas element will be mounted as a child */
  background: transparent;
}

/* ============================================
   WEBGL/THREE.JS CANVAS MOUNTING GUIDE
   ============================================
   
   The containerized background system is designed to support WebGL/Three.js
   canvas elements without requiring changes to the content layer or layout.
   
   Z-INDEX LAYERING:
   - .bg-layer: z-index: 0 (background layer - canvas mounts here)
   - .content-layer: z-index: 1 (content layer - always on top)
   
   This ensures that any canvas element mounted in the bg-layer will always
   render behind the content, maintaining proper visual hierarchy.
   
   CANVAS MOUNTING PROCESS:
   
   1. Select the target section's bg-layer:
      const bgLayer = document.querySelector('.section--hero .bg-layer');
   
   2. Set the data-bg-type attribute to "canvas":
      bgLayer.setAttribute('data-bg-type', 'canvas');
   
   3. Create and append a canvas element:
      const canvas = document.createElement('canvas');
      bgLayer.appendChild(canvas);
   
   4. Initialize your WebGL/Three.js scene using the canvas
   
   IMPORTANT NOTES:
   - The canvas will automatically fill the entire bg-layer (100% width/height)
   - No changes to .content-layer positioning are required
   - The canvas inherits the absolute positioning from .bg-layer
   - Multiple sections can have different canvas backgrounds independently
   - Canvas rendering happens at z-index: 0, content stays at z-index: 1
   
   For a complete Three.js integration example, see the documentation file:
   WEBGL_INTEGRATION_GUIDE.md (to be created in project root)
   
   ============================================ */


/* ============================================
   SECTION-SPECIFIC BACKGROUNDS
   ============================================
   Custom backgrounds for each section.
   These can be easily modified to change the look of each section.
*/

/* Hero Section - Gradient */
.section--hero .bg-layer[data-bg-type="gradient"] {
  background: linear-gradient(135deg, var(--bg-main) 0%, var(--bg-surface) 100%);
}

/* About Section - Solid */
.section--about .bg-layer[data-bg-type="solid"] {
  background: var(--bg-surface);
}

/* Skills Section - Gradient */
.section--skills .bg-layer[data-bg-type="gradient"] {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-main) 100%);
}

/* Projects Section - Solid */
.section--projects .bg-layer[data-bg-type="solid"] {
  background: var(--bg-main);
}

/* Experience Section - Gradient with accent */
.section--experience .bg-layer[data-bg-type="gradient"] {
  background: linear-gradient(135deg, var(--bg-main) 0%, rgba(156, 175, 136, 0.1) 100%);
}

/* Contact Section - Solid */
.section--contact .bg-layer[data-bg-type="solid"] {
  background: var(--bg-surface);
}


/* ============================================
   HERO SECTION STYLES
   ============================================
   Typography and layout for the Hero section.
   Requirements: 7.1, 4.1
*/

.section--hero .content-layer {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.section--hero .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.hero__title {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.02em;
  font-family: 'BBH Bartle', sans-serif;
}

.hero__subtitle {
  font-size: clamp(1.125rem, 4vw, 2rem);
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-secondary);
  margin: 0 0 var(--space-md) 0;
  max-width: 600px;
  font-family: "BBH Hegarty", sans-serif;
}

/* Ensure Hero CTA button has proper spacing */
.section--hero .btn {
  margin-top: var(--space-sm);
}


/* ============================================
   ABOUT SECTION STYLES
   ============================================
   Two-column layout with image and text.
   Requirements: 7.2, 4.2
*/

.section--about .content-layer {
  display: flex;
  align-items: center;
  justify-content: center;
}

.section__title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
  margin: 0 0 var(--space-lg) 0;
  text-align: center;
  letter-spacing: 0em;
  font-family: "Limelight", sans-serif;
}

.about__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: center;
}

.about__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  font-weight: 600;
  font-family: "Geom", sans-serif;
}

.about__bio {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0;
}

.about__image {
  flex: 0 0 auto;
  width: 100%;
  max-width: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.about__image-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-main);
  box-shadow: 0 8px 30px var(--shadow-medium);
  transition: all var(--duration-normal) var(--ease-smooth);
}

.about__image-placeholder:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 40px var(--shadow-medium);
}

.about__image-placeholder svg {
  width: 100%;
  height: 100%;
  display: block;
}


/* ============================================
   RESPONSIVE LAYOUT SYSTEM
   ============================================
   Mobile-first responsive design with four breakpoints.
   Requirements: 6.1, 6.2, 6.3, 6.4
*/


/* ============================================
   MOBILE BASE STYLES (320px+)
   ============================================
   Default styles optimized for mobile devices.
   All styles above are mobile-first.
*/

/* Mobile-specific adjustments */
.section {
  min-height: 100vh;
  /* Allow sections to be shorter on mobile if content is minimal */
  min-height: auto;
}

.content-layer {
  padding: var(--space-lg) var(--space-sm);
  min-height: 100vh;
}

.container {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

/* Mobile typography adjustments */
.hero__title {
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 1.1;
}

.hero__subtitle {
  font-size: clamp(1rem, 4vw, 1.5rem);
  margin-bottom: var(--space-md);
}

/* Mobile grid layouts - single column by default */
.skills__grid,
.projects__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.about__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.contact__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: stretch;
}


/* ============================================
   TABLET BREAKPOINT (768px+)
   ============================================
   Styles for tablet devices and larger.
   Requirements: 6.2
*/

@media (min-width: 768px) {
  /* Section adjustments */
  .section {
    min-height: 100vh;
  }
  
  .content-layer {
    padding: var(--space-xl) var(--space-md);
  }
  
  .container {
    max-width: 720px;
    padding: 0 var(--space-md);
  }
  
  /* Typography scaling */
  .hero__title {
    font-size: clamp(3rem, 6vw, 4rem);
  }
  
  .hero__subtitle {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
  }
  
  /* Grid layouts - two columns */
  .skills__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
  
  .projects__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
  
  /* About section - side by side layout */
  .about__content {
    flex-direction: row;
    align-items: center;
    gap: var(--space-lg);
  }
  
  .about__text {
    flex: 1;
  }
  
  .about__image {
    flex: 0 0 300px;
    max-width: 300px;
  }
  
  .section__title {
    text-align: left;
  }
  
  /* Contact links - horizontal layout */
  .contact__links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
  }
  
  /* Timeline adjustments */
  .timeline {
    gap: var(--space-lg);
  }
}


/* ============================================
   DESKTOP BREAKPOINT (1024px+)
   ============================================
   Styles for desktop devices and larger.
   Requirements: 6.3
*/

@media (min-width: 1024px) {
  /* Section adjustments */
  .content-layer {
    padding: var(--space-xl) var(--space-lg);
  }
  
  .container {
    max-width: 960px;
    padding: 0 var(--space-lg);
  }
  
  /* Typography scaling */
  .hero__title {
    font-size: clamp(3.5rem, 5vw, 4.5rem);
  }
  
  .hero__subtitle {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
  }
  
  /* Grid layouts - three columns for skills */
  .skills__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
  
  .projects__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
  }
  
  /* About section - more spacing */
  .about__content {
    gap: var(--space-xl);
  }
  
  .about__image {
    flex: 0 0 400px;
    max-width: 400px;
  }
  
  /* Contact links - more spacing */
  .contact__links {
    gap: var(--space-lg);
  }
  
  /* Timeline - wider layout */
  .timeline {
    max-width: 800px;
    margin: 0 auto;
  }
}


/* ============================================
   LARGE DESKTOP BREAKPOINT (1440px+)
   ============================================
   Styles for large desktop displays.
   Requirements: 6.4
*/

@media (min-width: 1440px) {
  /* Container max-width increase */
  .container {
    max-width: 1200px;
  }
  
  /* Section adjustments */
  .content-layer {
    padding: var(--space-xl) var(--space-xl);
  }
  
  /* Typography - maximum sizes */
  .hero__title {
    font-size: 4.5rem;
  }
  
  .hero__subtitle {
    font-size: 2rem;
  }
  
  /* Grid layouts - three columns for projects */
  .skills__grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xl);
  }
  
  .projects__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
  }
  
  /* About section - maximum spacing */
  .about__content {
    gap: calc(var(--space-xl) * 1.5);
  }
  
  .about__image {
    flex: 0 0 450px;
    max-width: 450px;
  }
  
  /* Timeline - maximum width */
  .timeline {
    max-width: 900px;
  }
}


/* ============================================
   UTILITY CLASSES
   ============================================
   Responsive utility classes for common patterns.
*/

/* Flexbox utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

/* Grid utilities */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Responsive visibility utilities */
.hidden-mobile {
  display: none;
}

@media (min-width: 768px) {
  .hidden-mobile {
    display: block;
  }
  
  .hidden-tablet {
    display: none;
  }
}

@media (min-width: 1024px) {
  .hidden-tablet {
    display: block;
  }
  
  .hidden-desktop {
    display: none;
  }
}

/* Text alignment utilities */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Responsive text alignment */
@media (max-width: 767px) {
  .text-center-mobile {
    text-align: center;
  }
}

@media (min-width: 768px) {
  .text-left-tablet {
    text-align: left;
  }
}

