/* Modular Building Blocks Style (extracted from multiple pages) */
.blocks-section {
  padding: 3rem 0;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.blocks-grid {
  display: grid;
  /* single-column layout for prototypes: stack blocks vertically */
  grid-template-columns: 1fr;
  gap: 1.75rem;
  perspective: 1000px;
  max-width: 900px; /* keep column comfortable on wide screens */
  margin: 0 auto;
}

.building-block {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border-top: 6px solid var(--block-color);
  border-left: 6px solid color-mix(in srgb, var(--block-color) 80%, white);
  transform-style: preserve-3d;
  overflow: hidden;
}

.building-block:nth-child(1) {
  --block-color: #2563eb;
}
.building-block:nth-child(2) {
  --block-color: #059669;
}
.building-block:nth-child(3) {
  --block-color: #b95d2c;
}
.building-block:nth-child(4) {
  --block-color: #8836d4;
}
.building-block:nth-child(5) {
  --block-color: #dcbb26;
}
.building-block:nth-child(6) {
  --block-color: #0891b2;
}
.building-block:nth-child(7) {
  --block-color: #98b208;
}
.building-block:nth-child(8) {
  --block-color: #6c75ec;
}

.building-block::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-left: 30px solid var(--block-color);
  border-bottom: 30px solid transparent;
  opacity: 0.3;
}

.building-block::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--block-color), transparent);
  transition: height 0.3s ease;
}

.building-block:hover {
  transform: translateY(-8px) rotateX(5deg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.building-block:hover::after {
  height: 8px;
}

.block-header {
  /* two-column header: fixed icon column + content (title + description) */
  display: grid;
  grid-template-columns: 96px 1fr; /* larger icon column so text is pushed further right */
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1rem;
}

.block-icon {
  width: 88px;
  height: 88px;
  background: white; /* icon sits on a white background */
  border-radius: 12px;
  padding: 0.35rem; /* slightly reduced to keep svg size stable with larger border */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 14px solid var(--block-color); /* thicker colored border around the icon */
  box-sizing: border-box;
}

/* use local svg files for icons; size images consistently */
.block-icon img {
  width: 44px;
  height: 44px;
  display: block;
  object-fit: contain;
  filter: none; /* ensure the svg is shown on white background */
}

.building-block:hover .block-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* removed second conflicting rule that inverted icon colors */

.block-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.15;
  margin: 0;
}

.block-content {
  display: block; /* ensures title and description stack inside content column */
  padding-left: 0.4rem; /* small nudge so text never overlaps icon */
}

/* allow the appetizer to use more of the right-side space (≈ +50%) */
.block-content .block-description {
  max-width: 86ch; /* increased to reduce early wrapping */
  margin-top: 0.4rem;
}

/* place description under the title within the content column so it doesn't start under the icon */
.block-description {
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0.35rem 0 0 0;
  /* rely on ch-based max-width from .block-content to control wrapping */
  font-style: italic;
  opacity: 0.95;
  display: block;
}

@media (max-width: 720px) {
  .block-header {
    grid-template-columns: 1fr; /* stack icon, title, description */
    gap: 0.75rem;
  }
  .block-icon {
    width: 64px;
    height: 64px;
    padding: 0.2rem; /* reduce inner padding on small screens */
    border: 10px solid var(--block-color); /* slightly thinner border */
  }
  .block-icon img {
    width: 28px; /* scale inner icon down proportionally */
    height: 28px;
  }
  .block-title {
    font-size: 1.05rem;
  }
  .block-description {
    max-width: 100%;
  }
}

.connection-hints {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  background: var(--block-color);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

.building-block:hover .connection-hints {
  opacity: 1;
  transform: scale(1);
  animation: ripple 2s infinite;
}

@keyframes ripple {
  0% {
    box-shadow: 0 0 0 0 var(--block-color);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(0, 0, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  }
}

.block-expand {
  background: linear-gradient(
    135deg,
    var(--block-color),
    color-mix(in srgb, var(--block-color) 80%, white)
  );
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.block-expand::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: translateY(-50%);
  transition: left 0.5s ease;
}

.block-expand:hover::before {
  left: 100%;
}

.block-expand:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.block-details {
  /* collapsed by default; only .expanded should reveal content */
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease,
    margin 0.3s ease;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--block-color) 5%, white),
    transparent
  );
  border-radius: 8px;
  margin-top: 0;
  padding: 0; /* ensure no accidental space when collapsed */
}

.block-details.expanded {
  /* expanded state: allow large height; use a high max-height for animation */
  max-height: 1200px;
  margin-top: 1.5rem;
  padding: 1.5rem;
}

/* Mobile fix: keep collapsed by default on narrow viewports; allow .expanded to show fully */
@media (max-width: 460px) {
  .block-details {
    /* keep collapsed state enforced on mobile to prevent automatic opening */
    max-height: 0 !important;
    padding: 0 !important;
  }
  .block-details.expanded {
    /* expanded content should be fully visible on mobile */
    max-height: 2000px !important; /* large enough to show content */
    margin-top: 1rem;
    padding: 1rem;
  }
}

.block-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-block {
  position: relative;
  padding: 0.75rem 0.75rem 0.75rem 3rem; /* a bit more left space for the check */
  margin-bottom: 0.75rem;
  background: white;
  border-left: 4px solid var(--block-color);
  border-radius: 0 8px 8px 0;
  color: #4b5563;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.feature-block:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-block::before {
  content: "✓";
  position: absolute;
  left: 0.75rem;
  top: 0.5rem;
  color: var(--block-color);
  font-size: 0.9rem;
  background: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-weight: 700;
}

/* Connection lines between related blocks */
.blocks-grid::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
  z-index: -1;
  pointer-events: none;
}

/* Staggered entrance animation */
.building-block {
  opacity: 0;
  transform: translateY(40px) rotateX(-10deg);
  animation: blockSlideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.building-block:nth-child(1) {
  animation-delay: 0.1s;
}
.building-block:nth-child(2) {
  animation-delay: 0.25s;
}
.building-block:nth-child(3) {
  animation-delay: 0.4s;
}
.building-block:nth-child(4) {
  animation-delay: 0.55s;
}
.building-block:nth-child(5) {
  animation-delay: 0.7s;
}
.building-block:nth-child(6) {
  animation-delay: 0.85s;
}
.building-block:nth-child(7) {
  animation-delay: 0.85s;
}
.building-block:nth-child(8) {
  animation-delay: 0.85s;
}

@keyframes blockSlideIn {
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

.combination-hint {
  text-align: center;
  margin-top: 3rem;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  color: #6b7280;
}

.combination-hint h3 {
  color: #374151;
  margin-bottom: 1rem;
}

/* Shared layout for blocks + CTA used on leistungen pages */
.blocks-and-cta {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}
.blocks-grid {
  flex: 1 1 0;
}
.blocks-cta {
  width: 320px;
  flex: 0 0 320px;
}
.sticky-cta {
  position: sticky;
  top: calc(var(--header-height) + 32px);
}
@media (max-width: 900px) {
  .blocks-and-cta {
    flex-direction: column;
  }
  .blocks-cta {
    width: 100%;
  }
  .sticky-cta {
    position: static;
    top: auto;
  }
}
