* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html {
    font-size: 18px;
    height: 100%;
    display: flex;
    justify-content: center;
}

body {
  font-family: "Nunito", Arial, Helvetica, serif;
  color:#2E261C;
  background-color: #F7F1E8;

  max-width: 700px;
  width: 100%;
  padding: 0 0.5rem; 
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Playwrite US Trad", Arial, Helvetica, sans-serif;
  font-size: 125%;
  color: #A8570C;
}

h1 {
  font-size: 180%;
}

a {
    color: #8B5E34;
    text-decoration: none;
}

a:hover {
    color: #A8570C;
    text-decoration: underline;
}

form {
  font-size: 125%;
}

header {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

main {
    background-color:#FFF9F1;
    border: 1px solid #888;
    border-bottom: none;
    border-radius: 50px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;

    margin-top: 3rem;
    padding: 1rem;
}

dt {
  font-weight: bold;
}

dd {
  font-weight: 600;
}

ul {
  list-style-type: none;
  padding-left: none;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1rem;
}

.description,
.ingredients,
.steps {
  line-height: 1.25;
}

a.homebutton {
  display: inline-block;
  background-color:#8B5E34;
  color: #F7F1E8;
  padding: 0.5em 1em;
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.3s, color 0.3s;
}

a.homebutton:hover {
  background-color: #A8570C;
  color: #FFF9F1;
}

.recipeimage {
  transform: rotate(2deg);
  border: 5px solid #FFF;
  border-radius: 3px;
}

.headertitle {
    color:#8B5E34;
    font-family: "Playwrite US Trad", Arial, Helvetica, sans-serif;
    font-size: 125%;
    font-weight: bold;
}

.headerprofile {
    margin-bottom: 0;
}

.visually-hidden {
    display:none;
}

.main-heading {
    margin-bottom: 2rem;
}

.description {
    margin-bottom: 2rem;
}

.header-top {
    display:flex;
    justify-content: space-between;
    align-items: flex-end;
}

.header-bottom {
    display:flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid #8B5E34;
    padding: 0;
}

.header-bottom form{
    display: flex;
    gap: 0.25rem;
    padding-top: 0.25rem;
}

.header-bottom form input[type="search"],
.header-bottom form button {
    padding: 0.25rem;
}

.recipe-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    row-gap: 0;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.recipe-metadata ul {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.recipe-metadata img {
    max-width: 100%;
    margin-bottom: 0.5rem
}

.recipe-metadata dl {
    display: flex;
    flex-direction: column;
    align-items:baseline;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.recipe-metadata dl div {
    display: flex;
    gap: 0.5rem;
}

.recipe-metadata dl dt {
    display: flex;
    flex-direction: column;
    width: calc(25%-0.25rem);
}

.recipe-metadata dl dd {
    display: flex;
    flex-direction: column;
    width: calc(75%-0.25rem);
}

.ingredients ul {
    padding-top: 0.25rem;
    padding-left: 1rem;
    text-indent: -1rem;
}

.steps ol {
    padding-top: 0.25rem;
    padding-left: 1em;
}

.index-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.recipe-card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    list-style: none;
    align-items: flex-start;
}

.recipe-card {
    background-color: #FFF;
    box-shadow:0px 3px 6px rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    width: calc((100% - 2rem) / 3);
}

.recipe-card img {
    max-width: 100%;
    height: auto;
}


.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    line-height: 1;
}

.recipe-tags li {
    white-space: nowrap;
    color: #888;

}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.profile-header img{
    width: 5rem;
    height: 5rem;
    gap: 1rem
}

.recipe-top-pair {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.recipe-top-pair img {
  width: 33.33%;
  max-width: calc(100%-1rem * 1/3);
}

.recipe-top-pair .description {
  width: calc(100% - (1rem * 2 / 3));
}

.recipe-bottom-pair {
  display: flex;
  gap: 1rem;
}

.recipe-bottom-pair .ingredients {
  width: calc((100% - 1rem) / 3);
}

.recipe-bottom-pair .steps {
  width: calc((100% - 1rem) * 2/3);
}

.top-metadata {
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.login-username,
.login-password {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: baseline;
    padding-bottom: 1rem;

}

.login-username input,
.login-password input {
    width: 80%;
    margin-left: auto;
    padding: 0.25rem;
    box-sizing: border-box;
}

.login-confirm {
    display:flex;
    justify-content: center;
}

.login-confirm button {
    width: 50%;
    min-width: 200px;
}

@media (max-width: 700px) {
  .login-username,
  .login-password {
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 0;
  }

  .login-username {
    margin-bottom: 1rem;
  }

  .login-username input,
  .login-password input {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 500px) {
    main {
        padding-left: 0;
        padding-right: 0;
        border-left: none;
        border-right: none;
    }

    header {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .recipe-top-pair,
    .recipe-bottom-pair {
        flex-direction: column;
        gap: 2rem;
    }

    .recipe-top-pair img,
    .recipe-top-pair .description,
    .recipe-bottom-pair .ingredients,
    .recipe-bottom-pair .steps {
        width: 100%;
    }
}

h1 button {
  align-items: right;
}

textarea {
  width: 100%;
  resize: vertical;
}


h1 input[type="text"] {
  font: inherit;
  color: inherit;
  width: inherit;
}

.steps ul li input[type="number"] {
    width: 10%;
}

.steps ul li input[name^="unit"] {
    width: 20%;
}

.steps ul li input[name^="name"] {
    width: 60%;
}

.steps li ul {
    list-style-type: circle;
    margin-left: 1.5rem;
    padding-left: 0;
}

.steps li ul li {
    padding-bottom: 0.25rem;
}

.steps li {
    padding-bottom: 1rem;
}

.errors {
    color: red;
    margin-bottom: 1rem;
}


@media (max-width: 600px) {
  .recipe-card {
    width: calc((100% - 1rem) / 2);
  }
}

@media (max-width: 400px) {
  .recipe-card {
    width: 100%;
  }
}

@media (max-width: 390px) {

    .header-bottom form{
        flex-direction: column;
    }
}