/* The submission panel is a drawer, not part of the article. Opening it must
   leave the page exactly where the reader left it, so it is taken out of the
   flow entirely and slides in from the right over the content. The styles in
   style.css describe the panel's contents; this file owns where the panel is. */

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  width: min(27rem, 100vw);
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 1.35rem clamp(1rem, 3vw, 1.5rem) 2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border: 0;
  border-left: 1px solid var(--line-strong);
  border-radius: 0;
  box-shadow: -24px 0 60px rgba(20, 26, 34, 0.18);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 180ms ease, visibility 0s linear 180ms;
}

.panel.is-open {
  transform: none;
  visibility: visible;
  transition: transform 180ms ease, visibility 0s;
}

/* The drawer scrolls its own content, so the submit row stays pinned to the
   bottom edge: a long passage or a long note must not push the only way to send
   the submission out of sight. */
.panel .panel-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin-bottom: 0;
  padding: 0.9rem 0 1rem;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

/* The selected passage stays marked while the drawer is open, so the reader can
   see what the submission is anchored to even after the selection collapses
   when focus moves into the drawer. */
::highlight(of-selection) {
  background-color: rgba(13, 93, 134, 0.2);
  color: inherit;
}

/* A narrow screen cannot hold a side drawer without swallowing the page, so it
   becomes a sheet that rises from the bottom. */
@media (max-width: 46rem) {
  .panel {
    top: auto;
    left: 0;
    width: 100%;
    max-height: 88dvh;
    border-left: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -18px 44px rgba(20, 26, 34, 0.22);
    transform: translateY(100%);
  }

  .panel.is-open {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .panel.is-open {
    transition: none;
  }
}

@media print {
  .panel {
    display: none;
  }
}
