/* nmwc-shell.css · unified site header (brand + tabs + actions) + MD view + downloads
 * All colors, radii, and font sizes flow from nmwc-framer-tokens.css.
 * Surface overlays (rgba whites on hover) remain literal — they are layered effects,
 * not semantic tokens.
 */

.site-header {
  position: fixed; top: 0; left: 0; right: 0; max-width: none; margin: 0;
  height: 72px; z-index: 200;
  background: rgba(15, 15, 15, 0.92);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center;
  padding: 0 28px; gap: 24px;
  font-family: 'SUIT Variable', 'SUIT', -apple-system, BlinkMacSystemFont, sans-serif;
}
.site-header .brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.site-header .brand:hover { opacity: 0.85; }
.site-header .brand:focus-visible {
  outline: none;
  box-shadow: var(--elev-3);
  border-radius: var(--radius-sm);
}
.site-header .brand svg { width: 32px; height: 32px; display: block; }
.site-header .brand-text {
  font-size: var(--fs-headline); font-weight: 700; letter-spacing: 0.04em; line-height: 1;
}
.site-header .header-nav {
  display: flex; align-items: center; gap: 20px;
  flex: 1; min-width: 0; overflow: visible;
  scrollbar-width: none; height: 100%;
}
.site-header .header-nav::-webkit-scrollbar { display: none; }
.site-header .header-nav .tab {
  display: inline-flex; align-items: center;
  height: 100%; padding: 0 4px; min-height: 44px;
  font-size: var(--fs-caption); font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-muted); text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-header .header-nav .tab:hover { color: var(--ink); }
.site-header .header-nav .tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}
.site-header .header-nav .tab:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0, 153, 255, 0.45);
  border-radius: var(--radius-xs);
}

/* === Sub-tabs · 2nd-level navigation for Design pages === */
.sub-tabs {
  position: fixed; top: 72px; left: 0; right: 0;
  height: 44px;
  background: rgba(15, 15, 15, 0.88);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  z-index: 199;
}
.sub-tabs-list { display: flex; align-items: center; gap: 24px; min-width: 0; flex: 1 1 auto; }
.sub-tabs-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sub-tabs .sub-tab {
  display: inline-flex; align-items: center;
  height: 100%; padding: 0 4px; min-height: 44px;
  font-size: var(--fs-caption); font-weight: 500;
  letter-spacing: 0.01em; color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.sub-tabs .sub-tab:hover { color: var(--ink); }
.sub-tabs .sub-tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}
body.has-sub-tabs { padding-top: 156px !important; }
body.has-sub-tabs > .container > header:first-child,
body.has-sub-tabs > nav.tabs + .container > header:first-child {
  margin-top: 32px;
}
.site-header .actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.site-header .action-btn {
  height: 34px; padding: 0 14px; min-height: 34px;
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-family: inherit; font-size: var(--fs-micro); font-weight: 500;
  letter-spacing: 0.04em; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.site-header .action-btn:active { transform: scale(0.97); }
.site-header .action-btn:focus-visible {
  outline: none;
  border-color: rgba(0, 153, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.15);
}
.site-header .action-btn:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.20); }
.site-header .action-btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.site-header .action-btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.site-header .action-btn.primary:hover { background: var(--ink); border-color: var(--ink); }

.site-header .dl-wrap { position: relative; }
.site-header .dl-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 240px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: 6px;
  display: none; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.site-header .dl-wrap.open .dl-menu { display: flex; }
.site-header .dl-menu a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none;
  font-size: var(--fs-caption); font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease;
}
.site-header .dl-menu a:hover { background: rgba(255, 255, 255, 0.06); }
.site-header .dl-menu a:focus-visible {
  outline: none; background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(0, 153, 255, 0.45);
}
.site-header .dl-menu a .size {
  font-size: var(--fs-micro); color: var(--ink-muted);
  font-family: ui-monospace, monospace; letter-spacing: 0.02em;
}
.site-header .dl-menu .sep { height: 1px; background: var(--hairline); margin: 4px 8px; }

/* Sub-tabs row · 우측 actions — MD view 상태에서도 body 직속이라 자동으로 살아남 */
.sub-tabs-actions .action-btn {
  height: 30px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-family: inherit; font-size: var(--fs-micro); font-weight: 500;
  letter-spacing: 0.04em; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.sub-tabs-actions .action-btn:active { transform: scale(0.97); }
.sub-tabs-actions .action-btn:focus-visible {
  outline: none;
  border-color: rgba(0, 153, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.15);
}
.sub-tabs-actions .action-btn:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.20); }
.sub-tabs-actions .action-btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.sub-tabs-actions .action-btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.sub-tabs-actions .action-btn.primary:hover { background: var(--ink); border-color: var(--ink); }

.sub-tabs-actions .dl-wrap { position: relative; }
.sub-tabs-actions .dl-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 240px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: 6px;
  display: none; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  z-index: 200;
}
.sub-tabs-actions .dl-wrap.open .dl-menu { display: flex; }
.sub-tabs-actions .dl-menu a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none;
  font-size: var(--fs-caption); font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease;
}
.sub-tabs-actions .dl-menu a:hover { background: rgba(255, 255, 255, 0.06); }
.sub-tabs-actions .dl-menu a:focus-visible {
  outline: none; background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(0, 153, 255, 0.45);
}
.sub-tabs-actions .dl-menu a .size {
  font-size: var(--fs-micro); color: var(--ink-muted);
  font-family: ui-monospace, monospace; letter-spacing: 0.02em;
  word-break: normal; overflow-wrap: normal;
}
.sub-tabs-actions .dl-menu .sep { height: 1px; background: var(--hairline); margin: 4px 8px; }

/* 모바일 — sub-tabs row가 종으면 Download 버튼 텍스트는 숨기고 아이콘만 */
@media (max-width: 600px) {
  .sub-tabs { padding: 0 16px; }
  .sub-tabs-actions .action-btn { padding: 0 10px; font-size: 11px; }
}

/* Hero 상단 여백 통일 — Home 기준 (h1.top ≈ 204px) */
body > .container > header:first-child,
body > nav.tabs + .container > header:first-child {
  margin-top: 68px;
}

/* hide the page's original .tabs (absorbed into header) */
body > nav.tabs { display: none !important; }

/* layout offset · single 72px header, no second sticky band
 * + 한국어 어절 보호 (word-break: keep-all) — 한글 단어가 줄 중간에서 끊기는 것을 방지.
 *   영문 긴 토큰/URL은 overflow-wrap으로 fallback. 코드·모노스페이스 영역은 opt-out. */
body {
  padding-top: 112px !important;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
}
/* opt-out — 영문/코드/숫자 토큰은 기본 줄바꿈 유지 */
code, pre, kbd, samp,
.md-view code, .md-view pre, .md-view pre code,
.site-header .brand-text,
.site-header .dl-menu .size {
  word-break: normal;
  overflow-wrap: normal;
  line-break: auto;
}
/* 유틸리티 — 명시적으로 끊지 말아야 할 phrase (예: "AI Native PM") */
.nowrap { white-space: nowrap; }

/* MD view */
.md-view {
  display: none;
  max-width: 920px; margin: 0 auto 80px;
  font-family: 'SUIT Variable', 'SUIT', -apple-system, sans-serif;
  font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink);
}
.md-view-active .container { display: none; }
.md-view-active .md-view { display: block; }
.md-view h1 { font-size: var(--fs-display-lg); font-weight: 500; letter-spacing: var(--ls-display-lg); margin: 24px 0 24px; line-height: var(--lh-display-lg); }
.md-view h2 { font-size: var(--fs-display-md); font-weight: 500; letter-spacing: var(--ls-display-md); margin: 56px 0 16px; padding-top: 32px; border-top: 1px solid var(--hairline); }
.md-view h3 { font-size: var(--fs-headline); font-weight: 700; margin: 40px 0 12px; letter-spacing: var(--ls-headline); }
.md-view h4 { font-size: var(--fs-body-lg); font-weight: 600; margin: 24px 0 8px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.md-view p { margin: 12px 0; max-width: none; color: var(--ink); }
.md-view ul, .md-view ol { margin: 12px 0 12px 24px; color: var(--ink); }
.md-view li { margin: 4px 0; }
.md-view code { background: var(--surface-2); padding: 2px 6px; border-radius: var(--radius-xs); font-size: var(--fs-micro); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.md-view pre { background: var(--surface-1); border: 1px solid var(--hairline-soft); padding: 20px; border-radius: var(--radius-md); overflow-x: auto; margin: 16px 0; }
.md-view pre code { background: none; padding: 0; font-size: var(--fs-micro); }
.md-view table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.md-view th, .md-view td { padding: 10px 14px; border-bottom: 1px solid var(--hairline-soft); text-align: left; vertical-align: top; }
.md-view th { color: var(--ink-muted); font-size: var(--fs-micro); font-weight: 500; text-transform: uppercase; letter-spacing: 0.12em; }
.md-view td { color: var(--ink); font-size: var(--fs-body-sm); }
.md-view blockquote { border-left: 2px solid var(--accent-blue); padding-left: 16px; margin: 16px 0; color: var(--ink-muted); }
.md-view a { color: var(--accent-blue); text-decoration: none; }
.md-view a:hover { text-decoration: underline; }
.md-view hr { border: none; border-top: 1px solid var(--hairline); margin: 32px 0; }
.md-view strong { color: var(--ink); font-weight: 700; }
.md-view em { color: var(--ink); font-style: italic; }
.md-view .md-error { padding: 60px 40px; text-align: center; color: var(--ink-muted); background: var(--surface-1); border-radius: var(--radius-lg); border: 1px solid var(--hairline-soft); }
.md-view .md-error code { background: var(--canvas); }

/* === Inline mark glyphs (replaces emoji for do/don't) === */
.mark-x, .mark-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  font-size: var(--fs-micro); font-weight: 700;
  border-radius: var(--radius-pill);
  margin-right: 6px; vertical-align: -3px;
  flex-shrink: 0;
}
.mark-x {
  background: rgba(248, 113, 113, 0.14);
  color: var(--semantic-error);
  border: 1px solid rgba(248, 113, 113, 0.35);
}
.mark-check {
  background: rgba(34, 197, 94, 0.14);
  color: var(--semantic-success);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

/* === Palette swatch · click-to-copy affordance === */
.ds-swatch.ds-swatch-copyable {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ds-swatch.ds-swatch-copyable:hover {
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}
.ds-swatch.ds-swatch-copyable:focus-visible {
  outline: none;
  border-color: rgba(0, 153, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.18);
}
.ds-swatch.ds-swatch-copyable .ds-swatch-hex {
  transition: color 0.15s ease;
}
.ds-swatch.ds-swatch-copyable.is-copied {
  border-color: rgba(34, 197, 94, 0.55);
}
.ds-swatch.ds-swatch-copyable.is-copied .ds-swatch-hex {
  color: var(--semantic-success);
}

/* === Floating image hover-download · zero layout impact === */
.floating-dl-btn {
  position: fixed; z-index: 250;
  width: 30px; height: 30px; padding: 0;
  background: rgba(10, 10, 10, 0.88); color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-pill); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.floating-dl-btn.visible { opacity: 1; pointer-events: auto; }
.floating-dl-btn:hover { background: var(--canvas); border-color: rgba(255, 255, 255, 0.30); }
.floating-dl-btn:active { transform: scale(0.94); }
.floating-dl-btn svg { width: 14px; height: 14px; }

/* === Composite 카드 다운로드 affordance · lockup + usage cases === */
[data-lockup], [data-graphic] {
  cursor: pointer;
}
/* .card에 적용 — 카드의 border-radius와 정확히 매칭. ::after로 콘텐츠 위에 테두리를 그려야
   자식의 dark 배경(stage/lockup div)이 inset box-shadow를 덮어버리는 문제 회피 */
.card:has(> [data-lockup]),
.card:has(> [data-graphic]) {
  position: relative;
  transition: filter 0.18s ease;
}
.card:has(> [data-lockup])::after,
.card:has(> [data-graphic])::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: box-shadow 0.18s ease;
}
.card:has(> [data-lockup]):hover::after,
.card:has(> [data-graphic]):hover::after {
  box-shadow: inset 0 0 0 1.5px rgba(0, 153, 255, 0.55);
}
.card:has(> [data-lockup]):hover,
.card:has(> [data-graphic]):hover {
  filter: brightness(1.04);
}

/* === Mobile hamburger nav (≤720px) === */
.site-header .hamburger { display: none; }
@media (max-width: 720px) {
  .site-header { padding: 0 16px; height: 64px; gap: 12px; }
  body { padding-top: 96px !important; }
  .site-header .brand svg { width: 28px; height: 28px; }
  .site-header .brand-text { font-size: var(--fs-body-lg); }
  .site-header .action-btn { padding: 0 10px; font-size: 11px; height: 30px; }
  .site-header .hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: transparent; border: none;
    border-radius: var(--radius-sm);
    color: var(--ink); cursor: pointer;
    margin-left: auto; order: 2;
  }
  .site-header .hamburger svg { width: 22px; height: 22px; }
  .site-header .hamburger:focus-visible { outline: none; box-shadow: var(--elev-3); }
  .site-header .actions { order: 3; }
  .site-header .header-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(15, 15, 15, 0.96);
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--hairline);
    flex-direction: column; height: auto; gap: 0;
    padding: 8px 16px 16px;
    overflow-x: visible;
    order: 4; flex-basis: 100%;
  }
  .site-header.menu-open { flex-wrap: wrap; }
  .site-header.menu-open .header-nav { display: flex; }
  .site-header .header-nav .tab {
    height: 44px; padding: 0 8px;
    border-bottom: none;
    border-left: 2px solid transparent;
    margin-bottom: 0;
    font-size: var(--fs-body-sm);
  }
  .site-header .header-nav .tab.active {
    border-bottom: none;
    border-left-color: var(--accent-blue);
    padding-left: 12px;
  }
  .sub-tabs {
    top: 64px;
    padding: 0 16px;
    gap: 14px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sub-tabs::-webkit-scrollbar { display: none; }
  body.has-sub-tabs { padding-top: 140px !important; }
  .md-view h1 { font-size: var(--fs-display-md); }
  .md-view h2 { font-size: var(--fs-headline); }
}