/**
 * 메인(index) 상단바와 동일한 데모 공용 스타일.
 * service.html 등에서 /demo/demo-main-topbar.css 로 링크한다.
 */

.demo-fixed-top-shell {
  display: contents;
}

.mobile-drawer-backdrop {
  display: none;
}

.mobile-category-strip {
  display: none;
}

.topbar-leading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  border-bottom: 0;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border, rgba(220, 204, 188, 0.42));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html[data-theme="dark"] .topbar {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.topbar-inner {
  width: min(1480px, 94vw);
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.brand {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  display: block;
  width: clamp(120px, 13vw, 170px);
  height: auto;
  object-fit: contain;
}

.menu {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  height: 32px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--surface);
  border-color: var(--ink);
  color: var(--ink);
  outline: none;
}

.auth-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-entry {
  min-height: 32px;
  max-width: 100%;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

html[data-theme="dark"] .auth-entry {
  background: rgba(255, 255, 255, 0.06);
}

.auth-entry:hover,
.auth-entry:focus-visible {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--surface);
  outline: none;
}

.top-search {
  flex: 0 1 360px;
  min-width: 220px;
  max-width: 420px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 0 auto;
  transition: max-width 220ms ease, flex-basis 220ms ease, width 220ms ease;
}

.top-search:focus-within {
  flex-basis: 540px;
  max-width: 560px;
}

.top-search input {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
}

.top-search button {
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.top-search button:hover {
  filter: brightness(0.92);
}

@media (max-width: 640px) {
  body {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }

  #demo-page-transition-root > main.wrap {
    padding-top: calc(env(safe-area-inset-top, 0px) + var(--demo-mobile-top-stack-h, 176px));
  }

  .topbar-inner,
  .wrap {
    width: 94vw;
  }

  .top-search {
    width: 100%;
    max-width: none;
  }

  .mobile-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(8, 10, 14, 0.48);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  body.mobile-drawer-open .mobile-drawer-backdrop:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
  }

  body.mobile-drawer-open {
    overflow: hidden;
  }
}

/* ── 데스크톱·전역: serenade-unified.css의 button/input 전역 규칙보다 상단바를 메인(index)과 동일하게 (특이도 .topbar …) ── */
.topbar .theme-toggle,
header.topbar button.theme-toggle {
  border: 1px solid var(--line) !important;
  background: transparent !important;
  color: var(--muted) !important;
  border-radius: 999px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 10px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease !important;
}

.topbar .theme-toggle:hover,
.topbar .theme-toggle:focus-visible,
header.topbar button.theme-toggle:hover,
header.topbar button.theme-toggle:focus-visible {
  background: var(--surface) !important;
  border-color: var(--ink) !important;
  color: var(--ink) !important;
  text-shadow: none !important;
}

.topbar .top-search input {
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  padding: 10px 12px !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  font-family: "SUIT", "Noto Sans KR", sans-serif !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

html[data-theme="dark"] .topbar .top-search input {
  background: var(--surface) !important;
  color: var(--ink) !important;
}

.topbar .top-search button {
  border: 0 !important;
  border-radius: 10px !important;
  background: var(--ink) !important;
  color: var(--surface) !important;
  padding: 0 14px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: normal !important;
  text-shadow: none !important;
  box-shadow: none !important;
}

.topbar .top-search button:hover,
.topbar .top-search button:focus-visible {
  filter: brightness(0.92) !important;
  color: var(--surface) !important;
  text-shadow: none !important;
  outline: none !important;
}
