:root {
    --ratio: 1.5;
    --s-5: calc(var(--s-4) / var(--ratio));    /* 0.131rem */
    --s-4: calc(var(--s-3) / var(--ratio));    /* 0.198rem */
    --s-3: calc(var(--s-2) / var(--ratio));    /* 0.296rem */
    --s-2: calc(var(--s-1) / var(--ratio));    /* 0.444rem */
    --s-1: calc(var(--s0) / var(--ratio));     /* 0.667rem */
    --s0: 1rem;                                 /* 1.000rem */
    --s1: calc(var(--s0) * var(--ratio));      /* 1.500rem */
    --s2: calc(var(--s1) * var(--ratio));      /* 2.250rem */
    --s3: calc(var(--s2) * var(--ratio));      /* 3.375rem */
    --s4: calc(var(--s3) * var(--ratio));      /* 5.063rem */
    --s5: calc(var(--s4) * var(--ratio));      /* 7.594rem */

    --pb-color: var(--jinks-color-primary, var(--pico-color));
    --jinks-logo: var(--jinks-logo-light);
    --jinks-splash-background: var(--jinks-splash-background-light);
    --jinks-color-inverse: var(--jinks-background-color-dark);
}

html {
    scroll-behavior: smooth;
    font-size: var(--jinks-base-font-size);
}
@media screen and (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

html, body {
    max-width: 100%;
}

body {
    background-color: var(--jinks-background-color);
    font-family: var(--jinks-base-font-family);
    line-height: var(--jinks-base-line-height);
    margin: 0;
    color: var(--pb-color);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--jinks-heading-font-family);
    font-weight: var(--jinks-heading-font-weight);
    line-height: var(--jinks-heading-line-height);
}

h1 {
    font-size: var(--jinks-h1-font-size);
    font-weight: var(--jinks-h1-font-weight);
    line-height: var(--jinks-h1-line-height);
}
h2 {
    font-size: var(--jinks-h2-font-size);
    font-weight: var(--jinks-h2-font-weight);
    line-height: var(--jinks-h2-line-height);
}
h3 {
    font-size: var(--jinks-h3-font-size);
    font-weight: var(--jinks-h3-font-weight);
    line-height: var(--jinks-h3-line-height);
}
h4 {
    font-size: var(--jinks-h4-font-size);
    font-weight: var(--jinks-h4-font-weight);
    line-height: var(--jinks-h4-line-height);
}

*:focus {
    outline: none;
}

.center-l {
    box-sizing: content-box;
    max-width: var(--jinks-page-max-width);
    margin-inline: auto;
    padding-inline: var(--s0);
}

.splash {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    visibility: hidden;
    opacity: 0;
    z-index: 3;
    background-image: var(--jinks-splash-background);
    background-color: var(--jinks-background-color);
    background-position: center center;
    background-size: var(--jinks-splash-image-width) var(--jinks-splash-image-height);
    background-repeat: no-repeat;
    transition: visibility 0s linear 300ms, opacity 300ms;
}

pb-page[unresolved]~.splash {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s linear 0s, opacity 300ms;
}

/* check should take the theming settings */
.toolbar {
    background-image: none;
    position: relative;
    width: 100%;
    background-color: var(--jinks-toolbar-background-color);
    color: var(--jinks-toolbar-color);
    --pico-color: var(--jinks-toolbar-color);
    --paper-checkbox-label-color: var(--jinks-toolbar-color);
    --paper-checkbox-unchecked-color: var(--jinks-toolbar-color);
    padding: var(--s0) 0;
    flex-wrap: wrap;
    row-gap: var(--s-1);
}

.toolbar ul {
    padding-left: var(--s-2);
    padding-right: var(--s-2);
}

.toolbar li {
    padding-top: 0;
    padding-bottom: 0;
}

.toolbar a {
    display: inline-block;
    color: var(--pb-toolbar-color) !important;
}

.toolbar pb-navigation {
    cursor: pointer;
}

.toolbar pb-navigation:not([disabled]) svg,
a[role="button"] svg, .theme-toggle svg, .icon {
    width: 1rem;
    height: 1rem;
    display: inline-block;
}

.toolbar a svg,
.aside-toggle svg {
    width: 20px;
    height: 20px;
}

.content-top:has(.toolbar) {
    background-color: var(--jinks-toolbar-background-color);
}

@media (max-width: 1024px) {
    .toolbar {
        max-width: 100vw;
        --jinks-breadcrumbs-max: 55ch;
    }

    .toolbar ul {
        padding-left: 0;
        padding-right: 0;
    }

    .toolbar ul:first-of-type {
        flex: 1 1 0;
        min-width: 0;
        overflow: hidden;
        margin-right: calc(var(--pico-nav-element-spacing-horizontal) * 2);
    }
}
@media (max-width: 767px) {
    .toolbar {
        --jinks-breadcrumbs-max: 26ch;
    }
}
@media (max-width: 320px) {
    .toolbar {
        --jinks-breadcrumbs-max: 18ch;
    }
}

pb-navigation[disabled] {
    display: inline-block;
    opacity: 0.3;
}

pb-document {
    display: none;
}

.page-header {
    padding-block-start: 0;
    background-image: var(--jinks-menubar-background-image);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: top;
    background-color: var(--jinks-menubar-background-color);
}

/* hero covers 100% of the viewport height */
.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    grid-column-start: 1;
    grid-row-start: 2;
    padding: var(--jinks-hero-padding, 1rem);
    height: var(--jinks-hero-height, auto);
    min-height: var(--jinks-hero-min-height, auto);

    color: var(--jinks-color-inverse);
    --pico-color: var(--jinks-color-inverse);
    --pico-h1-color: var(--jinks-color-inverse);
    position: relative;
    background-image: var(--jinks-hero-background-image);
    background-size: var(--jinks-hero-background-size);
    background-repeat: var(--jinks-hero-background-repeat);
    background-color: var(--jinks-hero-background-color);
    background-position: var(--jinks-hero-background-position);
}

.hero::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--jinks-hero-background-color); /* Adjust the opacity as needed */
}

.hero > * {
    position: relative;
    z-index: 1;
}

.logo {
    background-image: var(--jinks-logo-light);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: left center;
    width: var(--jinks-logo-image-width);
    height: var(--jinks-logo-image-height);
    margin-right: var(--jinks-logo-margin-right, 1rem);
    cursor: pointer;
}

.logo a {
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
}

pb-progress {
    width: 100%;
}

pb-dialog h2,
pb-dialog h3 {
    color: var(--jinks-dialog-header-color);
    font-size: var(--jinks-dialog-header-font-size);
    margin-bottom: 0;
    font-weight: normal;
}

@media (max-width: 768px) {
    #downloadDialog {
        width: 100%;
    }
}

@media (min-width: 769px) {
    #downloadDialog {
        width: 50%;
    }
}

pb-view, pb-view-annotate {
    --jinks-heading-font-family: var(--jinks-content-font-family);
    font-family: var(--jinks-content-font-family);
    font-size: var(--jinks-content-font-size);
    line-height: var(--jinks-content-line-height);
    margin: 0 1rem;
    position: relative;
}

pb-view::part(content) {
    padding-top: 1rem;
    --pico-color: var(--jinks-color-primary);
    --pico-h1-color: var(--jinks-h1-color);
    --pico-h2-color: var(--jinks-h2-color);
    --pico-h3-color: var(--jinks-h3-color);
    --pico-h4-color: var(--jinks-h4-color);
    --pico-h5-color: var(--jinks-h5-color);
    --pico-h6-color: var(--jinks-h6-color);
}

@media (min-width: 769px) {
    pb-view, pb-view-annotate {
        max-width: var(--pb-view-max-width);
    }
}

pb-popover {
    text-align: left !important;
}

.version {
    text-align: right;
    font-size: 0.85em;
    padding: 1em;
    color: var(--jinks-color-lighter);
}

.version span {
    font-weight: bold;
}

/* Display KWIC search results */
.results .card header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.results {
    padding: 1rem;
    --jinks-breadcrumbs-max: none;
}

.results nav[aria-label="breadcrumb"] {
    white-space: normal;
}

.results nav[aria-label="breadcrumb"] ul {
    flex-wrap: wrap;
}

.results nav[aria-label="breadcrumb"] ul li {
    padding: 0 0.5rem;
    text-overflow: normal;
    white-space: normal;
    max-width: none;
}

.results .card header .count {
    font-size: 0.875rem;
}

.matches {
    margin-left: 20px;
    margin-top: 10px;
    font-family: var(--jinks-content-font-family);
}

.matches .hi {
    color: var(--jinks-color-focus);
}

.matches .count {
    margin-top: 1em;
}

.matches .count::before {
    content: '[';
}

.matches .count::after {
    content: ']';
}

.facets {
    flex: 0;
    min-width: 220px;
}

.facet-dimension {
    margin: 1rem .5rem;
}

.facets h3 {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-family: var(--jinks-base-font-family);
    font-weight: 600;
    padding: .5rem;
}

.facets h3 label {
    margin-left: 16px;
    font-size: 11px;
}

.facets table {
    font-size: 0.875rem;
}

.facets table table {
    padding-left: 16px;
    width: 100%;
}

.facets table td {
    padding: 4px 0;
    background-color: transparent;
    border: none;
}

.facets table td:nth-child(1) {
    font-weight: 500;
}

.facets table td:nth-child(2) {
    color: var(--jinks-colors-black-300);
    text-align: right;
    padding-left: 1em;
}

main > section {
    margin-top: var(--pico-block-spacing-vertical);
}

pb-odd-editor {
    margin: 1rem;
}

footer {
    display: flex;
    justify-content: flex-end;
    gap: 2rem;
    margin-top: 4rem;
    padding-bottom: 2rem;
}
footer a {
    width: 128px;
}

footer.mobile-footer {
    display: block;
    padding: .375rem 1rem;
    margin: 0;
    background: var(--jinks-colors-50);
}

footer.mobile-footer > nav > ul {
    gap: 1rem;
}

footer.mobile-footer > nav > ul > li {
    padding-top: 0;
    padding-bottom: 0;
}

footer.mobile-footer svg {
    height: 1.65rem;
    width: 1.65rem;
}

footer.mobile-footer a {
    width: auto;
}

.metadata a {
    width: 100%;
    text-align: center;
}

.overflow {
    overflow: auto;
    height: 100%;
}

.error {
    /* FIXME: hard-coded color value */
    color: #c02020;
}

aside nav[aria-label="breadcrumb"] {
    display: flex;
    align-items: center;
}

aside nav[aria-label="breadcrumb"] ul,
aside nav[aria-label="breadcrumb"] ul li {
    display: inline-block;
}

aside nav[aria-label="breadcrumb"] ul li a {
    display: inline;
}

[aria-label=breadcrumb] {
    font-size: var(--jinks-breadcrumbs-font-size);
    white-space: nowrap;
    position: relative;
}

nav[aria-label="breadcrumb"] ul li {
    max-width: var(--jinks-breadcrumbs-max);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

nav[aria-label="breadcrumb"] svg, .menubar .icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.card {
    padding: 1.5rem;
    margin-bottom: .5rem;
    border-radius: 1rem;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.08);
    background-color: var(--jinks-colors-50);
}

.alert {
    display: flex;
    padding: 10px 12px;
    margin: 1rem 0;
    align-items: center;
    gap: 12px;
    align-self: stretch;
    border-radius: 8px;
    background: var(--jinks-form-background-color);

    /* Light/Elevation/card-rest */
    box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.08), 0px 1px 2px -1px rgba(0, 0, 0, 0.08), 0px 2px 4px 0px rgba(0, 0, 0, 0.04);
}

nav.before-top > ul:first-child,
nav.before-top > ul:first-child > li {
    flex: 1;
}

.before-top pb-search,
.before pb-search {
    width: 100%;
}

.before pb-search {
    margin-bottom: var(--s-1);
}

main {
  height: 100%;
}

.container {
  height: 100%;
  overflow: hidden;
}

.container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-content: stretch;
  align-items: stretch;

  * {
    flex: 0 0 auto;
    align-self: auto;
  }
}

.container > :not(.resize-handler) {
  padding: 10px;
  overflow: auto;
}

.metadata-panel {
    margin-block-start: 1rem;
}
