/* Neutral defaults; a design restyles .consent and its parts as it likes */
dialog.consent {
    box-sizing: border-box;
    width: calc(100% - 2rem);
    max-width: 40rem;
    max-height: calc(100% - 2rem);
    padding: 0;
    border: none;
    border-radius: 0.5rem;
    background: #fff;
    color: #222;
    font: inherit;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.25);
    overflow-y: auto;
}

/* The dialog itself takes the focus when it opens; its links and buttons show theirs */
dialog.consent:focus {
    outline: none;
}

dialog.consent::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.consent-dialog {
    padding: 1.5rem;
}

.consent-heading {
    margin: 0 0 1rem;
}

.consent-text p:first-child,
.consent-category-text p:first-child {
    margin-top: 0;
}

/* The spacing between the parts is theirs alone: a last paragraph's margin would add to it */
.consent-text p:last-child,
.consent-category-text p:last-child,
.consent-links {
    margin-bottom: 0;
}

.consent-categories {
    margin: 1rem 0;
}

.consent-category {
    padding: 0.75rem 0;
    border-top: 1px solid rgba(0, 0, 0, 0.15);
}

.consent-category-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.consent-category-label input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
}

.consent-category-state {
    margin-left: auto;
    font-size: 0.875em;
    opacity: 0.7;
}

.consent-category-text {
    margin-top: 0.5rem;
    font-size: 0.9em;
}

.consent-links a + a {
    margin-left: 1rem;
}

.consent-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.consent-controls button {
    flex: 1 1 10rem;
    justify-content: center;
    text-align: center;
    cursor: pointer;
}

/* What consent.js hides (the categories and "Accept selection" until the settings open) stays
   hidden against a design's button and box rules: one design's
   "body #website-wrapper .block .button { display: inline-block }" showed the button at once */
dialog.consent [hidden] {
    display: none !important;
}

/* Open, the dialog is in the browser's top layer above everything else, and closed it shows
   nothing, so its block takes no room and shows no frame or options, on the site as in the
   admin. Its options are under Blocks in the admin toolbar. */
.block:has(> dialog.consent):not(:has(> .consent-settings-link)) {
    position: absolute !important;
    width: 0 !important;
    min-width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.block:has(> dialog.consent):not(:has(> .consent-settings-link)) > :is(.block-button, .block-options, .block-frame) {
    display: none !important;
}
