/* ============================================================================
   ATOM Design System — Preview canvas contract
   ----------------------------------------------------------------------------
   Every card preview authors against a fixed 400x225 canvas
   (the card frame's 16:9 box at its largest rendered size). preview-loader.js
   sets --atom-preview-scale per card so the canvas scales down to whatever
   width the grid gives it. That means every preview can be written in plain
   px, and stays pixel-consistent across the 2-col and 3-col breakpoints.
   ========================================================================== */

/* The fallback lives in the var() call, not as a declaration here. Declaring
   --atom-preview-scale on .atom-preview itself would beat the value
   preview-loader.js sets on the parent frame — an element's own declaration
   always wins over an inherited one — and every canvas would render unscaled. */
.atom-preview {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 225px;
  transform: translate(-50%, -50%) scale(var(--atom-preview-scale, 1));
  transform-origin: center center;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1.45;
  color: var(--atom-fg-neutral);
  word-break: keep-all;
}

/* --- canvas layout helpers ------------------------------------------------ */
.atom-preview--stack {
  flex-direction: column;
  gap: var(--atom-x3);
}

.atom-preview--row {
  flex-direction: row;
  gap: var(--atom-x3);
}

/* "The preview owns the whole canvas." Alignment stays centred — the stage
   elements that use this either size themselves explicitly or are absolutely
   positioned against the canvas, so stretching would only break centring. */
.atom-preview--fill {
  padding: 0;
}

/* A padded inner box for previews that want to bleed to the frame edges. */
.atom-preview--pad {
  padding: var(--atom-x5);
}

/* --- shared preview primitives ------------------------------------------- */

/* A raised surface — the "white card" most previews sit on. */
.atom-pv-surface {
  background: var(--atom-bg-layer);
  border-radius: var(--atom-radius-r3);
  box-shadow: var(--atom-shadow-s1);
}

/* A dimmed backdrop for the overlay-family previews. */
.atom-pv-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

/* Grey filler bars standing in for body copy. */
.atom-pv-bar {
  height: 8px;
  border-radius: var(--atom-radius-full);
  background: var(--atom-bg-neutral-weak);
}

/* The blue hatched fill the source uses to mark "your content goes here". */
.atom-pv-hatch {
  border-radius: var(--atom-radius-r1);
  background-color: rgba(120, 170, 235, 0.35);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(90, 150, 225, 0.55) 0 2px,
    transparent 2px 6px
  );
}

/* --- mini device frame (bottom nav / sheets / top nav / banners) --------- */
.atom-pv-phone {
  position: relative;
  width: 226px;
  height: 225px;
  overflow: hidden;
  background: var(--atom-bg-layer);
  border-radius: var(--atom-radius-r3) var(--atom-radius-r3) 0 0;
}

.atom-pv-phone__body {
  position: absolute;
  inset: 0;
  background: var(--atom-gray-400);
  opacity: 0.55;
}

.atom-pv-phone__home-indicator {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 74px;
  height: 4px;
  border-radius: var(--atom-radius-full);
  background: var(--atom-fg-neutral);
  opacity: 0.35;
}

/* --- shared icon sizing -------------------------------------------------- */
.atom-pv-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.atom-pv-icon--sm {
  width: 14px;
  height: 14px;
}

.atom-pv-icon--lg {
  width: 24px;
  height: 24px;
}
