
:root {
    --c-primary: #1e51ab;
    --c-primary-dark: #010112;
    --c-primary-light: #f1f7fe;
    --c-shadow-dark: rgb(from var(--c-primary-dark) r g b / 35% );
    --c-shadow-light: rgb(from var(--c-primary-light) r g b / 35% );

    --background: var(--c-primary-light);
    --text: var(--c-primary-dark);
    --shadow: var(--c-shadow-dark);
}

html {
  scroll-behavior: smooth;
}

:root:has(body > #theme-toggle > label > #theme-dark:checked) {
    --background: var(--c-primary-dark);
    --text: var(--c-primary-light);
    --shadow: var(--c-shadow-light);
}

:root:has(body > #theme-toggle > label > #theme-light:checked) {
    --background: var(--c-primary-light);
    --text: var(--c-primary-dark);
    --shadow: var(--c-shadow-dark);
}

@media (prefers-color-scheme: dark) {
    :root:has(body > #theme-toggle > label > #theme-system:checked) {
        --background: var(--c-primary-dark);
        --text: var(--c-primary-light);
        --shadow: var(--c-shadow-light);
    }
}

body {
    font-family: Verdana, sans-serif;
    max-width: 60ch;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem 1rem;
    background-color: var(--background);
    background-repeat: no-repeat;
    background-position: top center;

    color: var(--text);
}

#theme-toggle {
    position: absolute;
    border: 1px solid var(--text);
    right: 0.5rem;
    top: 0.5rem;
    border-radius: 2rem;

    #theme-dark, #theme-light, #theme-system {
        -webkit-appearance: none;
        appearance: none;
        margin: 0;
    }
    label {
        display: grid;
        width: 3rem;
        aspect-ratio: 1;
        text-align: center;
        cursor: pointer;
    }

    label:has(#theme-dark:checked), label:has(#theme-light:checked), label:has(#theme-system:checked) {
        background: var(--text);
        color: var(--background);
        border-radius: 100%;
    }

    span, svg {
        height: 1rem;
        width: 1rem;
        border-radius: 100%;
        display: inline-block;
        margin-left: auto;
        margin-right: auto;
    }
}

.logo-link {
    text-decoration: none;
    display: inline-block;
    width: 2rem;
    height: 2rem;
    margin-right: 1rem;
    margin-bottom: 0.5rem;

    svg {
        width: 100%;
        height: 100%;
    }
}

p {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.subtitle {
    text-align: center;
}

li {
    margin-top: 0.5rem;
}

.description {
    font-style: italic;
}

.author, .date {
    font-size: 0.8rem;
}

section, hr {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

hr {
    background: linear-gradient(to left, var(--background), var(--text));
    height: 1px;
    border: 0;
}

figcaption {
    font-size: 0.8rem;
}


video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
}

#back-to-top {
    position: fixed;
    right: 0.5rem;
    bottom: 0.5rem;

    z-index: 2;  /* ensure it's above other elements */
}

@supports (animation-timeline: scroll()) {
  #back-to-top {
    animation: fadeInScroller ease-in forwards;
    animation-timeline: scroll();
    animation-range: 0vh 500px;
    opacity: 0; /* Start hidden */
  }

  @keyframes fadeInScroller {
    0% { opacity: 0; pointer-events: none; }
    100% { opacity: 1; pointer-events: auto; }
  }
}

#search {
    box-sizing: border-box;
    width: 100%;
    font-size: 1rem;
    color: var(--text);
    
    border-right-width: 0;
    border-top-width: 0;
    border-bottom-width: 0;

    /* let it load before initialize */
    opacity: 0.5;
    transition: opacity 0.3s ease-in-out;
}

#search.is-loaded {
    opacity: 1;
}

#search::placeholder {
    color: var(--text);
}

a.article {
    display: block;
    margin: 1rem 0;
    text-decoration: none;
}

.article h3, .article p {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

table {
    border-collapse: collapse;
    max-width: 100%;

    th, td {
        border: 1px solid var(--text);
        border-spacing: 0;
        padding: 8px;
    }
}

footer {
    font-size: 0.9rem;
}

img {
    display: block;
    max-width: 100%;
    max-height: 50vh;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    margin-left: auto;
    margin-right: auto;
}

figcaption {
    color: var(--text);
    text-align: center;
}

a:-webkit-any-link {
    color: var(--text);
}

pre, blockquote, .eclipse-theme {
    padding: 1rem;
    border-color: var(--text);
    border-radius: 3rem;
    box-shadow: 12px 0 24px -12px var(--shadow),
                -6px 0 24px -6px var(--shadow), 
                inset 5px 0px 5px 0px var(--text);
    background: radial-gradient(circle at right, var(--background) 50%, rgb(from var(--text) r g b / 15%));
    transition: transform 0.15s ease-in-out;
}

blockquote:hover, .eclipse-theme:hover {
  transform: translateY(-3px);
}

blockquote {
    margin: 1rem 1rem;
    font-size: 1.1rem;
    padding: 1.25rem;

    p {
        display: inline;
    }
}

pre {
    padding: 2rem;
    overflow-x: auto;
    scrollbar-color: var(--text) rgb(from var(--background) r g b / 15%);
}

code {
    font-size: 1rem;
}

svg {
    fill: var(--text);
}

.website-title {
    height: 180px;
    width: 180px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 100%;
    display: flex;
    border-left-width: 30px;
    align-items: center;
}

a, a:visited {
  color: var(--text);
}