/* 172차: 메뉴 시험 화면 — React 'Morphing Island Navbar'(framer-motion)를 CSS 로.
   hover-pill(layoutId) = .island-pill 하나가 탭 사이를 미끄러짐, dropdown-surface = .island-panel 이 크기를 바꾸며 내용만 갈아 끼움.
   스프링 느낌은 --island-spring(살짝 넘쳤다 돌아옴). 색은 사이트 토큰만 (라이트 · 다크 둘 다)
   174차: 원래 상단바 자리에 — 로고 왼쪽 · 섬 가운데 · 언어 · 프로필 오른쪽 (.island-topbar), 방문자 수는 푸터 */
.island-topbar {
  --island-spring: cubic-bezier(.32, 1.28, .5, 1);
  --island-glass: color-mix(in srgb, #ffffff 92%, transparent);  /* 176차(사용자): 라이트는 흰색 (크림 --surface 대신) */
  --island-panel: color-mix(in srgb, #ffffff 97%, transparent);
  --island-line: color-mix(in srgb, var(--border) 85%, transparent);
  --island-hover: color-mix(in srgb, var(--text) 8%, transparent);
  position: fixed;  /* 174차(5): 모든 화면에서 섬만 떠 있음 (배경 띠 없음) */
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  padding: 12px var(--shell-gutter) 16px;
  pointer-events: none;
}
html[data-theme="dark"] .island-topbar {
  --island-glass: color-mix(in srgb, var(--surface) 82%, transparent);
  --island-panel: color-mix(in srgb, var(--surface) 96%, transparent);
}
.island-topbar .island-stage { width: auto; max-width: 100%; }  /* 174차(3): 섬은 내용만큼만 (꽉 채우면 너무 길어짐) */

.island-topbar .island-stage { pointer-events: auto; }
/* 174차(4, 사용자: '히어로는 경계 없이 위에도 덮게'): 홈은 히어로가 화면 맨 위부터 — 히어로 안쪽 위 여백만 섬 높이만큼 더 */

/* 174차(5, 사용자: '일반 메뉴들은 처음 들어왔을 때 글자가 메뉴에 안 가리게'): 히어로가 없는 화면은 섬 높이만큼 위 여백 (높이는 island-nav.js 가 --island-h) */
/* 174차(6, 사용자: '모바일은 지금 방식, 데스크톱은 섬 메뉴') · 174차(9, '태블릿에서도 안 깨지게'): 768px 이상(태블릿 · 데스크톱) = 섬 메뉴(원래 상단바는 숨기고 서브탭은 그것을 씀), 그보다 좁으면(휴대폰) 원래 상단바 */
@media (min-width: 768px) {
  .topbar { display: none !important; }
  body:has(.island-topbar:not(.is-overlay)) { padding-top: var(--island-h, 84px); }
  body:has(.island-topbar.is-overlay) .hero { padding-top: calc(88px + var(--island-h, 76px)); }
}
@media (max-width: 767.98px) {
  .island-topbar, .site-footer .visit-counter.footer-visits { display: none !important; }
}

/* 174차(2): 섬 하나 = 로고 | 메뉴 | 언어 · 프로필 사진 */
.island-logo { display: inline-flex; align-items: center; flex: none; padding: 0 10px 0 12px; }
.island-logo .brand-logo { height: 22px; width: auto; transform: translateY(-3px); }  /* 191차(사용자): 아주 살짝 위로 · 192차: 2px 더 */
.island-logo.brand-link:hover .brand-logo { transform: translateY(-4px) rotate(-2deg); }  /* 마우스를 올려도 그 자리에서 살짝만 */
.island-actions { display: flex; align-items: center; gap: 6px; flex: none; padding-left: 6px; border-left: 1px solid var(--island-line); }
.island-actions .lang-switch summary { width: 32px; height: 32px; border-width: 1px; }
/* 174차(8): 전적 검색 돋보기 → 섬 아래 입력칸 */
.island-search { position: relative; }
.island-search summary {
  display: grid; place-items: center; width: 32px; height: 32px; list-style: none; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--island-line); color: var(--text-2); transition: color .15s ease, border-color .15s ease;
}
.island-search summary::-webkit-details-marker { display: none; }
.island-search summary:hover, .island-search[open] summary { color: var(--text); border-color: var(--poke-yellow); }
.island-search-panel {
  position: absolute; right: -6px; top: calc(100% + 14px); z-index: 56;
  display: flex; align-items: center; gap: 6px; width: 320px; margin: 0; padding: 6px 6px 6px 14px;
  border: 1px solid var(--island-line); border-radius: 999px;
  background: var(--surface); box-shadow: 0 16px 40px rgb(0 0 0 / .14);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.island-search-panel input[type=search] { flex: 1; min-width: 0; height: 34px; padding: 0 !important; border: 0 !important; border-radius: 0; background: none !important; box-shadow: none !important; color: var(--text); font: 600 13.5px var(--font-body); outline: none; appearance: none; -webkit-appearance: none; }
.island-search-panel input[type=search]:focus, .island-search-panel input[type=search]:focus-visible { border: 0 !important; box-shadow: none !important; outline: none !important; }  /* 사이트 공용 입력칸 테두리 · 초점 링은 섬 칸 바깥(focus-within)에만 */
.island-search-panel:focus-within { border-color: var(--poke-yellow); }
.island-search-panel input::placeholder { color: var(--text-3); }
.island-search-panel button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 999px; cursor: pointer; background: var(--accent); color: var(--accent-text); }
.island-actions .lang-flag { width: 20px; height: 20px; }
.island-actions .user-menu summary { padding: 2px; gap: 0; border: 1px solid var(--island-line); font-size: 0; }  /* 사진만 (이름 · 권한 뱃지는 팝업 안에) */
.island-actions .user-menu summary .admin-badge { display: none; }
.island-actions .user-dot { width: 32px; height: 32px; }
.island-actions .topbar-login { padding: 6px 12px; border: 0; border-radius: 999px; box-shadow: none; font-size: 13px; font-weight: 700; color: var(--text); }
.island-actions .topbar-login:hover { background: var(--island-hover); text-decoration: none; }
.island-actions .btn-sm { padding: 6px 12px; border-radius: 999px; font-size: 12.5px; }

/* 푸터로 내린 방문자 수 (site.css 는 좁은 화면에서 숨김 — 푸터에선 늘 보임) */
.site-footer .visit-counter.footer-visits { display: flex; flex-wrap: wrap; margin: 12px 0 10px; }

.island-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}

/* 떠 있는 섬(메뉴 막대) */
.island-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--island-line);
  background: var(--island-glass);
  box-shadow: 0 8px 30px rgb(0 0 0 / .05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.island-tabs {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.island-tabs::-webkit-scrollbar { display: none; }
html[data-theme="dark"] .island-bar { box-shadow: 0 8px 32px rgb(0 0 0 / .4); }

/* 탭 사이를 미끄러지는 알약 (framer-motion layoutId="hover-pill") */
.island-pill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--island-hover);
  opacity: 0;
  pointer-events: none;
  transition: transform .42s var(--island-spring), width .42s var(--island-spring), opacity .18s ease;
}
.island-pill.is-on { opacity: 1; }

.island-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease;
}
.island-tab:hover, .island-tab.is-hover, .island-tab.is-open { color: var(--text); text-decoration: none; }
.island-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.island-chev { color: var(--text-3); transition: transform .25s var(--island-spring), color .2s ease; }
.island-tab.is-open .island-chev { transform: rotate(180deg); color: var(--text); }

/* 모양이 바뀌는 판 (dropdown-surface) */
.island-panel {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  z-index: 50;
  width: 370px;
  height: 0;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--island-line);
  background: var(--island-panel);
  box-shadow: 0 24px 50px -12px rgb(0 0 0 / .12), 0 0 0 1px rgb(0 0 0 / .03);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  transform: translate(-50%, 10px) scale(.98);
  transform-origin: 50% 0;
  pointer-events: none;
  transition:
    width .45s var(--island-spring), height .45s var(--island-spring),
    opacity .2s ease, transform .4s var(--island-spring);
}
html[data-theme="dark"] .island-panel { box-shadow: 0 30px 70px -15px rgb(0 0 0 / .8), 0 0 0 1px rgb(255 255 255 / .04); }
.island-panel.is-open { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }

/* 판 안의 내용 — 메뉴마다 한 장, 겹쳐 두고 지금 것만 보임 (크기는 JS 가 판에 옮김) */
.island-sheet {
  position: absolute;
  top: 0;
  left: 0;
  width: min(370px, calc(100vw - 32px));
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .3s var(--island-spring), visibility 0s linear .18s;
}
.island-sheet.is-cols2 { width: min(600px, calc(100vw - 32px)); }
.island-sheet.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: .05s, .05s, 0s; }

.island-sheet-head { padding: 16px 26px 4px; }
.island-eyebrow {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--text-3);
}
.island-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-2); }

.island-items { display: grid; gap: 2px; padding: 8px 14px 14px; }
.island-sheet.is-cols2 .island-items { grid-template-columns: 1fr 1fr; }

.island-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
  transition: background-color .15s ease;
}
.island-item:hover, .island-item:focus-visible { background: var(--island-hover); text-decoration: none; outline: none; }
.island-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  margin-top: 1px;
  border-radius: 12px;
  border: 1px solid var(--island-line);
  background: var(--surface-muted);
  font-size: 17px;
  line-height: 1;
  transition: transform .3s var(--ease-bounce), border-color .15s ease, background-color .15s ease;
}
.island-item:hover .island-icon { transform: scale(1.08) rotate(-4deg); border-color: var(--border-strong); background: var(--surface); }
.island-text { display: grid; gap: 2px; min-width: 0; }
.island-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.island-tag {
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--highlight);
  background: color-mix(in srgb, var(--highlight) 12%, transparent);
}
.island-arrow { color: var(--text-3); opacity: 0; transform: translateX(-4px); transition: opacity .15s ease, transform .2s ease; }
.island-item:hover .island-arrow { opacity: 1; transform: none; }
.island-desc { font-size: 11.5px; line-height: 1.45; color: var(--text-2); }

.island-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 26px;
  border-top: 1px solid var(--island-line);
  background: color-mix(in srgb, var(--surface-muted) 60%, transparent);
  font-size: 11.5px;
}
.island-foot-name { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.island-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--poke-yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--poke-yellow) 25%, transparent); }
.island-foot a { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--text); }

@media (max-width: 640px) {
  .island-topbar { padding: 10px 8px 12px; }
  .island-logo { padding: 0 6px 0 8px; }
  .island-logo .brand-logo { height: 16px; }
  .island-actions { gap: 4px; padding-left: 4px; }
  .island-actions .lang-switch summary, .island-actions .user-dot { width: 28px; height: 28px; }
  .island-actions .lang-flag { width: 18px; height: 18px; }
  .island-actions .btn-sm { display: none; }  /* 휴대폰 비회원: 섬 안엔 '로그인'만 (가입은 로그인 화면에서) */
  .island-logo .brand-logo { height: 14px; }
}
@media (max-width: 640px) {
  .island-tab { padding: 8px 12px; font-size: 13px; }
  .island-sheet.is-cols2 .island-items { grid-template-columns: 1fr; }
  .island-sheet-head { padding: 14px 20px 2px; }
  .island-foot { padding: 10px 20px; }
}

/* 174차: 지금 보고 있는 메뉴 — 작은 노란 점 */
.island-tab.is-current { color: var(--text); }
.island-tab.is-current::after {
  content: ""; position: absolute; left: 50%; bottom: 2px; width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--poke-yellow); box-shadow: 0 0 0 2px color-mix(in srgb, var(--poke-yellow) 30%, transparent);
}
.island-tab.has-drop.is-current::after { margin-left: -9px; }

/* 174차(9): 태블릿 폭은 섬을 촘촘하게 (기본 규칙보다 뒤에 있어야 이김) — 그래도 넘치면 메뉴 칸만 옆으로 밀림(.island-tabs), 줄바꿈 없음 */
@media (min-width: 768px) and (max-width: 1099.98px) {
  .island-topbar { padding-left: 12px; padding-right: 12px; }
  .island-logo { padding: 0 6px 0 8px; }
  .island-logo .brand-logo { height: 18px; }
  .island-tab { padding: 8px 9px; font-size: 13px; gap: 3px; }
  .island-actions { gap: 4px; padding-left: 4px; }
  .island-search summary, .island-actions .lang-switch summary, .island-actions .user-dot { width: 30px; height: 30px; }
}
@media (min-width: 768px) and (max-width: 899.98px) {
  .island-tab { padding: 8px 7px; font-size: 12.5px; }
  .island-chev { width: 12px; height: 12px; }
  .island-logo .brand-logo { height: 15px; }
}
.island-tag.is-hot {  /* 190차: HOT — 206차: 서브탭 .nav-badge 처럼 작게, 글자 오른쪽 위 윗첨자 */
  position: relative; top: -.6em; margin-left: -4px; padding: 1px 4px;
  color: #fff; background: #ef4444; font: 800 8px/1.2 var(--font-body); letter-spacing: .06em;
}
