/* ===== 헤더 ===== */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 100;
  height: var(--header-h);
  padding: 20px 20px 0;
  transition: background 0.35s, box-shadow 0.35s, padding 0.35s;
}
.header-inner {
  position: relative; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  color: var(--white);
  transition: color 0.35s;
}
.header-nav { display: flex; gap: 28px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
.header-nav a { position: relative; padding: 6px 0; }
.header-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--yellow); transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.header-nav a:hover::after { transform: scaleX(1); }

.brand { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; }
/* 로고 전환: 아이콘이 가운데로 접히고, 글자 로고가 가운데에서 펼쳐짐 */
.brand-mark {
  width: 52px; height: 52px; filter: brightness(0) invert(1);
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.7s var(--ease), opacity 0.7s var(--ease);
}
.brand-word {
  position: absolute; white-space: nowrap;
  font-size: 34px; font-weight: 900; letter-spacing: -0.04em; color: var(--green-800);
  opacity: 0; clip-path: inset(0 50% 0 50%);
  transition: clip-path 0.7s var(--ease), opacity 0.5s var(--ease);
}

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; transition: background 0.2s; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.15); }
.icon-btn svg { width: 22px; height: 22px; }
.cart-count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--orange); color: var(--white);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.shop-btn { margin-left: 8px; }

/* 스크롤 후 상태 — 히어로가 없는 페이지(<body class="is-plain">)는 처음부터 이 상태 */
.site-header.is-scrolled,
.is-plain .site-header { background: rgba(255, 255, 255, 0.97); box-shadow: 0 1px 0 var(--line); padding: 0; }
.site-header.is-scrolled .header-inner,
.is-plain .site-header .header-inner { color: var(--green-800); max-width: calc(var(--container) + 40px); margin: 0 auto; }
.site-header.is-scrolled .brand-mark,
.is-plain .site-header .brand-mark { opacity: 0; clip-path: inset(0 50% 0 50%); }
.site-header.is-scrolled .brand-word,
.is-plain .site-header .brand-word {
  opacity: 1; clip-path: inset(0 0 0 0);
  transition-delay: 0.4s;
}
.is-plain .site-header .brand-word { transition-delay: 0s; }
.site-header.is-scrolled .icon-btn:hover,
.is-plain .site-header .icon-btn:hover { background: var(--gray-50); }

/* ===== 드로어 메뉴 ===== */
body.no-scroll { overflow: hidden; }

@media (max-width: 980px) {
  .header-nav, .shop-btn { display: none; }
  .header-inner { padding: 0 16px; }
  .brand { left: 24px; transform: translateY(-50%); }
  .brand-word { left: 0; font-size: 28px; }
  /* 숨긴 로고 마크와 같은 칸에 겹쳐 세로 가운데 정렬 (아래로 밀려 헤더를 넘던 문제) */
  .site-header.is-scrolled .brand-word,
  .is-plain .site-header .brand-word,
  .site-header.is-scrolled .brand-mark,
  .is-plain .site-header .brand-mark { grid-area: 1 / 1; }
  .site-header.is-scrolled .brand-word,
  .is-plain .site-header .brand-word { position: static; }
}
@media (max-width: 640px) {
  .site-header { padding: 12px 12px 0; }
  .icon-btn:not(.cart-btn) { display: none; }
  .brand-mark { width: 42px; height: 42px; }
}

/* ===== 헤더 검색 (검색 아이콘을 누르면 헤더 아래에 열림, 제출하면 /shop?q=) ===== */
.site-search {
  position: absolute; left: 0; right: 0; top: 100%;
  padding: 14px var(--gutter); background: var(--white);
  box-shadow: 0 12px 30px rgba(32, 78, 74, 0.12); border-top: 1px solid var(--line);
}
.site-search[hidden] { display: none; }
.site-search__form { display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 0 auto; }
.site-search__input {
  flex: 1; min-width: 0; height: 48px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--gray-50); color: var(--ink); font-size: 15px;
}
.site-search__input:focus { outline: none; border-color: var(--green-800); background: var(--white); }
.site-search .icon-btn { color: var(--green-800); }
.site-search .icon-btn:hover { background: var(--gray-50); }
.site-search__close { transform: rotate(45deg); }
@media (max-width: 640px) {
  .site-search { padding: 12px 16px; }
  .site-search .btn-sm { padding: 0 18px; }
}
