/* Framing only: toolbar and menu come from the native renderer. */
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color-scheme: light dark;
}

.sharing-stage {
  position: relative;
  isolation: isolate;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  color: var(--color-foreground);
}

.sharing-note-context {
  display: none;
}

.sharing-toolbar {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.sharing-popover {
  position: relative;
  align-self: flex-end;
  width: min(400px, 100%);
  margin-right: 40px;
}

@media (min-width: 800px) {
  .sharing-note-context {
    position: absolute;
    z-index: -1;
    inset: 0;
    display: block;
    overflow: hidden;
    pointer-events: none;
    mask-image: linear-gradient(to right, #000 calc(100% - 6rem), transparent);
  }

  [data-note-editor] {
    --note-bottom-dock-height: 0px;
    position: absolute;
    /* Native title sits 32px below the 28px sharing button at y=24px. */
    top: 60px;
    /* The native 40px content inset places the first letter at the panel midpoint. */
    left: calc(50% - 40px);
    width: 50rem;
    height: 44rem;
    opacity: 0.48;
  }

  [data-note-header] textarea {
    field-sizing: content;
    height: auto !important;
    min-height: 36px;
  }

  [data-note-body] {
    overflow: hidden;
    scrollbar-gutter: auto;
  }

  /* These layers affect only the note; the native menu and toolbar stay crisp. */
  .sharing-note-context::before,
  .sharing-note-context::after {
    content: "";
    position: absolute;
    inset: 0;
  }

  .sharing-note-context::before {
    z-index: 1;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    mask-image: linear-gradient(to right, #000 25%, transparent 75%);
  }

  .sharing-note-context::after {
    z-index: 2;
    background: linear-gradient(
      to right,
      light-dark(var(--color-sidebar), var(--color-surface-1)),
      color-mix(in oklab, var(--color-background) 90%, transparent) 30%,
      color-mix(in oklab, var(--color-background) 65%, transparent) 50%,
      transparent 75%
    );
  }
}

@media (min-width: 800px) and (prefers-color-scheme: dark) {
  [data-note-editor] {
    opacity: 0.34;
  }

  /* Dither the dark gradients beneath the crisp sharing controls and site copy. */
  .sharing-stage::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    background-image: url("./gradient-noise.svg");
    opacity: 0.025;
  }
}

[data-sharing-menu] {
  width: 100%;
  max-width: none;
  animation: none;
}

@media (max-width: 480px) {
  .sharing-stage {
    padding: 20px 16px;
  }

  .sharing-popover {
    margin-right: 0;
  }
}
