/* HiVenues / #272 — presentation-layer convergence.
 *
 * This stylesheet intentionally sits after the qualified HiVenues styles.
 * It changes Studio hierarchy and interaction geometry without redefining the
 * canonical host graph, persistence, Release, media, or consequence semantics.
 */

.cc-studio-body {
  --cc-studio-chrome: rgba(10, 13, 17, 0.94);
  --cc-studio-panel: rgba(17, 21, 27, 0.98);
  --cc-studio-border: rgba(255, 255, 255, 0.11);
  --cc-studio-muted: #a9b2bd;
  --cc-studio-bright: #f7f8fa;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.08), transparent 34rem),
    #07090c;
  color: var(--cc-studio-bright);
  min-height: 100dvh;
  overflow-x: hidden;
}

.cc-studio-shell {
  min-height: 100dvh;
}

.cc-studio-topbar {
  position: sticky;
  top: 0;
  z-index: 55;
  min-height: 72px;
  padding: 12px clamp(14px, 2vw, 30px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--cc-studio-border);
  background: var(--cc-studio-chrome);
  -webkit-backdrop-filter: blur(24px) saturate(125%);
  backdrop-filter: blur(24px) saturate(125%);
}

.cc-studio-brand {
  min-width: 0;
  gap: 11px;
}

.cc-studio-brand > div {
  min-width: 0;
}

.cc-studio-brand__mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.cc-studio-brand strong {
  display: block;
  overflow: hidden;
  color: var(--cc-studio-bright);
  font-size: 0.96rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-studio-brand small {
  display: block;
  margin-top: 3px;
  color: var(--cc-studio-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.cc-studio-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.cc-studio-state-cluster {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: 4px;
  padding-right: 12px;
  border-right: 1px solid var(--cc-studio-border);
}

.cc-studio-actions .cc-save-state,
.cc-studio-actions .cc-draft-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: #dce2e8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cc-studio-actions .cc-save-state::before {
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 999px;
  background: #9dc9a9;
  content: '';
}

.cc-studio-actions .cc-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  font-size: 0.78rem;
}

.cc-studio-notice {
  position: relative;
  z-index: 45;
  margin: 12px auto 0;
  width: min(1180px, calc(100% - 28px));
  border-radius: 14px;
}

/* The former permanent three-column application shell becomes one creative
 * workspace. Context is layered only when the operator asks for it. */
.cc-studio-workspace {
  position: relative;
  display: block;
  min-height: calc(100dvh - 72px);
  padding: 0;
}

.cc-studio-rail {
  display: none !important;
}

.cc-studio-commandbar {
  position: sticky;
  top: 84px;
  z-index: 46;
  display: grid;
  grid-template-columns: repeat(4, minmax(128px, 1fr));
  width: min(650px, calc(100% - 28px));
  margin: 14px auto 0;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(15, 18, 23, 0.90);
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
  backdrop-filter: blur(22px) saturate(125%);
}

.cc-studio-commandbar details {
  position: relative;
  min-width: 0;
}

.cc-studio-commandbar details + details {
  border-left: 1px solid rgba(255, 255, 255, 0.07);
}

.cc-studio-commandbar summary {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 8px 11px;
  border-radius: 11px;
  color: #dfe5eb;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  list-style: none;
  text-align: center;
  user-select: none;
}

.cc-studio-commandbar summary::-webkit-details-marker {
  display: none;
}

.cc-studio-commandbar summary:hover,
.cc-studio-commandbar summary:focus-visible,
.cc-studio-commandbar details[open] > summary {
  outline: none;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.cc-studio-commandmenu {
  position: absolute;
  top: calc(100% + 11px);
  left: 0;
  width: min(310px, calc(100vw - 32px));
  max-height: min(60dvh, 560px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  background: rgba(16, 20, 26, 0.985);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

.cc-studio-commandbar details:nth-last-child(-n + 2) .cc-studio-commandmenu {
  right: 0;
  left: auto;
}

.cc-studio-commandmenu__label {
  display: block;
  padding: 8px 9px 5px;
  color: #87929e;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.cc-studio-commandmenu button,
.cc-studio-commandmenu a {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: flex-start;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #e8edf2;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  text-decoration: none;
}

.cc-studio-commandmenu button:hover,
.cc-studio-commandmenu button:focus-visible,
.cc-studio-commandmenu a:hover,
.cc-studio-commandmenu a:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.cc-studio-commandmenu__add {
  margin-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #f3d9b1 !important;
}

/* Canvas is the product center of gravity. */
.cc-studio-stage {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 2.2vw, 34px) 56px;
  min-width: 0;
}

.cc-studio-stage__toolbar {
  min-height: 44px;
  margin: 0 0 10px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 0;
  background: transparent;
  color: var(--cc-studio-muted);
}

.cc-studio-stage__identity {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 9px;
}

.cc-studio-stage__identity strong {
  color: #eef2f6;
  font-size: 0.79rem;
  font-weight: 800;
}

.cc-studio-stage__identity span,
.cc-studio-stage__meta {
  color: #939eaa;
  font-size: 0.72rem;
}

.cc-stage-device {
  overflow: hidden;
  min-height: min(76dvh, 920px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background: #f5f0e7;
  box-shadow:
    0 38px 100px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(255, 255, 255, 0.025) inset;
}

#hivenuesanvas-slot {
  min-height: inherit;
}

/* A second complete visitor page no longer belongs below the authoring canvas.
 * Preview and Release are dedicated routes. This guard also prevents stale
 * fragments from reintroducing the old duplicated workflow. */
.cc-complete-preview,
.cc-full-preview-shell,
#cc-full-preview-frame {
  display: none !important;
}

/* Context is absent until selected, then becomes a deliberate overlay rather
 * than a permanently allocated third column. */
.cc-studio-inspector {
  position: fixed;
  z-index: 80;
  top: 92px;
  right: 18px;
  bottom: 18px;
  left: auto;
  width: min(392px, calc(100vw - 36px));
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  padding: 0 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: var(--cc-studio-panel);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.50);
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 36px));
  visibility: hidden;
  transition:
    transform 180ms ease,
    opacity 150ms ease,
    visibility 0s linear 180ms;
}

.cc-studio-inspector[data-open='true'] {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  visibility: visible;
  transition-delay: 0s;
}

.cc-studio-inspector__head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -18px 16px;
  padding: 17px 18px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(17, 21, 27, 0.98);
}

.cc-inspector-close--mobile {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.cc-studio-inspector .cc-inspector-empty {
  display: none;
}

.cc-context-open .cc-stage-device {
  box-shadow:
    0 38px 100px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.025) inset;
}

@media (max-width: 900px) {
  .cc-studio-topbar {
    min-height: 0;
    padding: 10px 11px;
    gap: 10px;
  }

  .cc-studio-brand__mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .cc-studio-brand strong {
    white-space: normal;
  }

  .cc-studio-brand small {
    font-size: 0.66rem;
  }

  .cc-studio-actions {
    gap: 6px;
  }

  .cc-studio-state-cluster {
    margin-right: 0;
    padding-right: 0;
    border-right: 0;
  }

  .cc-studio-actions .cc-save-state {
    display: none;
  }

  .cc-studio-actions .cc-draft-status {
    min-height: 32px;
    padding: 0 9px;
    font-size: 0.68rem;
  }

  .cc-studio-actions .cc-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .cc-studio-workspace {
    min-height: calc(100dvh - 60px);
    padding-bottom: 84px;
  }

  .cc-studio-commandbar {
    position: fixed;
    top: auto;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    z-index: 70;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: auto;
    margin: 0;
    border-radius: 18px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.46);
  }

  .cc-studio-commandbar summary {
    min-height: 52px;
    padding: 7px 5px;
    font-size: 0.70rem;
  }

  .cc-studio-commandmenu,
  .cc-studio-commandbar details:nth-last-child(-n + 2) .cc-studio-commandmenu {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-height: min(58dvh, 520px);
    border-radius: 18px;
  }

  .cc-studio-stage {
    width: 100%;
    padding: 13px 9px 22px;
  }

  .cc-studio-stage__toolbar {
    min-height: 36px;
    margin-bottom: 8px;
    gap: 8px;
  }

  .cc-studio-stage__identity {
    gap: 6px;
  }

  .cc-studio-stage__identity span,
  .cc-studio-stage__meta {
    font-size: 0.66rem;
  }

  .cc-stage-device {
    min-height: 68dvh;
    border-radius: 18px;
    box-shadow: 0 20px 58px rgba(0, 0, 0, 0.32);
  }

  .cc-studio-inspector {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(82dvh, 760px);
    padding: 0 16px calc(22px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 26px 26px 0 0;
    opacity: 1;
    transform: translateY(110%);
  }

  .cc-studio-inspector[data-open='true'] {
    transform: translateY(0);
  }

  .cc-studio-inspector__head {
    margin-right: -16px;
    margin-left: -16px;
    padding-right: 16px;
    padding-left: 16px;
    border-radius: 26px 26px 0 0;
  }
}

@media (max-width: 560px) {
  .cc-studio-topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .cc-studio-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    width: 100%;
  }

  .cc-studio-state-cluster {
    justify-self: start;
  }

  .cc-studio-stage__meta {
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cc-studio-inspector {
    transition: none;
  }
}
