/*
 * Custom design request form.
 *
 * Styled from the theme's own custom properties rather than its utility
 * classes. That is deliberate: the theme's Tailwind build only scans theme
 * files, so a class used here would have no CSS generated for it. Reading the
 * variables instead means this form takes the shop's colours, fonts and corner
 * radius automatically, and follows them when the client changes them under
 * Website look.
 *
 * Every variable has a fallback, so the form is still presentable on a theme
 * that defines none of them.
 */

.pdr-promo,
.pdr-inline,
.pdr-modal,
.pdr-product-cta,
.pdr-checkout-note {
  --pdr-ink: var(--color-ink, #1f2430);
  --pdr-muted: var(--color-muted, #6b7280);
  --pdr-action: var(--color-action, #b91e4d);
  --pdr-action-hover: var(--color-action-hover, #8f1740);
  --pdr-accent: var(--color-accent, #fcd9de);
  --pdr-soft: var(--color-soft, #f7d2d6);
  --pdr-cream: var(--color-cream, #fff6f6);
  --pdr-surface: var(--color-blush, #fffbfb);
  --pdr-line: var(--color-line, #ecdfe1);
  --pdr-radius: 1rem;
  --pdr-radius-sm: 0.625rem;

  font-family: inherit;
  color: var(--pdr-ink);
  box-sizing: border-box;
}

.pdr-promo *,
.pdr-inline *,
.pdr-modal *,
.pdr-product-cta * {
  box-sizing: border-box;
}

/* -------------------------------------------------------------------------
 * Buttons
 * ---------------------------------------------------------------------- */

.pdr-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  /* 48px: a comfortable target for a thumb, which is how most of these are
     going to be tapped. */
  min-height: 3rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--pdr-action);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

/* Stated, not inherited. A filled button that only changes its background on
   hover is how a label disappears into its own fill. */
.pdr-button:hover,
.pdr-button:focus-visible {
  background: var(--pdr-action-hover);
  color: #fff;
}

.pdr-button svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
}

.pdr-button--outline {
  background: transparent;
  color: var(--pdr-action);
  border: 1px solid currentColor;
}

.pdr-button--outline:hover,
.pdr-button--outline:focus-visible {
  background: var(--pdr-action);
  color: #fff;
  border-color: var(--pdr-action);
}

.pdr-button--submit {
  width: 100%;
  margin-top: 0.5rem;
}

.pdr-button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.pdr-link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--pdr-action);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

/* -------------------------------------------------------------------------
 * Promotional blocks
 * ---------------------------------------------------------------------- */

.pdr-promo {
  padding: 2.5rem 1.25rem;
  background: var(--pdr-cream);
}

.pdr-promo--wide {
  padding: 4rem 1.25rem;
  background: linear-gradient(180deg, var(--pdr-cream), var(--pdr-accent));
}

.pdr-promo__inner {
  max-width: 40rem;
  margin: 0 auto;
  text-align: center;
}

.pdr-promo__eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pdr-action);
}

.pdr-promo__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.2;
}

.pdr-promo__text {
  margin: 0 0 1.75rem;
  color: var(--pdr-muted);
  line-height: 1.65;
}

.pdr-product-cta {
  margin: 1rem 0 0;
}

.pdr-product-cta .pdr-button {
  width: 100%;
}

.pdr-product-cta__note {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--pdr-muted);
  text-align: center;
}

.pdr-checkout-note {
  margin: 1rem 0;
  font-size: 0.9375rem;
  color: var(--pdr-muted);
}

/* -------------------------------------------------------------------------
 * The modal
 * ---------------------------------------------------------------------- */

.pdr-modal[hidden] {
  display: none;
}

.pdr-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.pdr-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 18 25 / 0.55);
  backdrop-filter: blur(2px);
}

.pdr-modal__panel {
  position: relative;
  width: 100%;
  max-width: 46rem;
  /* Anchored to the bottom on a phone, where the buttons need to be within
     reach; centred once there is room. */
  max-height: 92dvh;
  overflow-y: auto;
  padding: 1.75rem 1.25rem 2rem;
  background: var(--pdr-surface);
  border-radius: 1.5rem 1.5rem 0 0;
  animation: pdr-rise 0.22s ease;
}

@media (min-width: 40rem) {
  .pdr-modal {
    align-items: center;
    padding: 1.5rem;
  }

  .pdr-modal__panel {
    max-height: 88dvh;
    padding: 2rem 2.25rem 2.25rem;
    border-radius: 1.5rem;
  }
}

@keyframes pdr-rise {
  from {
    transform: translateY(1.5rem);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pdr-modal__panel {
    animation: none;
  }
}

.pdr-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--pdr-muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.pdr-modal__close:hover {
  background: var(--pdr-accent);
  color: var(--pdr-ink);
}

/* -------------------------------------------------------------------------
 * The form
 * ---------------------------------------------------------------------- */

.pdr-inline {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--pdr-surface);
  border: 1px solid var(--pdr-line);
  border-radius: var(--pdr-radius);
}

.pdr-form__head {
  margin-bottom: 1.5rem;
  padding-right: 2.5rem;
}

.pdr-form__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.375rem, 3.5vw, 1.75rem);
  line-height: 1.25;
}

.pdr-form__intro {
  margin: 0;
  color: var(--pdr-muted);
  line-height: 1.6;
}

.pdr-grid {
  display: grid;
  gap: 1.125rem;
}

@media (min-width: 34rem) {
  .pdr-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.pdr-field {
  margin: 0 0 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.pdr-grid .pdr-field {
  margin: 0;
}

.pdr-field--full {
  grid-column: 1 / -1;
}

.pdr-field label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.pdr-field label span {
  color: var(--pdr-action);
}

.pdr-field input,
.pdr-field select,
.pdr-field textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--pdr-line);
  border-radius: var(--pdr-radius-sm);
  background: #fff;
  color: var(--pdr-ink);
  /* 16px stops iOS zooming the page when a field is focused. */
  font-size: 1rem;
  font-family: inherit;
}

.pdr-field textarea {
  min-height: auto;
  resize: vertical;
  line-height: 1.55;
}

.pdr-field input:focus,
.pdr-field select:focus,
.pdr-field textarea:focus {
  outline: 2px solid var(--pdr-action);
  outline-offset: 1px;
  border-color: transparent;
}

.pdr-field input[aria-invalid='true'],
.pdr-field textarea[aria-invalid='true'] {
  border-color: #dc2626;
}

.pdr-hint {
  font-size: 0.8125rem;
  color: var(--pdr-muted);
}

.pdr-privacy {
  margin: 1rem 0 0;
  font-size: 0.8125rem;
  color: var(--pdr-muted);
  text-align: center;
}

/* The honeypot. Hidden from people without display:none, which some bots
   check for. */
.pdr-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* -------------------------------------------------------------------------
 * Product context
 * ---------------------------------------------------------------------- */

.pdr-product {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  background: var(--pdr-cream);
  border-radius: var(--pdr-radius-sm);
}

.pdr-product img {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.5rem;
  object-fit: cover;
}

.pdr-product__label {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pdr-muted);
}

.pdr-product__name {
  margin: 0.125rem 0 0;
  font-weight: 600;
}

/* -------------------------------------------------------------------------
 * Uploads
 * ---------------------------------------------------------------------- */

.pdr-uploads {
  margin-bottom: 1.125rem;
}

.pdr-uploads__label {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.pdr-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 1.75rem 1rem;
  border: 2px dashed var(--pdr-line);
  border-radius: var(--pdr-radius-sm);
  background: var(--pdr-cream);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pdr-dropzone:hover,
.pdr-dropzone.is-over {
  border-color: var(--pdr-action);
  background: var(--pdr-accent);
}

.pdr-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pdr-dropzone__icon svg {
  width: 1.75rem;
  height: 1.75rem;
  fill: none;
  stroke: var(--pdr-action);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pdr-dropzone__text {
  font-size: 0.9375rem;
  color: var(--pdr-muted);
}

.pdr-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.625rem;
  margin: 0.875rem 0 0;
  padding: 0;
  list-style: none;
}

.pdr-preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--pdr-radius-sm);
  overflow: hidden;
  background: var(--pdr-cream);
}

.pdr-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pdr-preview__remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 999px;
  background: rgb(15 18 25 / 0.7);
  color: #fff;
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}

.pdr-preview__remove:hover {
  background: rgb(15 18 25 / 0.9);
}

/* -------------------------------------------------------------------------
 * Messages
 * ---------------------------------------------------------------------- */

.pdr-alert[hidden] {
  display: none;
}

.pdr-alert {
  margin-bottom: 1.25rem;
  padding: 0.875rem 1rem;
  border-radius: var(--pdr-radius-sm);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.pdr-alert--error {
  background: #fef2f2;
  color: #991b1b;
}

.pdr-alert--success {
  background: #ecfdf5;
  color: #065f46;
}

.pdr-done {
  padding: 2rem 1rem;
  text-align: center;
}

.pdr-done__mark {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ecfdf5;
  color: #059669;
  font-size: 1.75rem;
}

.pdr-done__title {
  margin: 0 0 0.5rem;
  font-size: 1.375rem;
}

.pdr-done__text {
  margin: 0 auto;
  max-width: 26rem;
  color: var(--pdr-muted);
  line-height: 1.65;
}

.pdr-done__ref {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--pdr-accent);
  font-weight: 700;
  letter-spacing: 0.04em;
}
