/* "Publish my anonymous data" box (lib/legacy-calc-route.ts writes the markup, public/ib-calc-share.js runs it).
   IB-DESIGN-SPEC B-answer 6: a glass card in the result column under Share this result (phone: under the result).
   The script moves it into the calculator's .ib-share-slot and sets data-placed; until then it stays hidden,
   so it never shows between the steps of the phone flow. With no slot on the page it shows in place. */
#ib-share.ib-share:not([data-placed]) { display: none; }
#ib-share.ib-share[data-placed="inline"] { margin: 8px clamp(9px, 2.6vw, 28px) 0; max-width: var(--ib-shell, 1180px); }
.ib-share-slot:empty { display: none; }
.ib-share-slot { width: 100%; margin-top: 4px; }
#ib-share.ib-share {
  box-sizing: border-box;
  max-width: none;
  margin: 0;
  padding: 16px 18px;
  border-radius: var(--ib-radius-2xl);
  background: var(--ib-ui-card-surface);
  border: 1px solid var(--ib-ui-card-surface-line);
  text-align: left;
  color: var(--ib-ui-ink);
  font-family: var(--ib-font-family, inherit);
}
html.embed-mode #ib-share.ib-share { display: none !important; }
.ib-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
.ib-share-text { flex: 1 1 240px; min-width: 0; }
#ib-share .ib-share-title {
  margin: 0 0 2px;
  font-size: var(--ib-font-size-xl);
  line-height: 1.375;
  font-weight: 700;
  color: var(--ib-ui-ink);
}
#ib-share .ib-share-small {
  margin: 0;
  font-size: var(--ib-font-size-md);
  line-height: 1.45;
  color: var(--ib-ui-ink-2);
}
/* Toggle switch on the right (IB-DESIGN-SPEC B-answer 6): 51x31 track, 27px knob; on = teal. */
#ib-share .ib-share-switch {
  position: relative;
  flex: 0 0 auto;
  width: 51px;
  height: 31px;
  margin: 6px 0;
  padding: 0;
  border: 0;
  border-radius: var(--ib-radius-pill);
  background: var(--ib-ui-tint-press);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--ib-motion-quick, .15s) ease;
}
#ib-share .ib-share-switch::before { content: ''; position: absolute; inset: -7px -2px; }
#ib-share .ib-share-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--ib-ui-pick-fg);
  transition: transform var(--ib-motion-quick, .15s) ease;
}
#ib-share .ib-share-switch[aria-checked="true"] { background: var(--ib-ui-pick); }
#ib-share .ib-share-switch[aria-checked="true"] .ib-share-knob { transform: translateX(20px); }
#ib-share .ib-share-switch:focus-visible {
  outline: 2px solid var(--ib-ui-focus-on-white);
  outline-offset: 2px;
}
.ib-share-row { flex-wrap: nowrap; }
#ib-share .ib-share-note {
  display: none;
  margin: 12px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--ib-ui-line);
  font-size: var(--ib-font-size-md);
  line-height: 1.5;
  color: var(--ib-ui-ink);
}
#ib-share[data-on="yes"] .ib-share-note { display: block; }
#ib-share .ib-share-note p { margin: 0 0 4px; color: var(--ib-ui-ink); }
#ib-share .ib-share-note p:last-child { margin-bottom: 0; }
#ib-share .ib-share-note .ib-share-values { color: var(--ib-ui-ink-2); }
#ib-share .ib-share-note a { color: var(--ib-ui-paper-link); }

/* P4 r6 (spec 4.2): desktop "Share this result" sits in the share slot as a full-width secondary pill,
   12 under the note, with the Publish box 12 under it (06-share.js portals it in as .ib-share.is-slotted). */
.ib-share-host { display: contents; }
.ib-share-slot:has(> .ib-share-host > .ib-share.is-slotted) { display: flex; flex-direction: column; gap: 12px; margin-top: 0; }
.ib-share-host > .ib-share.is-slotted { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; }
.ib-share.is-slotted .ib-share-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-sizing: border-box; width: 100%; height: 48px; margin: 0; padding: 0 16px;
  border-radius: var(--ib-radius-pill);
  background: var(--ib-ui-tint);
  border: 1px solid var(--ib-ui-glass-border);
  color: var(--ib-ui-ink);
  font-family: inherit; font-size: var(--ib-font-size-lg); font-weight: 600; line-height: 1;
  cursor: pointer;
}
.ib-share.is-slotted .ib-share-btn svg { flex: 0 0 auto; }
.ib-share.is-slotted .ib-share-btn:focus-visible { outline: 2px solid var(--ib-action-navy); outline-offset: 2px; }
.ib-share.is-slotted .ib-share-msg { text-align: center; }
.ib-share.is-slotted .ib-share-msg:empty { display: none; }
