/* === Fonts === */

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/roboto-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Roboto';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/roboto-italic.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Roboto Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/roboto-mono-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Roboto Serif';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('fonts/roboto-serif-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Roboto Serif';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('fonts/roboto-serif-italic.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* === Base === */

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

html,
body {
    padding: 0;
    margin: 0;
    background-color: #111111;
    color: #444444;
    font-family: "Roboto", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings: "wdth" 100;
    font-size: 1.05em;
    line-height: 1.4;
}

/* === Page layout === */

#page-wrapper {
    max-width: 30cm;
    margin: 0 auto;
    padding: 0;
}

#box {
    background-color: #faf7f2;
    margin: 0;
    padding: 0.25cm;
}

/* === Header === */

#header,
#footer {
    max-width: 100%;
    text-align: center;
    margin: 0;
}

#header {
    padding: 0.5cm 0.5cm 0 0.5cm;
}

#header a {
    max-width: 90%;
    margin: 0;
    padding: 0;
}

#header a img {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* === Navigation: hamburger toggle (checkbox hack) === */

#nav-toggle {
    display: none;
}

#nav-hamburger {
    display: none;
}

#nav-hamburger .close {
    display: none;
}

#nav-backdrop {
    display: none;
}

/* === Navigation: wide-screen horizontal links === */

ul.links {
    padding: 0.5cm 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

ul.links li {
    padding: 0.2cm 0.5cm;
    margin: 0;
    white-space: nowrap;
}

/* === Navigation: narrow-screen slide-out panel === */

@media (max-width: 30em) {
    #box {
        padding: 0.25cm 0cm;
    }

    blockquote,
    pre {
        margin-left: 0;
    }

    #header {
        padding-top: 1.2cm;
    }

    #nav-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0.3cm;
        left: 0.3cm;
        z-index: 300;
        width: 0.8cm;
        height: 0.8cm;
        background: #faf7f2;
        border: 1px solid #444444;
        border-radius: 0.1cm;
        cursor: pointer;
    }

    #nav-hamburger .open {
        display: block;
        width: 0.55cm;
        height: 0.55cm;
        background-image: url('icons/menu.svg');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }

    #nav-hamburger .close {
        width: 0.55cm;
        height: 0.55cm;
        background-image: url('icons/close.svg');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }

    #nav-toggle:checked ~ #nav-hamburger .open {
        display: none;
    }

    #nav-toggle:checked ~ #nav-hamburger .close {
        display: block;
    }

    #nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 100;
        background: rgba(0, 0, 0, 0.4);
    }

    #nav-toggle:checked ~ #nav-backdrop {
        display: block;
    }

    nav {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        width: 14cm;
        max-width: 85vw;
        z-index: 200;
        background: #faf7f2;
        overflow-y: auto;
        transition: left 0.25s ease;
    }

    #nav-toggle:checked ~ nav {
        left: 0;
    }

    /* Footer links: keep 2-column layout on narrow screens */
    ul.links li {
        flex-basis: calc(50% - 1cm);
        text-align: center;
    }

    /* Nav panel links: full-width vertical list */
    nav ul.links {
        flex-direction: column;
        align-items: stretch;
        padding: 1.2cm 0 0.5cm 0;
    }

    nav ul.links li {
        flex-basis: auto;
        text-align: left;
        white-space: normal;
        padding: 0.3cm 0.5cm;
    }

    nav ul.links li:has(details[open]) {
        padding-bottom: 0;
    }

    nav ul.links li details {
        margin-bottom: 0;
    }
}

/* === Sub-menus: wide-screen CSS dropdown === */

@media (min-width: 30em) {
    nav ul.links li {
        position: relative;
    }

    nav ul.links li details > summary {
        list-style: none;
        cursor: pointer;
        color: #009444;
        font-weight: 400;
    }

    nav ul.links li details > summary::-webkit-details-marker {
        display: none;
    }

    nav ul.links li details > summary:hover {
        text-decoration: underline;
        color: #8c4e31;
    }

    nav ul.links li details > summary {
        margin-bottom: 0;
    }

    nav ul.links li .submenu {
        display: none;
        position: absolute;
        top: calc(100% - 0.5cm);
        left: 0;
        background: #faf7f2;
        border: 1px solid #e0dbd3;
        border-radius: 0.1cm;
        list-style: none;
        padding: 0.2cm 0;
        min-width: 100%;
        box-shadow: 0 0.1cm 0.3cm rgba(0, 0, 0, 0.15);
        z-index: 50;
        text-align: left;
    }

    nav ul.links li .submenu li {
        padding: 0.15cm 0.5cm;
        white-space: nowrap;
    }

    nav ul.links li details:hover .submenu,
    nav ul.links li details:focus-within .submenu {
        display: block;
    }
}

/* === Sub-menus: narrow-screen inline expansion via <details> === */

@media (max-width: 30em) {
    nav ul.links li details > summary {
        list-style: none;
        font-weight: 400;
        color: #009444;
    }

    nav ul.links li details > summary::-webkit-details-marker {
        display: none;
    }

    nav ul.links li .submenu {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    nav ul.links li .submenu li {
        padding: 0.25cm 0.5cm 0.25cm 1cm;
    }
}

/* === Typography === */

a,
a:visited {
    text-decoration: none;
    color: #009444;
}

a:hover,
a:hover:visited {
    text-decoration: underline;
    color: #8c4e31;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
table,
details,
figure {
    margin: 0 0 0.75cm 0;
    padding: 0;
}

ul,
ol,
dl {
    margin: 0 0 0.75cm 0;
}

li {
    margin-bottom: 0.01cm;
}

blockquote {
    margin-left: 0.5cm;
    font-style: italic;
    background-color: #ede9e1;
    border-radius: 0.1cm;
    padding: 0.5cm;
}

blockquote > *:last-child {
    margin-bottom: 0;
}


dt {
    font-weight: 600;
    padding: 0.1cm 0;
    margin-left: 0.5cm;
    position: relative;
}

dt::before {
    content: '›';
    position: absolute;
    left: -0.4cm;
}

dd {
    margin: 0 0 0.75cm 0.5cm;
}

details > summary {
    font-weight: 600;
    margin-bottom: 0.1cm;
    padding-left: 1.2em;
    text-indent: -1.2em;
}

details > *:not(summary) {
    margin-left: 0.5cm;
}

details > *:last-child {
    margin-bottom: 0;
}

code {
    background-color: rgba(68, 68, 68, 0.5);
    color: #ffffff;
    border-radius: 0.1cm;
    padding: 0.05em 0.2em;
    font-family: "Roboto Mono", monospace;
}

pre {
    background-color: #444444;
    color: #ffffff;
    border-radius: 0.1cm;
    padding: 0.5cm;
    margin-left: 0.5cm;
    overflow-x: auto;
}

pre code {
    background-color: transparent;
    color: inherit;
    border-radius: 0;
    padding: 0;
}

hr {
    border: none;
    border-top: 2px solid #444444;
    margin: 0.75cm 0;
}

p.read-more {
    text-align: right;
}

h1,
h2,
h3,
h4 {
    font-family: "Roboto Serif", serif;
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
    font-variation-settings: "wdth" 100, "GRAD" 0;
}

h1 {
    font-size: 2em;
}

h2 {
    font-size: 1.75em;
}

h3 {
    font-size: 1.5em;
}

h4 {
    font-size: 1.25em;
}

/* === Main content === */

#main {
    margin: 0 0.5cm;
}

/* === Cards === */

#cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6cm, 1fr));
    gap: 0.5cm;
}

#cards div.card {
    display: flex;
    flex-direction: column;
}

#cards div.card div.card-content {
    flex-grow: 1;
}

#cards div.card div.card-content img {
    margin: 0 0 0.25cm 0;
    padding: 0;
    border: 1px solid #444444;
    border-radius: 0.1cm;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* === Image modifiers === */

img.no-border {
    border: none;
    border-radius: 0;
}

/* === Action lists === */

ul.actions {
    list-style: none;
    padding: 0;
    margin: 0.5cm 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25cm;
}

ul.actions li {
    padding: 0;
    margin: 0;
}

ul.actions li:first-child {
    padding: 0;
    margin: 0;
}

#cards div.card ul.actions {
    margin: 0.25cm 0 0 0;
    justify-content: flex-end;
}

/* === Forms === */

input,
select,
textarea {
    padding: 0.15cm;
    border: 1px solid #cccccc;
    border-radius: 0.1cm;
    font-family: "Roboto", sans-serif;
    font-size: 1em;
    line-height: normal;
    color: #444444;
    background-color: #faf7f2;
}

option {
    background-color: #faf7f2;
}

textarea {
    font-family: "Roboto Mono", monospace;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="search"],
input[type="tel"],
textarea,
select {
    width: 15cm;
    max-width: 100%;
}

input[type="file"] {
    border: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #009444;
    outline-offset: -1px;
}

label[for] {
    display: block;
    font-weight: 500;
    margin-bottom: 0.1cm;
}

input:disabled,
input[type="checkbox"]:disabled,
select:disabled {
    background-color: #ede9e1;
}

/* === Buttons === */

button {
    background-color: #009444;
    border: none;
    color: #ffffff;
    border-radius: 0.1cm;
    padding: 0.3cm 0.8cm;
    margin: 0;
    font-family: "Roboto", sans-serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-style: normal;
    font-variation-settings: "wdth" 100;
    font-size: 0.95em;
    cursor: pointer;
}

button.black,
button[type="reset"] {
    background-color: #444444;
}

button.red {
    background-color: #cc2200;
}

button:not(:disabled):hover {
    filter: brightness(1.2);
}

button:disabled {
    background-color: #888888;
    cursor: default;
}

/* === Tables === */

table {
    border-collapse: collapse;
    border-radius: 0.1cm;
    display: block;
    overflow-x: auto;
}

th,
td {
    padding: 0.2cm;
    text-align: left;
}

th {
    background-color: #444444;
    color: #ffffff;
}

tbody tr:nth-child(even) {
    background-color: #ede9e1;
}

/* === Hint text === */

p.hint {
    font-style: italic;
    font-size: 0.9em;
    color: #888888;
    margin-top: -0.4cm;
}

/* === Link-styled buttons === */

a.button {
    display: inline-block;
    background-color: #009444;
    color: #ffffff;
    border-radius: 0.1cm;
    padding: 0.3cm 0.8cm;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
}

a.button:hover,
a.button:visited:hover {
    text-decoration: none;
    filter: brightness(1.2);
    color: #ffffff;
}

a.button:visited {
    color: #ffffff;
}

/* === Sidebar layout === */

.sidebar-layout {
    display: grid;
    grid-template-columns: 16ch 1fr;
    gap: 1cm;
}

@media (max-width: 30em) {
    .sidebar-layout {
        grid-template-columns: 1fr;
    }
}

/* === Sidebar === */

.sidebar h3 {
    margin-bottom: 0.25cm;
    font-size: 1em;
    font-family: "Roboto", sans-serif;
    font-weight: 600;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin-bottom: 0.2cm;
    line-height: 1.3;
}

.sidebar li a {
    text-decoration: none;
    color: #009444;
    font-size: 0.9em;
}

.sidebar li a:hover {
    text-decoration: underline;
    color: #8c4e31;
}

.sidebar li.current a {
    font-weight: 600;
    color: #444444;
}

/* === Footer === */

#footer {
    margin: 0;
    padding: 0;
    color: #aaaaaa;
    font-size: 0.9em;
}

#footer p.legal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15cm 0;
}

#footer p.legal span {
    white-space: nowrap;
}

@media (min-width: 50em) {
    #footer p.legal {
        flex-direction: row;
        justify-content: center;
        gap: 0;
    }

    #footer p.legal span + span::before {
        content: ' - ';
        white-space: pre;
    }
}
