:root {
    --bg-main: #fff;
    --bg-header: none;
    --bg-sidebar: #eee;
    --fg-text: #333;
    --fg-link: #00f;
    --fg-error: #f00;
    --fg-header: #333;
    --sidebar-width: 400px;
    --shadow-dark: #aaa;
    --shadow-light: #fff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #111;
        --bg-header: none;
        --bg-sidebar: #333;
        --fg-text: #fff;
        --fg-link: #ccf;
        --fg-error: #f00;
        --fg-header: #eee;
        --shadow-dark: #000;
        --shadow-light: #666;
    }
}

* {
    box-sizing: border-box;
}

html {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    color: var(--fg-text);
    background-color: var(--bg-main);
}

body {
    margin: 0;
    padding: 0;
    font-family: monospace;
}

img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    margin: auto auto;
    object-fit: contain;
}

a {
    color: var(--fg-link);
    text-decoration: none;
}

.spacer {
    flex-grow: 1;
}

.padded {
    padding: 20px;
}

#fade {
    display: none;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    //right: 402px;
    height: 60px;
    display: flex;
    align-items: center;
    font-family: monospace;
    font-size: 24px;
    padding: 0 0 0 20px;
    gap: 20px;
    background-color: var(--bg-header);
    color: var(--fg-header);
    z-index: 1000;
    border-bottom: 1px solid var(--shadow-dark);
    //box-shadow: 0 0 10px rgba(0, 0, 0, 0.75);
    box-shadow: 0px 1px 0px 0px var(--shadow-light);
}

header .title {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

header .action {
    display: flex;
    flex-shrink: 0;
    gap: 5px;
    align-items: center;
    position: relative;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    color: inherit;
}

header .action input[type="file"] {
    border: 0;
    clip: rect(0, 0, 0, 0);
    height: 1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    white-space: nowrap;
    width: 1px;
}

header .user {
    width: calc(var(--sidebar-width) + 1px);
    display: flex;
    justify-content: flex-end;
    padding-right: 20px;
    border-left: 1px dotted #aaa;
}

form {
    width: 100%;
    display: block;
}

main {
    position: fixed;
    top: 61px;
    left: 0;
    bottom: 0;
    right: var(--sidebar-width);
    overflow: auto;
    display: flex;
    z-index: 950;
    //background-color: var(--bg-main);
}

main>textarea {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 2px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #ccc;
    color: var(--fg-text);
    padding: 20px;
    font-family: monospace;
    outline: none;
    resize: none;
    font-size: 14px;
    caret-color: var(--fg-text);
}

svg { height: 20px; min-height: 20px; min-width: 20px; flex-shrink: 0; }

aside {
    position: fixed;
    top: 60px;
    right: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: monospace;
    z-index: 900;
    box-shadow:
        -1px 1px 0px 0px var(--shadow-light),
        -2px 1px 0px 0px var(--shadow-dark);
}

.form-field {
    margin: 0 0 20px 0;
}

.files {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    padding: 20px;
    align-content: flex-start;
}

.file>.thumb {
    display: flex;
    width: 100px;
    height: 100px;
    margin-bottom: 5px;
    font-size: 3px;
    text-decoration: none;
    overflow: hidden;
}

.file>.thumb svg {
    width: 100%;
    height: 100%;
}

.file>.thumb>img {
    vertical-align: bottom;
}

.file>.name {
    width: 100px;
    font-size: 12px;
    text-align: center;
    text-shadow: 1 1 5px #111;
    word-break: break-all;
}

aside label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 5px 0;
}

input, select,
aside textarea {
    //display: block;
    -webkit-appearance: none;
    width: 100%;
    padding: 6px;
    margin: 0;
    border: 1px solid var(--fg-text);
    border-radius: 2px;
    font-size: 12px;
    font-family: inherit;
    color: #333;
    background-color: #fff;
    box-shadow:
        -1px 0px 0px 0px #888,
        0px -1px 0px 0px #888,
        1px 0px 0px 0px #fff,
        0px 1px 0px 0px #fff;
}

select {
    border: 1px solid #555;
    border-radius: 4px;
    background: url('data:image/svg+xml;utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>') 100% 50% no-repeat #e2e2e2;
    box-shadow:
        inset -1px 0px 0px 0px #aaa,
        inset 0px -1px 0px 0px #aaa,
        inset 1px 0px 0px 0px #fff,
        inset 0px 1px 0px 0px #fff;
}

aside input[type="date"] {
    min-height: 30px;
}

input::placeholder {
    color: #999;
}

aside p {
    margin: 0 0 20px 0;
    word-break: break-all;
}

.buttons {
    //position: fixed;
    display: flex;
    gap: 10px;
    align-content: stretch;
    //right: 0;
    //bottom: 0;
    width: 100%;
    //height: 50px;
    //padding: 10px;
    background-color: var(--bg-sidebar);
    //box-shadow: 0 0 10px rgba(0, 0, 0, 0.75);
    z-index: 940;
}

button {
    flex-grow: 1;
    white-space: nowrap;
    border: 1px solid #333;
    background-color: #ddd;
    color: #333;
    padding: 5px 10px 7px 10px;
    font-size: 14px;
    border-radius: 4px;
    box-shadow:
        inset -1px 0px 0px 0px #777,
        inset -2px 0px 0px 0px #aaa,
        inset 0px -1px 0px 0px #777,
        inset 0px -2px 0px 0px #aaa,
        inset 1px 0px 0px 0px #ddd,
        inset 2px 0px 0px 0px #fff,
        inset 0px 1px 0px 0px #ddd,
        inset 0px 2px 0px 0px #fff;
}

button:hover, a.tag:hover {
    cursor: pointer;
    opacity: 0.9;
}

/*
.buttons button.primary {
    background-color: #dde;
    font-weight: bold;
}
*/

.buttons button.delete {
    background-color: #fcc;
}

.errorlist {
    list-style-type: none;
    margin: 5px 0 0 0;
    padding: 0;
}

.errorlist>li {
    color: var(--fg-error);
    font-size: 12px;
    margin-bottom: 5px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    display: flex;
    align-items: baseline;
    padding: 5px 10px 6px 10px;
    font-size: 14px;
    font-variant: small-caps;
    text-decoration: none;
    color: #fff;
    background-color: #777;
    border-radius: 4px;
    gap: 10px;
}

.tag .count {
    font-size: 75%;
    opacity: 0.5;
}

.tag.all {
    background-color: #444;
}

.tag.active {
    background-color: #336;
}

div.login {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.form-horizontal {
    display: flex;
    align-items: center;
    gap: 10px;
}

.passkeys {
}

.passkeys .current {
    font-weight: bold;
}

.passkeys li {
    margin-bottom: 10px;
}

.passkeys small {
    color: #999;
}

.divider {
    display: block;
    width: 100%;
    height: 0px;
    border-top: 1px solid #aaa;
    border-bottom: 1px solid #fff;
    margin: 20px 0;
}

@media screen and (max-width: 1023px) {
    header {
        position: static;
        font-size: 18px;
        gap: 10px;
    }

    header .user { width: auto; border: none; }

    main {
        position: static;
    }

    main>textarea {
        position: static;
        width: 100%;
        min-height: 400px;
    }

    aside {
        position: static;
        width: 100%;
        box-shadow: none;
        background-color: transparent;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .buttons {
        position: static;
        width: 100%;
        height: auto;
        box-shadow: none;
        background-color: transparent;
        padding: 20px;
    }
}

@media screen and (max-width: 450px) {
    header .title { display: none; }
    .files { gap: 20px; }
}
