* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 18px;
}

header {
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.header-bottom {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  border-top: 3px solid #8B5E34;
  justify-content: space-between;
}

.header-bottom ul {
  display: flex;
  gap: 1rem;
  list-style: none;
}

.page-container {
  max-width: 700px;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: center;
  flex-direction: column;
}

main {
    padding: 1rem;
    background-color: #FDF8F2;
    border: 1px solid #2e251c;
    border-radius: 20px;
}

#bottomMargin {
    margin-bottom: 2rem; 
}

#noMargin {
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Playwrite US Trad", cursive, serif;
  color: #A8570C
}

body {
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  font-size: 18px;
  background-color: #F7F1E8;
}

h1 {
  font-size: 1.8em;
  display: flex;
  flex-direction: row;
  align-items: start;
}

.recipe-intro {
  display: flex;
}
#edit_description_div {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
#edit_description {
  flex-grow: 1;
}

.edit_recipe_title {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.edit_recipe_title h1 {
  display: flex;
  align-items: start;
  gap: 2rem;
}

.edit_recipe_title input {
  flex: 1;
  font-size: 1em;
  padding: 5px;
}

#recipe_title {
  flex-direction: row;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 2rem;
}

#recipe_title form {
  margin: 0;
  padding: 0;
  size: 0;
}

#recipe_title button {
  align-self: flex-start;
}


#edit_title {
  font-size: 1em;
  font-family: "Playwrite US Trad", cursive, serif;
  color: #A8570C;
}

#step-description_edit {
  display: flex;
  flex-direction: column;

}

#step-description_edit li textarea {
  width: 90%;
  height: auto;
  flex-grow: 1;
}

.step-ingredients_edit {
  list-style: circle;
  margin-left: 2rem;
  margin-bottom: 1rem;
}
#step_ingredient_edit_list_item {
  padding-bottom: .25rem;
}

#ingredient_amount_edit {
  width: 3rem;
  padding: .25rem;
}

#ingredient_unit_edit {
  width: 5rem;
  padding: .25rem;

}

#ingredient_name_edit {
  width: auto;
  padding: .25rem;

}



.recipe-stats input {
  width: 4rem;
}

h2, h3, h4, h5, h6 {
  font-size: 1.25em;
}

dt strong {
   font-weight: 600;
}

a {
  color: #8B5E34;
  text-decoration: none;
}

a:hover {
  color: #A8570C;
  text-decoration: underline;
}

ul {
    list-style: none;
}

.visually-hidden {
  display: none;
}

.card-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem 1rem;
  padding: 0 1rem;
  align-items: start;
}

.card {
  display: flex;
  flex-direction: column;
  background-color: #FFF;
  box-shadow: 0 1px 3px #2e251c; 
  /* box shadow looks more like what is in the image than border since its only on 2 sides but could just be wrong about this */
  border-radius: 30px;
  list-style: none; 
  padding: 1rem;
}

.card-photo {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Specific to search.html */
.search-form input{
  width: 100%;
  padding: .25rem;
  font-size: 1.5rem;
}

/* Specific to login.html */
#login-form {
  display: flex;
  flex-direction: column;
  font-size: 1.25em;
}

#login-form label {
  align-items: baseline;
}

#login-form input {
  padding: .25rem;
  align-items: baseline;
  width: 80%;
}

#login-form button {
  width: 50%;
  align-self: center;
  margin-top: 1rem;

  min-width: 200px;
}

.login-row {
  margin-top: 1rem;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

/* Specific to profile.html */
.profile-header-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 2rem;
}

.profile-header-info img {
  height: auto;
  max-height: 100px;
}

.profile-header-info :first-child {
  flex-grow: 1;
}

.profile-header-text {
  display: flex;
  flex-direction: column;
}

.profile-header-data {
  display: flex;
  flex-direction: row;
  justify-content: start;
}

.profile-header-data :first-child {
  flex-grow: 0;
  margin-right: 2rem;
}

/* Error output for edit form */
output.errors-list li{
  color: red;
  margin: 1rem 0;
}

.profile-bio {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* Specific to index.html */
.homepage-buttons {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}

.button-homepage {
  background-color: #8B5E34;
  border: none;
  padding: .5em 1em;
  font-size: 1em;
  border-radius: 99px;
  text-decoration: none;
}

.button-homepage a {
    color: #F7F1E8;
}

/* Specific to recipe.html */
.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.recipe-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
}

.ingredients-list li {
  text-indent: -1rem;
  padding-left: 1rem;
}

.steps-list {
  list-style-position: inside; /* numbers inside padding instead of outside */
  padding-left: 0;            
}

.recipe-photo {
    transform: rotate(2deg);
    border: 5px solid #FFF;
    border-radius: 3px;

    height: auto;
    margin-bottom: 0.5rem;
}

.recipe-stats dt {
  display: inline;
  font-weight: bold;
}

.recipe-stats dd {
  display: inline;
  margin: 0 0 0 0.5rem; /* small space after the term */
}

.recipe-stats dd::after {
  content: "\A"; /* adding a new line after each definition */
  white-space: pre;
}

.ingredients-list,  .steps-list {
  flex: 1;
  min-width: 200px; /* prevent list from getting too small */
}

.recipe-body {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  align-items: flex-start;
}

.recipe-body section:first-child {
  flex: 1 1 0;
}

.recipe-body section:last-child {
  flex: 2 1 0;
}

.recipe-intro {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-top: 2rem;
} 

.recipe-intro img {
  min-width: 33%;
}

.recipe-intro p {
  margin: 0;
}

/* Responsive design rules */
@media (max-width: 500px) {
  .recipe-intro,
  .recipe-body {
    flex-direction: column;
  }
  main {
    background-color: #FDF8F2;
    border-top: 1px solid #2e251c;
    border-bottom: 1px solid #2e251c;
    border-left: none;
    border-right: none;

    border-radius: 20px;
  }
  .recipe-photo {
    max-width: 100%;
    margin-bottom: 1rem;
  }
  .header-bottom {
    padding: .5rem;
  }
  .header-top {
    padding: .5rem;
  }

}

@media (max-width: 700px) {
#login-form {
  display: flex;
  flex-direction: column;
  font-size: 1.25em;
}

#login-form label {
  align-items: baseline;
  padding-top: 1rem;
}

#login-form input {
  padding: .25rem;
  align-items: baseline;
  width: 100%;
}

#login-form button {
  width: 50%;
  align-self: center;
  margin-top: 1rem;

  min-width: 200px;
}
.login-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

}

@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 400px) {
  .card-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}