/* 역할: 화면 배치: 본문 너비, 상단 앱바, 햄버거 메뉴와 모바일 화면을 정합니다. 앱바 색은 .app-bar, 메뉴 너비는 .account-drawer에서 수정합니다. */

/* 화면 전체와 본문 */
body {
  max-width: none;
  margin: 0;
  padding: 0;
}

body > main {
  box-sizing: border-box;
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* 상단 앱바 */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgb(58, 36, 36);
  border-bottom: 1px solid #e5e7eb;
}

.app-bar-inner {
  box-sizing: border-box;
  max-width: 940px;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-brand {
  color: #171717;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -1px;
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-write {
  padding: 7px 14px;
  border-radius: 10px;
  background: #0071e3;
  color: #fff;
  font-size: 14px;
}

.app-menu-button,
.drawer-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  color: #222;
  font-size: 24px;
}

.app-menu-button:hover,
.drawer-close:hover {
  background: #f1f3f5;
}

/* 오른쪽 메뉴 패널 */
.account-drawer {
  box-sizing: border-box;
  position: fixed;
  inset: 0 0 0 auto;
  width: min(340px, 90vw);
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 24px 20px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  border: 0;
  background: #fff;
  color: #222;
  overflow-y: auto;
}

.account-drawer::backdrop {
  background: rgb(0 0 0 / 40%);
}

html:has(.account-drawer[open]) {
  overflow: hidden;
}

.drawer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.drawer-heading h2 {
  margin: 0;
}

.drawer-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid #eee;
}

.drawer-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  height: 48px;
  border-radius: 50%;
  background: #e8f2ff;
  color: #0063c7;
  font-weight: 700;
}

.drawer-user {
  min-width: 0;
}

.drawer-user strong,
.drawer-user small {
  display: block;
  overflow-wrap: anywhere;
}

.drawer-profile p {
  margin: 8px 0 0;
}

.drawer-links {
  display: grid;
  gap: 6px;
  padding: 20px 0;
}

.drawer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 4px 12px;
  border-radius: 10px;
  color: #222;
}

.drawer-link:hover {
  background: #f4f6f8;
  text-decoration: none;
}

.drawer-badge {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 20px;
  background: #e8f2ff;
  color: #0063c7;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.drawer-footer {
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.drawer-logout {
  width: 100%;
  border-radius: 10px;
  background: #f4f6f8;
  color: #444;
}

.app-brand:hover,
.app-write:hover {
  text-decoration: none;
}

.app-menu-button:focus-visible,
.drawer-close:focus-visible,
.drawer-link:focus-visible,
.app-brand:focus-visible,
.app-write:focus-visible {
  outline: 3px solid #0071e3;
  outline-offset: 3px;
}

/* 고정 앱바가 이동한 댓글을 가리지 않도록 */
[id^="comment-"] {
  scroll-margin-top: 88px;
}

@media (max-width: 600px) {
  body > main {
    padding: 20px 16px 40px;
  }

  .app-bar-inner {
    padding: 0 16px;
  }
}


/* 메뉴 상단의 사진·닉네임을 누르면 내 프로필로 이동 */
.drawer-profile-link {
  color: inherit;
  border-radius: 8px;
}

.drawer-profile-link:hover {
  background: #f4f6f8;
  text-decoration: none;
}

.drawer-profile-link:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 4px;
}

.drawer-profile-link .user-avatar {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  font-size: 20px;
}

/* 로그아웃 아래 작은 운영 안내 링크 */
.drawer-policy-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  padding: 14px 4px 6px;
}

.drawer-policy-links a {
  padding: 3px 0;
  color: #687080;
  font-size: 11px;
  line-height: 1.6;
  text-decoration: none;
}

.drawer-policy-links a:hover {
  text-decoration: underline;
}

.drawer-policy-links a:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 3px;
}

