.site-header,
.site-footer,
main {
  /*
    width: min(100% - 32px, var(--container))
    화면이 넓을 때는 최대 1160px까지만 커지고,
    화면이 좁을 때는 좌우 16px씩 여백을 남기도록 만든 계산식입니다.
  */
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}

.site-header {
  /*
    sticky는 스크롤할 때 헤더가 위쪽에 붙어 있게 합니다.
    다만 모바일에서는 공간이 부족하므로 아래 @media에서 static으로 바꿉니다.
  */
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(223, 230, 227, 0.86);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(31, 49, 43, 0.08);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  width: 38px;
  height: 38px;
  object-fit: contain;
  padding: 4px;
  /* 모든 페이지의 브랜드 아이콘은 흰 배경만 남기고 테두리/그림자는 보이지 않게 합니다. */
  background: #ffffff;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  outline: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--color-muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--color-ink);
}

.header-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 14px;
  color: #ffffff;
  background: var(--color-primary-dark);
  border-radius: 8px;
  font-weight: 800;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 34px 0 48px;
  color: var(--color-muted);
  font-size: 0.92rem;
}

.site-footer div {
  display: flex;
  gap: 16px;
  font-weight: 700;
}

@media (max-width: 820px) {
  /*
    화면 폭이 820px 이하가 되면 적용되는 모바일/태블릿용 규칙입니다.
    이것이 모바일에서 다른 형태로 보이는 핵심 원리입니다.
  */
  .site-header {
    /* 모바일에서는 sticky 헤더가 화면을 많이 차지할 수 있어 일반 배치로 바꿉니다. */
    position: static;
    /* flex-wrap을 켜면 메뉴가 한 줄에 안 들어갈 때 다음 줄로 내려갑니다. */
    flex-wrap: wrap;
  }

  .site-nav {
    /*
      order: 3은 메뉴를 브랜드와 버튼 아래쪽 줄로 보내기 위한 설정입니다.
      width: 100%로 한 줄 전체를 쓰게 만들어 작은 화면에서도 눌리기 쉽게 합니다.
    */
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 10px;
    overflow-x: auto;
    padding-top: 4px;
  }

  .header-action {
    margin-left: auto;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
