/*
 * .ui-3d: one treatment for every product screenshot on the marketing site.
 * A perspective-tilted app window with a glass slab, layered shadow, light rim and sheen, plus floating
 * callout cards lifted off the screen. Transform and opacity only, so nothing ever shifts layout.
 * assets/ui-3d.js eases the tilt with scroll and pointer; without it (or with reduced motion) the
 * custom properties below hold a static, nicely angled still.
 *
 * Markup:
 *   <figure class="ui-3d" data-ui-3d>
 *     <div class="ui-3d__stage">
 *       <a class="ui-3d__window" href="full-size.jpg"><picture>...<img></picture><span class="ui-3d__sheen"></span></a>
 *       <div class="ui-3d__card ui-3d__card--a" aria-hidden="true">...</div>
 *       <div class="ui-3d__card ui-3d__card--b" aria-hidden="true">...</div>
 *     </div>
 *     <figcaption>...</figcaption>
 *   </figure>
 */
.ui-3d {
  --rx: 4deg;
  --ry: -8deg;
  --sheen: 62%;
  --shift: 0;
  --card-z: 78px;
  position: relative;
  margin: 0;
  min-width: 0;
  /* room for the cards that hang over the window edge */
  padding: 40px 30px 26px 40px;
  perspective: 1700px;
  perspective-origin: 50% 38%;
  isolation: isolate;
}

/* soft pastel light behind the window; never transformed, so it costs nothing per frame */
.ui-3d::before {
  content: "";
  position: absolute;
  inset: -2% -4% 0;
  z-index: -1;
  background:
    radial-gradient(48% 52% at 26% 28%, rgba(155, 143, 232, 0.36), transparent 72%),
    radial-gradient(46% 50% at 78% 74%, rgba(123, 167, 201, 0.38), transparent 72%);
  -webkit-mask-image: radial-gradient(closest-side, #000 52%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 52%, transparent 100%);
  pointer-events: none;
}

.ui-3d__stage {
  position: relative;
  aspect-ratio: 4 / 3;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
}

/* the glass slab: gives the window real thickness when it turns */
.ui-3d__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(160deg, #e9e5f2, #cfc9de);
  transform: translateZ(-14px);
  box-shadow: 0 0 0 1px rgba(28, 25, 23, 0.06);
}

/* ground shadow, pushed back in depth so perspective slides it as the window turns */
.ui-3d__stage::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -5%;
  height: 16%;
  background: radial-gradient(closest-side, rgba(52, 44, 96, 0.42), rgba(52, 44, 96, 0) 100%);
  filter: blur(14px);
  transform: translateZ(-90px) translateX(calc(var(--shift) * 1%));
  pointer-events: none;
}

.ui-3d__window {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: 18px;
  background: #f6f4fa;
  box-shadow:
    0 0 0 1px rgba(28, 25, 23, 0.07),
    0 2px 4px rgba(28, 25, 23, 0.05),
    0 14px 26px -10px rgba(28, 25, 23, 0.14),
    0 38px 64px -26px rgba(60, 50, 110, 0.38),
    0 80px 90px -56px rgba(60, 50, 110, 0.3);
  transform: translateZ(0);
}
.ui-3d__window:focus-visible { outline: 3px solid #7ba7c9; outline-offset: 5px; }
.ui-3d__window picture,
.ui-3d__window img { display: block; width: 100%; height: 100%; }
.ui-3d__window img { object-fit: cover; }

/* light rim on the top and left edges, like a polished bevel */
.ui-3d__window::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 1px 0 0 rgba(255, 255, 255, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

/* soft reflection that slides across the glass as the window turns */
.ui-3d__sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(104deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0.4) 48%, rgba(255, 255, 255, 0) 58%);
  background-size: 260% 100%;
  background-position: var(--sheen) 0;
  opacity: 0.55;
}

/* callout cards, lifted off the screen */
.ui-3d__card {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 6px;
  width: min(46%, 260px);
  padding: 14px 16px 15px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  color: #1c1917;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  pointer-events: none;
  box-shadow:
    0 0 0 1px rgba(28, 25, 23, 0.06),
    0 3px 6px rgba(28, 25, 23, 0.06),
    0 18px 30px -10px rgba(28, 25, 23, 0.2),
    0 44px 56px -26px rgba(60, 50, 110, 0.4);
  transform: translateZ(var(--card-z));
}
.ui-3d__card--a { left: -7%; bottom: 7%; width: min(35%, 232px); }
.ui-3d__card--b { right: -6%; top: -9%; --card-z: 118px; width: min(38%, 236px); }

.ui-3d__label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #57534e;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.ui-3d__label i { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, #9b8fe8); }
.ui-3d__label svg { width: 14px; height: 14px; color: var(--dot, #9b8fe8); }
.ui-3d__value { font-size: 26px; font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; }
.ui-3d__value small { font-size: 13px; font-weight: 600; letter-spacing: 0; color: #57534e; }
.ui-3d__card p { margin: 0; color: #57534e; font-size: 12.5px; line-height: 1.4; }
.ui-3d__card p b { color: #1c1917; font-weight: 600; }
.ui-3d__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-3d__chips span {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--chip, #eeebfb);
  color: #1c1917;
  font-size: 12px;
  font-weight: 600;
}
.ui-3d__ok {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #e3f1e2;
  color: #2f6b2e;
  font-size: 11.5px;
  font-weight: 700;
}

.ui-3d figcaption { position: relative; padding-top: 16px; color: #78716c; font-size: 12px; line-height: 1.5; }

/* phones: flatter and simpler, one card, smaller lift */
@media (max-width: 720px) {
  .ui-3d {
    --rx: 2deg;
    --ry: -4deg;
    --card-z: 36px;
    padding: 22px 10px 14px;
    perspective: 1400px;
  }
  .ui-3d__window,
  .ui-3d__stage::before { border-radius: 14px; }
  /* the phone art is the real mobile layout, portrait */
  .ui-3d__stage { aspect-ratio: 390 / 760; width: min(100%, 262px); margin-inline: auto; }
  .ui-3d__card { width: min(78%, 212px); padding: 11px 13px 12px; border-radius: 14px; }
  .ui-3d__card--a { left: -12%; bottom: -7%; }
  .ui-3d figcaption { padding-top: 54px; }
  .ui-3d__card--b { display: none; }
  .ui-3d__value { font-size: 22px; }
}

