/* ========== 공통 토큰 ========== */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --stage: #ecebe6;
  --ink: #19191c;
  --ink-2: #4f4f57;
  --muted: #8a8a93;
  --line: #e2e0d9;
  --accent: #2f5bff;
  --accent-weak: #e7edff;
  --hot: #ff5b2e;
  --ok: #17a05d;
  --bad: #e5484d;
  --dim: rgba(15, 15, 20, 0.55);
  --radius: 18px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.05);
  --shadow-2: 0 10px 30px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.08);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --serif: "Noto Serif KR", "Nanum Myeongjo", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 아이콘 */
.ic {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: middle;
}
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 26px; height: 26px; }
.ic.fill { fill: currentColor; }

/* ========== 사이트 헤더 ========== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  height: 60px; padding: 0 24px;
  background: rgba(245, 244, 240, .86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; letter-spacing: -.01em;
  text-decoration: none; white-space: nowrap;
}
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
}
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  position: relative;
  padding: 8px 14px; border-radius: 10px;
  font-size: 15px; font-weight: 600; color: var(--ink-2);
  text-decoration: none; white-space: nowrap;
  transition: background .2s, color .2s;
}
.site-nav a:hover { background: rgba(0,0,0,.05); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 2px; border-radius: 2px; background: var(--ink);
}
@media (max-width: 560px) {
  .site-header { padding: 0 16px; gap: 8px; }
  .brand-text { display: none; }
  .site-nav a { padding: 8px 10px; font-size: 14px; }
}

/* ========== 페이지 공통 ========== */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 560px) { .wrap { padding: 0 16px; } }

.page-head { padding: 48px 0 24px; }
.page-head h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.025em; line-height: 1.25; }
.page-head p { margin-top: 10px; color: var(--ink-2); font-size: 17px; }

.section-title {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 56px 0 16px; scroll-margin-top: 130px;
}
.section-title h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.section-title span { color: var(--muted); font-size: 15px; }

.site-footer {
  margin-top: 96px; padding: 32px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.site-footer a { color: var(--ink-2); }

/* 시도해 보라는 표시 */
.try {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: 99px;
  background: rgba(255,255,255,.9); color: var(--hot);
  font-size: 12px; font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  pointer-events: none;
}
.try::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--hot);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 91, 46, .55); }
  70% { box-shadow: 0 0 0 7px rgba(255, 91, 46, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 91, 46, 0); }
}

/* 공통 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent;
  background: var(--ink); color: #fff;
  font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: transform .12s, background .2s, box-shadow .2s, opacity .2s;
}
.btn:hover { background: #33333a; }
.btn:active { transform: scale(.97); }
.btn.line { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.line:hover { background: #f4f4f2; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.blue { background: var(--accent); }
.btn.blue:hover { background: #2549d8; }
.btn.red { background: var(--bad); }
.btn.red:hover { background: #c9373c; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink);
  transition: background .2s;
}
.icon-btn:hover { background: rgba(0,0,0,.06); }

/* 세그먼트(선택 버튼 묶음) */
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: rgba(0,0,0,.06); border-radius: 10px;
}
.seg button {
  border: 0; background: transparent;
  padding: 5px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-1); }

/* ========== 공통 레이어(모달·시트·드로어·라이트박스) ========== */
.layer {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 20px;
  visibility: hidden;
  transition: visibility 0s linear .3s;
}
.layer.is-open { visibility: visible; transition: none; }
.layer .dim {
  position: absolute; inset: 0;
  background: var(--dim);
  opacity: 0; transition: opacity .3s;
}
.layer.is-open .dim { opacity: 1; }
.layer .panel {
  position: relative;
  opacity: 0; transform: translateY(12px) scale(.97);
  transition: opacity .25s, transform .3s var(--ease-out);
}
.layer.is-open .panel { opacity: 1; transform: none; }
body.scroll-lock { overflow: hidden; }

/* 레이어 안 이름표 */
.name-tag {
  position: absolute; z-index: 3;
  padding: 3px 9px; border-radius: 7px;
  background: var(--hot); color: #fff;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(255, 91, 46, .35);
  pointer-events: none;
}

/* ========== 토스트·스낵바 ========== */
.toast-zone {
  position: fixed; left: 50%; bottom: 28px; z-index: 400;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 99px;
  background: rgba(25, 25, 28, .92); color: #fff;
  font-size: 15px; font-weight: 500;
  box-shadow: var(--shadow-2);
  animation: toast-in .35s var(--ease-out) both;
}
.toast.out { animation: toast-out .3s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

.snack-zone {
  position: fixed; left: 24px; bottom: 24px; z-index: 400;
  max-width: calc(100vw - 48px);
}
.snackbar {
  display: flex; align-items: center; gap: 24px;
  min-width: 300px; padding: 12px 10px 12px 18px; border-radius: 10px;
  background: #2b2b30; color: #fff;
  font-size: 15px;
  box-shadow: var(--shadow-2);
  animation: snack-in .35s var(--ease-out) both;
}
.snackbar.out { animation: toast-out .3s ease-in both; }
.snackbar button {
  margin-left: auto; border: 0; background: transparent;
  color: #8fb0ff; font-weight: 700; padding: 6px 10px; border-radius: 6px;
}
.snackbar button:hover { background: rgba(255,255,255,.08); }
@keyframes snack-in { from { opacity: 0; transform: translateY(100%); } }
@media (max-width: 560px) {
  .snack-zone { left: 16px; right: 16px; bottom: 16px; }
  .snackbar { min-width: 0; }
}

/* ========== 화면에 맞춰 축소(와이어프레임용) ========== */
.fit { position: relative; width: 100%; overflow: hidden; }
.fit-inner { transform-origin: top left; margin: 0 auto; }

/* ========== 라이트박스 ========== */
.lightbox .dim { background: rgba(8, 8, 10, .92); }
.lb-panel { display: grid; justify-items: center; gap: 10px; }
.lb-panel img { max-width: min(86vw, 640px); max-height: 76vh; border-radius: 4px; transition: opacity .2s; }
.lb-cap { color: #ddd; font-size: 14px; }
.lightbox .icon-btn { position: absolute; z-index: 2; width: 52px; height: 52px; color: #fff; border-radius: 50%; }
.lightbox .icon-btn:hover { background: rgba(255,255,255,.12); }
.lb-close { top: 16px; right: 16px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
.lb-nav.prev { left: 12px; } .lb-nav.next { right: 12px; }
.lb-tag { left: 16px; top: 20px; }

/* ========== 툴팁 ========== */
.tip-host { position: relative; }
.tooltip {
  position: absolute; bottom: calc(100% + 10px); left: 50%;
  padding: 5px 10px; border-radius: 7px;
  background: var(--ink); color: #fff;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  opacity: 0; transform: translate(-50%, 4px); pointer-events: none;
  transition: opacity .15s, transform .2s var(--ease-out);
}
.tooltip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--ink); }
.tip-host:hover .tooltip, .tip-host:focus-visible .tooltip, .tip-host.show .tooltip { opacity: 1; transform: translate(-50%, 0); transition-delay: .15s; }

/* ========== 팝오버 ========== */
.pop-wrap { position: relative; }
.popover {
  position: absolute; top: calc(100% + 12px); left: 50%; z-index: 5;
  display: grid; gap: 2px; width: 190px; padding: 10px;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-2);
  opacity: 0; transform: translate(-50%, -6px) scale(.97); transform-origin: top center; pointer-events: none;
  transition: opacity .2s, transform .25s var(--ease-out);
}
.popover::before { content: ""; position: absolute; bottom: 100%; left: 50%; margin-left: -7px; border: 7px solid transparent; border-bottom-color: #fff; }
.pop-wrap.open .popover { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.popover b { padding: 2px 8px 6px; font-size: 13px; color: var(--muted); }
.popover button { display: flex; align-items: center; gap: 8px; padding: 8px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; text-align: left; }
.popover button:hover { background: #f3f2ee; }
.site-footer p + p { margin-top: 6px; }
