/* Product popup (opened from the product rail cards: home, FFC / FPC / RFC pages, application pages). Cards: nw-product-rail.css.
   One popup, shared by every page that includes it.
   Scope `body[class]` has the same specificity as the page-scoped selectors in make-ffc-build.css, nw-ce-page.css and nw-phone.css,
   so these rules win by load order. Colours come from the tokens in make-tokens.css. */

/* ---------- Popup ---------- */
body:has(.pl-form-dialog[open]) { overflow: hidden; }
.pl-form-dialog::backdrop { background: #101c37b3; backdrop-filter: blur(6px); }
body[class] .pl-form-dialog { width: min(1000px, calc(100% - 48px)); max-height: 90dvh; margin: auto; border: 0; padding: 0; border-radius: 9px; background: #fff; color: var(--ink, #171c29); overflow: hidden; }
body[class] .pl-form-dialog .ce-dialog-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; }

/* Close button floats over the top-right corner. The layout scrolls, the dialog does not, so the button
   (positioned against the dialog) stays put while the content scrolls, on every screen size. */
body[class] .pl-form-dialog .ce-dialog-close { position: absolute; top: 16px; right: 16px; z-index: 4; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--nw-border); border-radius: 50%; background: #f7f9fd; color: #6e83aa; cursor: pointer; }
/* ---------- Hover: PC only ----------
   Tablet / phone are touch screens, so hover means nothing there. Every hover rule waits for a real pointer on a PC-width screen. */
@media (min-width: 1280px) and (hover: hover) {
  body[class] .pl-form-dialog .ce-dialog-close:hover { background: #eaf0ff; }
  body[class] .pl-form-frame .pl-form-nav:hover { transform: none; border-color: transparent; }
  body[class] .pl-form-thumbs button:hover img { opacity: .8; }
}

/* Text column: its first line meets the top edge of the photo frame (both start 28px down). */
body[class] .pl-form-dialog .ce-dialog-body { padding: 28px 38px 28px 24px; }
body[class] .pl-form-dialog .ce-dialog-body h2 { margin-top: -.18em; padding-right: 24px; font-size: 35px; font-weight: 450; line-height: 1.15; letter-spacing: -1.2px; }
body[class] .pl-form-dialog .ce-dialog-description { margin-top: 18px; color: #65758f; font-size: var(--nw-fs-body); line-height: 1.85; }
body[class] .pl-form-dialog .ce-dialog-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 0; padding: 0; list-style: none; }
body[class] .pl-form-dialog .ce-dialog-tags > li { padding: 5px 9px; border: 1px solid var(--nw-border); border-radius: 3px; background: #f5f8ff; color: #7e92bc; font-size: var(--nw-fs-meta); line-height: 1.6; }
body[class] .pl-form-dialog .ce-dialog-brief { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--nw-border); }

/* Parameters: label over value, two columns (one on phone); long values (process chains) take the full row. */
body[class] .pl-form-params { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin-top: 12px; }
body[class] .pl-form-params > .is-wide { grid-column: 1 / -1; }
body[class] .pl-form-params dt { color: var(--nw-text-faint); font-size: var(--nw-fs-meta); line-height: 1.4; }
body[class] .pl-form-params dd { margin: 4px 0 0; color: var(--nw-ink-strong); font-size: var(--nw-fs-secondary); font-weight: 500; line-height: 1.5; }

/* Photo column: 1:1 frame, type chip pinned top-left, two cross-fading photos, arrows, thumbnail row. */
body[class] .pl-form-dialog .pl-form-stage { display: flex; flex-direction: column; justify-content: flex-start; gap: 12px; min-height: 0; height: auto; padding: 28px 20px 28px 28px; background: #fff; }
body[class] .pl-form-dialog .pl-form-frame { position: relative; box-sizing: border-box; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; border: 1px solid var(--nw-border); border-radius: 8px; background: var(--nw-surface-soft); }
body[class] .pl-form-dialog .pl-form-chip { position: absolute; top: 12px; left: 12px; z-index: 3; }
body[class] .pl-form-dialog .pl-form-chip:empty { display: none; }
body[class] .pl-form-dialog .pl-form-frame > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s ease; }
body[class] .pl-form-dialog .pl-form-frame > img.is-on { opacity: 1; }

/* Arrows are the site's .circle-button (hover included); only position is set here, and hover changes colour without lifting. */
body[class] .pl-form-frame .pl-form-nav { position: absolute; top: 50%; z-index: 2; margin-top: -18px; border: 1px solid var(--nw-border); }
body[class] .pl-form-prev { left: 12px; }
body[class] .pl-form-next { right: 12px; }
body[class] .pl-form-nav[hidden],
body[class] .pl-form-thumbs[hidden] { display: none; }

/* Thumbnails span exactly the photo width; only the picture is dimmed, the active one is full strength with a darker border. */
body[class] .pl-form-thumbs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
body[class] .pl-form-thumbs button { box-sizing: border-box; width: 100%; aspect-ratio: 1 / 1; padding: 0; border: 1px solid var(--nw-border); border-radius: 8px; overflow: hidden; background: var(--nw-surface-soft); cursor: pointer; }
body[class] .pl-form-thumbs img { position: static; display: block; width: 100%; height: 100%; object-fit: cover; opacity: .5; transition: opacity .2s; }
body[class] .pl-form-thumbs button[aria-current="true"] { border-color: #8a94a6; }
body[class] .pl-form-thumbs button[aria-current="true"] img { opacity: 1; }

@media (max-width: 820px) {
  body[class] .pl-form-dialog { width: calc(100% - 28px); border-radius: 7px; }
  body[class] .pl-form-dialog .ce-dialog-layout { grid-template-columns: 1fr; }
  body[class] .pl-form-params { grid-template-columns: 1fr; }
  body[class] .pl-form-dialog .pl-form-stage { padding: 18px 18px 6px; }
  body[class] .pl-form-dialog .ce-dialog-body h2 { font-size: 29px; }
  body[class] .pl-form-dialog .ce-dialog-description { font-size: var(--nw-fs-secondary); }
}
@media (prefers-reduced-motion: reduce) {
  body[class] .pl-form-dialog .pl-form-frame > img,
  body[class] .pl-form-thumbs img { transition: none; }
}
