/* Visual Blog four-colour Highlight module. This file owns Highlight only. */
.visual-blog-highlight-module {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    flex: 0 0 auto;
}

.visual-blog-formatbar .visual-blog-highlight-module .visual-blog-highlight-button,
.visual-blog-formatbar .visual-blog-highlight-module .visual-blog-highlight-arrow {
    min-height: 38px;
    margin: 0 !important;
    border: 1px solid #cbd5e1 !important;
    background: #e5e7eb !important;
    color: #334155 !important;
    font-weight: 700;
    box-shadow: none !important;
    cursor: pointer;
}

.visual-blog-formatbar .visual-blog-highlight-module .visual-blog-highlight-button {
    padding: 0 14px !important;
    border-right: 0 !important;
    border-radius: 10px 0 0 10px !important;
}

.visual-blog-formatbar .visual-blog-highlight-module .visual-blog-highlight-arrow {
    width: 30px;
    min-width: 30px;
    padding: 0 !important;
    border-radius: 0 10px 10px 0 !important;
}

/* OFF = grey. */
.visual-blog-formatbar .visual-blog-highlight-module .visual-blog-highlight-button[aria-pressed="false"] {
    border-color: #cbd5e1 !important;
    background: #e5e7eb !important;
    color: #334155 !important;
}

/* ON = yellow, independently of the selected highlight colour. */
.visual-blog-formatbar .visual-blog-highlight-module .visual-blog-highlight-button[aria-pressed="true"],
.visual-blog-formatbar .visual-blog-highlight-module .visual-blog-highlight-button.is-active {
    border-color: #c99c00 !important;
    background: #ffe66f !important;
    color: #2f2500 !important;
}

.visual-blog-highlight-palette[hidden] { display: none !important; }

.visual-blog-highlight-palette {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 999999;
    display: flex;
    gap: 7px;
    padding: 8px;
    border: 1px solid #d7e0eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 35px rgba(15, 23, 42, .16);
}

.visual-blog-highlight-palette button {
    position: relative;
    width: 30px;
    height: 30px;
    min-height: 30px;
    margin: 0;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--tw-highlight-swatch, #fff) !important;
    cursor: pointer;
}

.visual-blog-highlight-palette button span {
    display: none !important;
}

.visual-blog-highlight-palette button[data-tw-highlight-color="#fff2a8"] { --tw-highlight-swatch: #fff2a8; }
.visual-blog-highlight-palette button[data-tw-highlight-color="#c8f7d2"] { --tw-highlight-swatch: #c8f7d2; }
.visual-blog-highlight-palette button[data-tw-highlight-color="#cfe8ff"] { --tw-highlight-swatch: #cfe8ff; }
.visual-blog-highlight-palette button[data-tw-highlight-color="#ffd5e5"] { --tw-highlight-swatch: #ffd5e5; }

.visual-blog-highlight-palette button.is-selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px #fff inset;
}

.visual-blog-highlight-palette button.is-selected::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #172033;
    font-weight: 900;
}

/* Repeated spaces must stay visible while editing and on the public blog. */
[data-tw-highlight-editor] mark[data-tw-highlight="1"],
mark[data-tw-highlight="1"] {
    display: inline;
    margin: 0;
    padding: 0;
    border-radius: 2px;
    color: inherit;
    white-space: pre-wrap;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    background: #fff2a8;
}

mark[data-tw-highlight="1"][data-tw-highlight-color="#fff2a8"] { background: #fff2a8; }
mark[data-tw-highlight="1"][data-tw-highlight-color="#c8f7d2"] { background: #c8f7d2; }
mark[data-tw-highlight="1"][data-tw-highlight-color="#cfe8ff"] { background: #cfe8ff; }
mark[data-tw-highlight="1"][data-tw-highlight-color="#ffd5e5"] { background: #ffd5e5; }

/* Keep ordinary spaces visible as well. This prevents the caret from appearing
   stuck when Highlight has just been turned OFF and the next input is a space. */
[data-tw-highlight-editor] {
    white-space: pre-wrap;
}
