/**
 * [한글 주석] 모바일 및 태블릿 대응을 위한 반응형 스타일 시트입니다.
 * 위치: /theme/assets/css/responsive.css
 */
/**
 * 기능: 태블릿/모바일 해상도에 맞춘 반응형 레이아웃과 햄버거 메뉴를 정의합니다.
 * 위치: /theme/assets/css/responsive.css
 */

/* ── 햄버거 버튼 (데스크톱에서 숨김) ──────────────────────────────── */
.zyss-theme__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 6px;
  background: none;
  border: 1px solid var(--zyss-color-border);
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.zyss-theme__hamburger-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--zyss-color-text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.zyss-theme__hamburger[aria-expanded="true"] .zyss-theme__hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.zyss-theme__hamburger[aria-expanded="true"] .zyss-theme__hamburger-bar:nth-child(2) {
  opacity: 0;
}
.zyss-theme__hamburger[aria-expanded="true"] .zyss-theme__hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── 1080px 이하: 사이드바 단독 열 ───────────────────────────────── */
@media (max-width: 1080px) {
  .zyss-theme__header-inner {
    padding-right: 206px;
  }

  .zyss-theme__layout {
    grid-template-columns: 1fr;
  }

  .zyss-theme__layout-sidebar {
    position: static;
  }

  .zyss-theme__content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .zyss-theme__content-grid--cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .zyss-theme__content-grid--recent-rich {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── 900px 이하: 햄버거 메뉴 표시, 상단 메뉴 드롭다운 ──────────── */
@media (max-width: 900px) {
  body.zyss-theme-mobile-nav-open {
    overflow: hidden;
  }

  .zyss-theme__widget--stats,
  .zyss-theme__widget--board-menu,
  .zyss-theme__widget--member-menu,
  .zyss-theme__widget--main-nav {
    display: none !important;
  }

  .zyss-theme__header-inner {
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 12px;
    padding-right: 16px;
  }

  .zyss-theme__utility-top {
    display: none !important;
  }

  .zyss-theme__hamburger {
    display: flex;
  }

  .zyss-theme__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--zyss-color-surface-strong);
    border-top: 1px solid var(--zyss-color-border);
    border-bottom: 1px solid var(--zyss-color-border);
    box-shadow: 0 8px 24px rgba(26, 39, 73, 0.10);
  }

  .zyss-theme__nav.is-open {
    display: block;
    max-height: 80vh;   /* 메뉴가 길어도 화면 밖으로 나가지 않도록 제한 */
    overflow-y: auto;
  }

  .zyss-theme__nav-list {
    flex-direction: column;
    gap: 0;
    padding: 12px 16px;
    align-items: stretch;
  }

  .zyss-theme__nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 12px;
  }

  .zyss-theme__nav-submenu {
    position: static;
    display: grid;
    min-width: 0;
    margin-top: 0;
    padding: 0 0 0 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    gap: 6px;
  }

  .zyss-theme__nav-submenu--depth-3 {
    left: auto;
  }

  .zyss-theme__header {
    position: sticky;
    top: 0;
  }

  .zyss-theme__page-topbar-inner {
    align-items: flex-start;
    gap: 14px;
  }

  .zyss-theme__page-topbar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .zyss-theme__page-topbar-toggle,
  .zyss-theme__page-topbar-home {
    width: 40px;
    height: 40px;
  }

  /* [한글 주석] 모바일 메뉴는 부모 메뉴 터치 시 하위 메뉴가 펼쳐지는 아코디언으로 고정합니다. */
  .zyss-theme__nav-item--has-children > .zyss-theme__nav-submenu {
    max-height: 0 !important;
    margin-top: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-4px);
    transition: max-height 0.24s ease, opacity 0.18s ease, transform 0.18s ease, margin-top 0.18s ease;
  }

  .zyss-theme__nav-item--has-children.is-expanded > .zyss-theme__nav-submenu {
    max-height: 70vh !important;
    margin-top: 6px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0);
  }

  .zyss-theme__nav-item--has-children.is-expanded > .zyss-theme__nav-link .zyss-theme__nav-caret {
    transform: rotate(180deg);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  /* [한글 주석] 블로그 댓글을 게시판 댓글과 같은 모바일 흐름으로 정리합니다. */
  .zyss-theme__comments-card .zyss-board__comment-guest-fields {
    grid-template-columns: 1fr;
  }

  .zyss-theme__comments-card .zyss-theme__comment-article {
    flex-direction: column;
    gap: 12px;
  }

  .zyss-theme__comments-card .zyss-board__comment-item--reply {
    margin-left: 18px;
  }
}

/* ── 768px 이하: 본문 패딩/폰트 조정 ─────────────────────────────── */
@media (max-width: 768px) {
  .zyss-theme__main {
    width: min(calc(100% - 20px), var(--zyss-content-width));
    padding-top: 24px;
    padding-bottom: 60px;
  }

  .zyss-theme__content-grid {
    grid-template-columns: 1fr;
  }

  .zyss-theme__content-grid--cols-2,
  .zyss-theme__content-grid--cols-3,
  .zyss-theme__content-grid--recent-rich {
    grid-template-columns: 1fr;
  }

  .zyss-theme__utility-top {
    top: 12px;
    right: 12px;
  }

  .zyss-theme__utility-bottom {
    bottom: 12px;
    right: 12px;
  }

  .zyss-theme__font-controls {
    max-width: 220px;
  }

  .zyss-theme__comments-card {
    padding: 20px;
  }

  .zyss-theme__comment-fields {
    grid-template-columns: 1fr;
  }

  .zyss-theme__comment-form textarea {
    min-height: 150px;
  }
}

/* ── 480px 이하: 소형 모바일 ──────────────────────────────────────── */
@media (max-width: 480px) {
  .zyss-theme__utility-button,
  .zyss-theme__font-status {
    padding: 8px 10px;
    font-size: 0.90rem;
  }

  .zyss-theme__single,
  .zyss-theme__card-body,
  .zyss-theme__widget {
    padding: 16px;
  }

  .zyss-theme__site-description {
    display: none;
  }
}
