/* Apps opened in the browser (spec 013): the viewer of /apps/bank-app/ and
   /apps/my-health/ — the apps' own Showcase: a highlighted phone in the free area
   and a case panel with its own scroll on the right, on a light plate of the site.
   Their cards on /apps/ are styled in css/apps.css («Phone preview»).
   Chrome (.hdr, .mini, .dock, .ftr) is never styled here (COMPONENTS.md, law 2). */

/* Short groups that stay on one line (Core/ui/typography: links, not the whole line). */
.pc-nw { white-space: nowrap; }

/* ---------- Viewer ---------- */
.lab--catalog-viewer {
  /* Keep the panel's layout scale independent from its reading scale:
     wider screens add room for scenarios without oversized text (Alexa, 29.10.2026). */
  --pcv-vw: tan(atan2(100vw - 1536px, 1px));
  --pcv-kc: clamp(1, 1 + var(--pcv-vw) * 0.1 / 1000, 1.1);
  --pcv-panel: calc(380px * max(1, 1 + var(--pcv-vw) * 0.5 / 1000));
  --pcv-ink: #171719;
  --pcv-ink-2: #3a3a3e;
  --pcv-mute: #5c5c60;
  --pcv-page: #ffffff;
  --pcv-dock: 72px;   /* the bottom-right Menu sits over the plate's last 40 px */
}
.pcv[data-kind="health"] { --pcv-page: #f5f5f2; }
/* Full-display My Health: the app supplies safe areas and its edge backdrop. */
.pcv[data-kind="health"] .pcv-app { top: 0; height: 100%; filter: opacity(1); }
.pcv[data-kind="health"] .pcv-status { background: transparent; pointer-events: none; }
.pcv[data-kind="health"] .pcv-device[data-status-light] .pcv-status { color: #fff; }
.pcv[data-kind="health"] .pcv-device[data-status-light] .pcv-homebar { background: #fff; }
.pcv[data-kind="state"] { --pcv-page: #f3f4f6; }  /* My State --page */
/* The viewer is one screen: nothing to scroll, and nothing an app can scroll. */
html:has(> body.lab--catalog-viewer), body.lab--catalog-viewer { overflow: clip; }
.pcv { position: relative; z-index: 5; color: var(--pcv-ink); }
.pcv-shell {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100svh;
  padding: var(--hdr-h) var(--g) var(--g);
}
.pcv-plate {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--pcv-panel);
  overflow: hidden;
  border-radius: 20px;
  background: radial-gradient(120% 90% at 35% 0%, #e9e9ee 0%, #dcdce3 100%);
}
/* The panel comes first in the document (keyboard and screen readers reach the
   scenarios before the app's own controls); on screen it stays on the right. */
.pcv-view { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pcv-plate > .pcv-panel { grid-column: 2; grid-row: 1; }
.pcv-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* The phone: the apps' Showcase device, scaled to the free area by catalog.js
   and centred on it whatever its unscaled size. */
.pcv-pair {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: flex-start;
  gap: 56px;
  transform: translate(-50%, -50%) scale(var(--k, 1));
  transform-origin: center center;
}
.pcv-device { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 0; }
.pcv-device[data-off] { display: none; }
.pcv-phone {
  position: relative;
  box-sizing: border-box;
  width: 417px;
  height: 876px;
  padding: 12px;
  border-radius: 62px;
  background: #0b0b0c;
  box-shadow:
    0 0 0 2px #2b2b2f, 0 0 0 3px #4a4a50, 0 0 0 5px #2b2b2f,
    0 50px 90px rgba(20, 20, 30, 0.28), 0 18px 36px rgba(20, 20, 30, 0.18);
}
.pcv-key { position: absolute; width: 4px; border-radius: 2px; background: #4a4a50; }
.pcv-key--action { left: -8px; top: 18%; height: 34px; }
.pcv-key--up { left: -8px; top: 25%; height: 64px; }
.pcv-key--down { left: -8px; top: 34%; height: 64px; }
.pcv-key--side { right: -8px; top: 28%; height: 100px; }
.pcv-screen {
  position: relative;
  width: 393px;
  height: 852px;
  overflow: hidden;
  isolation: isolate;
  border-radius: 50px;
  background: var(--pcv-page);
  clip-path: inset(0 round 50px);
  /* Chrome paints the app's own layers (its fixed, blurred tab bar) past a
     rounded clip-path; the mask keeps them inside the corners (.ha-screen). */
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}
.pcv-status {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 6px 30px 0 44px;
  box-sizing: border-box;
  background: var(--pcv-page);
  color: #171719;
  font: 600 17px/1 -apple-system, "SF Pro Text", system-ui, sans-serif;
  letter-spacing: -0.2px;
}
.pcv-icons { display: flex; gap: 6px; align-items: center; }
.pcv-island {
  position: absolute;
  top: 11px;
  left: 50%;
  z-index: 3;
  width: 124px;
  height: 36px;
  border-radius: 20px;
  background: #000;
  translate: -50% 0;
}
.pcv-app {
  position: absolute;
  left: 0;
  top: 54px;
  z-index: 1;
  display: block;
  width: 100%;
  height: calc(100% - 54px);
  border: 0;
  background: var(--pcv-page);
}
.pcv-homebar {
  position: absolute;
  left: 50%;
  bottom: 8px;
  z-index: 3;
  width: 134px;
  height: 5px;
  border-radius: 3px;
  background: #111113;
  opacity: 0.9;
  pointer-events: none;
  translate: -50% 0;
}
.pcv-label { display: none; margin: 0; font: 500 15px/20px "Inter", sans-serif; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pcv-mute); }
.pcv[data-both] .pcv-label { display: block; }
.pcv[data-both]:not([data-side-by-side]) .pcv-label { display: none; }

/* Loading failed / calls off: inside the stage, never over the panel. */
.pcv-message {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(320px, calc(100% - 32px));
  padding: 24px;
  box-sizing: border-box;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(20, 20, 30, 0.18);
  text-align: center;
  translate: -50% -50%;
}
.pcv-message[hidden] { display: none; }
.pcv-message p { margin: 0; font: 400 18px/26px "Inter", sans-serif; }
.pcv-toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 4;
  max-width: min(360px, calc(100% - 32px));
  margin: 0;
  padding: 12px 18px;
  box-sizing: border-box;
  border-radius: 14px;
  background: #171719;
  color: #eaeaea;
  font: 400 15px/20px "Inter", sans-serif;
  text-align: center;
  translate: -50% 0;
}
.pcv-toast[hidden] { display: none; }

/* The case panel. */
.pcv-panel {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 40px 28px calc(var(--pcv-dock) + 8px);
  border-left: 1px solid rgba(23, 23, 25, 0.08);
  background: rgba(255, 255, 255, 0.55);
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 23, 25, 0.24) transparent;
}
.pcv-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; }
.pcv-crumb {
  margin: 0;
  font: 500 calc(13px * var(--pcv-kc)) / 1.25 "Inter", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pcv-mute);
}
.pcv-crumb a {
  display: inline-block;
  padding: 12px 0;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  transition: text-decoration-color var(--lab-out) linear;
}
.pcv-crumb a:hover, .pcv-crumb a:active { text-decoration-color: currentColor; transition-duration: var(--lab-in); }
.pcv-crumb a:focus-visible { outline: 2px solid var(--pcv-ink); outline-offset: 2px; border-radius: 4px; }
.pcv-title {
  margin: 8px 0 0;
  font: 400 calc(36px * var(--pcv-kc)) / 1.15 "Inter", sans-serif;
  letter-spacing: -0.035em;
}
.pcv-meta {
  margin: 16px 0 0;
  font: 500 calc(13px * var(--pcv-kc)) / 1.4 "Inter", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pcv-mute);
}
.pcv-lead {
  max-width: 34ch;
  margin: 24px 0 0;
  font: 300 calc(16px * var(--pcv-kc)) / 1.6 "Inter", sans-serif;
  color: var(--pcv-ink-2);
  text-wrap: pretty;
}
/* The licence line of a photo inside the app (My State). */
.pcv-credit {
  max-width: 40ch;
  margin: 12px 0 0;
  font: 400 calc(12px * var(--pcv-kc)) / 1.45 "Inter", sans-serif;
  color: var(--pcv-mute);
}
.pcv-credit a { color: inherit; text-underline-offset: 3px; }
.pcv-credit a:focus-visible { outline: 2px solid var(--pcv-ink); outline-offset: 2px; border-radius: 2px; }
.pcv-tabs { margin-top: 24px; }
.pcv-tabs .cs-tab { padding-inline: 16px; }
.pcv-groups { display: flex; flex-direction: column; gap: 36px; margin-top: 36px; }
.pcv-group-title {
  margin: 0 0 14px;
  font: 500 calc(12px * var(--pcv-kc)) / 1.35 "Inter", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pcv-mute);
}
.pcv-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
/* Scenario tiles, not CTA buttons: a phrase that may wrap (Core/ui/buttons §0). */
.pcv-scn {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 40px 14px 16px;
  box-sizing: border-box;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--pcv-ink);
  font: 400 calc(15px * var(--pcv-kc)) / 1.45 "Inter", sans-serif;
  text-align: left;
  text-wrap: pretty;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--lab-out) linear, box-shadow var(--lab-out) linear;
}
.pcv-scn::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  opacity: 0.45;
  translate: 0 -50%;
  rotate: 45deg;
}
.pcv-scn:hover, .pcv-scn:active, .pcv-scn:focus-visible { background: #fff; transition-duration: var(--lab-in); }
.pcv-scn:focus-visible { outline: 2px solid var(--pcv-ink); outline-offset: 2px; }
.pcv-scn[aria-current] { background: #fff; box-shadow: inset 3px 0 0 var(--pcv-ink); font-weight: 500; }
.pcv-foot { display: grid; gap: 10px; margin-top: 36px; }
.pcv-foot .lab-btn { min-width: 0; padding-inline: 16px; }
.pcv-close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #171719;
  color: #eaeaea;
  font: 600 14px/16px "Inter", sans-serif;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.pcv-close[hidden] { display: none; }
.pcv-close:hover, .pcv-close:active { background: #3a3a3e; }
.pcv-close:focus-visible { outline: 2px solid var(--pcv-ink); outline-offset: 3px; }

/* The narrow screen: Scenarios on the Menu's line, the panel in a sheet. */
.pcv-bar { display: none; }
.pcv-sheet {
  box-sizing: border-box;
  width: 100%;
  max-width: 640px;
  max-height: 88svh;
  margin: auto auto 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: #eceef0;
  color: var(--pcv-ink);
}
.pcv-sheet[open] { display: flex; flex-direction: column; }
.pcv-sheet::backdrop { background: rgba(10, 10, 12, 0.5); }
.pcv-sheet > .pcv-panel {
  max-height: 88svh;
  padding: 0 20px calc(24px + env(safe-area-inset-bottom, 0px));
  border-left: 0;
  background: transparent;
}
/* The sheet opens on the current scenario; Close stays in reach above it. */
.pcv-sheet .pcv-head {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-inline: -20px;
  padding: 12px 20px 8px;
  background: #eceef0;
}

@media (max-width: 1099.98px) {
  .lab--catalog-viewer { --pcv-panel: 320px; }
  .pcv-panel { padding-inline: 24px; }
}
@media (max-width: 899.98px) {
  .pcv-shell {
    grid-template-rows: minmax(0, 1fr) auto;
    padding-bottom: 0;
  }
  .pcv-plate { grid-template-columns: minmax(0, 1fr); }
  .pcv-plate > .pcv-panel { display: none; }
  /* The button's middle on the Menu's middle: Menu is 48 high, max(16px, safe area) off the bottom. */
  .pcv-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px calc(var(--pcv-dock-w, 124px) + 12px) calc(max(16px, env(safe-area-inset-bottom, 0px)) - 4px) 0;
  }
  .pcv-bar { container-type: inline-size; }
  .pcv-bar .lab-btn { flex: none; }
  .pcv-bar-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    margin: 0;
    font: 500 13px/16px "Inter", sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink, #dee2e4);
  }
  .pcv-bar-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pcv-bar-name span + span { font-weight: 400; letter-spacing: 0.02em; text-transform: none; color: var(--ink-mute, #9aa2a8); }
  .pcv-bar-name span:empty { display: none; }
}
/* Too little room beside the button for a readable name: the button alone. */
@container (max-width: 299.98px) {
  .pcv-bar-name { display: none; }
}
.pcv-phones { flex: none; align-self: center; margin-top: 12px; }
.pcv-phones[hidden] { display: none; }

/* A phone in the hand: no drawn phone around the app (Alexa, 15.10.2026). */
@media (max-width: 599.98px), (max-height: 499.98px) {
  .pcv-plate { border-radius: 16px; background: var(--pcv-page); }
  .pcv-pair, .pcv-device, .pcv-phone, .pcv-screen { width: 100%; height: 100%; }
  .pcv-pair { inset: 0; gap: 0; transform: none; }
  .pcv-device { gap: 0; }
  .pcv-phone { padding: 0; border-radius: 0; background: var(--pcv-page); box-shadow: none; }
  .pcv-screen { border-radius: 0; clip-path: none; }
  .pcv-key, .pcv-status, .pcv-island, .pcv-homebar, .pcv-label { display: none; }
  .pcv[data-both] .pcv-label { display: none; }
  .pcv-app { top: 0; height: 100%; }
  .pcv-phones { margin-bottom: 8px; }
}
/* The home hero's narrow button: the same 56, the side padding only (lab.css). */
@media (max-width: 519.98px) {
  .pcv-bar .lab-btn { padding-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .pcv-scn, .pcv-crumb a { transition: none; }
}
@media (forced-colors: active) {
  .pcv-scn[aria-current] { outline: 2px solid Highlight; outline-offset: -2px; }
}
