/* ====================<外壳>==================== */

/* 四大区域玻璃化 */
.header,
.sidebar,
.footer,
.main {
  background-color: rgba(var(--glass-r), var(--glass-g), var(--glass-b), var(--glass-opacity));
  backdrop-filter: blur(20px) saturate(180%);
}

.header {
  width: 100%;
  height: 64px;

  /* 抬起层级：header 与 main 都因 backdrop-filter 形成层叠上下文，
     不加 z-index 时后出现的 main 会盖住语言菜单等浮层 */
  position: relative;
  z-index: 10;

  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: row;
  gap: var(--space-md);

  padding: var(--space-sm);
  border: var(--border-width) solid color-mix(in srgb, var(--g-color) 15%, transparent);
}

.center {
  width: 100%;
  height: auto;

  display: flex;
  flex-direction: row;
}

.sidebar {
  width: 15%;
  max-height: 600px;
  overflow-y: auto;

  display: flex;
  justify-content: start;
  align-items: center;
  flex-direction: column;
  gap: var(--space-lg);

  border: var(--border-width) solid color-mix(in srgb, var(--g-color) 15%, transparent);
}

.main {
  width: 85%;
  max-height: 600px;
  overflow-y: auto;

  display: flex;
  flex-direction: column;
  gap: var(--space-sm);

  padding: var(--space-md);
  background-color: rgba(
    var(--glass-r),
    var(--glass-g),
    var(--glass-b),
    var(--glass-opacity)
  );
  border: var(--border-width) solid color-mix(in srgb, var(--g-text) 10%, transparent);
}

.footer {
  width: 100%;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--space-md);

  padding: var(--space-md);
}

/* 抽屉遮罩：桌面恒隐藏，手机端点菜单按钮给 .sidebar 挂 .sidebar-open 后显示 */
.sidebar-overlay {
  display: none;
}

/* ====================<响应式>==================== */

@media (max-width: 768px) {
  /* [响应式-sm] 手机：侧栏改为左侧抽屉（脱离文档流），主内容占满宽度 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100dvh;
    max-height: none;
    margin: 0;

    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 9999;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  /* 遮罩默认 display:none，打开抽屉时显示 */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.45);
  }

  .sidebar.sidebar-open + .sidebar-overlay {
    display: block;
  }

  .main {
    width: 100%;
    max-height: none;
    overflow-y: visible;
  }
}
