/* Typography */

@font-face {
    font-family: "Hedvig Letters Serif";
    src: url("../fonts/HedvigLettersSerif18pt-Regular.woff2") format("woff2");
}

/* Variables */

:root {
    --color-main-text: #101010;
    --color-main-border: #101010;
    --color-main-inverse: #fff;
    --color-bg: #eeeceb;
    --color-disabled: #B0B0B0;
    --padding: 1.8rem;
    --text-padding: 1.8rem;
    --font-size-heading: 2.4em;
    --font-size-button: 1.2rem;
    --font-size-text: 1.2em;
    --border-radius: 34px;
    --transition-duration: 0.4s;
    --line-height: 1.7;
}

[data-theme="dark"] {
    --color-main-text: #eeeceb;
    --color-main-border: #FFF;
    --color-main-inverse: #101010;
    --color-bg: #101010;
    --color-disabled: #696969;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-variant-ligatures: none;
    text-rendering: optimizeLegibility;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent horizontal scrolling */
}

body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-family: 'Hedvig Letters Serif', serif;
    background-color: var(--color-bg);
    max-width: 100vw;
    overflow: hidden;
}

ul, ol {
    color: var(--color-main-text);
    list-style-position: outside; /* Bullets and numbers outside the text */
    margin-top: 1rem; /* Add space above the list */
    margin-bottom: 1rem; /* Add space below the list */
    padding-left: 1.0rem; /* Space the beginning of text to the right */
}

ul li, ol li {
    margin-bottom: 0.5rem; /* Add space between list items */
    line-height: 1.8; /* Improve line height for better readability */
    padding-left: 1.0rem; /* Align the second line with the first line */
}


/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    background-color: var(--color-bg);
    padding: var(--padding);
    border-bottom: 1px solid var(--color-main-border);
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Centering h1 within header */
header h1 {
    margin: 0;
    font-size: var(--font-size-heading);
    color: var(--color-main-text);
    font-weight: normal;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.background {
    position: absolute; /* Make sure it can contain absolutely positioned children */
    width: 100%;
    height: 100%;
    max-width: 100vw; /* Ensure container does not exceed viewport width */
    overflow: hidden; /* Hide any overflow from children */
    z-index: -10;
}

/* Theme switch wrapper */
.theme-switch-wrapper {
    display: flex;
    margin-left: auto;
}

.theme-switch-wrapper em {
    font-size: var(--font-size-button);
}

.theme-switch {
    display: inline-block;
    height: 1.5rem;
    position: relative;
    width: 3rem;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: var(--color-bg);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: var(--transition-duration);
    border: 1px solid var(--color-main-border);
}

.slider:before {
    background-color: var(--color-main-border);
    content: "";
    height: 1.2rem;
    width: 1.2rem;
    position: absolute;
    top: 50%;
    left: 0.10rem;
    transform: translateY(-50%);
    transition: var(--transition-duration);
}

input:checked + .slider:before {
    transform: translate(1.48rem, -50%);
}

.slider.round {
    border-radius: var(--border-radius);
}

.slider.round:before {
    border-radius: 50%;
}

/* Timer container */

.container {
    text-align: center;
    padding: var(--text-padding);
    border-radius: 90px;
}

#timerDisplay {
    font-size: 8em;
    margin: 20px 0;
    color: var(--color-main-text);
}

/* Timer controls */

.controls {
    margin: 20px 0;
}

.timeButton, #startStopButton {
    padding: 0.5rem 1.0rem;
    margin: 5px;
    border: none;
    border-radius: 5px;
    font-size: var(--font-size-button);
}

.timeButton {
    color: var(--color-main-text);
    background-color: var(--color-bg);
    cursor: pointer;
    border-radius: 90px;
    border: 1px solid var(--color-main-border);
}

#startStopButton {
    background-color: var(--color-main-text);
    color: var(--color-bg);
    cursor: pointer;
    border-radius: 90px;
    border: 1px solid var(--color-main-border);
}

#startStopButton:hover {
    background-color: var(--color-bg);
    color: var(--color-main-text);
}

.timeButton:hover {
    background-color: var(--color-main-text);
    color: var(--color-bg);
}

#startStopButton:disabled, .timeButton:disabled {
    /*    background-color: var(--color-disabled);*/
    border-color: var(--color-disabled);
    color: var(--color-disabled);
    cursor: not-allowed;
}

/* Sidebar styling */
.sidebar {
    height: calc(100% - 24px - 2 * var(--padding)); /* Adjust based on the header height */
    width: 25%;
    position: fixed;
    z-index: 1000;
    top: calc(24px + 2 * var(--padding)); /* Adjust based on the header height */
    left: calc(50% + 1px); /* Ensure the sidebar is fully off-screen, including the border */
    background-color: var(--color-bg);
    overflow-x: hidden;
    transition: left 1s;
    padding-top: var(--text-padding);
    border-top: 1px solid var(--color-main-border);
    border-right: 1px solid var(--color-main-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar a {
    color: var(--color-main-text);
    text-decoration: underline;
}

.sidebar-content, .sidebar-footer {
    padding: var(--text-padding);
    flex-grow: 1;
    text-align: left; /* Ensure text is left-aligned */
    line-height: var(--line-height);;
}

.sidebar h2, .sidebar p {
    color: var(--color-main-text);
}

.sidebar .close-btn {
    position: absolute;
    top: 10px;
    right: 28px;
    cursor: pointer;
    font-size: 36px;
}

.close-btn {
    color: var(--color-main-text);
}

#aboutLink {
    margin-right: auto;
    padding-right: var(--text-padding);
    color: var(--color-main-text);
    font-size: var(--font-size-text);
    text-decoration: none;
    cursor: pointer;
}

#aboutLink:hover {
    text-decoration: underline;
}

.sidebar-footer {
    padding: var(--text-padding);
    text-align: left; /* Ensure text is left-aligned */
}

/* Accessibility */

button:focus-visible {
    /*outline: 1px solid var(--color-main-border);*/
    /*outline-offset: 2px;*/
    filter: drop-shadow(0 0 0.3rem var(--color-main-text));
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Media Queries */

@media only screen and (min-width: 992px) and (max-width: 1925px) {
    :root {
        --font-size-heading: 2.5rem;
        --font-size-button: 1.2rem;
        --font-size-text: 1.2rem;
    }

    .timeButton, #startStopButton {
        padding: 0.5rem 1rem;
    }

    .sidebar {
        width: 50%;
        left: 2px;
    }

    #timerDisplay {
        font-size: 6em;
    }
}

@media only screen and (min-width: 768px) and (max-width: 992px) {
    :root {
        --font-size-heading: 2em;
        --font-size-button: 1.2rem;
        --font-size-text: 1.3rem;
    }

    .timeButton, #startStopButton {
        padding: 0.5rem 1rem;
    }

    .sidebar {
        width: 50%;
        left: 1px;
    }

    #timerDisplay {
        font-size: 5em;
    }
}

@media only screen and (max-width: 768px) {
    :root {
        --font-size-heading: 1.6em;
        --font-size-button: 0.9em;
        --font-size-text: 0.9em;
    }

    .timeButton, #startStopButton {
        padding: 0.5rem 1rem;
    }

    .sidebar {
        width: 100%;
    }

    #timerDisplay {
        font-size: 4em;
    }
}
