/* Polaroid cover: a tilted white frame with a pin, rendered between a card's
   band and its content. The photo keeps its ratio and is never cropped. */
.polaroid {
  --polaroid-photo-max-width: 179px;
  --polaroid-photo-max-height: 179px;
  --polaroid-padding: 7px;
  --polaroid-pin-size: 22px;
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;

  @media (max-width: 900px) {
    --polaroid-photo-max-width: 200px;
    --polaroid-photo-max-height: 155px;
  }
}

/* Climbs into the band above it, which is made taller to hold it. The
   compound selector outranks the header's own min-height. */
.polaroid--pinned {
  margin-top: -58px;
}

.pots__pot-card__header.pots__pot-card__header--tall {
  min-height: 90px;
}

/* Smaller, in the flow (owner dashboard). */
.polaroid--small {
  --polaroid-photo-max-width: 120px;
  --polaroid-photo-max-height: 120px;
  --polaroid-padding: 5px;
  --polaroid-pin-size: 16px;
  margin-top: var(--spacing-xl);
}

.polaroid__frame {
  position: relative;
  padding: var(--polaroid-padding) var(--polaroid-padding) calc(var(--polaroid-padding) + 2px);
  background-color: white;
  border-radius: 5px;
  box-shadow: 0 10px 26px rgb(0 0 0 / 16%);
  transform: rotate(-3deg);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;

  /* Lifts a little when it opens the lightbox, so it reads as clickable. */
  &:has(.polaroid__link):hover {
    transform: rotate(-1.5deg) translateY(-4px);
    box-shadow: 0 16px 32px rgb(0 0 0 / 24%);
  }
}

.polaroid__link {
  display: block;
}

.polaroid__photo {
  display: block;
  width: auto;
  height: auto;
  max-width: var(--polaroid-photo-max-width);
  max-height: var(--polaroid-photo-max-height);
  border-radius: 2px;
  background-color: #F2F2F2;
}

.polaroid__pin {
  position: absolute;
  top: calc(-1 * var(--polaroid-pin-size) / 2);
  left: 50%;
  width: var(--polaroid-pin-size);
  height: var(--polaroid-pin-size);
  transform: translateX(-50%);
  border-radius: var(--rounded-full);
  background-color: white;
  box-shadow: inset 0 0 0 1px #ECEAE3, 0 1px 3px rgb(0 0 0 / 12%);

  &::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 40%;
    height: 40%;
    margin: auto;
    border-radius: var(--rounded-full);
    background-color: #BCC8CB;
  }
}

/* Lightbox */
.cover-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  border-radius: var(--rounded-3xs);
}

/* Cover picker in the pot form */
.cover-field__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.cover-field__dropzone {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border: 2px dashed var(--color-border-neutral);
  border-radius: var(--rounded-xs);
  background-color: white;
  transition: border-color 0.15s, background-color 0.15s;
}

.cover-field__dropzone[hidden],
.cover-field__preview[hidden] {
  display: none;
}

/* Same accent as a focused input. */
.cover-field__dropzone:hover,
.cover-field__dropzone--active {
  border-color: var(--color-input-border-focus);
  background-color: hsl(35deg 27% 94% / 0.39);
}

/* Pressed: flashes back to white so the click registers visually. */
.cover-field__dropzone:active {
  background-color: white;
}

.cover-field__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: var(--rounded-3xs);
  background-color: hsl(94deg 100% 10% / 0.07);
  color: var(--interactive-primary);

  svg {
    width: 28px;
    height: 28px;
  }
}

/* The text keeps a readable width next to the icon. */
.cover-field__text {
  flex: 1;
}

.cover-field__preview {
  box-shadow: none;

  .polaroid {
    --polaroid-photo-max-width: 143px;
    --polaroid-photo-max-height: 143px;
  }
}

.cover-field__preview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-md);
  padding: var(--spacing-lg) var(--spacing-md) var(--spacing-xl);
}

.cover-field__remove {
  --btn-color: var(--color-danger);
}

.cover-field__error {
  font-size: var(--font-sm);
  color: var(--color-danger);
}
