@font-face {
    font-family: 'Montserrat';
    font-weight: 400;
    font-display: block;
    src: url('/fonts/montserrat-400.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-weight: 500;
    font-display: block;
    src: url('/fonts/montserrat-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-weight: 600;
    font-display: block;
    src: url('/fonts/montserrat-600.woff2') format('woff2');
}

:root {
    color-scheme: light dark;

    /* The app's theme colors, and the darkest purple of its icon. */
    --color-primary: #6915aa;
    --color-primary-shade: #5c1296;
    --color-primary-tint: #9a4ed4;
    --color-primary-light: #b392cd;
    --color-primary-dark: #2e1042;

    --color-background-start: var(--color-primary-tint);
    --color-background-middle: var(--color-primary);
    --color-background-end: var(--color-primary-dark);
    --color-on-background: #ffffff;
    --color-surface: #fbfbfb;
    --color-text: #222428;
    --color-text-accent: var(--color-primary);
    --color-shadow: rgb(0 0 0 / 25%);
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-background-start: var(--color-primary-shade);
        --color-background-middle: var(--color-primary-dark);
        --color-background-end: #121212;
        --color-surface: #181818;
        --color-text: #f4f5f8;
        --color-text-accent: var(--color-primary-light);
    }
}

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

html {
    background: var(--color-background-end);
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 2.5rem 1rem 1.5rem;
    color: var(--color-on-background);
    font-family: 'Montserrat', system-ui, sans-serif;
    line-height: 1.6;
    overflow-wrap: break-word;
}

/* Fixed behind the content, so the screen shows the whole gradient however long the page is. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        160deg,
        var(--color-background-start),
        var(--color-background-middle) 40%,
        var(--color-background-end)
    );
}

a {
    color: inherit;
    text-underline-offset: 0.2em;
}

header,
main,
footer {
    width: 100%;
    max-width: 45rem;
}

header {
    text-align: center;
}

.logo {
    width: 14rem;
    max-width: 100%;
    height: auto;
}

h1 {
    margin: 0.5rem 0 1.5rem;
    font-size: clamp(1.4rem, 5vw, 1.75rem);
    font-weight: 600;
    line-height: 1.25;
}

footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
}

footer a {
    text-decoration: none;
}

footer a:hover,
footer a:focus-visible {
    text-decoration: underline;
}

.centered-page {
    justify-content: center;
    text-align: center;
}

.centered-page .logo {
    width: 18rem;
}

.centered-page main {
    max-width: 32rem;
}

.tagline {
    margin-bottom: 0;
}

.contact {
    margin-top: 0.25rem;
}

/* The badge image's transparent margin is all the space needed below it. */
.google-play-link {
    margin: 1.5rem 0 0;
}

.google-play-link img {
    width: 14rem;
    height: auto;
    vertical-align: bottom;
}

.trademark {
    margin-top: 0;
}

small {
    opacity: 0.7;
}

/* The page starts with the header, whose own space above and below centers its contents. */
.document-page {
    padding-top: 0;
}

/* The header is as wide as the card, so its logo and language menu line up with the card's edges. */
.document-page header,
.document-page main {
    max-width: 60rem;
}

.document-page header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 2.75rem 0 2.5rem;
}

.document-page header > a {
    justify-self: start;
}

.document-page .logo {
    display: block;
    width: 9rem;
}

.document-page h1 {
    margin: 0;
    font-size: clamp(1.25rem, 4.5vw, 1.5rem);
}

.document-page main {
    padding: 1.5rem clamp(1.25rem, 5vw, 2.5rem);
    border-radius: 1rem;
    background: var(--color-surface);
    box-shadow: 0 1rem 3rem var(--color-shadow);
    color: var(--color-text);
    font-size: 0.875rem;
}

.document-page main p {
    text-align: justify;
    hyphens: auto;
}

.document-page h2 {
    margin: 1.5em 0 0.6em;
    color: var(--color-text-accent);
    font-size: 1.05rem;
    font-weight: 600;
}

.document-page h2:first-of-type {
    margin-top: 0.9em;
}

.document-page h3 {
    margin-top: 1em;
    font-size: 0.95rem;
    font-weight: 600;
}

#date {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: right;
    opacity: 0.7;
}

.language-menu {
    position: relative;
    justify-self: end;
    font-size: 0.85rem;
    font-weight: 500;
}

.language-menu summary {
    padding: 0.25rem 0.9rem;
    border: 0.0625rem solid currentColor;
    border-radius: 1rem;
    cursor: pointer;
    list-style: none;
}

.language-menu summary::-webkit-details-marker {
    display: none;
}

.language-menu summary::after {
    content: '';
    display: inline-block;
    width: 0.4em;
    height: 0.4em;
    margin-left: 0.6em;
    border-right: 0.15em solid currentColor;
    border-bottom: 0.15em solid currentColor;
    transform: translateY(-0.15em) rotate(45deg);
}

.language-menu[open] summary::after {
    transform: translateY(0.1em) rotate(-135deg);
}

.language-menu ul {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1;
    min-width: 100%;
    margin: 0.5rem 0 0;
    padding: 0.5rem 0;
    border-radius: 0.75rem;
    background: var(--color-surface);
    box-shadow: 0 0.5rem 1.5rem var(--color-shadow);
    color: var(--color-text);
    font-size: 0.95rem;
    list-style: none;
    text-align: left;
}

.language-menu a {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
}

.language-menu a:hover,
.language-menu a:focus-visible {
    text-decoration: underline;
}

.language-menu [aria-current] {
    font-weight: 600;
}

/* Too narrow for the title between the logo and the menu, so it takes a row of its own below them. */
@media (max-width: 45rem) {
    .document-page header {
        grid-template-columns: 1fr auto;
        row-gap: 1rem;
    }

    .document-page h1 {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .language-menu {
        grid-column: 2;
        grid-row: 1;
    }
}
