<script setup>
const { menuOpen } = useMenuState()
</script>

<template>
  <div class="site-shell public-layout">
    <SiteHeader class="shrink-0" />
    <div
      class="public-layout__grid mx-auto grid w-full max-w-[1294px] flex-1 grid-cols-1 bg-[var(--site-bg)] px-4 transition-[grid-template-columns,max-width] duration-300 ease-out lg:grid lg:min-h-0 lg:h-[calc(100vh-57px)] lg:max-h-[calc(100vh-57px)] lg:flex-none lg:overflow-hidden lg:px-0 lg:[grid-template-columns:287px_minmax(0,720px)_287px] lg:[grid-template-rows:minmax(0,1fr)]"
      :class="menuOpen ? '' : 'max-w-[1007px] lg:[grid-template-columns:0_minmax(0,720px)_287px]'"
    >
      <LeftSidebar :menu-open="menuOpen" />
      <main
        class="site-main min-h-0 w-full overflow-x-hidden lg:h-full lg:max-h-full lg:overflow-y-auto lg:overscroll-y-contain lg:w-[720px]"
        :class="{ 'site-main--menu-closed': !menuOpen }"
      >
        <slot />
      </main>
      <RightSidebar />
    </div>
  </div>
</template>
