/* Photo Lab - compact style picker + rebuilt wizard navigation. Loaded ONLY by photo-lab.php, after photo-lab.css and typography.css.
   Scope: Step 3 style grid and the bottom dock (Back / Continue) on all six steps. Souvenir rendering, style ids, filters, upload/crop,
   personalization, copies, pricing and submission are untouched. Selectors are prefixed (html .pl-app[data-pl-step]) so they win
   over the layered poster rules in photo-lab.css without !important. */

/* ================= STEP 3 - compact style grid ================= */
html .pl-app[data-pl-step] .pl-style3 .pl-styles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: none;
  align-content: start;
  gap: 10px;
  flex: none;
  margin: 0;
  padding: 2px;
  overflow: visible;
  scroll-snap-type: none;
}

html .pl-app[data-pl-step] .pl-style3 .pl-style {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  flex: none;
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 0;
  padding: 6px 6px 9px;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  text-align: left;
  scroll-snap-align: none;
}

html .pl-app[data-pl-step] .pl-style3 .pl-style canvas {
  width: 100%;
  height: auto;
  max-width: none;
  min-height: 0;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
}

html .pl-app[data-pl-step] .pl-style3 .pl-style strong {
  display: block;
  padding: 0 3px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  color: #fff;
}

html .pl-app[data-pl-step] .pl-style3 .pl-style:hover,
html .pl-app[data-pl-step] .pl-style3 .pl-style:focus-visible {
  border-color: rgba(255, 90, 104, 0.8);
}

html .pl-app[data-pl-step] .pl-style3 .pl-style:focus-visible {
  outline: 2px solid #ff4452;
  outline-offset: 2px;
}

/* selected: clear red outline + checkmark badge (the "Selected" word stays for screen readers, aria-pressed carries the state) */
html .pl-app[data-pl-step] .pl-style3 .pl-style.is-selected,
html .pl-app[data-pl-step] .pl-style3 .pl-style[aria-pressed="true"] {
  padding: 6px 6px 9px;
  border-color: #ff2a3c;
  box-shadow: 0 0 0 2px #ff2a3c, 0 0 18px rgba(255, 24, 44, 0.5);
}

html .pl-app[data-pl-step] .pl-style3 .pl-style .pl-style__state {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

html .pl-app[data-pl-step] .pl-style3 .pl-style .pl-style__check {
  top: 12px;
  right: 12px;
}

html .pl-app[data-pl-step] .pl-style3__panel {
  gap: 10px;
}

html .pl-app[data-pl-step] .pl-style3__head {
  padding-right: 14px;
}

@media (max-width: 1099px) {
  html .pl-app[data-pl-step] .pl-style3__panel {
    padding: 14px;
  }

  html .pl-app[data-pl-step] .pl-style3__head {
    padding-right: 0;
  }
}

@media (min-width: 1100px) {
  html .pl-app[data-pl-step] .pl-style3 .pl-styles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(100%, calc(3 * 168 * var(--u) + 2 * 10px));
    margin-inline: auto;
    gap: calc(10 * var(--u));
  }

  html .pl-app[data-pl-step] .pl-style3 .pl-style {
    gap: calc(6 * var(--u));
    padding: calc(5 * var(--u)) calc(5 * var(--u)) calc(8 * var(--u));
  }

  html .pl-app[data-pl-step] .pl-style3 .pl-style.is-selected,
  html .pl-app[data-pl-step] .pl-style3 .pl-style[aria-pressed="true"] {
    padding: calc(5 * var(--u)) calc(5 * var(--u)) calc(8 * var(--u));
  }

  html .pl-app[data-pl-step] .pl-style3 .pl-style strong {
    font-size: max(12.5px, calc(14.5 * var(--u)));
  }

  html .pl-app[data-pl-step] .pl-style3__panel {
    align-self: center;
    flex: 1 1 auto;
  }
}

/* ================= BOTTOM NAVIGATION (all six steps) ================= */
/* the explanatory "Next: ..." strip crowded the controls; the step headline and progress already say where the user is */
html .pl-app[data-pl-step] .pl-dock__hint {
  display: none;
}

html .pl-app[data-pl-step] .pl-dock .pl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

html .pl-app[data-pl-step] .pl-dock .pl-btn.pl-btn--primary {
  font-weight: 700;
}

@media (max-width: 1099px) {
  html .pl-app[data-pl-step] .pl-dock {
    grid-template-columns: minmax(104px, 0.62fr) minmax(0, 1fr);
    grid-template-areas: "back next";
    gap: 10px;
    padding: 10px;
    margin: 10px 8px calc(10px + env(safe-area-inset-bottom));
  }

  html .pl-app[data-pl-step] .pl-dock .pl-btn {
    min-height: 50px;
    padding: 0 16px;
    font-size: 1rem;
  }

  html .pl-app[data-pl-step] .pl-dock [data-pl-dock-next] {
    font-size: 1rem;
    padding: 0 16px;
    white-space: nowrap;
  }
}

@media (min-width: 1100px) {
  html .pl-app[data-pl-step] .pl-dock {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  html .pl-app[data-pl-step] .pl-dock .pl-btn {
    width: auto;
    min-width: max(150px, calc(170 * var(--u)));
    padding: 0 max(18px, calc(24 * var(--u)));
    font-size: max(14px, calc(15 * var(--u)));
  }

  html .pl-app[data-pl-step] .pl-dock [data-pl-back] {
    grid-column: 1;
    justify-self: start;
    width: auto;
  }

  html .pl-app[data-pl-step] .pl-dock [data-pl-dock-next] {
    grid-column: 3;
    justify-self: end;
    width: auto;
    min-width: max(190px, calc(230 * var(--u)));
    font-size: max(14px, calc(15 * var(--u)));
  }
}

/* ---- desktop: dock sits a little lower and lighter so step 5's summary + "Edit personalization" never touch it ---- */
@media (min-width: 1100px) {
  html .pl-app[data-pl-step] .pl-dock {
    top: calc(888 * var(--u));
    height: calc(52 * var(--u));
    padding: calc(3 * var(--u)) calc(8 * var(--u));
  }

  html .pl-app[data-pl-step] .pl-dock .pl-btn {
    height: calc(44 * var(--u));
    min-height: 40px;
  }

  /* step 6: Back used to float over the photo's corner; it now sits under the Send card, in the same column */
  html .pl-app[data-pl-step="6"] .pl-send {
    grid-template-rows: max-content max-content;
    align-content: start;
    height: auto;
    row-gap: calc(14 * var(--u));
    align-items: start;
  }

  html .pl-app[data-pl-step="6"] .pl-send__photo {
    display: contents;
  }

  html .pl-app[data-pl-step="6"] .pl-print--send {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  html .pl-app[data-pl-step="6"] .pl-send-card {
    grid-column: 2;
    grid-row: 1;
  }

  html .pl-app[data-pl-step="6"] .pl-send__back {
    position: static;
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    width: auto;
    min-width: max(150px, calc(170 * var(--u)));
    min-height: 44px;
    padding: 0 max(18px, calc(24 * var(--u)));
    font-size: max(14px, calc(15 * var(--u)));
  }
}
