* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  display: flex;
  font-family: "Nunito", Arial, sans-serif;
  font-size: 18px;
  background-color: #f7f1e8;
  justify-content: center;
}

body {
  max-width: 700px;
  width: 100%;
  padding: 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

main {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

header {
  display: flex;
  flex-direction: column;
}

header .topRow {
  display: flex;
  flex-direction: row;
  border-bottom: 2px solid #8b5e34;
  justify-content: space-between;
  align-items: end;
}

header .bottomRow {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.bottomRow form {
  padding: 0.25rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Playwrite US Trad", "Helvetica Neue", serif;
  font-size: 1.25em;
}

.MainTitle {
  font-size: calc(18px * 1.8);
  color: #a8570c;
}
.searchForm {
  font-size: calc(18px * 1.25);
}
.PrepTime {
  font-weight: 600;
}

.ingredients,
.description,
.steps {
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  gap: 0.75rem; 
}
.ingredients h4,
.steps h4 {
  color: #a8570c;
}

#searchTag {
  font-weight: bold;
  font-size: 18px;
}
.mainBody {
  background-color: #fff9f1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.topRow p a {
  font-weight: 600;
}

menu a {
  font-weight: 600;
}

header h1 a {
  color: #8b5e34;
  text-decoration: none;
}
header h1 a:hover {
  color: #a8570c;
  text-decoration: none;
}

header p a {
  color: #8b5e34;
  text-decoration: none;
}

header p a:hover {
  color: #a8570c;
  text-decoration: none;
}

header nav menu {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

header nav menu a {
  color: #8b5e34;
  text-decoration: none;
}

header nav menu a:hover {
  color: #a8570c;
  text-decoration: none;
}

.featuredRecipes {
  color: #a8570c;
}

.recipeName {
  color: #a8570c;
  text-decoration: none;
}
.recipeName:hover {
  color: #8b5e34;
}

.tags li {
  list-style-type: none;
}
.tags li a {
  color: #8b5e34;
  text-decoration: none;
}
.tags li a:hover {
  color: #a8570c;
}

.singleTag {
  color: #8b5e34;
  text-decoration: none;
}
.singleTag:hover {
  color: #a8570c;
}

.tagList {
  list-style-type: none;
}

.btn {
  display: inline-block;
  background-color: #8b5e34;
  color: #f7f1e8;
  text-decoration: none;
  padding: 0.5em 1em;
  border-radius: 9999px;
}

.btn:hover {
  background-color: #a8570c;
  color: #fff9f1;
}
.recipeImg {
  transform: rotate(2deg);
  border: 5px solid #fff;
  border-radius: 3px;
  margin-bottom: 0.5rem; 
  background-color: #fff9f1;
}

menu {
  list-style-type: none;
}

.recipeCards {
  list-style-type: none;
}

.visually-hidden {
  display: none;
}
.recipeByName a {
  color: #8b5e34;
  text-decoration: none;
}
.recipeByName a:hover {
  color: #a8570c;
}
.indexBody {
  border-width: 0.5px;
  border-style: solid;
  border-radius: 25px;
  border-color: #2e261c;
  max-width: 700px;
  border-bottom: 0px;
}

.indexHeader {
  max-width: 700px;
}
.singleCard {
  border-width: 1px;
  border-radius: 10px;
  max-width: 700px;
  border-style: outset;
  background-color: #ffffff7a;
}

.mainBody {
  border-width: 1px;
  border-style: solid;
  border-color: #2e261c;
  border-radius: 25px;
  border-bottom: 0px;
}

.singleCardSpace {
  border-width: 1px;
  border-radius: 10px;
  border-style: outset;
  background-color: #ffffff7a;
  margin-bottom: 1em;
}

.searchList {
  list-style-type: none;
}

.searchList {
  list-style-type: none;
}

.searchRecipName {
  text-decoration: none;
}

/* 
recipe page
*/

.recipeMeta {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 0 0;
}

.authorMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.tagList {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
}

.ingredients ul {
  padding-left: 1rem;
}

.ingredients li {
  text-indent: -1rem;
  padding-left: 1rem;
}

.steps ol {
  padding-left: 1em;
}

.recipeImg {
  max-width: 100%;
  margin-top: 0.5rem;
}

.PrepTime {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.PrepTime div {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
}

.PrepTime div dt {
  width: calc(100% - 75%);
}

.PrepTime div dd {
  width: calc(100% - 25%);
  padding: 0 0 0 0.5rem;
}

.recipe-Metadata,
.recipeMetaBot {
  display: flex;
  gap: 1rem;
}

.imgPrep,
.ingredients {
  width: calc((100% - 1rem) / 3);
}

.description,
.steps {
  width: calc((100% - 1rem) * 2 / 3);
}

/*
Index page
*/

.recipeCards {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  padding: 1rem 0 0;
  flex-wrap: wrap;
  align-items: flex-start;
}

.singleCard img {
  max-width: 100%;
}

.singleCard {
  width: calc((100% - 2rem) / 3);
  padding: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease-in-out;
  border: none;
  border-radius: 10px;
}
.singleCard:hover {
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tags li a {
  white-space: nowrap;
}
/*
  Search page
*/

#searchTag {
  width: 100%;
  padding: 0.25rem;
}

/*
  profile Page
*/

.profileHeader {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profileHeaderTop {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 1rem;
}

.profileHeaderTop img {
  width: 5rem;
  height: 5rem;
}

.profileInfo {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

/* screen width is <= 500 px
*/
@media (max-width: 500px) {
  body {
    padding: 0 0;
  }
  .steps {
    width: 100%;
    margin-bottom: 2rem;
  }
  .mainBody {
    border-left: 0;
    border-right: 0;
  }

  header {
    padding: 0.5rem;
  }

  header .topRow {
    border-bottom: 2px solid #8b5e34;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
  }
}

/*
  Login page
*/

.loginForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.formRow {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.25rem;
}
.formRow label {
  flex: 0;
}
.formRow input {
  width: 80%;
}
.formRow button {
  width: 50%;
  margin: 0 auto;
  min-width: 200px;
}

/* screen width is <= 700 px
*/
@media (max-width: 700px) {
  .formRow {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .formRow input {
    width: 100%; 
  }

  .formRow + .formRow {
    margin-top: 1rem;
  }
}

/* screen width is <= 600 px*/
@media (max-width: 600px) {
  .recipeCards .singleCard {
    width: calc((100% - 1rem) / 2); 
  }
}

/* screen width is <= 400 px */
@media (max-width: 400px) {
  .recipeCards .singleCard {
    width: 100%; 
  }

  .bottomRow form input {
   flex: 1 1 0.2rem;
   height: 1.5rem;
  min-width: 0; 
  }

  .bottomRow form button {
    flex: 0 0 auto;
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
  }
}

.indexSubtext {
  color: black;
}

.indexButton {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0.7rem 0 0;
}

.recipeList {
  list-style-type: none;
}
.bottomRow form {
  display: flex;
  align-items: stretch;
  gap: 0.3rem;
  padding: 0;
  flex-wrap:wrap;
}

.bottomRow form input {
  height: 1.8rem;
  
}

.bottomRow form button {
  padding: 0.2rem 0.5rem;
  flex-shrink: 1;
}

/* Edit Page*/

.recipeHeader { position: relative; }
.saveBtn {
  position: absolute;
  top: 0;
  right: 0;
}

textarea {
  width: 100%;
  max-width: 100%;   
  display: block;   
  resize: vertical; 
}

.steps textarea {
  width: 100%;
  max-width: 100%;
  resize: vertical;         
  display: inline-block;  
  vertical-align: top;      
}

/* Big, branded recipe title input */
#Recipe-Title {
  width: 90%;
  padding: .55rem .9rem;
  border: 1px solid black;
  background: #fff;
  outline: black;
  font-family: "Playwrite US Trad", "Helvetica Neue", serif;
  font-size: calc(18px * 1.8);  
  color: #a8570c;  
  font-weight: 600;
}

.PrepTime input[type="number"] {
  width: 5ch;         
  padding: .15rem .3rem; 
  font-size: 0.95rem;   
  line-height: 1.2;
  box-sizing: border-box;
}
.Ingredients-Edit {
list-style: circle; 
list-style-position: outside;
padding-left: 1.5rem; 

}

.Ingredients-Edit-Each {
 padding: .25rem 0;
}

.Ingredients-Edit-Each input {
  width: 100%;
  padding: .3rem .5rem;
  border: 1px solid black;
  box-sizing: border-box;
}

.steps ol > li:not(:last-child) {
  padding-bottom: 1rem;
}

.ing-row {
  display: grid;
  grid-template-columns: 5ch 8ch 1fr;
  gap: .4rem;
}

.error-list { display:block; color:#c0392b; font-weight:600; margin:.5rem 0 1rem; }
.error-list ul { list-style: disc; margin-left:1.5rem; }
/* Put Edit at the top-right next to the title */
.titleRow {
  display: flex;
  align-items: flex-start;   /* keeps button aligned with the title top */
  justify-content: space-between;
  gap: .75rem;
}