/* =============================================
   Column Layout — ACE Design System
   Responsive grid container for SDC components
   ============================================= */

.column-layout {
  display: grid;
  width: 100%;
  min-width: 0;
}

/* --- Gap variants --- */
.column-layout--gap-small {
  gap: 1rem;
}

.column-layout--gap-medium {
  gap: 2rem;
}

.column-layout--gap-large {
  gap: 3rem;
}

/* --- Column variants (desktop) --- */
.column-layout--2-cols {
  grid-template-columns: repeat(2, 1fr);
}

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

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

/* --- Alignment --- */
.column-layout--align-start {
  align-items: start;
}

.column-layout--align-center {
  align-items: center;
}

.column-layout--align-end {
  align-items: end;
}

.column-layout--align-stretch {
  align-items: stretch;
}

/* =============================================
   Responsive — Tablet
   ============================================= */

@media (max-width: 1023px) {
  .column-layout--4-cols {
    grid-template-columns: repeat(2, 1fr);
  }

  .column-layout--3-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =============================================
   Responsive — Mobile
   ============================================= */

@media (max-width: 767px) {
  /* Default: stack vertically on mobile */
  .column-layout--2-cols:not(.column-layout--scroll-mobile),
  .column-layout--3-cols:not(.column-layout--scroll-mobile),
  .column-layout--4-cols:not(.column-layout--scroll-mobile) {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Horizontal scroll with peek of next card */
  .column-layout--scroll-mobile {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
    margin-right: -1.25rem; /* Peek effect: overflow into padding */
  }

  .column-layout--scroll-mobile::-webkit-scrollbar {
    display: none;
  }

  /* Target direct children AND Canvas wrappers */
  .column-layout--scroll-mobile > *,
  .column-layout--scroll-mobile > [class*="canvas"] {
    flex: 0 0 auto;
    min-width: 85%;
    max-width: 85%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  /* Ensure children don't break flex layout */
  .column-layout--scroll-mobile > * > * {
    width: 100%;
  }
}
