/* filepath: c:\Users\ianma\frontend_dev\mcc-newsletter\assets\css\site.css */
/* Background pattern with bokeh blur effect */
body {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('/assets/img/leaves.png');
  background-repeat: repeat;
  background-size: auto;
  filter: blur(3px);
  opacity: 0.6;
  z-index: -1;
}

/* Ensure header doesn't grow */
header {
  flex-shrink: 0;
}

/* Header nav with same width as content */
header nav.container {
  background-color: #2d5f3f;
  max-width: 45rem;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 1rem);
  padding: 1rem var(--pico-block-spacing-horizontal);
  border-radius: 0.5rem;
  margin-top: 0.05rem;
  padding-right: 2rem;
  font-size: 1.5rem;
}

/* Main content area with solid background */
main.container {
  background-color: var(--pico-background-color);
  padding: 2rem var(--pico-block-spacing-horizontal);
  flex: 1;
  max-width: 45rem;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 1rem);
  border-radius: 0.5rem 0.5rem 0 0;
  margin-top: 0.05rem;
}

/* Footer with solid background and sticky to bottom */
footer.container {
  background-color: var(--pico-background-color);
  padding: 2rem var(--pico-block-spacing-horizontal);
  flex-shrink: 0;
  max-width: 45rem;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 1rem);
  border-radius: 0 0 0.5rem 0.5rem;
  margin-bottom: 1rem;
  border-top: 0.25rem solid #2d5f3f;
}

/* Colored header */
header {
  background-color: transparent;
  padding: 0;
}

/* Modern button-style nav links */
header nav ul li a {
  color: white;
  text-decoration: none;
  background-color: transparent;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  display: inline-block;
  font-weight: 500;
}

header nav ul li a:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.2);
}

header nav ul li a:active {
  transform: translateY(0);
  background-color: rgba(255, 255, 255, 0.25);
}

/* Logo styling */
header nav img.logo {
  height: 5rem;
  width: auto;
  filter: brightness(0) invert(1);
}

/* Reading width */
main.container {
  max-width: 45rem;
  margin-left: auto;
  margin-right: auto;
}

/* Ensure all content stays within bounds */
main img,
main pre,
main table {
  max-width: 100%;
  height: auto;
}

/* Article/Post styling */
article header {
  border-bottom: 0.125rem solid var(--pico-muted-border-color);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

article header h1 {
  margin-bottom: 0.5rem;
  color: #2d5f3f;
}

article header small {
  color: var(--pico-muted-color);
  font-weight: 500;
}

/* Better content link styling - exclude buttons */
article a:not([role="button"]),
main a:not([role="button"]) {
  color: #1a7a30;
  text-decoration: underline;
  text-decoration-color: rgba(26, 122, 48, 0.4);
  text-underline-offset: 0.125rem;
  transition: all 0.2s ease;
  font-weight: 500;
}

article a:not([role="button"]):hover,
main a:not([role="button"]):hover {
  color: #0f5f20;
  text-decoration-color: rgba(15, 95, 32, 1);
}

/* Archive list styling */
article h3 a {
  color: #2d5f3f;
  text-decoration: none;
  border-bottom: 0.125rem solid rgba(45, 95, 63, 0.2);
  transition: border-color 0.2s ease;
  display: inline-block;
}

article h3 a:hover {
  border-bottom-color: #2d5f3f;
}

/* Better spacing for archive items */
article + article {
  margin-top: 2.5rem;
}

/* Improved typography */
article p {
  line-height: 1.7;
}

/* Code blocks enhancement */
article pre {
  border-left: 0.25rem solid #2d5f3f;
}

/* Blockquote styling */
article blockquote {
  border-left: 0.25rem solid #2d5f3f;
  color: var(--pico-muted-color);
}

/* Hamburger menu - hidden on desktop */
.menu-toggle {
  display: none;
}

.hamburger {
  display: none;
}

/* Desktop nav menu - always visible */
.nav-menu {
  display: flex;
}

/* CTA Grid Layout - Desktop: 2 columns, Mobile: 1 column */
.cta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 2rem 0;
  width: 100%;
}

.cta-grid a[role="button"] {
  width: 100%;
}

/* Carousel Wrapper */
.carousel-wrapper {
  margin: 2rem 0;
  position: relative;
  max-width: 100%;
  overflow: hidden;
}

/* Carousel Container */
.carousel {
  display: flex;
  gap: 2rem;
  overflow: hidden; /* Disable manual scrolling */
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 1rem 5%;
  touch-action: none; /* Disable touch scrolling */
}

.carousel::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

/* Carousel Navigation Arrows */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(45, 95, 63, 0.9);
  color: white;
  border: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.carousel-arrow:hover {
  background: rgba(61, 127, 95, 0.95);
  transform: translateY(-50%) scale(1.1);
}

.carousel-arrow.prev {
  left: 0.5rem;
}

.carousel-arrow.next {
  right: 0.5rem;
}

/* Carousel Cards */
.carousel-card {
  flex: 0 0 80%;
  min-width: 80%;
  background: var(--pico-card-background-color);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  scroll-snap-align: center;
  border-left: 4px solid #2d5f3f;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.carousel-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.carousel-card.highlight {
  background: linear-gradient(135deg, rgba(45, 95, 63, 0.05) 0%, rgba(61, 127, 95, 0.08) 100%);
  border-left-color: #3d7f5f;
}

.carousel-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #2d5f3f;
}

.carousel-card h3 a {
  color: #2d5f3f;
  text-decoration: none;
}

.carousel-card h3 a:hover {
  text-decoration: underline;
}

.carousel-card small {
  display: block;
  color: var(--pico-muted-color);
  margin-bottom: 1rem;
  font-weight: 500;
}

.carousel-card p {
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.card-badge {
  display: inline-block;
  background: #2d5f3f;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Carousel Navigation Dots */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Desktop: Cards at 70% already set above */

/* Mobile responsiveness */
@media (max-width: 48em) {
  /* Adjust background for mobile - smaller tiles */
  body {
    background-size: 200px auto;
  }
  
  /* Smaller arrows on mobile */
  .carousel-arrow {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
  }
  
  /* Reduce gaps on mobile for better space usage */
  .carousel-arrow {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
  }
  
  /* Reduce gaps on mobile for better space usage */
  header nav.container {
    margin-top: 0.25rem;
    border-radius: 0.375rem;
    font-size: 1rem;
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
  }
  
  /* Logo takes left side with proper spacing */
  header nav ul:first-child {
    justify-self: start;
    margin: 0;
  }
  
  header nav ul:first-child li {
    list-style: none;
  }
  
  header nav ul:first-child a {
    padding: 0;
  }
  
  /* Menu toggle and nav menu take full width below */
  .menu-toggle,
  .hamburger,
  .nav-menu {
    grid-column: 1 / -1;
  }
  
  .hamburger {
    grid-column: 2;
    justify-self: end;
    font-size: 3.5rem;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    user-select: none;
    transition: transform 0.3s ease;
  }
  
  .hamburger::before {
    content: '☰';
    transition: opacity 0.2s ease;
  }
  
  .menu-toggle:checked ~ .hamburger::before {
    content: '✕';
  }
  
  .menu-toggle:checked ~ .hamburger {
    transform: rotate(90deg);
  }
  
  /* Hide nav menu by default on mobile */
  .nav-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 0.0625rem solid rgba(255, 255, 255, 0.2);
    animation: slideDown 0.3s ease;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-0.5rem);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .nav-menu li {
    width: 100%;
    text-align: center;
    margin: 0.25rem 0;
  }
  
  /* Show menu when checkbox is checked */
  .menu-toggle:checked ~ .nav-menu {
    display: flex;
  }
  
  main.container {
    margin-top: 0.25rem;
    border-radius: 0.375rem 0.375rem 0 0;
    padding: 1.5rem var(--pico-block-spacing-horizontal);
  }
  
  /* Smaller logo on mobile to prevent distortion */
  header nav img.logo {
    height: 4rem;
    width: auto;
    max-width: none;
    object-fit: contain;
  }
  
  footer.container {
    margin-bottom: 0.5rem;
    border-radius: 0 0 0.375rem 0.375rem;
    padding: 1.5rem var(--pico-block-spacing-horizontal);
  }
  
  /* Better link tap targets */
  nav a {
    padding: 0.5rem 0.75rem;
  }
  
  /* Adjust article spacing on mobile */
  article header {
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
  }
  
  article + article {
    margin-top: 2rem;
  }

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

  /* Mobile: Full width cards */
  .carousel-card {
    flex: 0 0 85%;
    min-width: 85%;
  }
  
  .carousel {
    padding: 1rem 5%;
    gap: 1.5rem;
  }
}