/*Specific color to the nev menu section*/
nav > ul > li:nth-child(3) > a {
    color: rgb(133, 227, 246);
}

/*Common layouts*/
#headline address,
#buttons {
    display: flex;
}

#headline address,
#buttons {
    justify-content: center;
}

label,
button,
#intro img {
    display: block;
}

#intro,
#intro figure,
#intro figure img,
input[type="range"] {
    margin: 0 auto;
}

#headline figure:last-of-type,
#intro img {
    width: 70%;
}

/*Styles for headline*/
#headline {
    display: grid;
    grid-template-columns: 2fr 1fr;
    justify-content: space-between;
    border-bottom: 2px solid grey;
}

#headline figure:first-of-type {
    grid-column: 1 / 3;
    grid-row: 1 / 4;
    max-height: 170px;
    overflow: hidden;
}

#headline figure:last-of-type {
    grid-column: 2 / 3;
    grid-row: 3 / 6;
}

h1 {
    grid-row: 3 / 5;
}

#headline address {
    grid-row: 5 / 6;
    font-style: normal;
    gap: 1rem;
}

#headline address a {
    color: rgb(192, 244, 202);
    background-color: rgb(17, 63, 63);
    padding: 5px;
}

h1,
#headline address {
    grid-column: 1 / 2;
}

h1,
#headline address,
#headline figure:last-of-type {
    margin: 0 20px;
}
/*Styles for headline ends*/

/*Styles for intro*/
#intro {
    max-width: 80%;
}

#intro > * {
    margin: 30px auto;
}

#intro p {
    max-width: 50ch;
    background-color: rgb(183, 183, 183);
    padding: 30px;
    border-radius: 0 70px 0 70px;
}

/*Form styles*/
form {
    margin: 20px auto;
    border: 2px solid grey;
    border-radius: 20px;
    padding: 20px;
    background-color: rgb(164, 209, 209);
}

form,
input[type="range"] {
    width: 80%;
}

#intro p,           /*Intro p selected as well for no repeat*/
input[type="text"], 
input[type="email"],
textarea, 
select,
fieldset > label,
fieldset {
    width: 100%;
}

input[type="text"], 
input[type="email"],
textarea, 
select,
fieldset > label,
fieldset,
button {
    border-radius: 4px;
}

label,
input,
select,
fieldset,
button,
textarea {
    margin-top: 5px;
    margin-bottom: 15px;
}


input[type="text"], 
input[type="email"],
textarea, 
select {
    color: #666666;
}

input[type="text"], 
input[type="email"],
textarea, 
select,
fieldset,
button {
    border: 1px solid rgb(24, 62, 25);
    padding: 7px;
    box-shadow: 0 1px 2px #666666;
}

form > label,
legend {
    font-weight: bold;
}

fieldset > label,
button,
input[type="range"] {
    cursor: pointer;
}

.topics {
    transform: scale(1.3); /*Makes the radio buttons larger*/
    margin-right: 10px;
    margin-left: 5px;
    accent-color: rgb(50, 126, 126);
}

legend,
label[for="rate"] {
    text-align: center;
}

/*Styles for the form buttons. 
Parts of this CSS is collected from my own form assignment last year in IT1.*/
#buttons {
    gap: 3rem;
}

button {
    width: 90px;
    font-size: 1.2rem;
    color: white;
    text-shadow: 0 -1px 1px #335166;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent); /*Little bit of glow to the buttons*/
}

button[type="submit"] {
    background-color: green;
}

button[type="reset"] {
    background-color: red;
}

button:active {
    transform: translate(1px, 1px); /*Click imitation*/
}

button:hover {
    transform: scale(1.1);
}

/*****Adjustments for the smallest phones*****/
@media screen and (max-width: 340px) {
    /*Making smaller for better layout, 
    still keeping as the largest size of headlines*/
    h1 {
        font-size: 2.2rem;
    }

    #headline > figure:last-of-type {
        margin: 10px;
    }

    #headline address {
        grid-column: 1 / 3;
        grid-row: 6 / 7;
    }
}

/****Ipad/small desktop design****/
@media screen and (min-width: 600px) {
    #headline figure:first-of-type {
        max-height: 300px;
        grid-row: 1 / 5;
    }

    #headline figure:first-of-type img {
        visibility: hidden;
    }

    #headline figure:last-of-type {
        grid-row: 3 / 7;
    }

    h1 {
        grid-row: 4 / 5;
    }

    #headline address {
        grid-row: 5 / 7;
        font-size: 1rem;
        padding: 30px 0;
        margin: 0 auto;
    }

    #intro img {
        width: 50%;
    }

    form {
        max-width: 60%;
    }
}

/****Desktop and larger screens.****/
@media screen and (min-width: 950px) {
    main {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas: 
            "head form"
            "intro form"
            "intro form"
            ". form";
    }

    main > * {
        max-width: 100%;
    }

    #headline {
        grid-area: head;
        margin: 20px;
        grid-template-rows: .3fr .3fr .3fr .7fr .3fr;
    }

    h1 {
        font-size: 3.8rem
    }

    #headline figure:first-of-type {
        background-image: none;
    }

    #headline figure:first-of-type img {
        visibility: visible;
    }

    #headline figure:last-of-type {
        grid-row: 2 / 5;
    }
    #headline address {
        grid-column: 1 / 3;
    }

    #intro {
        grid-area: intro;
        align-self: self-start;
        margin-bottom: 20px;
    }

    #intro img {
        width: 60%;
    }

    form {
        grid-area: form;
    }
}