/* Redefining css variables from picocss */
:root {
    --nav-element-spacing-horizontal: 1rem;
    --block-spacing-vertical: calc(var(--spacing) * 2.1);
    --h4-color: var(--color);
}

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

a {
    text-underline-offset: 3px;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

main {
    flex: 1;
    padding-bottom: var(--block-spacing-vertical);
}

#app > footer {
    border-top: 2px solid var(--primary-focus);
    background-color: var(--code-background-color);
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.1);
    padding: var(--spacing);
}

#app > footer p {
    text-align: center;
    margin: 0;
}

article {
    margin: var(--block-spacing-vertical) 0 0 0;
}

article > header {
    font-weight: bold;
    font-size: 1.5rem;
}

#bmc-button {
    width: 217px;
    height: 60px;
}

#bmc-button:hover {
    filter: brightness(0.9);
}

/* ChatGPT suggests this trick for responsive videos */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    margin-bottom: var(--typography-spacing-vertical);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

a {
    white-space: nowrap;
}

#player-controls {
    display: flex;
    /* This will push the left-side and right-side apart */
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#how-to-record {
    margin-left: 0.5rem;
    text-decoration: none;
}

#player-controls-universal {
    display: flex;
    align-items: center;
    width: 100%;
}

#player-controls-universal .spacer {
    flex-grow: 1;
}

@media (max-width: 767px) {
    #tts-box {
        height: 14rem;
    }

    #player-controls-universal {
        /* Stack the children vertically */
        flex-direction: column;
        gap: 1rem;
    }

    #player-controls-universal .spacer {
        /* Hide the spacer on small screens */
        display: none;
    }

    #player-controls-universal .player-button {
        flex-grow: 1;
        /* Set the width to 100% */
        width: 100%;
        margin: 0;
    }
}

#error404 > * {
    text-align: center;
}

.error-msg {
    color: var(--form-element-invalid-border-color);
    /* display: none; */
}

/* #region Navbar */

#navbar {
    /* Мне нужно знать высоту navbar-a,
    иначе я не знаю где показывать всплывающее меню */
    --navbar-height: 4rem;
    --navbar-background-color: var(--code-background-color);
    /* spacing between menu items */
    --navbar-menu-spacing-horizontal: 2rem;
    --navbar-menu-spacing-vertical: 1rem;
    /* size of the navbar toggle button */
    --navbar-toggle-width: 1.3rem;

    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 0 var(--spacing);
    background-color: var(--navbar-background-color);
    border-bottom: 2px solid var(--primary-focus);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
    /* height: var(--navbar-height); */
    min-height: var(--navbar-height);
}

/* Remove default marings and paddings for lists, buttons etc. */
#navbar * {
    margin: 0;
    padding: 0;
}

/* #region Navbar brand */

#navbar-brand {
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
}

/* This is logo within the #brand link */
#navbar-brand svg {
    width: 2.2rem;
    height: 2.2rem;
    margin-left: 0.2rem;
    margin-right: 0.5rem;
}

/* #endregion */

#navbar-right {
    display: flex;
}

/* #region Navbar Menu */

#navbar-menu {
    display: flex;
    gap: var(--navbar-menu-spacing-horizontal);
}

#navbar-menu li {
    /* Remove bullet points */
    list-style: none;
}

#navbar-menu li a {
    text-decoration: none;
}

/* #endregion */

/* Применяется к двум кнопкам: hamburger и theme-toggle */
#navbar button {
    cursor: pointer;
    background-color: transparent;

    /* Нужно задать размеры, иначе кнопка растягивается на всю ширину */
    width: var(--navbar-toggle-width);
    height: var(--navbar-toggle-width);

    /* Чтобы отцентровать контент внутри */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    /* Иначе появляется border когда кнопка принимает фокус */
    border: none;
    box-shadow: none;
}

/* На десктопе hamburger button не показывается */
#navbar button#navbar-toggle {
    display: none;
    /* Чтобы отодвинуть theme-toggler */
    margin-left: 0.8rem;
}

#theme-toggle {
    margin-left: var(--navbar-menu-spacing-horizontal);
}

/* В svg элементе прописано fill="currentColor"
Поэтому цвет spana эффективно задаёт цвет иконки */

#light-theme-on {
    color: hsl(205, 20%, 32%);
}

#dark-theme-on {
    color: hsl(205, 16%, 77%);
}

@media screen and (max-width: 700px) {
    #navbar button#navbar-toggle {
        display: flex;
    }

    #navbar-toggle .icon-bar {
        display: block;
        width: var(--navbar-toggle-width);
        height: 2px;
        margin: 2.5px;
        background-color: var(--secondary);
        transition: 0.25s ease-in-out;
    }

    #navbar-toggle:is(:focus, :hover) .icon-bar {
        background-color: var(--secondary-hover);
    }

    #navbar
        #navbar-toggle[aria-expanded="true"]
        .icon-bar:is(:first-child, :last-child) {
        position: absolute;
        margin: 0;
        width: 1.3rem;
        /* transition: 0.25s ease-in-out; */
    }

    #navbar #navbar-toggle[aria-expanded="true"] .icon-bar:first-child {
        transform: rotate(45deg);
    }

    #navbar-toggle[aria-expanded="true"] .icon-bar:nth-child(2) {
        opacity: 0;
    }

    #navbar-toggle[aria-expanded="true"] .icon-bar:last-child {
        transform: rotate(-45deg);
    }

    #navbar-menu {
        background-color: var(--navbar-background-color);

        opacity: 0;
        visibility: hidden;
        /* Нельзя этого делать только с помощью opacity,
        ибо потом боксик там будет, хоть и невидимый,
        и нельзя будет кликать на ссылки под ним.
        visibility включается сразу, и видно, как повышается opacity
        linear 0.5s указывает задержку для обратного перехода.
        То есть, он будет оставаться видимым пока opacity будет понижаться.
        */
        transition:
            opacity 0.5s,
            visibility 0s linear 0.5s;
        list-style: none;
        position: absolute;
        top: var(--navbar-height);
        right: 0.2rem;
        border-radius: 5px;
        box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
        padding: var(--navbar-menu-spacing-vertical);

        display: flex;
        flex-direction: column;
        gap: var(--navbar-menu-spacing-vertical);
        align-items: center;
        margin: 5px;
    }

    /* navbar-menu, когда оно показывается */
    #navbar-menu.show {
        opacity: 1;
        visibility: visible;
        transition:
            opacity 0.5s,
            visibility 0s linear 0s;
    }
}

/* #endregion */

/* #region header2 */

/* contains 2 sections: title and right side */
.header2 {
    display: flex;
    justify-content: space-between;
    /* This centers the items vertically if header has a specific height. */
    align-items: center;
}

.header2 .right-side {
    color: var(--color);
    font-style: normal;
    font-weight: var(--font-weight);
    font-size: calc(var(--font-size) * 0.9);
    display: flex;
    align-items: center;
}

.header2 .right-side a {
    color: var(--primary-hover);
    margin-right: 0.15rem;
    margin-left: 0.2rem;
    white-space: nowrap;
}

@media (max-width: 769px) {
    .header2 .right-side {
        display: none;
    }
}

/* #endregion */

/* #region pretty-list */
/* Colored list numbers a bit bigger than main text */

.pretty-list {
    list-style: none;
    counter-reset: custom-counter;
}

.pretty-list li {
    counter-increment: custom-counter;
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 0;
}

.pretty-list li::before {
    content: counter(custom-counter) ". ";
    position: relative;
    font-size: 1.4rem;
    color: var(--primary);
    margin-right: 1rem;
}

/* #endregion */

a.bmc svg {
    height: 3rem;
    width: auto;
    transition: all 0.3s ease;
    filter: drop-shadow(2px 2px 5px #ccc);
}

a.bmc:hover svg .bmc-button {
    fill: hsl(52, 100%, 48%);
}

strong {
    color: hsl(205, 20%, 36%);
}

/* #region header2 */

/* contains 2 sections: title and right side */
.footer2 {
    display: flex;
    justify-content: space-between;
    /* This centers the items vertically if header has a specific height. */
    align-items: center;
}

.coffee {
    height: 36px;
    width: auto;
}

/* #endregion */

/* #region Top Info Box */

#top-info-box {
    padding: 0.5rem;
    text-align: center;
    font-size: calc(var(--font-size) * 0.9);
}

#top-info-box a {
    font-size: 1rem;
}

/* Hide slogan by default */
#top-info-box .slogan {
    display: none;
}

/* Display slogan on screens wider than 600px */
@media (min-width: 600px) {
    #top-info-box .slogan {
        display: inline;
    }
}

/* #endregion */

/* #region jimlet button */

.jimlet-btn svg {
    width: 220px;
    height: auto;
    display: block;
    transition: filter 0.15s ease;
}
.jimlet-btn:hover svg {
    filter: brightness(0.95);
}

/* #endregion */

/* #region rotator */

.mobile-rotator-holder {
    padding: 1rem 0;
    text-align: center;
}

#tts-rotator {
    display: none;
}

#tts-rotator.mounted {
    display: block;
}

.rotating-panels .rotating-panel {
    display: none;
}

.rotating-panels .rotating-panel span {
    margin-left: 2px;
}

.rotating-panels .rotating-panel.active {
    display: inline;
    animation: flash-bg 0.4s ease-out;
}

@keyframes flash-bg {
    0% {
        background-color: #fdf1b4;
    }
    100% {
        background-color: transparent;
    }
}

#ttsbox-card {
    margin-top: 0;
}

/* #endregion rotating panels */
