/* Starting this CSS file with a reset from Josh W. Comeau */

/* 1. Use a more-intuitive box-sizing model */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
*:not(dialog) {
  margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  /* 4. Add accessible line-height */
  line-height: 1.5;
  /* 5. Improve text rendering */
  -webkit-font-smoothing: antialiased;
}

/* 6. Improve media defaults */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input, button, textarea, select {
  font: inherit;
}

/* 8. Avoid text overflows */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
  text-wrap: pretty;
}
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

/*
  10. Create a root stacking context
*/
#root, #__next {
  isolation: isolate;
}

/* style vars */
:root {
    --primary: lightgreen;
    --secondary: lightblue;
}

/* actual design things */

body {
    margin: auto;
    margin-top: 2em;
    margin-bottom: 2em;
    max-width: 800px;
    font-family: ui-rounded, 'Hiragino Maru Gothic ProN', Quicksand, Comfortaa, Manjari, 'Arial Rounded MT', 'Arial Rounded MT Bold', Calibri, source-sans-pro, sans-serif;
    font-weight: normal;
    padding: 1em;
}

header {
    display: block;
    height: 2em;
}

header nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3em;
    display: flex;
    padding-left: 1rem;
    padding-right: 1rem;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 2px 0px;
    background: var(--primary);

    .logo {
        color: initial;
        text-decoration: none;
        font-size: 2em;
    }

    .logo:hover {
        color: white;
    }

    .icons {
        list-style: none;
        padding: 0;
        display: flex;
        flex-direction: row;
        gap: 1em;

        li {
            color: black;
            width: 1.5em;
            height: 1.5em;
            cursor: pointer;
        }

        li:hover {
            color: white;
        }
    }

    .account {
        display: flex;
        align-items: center;
        gap: 1em;
    }
}

main {
    a {
        color: var(--primary);
    }

    p {
        margin-bottom: 1em;
    }

    .welcome {
        margin: auto;
        width: fit-content;
        margin-bottom: 1em;

        .logo {
            font-size: 2rem;
        }
    }

    .centred {
        display: flex;
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }

    .flash {
        width: 100%;
        padding: 1em;
        margin-bottom: 1em;

        &.error {
            background-color: pink
        }
        &.success {
            background-color: lightgreen
        }
    }


    .new {
        width: 100%;
        display: flex;
        textarea {
            padding: 5px;
            flex-grow: 1;
        }

        margin-top: 1em;
        margin-bottom: 1em;
    }
    
    .post, .comment {
        border: 1px solid black;
        margin-bottom: 1em;
        padding: 1em;

        time {
            float: right;
            font-size: 0.8em;
            opacity: 75%;
        }

        .details {
            padding-bottom: 5px;
        }

        .reactions {
            margin-top: 0.5em;
            font-size: 0.8em;
            .rxn {
                cursor: pointer;
                border: 2px solid var(--primary);
                border-radius: 2em;
                padding: 5px;

                b {
                    background: white;
                    border-radius: 2em;
                    padding: 3px;
                }
            }

            .rxn.me {
                border: 2px solid var(--secondary);
            }
        }

        .options {
            border-top: 1px solid lightgrey;
            padding-top: 0.5em;
            margin-top: 0.5em;
            margin-bottom: 1em;
            font-size: 0.8rem;
        }
    }

    /* If the post has a reaction from the user, hide the reaction button */
    .post:has(> .reactions .rxn.me) {
        & > .options button.react { display: none }
    }
}

main.settings {
    .profile, .registration {
        max-width: 25em;
        margin: auto;
        margin-bottom: 2em;
        display: flex;
        flex-direction: column;

        label, button {
            margin-top: 0.5em;
        }
    }
}
