/* Shared Core shell styles are deliberately namespaced. They cannot restyle
   business pages unless markup explicitly opts in with data-studio-shell. */
[data-studio-shell] {
  --studio-shell-accent: var(--studio-brand-accent, #111111);
  box-sizing: border-box;
  color: inherit;
  font: inherit;
}

[data-studio-shell] *,
[data-studio-shell] *::before,
[data-studio-shell] *::after {
  box-sizing: inherit;
}

[data-studio-shell] :focus-visible {
  outline: 3px solid color-mix(in srgb, var(--studio-shell-accent) 72%, white);
  outline-offset: 3px;
}

[data-studio-shell] [data-studio-language] {
  min-block-size: 44px;
  min-inline-size: 44px;
}

@media (prefers-reduced-motion: reduce) {
  [data-studio-shell] *,
  [data-studio-shell] *::before,
  [data-studio-shell] *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Shared deep-page viewer header. Business-page styling remains untouched;
   only pages registered by the Page Adapter receive these attributes. */
:root {
  --studio-deep-header-height: 64px;
}

html[data-studio-deep-header] body > header:not(#studioGlobalNav),
html[data-studio-deep-header] #colangs,
html[data-studio-deep-header] #__backStudio,
html[data-studio-deep-header] #backStudio,
html[data-studio-deep-header] [data-studio-legacy-chrome="hidden"] {
  display: none !important;
}

html[data-studio-deep-header="embedded"] #studioGlobalNav {
  display: none !important;
}

#studioGlobalNav[data-studio-shell="deep-page"] {
  --studio-shell-ink: #111820;
  --studio-shell-muted: #617080;
  --studio-shell-line: color-mix(in srgb, var(--studio-brand-accent, #111111) 18%, #dce2e8);
  position: sticky;
  inset-block-start: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  gap: 11px;
  inline-size: 100%;
  block-size: var(--studio-deep-header-height);
  min-block-size: var(--studio-deep-header-height);
  padding: 8px clamp(12px, 2.4vw, 28px);
  background: rgba(255, 255, 255, 0.97);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--studio-brand-soft, #f2f2f2) 72%, white) 0, rgba(255, 255, 255, 0.97) 34%, rgba(255, 255, 255, 0.97) 100%);
  border: 0;
  border-block-end: 1px solid var(--studio-shell-line, #dce2e8);
  box-shadow: 0 7px 24px rgba(19, 34, 49, 0.06);
  color: var(--studio-shell-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Thonburi", "Helvetica Neue", sans-serif;
  line-height: 1.2;
  isolation: isolate;
}

#studioGlobalNav[data-studio-shell="deep-page"]::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: -1px;
  block-size: 2px;
  background: linear-gradient(90deg, var(--studio-brand-primary, #111111), var(--studio-brand-accent, #111111) 22%, transparent 58%);
  opacity: 0.7;
  pointer-events: none;
}

#studioGlobalNav[data-studio-shell="deep-page"] a,
#studioGlobalNav[data-studio-shell="deep-page"] select {
  font: inherit;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-back,
#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-open {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-block-size: 42px;
  border: 1px solid var(--studio-shell-line, #dce2e8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--studio-shell-ink);
  box-shadow: 0 3px 12px rgba(19, 34, 49, 0.04);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-back {
  gap: 7px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 760;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-back-icon {
  color: var(--studio-brand-accent, #111111);
  font-size: 17px;
  line-height: 1;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-open {
  inline-size: 42px;
  padding: 0;
  font-size: 18px;
  font-weight: 760;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-back:hover,
#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-open:hover,
#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-lang:hover {
  border-color: var(--studio-brand-accent, #111111);
  background: #fff;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-back:active,
#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-open:active {
  transform: translateY(1px);
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  min-inline-size: 0;
  color: var(--studio-shell-ink);
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand-mark {
  display: grid;
  place-items: center;
  inline-size: 34px;
  block-size: 34px;
  border-radius: 50%;
  background: var(--studio-brand-primary, #111111);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 760;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--studio-brand-soft, #f2f2f2) 78%, white);
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand.has-logo .studio-global-brand-mark,
#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand.has-logo .studio-global-brand-label {
  display: none;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand-logo {
  display: block;
  inline-size: auto;
  max-inline-size: 154px;
  block-size: 36px;
  object-fit: contain;
  object-position: left center;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand-label {
  max-inline-size: 170px;
  overflow: hidden;
  color: var(--studio-shell-ink);
  font-size: 13px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-separator {
  flex: 0 0 auto;
  inline-size: 1px;
  block-size: 28px;
  background: var(--studio-shell-line, #dce2e8);
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-title {
  min-inline-size: 92px;
  max-inline-size: min(28vw, 360px);
  overflow: hidden;
  color: var(--studio-shell-ink);
  font-family: Georgia, "Times New Roman", "Songti SC", "Hiragino Mincho ProN", serif;
  font-size: clamp(14px, 1.45vw, 19px);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-spacer {
  flex: 1 1 auto;
  min-inline-size: 4px;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-langs {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-lang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 36px;
  block-size: 38px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--studio-shell-muted);
  font-size: 12px;
  font-weight: 780;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-lang.is-active {
  border-color: var(--studio-brand-primary, #111111);
  background: var(--studio-brand-primary, #111111);
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--studio-brand-primary, #111111) 20%, transparent);
}

#studioGlobalNav[data-studio-shell="deep-page"] .studio-global-language-select {
  display: none;
  flex: 0 0 auto;
  min-block-size: 42px;
  max-inline-size: 92px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--studio-shell-line, #dce2e8);
  border-radius: 12px;
  background-color: #fff;
  color: var(--studio-shell-ink);
  font-size: 12px;
  font-weight: 740;
}

html[data-studio-deep-layout="viewport"][data-studio-deep-header]:not([data-studio-deep-header="embedded"]) [data-studio-viewport-shell] {
  min-block-size: calc(100vh - var(--studio-deep-header-height)) !important;
  min-block-size: calc(100dvh - var(--studio-deep-header-height)) !important;
}

html[data-studio-deep-layout="viewport"][data-studio-deep-header]:not([data-studio-deep-header="embedded"]) .app[data-studio-viewport-shell] {
  block-size: calc(100vh - var(--studio-deep-header-height)) !important;
  block-size: calc(100dvh - var(--studio-deep-header-height)) !important;
}

@media (max-width: 900px) {
  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand-logo {
    display: none;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand.has-logo .studio-global-brand-mark {
    display: grid;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand-label {
    display: none;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-title {
    max-inline-size: none;
  }
}

@media (max-width: 760px) {
  #studioGlobalNav[data-studio-shell="deep-page"] {
    gap: 8px;
    padding-inline: 10px;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-back {
    inline-size: 42px;
    padding: 0;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-back-label {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  :root {
    --studio-deep-header-height: 56px;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] {
    gap: 7px;
    padding-block: 6px;
    padding-inline: 8px;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-back,
  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-open {
    min-block-size: 40px;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-brand-mark {
    inline-size: 32px;
    block-size: 32px;
    box-shadow: none;
    font-size: 14px;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-separator {
    block-size: 24px;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-title {
    min-inline-size: 0;
    font-size: 14px;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-langs,
  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-open {
    display: none;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-language-select {
    display: block;
  }
}

@media (max-width: 360px) {
  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-separator {
    display: none;
  }

  #studioGlobalNav[data-studio-shell="deep-page"] .studio-global-language-select {
    max-inline-size: 78px;
  }
}
