/*
 * 프리또 공통 틀 — docs/디자인/디자인-시스템.md §2.2·§6.1
 * TopBar(로고 + 상품 세그먼트 + 데스크톱 주 메뉴 + 로그인) · SubNav · BottomNav(모바일) · 본문 격자 · Footer
 * 옛 화면(data-ui="v1", Tabler·style.css 위)에서도 같은 모양이어야 한다 → base.css 없이 동작하도록
 * 틀 요소 안에서 리셋을 다시 선언한다 (Tabler reboot의 요소 선택자보다 클래스 선택자가 이긴다 — §6.2)
 * 현재 위치는 aria-current — "page"(지금 페이지) · "true"(지금 페이지가 속한 탭·상품) 둘 다 같은 모양
 */

/* ── 틀 공통 리셋 (옛 화면 대비) ── */
.ft-topbar, .ft-subnav, .ft-bottomnav, .ft-footer, .ft-skip, .ft-pagehead {
  box-sizing: border-box;
  font-family: var(--ft-font);
  letter-spacing: normal;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
.ft-topbar *, .ft-subnav *, .ft-bottomnav *, .ft-footer *, .ft-pagehead *,
.ft-topbar *::before, .ft-subnav *::before, .ft-bottomnav *::before, .ft-footer *::before,
.ft-topbar *::after, .ft-subnav *::after, .ft-bottomnav *::after, .ft-footer *::after { box-sizing: border-box; }
.ft-topbar p, .ft-topbar ul, .ft-subnav ul, .ft-bottomnav ul, .ft-footer p, .ft-footer ul, .ft-footer li,
.ft-topbar h1, .ft-topbar h2, .ft-footer h2, .ft-pagehead h1, .ft-pagehead p { margin: 0; padding: 0; list-style: none; }
.ft-topbar a, .ft-topbar a:hover, .ft-subnav a, .ft-subnav a:hover, .ft-bottomnav a, .ft-bottomnav a:hover,
.ft-footer a, .ft-footer a:hover, .ft-skip, .ft-skip:hover { text-decoration: none; }
.ft-topbar :focus-visible, .ft-subnav :focus-visible, .ft-bottomnav :focus-visible, .ft-footer :focus-visible {
  outline: 2px solid var(--ft-focus); outline-offset: 2px; box-shadow: none;
}

/* ── 접근성 유틸 (옛·새 화면 공통이라 여기 둔다) ── */
.ft-sr-only {  /* 옛 CSS의 span·a 규칙(예: .footerIcon span 너비 100%)에 지지 않게 !important */
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important;
}
/* 본문 바로가기 — 키보드 포커스에서만 보인다 */
.ft-skip {
  position: absolute; left: var(--ft-space-2); top: -100px; z-index: var(--ft-z-dialog);
  padding: var(--ft-space-3) var(--ft-space-4); border-radius: var(--ft-radius-md);
  background: var(--ft-accent); color: var(--ft-on-accent); font-size: var(--ft-text-md); font-weight: var(--ft-weight-semibold);
}
.ft-skip:focus, .ft-skip:focus-visible { top: var(--ft-space-2); color: var(--ft-on-accent); outline: 2px solid var(--ft-text); outline-offset: 2px; }

/* 아이콘 (SVG 스프라이트 /res/svg/ft-icons.svg — Tabler Icons) */
.ft-icon {
  display: inline-block; vertical-align: middle; width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ft-icon--sm { width: 16px; height: 16px; }
.ft-icon--lg { width: 24px; height: 24px; }

/* 고정 TopBar 아래로 #앵커 이동이 숨지 않게 */
:root[data-ui] { scroll-padding-top: calc(var(--ft-topbar-h) + var(--ft-space-2)); }

/* ── TopBar ── */
.ft-topbar {
  position: sticky; top: 0; z-index: var(--ft-z-nav);
  background: var(--ft-surface); color: var(--ft-text);
  border-bottom: 1px solid var(--ft-border);
  font-size: var(--ft-text-md); line-height: var(--ft-lh-md);
}
.ft-topbar__inner {
  display: flex; align-items: center; gap: var(--ft-space-3);
  max-width: var(--ft-content-max); height: var(--ft-topbar-h);
  margin: 0 auto; padding: 0 var(--ft-gutter);
}
.ft-logo {
  display: inline-flex; align-items: center; flex: none; min-height: var(--ft-touch);
  font-size: 20px; line-height: 1; font-weight: 800; letter-spacing: -0.02em; color: var(--ft-text);
}
.ft-logo:hover { color: var(--ft-text); }
.ft-logo b { color: var(--ft-accent); font-weight: inherit; }

/* 상품 전환 세그먼트 — 현재 상품은 상품색 채움, 나머지 --ft-text-2(7.56:1). 높이 36 + 터치 44 */
.ft-segment {
  display: inline-flex; flex: none; padding: 3px; gap: 2px;
  background: var(--ft-surface-2); border: 1px solid var(--ft-border); border-radius: var(--ft-radius-full);
}
.ft-segment__item {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 52px; height: 36px; padding: 0 var(--ft-space-3);
  border-radius: var(--ft-radius-full);
  font-size: var(--ft-text-sm); line-height: 1; font-weight: var(--ft-weight-semibold); color: var(--ft-text-2);
  white-space: nowrap;
}
.ft-segment__item::after { content: ""; position: absolute; inset: -4px 0; } /* 터치 영역 44px */
.ft-segment__item:hover { color: var(--ft-text); }
.ft-segment__item[aria-current] { color: var(--ft-on-accent); background: var(--ft-accent); }
.ft-segment__item[data-product="lotto"][aria-current] { background: var(--ft-lotto); }
.ft-segment__item[data-product="pension"][aria-current] { background: var(--ft-pension); }
.ft-segment__item[data-product="speetto"][aria-current] { background: var(--ft-speetto); }
.ft-segment__item[aria-current]:hover { color: var(--ft-on-accent); }
@media (max-width: 359px) {
  .ft-topbar__inner { gap: var(--ft-space-2); padding: 0 12px; }
  .ft-segment__item { min-width: 44px; padding: 0 var(--ft-space-2); }
}

.ft-topbar__end { margin-left: auto; display: flex; align-items: center; gap: var(--ft-space-1); flex: none; }
.ft-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--ft-touch); height: var(--ft-touch); padding: 0; border: 0; border-radius: var(--ft-radius-full);
  color: var(--ft-text-2); background: none; cursor: pointer;
}
.ft-iconbtn:hover { background: var(--ft-surface-2); color: var(--ft-text); }

/* 로그인 / 닉네임 메뉴 (<details> — JS 없이 열리고, ft.js가 바깥 클릭·Esc로 닫는다) */
.ft-login {
  position: relative; display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 var(--ft-space-3);
  border: 1px solid var(--ft-border-strong); border-radius: var(--ft-radius-full); background: var(--ft-surface);
  font-size: var(--ft-text-sm); line-height: 1; font-weight: var(--ft-weight-semibold); color: var(--ft-text);
  white-space: nowrap; cursor: pointer; list-style: none;
}
.ft-login::after { content: ""; position: absolute; inset: -5px -1px; } /* 터치 영역 44px */
.ft-login:hover { background: var(--ft-surface-2); color: var(--ft-text); }
.ft-login::-webkit-details-marker { display: none; }
.ft-login__name { max-width: 7em; overflow: hidden; text-overflow: ellipsis; }
.ft-menu { position: relative; }
.ft-menu[open] > .ft-login { background: var(--ft-surface-2); }
.ft-menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--ft-z-dialog);
  min-width: 200px; padding: var(--ft-space-2) 0; margin: 0;
  background: var(--ft-surface); border: 1px solid var(--ft-border); border-radius: var(--ft-radius-md); box-shadow: var(--ft-shadow-2);
}
.ft-menu__panel a {
  display: flex; align-items: center; min-height: var(--ft-touch); padding: 0 var(--ft-space-4);
  font-size: var(--ft-text-md); line-height: var(--ft-lh-md); color: var(--ft-text);
}
.ft-menu__panel a:hover { background: var(--ft-surface-2); color: var(--ft-text); }
.ft-menu__label {
  display: block; padding: var(--ft-space-2) var(--ft-space-4) var(--ft-space-1);
  font-size: var(--ft-text-xs); line-height: var(--ft-lh-xs); font-weight: var(--ft-weight-semibold); color: var(--ft-text-2);
}
.ft-menu__sep { height: 1px; margin: var(--ft-space-2) 0; background: var(--ft-border); border: 0; }

/* 데스크톱 주 메뉴 (모바일에서는 하단 탭바) */
.ft-gnb { display: none; }
@media (min-width: 1024px) {
  .ft-gnb { display: flex; gap: var(--ft-space-1); margin-left: var(--ft-space-4); }
  .ft-gnb__item {
    display: inline-flex; align-items: center; height: var(--ft-topbar-h); padding: 0 var(--ft-space-3);
    font-size: var(--ft-text-md); line-height: 1; font-weight: var(--ft-weight-semibold); color: var(--ft-text-2);
    box-shadow: inset 0 -3px 0 transparent; white-space: nowrap;
  }
  .ft-gnb__item:hover { color: var(--ft-text); }
  .ft-gnb__item[aria-current] { color: var(--ft-accent); box-shadow: inset 0 -3px 0 var(--ft-accent); }
}

/* ── SubNav (섹션 안 하위 메뉴) — 가로 스크롤 + 오른쪽 끝 흐림(더 있음 단서) ── */
.ft-subnav { background: var(--ft-surface); border-bottom: 1px solid var(--ft-border); }
.ft-subnav__inner {
  display: flex; gap: var(--ft-space-1); overflow-x: auto; scrollbar-width: none;
  max-width: var(--ft-content-max); margin: 0 auto; padding: 0 var(--ft-gutter);
}
.ft-subnav__inner[data-overflow="true"] { -webkit-mask-image: linear-gradient(90deg, black calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, black calc(100% - 24px), transparent); }
.ft-subnav__inner::-webkit-scrollbar { display: none; }
.ft-subnav__item {
  flex: none; display: inline-flex; align-items: center; height: var(--ft-touch); padding: 0 var(--ft-space-3);
  font-size: var(--ft-text-sm); line-height: 1; font-weight: var(--ft-weight-semibold); color: var(--ft-text-2);
  box-shadow: inset 0 -2px 0 transparent; white-space: nowrap;
}
.ft-subnav__item:hover { color: var(--ft-text); }
.ft-subnav__item[aria-current] { color: var(--ft-text); box-shadow: inset 0 -2px 0 var(--ft-accent); }

/* ── BottomNav (모바일 <1024 전용) ── */
.ft-bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--ft-z-nav);
  display: grid; grid-template-columns: repeat(var(--ft-tabs, 5), minmax(0, 1fr));
  height: calc(var(--ft-bottomnav-h) + env(safe-area-inset-bottom));
  padding: 0 0 env(safe-area-inset-bottom); margin: 0;
  background: var(--ft-surface); border-top: 1px solid var(--ft-border);
}
.ft-bottomnav__item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; font-size: var(--ft-text-xs); line-height: var(--ft-lh-xs); font-weight: var(--ft-weight-semibold);
  color: var(--ft-text-2); white-space: nowrap;
}
.ft-bottomnav__item:hover { color: var(--ft-text); }
.ft-bottomnav__item .ft-icon { width: 24px; height: 24px; }
.ft-bottomnav__item[aria-current] { color: var(--ft-accent); }
.ft-bottomnav__item[aria-current]::before {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--ft-accent);
}
.ft-bottomnav[data-tabs="3"] { --ft-tabs: 3; }
.ft-bottomnav[data-tabs="4"] { --ft-tabs: 4; }
.ft-bottomnav[data-tabs="5"] { --ft-tabs: 5; }
@media (min-width: 1024px) { .ft-bottomnav { display: none; } }
/* 하단 탭바가 본문 끝을 가리지 않게 — 탭바가 있는 화면의 문서 끝 여백 */
@media (max-width: 1023.98px) {
  .ft-has-bottomnav { padding-bottom: calc(var(--ft-bottomnav-h) + env(safe-area-inset-bottom)); }
}

/* ── 본문 격자 (새 화면) ── */
.ft-page {
  box-sizing: border-box; max-width: var(--ft-content-max); margin: 0 auto;
  padding: var(--ft-space-4) var(--ft-gutter) var(--ft-space-8);
  display: grid; gap: var(--ft-space-4); grid-template-columns: minmax(0, 1fr);
}
.ft-main, .ft-aside { display: grid; gap: var(--ft-space-4); align-content: start; min-width: 0; }
@media (min-width: 1024px) {
  .ft-page { padding-top: var(--ft-space-6); padding-bottom: var(--ft-space-12); gap: var(--ft-space-6); }
  .ft-page--aside { grid-template-columns: minmax(0, 1fr) var(--ft-aside-w); }
  .ft-aside { position: sticky; top: calc(var(--ft-topbar-h) + var(--ft-space-6)); }
}

/* 페이지 머리 (H1 = 페이지 제목) */
.ft-pagehead { display: grid; gap: var(--ft-space-1); color: var(--ft-text); }
.ft-pagehead__title { font-size: var(--ft-text-xl); line-height: var(--ft-lh-xl); font-weight: var(--ft-weight-bold); letter-spacing: -0.01em; }
.ft-pagehead__desc { font-size: var(--ft-text-sm); line-height: var(--ft-lh-sm); color: var(--ft-text-2); }
@media (min-width: 1024px) {
  .ft-pagehead__title { font-size: var(--ft-text-2xl); line-height: var(--ft-lh-2xl); }
}

/* ── Footer ── */
.ft-footer {
  border-top: 1px solid var(--ft-border); background: var(--ft-surface);
  padding: var(--ft-space-6) var(--ft-gutter) var(--ft-space-8);
  font-size: var(--ft-text-sm); line-height: var(--ft-lh-sm); color: var(--ft-text-2);
}
.ft-footer__inner { max-width: var(--ft-content-max); margin: 0 auto; display: grid; gap: var(--ft-space-3); }
.ft-footer__links { display: flex; flex-wrap: wrap; gap: 0 var(--ft-space-4); }
.ft-footer__links a {
  display: inline-flex; align-items: center; min-height: var(--ft-touch);
  color: var(--ft-text); font-weight: var(--ft-weight-semibold);
}
.ft-footer__links a:hover { color: var(--ft-accent); }
.ft-footer__links--sub a { color: var(--ft-text-2); font-weight: var(--ft-weight-regular); }
.ft-footer__note { color: var(--ft-text-3); font-size: var(--ft-text-xs); line-height: var(--ft-lh-xs); }
.ft-footer__sns { display: flex; flex-wrap: wrap; gap: 0; margin: 0 calc(var(--ft-space-3) * -1); }
.ft-footer__sns a, .ft-footer__sns button {
  display: inline-flex; align-items: center; justify-content: center; width: var(--ft-touch); height: var(--ft-touch); padding: 0; margin: 0;
  border: 0; border-radius: var(--ft-radius-full); background: none; font: inherit; color: var(--ft-text-2); cursor: pointer;
}
.ft-footer__sns a:hover, .ft-footer__sns button:hover { background: var(--ft-surface-2); color: var(--ft-text); }

/* 푸터 SNS 아이콘 그림 — 옛 화면은 style.css가 그리고(v1-bridge.css가 크기), 새 화면(v2)은 style.css가 없어 여기서 (D10 정리 때 v2 한정을 푼다) */
:root[data-ui="v2"] .ft-footer__sns .footerIcon .icon {
  display: block; width: 24px; height: 24px; border-radius: 50%;
  background-position: center; background-repeat: no-repeat; background-size: contain;
}
:root[data-ui="v2"] .footerIcon.tistory .icon { background-image: url(/res/svg/sns/tistory_logo.svg); }
:root[data-ui="v2"] .footerIcon.Nband .icon { background-image: url(/res/svg/sns/naverband-logo.svg); }
:root[data-ui="v2"] .footerIcon.Nblog .icon { background-image: url(/res/svg/sns/g_blog.svg); }
:root[data-ui="v2"] .footerIcon.Gblog .icon { background-image: url(/res/svg/sns/n_blog.svg); }
:root[data-ui="v2"] .footerIcon.youtube .icon { background-image: url(/res/svg/sns/youtube.svg); }
:root[data-ui="v2"] .footerIcon.instagram .icon { background-image: url(/res/svg/sns/instagram.svg); }
:root[data-ui="v2"] .footerIcon.linkedin .icon { background-image: url(/res/svg/sns/linkedin.svg); }
:root[data-ui="v2"] .footerIcon.reddit .icon { background-image: url(/res/svg/sns/reddit.svg); }
:root[data-ui="v2"] .footerIcon.pinterest .icon { background-image: url(/res/svg/sns/pinterest.svg); }
:root[data-ui="v2"] .footerIcon.twitter .icon { background-image: url(/res/svg/sns/twitter.svg); }
:root[data-ui="v2"] .footerIcon.tumblr .icon { background-image: url(/res/svg/sns/tumblr.svg); }
:root[data-ui="v2"] .footerIcon.link .icon { background-image: url(/res/svg/sns/copy.svg); }
:root[data-ui="v2"] .footerIcon.facebook .icon { background-image: url(/res/svg/sns/facebook_il.svg); }
:root[data-ui="v2"] .footerIcon.medium .icon { background-image: url(/res/svg/sns/medium.svg); }
:root[data-ui="v2"] .footerIcon.behance .icon { background-image: url(/res/svg/sns/behance.svg); }
:root[data-ui="v2"] .footerIcon.dribbble .icon { background-image: url(/res/svg/sns/dribbble_back.svg); }
:root[data-ui="v2"] .footerIcon.livejournal .icon { background-image: url(/res/svg/sns/livejournal.svg); }
