:root {
    --soft-color-rgba: rgba(var(--on-surface-color), 0.5);

    --font-family: "Letter Extended", Roboto Mono, monospace;
    /*--font-family: Soehne,Helvetica,Segoe UI,sans-serif;*/

    --gap: 3rem;
    --underline-offset: 0.3rem;

    --small-icon-size: 1em;
    --medium-icon-size: 3rem;

    --line-thickness: 1px;
    --line-style: dashed;

    --action-line-style: solid;

    --animation-duration: 0.3s;
}

/* Color scheme */
:root {
    --primary-color: #009f9f; /* Kyanite */
    /*--primary-variant-color: */
    /*--secondary-color: */
    /*--secondary-variant-color: */

    --primary-color-rgb: rgb(3, 252, 186);
    --primary-gradient: linear-gradient(143deg, var(--primary-color), transparent 70%),
    linear-gradient(233deg, black, transparent 70.71%),
    linear-gradient(24deg, white, transparent 50%),
    black;

    --background-gradient: linear-gradient(217deg, var(--primary-color), transparent 70%),
    linear-gradient(127deg, black, transparent 70.71%),
    linear-gradient(336deg, white, transparent 50%),
    black;

    --background-color: rgb(245, 245, 245); /* White smoke #F5F5F5 */
    --on-background-color: rgb(16, 12, 8); /* Smoky black #100C08 */

    --surface-color: rgb(255, 255, 255); /* White #FFFFFF */
    --on-surface-color: var(--on-background-color);

    --error-color: red;
    --on-primary-color: white;
    --on-secondary-color: black;
    --on-error-color: white;
}

@media (prefers-color-scheme: dark) {
    :root {
        /*--primary-variant-color: */
        /*--secondary-color: */
        /*--secondary-variant-color: */

        --background-color: #181a1b;
        --surface-color: black;
        --error-color: red;
        --on-secondary-color: black;
        --on-background-color: white;
        --on-surface-color: rgb(255, 255, 255); /* white #FFFFFF */
        --on-error-color: black;
    }
}

@media (prefers-color-scheme: dark) {
    .icon {
        filter: invert(100%);
    }
}

/* Main styling */

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--font-family), monospace;

    line-height: 1.4rem;

    padding: 0;

    display: flex;
    flex-direction: column;
    /* To show elements below each other */
    align-items: center;

    background-color: var(--background-color);
}

body.scroll-lock {
    /* To disable scrolling when a modal is open */
    overflow: hidden;
}

h1 {
    text-transform: uppercase;

    /*!* When wrapping to multiple lines, some padding between the lines *!*/
    line-height: 1;
}

h2 {
    text-transform: uppercase;

    border-bottom: var(--line-thickness) var(--line-style, solid);
    padding-bottom: 0.2em;
    margin-bottom: 0.5em;

    /* When wrapping to multiple lines, some padding between the lines */
    line-height: 1;
}

h3 {
    text-transform: uppercase;
    /*font-size: unset;*/

    /*padding: 0;*/
    /*margin: 0;*/
    /*font-weight: normal;*/
    /*display: inline;*/
}

header h3 {
    display: inline;
}

h1,
h2,
h3 {
    margin-top: var(--gap);
}

h1 a,
h2 a,
h3 a {
    text-decoration: none;
}

a {
    text-underline-offset: var(--underline-offset);
    text-decoration-thickness: var(--line-thickness);
    text-decoration-color: var(--soft-color-rgba);
    text-decoration-line: underline;
}

a:link,
a:visited {
    color: unset;
}

button {
    font-family: var(--font-family), monospace;
    font-size: 1rem;

    display: block;
    width: 100%;
    padding: 0.5em 1em;

    background-color: var(--background-color);
    border: var(--line-thickness) var(--action-line-style);
    border-color: var(--primary-color);
    cursor: pointer;

    vertical-align: center;
}

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

button:hover .icon {
    filter: invert(100%);
}

footer {
    width: 100%;
    bottom: 2vh;
    padding: var(--gap) 0;

    font-size: small;

    text-align: center;

    background-color: var(--surface-color);

    margin-top: auto;
    flex-shrink: 0;
}

footer p {
    opacity: 0.6;
}

footer a {
    text-decoration: none;
}

header p {
    text-align: justify;
    margin-top: var(--underline-offset);
}

hr {
    border: none;
    border-bottom: var(--line-thickness) var(--line-style) var(--on-background-color);

    /*margin-bottom: var(--line-thickness);*/
    margin: var(--gap) 0;
}

main {
    max-width: 320mm;
    padding: 2rem;

    counter-reset: link;
}

html {
    hyphens: manual;
    overflow-wrap: break-word;
}

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

.badge {
    min-width: 1rem;
    max-height: var(--small-icon-size);

    vertical-align: middle;
    margin-left: 0.3em;
}

.hidden {
    display: none;
}

.wrapper {
    /* Wrapper to center the content */
    flex: 1;
    display: flex;
    flex-direction: column;
    /* To show elements below each other */
    align-items: center;
    justify-content: center;
}

.ipa {
    font-family: "Charis SIL", "Doulos SIL", serif;
    font-weight: lighter;
}

.landing {
    text-align: center;
}

.heart {
    color: #CD001A; /* Cherry red */
}

.inline-icon {
    height: 1rem;
    vertical-align: middle;
}

.quote {
    border-left: var(--line-thickness) solid var(--primary-color);
    padding-left: 10px;
    margin: 20px;
    text-align: left;
}

/* Custom details element */
details {
    padding-left: 2.1em;
}

summary {
    list-style: none;
}

details summary {
    display: flex;
}

details > summary::before {
    content: '[+]';
    cursor: pointer;
    margin-left: -2.1em;
    margin-right: 0.3em;
}

details[open] summary::before {
    content: '[−] ';
}

details[open] {
    /* When open, add some spacing below */
    margin-bottom: 1em;
}

details[open] table td {
    min-width: 1.5rem;
}

@media print {
    body {
        font-size: 10pt;
        line-height: 1.1em;

        color: black;
        background: none;
    }

    main {
        padding: 0;
    }

    h1 {
        margin-top: 0;
    }

    a {
        text-decoration: none; /* Remove link styling */
        color: black; /* Ensure links are printed in black */
    }

    abbr {
        text-decoration: none;
    }

    details,
    details summary::before {
        margin: initial;
        padding: initial;
    }

    /* Hide the [+] in print */
    details summary::before,
    details[open] summary::before {
        content: '';
    }

    footer,
    nav-bar {
        display: none;
    }

    section {
        page-break-inside: avoid;
    }
}

/* Show icons with links next to each other */

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

ul.links li {
    padding: 0 10px;
}

ul.links img {
    width: 40px;
    height: 40px;
}

@media (prefers-reduced-motion: no-preference) {
    a .icon:hover {
        -webkit-filter: opacity(50%);
        -webkit-transition: all 0.5s ease;
        -moz-transition: all 0.5s ease;
        -o-transition: all 0.5s ease;
        -ms-transition: all 0.5s ease;
        transition: all 0.5s ease;
    }
}

/* Dictionary */

.dictionary-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 var(--gap);
}

/* Hero */

.hero {
    min-height: 100%;
    min-width: 100%;

    margin: 0;
    padding: 0;

    display: grid;
    place-items: center;

    background: var(--background-gradient);
    color: var(--on-primary-color);
}

.hero strong {
    color: var(--on-primary-color);
}

.hero-content {
    padding: 0 clamp(5%, 5vw, 100px);
    max-width: 320mm;
}

.hero .badges .icon {
    filter: invert(100%);
}

/* Cards */

.cards {
    width: 100%;

    margin: 1rem auto;

    display: inline-grid;
    grid-template-columns: repeat(auto-fit, minmax(15em, 1fr));
    grid-auto-rows: auto;
    gap: 1em var(--gap);

    /*display: flex;*/
    /*flex-wrap: wrap;*/
    /*justify-content: center;*/
}

.card {
    display: flex;
    flex-direction: column;

    padding: 1.5rem;

    /*background-color: var(--surface-color);*/
    /*color: var(--on-surface-color);*/
    border: var(--line-thickness) var(--action-line-style);
    /*border-color: var(--on-background-color);*/
    /*border-color: var(--soft-color-rgba);*/
    /*border-color: var(--surface-color);*/
    /*border-color: black;*/
    border-color: var(--primary-color);


    /*box-shadow: 1px 1px 0 var(--primary-color);*/

}

.card .body {
    flex: 1 1 auto; /* To push the content to the top and the footer to the bottom */
}

.card ul {
    padding-left: 1em;
}

.card .icon {
    opacity: 85%;
}

.card img {
    max-width: clamp(5rem, 25%, 15rem);
    height: auto;
}

@media print {
    .card img {
        max-width: 2cm;
    }
}

.card h1,
.card h2,
.card h3,
.card header {
    display: block;
    text-align: center;
}

.card header p {
    text-align: center;
}

/* Actions */
.badges {
    /* Align badges to the right */
    display: flex;
    justify-content: flex-end;
    gap: 1em;
}

.badges img {
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
}

/* Podium */

.cards.podium {
    margin-bottom: 6vh;
}

@media (prefers-reduced-motion: no-preference) {
    .cards.podium .card {
        transition: transform 200ms ease;
    }
}

.cards.podium .card:nth-of-type(1) {
    transform: translateY(0);
    /* Swap first and second card for podium */
    order: 2;
}

.cards.podium .card:nth-of-type(2) {
    transform: translateY(3vh);
    order: 1;
}

.cards.podium .card:nth-of-type(3) {
    transform: translateY(6vh);
    order: 3;
}

/* Blurry box with overlay button */

.blurred {
    position: relative;
    display: flex;
    align-items: center;

    min-height: 10em;
}

.blur-box {
    padding: 2em;
    margin: -2em;

    pointer-events: none;
}

.blur-content {
    width: 100%;
    filter: blur(10px);
}

@media (prefers-reduced-motion: no-preference) {
    .blurred-content {
        transition: filter var(--animation-duration);
    }
}

.blurred.revealed .blur-content {
    filter: none;
    pointer-events: auto;
}

.reveal-btn {
    position: absolute;
    display: flex;
    align-items: center;
    flex-direction: column;
}

/* https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion */
@media (prefers-reduced-motion: no-preference) {
    /* URL animation on hover
       Draw a line from left to right when hovering over the link */
    a {
        /* Reset to default text color */
        color: inherit;
        position: relative;
    }

    a::before {
        content: '';
        position: absolute;
        /* Height of the line */
        bottom: -1px;
        height: var(--line-thickness);
        left: 0;
        width: 0;
        background-color: var(--primary-color);
        transition: width var(--animation-duration) ease;
    }

    a:has(.icon)::before {
        display: none;
    }

    a:hover::before {
        width: 100%;
    }

    button:hover {
        transition: background-color var(--animation-duration) ease, color var(--animation-duration) ease;
    }

    button:hover .icon {
        transition: filter var(--animation-duration) ease;
    }
}

@media (max-width: 600px) {
    footer {
        max-width: 100%;
    }
}

@media (min-height: 100vh) {
    .footer {
        position: static;
    }
}
