/* W17-09A — Home hero variant D «منصة القيادة» (premium command deck; internal preview: index.html?hero=d). B stays the public default.
   A product-first opening: headline on the right, and on the left ONE flagship application window lit on a deep-navy set —
   a rich off-white screen with real document hierarchy (invoice / resource board / purchase order), linked evidence cards,
   and a glass "lens" floating in front. Three scenes swap every major region of the window.
   The opening (~3.2s) moves camera (tilt + dolly) and light only; the headline and actions never drop below full opacity.
   Ambient motion (a slow proof trace, >5s) starts only with JS after the opening and is pausable (WCAG 2.2.2).
   Compositions: wide (≥1181px) · tablet (721–1180px) · mobile (≤720px, flat condensed screen) · narrow (≤420px). */

/* ---------- Variant switch: the original A/B DOM stays in place and is hidden only while D is active ---------- */
.hero:not([data-concept="d"]) > .prem { display: none; }
.hero[data-concept="d"] { grid-template-rows: 1fr; padding-block: 0; background: #040a1c; }
.hero[data-concept="d"] > .hero__backdrop,
.hero[data-concept="d"] > .hero__layout,
.hero[data-concept="d"] > .hero-proof,
.hero[data-concept="d"] > .hero__foot { display: none !important; }

.prem {
  --pr-ink: #040a1c;
  --pr-cobalt: #2f6bff;
  --pr-cobalt-2: #8cb8ff;
  --pr-warm: #ffbe6b;
  --pw-paper: #f6f8fc;
  --pw-paper-2: #edf1f9;
  --pw-ink: #0c1834;
  --pw-ink-2: #4a5878;
  --pw-ink-3: #6a7795;
  --pw-line: rgb(16 34 80 / .1);
  --pw-line-2: rgb(16 34 80 / .18);
  --pw-blue: #1f4fe0;
  --pw-blue-tint: #e9efff;
  --pw-ok: #0b6e4a;
  --pw-ok-tint: #e3f5ec;
  --pw-warn: #844e00;
  --pw-warn-tint: #fff1d9;
  --rig-rest: rotateX(3deg) rotateY(7deg);
  position: relative; isolation: isolate; overflow: clip;
  display: grid; align-content: center; align-self: stretch;
  min-height: calc(100svh - var(--header-h));
  padding-block: clamp(1.25rem, .5rem + 1.6vw, 2rem);
  background-color: var(--pr-ink);
  color: var(--text-1);
}

/* ---------- The set: a cobalt key light above the product, haze on the floor, a faint warm practical far left ---------- */
.prem__set { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.prem__set i { position: absolute; inset: 0; }
.prem__key {
  background:
    radial-gradient(58% 72% at 30% 4%, rgb(56 106 255 / .42), rgb(40 80 210 / .1) 52%, transparent 76%),
    radial-gradient(36% 48% at 88% 18%, rgb(120 160 255 / .1), transparent 72%);
}
.prem__floor { background: radial-gradient(64% 30% at 32% 94%, rgb(60 110 255 / .2), transparent 72%), linear-gradient(180deg, transparent 62%, rgb(2 5 14 / .6)); }
.prem__warm { background: radial-gradient(30% 26% at 3% 78%, rgb(255 170 80 / .1), transparent 72%); }

.prem__frame {
  display: grid; align-items: center;
  grid-template-columns: minmax(340px, .86fr) minmax(0, 1.58fr);
  gap: clamp(1.5rem, .5rem + 3vw, 3.5rem);
}

/* ---------- Copy (right in RTL) ---------- */
.prem__copy { min-width: 0; }
.prem__kicker { display: inline-flex; align-items: center; gap: .55rem; margin: 0; color: var(--blue-200); font-size: .9375rem; font-weight: 500; }
.prem__title {
  margin: .85rem 0 0; color: #fff;
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.005em;
  font-size: clamp(2rem, .7rem + 2.1vw, 2.85rem); line-height: 1.2; text-wrap: balance;
}
.prem__title > span { display: block; }
.prem__title em {
  font-style: normal; color: var(--pr-cobalt-2);
  background: linear-gradient(90deg, #c9dcff, #6f9bff 70%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.prem__lead { margin: 1rem 0 0; max-width: 32em; color: #c3d1f2; font-size: 1.0625rem; line-height: 1.85; }
.prem__ctas { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.prem__note {
  display: grid; gap: .2rem; margin: 1.5rem 0 0; padding: .75rem 1rem; max-width: 30rem;
  border-inline-start: 2px solid var(--pr-cobalt); border-radius: 0 10px 10px 0; background: rgb(140 184 255 / .05);
  color: #b9c6e4; font-size: .9375rem; line-height: 1.7;
}
.prem__note b { color: #fff; font-size: .875rem; font-weight: 600; }
.prem__tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1.25rem; }
.prem__back, .prem__tool {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; min-width: 40px; padding: 0 .9rem;
  border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2);
  font: inherit; font-size: .875rem; line-height: 1.4; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: color var(--dur-1), border-color var(--dur-1), background var(--dur-1);
}
.prem__back:hover, .prem__tool:hover { color: var(--text-1); border-color: var(--line-3); background: rgb(255 255 255 / .03); }
.prem__back:focus-visible, .prem__tool:focus-visible, .prem__mode:focus-visible { outline: 2px solid var(--pr-cobalt-2); outline-offset: 2px; border-radius: 999px; }
.prem__tool svg { width: 16px; height: 16px; flex: none; }
.prem__tool [hidden] { display: none; }

/* ---------- Stage (left in RTL) ---------- */
.prem__stage { display: grid; gap: .75rem; min-width: 0; }
.prem__deck { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.prem__deck-k { margin: 0; color: #9fb2de; font-size: .875rem; font-weight: 500; }
.prem__modes { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: rgb(10 22 52 / .72); border: 1px solid rgb(140 184 255 / .2); }
.prem__modes[hidden] { display: none; }
.prem__mode {
  min-height: 40px; padding: 0 1.15rem; border: 0; border-radius: 999px; background: transparent; color: #c3d1f2;
  font: inherit; font-size: .9375rem; font-weight: 600; cursor: pointer; transition: color var(--dur-1), background var(--dur-1);
}
.prem__mode:hover { color: #fff; background: rgb(255 255 255 / .05); }
.prem__mode[aria-pressed="true"] { background: linear-gradient(180deg, #f7f9ff, #dfe8ff); color: #0b1a3d; box-shadow: 0 6px 18px -8px rgb(47 107 255 / .7); }

.prem__camera { perspective: 2200px; perspective-origin: 60% 40%; padding-block-end: 1.75rem; }
.prem__rig { position: relative; transform-style: preserve-3d; transform: var(--rig-rest); transform-origin: 50% 55%; }
.prem__ghost {
  position: absolute; inset: -5% 10% 22% -5%; border-radius: 18px;
  display: grid; align-content: start; gap: 10px; padding: 1.25rem 1.5rem;
  background: linear-gradient(160deg, #102252, #08132f); border: 1px solid rgb(140 184 255 / .14);
  transform: translateZ(-110px); opacity: .8;
}
.prem__ghost i { display: block; height: 10px; border-radius: 6px; background: rgb(140 184 255 / .12); }
.prem__ghost i:nth-child(1) { width: 34%; }
.prem__ghost i:nth-child(2) { width: 58%; }
.prem__ghost i:nth-child(3) { width: 46%; }
.prem__ghost i:nth-child(4) { width: 22%; }

/* ---------- The flagship window ---------- */
.prem__win {
  position: relative; overflow: hidden; border-radius: 16px;
  background: var(--pw-paper); color: var(--pw-ink);
  font-family: var(--font-body); font-size: .8125rem; line-height: 1.5;
  box-shadow:
    0 0 0 1px rgb(255 255 255 / .1),
    0 50px 90px -30px rgb(0 4 20 / .85),
    0 24px 48px -24px rgb(24 70 200 / .55),
    0 0 120px -40px rgb(60 110 255 / .45);
}
.prem__win::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(112deg, transparent 38%, rgb(255 255 255 / .38) 48%, transparent 58%);
  transform: translateX(-130%); opacity: 0;
}
.prem__win svg { width: 16px; height: 16px; flex: none; }

.pw-bar {
  display: flex; align-items: center; gap: .75rem; min-height: 44px; padding: .5rem .9rem;
  background: linear-gradient(180deg, #0f1f48, #0a1636); color: #dfe8ff; white-space: nowrap;
}
.pw-dots { display: inline-flex; gap: 5px; }
.pw-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgb(255 255 255 / .22); }
.pw-brand { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; font-family: var(--font-num); }
.pw-brand i { width: 14px; height: 14px; border-radius: 4px; background: linear-gradient(135deg, #8cb8ff, #2f6bff); }
.pw-crumb { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #a9bbe3; }
.pw-crumb span + span::before { content: "/"; margin-inline: .45rem; opacity: .5; }
.pw-crumb span:last-child { color: #fff; font-weight: 600; font-family: var(--font-num); }
.pw-ctx { display: inline-flex; gap: .35rem; }
.pw-chip { padding: .15rem .6rem; border-radius: 999px; background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .12); color: #dfe8ff; }
.pw-tag {
  padding: .15rem .6rem; border-radius: 6px; border: 1px solid rgb(255 190 107 / .4);
  background: rgb(255 190 107 / .12); color: #ffd79a; font-size: .75rem; font-weight: 600;
}

.pw-body { display: grid; grid-template-columns: 52px minmax(0, 1fr); }
.pw-rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: .75rem 0; background: #eaeff8; border-inline-end: 1px solid var(--pw-line); }
.pw-rail i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--pw-ink-3); }
.pw-rail i svg { width: 18px; height: 18px; }
.pw-rail i.is-on { background: var(--pw-blue); color: #fff; box-shadow: 0 6px 14px -6px rgb(31 79 224 / .8); }

.pw-main { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; }
.pw-tools { display: flex; align-items: center; gap: .75rem; padding: .55rem .9rem; background: #fff; border-bottom: 1px solid var(--pw-line); white-space: nowrap; }
.pw-tabs { display: inline-flex; gap: 2px; }
.pw-tabs span { padding: .3rem .75rem; border-radius: 8px; color: var(--pw-ink-2); }
.pw-tabs span.is-on { background: var(--pw-blue-tint); color: var(--pw-blue); font-weight: 600; }
.pw-search { flex: 0 1 210px; min-width: 0; margin-inline-start: auto; overflow: hidden; text-overflow: ellipsis; padding: .3rem .8rem; border: 1px solid var(--pw-line-2); border-radius: 8px; color: #8a96b3; }
.pw-act { padding: .35rem .85rem; border-radius: 8px; background: var(--pw-blue); color: #fff; font-weight: 600; }

.pw-grid {
  display: grid; align-items: start; gap: .85rem; padding: .85rem; min-height: 400px;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr); background: var(--pw-paper-2);
}
.prem[data-scene="bookings"] .pw-grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }

.pw-doc, .pw-card {
  min-width: 0; background: #fff; border: 1px solid var(--pw-line); border-radius: 12px;
  box-shadow: 0 1px 2px rgb(16 34 80 / .06), 0 10px 26px -16px rgb(16 34 80 / .3);
  outline: 2px solid rgb(47 107 255 / 0); outline-offset: 2px;
}
.pw-doc { display: grid; gap: .8rem; padding: .95rem 1rem; }
.pw-doc__h { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.pw-doc__k { margin: 0; color: var(--pw-ink-2); font-size: .75rem; }
.pw-doc__t { margin: .1rem 0 0; color: var(--pw-ink); font-family: var(--font-num); font-size: 1.125rem; font-weight: 700; }
.pw-pill { padding: .2rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.pw-pill--ok { background: var(--pw-ok-tint); color: var(--pw-ok); }
.pw-pill--warn { background: var(--pw-warn-tint); color: var(--pw-warn); }
.pw-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; margin: 0; }
.pw-meta div { min-width: 0; padding: .4rem .55rem; border-radius: 8px; background: var(--pw-paper); }
.pw-meta dt { color: var(--pw-ink-3); font-size: .6875rem; }
.pw-meta dd { margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pw-table { width: 100%; border-collapse: collapse; }
.pw-table th { padding: .35rem .5rem; border-bottom: 1px solid var(--pw-line-2); color: var(--pw-ink-3); font-size: .72rem; font-weight: 600; text-align: start; white-space: nowrap; }
.pw-table td { padding: .5rem; border-bottom: 1px solid var(--pw-line); color: var(--pw-ink); }
.pw-table td:first-child { font-weight: 500; }
.pw-table th:not(:first-child), .pw-table td:not(:first-child) { text-align: end; font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pw-table tbody tr:last-child td { border-bottom: 0; }
.pw-table--sm td { padding: .38rem .4rem; font-size: .78rem; }
.pw-table--sm th { padding-inline: .4rem; }

.pw-total { justify-self: end; display: grid; gap: .3rem; width: min(100%, 15rem); padding: .55rem .7rem; border-radius: 10px; background: var(--pw-paper); }
.pw-total div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--pw-ink-2); }
.pw-total .pw-total__grand { margin-top: .2rem; padding-top: .45rem; border-top: 1px dashed var(--pw-line-2); color: var(--pw-ink); font-size: 1.125rem; font-weight: 700; }
.pw-money { display: inline-flex; align-items: center; gap: .25em; font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.pw-side { display: grid; gap: .85rem; min-width: 0; }
.pw-card { display: grid; gap: .55rem; padding: .8rem .9rem; }
.pw-card__h { display: flex; align-items: center; gap: .5rem; }
.pw-card__h b { font-size: .875rem; }
.pw-ico { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--pw-blue-tint); color: var(--pw-blue); }
.pw-ref { margin-inline-start: auto; padding: .1rem .45rem; border-radius: 6px; background: var(--pw-blue-tint); color: var(--pw-blue); font-family: var(--font-num); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.pw-card__sub { margin: 0; color: var(--pw-ink-2); font-size: .75rem; line-height: 1.65; }
.pw-card__foot { display: inline-flex; align-items: center; gap: .35rem; margin: 0; color: var(--pw-ok); font-size: .75rem; font-weight: 600; }
.pw-card__foot svg { width: 14px; height: 14px; }
.pw-rows { display: grid; margin: 0; padding: 0; list-style: none; }
.pw-rows li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--pw-line); }
.pw-rows li:last-child { border-bottom: 0; }
.pw-rows li > span { color: var(--pw-ink-2); }
.pw-rows li > b { font-weight: 600; white-space: nowrap; }
.pw-flow { display: inline-flex; align-items: baseline; gap: .3rem; font-family: var(--font-num); }
.pw-flow s { color: #8a96b3; font-weight: 500; }
.pw-flow i { font-style: normal; color: var(--pw-blue); }
.pw-flow small { color: var(--pw-ink-2); font-size: .7rem; font-weight: 500; }
.pw-okv { display: inline-flex; align-items: center; gap: .3rem; color: var(--pw-ok); font-family: var(--font-num); }
.pw-okv svg { width: 14px; height: 14px; }
.pw-btn { justify-self: start; padding: .4rem .95rem; border-radius: 8px; background: var(--pw-blue); color: #fff; font-weight: 600; }
.pw-caveat { margin: 0; padding: .45rem .6rem; border-radius: 8px; border: 1px solid #f1cf94; background: #fff6e6; color: #6f4300; font-size: .75rem; line-height: 1.65; }

.pw-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.pw-steps li { min-width: 0; padding: .4rem .5rem; border-radius: 8px; border-top: 2px solid #18a06c; background: #eef7f2; }
.pw-steps b { display: block; font-size: .75rem; }
.pw-steps small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pw-ink-2); font-family: var(--font-num); font-size: .6875rem; }

.pw-status { display: flex; gap: 1.25rem; overflow: hidden; padding: .5rem 1rem; border-top: 1px solid var(--pw-line); background: #fff; color: var(--pw-ink-2); font-size: .75rem; white-space: nowrap; }
.pw-status span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-inline-end: .4rem; border-radius: 50%; background: #18a06c; vertical-align: middle; }

/* bookings: staff-operated resource board */
.pw-board {
  position: relative; display: grid; column-gap: 4px;
  grid-template-columns: 48px repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: 46px repeat(var(--rows), 36px);
  font-size: .75rem;
}
.pb-lines { grid-column: 1 / -1; grid-row: 2 / -1; background: repeating-linear-gradient(180deg, #e6ebf4 0 1px, transparent 1px 36px); }
.pb-col { grid-row: 2 / -1; border-radius: 8px; background: rgb(16 34 80 / .025); }
.pb-res { grid-row: 1; min-width: 0; padding: .3rem .4rem; }
.pb-res b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.pb-res small { color: var(--pw-ink-3); font-size: .6875rem; }
.pb-time { grid-column: 1; color: var(--pw-ink-3); font-family: var(--font-num); font-size: .6875rem; transform: translateY(-.6em); }
.pb-col, .pb-lines, .pb-res, .pb-time { z-index: 0; }
.pb-blk {
  position: relative; z-index: 1; display: grid; align-content: start; gap: 1px; min-width: 0; overflow: hidden;
  margin-block: 2px; padding: .3rem .45rem; border-radius: 8px; outline: 2px solid rgb(47 107 255 / 0); outline-offset: 1px;
}
.pb-blk b, .pb-blk small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-blk small { font-size: .6875rem; }
.pb-blk--ok { background: var(--pw-blue-tint); border-inline-start: 3px solid var(--pw-blue); color: #142a66; }
.pb-blk--hold { background: repeating-linear-gradient(135deg, #fff3dc 0 8px, #ffe8c0 8px 16px); border: 1px dashed #d4952a; color: #633a00; }
.pb-blk--off { background: #eceff5; color: var(--pw-ink-3); }

/* ---------- The lens: glass evidence card in front of the window ---------- */
.prem__lens {
  position: absolute; left: -1.25rem; bottom: -1.5rem; z-index: 2; width: min(17.5rem, 42%);
  padding: .85rem .95rem; border-radius: 14px; color: #eef2fb;
  background: rgb(12 24 58 / .84); border: 1px solid rgb(160 196 255 / .28);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / .75), inset 0 1px 0 rgb(255 255 255 / .08);
  transform: translateZ(70px);
}
.pl-k { margin: 0 0 .55rem; color: #a9c8ff; font-size: .75rem; font-weight: 600; }
.pl-chain { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.pl-chain li { display: grid; gap: 2px; min-width: 0; padding: .45rem .5rem; border-radius: 9px; border: 1px solid rgb(255 255 255 / .1); background: rgb(255 255 255 / .06); }
.pl-chain li::before { content: ""; width: 7px; height: 7px; margin-bottom: 2px; border-radius: 50%; background: var(--pr-warm); }
.pl-chain li[data-state="done"] { border-color: rgb(63 214 156 / .42); }
.pl-chain li[data-state="done"]::before { background: #3fd69c; }
.pl-chain b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-num); font-size: .8125rem; }
.pl-chain small { color: #b9c6e4; font-size: .6875rem; line-height: 1.45; }
.pl-foot { display: flex; align-items: center; gap: .35rem; margin: .6rem 0 0; color: #c3d1f2; font-size: .75rem; }
.pl-foot svg { width: 14px; height: 14px; flex: none; color: #3fd69c; }

/* ---------- Truth line: always visible ---------- */
.prem__truth { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: 0; color: #9fb2de; font-size: .8125rem; line-height: 1.6; }
.prem__tag { padding: .15rem .65rem; border-radius: 999px; border: 1px solid rgb(255 190 107 / .4); background: rgb(255 190 107 / .12); color: #ffd79a; font-weight: 600; white-space: nowrap; }

/* ---------- Opening (~3.2s, markup-started, one shot): light rises, camera dollies in and settles, the screen is exposed ---------- */
.prem.is-opening .prem__key { animation: pr-light 2.2s var(--ease-out) both; }
.prem.is-opening .prem__floor { animation: pr-light 2.6s .3s var(--ease-out) both; }
.prem.is-opening .prem__rig { animation: pr-dolly 2.8s cubic-bezier(.16, .84, .24, 1) both; }
.prem.is-opening .prem__ghost { animation: pr-ghost 2.6s .2s var(--ease-out) both; }
.prem.is-opening .prem__win { animation: pr-expose 2.4s var(--ease-out) both; }
.prem.is-opening .prem__win::after { animation: pr-sweep 1.5s 1.15s ease-in-out both; }
.prem.is-opening .pw-bar { animation: pr-rise .8s .55s var(--ease-out) both; }
.prem.is-opening .pw-rail,
.prem.is-opening .pw-tools { animation: pr-rise .8s .8s var(--ease-out) both; }
.prem.is-opening .pw-doc { animation: pr-rise .9s 1.05s var(--ease-out) both; }
.prem.is-opening .pw-side > :nth-child(1) { animation: pr-rise .9s 1.35s var(--ease-out) both; }
.prem.is-opening .pw-side > :nth-child(2) { animation: pr-rise .9s 1.6s var(--ease-out) both; }
.prem.is-opening .pw-status { animation: pr-rise .8s 1.8s var(--ease-out) both; }
.prem.is-opening .prem__lens { animation: pr-lens 1.2s 1.95s var(--ease-out) both; }

@keyframes pr-light { from { opacity: .12; } }
@keyframes pr-dolly { from { transform: rotateX(17deg) rotateY(24deg) translate3d(0, 5%, -340px); } }
@keyframes pr-ghost { from { opacity: 0; transform: translateZ(-300px); } }
@keyframes pr-expose { from { filter: brightness(.35) saturate(.6); } }
@keyframes pr-sweep { 0% { opacity: 0; transform: translateX(-130%); } 30%, 70% { opacity: 1; } 100% { opacity: 0; transform: translateX(130%); } }
@keyframes pr-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes pr-lens { from { opacity: 0; transform: translateZ(160px) translate(-16px, 26px); } }

/* ---------- Ambient (JS, after the opening; pausable): one slow trace across the linked evidence, the lens breathes ---------- */
.prem.is-live [data-proof] { animation: pr-proof 7.5s calc(var(--i, 0) * 2.5s) ease-in-out infinite; }
.prem.is-live .prem__lens { animation: pr-float 9s ease-in-out infinite alternate; }
.prem.is-live.is-still [data-proof], .prem.is-live.is-still .prem__lens,
.prem.is-live.is-offstage [data-proof], .prem.is-live.is-offstage .prem__lens { animation-play-state: paused; }
@keyframes pr-proof {
  0%, 30%, 100% { outline-color: rgb(47 107 255 / 0); }
  9%, 20% { outline-color: rgb(47 107 255 / .6); }
}
@keyframes pr-float { from { transform: translateZ(70px); } to { transform: translateZ(70px) translateY(-6px); } }

/* ---------- Scene swap (JS) ---------- */
.prem.is-swapping .pw-crumb,
.prem.is-swapping .pw-ctx,
.prem.is-swapping .pw-tools,
.prem.is-swapping .pw-doc,
.prem.is-swapping .pw-side,
.prem.is-swapping .pw-status { animation: pr-rise .6s var(--ease-out) both; }
.prem.is-swapping .prem__lens { animation: pr-fade .6s .1s var(--ease-out) both; }
@keyframes pr-fade { from { opacity: 0; } }

/* ---------- Wide but not huge ---------- */
@media (max-width: 1500px) {
  .pw-chip + .pw-chip { display: none; }
}

/* ---------- Tablet: copy above, the screen below at full width ---------- */
@media (max-width: 1180px) {
  .prem { --rig-rest: rotateX(2deg) rotateY(3deg); min-height: 0; padding-block: 2rem 2.5rem; }
  .prem__frame { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .prem__copy { max-width: 44rem; }
  .prem__title > span { display: inline; }
  .prem__lens { left: .75rem; }
  .prem__ghost { inset: -4% 6% 26% -3%; }
}

/* ---------- Mobile: a flat, condensed screen that keeps the scene's focus ---------- */
@media (max-width: 720px) {
  .prem { padding-block: 1.5rem 2rem; }
  .prem__title > span { display: block; }
  .prem__lead { font-size: 1rem; }
  .prem__ctas .btn { flex: 1 1 auto; }
  .prem__note { margin-top: 1.25rem; }
  .prem__deck { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
  /* W17-09C: the selector spans the stage as equal columns (DOM order, so RTL starts at the right); labels stay on one line. */
  .prem__modes { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; box-sizing: border-box; }
  .prem__modes[hidden] { display: none; }
  .prem__mode { min-width: 0; padding: 0 .35rem; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .prem__camera { perspective: none; padding-block-end: 0; }
  .prem__rig { transform: none; }
  .prem__ghost { display: none; }
  .pw-bar { flex-wrap: wrap; gap: .35rem .6rem; }
  .pw-dots, .pw-ctx { display: none; }
  .pw-tag { margin-inline-start: auto; font-size: .6875rem; }
  .pw-crumb { order: 3; flex-basis: 100%; }
  .pw-body { grid-template-columns: minmax(0, 1fr); }
  .pw-rail, .pw-search, .pw-status { display: none; }
  .pw-tools { padding-inline: .6rem; overflow: hidden; }
  .pw-act { margin-inline-start: auto; }
  .pw-grid,
  .prem[data-scene="bookings"] .pw-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; padding: .6rem; gap: .6rem; }
  .pw-doc { padding: .8rem; }
  .pw-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pw-total { width: 100%; }
  .pw-table--po th:nth-child(4), .pw-table--po td:nth-child(4) { display: none; }
  .prem__lens { position: relative; left: auto; bottom: auto; width: auto; margin-top: .75rem; transform: none; }

  .prem.is-opening .prem__rig { animation-name: pr-dolly-m; }
  .prem.is-opening .prem__lens { animation-name: pr-rise; }
  .prem.is-live .prem__lens { animation: none; }

  /* W17-09B product-first fold: headline, lead and the primary action, then the story selector and the screen;
     the secondary action, scene note and tools follow the screen. Visual order only — the DOM is unchanged, and the
     two unwrapped containers (.prem__copy, .prem__ctas) are plain divs with no role, so display:contents drops no semantics. */
  .prem { padding-block-start: 1rem; }
  .prem__frame { display: flex; flex-direction: column; gap: 0; }
  .prem__copy, .prem__ctas { display: contents; }
  .prem__title { margin-top: .55rem; }
  .prem__lead { margin-top: .6rem; font-size: .9375rem; line-height: 1.75; }
  .prem__ctas .btn { flex: none; }
  .prem__ctas > .btn:first-child { order: 0; margin-top: .9rem; }
  .prem__stage { order: 1; margin-top: 1rem; gap: .6rem; align-self: stretch; width: 100%; }
  .prem__ctas > .btn:nth-child(2) { order: 2; margin-top: 1.25rem; }
  .prem__note { order: 3; margin-top: 1rem; max-width: none; }
  .prem__tools { order: 4; margin-top: 1rem; }
  .prem__deck { gap: .4rem; }
}
@keyframes pr-dolly-m { from { transform: translateY(22px) scale(.96); } }

@media (max-width: 560px) {
  .pw-board { grid-template-columns: 44px repeat(2, minmax(0, 1fr)); }
  .pw-board [data-col="3"], .pw-board [data-col="4"] { display: none; }
}

/* ---------- Narrow: the document and its first piece of evidence; the lens carries the full chain ---------- */
@media (max-width: 420px) {
  .prem__title { font-size: 1.75rem; }
  .pw-tabs span:nth-child(n + 3) { display: none; }
  .pw-side > :nth-child(2) { display: none; }
  .pw-steps small { display: none; }
  .pw-steps li { padding: .35rem .3rem; }
  .pw-steps b { font-size: .6875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pw-table td, .pw-table th { padding-inline: .3rem; }
}

/* ---------- Reduced motion: entirely static (the settled pose, no opening, no trace, no swap motion) ---------- */
@media (prefers-reduced-motion: reduce) {
  .prem *, .prem *::before, .prem *::after { animation: none !important; transition: none !important; }
}
