/* ============================================================
   b/p preview viewer (Nov 2026). Built on the site tokens in site.css:
   paper and ink, Inter Tight and JetBrains Mono, --u sizing, --fl and
   --fs floors. No colour: the frame and the type do the work.
   Desktop: a browser window about two thirds wide, the note beside it,
   controls under the frame and actions under the note on one line.
   Phones: a full-screen sheet, the frame on top, actions held at the foot.
   ============================================================ */
.bpv{position:fixed!important;inset:0;z-index:90!important;display:flex;flex-direction:column;color:var(--ink);font-family:var(--sans);
  --bpv-top:max(46px,calc(var(--u)*60));
  --bpv-bar:max(24px,calc(var(--u)*30));
  --bpv-tools:max(34px,calc(var(--u)*36));
  --bpv-text:clamp(250px,calc(var(--u)*380),460px);
  --bpv-gap:calc(var(--u)*44);
  --bpv-row:max(12px,calc(var(--u)*16));
  --bpv-foot:max(18px,calc(var(--u)*28));
  --bpv-vh:100vh;
  --bpv-w:min(calc(100vw - var(--pad)*2 - var(--bpv-text) - var(--bpv-gap)),calc((var(--bpv-vh) - var(--bpv-top) - var(--bpv-bar) - var(--bpv-tools) - var(--bpv-row) - var(--bpv-foot) - 8px)*1.6))}
@supports (height:100dvh){.bpv{--bpv-vh:100dvh}}
.bpv[hidden],.bpv [hidden]{display:none!important}
.bpv:focus{outline:none}
.bpv *{box-sizing:border-box}
.bpv button,.bpv a{-webkit-tap-highlight-color:transparent}
.bpv :focus-visible{outline:2px solid var(--ink);outline-offset:2px}

/* an opener is where the frame grows from, so a tap must not flash a tinted
   block over it as the preview opens */
[data-build]{-webkit-tap-highlight-color:transparent}

/* while a build is open the site's own bar steps back, so its mark and audit
   link never show through the counter and Close as the paper comes up */
html.bpv-cover .nav{opacity:0;transition:opacity .2s var(--ease)}
html.bpv-cover .dock{transform:translateY(140%)}

/* paper over the page: near opaque, so nothing behind it reads as a grey or
   coloured cloud (every pixel clear of the frame's shadow stays #f6f6f6 or
   lighter, even over a black tile) */
.bpv-bg{position:absolute;inset:0;background:rgba(255,255,255,.97);-webkit-backdrop-filter:blur(24px);backdrop-filter:blur(24px);opacity:0;transition:opacity .5s var(--ease)}
.bpv.is-in .bpv-bg{opacity:1}
.bpv.is-out .bpv-bg{opacity:0;transition-duration:.45s}

/* ---------- top: where you are, and the way out ---------- */
.bpv-top{position:relative;flex:none;height:var(--bpv-top);display:flex;align-items:center;justify-content:space-between;padding:0 var(--pad);opacity:0;transition:opacity .45s var(--ease)}
.bpv.is-in .bpv-top{opacity:1}
.bpv.is-opening .bpv-top{transition-delay:.12s}
.bpv-step{display:flex;align-items:center;gap:calc(var(--u)*4)}
.bpv-arrow,.bpv-close{font-family:var(--mono);text-transform:uppercase;letter-spacing:.02em;font-size:var(--fl);background:transparent;color:var(--ink);box-shadow:inset 0 0 0 1px #cfcfcf;display:inline-flex;align-items:center;justify-content:center;transition:background .25s,color .25s,box-shadow .25s,transform .16s var(--ease)}
.bpv-arrow{width:max(34px,calc(var(--u)*38));height:max(30px,calc(var(--u)*32));font-size:max(13px,calc(var(--u)*13))}
@media (hover:hover){.bpv-arrow:hover,.bpv-close:hover{background:var(--ink);color:#fff;box-shadow:inset 0 0 0 1px var(--ink)}}
.bpv-arrow:active,.bpv-close:active{transform:scale(.96)}
.bpv-count{font-family:var(--mono);font-size:var(--fl);letter-spacing:.02em;color:var(--soft);min-width:8ch;text-align:center;font-variant-numeric:tabular-nums}
.bpv-count b{font-weight:400;color:var(--ink)}
.bpv-close{margin-left:auto;gap:calc(var(--u)*12);height:max(30px,calc(var(--u)*32));padding:0 calc(var(--u)*13)}
.bpv-x{position:relative;width:9px;height:9px;display:inline-block}
.bpv-x::before,.bpv-x::after{content:"";position:absolute;left:50%;top:-1px;width:1px;height:11px;background:currentColor;transform:rotate(45deg)}
.bpv-x::after{transform:rotate(-45deg)}

/* ---------- body: centred when it fits, scrolls when it does not ---------- */
.bpv-body{position:relative;flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column}
.bpv-grid{margin:auto 0;display:grid;grid-template-columns:var(--bpv-w) var(--bpv-text);grid-template-areas:"win copy" "tools acts";column-gap:var(--bpv-gap);row-gap:var(--bpv-row);justify-content:center;padding:0 var(--pad) var(--bpv-foot)}

/* ---------- the window ---------- */
.bpv-win{grid-area:win;position:relative;isolation:isolate;background:#fff;transform-origin:0 0;box-shadow:0 0 0 1px rgba(17,17,17,.09);transition:box-shadow .3s var(--ease),background-color .3s var(--ease)}
/* a short, soft shadow: it lifts the frame without greying the band under it */
.bpv-win::after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;box-shadow:0 calc(var(--u)*28) calc(var(--u)*56) calc(var(--u)*-28) rgba(0,0,0,.14),0 calc(var(--u)*4) calc(var(--u)*12) rgba(0,0,0,.05);opacity:0;transition:opacity .8s var(--ease)}
.bpv.is-in .bpv-win::after{opacity:1}
.bpv.is-out .bpv-win::after{opacity:0;transition-duration:.3s}
.bpv-bar{position:relative;height:var(--bpv-bar);display:flex;align-items:center;justify-content:center;background:#f6f6f6;border-bottom:1px solid #e5e5e5;transition:opacity .3s var(--ease)}
.bpv-dots{position:absolute;left:calc(var(--u)*12);top:50%;transform:translateY(-50%);display:flex;gap:max(5px,calc(var(--u)*6))}
.bpv-dots i{width:max(7px,calc(var(--u)*8));height:max(7px,calc(var(--u)*8));border-radius:50%;box-shadow:inset 0 0 0 1px #cbcbcb}
.bpv-url{font-family:var(--mono);font-size:var(--fl);letter-spacing:0;color:var(--soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:62%}
.bpv-play{position:absolute;right:max(4px,calc(var(--u)*6));top:50%;transform:translateY(-50%);width:max(28px,calc(var(--u)*30));height:max(22px,calc(var(--u)*24));display:grid;place-items:center;color:var(--soft);transition:color .2s}
@media (hover:hover){.bpv-play:hover{color:var(--ink)}}
.bpv-play i{display:block;width:8px;height:9px;border-left:2px solid currentColor;border-right:2px solid currentColor}
.bpv-play.is-paused i{width:0;height:0;border-style:solid;border-width:5px 0 5px 8px;border-color:transparent transparent transparent currentColor}

.bpv-scr{position:relative;aspect-ratio:16/10;overflow:hidden;background:#ececec;transition:background-color .3s var(--ease)}
.bpv-scr>*{position:absolute;inset:0;width:100%;height:100%}
/* two layers: the build on show (.is-front), and under it, while the next one
   fades in over it, the one it replaces (.is-under). Each carries its own
   neutral frame, so a missing still never shows an empty window. */
.bpv-m{opacity:0;background:#ececec;transition:background-color .3s var(--ease)}
.bpv-m.is-under{opacity:1;z-index:1}
.bpv-m.is-front{opacity:1;z-index:2}
.bpv-m>*{position:absolute;inset:0;width:100%;height:100%}
.bpv-blank{display:flex;align-items:center;justify-content:center;padding:0 8%;text-align:center;font-size:calc(var(--u)*56);line-height:.95;letter-spacing:-.04em;color:#c3c3c3;transition:opacity .3s var(--ease)}
.bpv-m.has-img .bpv-blank{visibility:hidden}
.bpv-poster,.bpv-clip{object-fit:cover;display:block;transition:opacity .32s var(--ease)}
.bpv-clip{opacity:0}
.bpv-m.is-playing .bpv-clip{opacity:1}

/* try it: the real site, at a true 1440 x 900 (or 390 x 844) scaled to fit */
.bpv-live{z-index:3;overflow:hidden;opacity:0;transition:opacity .5s var(--ease)}
.bpv-scr.is-live .bpv-m .bpv-clip,.bpv-scr.is-live .bpv-m .bpv-blank{opacity:0}
.bpv-scr.is-live:not(.is-loading):not(.is-missing) .bpv-live{opacity:1}
.bpv-live iframe{position:absolute;left:0;top:0;border:0;display:block;background:#fff;transform-origin:0 0}
/* the phone stands on the paper: no browser window around a handset, and the
   screen does not clip, so the handset's shadow falls on the paper instead of
   stopping in a hard line at the frame's edge */
.bpv[data-view="live-phone"] .bpv-scr,.bpv[data-view="live-phone"] .bpv-live{overflow:visible}
.bpv[data-view="live-phone"] .bpv-bar{opacity:0;pointer-events:none}
.bpv[data-view="live-phone"] .bpv-win{background:transparent;box-shadow:none}
.bpv.is-in[data-view="live-phone"] .bpv-win::after{opacity:0;transition-duration:.3s}
.bpv[data-view="live-phone"] .bpv-scr,.bpv[data-view="live-phone"] .bpv-m{background:transparent}
.bpv-scr.is-phone .bpv-m>*{opacity:0}
.bpv-phone{position:absolute;left:0;top:0;width:414px;height:868px;padding:12px;border-radius:60px;background:#111;transform-origin:0 0;box-shadow:0 40px 80px -36px rgba(0,0,0,.3)}
.bpv-phone-scr{position:relative;width:390px;height:844px;border-radius:48px;overflow:hidden;background:#fff}
.bpv-phone iframe{position:static;transform:none}
.bpv-load{z-index:4;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;font-family:var(--mono);text-transform:uppercase;letter-spacing:.02em;font-size:var(--fl);color:var(--ink);background:rgba(255,255,255,.74);opacity:0;pointer-events:none;transition:opacity .35s var(--ease)}
.bpv-load:empty{display:none}
.is-loading .bpv-load,.is-missing .bpv-load{opacity:1}
.bpv-load::after{content:"";width:max(90px,calc(var(--u)*130));height:1px;background:linear-gradient(90deg,transparent,var(--ink),transparent) no-repeat,#d2d2d2;background-size:40% 100%,100% 100%;animation:bpvrun 1.4s var(--ease) infinite}
.is-missing .bpv-load::after{animation:none;background:#d2d2d2}
@keyframes bpvrun{from{background-position:-100% 0,0 0}to{background-position:200% 0,0 0}}

/* ---------- under the frame: how to look at it ---------- */
.bpv-tools{grid-area:tools;display:flex;justify-content:space-between;align-items:center;gap:12px;min-width:0}
/* Preview or Try it: a two-part switch on the frame's own edge. The part in
   use is filled, its node lit; the other is a plain button with an open ring,
   the guide thread's unlit node. */
.bpv-mode{display:inline-flex;background:#fff;box-shadow:inset 0 0 0 1px #cfcfcf}
.bpv-mode button{position:relative;display:inline-flex;align-items:center;gap:.8em;font-family:var(--mono);text-transform:uppercase;letter-spacing:.02em;font-size:var(--fl);min-height:max(32px,calc(var(--u)*34));padding:0 calc(var(--u)*14) 0 calc(var(--u)*12);color:var(--ink);transition:background-color .25s,color .25s}
.bpv-mode button+button{box-shadow:inset 1px 0 0 #cfcfcf}
.bpv-mode button::before{content:"";flex:none;width:6px;height:6px;border-radius:50%;background:transparent;box-shadow:inset 0 0 0 1px currentColor;transition:background-color .25s}
.bpv-mode button[aria-pressed="true"]{background:var(--card)}
.bpv-mode button[aria-pressed="true"]::before{background:currentColor}
@media (hover:hover){.bpv-mode button[aria-pressed="false"]:hover{background:var(--ink);color:#fff}}
/* Desktop or Phone: the quiet switch from the menu, grey words, the chosen
   one in ink with its dot hung to the left of the word */
.bpv-seg:not(.bpv-mode){display:inline-flex;align-items:center;gap:calc(var(--u)*24)}
.bpv-seg:not(.bpv-mode) button{position:relative;font-family:var(--mono);text-transform:uppercase;letter-spacing:.02em;font-size:var(--fl);min-height:30px;padding:4px 0;color:var(--soft);transition:color .25s}
.bpv-seg:not(.bpv-mode) button::before{content:"";position:absolute;left:-11px;top:50%;width:5px;height:5px;margin-top:-3px;border-radius:50%;background:var(--ink);transform:scale(0);transition:transform .35s var(--ease)}
.bpv-seg:not(.bpv-mode) button[aria-pressed="true"]{color:var(--ink)}
@media (hover:hover){.bpv-seg:not(.bpv-mode) button:hover{color:var(--ink)}}
.bpv-seg:not(.bpv-mode) button[aria-pressed="true"]::before{transform:none}

/* ---------- beside the frame: the note ---------- */
.bpv-copy{grid-area:copy;display:flex;flex-direction:column;min-width:0}
.bpv-ghost{position:absolute;margin:0;pointer-events:none;z-index:1}
.bpv-meta{font-family:var(--mono);text-transform:uppercase;letter-spacing:.02em;font-size:var(--fl);color:var(--soft)}
.bpv-name{font-size:calc(var(--u)*60);font-weight:400;line-height:.94;letter-spacing:-.042em;margin-top:calc(var(--u)*14);text-wrap:balance;overflow-wrap:anywhere}
.bpv-blurb{font-size:max(16px,calc(var(--u)*18));line-height:1.38;letter-spacing:-.01em;color:var(--ink2);margin-top:calc(var(--u)*24);max-width:36ch;text-wrap:pretty}
.bpv-end{margin-top:auto;padding-top:calc(var(--u)*28)}
.bpv-notice{display:flex;gap:calc(var(--u)*10);font-size:var(--fs);line-height:1.4;color:var(--ink);padding-top:calc(var(--u)*12);border-top:1px solid var(--line)}
.bpv-notice .t{text-wrap:balance}   /* two or three lines, evened out: no lone last word */
.bpv-notice .ar{font-family:var(--mono);color:var(--soft);flex:none}
.bpv-tags{list-style:none;display:flex;flex-wrap:wrap;row-gap:4px;margin-top:calc(var(--u)*14);font-family:var(--mono);text-transform:uppercase;letter-spacing:.02em;font-size:var(--fl);color:var(--soft)}
.bpv-tags li{white-space:nowrap}
.bpv-tags li:not(:last-child)::after{content:"\00b7";margin:0 .75em;color:#9a9a9a}
.bpv-acts{grid-area:acts;display:flex;flex-wrap:wrap;gap:calc(var(--u)*6);align-items:center;container-type:inline-size}
.bpv-acts .btn{min-height:max(34px,calc(var(--u)*36));padding:calc(var(--u)*10) calc(var(--u)*15)}
/* a narrow note keeps both actions on one row: "Read the case study" becomes "Case study" */
@container (max-width:360px){.bpv-long{display:none}}

/* ---------- arriving and leaving (moving between builds is in viewer.js) ---------- */
.bpv-copy,.bpv-tools,.bpv-acts{opacity:0;transform:translateY(12px);transition:opacity .42s var(--ease),transform .55s var(--ease)}
.bpv.is-in .bpv-copy,.bpv.is-in .bpv-tools,.bpv.is-in .bpv-acts{opacity:1;transform:none}
/* the words wait until the paper under them is opaque, so nothing of the page
   behind ghosts through them while the frame grows */
.bpv.is-opening .bpv-copy,.bpv.is-opening .bpv-tools,.bpv.is-opening .bpv-acts{transition-delay:.38s}
.bpv.is-opening .bpv-acts{transition-delay:.46s}
.bpv.is-out .bpv-copy,.bpv.is-out .bpv-tools,.bpv.is-out .bpv-acts,.bpv.is-out .bpv-top{opacity:0;transition-duration:.2s;transition-delay:0s}

/* ---------- tablets: a narrower note ---------- */
@media (min-width:821px) and (max-width:1100px){
  .bpv{--bpv-gap:28px}
  .bpv-name{font-size:max(34px,calc(var(--u)*60))}
}

/* ---------- phones: a full-screen sheet ---------- */
@media (max-width:820px){
  .bpv{--bpv-top:52px}
  .bpv-bg{background:#fff;-webkit-backdrop-filter:none;backdrop-filter:none}
  .bpv-top{padding:0 16px;border-bottom:1px solid var(--line);background:#fff}
  .bpv-step{gap:4px}
  .bpv-arrow{width:44px;height:40px;font-size:14px}
  .bpv-close{height:40px;padding:0 14px;gap:10px;font-size:11px}
  .bpv-count{font-size:11px;min-width:7.5ch}
  .bpv-body{display:block;-webkit-overflow-scrolling:touch}
  .bpv-grid{display:flex;flex-direction:column;min-height:100%;margin:0;padding:14px 16px 0}
  .bpv-win{width:100%}
  .bpv-bar{height:26px}
  .bpv-dots{left:10px;gap:5px}
  .bpv-dots i{width:7px;height:7px}
  .bpv-url{font-size:11px;max-width:58%}
  .bpv-play{right:4px;width:32px;height:26px}
  .bpv-blank{font-size:30px}
  .bpv-tools{display:none}
  .bpv-copy{padding:22px 0 28px}
  .bpv-meta{font-size:11px}
  .bpv-name{font-size:40px;margin-top:10px}
  .bpv-blurb{font-size:17px;line-height:1.4;margin-top:16px;max-width:none}
  .bpv-end{margin-top:0;padding-top:22px}
  .bpv-notice{font-size:15.5px;gap:10px;padding-top:12px}
  .bpv-tags{font-size:11px;margin-top:14px}
  .bpv-acts{position:sticky;bottom:0;z-index:2;flex-wrap:nowrap;gap:8px;margin:auto -16px 0;padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px));background:rgba(255,255,255,.95);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-top:1px solid var(--line)}
  .bpv-acts .btn{flex:1 1 0;justify-content:space-between;min-height:46px;padding:14px;font-size:11.5px}
  .bpv-acts .bpv-case{flex:0 1 auto}
  .bpv-long{display:none}
  /* the sheet does not rise on open; only the swap between builds travels */
  .bpv .bpv-copy,.bpv .bpv-acts{transform:none}
}

@media (prefers-reduced-motion:reduce){
  .bpv,.bpv *{transition-duration:.01ms!important;transition-delay:0s!important;animation:none!important}
}
