:root {
    --window-width: min(510px, 100vw);
    --font-normal: 14px;
    --infobar-height: 1.5rem;
}

body {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: AtkinsonHyperlegible;
    font-size: var(--font-normal);
}

main {
    display: grid;
    grid: 1fr var(--infobar-height) / 1fr;
    width: var(--window-width);
    height: 100vh;
    padding: 0;
    overflow-y: scroll;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
main::-webkit-scrollbar {
    display: none;
}

#infobar {
    display: grid;
    grid: auto / 120px 1fr;
    background: white;
    border: 1px solid #888;
    box-sizing: border-box;
    z-index: 1000;
}

.window {
    width: 90%;
}

.tabs {
    padding: 0;
    display: grid;
    grid: min-content 10fr / auto-flow;
}

[role="tabpanel"] {
    margin-bottom: 0;
    padding: 5px;
}

[role="tab"] {
    font-size: 1.3rem;
}

section + section {
    border: solid black;
    border-width: 3px 0px 0px 0px;
}

section {
    padding: 5px 0;
}

section.vfill {
    height: 98%;
}

#infobar > section {
    padding: 0 5px;
    margin: auto 0;
    border: none;
}

h1 {
    font-size: 18px;
    margin: 0;
}

h2 {
    font-size: 16px;
    margin: 5px 0;
}

button:not([role="tab"]) {
    font-size: 1.1rem;
    margin: 5px 0;
}

button > a {
    color: inherit;
    text-decoration: inherit;
}

button > a:hover {
    color: inherit;
}

button.image {
    font: inherit;
    min-width: 0;
    min-height: 0;
    padding: 0 2px;
}

ul {
    margin: 0.5rem 0;
}

p {
    margin: 0.5rem 0;
}

.col-2 {
    display: grid;
    grid: auto / 1.5fr 1fr;
    align-items: center;
}

.col-3 {
    display: grid;
    grid: auto / 1fr 1fr 1fr;
    justify-items: center;
}

.inline {
    display: inline;
}

.right {
    text-align: right;
}

table {
    width: 100%;
}

td,
th {
    text-align: left;
    padding: 0 5px;
}

table table td,
table table th {
    text-align: center;
}

table.status-table td {
    width: 38%;
}

td.text,
th.text {
    text-align: left;
    padding: 1px 2px;
}

td.number,
th.number {
    text-align: right;
    padding: 1px 2px;
    font-feature-settings: "tnum";
}

table.color-cols th:nth-child(2n),
table.color-cols td:nth-child(2n),
table.color-head td {
    background-color: lightgray;
}

table.color-cols th:nth-child(2n + 1),
table.color-cols td:nth-child(2n + 1),
table.color-head th {
    background-color: lightblue;
}

td.text-center {
    text-align: center;
}

table button:not([role="tab"]) {
    margin: 0;
}

td.image-cell {
    padding: 2px;
}

.bold {
    font-weight: bold;
}

img.icon,
svg.icon {
    height: 2.4em;
    border-radius: 10px;
}

img.inline {
    height: auto;
    width: auto;
    max-width: 25px;
    max-height: 1rem;
    vertical-align: middle;
}

p.code {
    font-family: "Lucida Console", "Courier New", monospace;
    font-size: 12px;
}

[role="tooltip"] {
    display: none;
    position: absolute;
    z-index: 1;
    padding: 0.5rem;
}

[role="tooltip"].fit {
    right: 0;
    width: min-content;
}

@keyframes charging {
    0% {
        content: url("/images/battery-0.svg");
    }
    20% {
        content: url("/images/battery-1.svg");
    }
    40% {
        content: url("/images/battery-2.svg");
    }
    60% {
        content: url("/images/battery-3.svg");
    }
    80% {
        content: url("/images/battery-4.svg");
    }
    100% {
        content: url("/images/battery-0.svg");
    }
}

.animate-charge[on="true"] {
    animation-name: charging;
    animation-duration: 2s;
    animation-iteration-count: infinite;
}

.warning {
    color: orangered;
}
.alert {
    color: red;
}

#notifications-symbol {
    position: absolute;
    top: 0;
    right: 0;
    height: 2rem;
    border-radius: 5px;
}

@font-face {
    font-family: "AtkinsonHyperlegible";
    src: url("/font/AtkinsonHyperlegible-Regular.ttf");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "AtkinsonHyperlegible";
    src: url("/font/AtkinsonHyperlegible-Bold.ttf");
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "AtkinsonHyperlegible";
    src: url("/font/AtkinsonHyperlegible-Italic.ttf");
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "AtkinsonHyperlegible";
    src: url("/font/AtkinsonHyperlegible-BoldItalic.ttf");
    font-weight: bold;
    font-style: italic;
    font-display: swap;
}

/* Large screen layout - show two different tab panels side by side */
/* Scale up various elements by approx. 1.15 */
@media (min-width: 1200px) {
    :root {
        --window-width: 1200px;
        --font-normal: 16px;
        --infobar-height: 3rem;
    }

    .tabs {
        display: grid;
        grid: min-content 1fr / 1fr 1fr;
    }

    .tabs > [role="tablist"] {
        grid-column: 1 / -1;
    }

    .tabs > [role="tabpanel"][hidden] {
        display: none;
    }
    
    h1 {
        font-size: 21px;
    }

    h2 {
        font-size: 19px;
    }

    [role="tab"] {
        font-size: 2rem;
    }

    button:not([role="tab"]) {
        font-size: 1.3rem;
    }

    img.icon,
    svg.icon {
        height: 3em;
    }

    img.inline {
        max-width: 29px;
        max-height: 1.3rem;
    }

    #notifications-symbol {
        height: 2.3rem;
    }
}
