/*
 * What the new portal adds to the old stylesheets and more than one component uses: text for
 * screen readers, the header's hidden entries, the skip link, the classes that give a heading moved up a level the look it
 * had, the headings' spacing, the rows of buttons and the back links, the overviews' actions, and the
 * rich-text editor's box, headings and link dialog. What belongs to one component is in that
 * component's own .razor.css; what changes a rule the old stylesheet already had is in common.css.
 */

:root {
    --button-gap: 10px;
}

/* Room for the scrollbar on every page, whether it scrolls or not, so the centred content, the header
   and the menu do not move sideways on a page change. Where the scrollbar lies over the page, as on
   macOS and phones, nothing is reserved. */
html {
    scrollbar-gutter: stable;
}

/* Text for screen readers only. Taken out of the flow it is a block of its own, where nowrap would
   collapse its leading and trailing spaces, and the screen reader would read the link
   "Titel<span> (åbner i et nyt vindue)</span>" as "Titel(åbner i et nyt vindue)". pre keeps the
   spaces and, like nowrap, keeps the text on one line, so the words are not read as one. */
.visually-hidden,
.skip-link {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: pre;
    border: 0;
}

/* What the header hides with the hidden attribute stays hidden, although common.css gives the
   menu's entries and links a display of their own, which would otherwise win over the browser's. */
header [hidden] {
    display: none !important;
}

/* The first thing a keyboard user reaches. Shown on focus only, above the header and the ribbon. */
.skip-link:focus {
    z-index: 2;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0.75rem 1.25rem;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background-color: #000;
    color: #fff;
    outline: 3px solid #fff;
    outline-offset: -5px;
}

/*
 * Headings moved up one level keep the look of the level they had. The old pages start at h2 and
 * have no h1; the new ones start at h1, and every heading under it moves up one level too, so the
 * outline skips nothing. `<h1 class="h2">` looks as an h2 did: the browser's default for the
 * level, plus what common.css gave it. The element is part of the selector so these win over
 * common.css's element rules (`h3`, `h4`, `.message-container h1`) without !important.
 */
h1.h2 {
    font-size: 1.5em;
    margin-block: 0.83em;
}

h2.h3 {
    font-family: 'KontrapunktBobLightRegular';
    font-size: 1.17em;
    margin-block: 1em;
}

h3.h4 {
    font-family: inherit;
    font-size: 11pt;
    margin-block: 1.33em;
}

/* The delete pages' question, an h5 directly under the page's title on the old pages. */
h2.h5 {
    width: 960px;
    font-size: 12pt;
    margin-block: 1.67em;
}


/*
 * A heading stands nearer what it introduces than what comes before it: 20 px above, as between two
 * boxes, and 10 px below. The box straight after it - inside the form, or past the empty clearing
 * div, where that is what comes first - sits 10 px under it. After the rules above, which these
 * refine.
 */
.contentArea > :is(h1, h2),
fieldset > h2:not(.h3) {
    margin-top: 20px;
    margin-bottom: 0;
}

.contentArea > :is(h1, h2) + :not(form, .clr),
.contentArea > :is(h1, h2) + .clr + *,
.contentArea > :is(h1, h2) + form > fieldset:first-of-type,
fieldset > h2:not(.h3) + fieldset {
    margin-top: 10px;
}

/* The same in the text pages' boxes. */
.contentWindow :is(h2, h3) {
    margin-top: 1.5em;
    margin-bottom: 0.3em;
}

.contentWindow :is(h2, h3) + * {
    margin-top: 0;
}

.contentWindow h2 + h3 {
    margin-top: 0.8em;
}

/* The message and error pages' titles, over the text they head. */
.message-container h1,
.error-container h1 {
    margin-bottom: 8px;
}

/*
 * One space between buttons, wherever they stand in a row. common.css gives every button 20 px to
 * its right, and the line's white space adds to it, so a row of buttons is a flex row with one gap
 * instead, and its buttons have no margin of their own.
 */
.filterButtons,
.contentBottomContainer,
.buttonRow,
.session-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--button-gap);
}

:is(.filterButtons, .contentBottomContainer, .buttonRow, .session-dialog__actions) :is(.btn, input[type="submit"]) {
    margin-right: 0;
}

/* Tilbage til oversigt takes a line of its own below the page's buttons, so it does not read as one
   of them: it leaves the page, where the buttons act on it. */
.contentBottomContainer > a.backLink {
    flex-basis: 100%;
}

/* The back links with a small chevron in front, drawn from two borders so a screen reader has no
   character to read out. It takes the link's own colour, and it moves with the text. */
a.backLink::before {
    content: "";
    display: inline-block;
    width: 0.35em;
    height: 0.35em;
    margin-right: 0.4em;
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: translateY(-0.1em) rotate(45deg);
}

/* The master data overviews' actions, and a hearing's documents' on its edit page, right-aligned in
   their column with the same space on both sides of each bar: a flex row drops the markup's spaces
   and spaces the items evenly. */
.adminList .actions,
.documentArea .actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6em;
}

.adminList .actions .separator,
.documentArea .actions .separator {
    color: #b3b3b3;
}

/* A hearing's documents' size right-aligned on its edit page, so it stands just before their actions,
   which keep to the right edge as narrow as they can be. The title column keeps its width from the
   type's heading. */
.documentArea .windowContainer table .fileSize {
    text-align: right;
}

.documentArea .actionsColumn {
    width: 1%;
    white-space: nowrap;
    padding-left: 1.5em;
}

/* Om Høringsportalen's contents: a list, so a screen reader says how many entries it has, drawn as
   the links one to a line, without bullets or indent. */
.aboutContents {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* The rich-text editor's editing area fills its box, so a click anywhere in the box puts the cursor
   in the text, as it did in the old editor. Trumbowyg gives the area a min-height of 100%, which
   resolves to nothing in a box whose height comes from flex, so the area was only as high as its
   text. The width is set because Trumbowyg's auto margins would otherwise shrink the area to its
   text and centre it in the column. */
.trumbowyg-editor-box {
    display: flex;
    flex-direction: column;
}

.trumbowyg-box .trumbowyg-editor {
    flex: 1;
    width: 100%;
}

/* The editor stands as far above the next label as the text fields do, 14 px: a field's 9 px bottom
   margin adds to the label's 5 px, because the field is inline-block, while the editor's box is a
   block, whose margin would fold into the label's, so it takes the sum. */
.trumbowyg-box {
    margin-bottom: 14px;
}

/* The editor's border and the link dialog's fields in the text fields' grey from common.css, 3:1
   against the white form, where Trumbowyg's own #d7e0e2 and #dedede have 1.3:1. */
.trumbowyg-box,
.trumbowyg-editor-box,
.trumbowyg-modal-box .trumbowyg-input-row {
    border-color: #8a8a8a;
}

/*
 * A heading in a hearing's description is part of its text, not a box's title. The details page and
 * the form both stand in a fieldset, whose h3 is drawn as the box's title in common.css, with an
 * indent and a dashed line. The editor's four levels, h3 to h6, get one scale in the headings' font
 * instead, larger than the text and smaller for each level.
 */
.fieldContainer dd :is(h3, h4, h5, h6),
.trumbowyg-editor :is(h3, h4, h5, h6) {
    margin: 10px 0 5px;
    padding: 0;
    border-bottom: none;
    font-family: KontrapunktBobLightRegular, Arial, Verdana, sans-serif;
    font-weight: bold;
    line-height: 1.3;
}

.fieldContainer dd h3,
.trumbowyg-editor h3 {
    font-size: 19px;
}

.fieldContainer dd h4,
.trumbowyg-editor h4 {
    font-size: 17px;
}

.fieldContainer dd h5,
.trumbowyg-editor h5 {
    font-size: 15px;
}

.fieldContainer dd h6,
.trumbowyg-editor h6 {
    font-size: 14px;
}

.fieldContainer dd > :first-child,
.trumbowyg-editor > :first-child {
    margin-top: 0;
}

/* The link dialog in the portal's look. Its fields lose the 9 px common.css puts under every text
   field, which made each row taller than its label. Bekræft is drawn as the form's green buttons
   and Annuller as its grey one, in Trumbowyg's place and size, which the portal's buttons nearly
   have anyway; both keep a focus outline, which Trumbowyg takes away. The green is the form
   buttons' in common.css, with 4.5:1 for the white text at its lightest point. */
.trumbowyg-modal-box .trumbowyg-input-html input {
    margin: 0;
}

/* The dialog's field labels, URL and Tekst, in the portal's body text colour, and the message on an
   empty required field in the red of the portal's validation messages. Trumbowyg's own grey-blue
   and red both have 3.7:1 against the labels' background, under the 4.5:1 normal text needs. */
.trumbowyg-modal-box .trumbowyg-input-infos label {
    color: #61625d;
}

.trumbowyg-modal-box .trumbowyg-input-infos .trumbowyg-msg-error {
    color: #cc0000;
}

.trumbowyg-modal-box .trumbowyg-modal-button {
    border: 1px solid;
    border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
    background-repeat: repeat-x;
    font-family: Arial, Verdana, sans-serif;
    font-size: 13px;
    transition: background-position 0.1s linear;
}

.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit,
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:focus,
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:active {
    background-color: #627335;
    background-image: linear-gradient(to bottom, #6b7d39 0%, #627335 30%, #627335 70%, #55642e 100%);
    border-color: #55642e #55642e #003580;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
}

.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset,
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:focus,
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:active {
    background-color: #f5f5f5;
    background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
    border-color: #e6e6e6 #e6e6e6 #bfbfbf;
    color: #333333;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
}

.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:hover {
    background-color: #55642e;
    background-position: 0 -15px;
}

.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:hover {
    background-color: #e6e6e6;
    background-position: 0 -15px;
}

/* The dialog places its two 100 px buttons from the right edge, with the rows' space between them. */
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit {
    right: calc(100px + var(--button-gap));
}

.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:focus-visible,
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:focus-visible {
    outline: 2px solid #1f497d;
    outline-offset: 2px;
}

/* The item that applies in each of the editor's menus, which the script marks with aria-pressed:
   the text type at the cursor in bold on grey, the colour with an outline round its swatch. */
.trumbowyg-dropdown-heading button[aria-pressed="true"] {
    background: #ecf0f1;
    font-weight: bold;
}

.trumbowyg-dropdown-foreColor button[aria-pressed="true"],
.trumbowyg-dropdown-backColor button[aria-pressed="true"] {
    outline: 2px solid #1f497d;
    outline-offset: 1px;
}

/* The colour lists' remove buttons, a checkered swatch drawn here; the plugin draws it from a data:
   image, which the Content-Security-Policy blocks. */
.trumbowyg-dropdown .trumbowyg-foreColorRemove-dropdown-button,
.trumbowyg-dropdown .trumbowyg-backColorRemove-dropdown-button {
    background: repeating-conic-gradient(#cccccc 0 25%, #ffffff 0 50%) 0 0 / 8px 8px;
}
