@import url("../lib/material-symbols/css/material-symbols.css");
@import url("../lib/clean-switch-1.0.0/clean-switch.css");

:root {
    --primary: #09bd72;
    --primary-darker: #069459;
    --primary-dark: #07a362;
    --primary-light: #0ccf7e;
    --primary-lighter: #0cda84;
    --primary-lightest: #bdedd9;
    --primary-ultralight: #dcfff1;
    --primary-fg: var(--primary);
    --fg: #000000;
    --fg-light: #333333;
    --bg: #ffffff;
    --hover-bg: var(--primary-dark);
    --active-bg: var(--primary-darker);
    --focus-bg: #8c8c8c;
    --on-primary: #ffffff;
    --border-color: gray;
    --error: #a40000;

    --standard-border-radius: 0.2em;
    --standard-spacing: 0.6em;
}

::selection {
    background-color: var(--primary);
    color: var(--on-primary);
}

:focus-visible {
    outline: 2px solid var(--primary);
}

header :focus-visible {
    outline: 2px solid var(--on-primary);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 4fr 1fr;
    grid-template-rows: max-content max-content max-content;
    grid-template-areas:
        "header header header"
        "banner banner banner"
        ".      main   .     "
        ".      footer .     ";
    min-height: 100vh;
    hyphens: auto;
}

.standout {
    background-color: var(--primary);
    color: var(--on-primary);
}

.standout ::selection {
    background-color: var(--on-primary);
    color: var(--primary);
}

.standout main h1 {
    font-size: 500%;
}

.standout main h1,
.standout main h2,
.standout main p {
    text-align: center;
}

.standout main a {
    color: var(--on-primary);
}

h3,
h4 {
    margin: var(--standard-spacing) 0;
}

body,
input,
select,
button,
.button {
    font-family: Roboto, sans-serif;
    color: var(--fg);
    background-color: var(--bg);
    font-size: 1em;
}

h1.light {
    font-weight: normal;
}

.button {
    text-decoration: none;
    text-align: center;
}

code,
pre {
    font-size: 15px;
}

pre {
    background-color: #ededed;
    border-radius: var(--standard-border-radius);
    padding: var(--standard-spacing);
}

.cl-switch.cl-switch-green input[type="checkbox"]:checked + .switcher::before {
    background-color: var(--primary);
}

.cl-switch.cl-switch-green input[type="checkbox"]:checked + .switcher {
    background-color: var(--primary-lightest);
}

input[type="text"],
input[type="password"],
input[type="search"],
.ts-control {
    border: 1px solid var(--border-color);
    padding: var(--standard-spacing);
    border-radius: var(--standard-border-radius);
}

.ts-control,
.ts-dropdown,
.ts-control input {
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

.ts-dropdown .optgroup-header {
    color: inherit;
    font-weight: bold;
    background: inherit;
}

.ts-dropdown .option.active {
    color: var(--on-primary);
    background-color: var(--primary);
}

.ts-dropdown-content {
    max-height: 400px;
}

header input[type="text"],
header input[type="password"],
header input[type="search"] {
    border: none;
    outline: none; /* appears only on focus */
    display: block;
    height: 100%;
    width: 100%;
}

header input[type="text"],
header input[type="password"],
header input[type="search"] {
    box-shadow: 1px 1px 3px var(--focus-bg);
}

header input[type="text"]:focus,
header input[type="password"]:focus,
header input[type="search"]:focus {
    box-shadow: 3px 3px 6px var(--focus-bg);
}

header a.material-symbols-outlined {
    padding: 0.5em;
    border-radius: 50%;
}

aside {
    display: block;
    position: fixed;
    left: -256px;
    transition: all 0.4s;
    height: 100%;
    width: 256px;
    z-index: 5;
    background-color: var(--bg);
    box-shadow: none;
}

aside:target {
    box-shadow: 5px 0 10px var(--focus-bg);
    left: 0;
}

aside + .modal-overlay {
    display: none;
    z-index: 3;
}

aside:target + .modal-overlay {
    position: fixed;
    display: block;
    background-color: #00000040;
    width: 100%;
    height: 100%;
}

a {
    color: var(--primary);
}

a:visited {
    color: var(--primary-dark);
}

a:hover {
    color: var(--primary-light);
}

a.modal-overlay {
    cursor: default;
}

header,
footer nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas: "left middle right";
}

header {
    padding: var(--standard-spacing);
    grid-area: header;
}

header section form {
    display: grid;
}

section.left {
    grid-area: left;
    justify-self: left;
}

section.middle {
    grid-area: middle;
}

section.right {
    grid-area: right;
    justify-self: right;
}

header,
header button.material-symbols-outlined,
header a.material-symbols-outlined {
    background-color: var(--primary);
    color: var(--on-primary);
}

.banner {
    grid-area: banner;

    display: grid;
    grid-template-columns: 1fr 4fr 1fr;
    grid-template-areas: ". content .";

    border-bottom: 1px solid var(--border-color);
    padding: calc(1.5 * var(--standard-spacing)) 0;
}

.banner .content {
    grid-area: content;

    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "left right";
}

.banner .content section.left {
    display: grid;
    grid-template-columns: max-content max-content;
    align-items: center;
}

main {
    grid-area: main;
    margin-top: 1em;
}

main:has(object:only-child) {
    margin-top: 0;
}

main object:only-child {
    width: 100vw; /* TODO */
    height: 100vh; /* TODO */
}

footer {
    grid-area: footer;
}

main > article > h2:first-of-type {
    margin-top: 0;
}

nav a,
nav a:visited {
    text-decoration: none;

    font-size: 90%;
    font-weight: 500;

    color: var(--fg-light);

    padding: var(--standard-spacing);
    margin: var(--standard-spacing);
    border-radius: var(--standard-border-radius);

    display: grid;
    grid-template-columns: max-content max-content;
    align-items: center;
}

nav a i.material-symbols-outlined,
.banner .content section.left i.material-symbols-outlined {
    margin-right: 16px;
    max-width: 26px;
}

nav a span + i.material-symbols-outlined {
    margin-left: 16px;
    margin-right: 0;
}

a.material-symbols-outlined {
    text-decoration: none;
}

nav a,
button.material-symbols-outlined,
a.material-symbols-outlined {
    transition: background-color 0.3s, color 0.3s;
}

nav a:hover,
button.material-symbols-outlined:hover,
a.material-symbols-outlined:hover {
    color: var(--on-primary);
    background-color: var(--hover-bg);
}

nav a:active,
button.material-symbols-outlined:active,
a.material-symbols-outlined:active {
    color: var(--on-primary);
    background-color: var(--active-bg);
}

nav .separator {
    display: block;
    border-top: 1px solid #cacaca;
    margin: calc(2 * var(--standard-spacing)) 0;
}

button,
.button,
input[type="submit"] {
    border-radius: var(--standard-border-radius);
    background-color: var(--primary);
    color: var(--on-primary) !important;
    padding: var(--standard-spacing);

    cursor: pointer;
    border: none;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 90%;

    transition: background-color 0.3s;
}

button.text,
.button.text,
input[type="submit"].text {
    color: var(--primary) !important;
    background: none;
    box-shadow: none;
}

button:disabled,
.button:disabled,
input[type="submit"]:disabled {
    cursor: initial;
    box-shadow: none !important;
    opacity: 0.5;
}

button,
.button,
input[type="submit"] {
    box-shadow: 1px 1px 3px var(--focus-bg);
    outline: none;
}

button:not(:disabled):focus,
.button:not(:disabled):focus,
input[type="submit"]:not(:disabled):focus {
    background-color: var(--primary-light);
}

button:not(:disabled).text:focus,
.button:not(:disabled).text:focus,
input[type="submit"].text:not(:disabled):focus {
    background: none;
}

button:not(:disabled):hover,
.button:not(:disabled):hover,
input[type="submit"]:not(:disabled):hover {
    box-shadow: 1px 1px 5px var(--focus-bg);
}

button:not(:disabled).text:hover,
.button:not(:disabled).text:hover,
input[type="submit"]:not(:disabled).text:hover {
    background-color: var(--primary-ultralight);
    box-shadow: none;
}

button:not(:disabled):active,
.button:not(:disabled):active,
input[type="submit"]:not(:disabled):active {
    box-shadow: 2px 2px 9px var(--focus-bg);
    background-color: var(--primary-lighter);
}

button:not(:disabled).text:active,
.button:not(:disabled).text:active,
input[type="submit"]:not(:disabled).text:active {
    background-color: var(--primary-lightest);
    box-shadow: none;
}

button.floating-action,
.button.floating-action {
    border-radius: 50%;
    width: 56px;
    height: 56px;
    position: fixed;
    right: 48px;
    bottom: 48px;
}

.toggle-button-group input[type="radio"] {
    appearance: none;
    margin: 0;
    outline: none;
}

.toggle-button-group label {
    padding: var(--standard-spacing);

    border: 1px solid var(--border-color);
    display: inline-block;

    cursor: pointer;
}

.toggle-button-group label:has(input[type="radio"]:focus) {
    outline: 2px solid var(--primary);
}

.toggle-button-group label:first-of-type {
    border-top-left-radius: var(--standard-border-radius);
    border-bottom-left-radius: var(--standard-border-radius);
}

.toggle-button-group label:not(:first-of-type) {
    border-left: none;
}

.toggle-button-group label:last-of-type {
    border-top-right-radius: var(--standard-border-radius);
    border-bottom-right-radius: var(--standard-border-radius);
}

.toggle-button-group label:has(input[type="radio"]:checked) {
    background-color: var(--primary-lightest);
}

.toggle-button-group label:hover {
    background-color: var(--primary-ultralight);
}

#office-holder-style {
    float: right;
}

.box {
    box-shadow: 0 1px 3px var(--focus-bg);
    padding: var(--standard-spacing);
    margin-bottom: calc(2 * var(--standard-spacing));
}

.box h2 {
    font-weight: normal;
}

.expanding.box summary {
    display: grid;
    grid-template-columns: max-content 1fr;
    list-style: none;
}

.expanding.box summary::before {
    /* Material Symbols style is applied in /static/lib/material-symbols/css/material-symbols.css */
    content: "expand_more";
    align-self: center;
    margin-right: 0.5em;
}

.expanding.box[open] summary::before {
    content: "expand_less";
}

.box > section {
    padding: var(--standard-spacing);
}

details summary {
    cursor: pointer;
}

details summary h1,
details summary h2,
details summary h3,
details summary h4,
details summary h5,
details summary h6 {
    display: inline;
    margin-top: 0;
    margin-bottom: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table td,
table th {
    padding: var(--standard-spacing);
}

table th.sort {
    cursor: pointer;
}

table thead {
    position: sticky;
    top: 0;
}

table th {
    background-color: var(--primary);
    color: var(--on-primary);
    text-align: left;
}

table thead ::selection {
    color: var(--primary);
    background-color: var(--on-primary);
}

table tr:nth-child(even) {
    background-color: rgb(240, 240, 240);
}

/* When using multirow, we manually override :nth-child() to make the table look nice. */
table tr.even {
    background-color: rgb(240, 240, 240) !important;
}

table tr.odd {
    background-color: unset !important;
}

.uuid,
.id {
    color: #4f4f4f;
    cursor: pointer;
    transition: color 1s;
    word-break: break-all;
}

.uuid:active,
.id:active {
    color: var(--primary);
    transition: none;
}

.name + i.uuid {
    /* Inline UUID button after a person's name, should not be too large */
    font-size: 100%;
}

form {
    display: grid;
    grid-template-columns: max-content;
    row-gap: calc(1.5 * var(--standard-spacing));
}

form input,
form select {
    width: 100%;
}

.ts-control input {
    width: initial;
}

form button,
form input[type="submit"] {
    margin-top: var(--standard-spacing);
}

.pagination-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas: "prev page-numbers next";
}

.pagination-controls button {
    width: fit-content;
}

.pagination-controls button.prev {
    justify-self: start;
    grid-area: prev;
}

.pagination-controls .page-numbers {
    justify-self: center;
    align-self: center;
    grid-area: page-numbers;
}

.pagination-controls button.next {
    justify-self: end;
    grid-area: next;
}

.hero {
    margin-top: 1em;
    text-align: center;
}

.hero > i {
    font-size: 10em;
}

.hero h1 {
    margin-top: 0;
}

.neutral {
    color: #09aebd;
}

.error {
    color: var(--error);
}

.name.redacted {
    filter: blur(0.35em);
    user-select: none;
}

.tooltip-container {
    position: relative;
    display: flex;
}

.tooltip {
    visibility: hidden;
    background-color: var(--on-primary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--border-color);
    width: 300px;
    max-width: 90vw;
    position: absolute;
    z-index: 1000;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    bottom: 100%;
    left: 50%;
    margin-left: -150px;
}

.tooltip-container:hover .tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.tooltip-header {
    background-color: var(--primary);
    color: var(--on-primary);
    padding: 12px 16px;
    border-radius: 4px 4px 0 0;
}

.tooltip-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.tooltip-content {
    padding: 16px;
}

.tooltip-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
}

.tooltip-item:last-child {
    margin-bottom: 0;
}

.tooltip-icon {
    margin-right: 12px;
    color: var(--primary-lighter);
    font-size: 20px;
    margin-top: 2px;
}

.tooltip-text {
    flex: 1;
}

.tooltip-label {
    font-size: 12px;
    color: var(--focus-bg);
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.tooltip-value {
    font-size: 14px;
    color: var(--fg-light);
    line-height: 1.5;
    word-break: break-word;
}

.tooltip-value code {
    font-size: 14px;
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: var(--bg) transparent transparent transparent;
}

section.office ul:last-of-type {
    margin-bottom: 0;
}

section.office h3 {
    font-weight: normal;

    /* For displaying an info icon leading to an office tooltip */
    display: grid;
    grid-template-rows: 1fr;
    align-items: center;
    column-gap: calc(0.5 * var(--standard-spacing));
    grid-template-columns: max-content 1fr;
}

section.office .tooltip-container .material-symbols-outlined {
    font-size: 100%;
}

section.office h4 {
    font-size: 90%;
}

section.period:not(:last-of-type) {
    margin-bottom: var(--standard-spacing);
}

details > ul.offices {
    padding-left: var(--standard-spacing);
}

li:has(.office) {
    list-style: none;
}

li .office,
li .office a {
    display: grid;
    grid-template-rows: 1fr;
    align-items: center;
    column-gap: calc(0.5 * var(--standard-spacing));
}

li .office {
    grid-template-columns: max-content 1fr max-content;
}

li .office a {
    grid-template-columns: auto max-content;
}

li .office .material-symbols-outlined {
    font-size: 19px;
}

li .office a {
    text-decoration: none;
    color: inherit;
}

li .office a:hover {
    color: var(--primary-light);
}

.filter-bar {
    display: grid;

    grid-auto-flow: column;
    column-gap: var(--standard-spacing);
    grid-auto-columns: 1fr;

    margin-bottom: calc(2 * var(--standard-spacing));
}

@media (max-width: 680px) {
    .filter-bar {
        grid-auto-flow: row;
    }
}

@media print {
    header {
        display: none;
    }

    body {
        display: initial;
    }

    main {
        margin-top: 0;
    }

    main h1 {
        margin-top: 0;
    }

    .box {
        box-shadow: none;
        padding: 0;
        margin-bottom: calc(2 * var(--standard-spacing));

        border-bottom: 1px solid var(--border-color);
    }

    .expanding.box summary::before {
        display: none !important;
        margin: 0;
    }

    .box > section {
        padding: 0;
    }
}
