/* Letter + name preview (admin configurator and client tracking).

   The fonts are exactly the ones used by the print model:
   - base letter: Liberation Serif Bold
   - name:        Lobster Two Bold Italic
   Both are self-hosted so the preview does not depend on Google Fonts.

   Rendered in CSS: white extruded base letter, coloured name with a
   contrasting outline, on the dark printing plate background. */

@font-face {
  font-family: "LP Liberation Serif";
  src: url("../fonts/liberation-serif-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LP Lobster Two";
  src: url("../fonts/lobster-two-700-italic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

.lp {
  --lp-name: #3ECFC0;
  --lp-border: #A9F0E8;
  --lp-base-size: 62;
  --lp-name-size: 18;
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  /* Always a square stage, in the admin configurator and on the client page. */
  aspect-ratio: 1 / 1;
  container-type: inline-size;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(120% 95% at 50% 6%, #45454b 0%, #303035 48%, #202024 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .09),
    inset 0 -34px 70px -34px rgba(0, 0, 0, .85),
    0 18px 40px -30px rgba(0, 0, 0, .55);
  isolation: isolate;
  user-select: none;
}
.lp::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  pointer-events: none;
  z-index: 4;
}

.lp-stage {
  position: absolute;
  inset: 3% 3% 5%;
  display: grid;
  place-items: center;
  z-index: 1;
}

.lp-base {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 2%;
  font-family: "LP Liberation Serif", "Liberation Serif", Georgia, serif;
  font-weight: 700;
  font-size: calc(var(--lp-base-size) * 1cqw);
  line-height: .92;
  white-space: nowrap;
  letter-spacing: -.01em;
  color: #fff;
  /* Slightly fatter than the plain glyph, like the printed lightbox letter. */
  -webkit-text-stroke: .012em #fff;
  transform: translateY(-2%);
  /* Solid side wall: many stacked copies instead of one offset shadow, so the
     letter reads as an extruded solid and not as a doubled letter. */
  text-shadow:
    -0.006em 0.005em 0 #dcdce3,
    -0.012em 0.010em 0 #d9d9e1,
    -0.018em 0.015em 0 #d6d6df,
    -0.024em 0.020em 0 #d3d3dc,
    -0.030em 0.025em 0 #d0d0da,
    -0.036em 0.030em 0 #cdcdd8,
    -0.042em 0.035em 0 #cacad6,
    -0.048em 0.040em 0 #c7c7d4,
    -0.054em 0.045em 0 #c4c4d2,
    -0.060em 0.050em 0 #c1c1cf,
    -0.066em 0.055em 0 #bebecd;
  filter: drop-shadow(0 0.055em 0.07em rgba(0, 0, 0, .38));
  z-index: 1;
}

.lp-name {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%) rotate(-8deg);
  display: inline-grid;
  grid-template-columns: 1fr;
  font-family: "LP Lobster Two", "Lobster Two", Georgia, cursive;
  font-style: italic;
  font-weight: 700;
  font-size: calc(var(--lp-name-size) * 1cqw);
  line-height: 1.06;
  white-space: nowrap;
  max-width: 100%;
}
.lp-name > span {
  grid-area: 1 / 1;
  display: block;
  white-space: nowrap;
}
.lp-name-back {
  color: var(--lp-border);
  -webkit-text-stroke: .055em var(--lp-border);
  filter:
    drop-shadow(-0.06em 0.05em 0 var(--lp-border))
    drop-shadow(0 0.055em 0.085em rgba(0, 0, 0, .32));
}
.lp-name-front {
  position: relative;
  z-index: 2;
  color: var(--lp-name);
}

.lp-empty .lp-name { display: none; }

.lp-note {
  margin: .55rem 0 0;
  font-size: .72rem;
  line-height: 1.45;
  color: #86756E;
}

/* --- real 3D preview (canvas replaces the CSS letter once it renders) --- */
.lp-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  z-index: 2;
  touch-action: none;
  cursor: grab;
}
.lp.is-dragging .lp-canvas { cursor: grabbing; }
.lp.is-3d .lp-stage { display: none; }
.lp-hint {
  position: absolute;
  left: 11px;
  bottom: 9px;
  z-index: 3;
  display: none;
  font: 600 max(.55rem, 9px)/1.2 "Manrope", system-ui, sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .5);
  pointer-events: none;
}
.lp.is-3d .lp-hint { display: block; }
.lp.is-dragging .lp-hint { opacity: 0; }

/* client tracking card that hosts the preview */
.track-preview { margin-bottom: 1rem; }
.track-popup-body > .track-preview { width: min(100%, 1040px); margin-inline: auto; }
.track-preview .lp { max-width: 440px; margin: .7rem auto .4rem; }
.track-preview .lp-note { text-align: center; }
