/* Share your results (Vantage Pulse, built as Profit Tracking, 1 Dec 2026).
 *
 * The file is named pt_share on purpose: every stylesheet is linked
 * by name in the head of every page, the pilot seller's page included,
 * and that page is pinned never to carry the word for what this
 * feature tracks (test/integration/pilot_login_test.rb).
 *
 * The share dialog only. Every rule is scoped under #profit-share, the
 * dialog's own id, so nothing here can reach another screen. The
 * dialog is a .stat-modal: a centred box on a desktop and a bottom
 * sheet on a phone, both from application.css.
 *
 * Colours follow the theme through the :root tokens. The picture
 * itself is drawn on a canvas in fixed brand colours
 * (pt_card_controller.js), so it looks the same in either theme.
 *
 * Phone rule (30 Nov 2026): nothing scrolls or swipes sideways. The
 * size buttons and the two actions wrap onto further lines, and the
 * picture is scaled to fit the width it is given, down to 320px.
 */

/* A desktop box narrower than the stat modal's 820px: the picture is
   the content. On a phone the sheet keeps its full width. */
@media (min-width: 821px) {
  #profit-share { width: min(560px, calc(100vw - 32px)); }
}

/* Anything the controller hides stays hidden, whatever display a
   button or a row would otherwise take. */
#profit-share [hidden] { display: none !important; }

#profit-share .stat-modal-body { min-width: 0; }

/* The picture: the export canvas itself, scaled down. Its own width
   and height attributes give the shape, so the tall story size
   shrinks to fit the height instead of pushing the buttons away. */
#profit-share .pt-share-stage,
#profit-share .pt-share-hold {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border-radius: 6px;
  background: var(--surface-2);
}
#profit-share .pt-share-canvas,
#profit-share .pt-share-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 44vh;
  max-height: 44dvh;
  border-radius: 4px;
}
/* Inside the iPhone app the finished picture is an image the member
   presses and holds to save, so the system menu must be allowed. */
#profit-share .pt-share-image {
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}
#profit-share .pt-share-hold p {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}

/* Square, Portrait, Story. They wrap; they never scroll. */
#profit-share .pt-share-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
#profit-share .pt-share-size {
  flex: 1 1 80px;
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: 600 14px/1 var(--font);
  cursor: pointer;
}
#profit-share .pt-share-size[aria-pressed="true"] {
  border-color: var(--mint);
  background: var(--mint);
  color: var(--navy);
}
#profit-share .pt-share-size:focus-visible {
  outline: 2px solid var(--mint-2);
  outline-offset: 2px;
}

/* Hide money amounts: the whole row is the label, so the whole row
   is the tap target. */
#profit-share .pt-share-privacy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-top: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
#profit-share .pt-share-privacy > span:first-child { min-width: 0; }

#profit-share .pt-share-error {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--danger);
}

/* Share and Download image: side by side where there is room, one
   above the other where there is not. */
#profit-share .pt-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
#profit-share .pt-share-actions .btn {
  flex: 1 1 150px;
  min-width: 0;
  min-height: 48px;
  justify-content: center;
  font-size: 16px;
}
#profit-share .pt-share-actions .btn:disabled {
  opacity: 0.6;
  cursor: default;
}

#profit-share .pt-share-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
}
