/* Bauhaus-inspired CSS for Bits & Pieces */

/* CSS Custom Properties */
:root {
  /* Color Palette - Inspired by the synthesizer prototype */
  --color-primary: #F8961E;     /* Orange (from knob) */
  --color-secondary: rgb(129,99,168);   /* Purple (from knob) */
  --color-accent: rgb(90,172,189);      /* Cyan (from knob) */
  --color-neutral: #2c3e50;     /* Dark gray-blue */
  --color-light: #f0f0f0;       /* Light gray */
  --color-white: #ffffff;
  --color-black: #1a1a1a;
  
  /* Additional accent colors from the synth for playful touches */
  --color-accent-green: #90BE6D;
  --color-accent-yellow: #F9C74F;
  --color-accent-red: #F94242;
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;
  
  /* Layout */
  --nav-max-width: 1400px;
  --container-max-width: 1000px;
  --post-max-width: 900px;
  --border-radius: 4px;
  --border-radius-lg: 8px;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  line-height: 1.6;
  color: var(--color-black);
  background-color: var(--color-white);
  margin: 0;
  padding: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 var(--space-sm) 0;
  color: var(--color-neutral);
}

h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
  margin: 0 0 var(--space-sm) 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-accent);
}

/* Layout Components */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

.nav-container {
  /* max-width: var(--nav-max-width); */
  margin: 0 auto;
  padding: 0 75px;
}

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

/* Header */
.site-header {
  background: var(--color-white);
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform 0.3s ease-in-out;
  will-change: transform;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-black);
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  color: var(--color-neutral);
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-md);
  align-items: center;
}

.nav-menu a {
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--color-black);
  transition: all 0.2s ease;
}

/* .nav-menu a:hover {
  color: var(--color-accent);
} */

.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--color-black);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.menu-toggle:hover {
  color: var(--color-accent);
}

/* Main Content */
.site-main {
  min-height: calc(100vh - 200px);
}

/* Home Page */
.hero {
  padding: var(--space-xl) 0;
  text-align: center;
  background: var(--color-white);
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--color-neutral);
  margin-bottom: var(--space-md);
  line-height: 1.1;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--color-neutral);
  margin-bottom: var(--space-lg);
  font-weight: 400;
}

.synth-illustration {
  max-width: 400px;
  margin: var(--space-lg) auto;
}

.synth-svg {
  width: 100%;
  height: auto;
}

.btn-cta {
  display: inline-block;
  padding: 1rem 2.5rem;
  background: var(--color-secondary);
  color: var(--color-white);
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: 50px;
  transition: all 0.3s ease;
  margin-top: var(--space-md);
}

.btn-cta:hover {
  background: var(--color-secondary);
  color: var(--color-white);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(77, 144, 142, 0.3);
}

/* About Section */
.about {
  padding: var(--space-lg) 0;
  background: var(--color-white);
}

.about h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-neutral);
  margin-bottom: var(--space-md);
}

.about-content {
  /* max-width: 900px; */
  margin: 0 auto;
  font-size: 1.2rem;
  line-height: 1.8;
  color: var(--color-neutral);
}

.about-content p {
  margin-bottom: var(--space-md);
}

/* Post List */
.posts {
  padding: var(--space-lg) 0;
  background: var(--color-white);
}

.posts h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-neutral);
  margin-bottom: var(--space-lg);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.post-card {
  background: var(--color-white);
  border: 2px solid var(--color-light);
  border-radius: 16px;
  padding: var(--space-md);
  transition: all 0.3s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.post-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.post-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.post-badge-hardware {
  background: var(--color-accent-yellow);
  color: var(--color-black);
}

.post-badge-software {
  background: var(--color-accent);
  color: var(--color-white);
}

.post-badge-experiments {
  background: var(--color-secondary);
  color: var(--color-white);
}

.post-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.post-icon-hardware {
  background: var(--color-accent-yellow);
  color: var(--color-black);
}

.post-icon-software {
  background: var(--color-accent);
  color: var(--color-white);
}

.post-icon-experiments {
  background: var(--color-secondary);
  color: var(--color-white);
}

.post-card-title {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
  color: var(--color-neutral);
  font-weight: 700;
}

.post-card-title a {
  color: var(--color-neutral);
}

/* .post-card-title a:hover {
  color: var(--color-accent);
} */

.post-card-excerpt {
  color: var(--color-neutral);
  line-height: 1.6;
  font-size: 1rem;
}

/* Individual Post */
.post {
  padding: var(--space-lg) 0;
}

.post-header {
  text-align: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--color-light);
}

.post-title {
  font-size: 3rem;
  color: var(--color-black);
  margin-bottom: var(--space-sm);
}

.post-meta {
  font-size: 1rem;
  color: var(--color-neutral);
  opacity: 0.8;
}

.post-content {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--color-neutral);
}

.post-content h2 {
  /* color: var(--color-secondary); */
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.post-content h3 {
  color: var(--color-neutral);
  margin-top: var(--space-md);
}

.post-content p {
  margin-bottom: var(--space-md);
}

.post-content .tldr {
  font-weight: 700;
}

.post-content code {
  background: var(--color-light);
  color: var(--color-neutral);
  padding: 0.2em 0.4em;
  border-radius: var(--border-radius);
  font-size: 0.9em;
}

.post-content pre {
  background: var(--color-light);
  padding: var(--space-sm);
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin: var(--space-md) 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 1em;
}

.post-content blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  border-left: 4px solid var(--color-primary);
  background: var(--color-light);
  color: var(--color-neutral);
  font-style: italic;
}

.post-content img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  height: auto;
}

.post-content figure {
  text-align: center;
  margin: var(--space-md) 0;
}

.post-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 2px solid var(--color-light);
}

.post-navigation {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
}

.post-navigation a {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-light);
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: all 0.2s ease;
}

.post-navigation a:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

/* Page Layout */
.page {
  padding: var(--space-lg) 0;
}

.page-header {
  text-align: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 3px solid var(--color-primary);
}

.page-title {
  font-size: 3rem;
  color: var(--color-primary);
}

.page-content {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--color-neutral);
}

/* Footer */
.site-footer {
  background: var(--color-neutral);
  color: var(--color-white);
  text-align: center;
  padding: var(--space-md) 0;
  margin-top: var(--space-xl);
}

/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --space-lg: 2rem;
    --space-xl: 4rem;
  }

  .hero-title {
    font-size: 2rem;
    padding: 0 var(--space-sm);
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .post-title,
  .page-title {
    font-size: 2rem;
  }

  .nav-logo {
    font-size: 1.25rem;
  }

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

  .nav-menu a {
    font-size: 1rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .about h2 {
    font-size: 2rem;
  }

  .about-content {
    font-size: 1.1rem;
  }

  .posts h2 {
    font-size: 2rem;
  }

  .post-navigation {
    flex-direction: column;
  }

  .synth-illustration {
    max-width: 100%;
    padding: 0 var(--space-sm);
  }

  .btn-cta {
    font-size: 1.1rem;
    padding: 0.875rem 2rem;
  }

  .nav-container {
    padding: 0 var(--space-sm);
  }

  .post-container {
    padding: 0 var(--space-sm);
  }

  .image-gallery {
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }

  .image-gallery img {
    width: 100% !important;
    height: auto !important;
    clip-path: none !important;
    max-width: 100%;
  }

  .lightbox-nav {
    font-size: 30px;
    padding: 10px;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
    font-size: 30px;
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }

/* Image Gallery */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}

.image-gallery-caption {
  text-align: center;
  font-size: 0.95rem;
  color: var(--color-neutral);
  opacity: 0.8;
  margin-top: var(--space-sm);
  font-style: italic;
}

.image-gallery.cols-1 {
  grid-template-columns: 1fr;
  width: max-content;
  margin-left: auto;
  margin-right: auto;
}

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

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

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

.image-gallery a {
  display: block;
  overflow: hidden;
  border-radius: var(--border-radius);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.image-gallery a:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.image-gallery img {
  width: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
  margin: 0 auto;
}

.image-gallery a:hover img {
  transform: scale(1.05);
}

/* Lightbox Modal */
.lightbox {
  display: none;
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--border-radius-lg);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 40px;
  color: var(--color-white);
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  transition: color 0.2s ease;
}

.lightbox-close:hover {
  color: var(--color-primary);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-white);
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  padding: 20px;
  user-select: none;
  transition: color 0.2s ease;
}

.lightbox-nav:hover {
  color: var(--color-primary);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-white);
  font-size: 1rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  border-radius: 20px;
}

 