/* Hallmark · the Facebook & Instagram onboarding path (epic 89274, sc-89283) · theme: UpHex brand (locked, Living Town)
 * Ported from the approved prototype prototypes/pack-onboarding-meta (meta.css). Loaded after pack_report_shared.css and
 * pack_onboard.css and scoped to the Meta path's root, so the Google steps never see a rule from here. Only what the Meta
 * path adds lives here: the goal objective line, the area size bubble, the budget math card, and the ad preview phone.
 * The prototype's :has(#id:checked) selectors became the port's conventions: onboard_live.js lights .is-on from
 * data-when, and the ad preview keys on the picked radio's position, so every state also works without script.
 */
.pack-onboard[data-path="meta"] {
  /* illustration-only colours for the stand-in ad artwork. They paint the business's ad, not UpHex chrome,
     so they sit outside the locked brand set (design.md: copper-style colours are illustration-only). */
  --ad-ember: oklch(62% 0.17 38);
  --ad-amber: oklch(78% 0.14 70);
  --ad-cream: oklch(96% 0.03 85);
  --ad-bean: oklch(32% 0.05 40);
  --ad-lime: oklch(80% 0.15 128);
  --ad-dusk: oklch(42% 0.10 300);
  --ad-sunset: oklch(70% 0.16 20);
  --ad-sage: oklch(58% 0.07 150);
  --ad-linen: oklch(93% 0.02 95);
  --ad-shadow: oklch(20% 0.03 40 / 0.35);
  --ad-cream-faint: oklch(100% 0 0 / 0.35);
  --ad-glass: oklch(100% 0 0 / 0.22);

  /* ------------------------------------------------------------------ goals: what Meta optimizes for */
  .pick__body em.meta-obj { font-style: normal; font-size: var(--text-xs); font-weight: 700; color: var(--color-blue-deep); }

  /* ------------------------------------------------------------------ area: Meta's size for the circle (area_sizes.js fills it) */
  .size[hidden] { display: none; }
  .size-note { font-weight: 600; color: var(--color-muted); }
  .size-note:empty { display: none; }

  /* ------------------------------------------------------------------ audience slip: the plan's total */
  .slip__total-note { text-wrap: pretty; }

  /* ------------------------------------------------------------------ budget: the math card shows its working, one line per input */
  .calc { display: grid; margin-top: var(--space-xs); }
  .calc__row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: baseline; gap: var(--space-sm); padding: 8px 0; border-top: 1px solid var(--color-hair); font-size: var(--text-sm); font-weight: 700; }
  .calc__row:first-child { border-top: 0; }
  .calc__op { font: 800 var(--text-base)/1 var(--font-display); color: var(--color-blue); text-align: center; }
  .calc__label { min-width: 0; }
  .calc__label small { display: block; font-size: var(--text-xs); font-weight: 500; color: var(--color-muted); }
  .calc__value { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .calc__row--sum { border-top: 2px solid var(--color-navy); }
  .calc__row--sum .calc__value { font: 800 var(--text-xl)/1 var(--font-display); letter-spacing: -0.03em; color: var(--color-blue-deep); }
  .calc__src { display: inline-flex; align-items: center; gap: 5px; margin-top: 2px; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--color-soft-blue); color: var(--color-blue-deep); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.02em; }
  .calc__check { display: flex; align-items: center; gap: var(--space-xs); margin: var(--space-xs) 0 0; padding: 8px 10px; border-radius: var(--radius-field); background: var(--color-canvas); font-size: var(--text-xs); font-weight: 700; }
  .calc__check .dot { background: var(--color-teal); }
  .calc__check--short .dot { background: var(--color-blue); }
  .calc__check:has([data-custom-check]:empty) { display: none; }
  /* no benchmark: no suggestions, the custom amount carries the step */
  .money-split[data-custom-split].is-on { display: block; }

  /* ------------------------------------------------------------------ ready: a setup row still to come (sc-89284) */
  .split__tick--pending { background: transparent; box-shadow: inset 0 0 0 2px var(--color-hair); }
  .meta-assets { display: grid; gap: var(--space-md); }
  .meta-assets__group { min-width: 0; margin: 0; padding: 0; border: 0; }
  .meta-assets__group legend { padding: 0; margin-bottom: var(--space-xs); }

  /* ------------------------------------------------------------------ ads: the preview phone on a scrimmed town */
  .adstage { position: relative; display: grid; place-items: center; gap: var(--space-md); padding: var(--space-xl) var(--space-md); border-radius: var(--radius-panel); overflow: hidden; background: var(--color-navy-deep); }
  .adstage__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.35; }
  .adstage > :not(.adstage__bg) { position: relative; }
  .placements { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .placements li { padding: 4px 10px; border-radius: var(--radius-pill); background: var(--color-fill-on-navy); box-shadow: inset 0 0 0 1px var(--color-line-on-navy-strong); color: var(--color-on-navy-2); font-size: var(--text-xs); font-weight: 700; transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out); }
  &:has(input[name="preview_format"][value="feed"]:checked) .placements [data-place="feed"],
  &:has(input[name="preview_format"][value="story"]:checked) .placements [data-place="story"],
  &:has(input[name="preview_format"][value="reel"]:checked) .placements [data-place="reel"] { background: var(--color-blue); color: var(--color-surface); box-shadow: none; }

  /* the screen is a real phone screen (about 9:19.5) in every format. Feed scrolls: the post sits at the top and the
     next one peeks below. Story and reel fill the screen with the creative, and the UI floats on top. */
  .adphone { width: min(252px, 100%); padding: 9px; border-radius: 42px; background: var(--color-navy); box-shadow: 0 0 0 1px var(--color-line-on-navy-strong), var(--shadow-lift); }
  .adphone__screen { position: relative; display: flex; flex-direction: column; aspect-ratio: 9 / 19.5; border-radius: 33px; overflow: hidden; background: var(--color-surface); color: var(--color-navy); }
  .ad__head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; font-size: 0.78rem; line-height: 1.2; }
  .ad__avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--ad-ember); color: var(--ad-cream); font: 800 0.7rem/1 var(--font-display); box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 3.5px var(--ad-amber); }
  .ad__who { min-width: 0; }
  .ad__who strong { display: block; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ad__who span { color: var(--color-muted); font-size: 0.7rem; }
  .ad__more { margin-left: auto; color: var(--color-muted); font-weight: 800; letter-spacing: 1px; }
  .ad__creative { position: relative; flex: none; aspect-ratio: 4 / 5; overflow: hidden; transition: aspect-ratio var(--dur-long) var(--ease-out); }
  .ad__cta { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: var(--color-canvas); font-size: 0.78rem; font-weight: 800; }
  .ad__cta > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ad__cta small { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--color-muted); font-size: 0.66rem; font-weight: 600; }
  .ad__cta b { padding: 6px 12px; border-radius: 8px; background: var(--color-rule); white-space: nowrap; }
  .ad__icons { display: flex; gap: 14px; padding: 10px 12px 4px; }
  .ad__icons svg, .ad__rail svg { width: 20px; height: 20px; fill: none; stroke: var(--color-navy); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .ad__caption { padding: 0 12px 14px; font-size: 0.74rem; line-height: 1.4; }
  .ad__caption b { font-weight: 800; }
  .ad__rail { display: none; }
  .ad__rail svg { width: 22px; height: 22px; stroke: var(--ad-cream); filter: drop-shadow(0 1px 3px var(--ad-shadow)); }
  .ad__peek { height: 200px; margin: 6px 12px 0; border-radius: 10px; background: var(--color-canvas); }
  .ad__reelfoot { display: none; }
  .ad__reelfoot b { font-weight: 800; }

  /* the creative: the owner's photo when ai-service hosted one; otherwise a text-on-colour stand-in, said so on the page */
  .art { position: absolute; inset: 0; display: grid; align-content: space-between; padding: 22px 20px; }
  .art > div { position: relative; z-index: 1; }
  .art__photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .art__kicker { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
  .art__head { font: italic 600 1.9rem/0.98 var(--font-editorial); letter-spacing: -0.02em; text-wrap: balance; overflow-wrap: anywhere; }
  .art__price { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: var(--radius-pill); font: 800 0.8rem/1.4 var(--font-display); }
  .art__plate { position: absolute; right: -18%; bottom: -14%; width: 78%; aspect-ratio: 1; }
  .art--ember { background: radial-gradient(120% 90% at 85% 90%, var(--ad-amber), var(--ad-ember) 55%, var(--ad-bean)); color: var(--ad-cream); }
  .art--ember .art__price { background: var(--ad-cream); color: var(--ad-ember); }
  .art--dusk { background: radial-gradient(120% 90% at 80% 95%, var(--ad-sunset), var(--ad-dusk) 70%); color: var(--ad-cream); }
  .art--dusk .art__price { background: var(--ad-lime); color: var(--ad-bean); }
  .art--sage { background: radial-gradient(120% 90% at 85% 90%, var(--ad-linen), var(--ad-sage) 70%); color: var(--ad-bean); }
  .art--sage .art__price { background: var(--ad-bean); color: var(--ad-linen); }
  .p-cream { fill: var(--ad-cream); }
  .p-rim { fill: none; stroke: var(--ad-shadow); stroke-width: 2; }
  .p-bean { fill: var(--ad-bean); }
  .p-ember { fill: var(--ad-ember); }
  .p-amber { fill: var(--ad-amber); }
  .p-lime { fill: var(--ad-lime); }
  .p-edge { stroke: var(--ad-bean); stroke-width: 3; stroke-opacity: 0.35; }

  /* which ad the phone shows: the nth picked radio shows [data-ad="n"] (at most three drafts, contract 2) */
  [data-ad] { display: none; }
  &:has(.ad-picks .pick:nth-child(1) input:checked) [data-ad="1"],
  &:has(.ad-picks .pick:nth-child(2) input:checked) [data-ad="2"],
  &:has(.ad-picks .pick:nth-child(3) input:checked) [data-ad="3"] { display: inline; }
  &:has(.ad-picks .pick:nth-child(1) input:checked) .art[data-ad="1"],
  &:has(.ad-picks .pick:nth-child(2) input:checked) .art[data-ad="2"],
  &:has(.ad-picks .pick:nth-child(3) input:checked) .art[data-ad="3"] { display: grid; }

  /* story + reel: full-bleed, header and CTA float over the creative */
  &:is(:has([value="story"]:checked), :has([value="reel"]:checked)) {
    .adphone__screen { display: block; }
    .ad__creative { position: absolute; inset: 0; aspect-ratio: auto; }
    .ad__head { position: absolute; z-index: 3; left: 0; right: 0; top: 10px; color: var(--ad-cream); }
    .ad__who span, .ad__more { color: var(--ad-cream); opacity: 0.8; }
    .ad__icons, .ad__caption, .ad__peek { display: none; }
    .ad__cta { position: absolute; z-index: 3; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 0; background: none; }
    .ad__cta > span { display: none; }
    .ad__cta b { padding: 9px 18px; border-radius: var(--radius-pill); background: var(--color-surface); box-shadow: 0 6px 18px var(--ad-shadow); }
    .art { padding-top: 64px; align-content: start; gap: 8px; }
    .art__head { font-size: 2rem; }
    .art__plate { right: -20%; bottom: 14%; width: 92%; }
  }
  &:has([value="story"]:checked) .ad__creative::before { content: ""; position: absolute; z-index: 3; left: 12px; right: 12px; top: 6px; height: 2.5px; border-radius: 2px; background: linear-gradient(90deg, var(--ad-cream) 38%, var(--ad-cream-faint) 38%); }
  /* reel chrome: the caption and a sponsored strip sit bottom-left, the CTA is a full-width bar above them */
  &:has([value="reel"]:checked) {
    .ad__rail { position: absolute; z-index: 3; right: 10px; bottom: 20px; display: grid; gap: 14px; }
    .ad__reelfoot { position: absolute; z-index: 3; left: 12px; right: 52px; bottom: 16px; display: grid; gap: 4px; color: var(--ad-cream); font-size: 0.7rem; line-height: 1.35; text-shadow: 0 1px 3px var(--ad-shadow); }
    .ad__head { display: none; }
    .ad__cta { left: 12px; right: 52px; bottom: 74px; transform: none; }
    .ad__cta b { display: block; text-align: center; border-radius: 8px; }
    .art { padding-top: 40px; }
    .art__plate { bottom: 26%; }
  }

  /* format switch: a segmented control built from radios */
  .seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-rule-strong); }
  .seg label { display: grid; place-items: center; min-height: 44px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: 800; color: var(--color-muted); cursor: pointer; transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out); }
  .seg label:has(input:checked) { background: var(--color-navy); color: var(--color-surface); }
  .seg label:has(input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 2px; }

  &.motion .art__plate { animation: pack-onboard-meta-plate 900ms var(--ease-out) 0.5s both; }
}
@keyframes pack-onboard-meta-plate { from { opacity: 0; transform: translate(12%, 12%) rotate(-18deg); } }
