/* Tokens */
:root {
    --theme-black: #212F38;
    --theme-grey: #4D5C6E;
    --theme-grey-light: #D4D4D4;
    --theme-coral: #FF6D5F;
    --theme-coral-text: #B44A41;
    --theme-coral-light: #FAD6D1;
    --theme-blue-light: #DFEAF8;
    --theme-yellow-light: #FDF9D6;
    --theme-lime-green-light: #E8F8DC;
    --row-alt: #E5E8EB;
    --white: #FFFFFF;

    --font-sans: Montserrat, Arial, "Noto Sans", sans-serif;
    --font-mono: "Cutive Mono", "Courier New", monospace;

    --navbar-height: 56px;
    --action-size: 44px;
}

/* Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-padding-top: var(--navbar-height);
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--white);
    color: var(--theme-black);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid var(--theme-black);
    outline-offset: 2px;
}

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
#page-navbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--theme-black);
    color: var(--white);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--navbar-height);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.navbar-brand::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--theme-coral);
}

.navbar-brand:hover {
    color: var(--theme-coral);
    text-decoration: none;
}

#page-navbar :focus-visible {
    outline-color: var(--white);
}

.navbar-actions {
    display: flex;
    flex-shrink: 0;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--action-size);
    height: var(--action-size);
    color: var(--white);
}

.icon-button[hidden] {
    display: none;
}

.icon-button:hover {
    color: var(--theme-coral);
    text-decoration: none;
}

/* Page heading */
.page-heading {
    padding: 40px 0 24px;
}

.page-heading h1 {
    margin: 0;
    font-size: 40px;
    font-weight: 300;
    line-height: 1.2;
}

/* Breadcrumbs */
.breadcrumbs {
    padding: 12px 16px;
    border-radius: 6px;
    background: var(--row-alt);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
}

.breadcrumbs .fa {
    margin-right: 6px;
    color: var(--theme-black);
}

.breadcrumbs a {
    color: var(--theme-grey);
}

.breadcrumbs a:hover {
    color: var(--theme-black);
}

.breadcrumbs .divider {
    margin: 0 4px;
    color: var(--theme-grey);
}

.breadcrumbs .current {
    font-weight: 700;
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 12px 16px;
    border-left: 4px solid var(--theme-black);
    background: var(--theme-blue-light);
}

.alert-success {
    background: var(--theme-lime-green-light);
}

.alert-warning {
    background: var(--theme-yellow-light);
}

.alert-danger,
.alert-error {
    background: var(--theme-coral-light);
}

.alert-close {
    font-size: 20px;
    line-height: 1;
}

/* Listing */
.listing-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 7rem 12rem;
    gap: 16px;
    align-items: center;
    padding: 10px 8px 10px 16px;
}

#directory-list-header {
    margin-top: 8px;
    padding-right: calc(8px + var(--action-size));
    border-bottom: 1px solid var(--theme-grey-light);
    color: var(--theme-coral-text);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#directory-listing {
    margin: 0 0 48px;
    padding: 0;
    list-style: none;
    font-family: var(--font-mono);
}

#directory-listing li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--action-size);
    align-items: center;
}

#directory-listing .downloadLink {
    grid-column: 1;
}

#directory-listing li:nth-child(even) {
    background: var(--row-alt);
}

#directory-listing li:hover {
    background: var(--theme-coral-light);
}

#directory-listing .downloadLink:hover {
    text-decoration: none;
}

#directory-listing .downloadLink:focus-visible {
    outline-offset: -2px;
}

.file-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.file-name .fa {
    margin-right: 6px;
    color: var(--theme-black);
}

.file-size,
.file-modified {
    text-align: right;
    white-space: nowrap;
}

#directory-listing .file-size,
#directory-listing .file-modified {
    color: var(--theme-grey);
}

.row-action {
    grid-column: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--action-size);
    height: var(--action-size);
    color: var(--theme-grey);
}

.row-action:hover {
    color: var(--theme-black);
    text-decoration: none;
}

/* Footer */
.page-footer {
    margin-top: auto;
    padding: 40px 0 32px;
    text-align: center;
}

.footer-logo {
    display: inline-block;
    padding: 20px;
}

.footer-logo img {
    display: block;
    width: 64px;
    height: 64px;
}

.footer-legal {
    margin: 0;
    color: var(--theme-grey);
    font-size: 12px;
}

/* File info dialog */
#file-info-modal {
    width: min(600px, calc(100% - 32px));
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--white);
    color: var(--theme-black);
}

#file-info-modal::backdrop {
    background: rgb(33 47 56 / 0.6);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 12px;
}

.modal-title {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    flex-shrink: 0;
    width: var(--action-size);
    height: var(--action-size);
    margin: -8px -12px -8px 0;
    color: var(--theme-grey);
    font-size: 24px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--theme-black);
}

#file-info {
    width: calc(100% - 48px);
    margin: 0 24px 24px;
    border-collapse: collapse;
}

#file-info th,
#file-info td {
    padding: 10px 0;
    border-top: 1px solid var(--theme-grey-light);
    text-align: left;
    vertical-align: top;
}

#file-info th {
    width: 8rem;
    padding-right: 16px;
    color: var(--theme-coral-text);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#file-info td {
    font-family: var(--font-mono);
    word-break: break-all;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0 16px;
    }

    .page-heading {
        padding: 28px 0 20px;
    }

    .listing-row {
        grid-template-columns: minmax(0, 1fr) 6rem;
        padding-left: 8px;
    }

    .breadcrumbs {
        padding-left: 8px;
    }

    .file-modified {
        display: none;
    }
}
