.page-section.freestyle {
  display: flex;
  flex-direction: column;
  gap: 2rem; /* Space between different layout rows */
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  text-align: var(--text-align , center);
  min-height: var(--min-section-heigth);
  justify-content: center;
  margin-top: 1.5rem;
}

.freestyle-blocks p {
  font-family: Iter, sans-serif;
}

.freestyle-blocks h1, h2, h3, h4, h5, h6 {
  font-family: Libre Baskerville, serif;
}

.freestyle-blocks h1 {
  font-size: clamp(3rem, 8vw, 4rem);
}

.freestyle-blocks h2 {
  font-size: clamp(2rem, 8vw, 3rem);
}

.freestyle-blocks h3 {
  font-size: clamp(1rem, 8vw, 2rem);
}

.freestyle-blocks h4 {
  font-size: clamp(0.25rem, 8vw, 1.25rem);
}

.freestyle-blocks h5, h6 {
  font-size: clamp(0.1rem, 8vw, 1rem);
}

.freestyle-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr); /* 12 equal fractions */
  gap: 1.5rem; /* The gutter between columns */
  align-items: start;
}

.freestyle-column {
  /* This tells the div to span the number of columns defined in the Panel */
  grid-column: span var(--span);
}


.freestyle-blocks iframe {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  display: block;
}


.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
  grid-auto-rows: 12.5rem;
  grid-auto-flow: dense;
  gap: 0.75rem;
}

.gallery figure {
  container: figure / inline-size;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  position: relative;
  box-shadow: rgba(0, 0, 0, 0.8) 0 0 6px;
}

@media (max-width: 768px) {
  .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    grid-auto-rows: 12.5rem;
    grid-auto-flow: dense;
    gap: 0.75rem;
  }

}

.gallery figure a {
  grid-area: 1 / 1 / -1 / -1;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

.gallery figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s ease-in-out, filter 0.6s ease;
}

/* Make the first image a large 2x2 hero */
.gallery figure:nth-child(1) {
  grid-area: span 2 / span 2;
}

/* Every 5th-ish image becomes tall */
.gallery figure:nth-child(4n + 1) {
  grid-row: span 2;
}

/* Every 6th-ish image becomes wide */
.gallery figure:nth-child(4n + 2) {
  grid-column: span 2;
}


.freestyle-blocks > * + * {
  margin-top: 0.25rem;
}

/* Responsive: Stack columns on small screens */
@media (max-width: 768px) {
  .freestyle-grid {
    grid-template-columns: 1fr; /* Switch to a single column */
  }

  .freestyle-column {
    grid-column: span 1; /* Ignore the span and take full width */
  }
}
