/*
 * Hanging Context share controls
 * Scoped to .hc-share so panel pages can opt in without touching shared.css.
 */

.hc-share {
  --hc-share-bg: color-mix(in srgb, var(--bg, #fafafa) 92%, var(--text, #111) 8%);
  --hc-share-border: color-mix(in srgb, var(--line, #d9d9d9) 84%, transparent);
  --hc-share-text: var(--text, #111);
  --hc-share-muted: var(--text-tertiary, #777);
  --hc-share-focus: var(--accent, #111);
  display: grid;
  gap: 0.45rem;
  color: var(--hc-share-text);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.75rem;
}

.hc-share *,
.hc-share *::before,
.hc-share *::after {
  box-sizing: border-box;
}

.hc-share-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.36rem;
  align-items: center;
}

.hc-share-primary[hidden],
.hc-share-progress[hidden] {
  display: none;
}

.hc-share-button {
  appearance: none;
  border: 1px solid var(--hc-share-border);
  border-radius: 999px;
  background: var(--hc-share-bg);
  color: var(--hc-share-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 1.82rem;
  padding: 0.34rem 0.68rem;
  font: inherit;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.hc-share-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.hc-share-button:hover {
  border-color: var(--hc-share-text);
  transform: translateY(-1px);
}

.hc-share-button:focus-visible {
  outline: 2px solid var(--hc-share-focus);
  outline-offset: 2px;
}

.hc-share-button-primary {
  background: var(--hc-share-text);
  border-color: var(--hc-share-text);
  color: var(--bg, #fafafa);
}

.hc-share-format {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--hc-share-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 1.4rem;
  padding: 0;
  font: inherit;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
}

.hc-share-format:hover,
.hc-share-format:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.hc-share-format:focus-visible {
  outline: 2px solid var(--hc-share-focus);
  outline-offset: 3px;
}

.hc-share-format:disabled {
  cursor: wait;
  opacity: 0.7;
}

.hc-share-separator {
  color: var(--hc-share-muted);
  line-height: 1;
}

.hc-share-progress {
  display: flex;
  align-items: center;
  width: min(12rem, 100%);
  min-height: 1.4rem;
}

.hc-share-progress-track {
  position: relative;
  width: 100%;
  height: 0.32rem;
  overflow: hidden;
  border: 1px solid var(--hc-share-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--hc-share-bg) 82%, transparent);
}

.hc-share-progress-fill {
  position: absolute;
  inset-block: 0;
  left: -45%;
  width: 45%;
  border-radius: inherit;
  background: var(--hc-share-text);
  animation: hc-share-progress-sweep 1.05s ease-in-out infinite;
}

@keyframes hc-share-progress-sweep {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(325%);
  }
}

.hc-share-terms,
.hc-share-status {
  margin: 0;
  color: var(--hc-share-muted);
  line-height: 1.45;
}

.hc-share-status:empty {
  display: none;
}

@media (max-width: 620px) {
  .hc-share-primary,
  .hc-share-button {
    width: 100%;
  }

  .hc-share-primary {
    justify-content: flex-start;
  }

  .hc-share-button {
    justify-content: center;
  }
}
