---
// BaseLayout.astro
// Primary layout component that provides the fundamental structure and styles for the site

interface Props {
  title: string;
  description?: string;
  image?: string;
}

const { 
  title, 
  description = "LaForceIT Blog - Home Lab & DevOps Insights", 
  image = "/images/og-image.jpg" // Make sure this image exists in public/images/
} = Astro.props;
---

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>{title}</title>
    <meta name="description" content={description} />
    
    <!-- OpenGraph/Social Media Meta Tags -->
    <meta property="og:title" content={title} />
    <meta property="og:description" content={description} />
    <meta property="og:image" content={Astro.site ? new URL(image, Astro.site).href : image} /> {/* Use absolute URL */}
    <meta property="og:url" content={Astro.url} />
    <meta property="og:type" content="website" />
    
    <!-- Twitter Card data -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content={title}>
    <meta name="twitter:description" content={description}>
    <meta name="twitter:image" content={Astro.site ? new URL(image, Astro.site).href : image}> {/* Use absolute URL */}
    
    <!-- Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@100;300;400;600;700&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    
    <!-- Favicon -->
    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
    
    <!-- Schema.org markup for Google -->
    <script type="application/ld+json">
      {
        "@context": "https://schema.org",
        "@type": "WebSite",
        "name": "LaForceIT Blog",
        "url": Astro.site ? new URL(Astro.url.pathname, Astro.site).href : Astro.url.href, // Use absolute URL
        "description": description,
        "author": {
          "@type": "Person",
          "name": "Daniel LaForce"
        }
      }
    </script>
    
    <!-- Global CSS Variables & Base Styles -->
    <style is:global>
      :root {
        /* Primary Colors */
        --bg-primary: #0f1219;
        --bg-secondary: #161a24;
        --bg-tertiary: #1e2330;
        --bg-code: #1a1e2a;
        --text-primary: #e2e8f0;
        --text-secondary: #a0aec0;
        --text-tertiary: #718096;
        
        /* Accent Colors */
        --accent-primary: #06b6d4; /* Cyan */
        --accent-secondary: #3b82f6; /* Blue */
        --accent-tertiary: #8b5cf6; /* Violet */
        
        /* Glow Effects */
        --glow-primary: rgba(6, 182, 212, 0.2);
        --glow-secondary: rgba(59, 130, 246, 0.2);
        --glow-tertiary: rgba(139, 92, 246, 0.2);
        
        /* Border Colors */
        --border-primary: rgba(255, 255, 255, 0.1);
        --border-secondary: rgba(255, 255, 255, 0.05);
        
        /* Card Background */
        --card-bg: rgba(24, 28, 44, 0.5); /* Slightly different from original */
        --card-border: rgba(56, 189, 248, 0.2); /* Cyan border */
        
        /* UI Element Colors */
        --ui-element: #1e293b;
        --ui-element-hover: #334155;
        
        /* Container Paddings */
        --container-padding: clamp(1rem, 5vw, 3rem);
        
        /* Font Sizes */
        --font-size-xs: 0.75rem;
        --font-size-sm: 0.875rem;
        --font-size-md: 1rem;
        --font-size-lg: 1.125rem;
        --font-size-xl: 1.25rem;
        --font-size-2xl: 1.5rem;
        --font-size-3xl: 1.875rem;
        --font-size-4xl: 2.25rem;
        --font-size-5xl: 3rem;
        
        /* Font Families */
        --font-mono: 'JetBrains Mono', monospace;
        --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      }
      
      /* Reset Styles */
      *, *::before, *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }
      
      html, body {
        height: 100%;
        width: 100%;
        overflow-x: hidden;
      }
      
      body {
        font-family: var(--font-sans);
        background-color: var(--bg-primary);
        color: var(--text-primary);
        font-size: var(--font-size-md);
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        background-image: 
            radial-gradient(circle at 20% 35%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
            radial-gradient(circle at 75% 15%, rgba(59, 130, 246, 0.05) 0%, transparent 45%),
            radial-gradient(circle at 85% 70%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
        position: relative;
      }
      
      /* Grid overlay effect */
      body::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-image: 
            linear-gradient(rgba(226, 232, 240, 0.03) 1px, transparent 1px),
            linear-gradient(90deg, rgba(226, 232, 240, 0.03) 1px, transparent 1px);
        background-size: 30px 30px;
        pointer-events: none;
        z-index: -1;
      }
      
      a {
        color: var(--accent-primary);
        text-decoration: none;
        transition: color 0.3s ease;
      }
      
      a:hover {
        color: var(--accent-secondary);
      }
      
      img {
        max-width: 100%;
        height: auto;
        display: block; /* Prevent bottom space */
      }
      
      h1, h2, h3, h4, h5, h6 {
        margin: 0 0 1rem 0;
        line-height: 1.2;
        font-weight: 600;
        color: var(--text-primary); /* Ensure headings use primary text color */
      }
      
      p {
        margin-bottom: 1.5rem;
        color: var(--text-secondary); /* Use secondary for paragraphs */
      }
      
      button {
        cursor: pointer;
        border: none;
        outline: none;
        font-family: var(--font-sans);
      }
      
      .container {
        max-width: 1280px;
        margin: 0 auto;
        padding: 0 var(--container-padding);
      }
      
      /* Neuronal nodes animation */
      .neural-nodes { /* Changed from ID to class */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: -1;
      }
      
      .neural-node {
        position: absolute; /* Changed from fixed */
        width: 2px;
        height: 2px;
        background: rgba(226, 232, 240, 0.2);
        border-radius: 50%;
        animation: pulse 4s infinite alternate ease-in-out;
      }
      
      @keyframes pulse {
        0% {
          transform: scale(1);
          opacity: 0.3;
        }
        100% {
          transform: scale(1.5);
          opacity: 0.6;
        }
      }
      
      /* Floating gradient shapes */
      .floating-shapes {
        position: fixed; /* Changed from absolute */
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: -1; /* Ensure it's behind content */
      }
      
      .floating-shape {
        position: absolute;
        border-radius: 50%;
        opacity: 0.05;
        filter: blur(30px);
      }
      
      .shape-1 {
        width: 300px;
        height: 300px;
        background: var(--accent-primary);
        top: 20%;
        right: 0;
      }
      
      .shape-2 {
        width: 200px;
        height: 200px;
        background: var(--accent-secondary);
        bottom: 10%;
        left: 10%;
      }
      
      .shape-3 {
        width: 150px;
        height: 150px;
        background: var(--accent-tertiary);
        top: 70%;
        right: 20%;
      }
      
      /* Main Header (Example - Adapt if using Header.astro component) */
      .site-header {
        background: linear-gradient(180deg, var(--bg-secondary), transparent);
        padding: 1.5rem 0;
        position: relative; /* Changed from sticky if needed */
        z-index: 10;
        border-bottom: 1px solid var(--border-primary);
      }
      
      .header-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        max-width: 1280px;
        margin: 0 auto;
        padding: 0 var(--container-padding);
      }
      
      /* Footer (Example - Adapt if using Footer.astro component) */
      .site-footer {
        background: var(--bg-secondary);
        padding: 4rem 0 2rem;
        border-top: 1px solid var(--border-primary);
        margin-top: 4rem; /* Add space above footer */
      }
      
      /* Add other global styles from your external file if needed */
      /* Or remove conflicting styles from the external file */

    </style>
  </head>
  <body>
    <!-- Neural Nodes Animation Container -->
    <div class="neural-nodes"></div>
    
    <!-- Floating Gradient Shapes Container -->
    <div class="floating-shapes">
      <div class="floating-shape shape-1"></div>
      <div class="floating-shape shape-2"></div>
      <div class="floating-shape shape-3"></div>
    </div>
    
    {/* Use slots for Header and Footer */}
    <slot name="header" />
    
    <main>
      <slot /> {/* Default slot for page content */}
    </main>
    
    <slot name="footer" />
    
    <!-- JavaScript for animations -->
    <script>
      // Create neural network nodes
      document.addEventListener('DOMContentLoaded', function() {
        const nodesContainer = document.querySelector('.neural-nodes');
        if (nodesContainer) { // Check if container exists
            const nodeCount = 30; // Adjust count as needed
            
            for (let i = 0; i < nodeCount; i++) {
              const node = document.createElement('div');
              node.classList.add('neural-node');
              
              // Random positioning
              node.style.left = `${Math.random() * 100}%`;
              node.style.top = `${Math.random() * 100}%`;
              
              // Random animation delay
              node.style.animationDelay = `${Math.random() * 5}s`;
              
              nodesContainer.appendChild(node);
            }
        } else {
            console.warn("Element with class 'neural-nodes' not found.");
        }
        
        // Terminal typing effect (if needed globally, otherwise keep in component)
        // const typingElements = document.querySelectorAll('.terminal-typing');
        // typingElements.forEach(typingElement => { ... });
      });
    </script>
  </body>
</html>