/* Wagtail StructBlock fields are:
     [data-contentpath="field"] > label.w-field__label + [data-field-wrapper]
   Hide the contentpath node so the label stays with its input. */

.mv-link-block > [data-contentpath="label"],
.mv-link-block > [data-contentpath="page"],
.mv-link-block > [data-contentpath="url"],
.mv-link-block > [data-contentpath="anchor_id"],
.mv-link-block > [data-contentpath="email"],
.mv-link-block > [data-contentpath="phone"],
.mv-link-block > [data-contentpath="open_in_new_tab"],
.mv-link-block > [data-contentpath="style"],
.mv-link-block > [data-contentpath="media_type"],
.mv-link-block > [data-contentpath="media_image"],
.mv-link-block > [data-contentpath="media_file"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="label"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="page"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="url"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="anchor_id"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="email"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="phone"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="open_in_new_tab"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="style"] {
  display: none !important;
}

.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="media_type"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="media_image"],
.struct-block:has(> [data-contentpath="kind"]):has(> [data-contentpath="anchor_id"]) > [data-contentpath="media_file"] {
  display: none !important;
}

.mv-link-block:not(.mv-link-kind--blank) > [data-contentpath="label"],
.mv-link-block:not(.mv-link-kind--blank) > [data-contentpath="style"],
.struct-block:has(> [data-contentpath="kind"] select option:checked:not([value=""])) > [data-contentpath="label"],
.struct-block:has(> [data-contentpath="kind"] select option:checked:not([value=""])) > [data-contentpath="style"] {
  display: block !important;
}

.mv-link-block.mv-link-kind--internal > [data-contentpath="page"],
.mv-link-block.mv-link-kind--internal > [data-contentpath="url"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="internal"]) > [data-contentpath="page"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="internal"]) > [data-contentpath="url"] {
  display: block !important;
}

.mv-link-block.mv-link-kind--external > [data-contentpath="url"],
.mv-link-block.mv-link-kind--external > [data-contentpath="open_in_new_tab"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="external"]) > [data-contentpath="url"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="external"]) > [data-contentpath="open_in_new_tab"] {
  display: block !important;
}

.mv-link-block.mv-link-kind--anchor > [data-contentpath="anchor_id"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="anchor"]) > [data-contentpath="anchor_id"] {
  display: block !important;
}

.mv-link-block.mv-link-kind--email > [data-contentpath="email"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="email"]) > [data-contentpath="email"] {
  display: block !important;
}

.mv-link-block.mv-link-kind--phone > [data-contentpath="phone"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="phone"]) > [data-contentpath="phone"] {
  display: block !important;
}

.mv-link-block.mv-link-kind--file > [data-contentpath="url"],
.mv-link-block.mv-link-kind--file > [data-contentpath="open_in_new_tab"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="file"]) > [data-contentpath="url"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="file"]) > [data-contentpath="open_in_new_tab"] {
  display: block !important;
}

.mv-link-block.mv-link-kind--media_popup > [data-contentpath="media_type"],
.struct-block:has(> [data-contentpath="kind"] select option:checked[value="media_popup"]) > [data-contentpath="media_type"] {
  display: block !important;
}

.mv-internal-link-helper {
  margin-top: 8px;
}

.mv-internal-link-helper__status {
  margin: 0;
  color: var(--w-color-text-meta, #5b5b5b);
  font-size: 12px;
  line-height: 1.45;
}

.mv-internal-link-helper__suggestions:empty {
  display: none;
}

.mv-internal-link-helper__suggestions {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.mv-internal-link-helper__suggestion {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--w-color-border-field-default, #d9d9d9);
  border-radius: 4px;
  background: var(--w-color-surface-page, #fff);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.mv-internal-link-helper__suggestion:hover,
.mv-internal-link-helper__suggestion:focus-visible {
  border-color: var(--w-color-primary, #007d7e);
  background: var(--w-color-surface-field, #f6f6f6);
  outline: none;
}

.mv-internal-link-helper__suggestion small {
  color: var(--w-color-text-meta, #5b5b5b);
}
