/* Customer Share / AR page — full-bleed model-viewer, light chrome. */
.share-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(1, 14, 208, 0.08), transparent 60%),
    linear-gradient(180deg, #f7f8fb 0%, var(--bg) 40%);
}

.share-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 18px clamp(16px, 3vw, 32px);
  border-bottom-width: 2px;
  background:
    linear-gradient(90deg,
      var(--ink) 0%,
      rgba(10,13,49,.95) 54%,
      rgba(1,14,208,.72) 100%),
    url(assets/header-bg.png) right center / cover no-repeat,
    var(--ink);
}

.share-header .brand-title {
  grid-row: auto;
}

.share-header .brand-sub {
  font-size: clamp(22px, 3vw, 30px);
}

.share-header .sub {
  grid-row: auto;
  max-width: 680px;
  margin-top: 0;
}

.share-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.share-title {
  margin: 0;
  font-family: var(--head-font);
  font-size: 22px;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -0.02em;
}

/* Action buttons live below the viewer (keeps the top clean and puts Copy link /
   Open editor where they don't fight the model-viewer canvas or AR button). */
.share-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex: 0 0 auto;
}

.share-actions .secondary,
.share-actions a.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.share-actions .secondary:hover,
.share-actions a.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.share-actions .secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.share-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: min(60vh, 680px);
  min-height: min(60dvh, 680px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #edeff3;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(10, 13, 49, 0.06);
}

.share-stage model-viewer {
  width: 100%;
  height: 100%;
  min-height: min(60vh, 680px);
  min-height: min(60dvh, 680px);
  --poster-color: transparent;
  background: transparent;
}

/* Annotate-mode Three.js viewer: fixed height (not flex:1) so the comments
   panel below stays reachable and the page can scroll to it. The editor's
   app-shell body has `overflow:hidden; height:100%`, which we override on the
   share page so the document scrolls instead of clipping. */
body.share-page {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
}

.share-page #preview.preview-card {
  flex: 0 0 auto;
  height: min(58vh, 620px);
  min-height: 420px;
}
.share-annot-list { margin-top: 4px; }

/* Slotted AR button — replaces model-viewer's default (bottom) AR button so it
   sits in the top-right, clear of mobile browser chrome. model-viewer only
   shows the slot when AR is available. */
.share-ar-button {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 22px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(10, 13, 49, 0.18);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}

.share-ar-button:active {
  background: #eef0f4;
}

.share-ar-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Soft MetallPRO credit on the model-viewer stage (not in AR). */
.share-mv-credit {
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 5;
  margin: 0;
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(10, 13, 49, 0.55);
  font-family: var(--body-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.share-stage .hide {
  display: none !important;
}

.share-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  z-index: 1;
}

.share-status[hidden] {
  display: none;
}

.share-note {
  margin: 0;
  font-size: 12px;
}

.share-note code {
  color: var(--accent);
}

/* Annotation hotspots rendered inside <model-viewer> in regular view mode. */
model-viewer .share-hotspot {
  --min-hotspot-opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translate3d(-50%, -50%, 0);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 8px 2px 2px;
  box-shadow: 0 2px 6px rgba(10, 13, 49, 0.18);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

model-viewer .share-hotspot .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(10, 13, 49, 0.25);
  flex: 0 0 auto;
}

model-viewer .share-hotspot .label {
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

model-viewer .share-hotspot.resolved {
  opacity: 0.6;
}

model-viewer .share-hotspot.resolved .dot {
  background: #2ea043 !important;
}

model-viewer .share-hotspot.resolved::after {
  content: '✓';
  color: #2ea043;
  font-weight: 700;
}

@media (max-width: 640px) {
  .share-header {
    padding: 14px 16px;
  }

  .share-header .brand-sub {
    font-size: 22px;
  }

  .share-main {
    padding: 12px 12px calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .share-title { font-size: 18px; }

  /* Center the Copy link / Open editor actions under the viewer on phones. */
  .share-actions {
    justify-content: center;
  }

  .share-stage,
  .share-stage model-viewer {
    min-height: 56vh;
    min-height: 56dvh;
  }
}
