/* Børneflapper Designer. Everything the tool needs is here: it takes the site's
 * colours when the theme offers them and has its own values if it does not. */

.bf-designer {
  --bf-ink: var(--ink, oklch(25% 0.055 250));
  --bf-soft: var(--ink-soft, oklch(42% 0.035 250));
  --bf-line: var(--line, oklch(88% 0.025 240));
  --bf-blue: var(--blue-deep, oklch(45% 0.12 240));
  --bf-tint: var(--blue-soft, oklch(96% 0.028 238));
  --bf-white: oklch(99% 0.004 235);
  --bf-top: var(--header-height, 4.75rem);

  display: grid;
  grid-template-columns: minmax(20rem, 0.75fr) minmax(0, 1.25fr);
  overflow: clip;
  border: 1px solid var(--bf-line);
  border-radius: 1.2rem;
  color: var(--bf-ink);
  background: var(--bf-white);
  text-align: left;
}

.bf-designer *,
.bf-designer *::before {
  box-sizing: border-box;
}

.bf-controls {
  min-width: 0;
  padding: clamp(1.5rem, 3vw, 2.5rem);
}

.bf-field {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.bf-field + .bf-field {
  margin-top: 1.7rem;
}

.bf-step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
  padding: 0;
  color: var(--bf-ink);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
}

.bf-step > span {
  display: grid;
  flex: none;
  width: 1.7rem;
  height: 1.7rem;
  place-items: center;
  border-radius: 0.45rem;
  color: var(--bf-white);
  background: var(--bf-ink);
  font-size: 0.78rem;
}

.bf-step small {
  color: var(--bf-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.bf-designer .bf-input {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  margin: 0;
  border: 0.13rem solid var(--bf-line);
  border-radius: 0.62rem;
  padding: 0.7rem 0.9rem;
  color: var(--bf-ink);
  background: var(--bf-white);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
}

.bf-designer .bf-input + .bf-input {
  margin-top: 0.5rem;
}

.bf-designer .bf-input[hidden],
.bf-more[hidden] {
  display: none;
}

.bf-more {
  min-height: 2.75rem;
  margin-top: 0.25rem;
  border: 0;
  padding: 0.4rem 0;
  color: var(--bf-blue);
  background: none;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.bf-designer .bf-input::placeholder {
  color: var(--bf-soft);
  font-weight: 500;
  opacity: 1;
}

.bf-designer .bf-input:focus {
  border-color: var(--bf-blue);
  outline: none;
}

.bf-icons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3.1rem, 1fr));
  gap: 0.35rem;
  max-height: 15.6rem;
  overflow-y: auto;
  border: 1px solid var(--bf-line);
  border-radius: 0.62rem;
  padding: 0.45rem;
}

.bf-icon {
  display: grid;
  aspect-ratio: 1;
  min-height: 2.75rem;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  padding: 0.3rem;
  color: var(--bf-soft);
  background: transparent;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.bf-icon img {
  display: block;
  width: 100%;
  height: auto;
}

.bf-icon-none {
  border-color: var(--bf-line);
}

.bf-icon[aria-pressed="true"] {
  border-color: var(--bf-blue);
  background: var(--bf-tint);
  box-shadow: 0 0 0 1px var(--bf-blue);
}

.bf-color-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bf-color-row + .bf-color-row {
  margin-top: 0.6rem;
}

.bf-color-title {
  flex: 0 0 2.6rem;
  color: var(--bf-soft);
  font-size: 0.88rem;
  font-weight: 600;
}

.bf-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.bf-color {
  width: 2.4rem;
  height: 2.4rem;
  border: 2px solid var(--bf-white);
  border-radius: 50%;
  padding: 0;
  box-shadow: 0 0 0 1px var(--bf-line);
  cursor: pointer;
  transition: box-shadow 120ms ease;
}

.bf-color[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--bf-ink);
}

.bf-color:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.bf-icon:focus-visible,
.bf-color:focus-visible,
.bf-product:has(input:focus-visible) {
  outline: 2px solid var(--bf-blue);
  outline-offset: 2px;
}

.bf-stage {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1.5rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: var(--bf-tint);
}

.bf-stage-note {
  margin: 0 0 0.7rem;
  padding: 0;
  color: var(--bf-soft);
  font-size: 0.9rem;
  font-weight: 650;
}

/* The backing paper with the rest of the labels, as the sheet arrives in the post. */
.bf-sheet {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--bf-line);
  border-radius: 0.8rem;
  padding: clamp(1.75rem, 4.5vw, 3.25rem) clamp(1.25rem, 4vw, 3rem);
  background: oklch(96.5% 0.006 235);
}

.bf-sheet-labels {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
}

/* 3 x 1 cm with the corners of the real label: 5 % of the width is 15 % of the height. */
.bf-label {
  position: relative;
  overflow: hidden;
  border-radius: 5% / 15%;
  background: #fff;
  box-shadow:
    0 0 0 1px oklch(25% 0.055 250 / 0.1),
    0 0.15rem 0.3rem oklch(25% 0.055 250 / 0.14),
    0 0.9rem 2rem oklch(25% 0.055 250 / 0.16);
}

/* The sheen of the lacquer. */
.bf-label::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, transparent 30%, rgb(255 255 255 / 0.16) 42%, transparent 52%);
  pointer-events: none;
}

.bf-label canvas {
  display: block;
  width: 100%;
  height: auto;
}

.bf-products {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.bf-product {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 3rem;
  margin: 0;
  border: 1px solid var(--bf-line);
  padding: 0.5rem 0.9rem;
  background: var(--bf-white);
  font-size: 0.98rem;
  cursor: pointer;
}

.bf-product + .bf-product {
  border-top: 0;
}

.bf-product:first-of-type {
  border-radius: 0.62rem 0.62rem 0 0;
}

.bf-product:last-of-type {
  border-radius: 0 0 0.62rem 0.62rem;
}

.bf-product input {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--bf-blue);
}

.bf-product img {
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.45rem;
  object-fit: cover;
}

.bf-product-text {
  flex: 1;
  min-width: 0;
  font-weight: 650;
}

.bf-product-text small {
  display: block;
  color: var(--bf-soft);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.35;
}

.bf-product strong {
  font-weight: 700;
  white-space: nowrap;
}

.bf-product:has(input:checked) {
  background: oklch(99% 0.012 238);
  box-shadow: inset 0.2rem 0 0 var(--bf-blue);
}

.bf-order {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  border: 1px solid var(--bf-line);
  border-radius: 0.8rem;
  padding: 1rem 1rem 1rem 1.25rem;
  background: var(--bf-white);
}

.bf-order > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.bf-order strong {
  font-size: 1.08rem;
  font-weight: 700;
}

.bf-order span {
  color: var(--bf-soft);
  font-size: 0.78rem;
}

/* The site's button when the theme is there, a plain one when it is not. */
.bf-add {
  flex: none;
  min-height: 3.25rem;
  border: 0;
  border-radius: 0.72rem;
  padding: 0.78rem 1.35rem;
  color: var(--bf-white);
  background: var(--bf-blue);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.bf-add:disabled {
  opacity: 0.7;
  cursor: progress;
}

.bf-feedback {
  min-height: 1.4em;
  margin: -0.8rem 0 0;
  padding: 0;
  color: var(--bf-ink);
  font-size: 0.95rem;
  font-weight: 600;
}

.bf-feedback a {
  color: var(--bf-blue);
  text-decoration: underline;
}

.bf-feedback:empty {
  display: none;
}

/* The design button on product pages. */
.bf-design-link {
  margin: 1.2rem 0;
}

@media (max-width: 60rem) {
  /* The label stays in view while it is being filled in. */
  .bf-designer {
    display: flex;
    flex-direction: column;
  }

  .bf-stage {
    display: contents;
  }

  .bf-preview {
    position: sticky;
    z-index: 3;
    top: var(--bf-top);
    order: -1;
    border-bottom: 1px solid var(--bf-line);
    padding: 0.7rem 1rem 0.9rem;
    background: var(--bf-tint);
  }

  .bf-stage-note {
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
  }

  .bf-sheet {
    padding: 0.9rem 1rem;
  }

  .bf-label {
    max-width: 30rem;
    margin-inline: auto;
  }

  .bf-controls {
    padding: 1.4rem 1.1rem 1.6rem;
  }

  .bf-products,
  .bf-order {
    margin-inline: 1.1rem;
  }

  .bf-order {
    margin-top: 1.2rem;
  }

  .bf-feedback {
    margin: 0.7rem 1.1rem 0;
  }

  .bf-order + .bf-feedback,
  .bf-designer {
    padding-bottom: 1.1rem;
  }
}

@media (max-width: 30rem) {
  .bf-order {
    align-items: stretch;
    flex-direction: column;
  }

  .bf-add {
    width: 100%;
  }

  .bf-color-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.3rem;
  }

  .bf-color-title {
    flex: none;
  }

  /* Seven swatches in one row, each still large enough for a thumb. */
  .bf-colors {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 2.75rem));
    gap: 0.25rem;
    width: 100%;
    justify-content: space-between;
  }

  .bf-color {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bf-icon,
  .bf-color {
    transition: none;
  }
}
