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

html {
  --ash: #888;
  --cacao: #a8570c;
  --cast-iron: #2e261c;
  --cream: #f7f1e8;
  --oak: #8b5e34;
  --paper: #fff9f1;
  --white: #fff;

  font-size: 18px;
  margin: 0.5rem;
  display: flex;
  flex-direction: row;
  justify-content: center;
}

body {
  font-family: "Nunito", serif;
  font-size: 18px;
  color: var(--cast-iron);
  background-color: var(--cream);
  max-width: 700px;
  width: 100%;
}

header {
  margin-bottom: 3rem;
  display: flex;
  flex-direction: column;
  max-width: 700px;
  min-width: 0px;
  width: 100%;
}

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

.header-row * {
  align-self: flex-end;
}

.header-links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-evenly;
  align-self: flex-start;
  gap: 1rem;
  text-wrap: nowrap;
}

.header-underline {
  border-bottom: 2px solid var(--oak);
}

.header-search-bar {
  margin-top: 0.25rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: end;
}

.header-search-bar * {
  padding: 0.25rem;
}

.header-search-bar input {
  min-width: 0;
  flex-basis: 60%;
}

main {
  background-color: var(--paper);
  border: 1px solid var(--ash);
  border-bottom: none;
  border-top-left-radius: 50px;
  border-top-right-radius: 50px;
  padding: 1rem;
}

.main-heading,
.description {
  margin-bottom: 2rem;
}

h1,
h2,
h3,
.page-title {
  font-family: "Playwrite US Trad", "Nunito", sans-serif;
  color: var(--cacao);
}

a,
.page-title {
  color: var(--oak);
  text-decoration: none;
}

a:hover,
.page-title:hover {
  color: var(--cacao);
  text-decoration: underline;
}

.index-buttons {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: center;
}

.button-link {
  color: var(--cream);
  background-color: var(--oak);
  padding: 0.5em 1em;
  border-radius: 16px;
}

.button-link:hover {
  color: var(--paper);
  background-color: var(--cacao);
  text-decoration: none;
}

.index-cards {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: left;
  margin: 1rem 0rem;
  gap: 1rem;
}

.index-card {
  width: 100%;
  flex-basis: calc(calc(100% - 2rem) / 3);
}

.tags {
  color: var(--ash);
  text-wrap: nowrap;
}

.search-page-form {
  display: flex;
}

.search-page-search-bar {
  padding: 0.25rem;
  width: 100%;
}

ul {
  list-style-type: none;
}

h1 {
  font-size: 1.8em;
}

h2,
h3,
.page-title,
.login-form {
  font-size: 1.25em;
}

.recipe-listing {
  background-color: var(--white);
  border: 1px solid var(--white);
  border-radius: 10px;
  padding: 0.5rem;
  filter: drop-shadow(0px 0px 2px rgba(0, 0, 0, 0.5));
}

img {
  width: 100%;
}

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

.profile-page-paragraph {
  margin: 1rem 0rem;
}

.profile-photo {
  width: 5rem;
  height: 5rem;
}

dt {
  font-weight: 600;
}

.description,
.ingredients,
.steps {
  line-height: 1.25;
}

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

.steps-list {
  padding-left: 1rem;
}

.steps-list li {
  padding-bottom: 1rem;
}

.recipe-image {
  transform: rotate(2deg);
  border: 5px solid var(--white);
  border-radius: 3px;
  margin-bottom: 0.5rem;
}

.recipe-sidebar {
  display: flex;
  flex-direction: column;
}

dl {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.5rem;
  row-gap: 0.25rem;
  --remainder-width: calc(100% - 0.5rem);
  /* I found issues with certain screen sizes because of rounding error, this helps fix that */
  --fourth-remainder-width: round(down, calc(var(--remainder-width) / 4), 0.1%);
  width: 100%;
}

dl * {
  margin-bottom: 0.25rem;
}

dl dt {
  flex-basis: var(--fourth-remainder-width);
  width: 100%;
}

dl dd {
  flex-basis: calc(var(--fourth-remainder-width) * 3);
  width: 100%;
}

.tags-list {
  display: flex;
  flex-direction: row;
  column-gap: 0.5rem;
  row-gap: 0rem;
  flex-wrap: wrap;
}

.recipe-metadata {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.recipe-metadata * {
  margin-top: 0px;
  margin-bottom: 0px;
}

.recipe-responsive-section {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.recipe-responsive-section h2 {
  margin-bottom: 0.5rem;
}

.recipe-responsive-section .ingredients,
.recipe-responsive-section .recipe-sidebar {
  flex-basis: calc(calc(100% - 1rem) / 3);
}
.recipe-responsive-section .steps,
.recipe-responsive-section .description {
  flex-basis: calc(2 * calc(100% - 1rem) / 3);
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form .show-password {
  justify-content: end;
  align-items: center;
  font-size: 0.5em;
}
.login-form .show-password * {
  flex-grow: 0;
  flex-basis: 0%;
}

.login-form label {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.login-form label input {
  flex-basis: 80%;
  padding: 0.25rem;
  font-size: 1em;
}

.login-form label p {
  flex-basis: 20%;
}

.login-form button {
  width: 50%;
  min-width: 200px;
  margin: auto;
  font-size: 1em;
}

.visually-hidden {
  display: none;
}

.recipe-title-heading {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: start;
}

.recipe-title-heading form {
  display: flex;
  flex-direction: row;
  align-items: start;
}

.recipe-title-heading input {
  font-family: "Playwrite US Trad", "Nunito", sans-serif;
  color: var(--cacao);
  font-size: 1.8em;
}

textarea {
  width: 100%;
  resize: vertical;
  vertical-align: top;
}

.edit-step-ingredient-list {
  list-style-type: circle;
  margin-left: 1.5rem;
}

.edit-step-ingredient-list li {
  padding-bottom: 0.25rem;
}

output {
  color: red;
}

@media screen and (max-width: 400px) {
  .index-card {
    flex-basis: 100%;
  }
}

@media screen and (max-width: 500px) {
  html {
    margin: 0rem;
  }
  .recipe-responsive-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }
  header {
    padding: 0.5rem 0rem;
  }
  .header-row {
    padding: 0rem 0.5rem;
  }
  main {
    border-left: none;
    border-right: none;
    border-top-left-radius: 0px;
    border-top-right-radius: 0px;
  }
}

@media screen and (max-width: 600px) and (min-width: 400px) {
  .index-card {
    width: 100%;
    flex-basis: calc(calc(100% - 1rem) / 2);
  }
}

@media screen and (max-width: 700px) {
  .login-form label {
    display: flex;
    flex-direction: column;
    gap: 0rem;
  }
  .login-form label input {
    width: 100%;
  }
}
