/**
 * ldhoras.com styles
 *
 * Inspired by https://edwardtufte.github.io/tufte-css/
 * and the Vaadin default UI theme
 */

/* UI */

body {
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    scroll-behavior: smooth;
}

@keyframes ldhoras-loader-anim {
    from {
        width: 0%;
    }

    to {
        width: 95%;
    }
}

#ldhoras-loader[style*="none"] {
    display: block !important;
    width: 100% !important;
    opacity: 0;
    animation: none !important;
    transition: opacity 500ms 300ms, width 300ms;
}

#ldhoras-loader {
    position: fixed !important;
    z-index: 100;
    left: 0;
    right: auto;
    top: 0;
    width: 50%;
    opacity: 1;
    height: 4px;
    background-color: hsl(214, 90%, 52%);
    pointer-events: none;
    transition: none;
    animation: ldhoras-loader-anim 10s cubic-bezier(0.25, 0, 0, 1) 300ms both;
}

vaadin-drawer-toggle {
    cursor: pointer;
}

#ldhoras-drawer-scroller, #ldhoras-title {
    display: none;
}

#ldhoras-title {
    float: left;
    overflow: hidden;
    margin: 0 auto;
    font-family: var(--lumo-font-family);
    font-size: var(--lumo-font-size-xl);
    font-weight: 500;
    color: var(--lumo-header-text-color);
    text-decoration: none;
    cursor: pointer;
    user-select: none;
}

#ldhoras-theme-button {
    float: right;
    margin: 0 var(--lumo-space-s);
    cursor: pointer;
}

#ldhoras-drawer-scroller,
.ldhoras-drawer-element {
    padding: var(--lumo-space-s);
}

@keyframes ldhoras-contact-button-anim {
    from {
        opacity: 0;
        transform: scale(0);
    }

    to {
        opacity: 1;
        transform: scale(1)
    }
}

#ldhoras-contact-button {
    display: none;
    position: fixed;
    border-radius: 50%;
    box-shadow: 0 3px 5px -1px rgba(0, 0, 0, .2), 0 6px 10px 0 rgba(0, 0, 0, .14), 0 1px 18px 0 rgba(0, 0, 0, .12);
    width: 2.5rem;
    height: 2.5rem;
    z-index: 1;
    right: 1rem;
    bottom: 1rem;
    cursor: pointer;
    transform: scale(0);
    transition: background-color 0.15s;
    animation: ldhoras-contact-button-anim 0.25s ease 5s 1 forwards;
}

/* Variables */

:root {
    --ldhoras-font-size-xxl: 3.2rem;
    --ldhoras-font-size-xl: 2.2rem;
    --ldhoras-font-size-l: 1.7rem;
    --ldhoras-font-size-m: 1.4rem;
    --ldhoras-font-size-s: 1.1rem;
    --ldhoras-font-size-xs: 1rem;

    --ldhoras-font-weight-normal: normal;
    --ldhoras-font-weight-bold: bold;

    --ldhoras-line-height-l: 1.4em;
    --ldhoras-line-height-m: 1.3em;
    --ldhoras-line-height-s: 1em;

    --ldhoras-header-text-color: hsl(214, 35%, 15%);
    --ldhoras-body-text-color: hsla(214, 40%, 16%, 0.94);
    --ldhoras-primary-text-color: hsl(214, 100%, 43%);
    --ldhoras-secondary-text-color: hsla(214, 42%, 18%, 0.69);
    --ldhoras-strong-color: hsl(3, 92%, 53%);
    --ldhoras-base-color: #fff;

    --ldhoras-space-l: 2.1rem;
    --ldhoras-space-m: 1.4rem;
}

[theme~=dark] {
    --ldhoras-header-text-color: hsl(214, 100%, 98%);
    --ldhoras-body-text-color: hsla(214, 96%, 96%, 0.9);
    --ldhoras-primary-text-color: hsl(214, 90%, 77%);
    --ldhoras-secondary-text-color: hsla(214, 87%, 92%, 0.69);
    --ldhoras-strong-color: hsl(3, 100%, 80%);
    --ldhoras-base-color: #0d1219;
    background-color: var(--ldhoras-base-color);
}

/* Elements */

article {
    max-width: 64rem;
    margin: 0 auto;
    font-family: "et-book", "Palatino", "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    font-weight: var(--ldhoras-font-weight-normal);
    color: var(--lumo-body-text-color);
}

article .container {
    margin: var(--ldhoras-font-size-xxl) var(--ldhoras-font-size-xs);
    margin: var(--ldhoras-font-size-xxl) calc(7.5% - 1.5rem);
}

article .content {
    width: 65%;
}

/* Headers */

section {
    padding-top: 0;
    padding-bottom: 0.5rem;
    counter-reset: sidenote-counter;
}

section h1 {
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    font-size: var(--ldhoras-font-size-xxl);
    font-weight: var(--ldhoras-font-weight-normal);
    line-height: 1em;
    color: var(--ldhoras-header-text-color);
}

section .h1sub,
section .toc {
    line-height: var(--ldhoras-line-height-m);
    font-size: var(--ldhoras-font-size-l);
    color: var(--ldhoras-header-text-color);
}

section h2 {
    border-bottom: 1px solid var(--ldhoras-secondary-text-color);
    margin-top: var(--ldhoras-space-l);
    margin-bottom: var(--ldhoras-space-m);
    font-size: var(--ldhoras-font-size-xl);
    font-weight: var(--ldhoras-font-weight-normal);
    line-height: var(--ldhoras-line-height-m);
    color: var(--ldhoras-header-text-color);
}

section h3,
section h4,
section h5 {
    margin-top: var(--ldhoras-space-m);
    margin-bottom: var(--ldhoras-space-m);
    font-size: var(--ldhoras-font-size-l);
    line-height: var(--ldhoras-line-height-m);
    color: var(--ldhoras-strong-color);
}

section h3 {
    font-weight: var(--ldhoras-font-weight-bold);
}

section h4 {
    font-weight: var(--ldhoras-font-weight-normal);
}

section h5 {
    font-size: var(--ldhoras-font-size-m);
    font-variant: small-caps;
}

/* Text */

section p,
section ol,
section ul {
    margin-top: var(--ldhoras-space-m);
    margin-bottom: var(--ldhoras-space-m);
    font-size: var(--ldhoras-font-size-m);
    line-height: var(--ldhoras-line-height-l);
    color: var(--ldhoras-body-text-color);
}

section p.note {
    font-size: var(--ldhoras-font-size-s);
    line-height: var(--ldhoras-line-height-m);
    color: var(--ldhoras-secondary-text-color);
}

section span.indent {
    padding-right: calc(var(--ldhoras-font-size-m));
}

section a {
    color: var(--ldhoras-primary-text-color);
    text-decoration: none;
}

section a:hover {
    text-decoration: underline;
}

section a[id] {
    scroll-margin-top: var(--lumo-size-xl);
}

section strong.red {
    font-weight: var(--ldhoras-font-weight-normal);
    color: var(--ldhoras-strong-color);
}

section span.ant {
    padding-right: calc(0.6 * var(--ldhoras-font-size-m));
}

/* Sidenotes */

section .side {
    display: inline;
    white-space: nowrap;
    hyphens: none;
}

section .side>label {
    counter-increment: sidenote-counter;
}

section .side>label:before {
    content: counter(sidenote-counter);
    padding-left: 0.1em;
    vertical-align: super;
    font-size: var(--ldhoras-font-size-xs);
    font-style: normal;
    font-variant: normal;
    line-height: 0;
}

section .side>input {
    display: none;
}

section .side>span {
    white-space: normal;
    float: right;
    clear: right;
    /* 30% of 65% */
    width: 46.15%;
    /* 35% of 65% */
    margin: 0.3rem -53.84% 0.7rem 0;
    font-size: var(--ldhoras-font-size-s);
    font-weight: var(--ldhoras-font-weight-normal);
    font-style: normal;
    font-variant: normal;
    line-height: var(--ldhoras-line-height-m);
    color: var(--ldhoras-secondary-text-color);
}

section .side>span:before {
    content: counter(sidenote-counter) " ";
    vertical-align: super;
    font-size: var(--ldhoras-font-size-xs);
    line-height: 0;
}

/* Lists */

section ol {
    padding-left: calc(2.1 * var(--ldhoras-font-size-m));
}

section p.alphalist {
    margin-left: calc(1.4 * var(--ldhoras-font-size-m));
}

section p.alphalist>span.margin {
    display: inline-block;
    width: calc(1.15 * var(--ldhoras-font-size-m));
    margin-left: calc(-1.4 * var(--ldhoras-font-size-m));
    padding-right: calc(0.25 * var(--ldhoras-font-size-m));
    text-align: right;
}

/* Versicles */

section blockquote {
    border: 0;
    margin: 0 0 0 calc(1.5 * var(--ldhoras-font-size-m));
    color: var(--lumo-body-text-color);
}

section blockquote>p>span.bqind {
    margin-left: calc(-1.49 * var(--ldhoras-font-size-m));
    width: calc(1.5 * var(--ldhoras-font-size-m));
    display: inline-block;
}

/* Options */

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

section .option-label {
    color: var(--ldhoras-primary-text-color);
    cursor: pointer;
}

section .option-label:hover {
    text-decoration: underline;
}

section .option-toggle {
    display: none;
}

section .option-toggle:checked+.option {
    display: block;
    animation: fadeIn 0.6s;
    animation-fill-mode: forwards;
}

section .option-toggle+.option {
    display: none;
}

/* Mobile */

@media (max-width: 42rem) {
    article .container {
        margin: var(--ldhoras-font-size-xxl) var(--ldhoras-font-size-xs);
    }

    article .content {
        width: 100%;
    }

    section h1,
    section h2 {
        hyphens: auto;
    }

    section .side>label {
        cursor: pointer;
    }

    section .side>span {
        display: none;
    }

    section .side>input:checked+span {
        display: block;
        width: 95%;
        padding-left: 5%;
        margin: 1rem 0;
        float: left;
        clear: left;
    }
}

/* Print */

@media print {
    vaadin-app-layout {
        --_vaadin-app-layout-navbar-offset-size: 0 !important;
        --_vaadin-app-layout-navbar-offset-size-bottom: 0 !important;
        --_vaadin-app-layout-drawer-offset-size: 0 !important;
    }

    vaadin-app-layout::part(drawer),
    vaadin-app-layout::part(navbar),
    #ldhoras-contact-button {
        display: none;
        visibility: hidden;
    }
}