/* Share (js/share.js): the sheet a drop's owner opens to post about the drop. A <dialog class="share-sheet">,
   centered on a computer and up from the bottom on a phone, where Post on X waits at the bottom from the first
   frame and the rest scrolls under it. Every rule is scoped to .share-sheet; the tokens are app.css's. */
html:has(dialog.share-sheet[open]) { overflow: hidden; }
dialog.share-sheet {
  --sh-line-hover: #86868b; --sh-ease: cubic-bezier(.32, .72, 0, 1);
  border: 0; padding: 0; width: min(1000px, calc(100% - 48px)); max-width: none; max-height: calc(100% - 48px);
  border-radius: 28px; overflow: auto; overscroll-behavior: contain; background: var(--bg); color: var(--ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .25);
}
dialog.share-sheet::backdrop { background: rgba(0, 0, 0, .32); }
dialog.share-sheet[open] { animation: sh-up .45s var(--sh-ease); }
@keyframes sh-up { from { transform: translateY(24px); opacity: 0; } }

.share-sheet .sh-body { position: relative; padding: 36px; }
@media (min-width: 900px) {
  .share-sheet .sh-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto auto 1fr; grid-template-areas: "head head" "art text" "art act"; column-gap: 48px; row-gap: 32px; align-items: start; }
}
.share-sheet .sh-head { grid-area: head; min-width: 0; }
.share-sheet .sh-art { grid-area: art; min-width: 0; }
.share-sheet .sh-text { grid-area: text; min-width: 0; }
.share-sheet .sh-act { grid-area: act; min-width: 0; }
.share-sheet h2 { margin: 0; padding-right: 40px; }
.share-sheet h2:focus { outline: none; }
.share-sheet h3 { margin: 0; font-size: var(--t-l); font-weight: 600; letter-spacing: -.01em; }
.share-sheet h3 label { display: inline; font: inherit; color: inherit; }

/* app.css makes every button a grey pill; here each kind sets its own look. */
.share-sheet button { font: inherit; color: inherit; letter-spacing: inherit; border: 0; border-radius: 0; background: none; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.share-sheet .sh-group { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
/* Shuffle: an ink link, as on the setup page. */
.share-sheet .sh-link { font-size: var(--t-m); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.share-sheet .sh-link:hover { background: none; color: var(--muted); }

.share-sheet .sh-box { aspect-ratio: 1; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px var(--tint-2); background: #fff; }
.share-sheet .sh-box canvas { display: block; width: 100%; height: 100%; }

/* iOS-style segmented control. */
.share-sheet .sh-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; margin-top: 14px; padding: 2px; border-radius: 10px; background: rgba(118, 118, 128, .12); }
.share-sheet .sh-seg button { position: relative; height: 36px; border-radius: 8px; font-size: var(--t-m); font-weight: 500; white-space: nowrap; transition: background .2s, box-shadow .2s; }
.share-sheet .sh-seg button:hover { background: none; }
/* Fingers: each half reaches 44 high. */
@media (pointer: coarse) { .share-sheet .sh-seg button::after { content: ""; position: absolute; inset: -4px 0; } }
.share-sheet .sh-seg button[aria-pressed=true] { background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }

.share-sheet .sh-post { display: block; width: 100%; min-height: 200px; resize: none; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  padding: 14px 16px; font-family: var(--sans); font-size: var(--t-l); line-height: 1.47; letter-spacing: -.01em; transition: border-color .15s; }
.share-sheet .sh-post:hover { border-color: var(--sh-line-hover); }
.share-sheet .sh-post:focus-visible { outline: 0; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.share-sheet .sh-count { margin: 8px 0 0; text-align: right; font-size: var(--t-s); color: var(--muted); font-variant-numeric: tabular-nums; }
.share-sheet .sh-count.over { color: var(--error); }

.share-sheet .sh-cta { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; border-radius: var(--pill); background: var(--ink); color: #fff; font-size: var(--t-l); font-weight: 500; text-decoration: none; transition: background .15s, transform .15s; }
.share-sheet .sh-cta:hover { background: #000; }
.share-sheet .sh-cta:active { transform: scale(.98); }
.share-sheet .sh-note { margin: 10px 0 0; font-size: var(--t-s); color: var(--muted); text-align: center; text-wrap: balance; }
.share-sheet .sh-twin { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.share-sheet .sh-twin button { height: 44px; border-radius: var(--pill); background: var(--tint); font-size: var(--t-m); font-weight: 500; transition: background .15s; }
.share-sheet .sh-twin button:hover { background: var(--tint-2); }

.share-sheet .sh-x { position: absolute; top: 18px; right: 18px; z-index: 3; width: 32px; height: 32px; border-radius: 50%; background: rgba(29, 29, 31, .06); display: grid; place-items: center; }
.share-sheet .sh-x:hover { background: rgba(29, 29, 31, .12); }
.share-sheet .sh-x svg { width: 12px; height: 12px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }

/* Its own toast: the page's #toast sits under the dialog. */
.share-sheet .sh-toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); z-index: 30; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: max-content; max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 18px; background: rgba(29, 29, 31, .92); color: #fff; font-size: 15px; text-align: center;
  transition: opacity .25s, transform .35s var(--sh-ease); }
.share-sheet .sh-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 899px) {
  dialog.share-sheet { width: 100%; margin: auto 0 0; max-height: calc(100% - 12px); border-radius: 22px 22px 0 0; }
  .share-sheet .sh-body { padding: 24px max(20px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left)); }
  .share-sheet .sh-art, .share-sheet .sh-text { margin-top: 28px; }
  /* The dock's box is the whole sheet, so it can stick to the bottom from the first frame. */
  .share-sheet .sh-act { display: contents; }
  .share-sheet .sh-dock { position: sticky; bottom: 0; z-index: 2; margin: 16px calc(-1 * max(20px, env(safe-area-inset-right))) 0 calc(-1 * max(20px, env(safe-area-inset-left)));
    padding: 12px max(20px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left));
    /* Solid, with a hairline: through a blur the post's last line showed as a grey smear above the button. */
    background: #fff; box-shadow: 0 -1px 0 var(--line); }
  .share-sheet .sh-toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .share-sheet .sh-x { right: max(18px, env(safe-area-inset-right)); }
}
@media (prefers-reduced-motion: reduce) { dialog.share-sheet[open] { animation: none; } .share-sheet * { transition: none; } }
