/**
 * @file
 * MLT Modern — Page layout (container + sidebar grid).
 *
 * Wraps the main content area + optional sidebars in a centred 1200px
 * container. Uses CSS Grid with template columns driven by classes the
 * page.html.twig template adds based on which sidebar regions have blocks.
 *
 *   .mlt-layout                     → no sidebars, main is 100%
 *   .mlt-layout--has-left           → left + main
 *   .mlt-layout--has-right          → main + right
 *   .mlt-layout--has-left.has-right → left + main + right
 *
 * Landing pages skip this whole layout — they use page--node--mlt-landing-
 * page.html.twig which renders the node body raw without this wrapper.
 *
 * Mobile (<992px): everything stacks to a single column regardless of
 * how many sidebars are present.
 */

.mlt-layout {
  max-width: var(--mlt-container-max);
  margin: 0 auto;
  padding: 40px var(--mlt-container-pad);
  display: grid;
  gap: 32px;
  align-items: start;

  /* Default (no sidebars): single column, main takes full width. */
  grid-template-columns: 1fr;
}

/* Left sidebar only: left | main */
.mlt-layout--has-left:not(.mlt-layout--has-right) {
  grid-template-columns: 300px 1fr;
}

/* Right sidebar only: main | right */
.mlt-layout--has-right:not(.mlt-layout--has-left) {
  grid-template-columns: 1fr 300px;
}

/* Both sidebars: left | main | right */
.mlt-layout--has-left.mlt-layout--has-right {
  grid-template-columns: 280px 1fr 280px;
}

/* Sidebar regions — visual treatment. Light card-ish look so they're
 * obviously distinct from the main content without being heavy. */
.mlt-region--sidebar-first,
.mlt-region--sidebar-second {
  /* Sidebar blocks sit in their own column. The whole region doesn't
   * need a background — let the individual blocks style themselves. */
}

/* Sidebar blocks get a default soft card treatment if they don't have
 * their own styling already. Override per-block as needed. */
.mlt-region--sidebar-first > div > div,
.mlt-region--sidebar-second > div > div {
  /* Don't apply to nested everything - just to top-level block wrappers. */
}

/* Mobile: collapse to single column, sidebars below main. */
@media (max-width: 991px) {
  .mlt-layout,
  .mlt-layout--has-left,
  .mlt-layout--has-right,
  .mlt-layout--has-left.mlt-layout--has-right {
    grid-template-columns: 1fr;
    padding: 24px var(--mlt-container-pad);
    gap: 24px;
  }

  /* On mobile, force sidebars to appear AFTER main content regardless
   * of source order. The .mlt-region--content gets order: 1, sidebars
   * get order: 2. */
  .mlt-region--content {
    order: 1;
  }
  .mlt-region--sidebar-first,
  .mlt-region--sidebar-second {
    order: 2;
  }
}
