:root {
    --fs-base: 14px;
    --lh-base: calc(var(--fs) * 2);
    --fs: var(--fs-base);
    --lh: var(--lh-base);
    
    --font-system: sans-serif;
    --font-default:  'BBB Readme', sans-serif;
    --font: var(--font-default);

    --c-body: rgb(225, 240, 232);
    --c-link: rgb(42, 67, 53);
    --c-link-active: inherit;
    --c-link-visited: rgb(39, 40, 52);
}

@font-face {
    font-family: "BBB Readme";
    font-weight: normal;
    font-style: normal;
    src: url("../fonts/bbb-readme/BBBReadMe-Regular.woff2") format("woff2"),
        url("../fonts/bbb-readme/BBBReadMe-Regular.woff") format("woff");
}

@font-face {
    font-family: "BBB Readme";
    font-weight: normal;
    font-style: italic;
    src: url("../fonts/bbb-readme/BBBReadMe-Italic.woff2") format("woff2"),
        url("../fonts/bbb-readme/BBBReadMe-Italic.woff") format("woff");
}


@font-face {
    font-family: "BBB Readme";
    font-weight: 500;
    font-style: normal;
    src: url("../fonts/bbb-readme/BBBReadMe-SemiBold.woff2") format("woff2"),
        url("../fonts/bbb-readme/BBBReadMe-SemiBold.woff") format("woff");
}

@font-face {
    font-family: "BBB Readme";
    font-weight: 500;
    font-style: normal;

    src: url("../fonts/bbb-readme/BBBReadMe-SemiBoldItalic.woff2") format("woff2"),
        url("../fonts/bbb-readme/BBBReadMe-SemiBoldItalic.woff") format("woff");
}

@font-face {
    font-family: "BBB Readme";
    font-weight: bold;
    font-style: normal;
    src: url("../fonts/bbb-readme/BBBReadMe-Bold.woff2") format("woff2"),
        url("../fonts/bbb-readme/BBBReadMe-Bold.woff") format("woff");
}

@font-face {
    font-family: "BBB Readme";
    font-weight: bold;
    font-style: italic;
    src: url("../fonts/bbb-readme/BBBReadMe-BoldItalic.woff2") format("woff2"),
        url("../fonts/bbb-readme/BBBReadMe-BoldItalic.woff") format("woff");
}

@font-face {
    font-family: "BBB Readme";
    font-weight: 800;
    font-style: normal;
    src: url("../fonts/bbb-readme/BBBReadMe-Black.woff2") format("woff2"),
        url("../fonts/bbb-readme/BBBReadMe-Black.woff") format("woff");
}

@font-face {
    font-family: "BBB Readme";
    font-weight: 800;
    font-style: italic;
    src: url("../fonts/bbb-readme/BBBReadMe-BlackItalic.woff2") format("woff2"),
        url("../fonts/bbb-readme/BBBReadMe-BlackItalic.woff") format("woff");
}

body[data-color-scheme="high-contrast"] {
    --c-body: white;
}

body {
    font-family: var(--font);
    font-size: var(--fs);
    line-height: var(--lh);
    background-color: var(--c-body);
    padding: 0 var(--lh) var(--lh) var(--lh);
}

/* # Menu */

nav.navigation {
    margin-bottom: calc(0.25 * var(--lh));
    font-weight: bold;
    display: grid;
    grid-template-columns: 1fr max-content;
    gap: 2ch;
    border-bottom: 1px dashed;
}

nav.navigation ul {
    list-style-type: none;
    display: flex;
    flex-direction: row;
    margin: 0 0 0 calc(-1 * var(--lh)); /* Compensate for padding on the links */
    padding: 0;
}

.navigation a {
    display: block;
    color: inherit;
    text-decoration: none;
    font-weight: normal;
    padding: var(--lh) var(--lh) calc(0.5 * var(--lh)) var(--lh);
}

.navigation a:hover,
.navigation a:focus {
    text-decoration: underline;
}

.navigation a.current {
    font-weight: bold;
}

/* ## Accessibility menu */
#accessibility-preferences {
    position: relative;
    padding-top: var(--lh);
    user-select: none;
    cursor: pointer;
}

#form--accessibility-preferences {
    position: absolute;
    right: 0;
    z-index: 1;
    background-color: var(--c-body);
    padding: var(--lh);
    margin-right: calc(-1 * var(--lh));
    border-style: solid;
    border-width: 0px 1px 1px 1px;
}

/* ### Toggle in accessibility menu
   based on: https://www.w3.org/WAI/ARIA/apg/patterns/switch/examples/switch-checkbox/ */
label.switch {
    display: block;
    margin: var(--lh) 0;
    width: 30ch;
}

label.switch .switch--label {
    display: inline-block;
    width: 18ch;
    user-select: none;
}

label.switch input[role="switch"] {
    opacity: 0;
    position: absolute;
}

label.switch input[role="switch"] ~ .switch--state {
    display: inline-block;
    user-select: none;
    width: 10ch;
}

label.switch input[role="switch"] ~ .switch--state > .switch--state--indicator {
    position: relative;
    top: calc(.2 * var(--lh));
    display: inline-block;
    border: 2px solid black;
    width: calc(2 * var(--lh));
    height: var(--lh);
    border-radius: calc(.5 * var(--lh));
}

label.switch input[role="switch"] ~ .switch--state > .switch--state--indicator::after{
    content: '';
    position: absolute;
    top: calc(.1 * var(--lh));
    left: calc(.1 * var(--lh));
    display: inline-block;
    border-radius: calc(.4 * var(--lh));
    width: calc(.8 * var(--lh));
    height: calc(.8 * var(--lh));
    background: black;
    opacity: 0.6;
}

label.switch input[role="switch"]:not(:checked) ~ .switch--state .switch--label--on,
label.switch input[role="switch"]:checked ~ .switch--state .switch--label--off {
    display: none;
}

label.switch input[role="switch"]:checked ~ .switch--state > .switch--state--indicator::after {
    left: initial;
    right: calc(.1 * var(--lh));
    background: green;
    opacity: 1;
} 

label.switch:hover {
    cursor: pointer;
}

label.switch.focus input[role="switch"] ~ .switch--state > .switch--state--indicator {
    outline: 5px auto Highlight;
    outline: 5px auto -webkit-focus-ring-color;
    outline-offset: 2px;
}

label.switch.focus span.switch--state--indicator,
label.switch:hover span.switch--state--indicator {
    background-color: white;
}

input[type="range"] {
    display: block;
    width: 100%;
    margin: calc(.5 * var(--lh)) 0;
}

#input--fontsize--label {
    display: inline-block;
    width: 18ch;
}

/** ## Bread crumb navigation*/

.breadcrumb {
    margin-bottom: calc(2 * var(--lh));
    position: sticky;
    top: 0;
    background: var(--c-body);
    padding: calc(.25 * var(--lh)) 0;
}

.breadcrumb ol {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    gap: 1ch;
}

.breadcrumb li:not(:last-child)::after {
    content: ">";
}

.breadcrumb a {
    color: inherit;
}

.breadcrumb li:last-child a,
.breadcrumb a:hover,
.breadcrumb a:focus {
    text-decoration: none;
}

/* # Main content / file listing */

ul.file-list {
    display: grid;
    align-items: flex-start;
    grid-template-columns: repeat(auto-fit, minmax(50ch, 1fr));
    gap: calc(2 * var(--lh));
    margin: calc(2 * var(--lh)) 0 0 0;
    padding: 0;
    list-style-type: none;
}

.file {
    display: grid;
    background: white;
    padding: var(--lh);
    grid-template-columns: 1fr 1fr;
    gap: var(--lh);
    align-items: flex-start;
    max-width: 90ch;
}

.file--header {
    grid-column-end: span 2;
}

.file figure {
    display: contents;
}

.file figure > a:first-child {
    display: contents;
}


.file figure img {
    grid-column-end: span 2;
    max-height: 900px;
    max-width: 100%;
}

li.file-list--item figure figcaption {
    max-width: 50ch;
}

.file--meta  {
    /* background: whitesmoke; */
    /* padding: calc(.5 * var(--lh)); */
    /* outline: 1px dotted black; */
    /* margin: calc(-.5 * var(--lh)) 0 0 0; */
    /* justify-self: flex-end; */
    grid-column-end: span 2;
}

.file--meta h3 {
    font-size: 100%;
    margin: 0 0 var(--lh) 0;
}

.file-reference--location {
    grid-column-end: span 2;
}



h2.file--name,
h6.file--type {
    margin: 0;
}

h6.file--type::before {
    content: "(";
}

h6.file--type::after {
    content: ")";
}

.file--meta dl {
    display: inline;
    margin-right: 1ch;
}

.file--meta dt {
    display: inline;
    font-weight: bold;
    text-transform: lowercase;
}

.file--meta dt:not(:first-child) {
    margin-left: 1ch;
}

.file--meta dd {
    display: inline;
    margin: 0;
    padding: 0;
}

.file--meta ul, .file--meta li {
    margin: 0;
    padding: 0;
    display: inline;
}

.file--meta li:not(:last-child)::after {
    content: ", ";
}

.file--meta li:last-child a {
    text-decoration: none;
}

.file .file--text-preview {
    position: relative;
    grid-column-end: span 2;
    width: 100%;
    box-sizing: border-box;
    max-height: calc(20 * var(--lh));
    overflow-y: hidden;
    overflow-x: hidden;
    outline: 2px solid var(--c-body);
    padding: calc(.5 * var(--lh));
}

.file .file--text-preview::after {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(4 * var(--lh));
    content: "";
    display: block;
    background: linear-gradient(to bottom, transparent, white 95%);
}

.file-reference--location {
    margin-top: calc(.5 * var(--lh));
    display: block;
}

p {
    margin: 0;
}

p + p {
    margin-top: var(--lh);
}

main a {
    color: var(--c-link);
}

main a:hover,
main a:focus {
    text-decoration: none;
    color: var(--c-link-active);
}

main a:visited {
    color: var(--c-link-visited);
}

article.page-content,
.directory--description,
.fellow--description {
    max-width: 80ch;
}


.headerlink {
    visibility: hidden;
    padding-left: 1ch;
    color: inherit;
}

:hover > .headerlink {
    visibility: visible;
}

.index--shortlist--container {
    margin-top: calc(2 * var(--lh));
    max-width: 80ch;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.index--shortlist--list ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.fellow--description--with-portrait {
    display: grid;
    grid-template-columns: 1fr 2fr;
    max-width: 120ch;
    gap: var(--lh);
}

.fellow--description--portrait {
    margin: 0;
}

.fellow--description figure img {
    max-width: 100%;
}

.fellow--description--with-portrait .fellow--spaces {
    grid-column-end: span 2;
}


dialog[open] {
    position: fixed;
    inset: 0;
    height: unset;
    width: unset;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    margin: 0;
    padding: calc(2 * var(--lh));
    background: rgba(244, 244, 244, 0.9);
    overflow: hidden;
}

.lightbox--close {
    grid-column: 2;
}

.lightbox--close button {
    font: inherit;
    border-radius: calc(.7 * var(--lh));
    margin: calc(.5 * var(--lh)) calc(.5 * var(--lh)) 0 calc(.5 * var(--lh));
    padding: calc(.2 * var(--lh)) var(--lh);
    background: none;
    border: 2px solid;
}

dialog > div {
    display: grid;
    grid-template-rows: min-content min-content 1fr;
    grid-template-columns: 1fr min-content;
    max-height: 100%;
    background: white;
}

dialog header, dialog aside {
    padding: calc(.5 * var(--lh)) calc(.5 * var(--lh)) 0;
}

dialog header:empty, dialog aside:empty {
    padding: 0;
}

dialog figure {
    margin: 0;
    padding: calc(.5 * var(--lh));
    max-height: 100%;
    display: grid;
    grid-template-rows: 1fr min-content;
    overflow: hidden;
    gap: calc(.5 * var(--lh));
}

dialog figure img {
    max-height: 100%;
    min-height: 0;
}

dialog figcaption {
    max-width: 80ch;
}

dialog[data-data-type="pdf"] div {
    width: 100%;
    height: 100%;
}

dialog[data-data-type="pdf"] figure {
    width: calc(100% - var(--lh));
    height: calc(100% - var(--lh));
}

dialog[data-data-type="pdf"] iframe {
    width: 100%;
    height: 100%;
}

dialog header.file--header {
    grid-column-end: span 1;
    grid-row: 1;
}

dialog aside.file--meta,
dialog figure {
    grid-column-end: span 2;
}


dialog[data-data-type="text"] .file--text-preview {
    max-height: 100%;
    overflow-y: auto;
    outline: 2px solid var(--c-body);
    padding: calc(.5 * var(--lh));
}