:root {
  --primary-color: #f60;
  --primary-color-bg: #faf1cb;
  --muted: #666;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  box-sizing: border-box;
}

html {
  background-color: #fefefe;
  border: 5px solid var(--primary-color);

  @media screen and (max-width: 640px) {
    border: none;
  }
}

body {
  background-color: #f5f5f5;
  border: 1px solid var(--primary-color);
  font-family: sans-serif;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  width: 80%;
  max-width: 1200px;

  @media screen and (max-width: 640px) {
    width: 100%;
  }
}

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

header h1,
header .menu,
main,
footer {
  padding: 1rem;
}

@media screen and (max-width: 640px) {

  h1 {
    font-size: 1.5rem;
    text-align: center;
  }

  header h1,
  header .menu,
  footer {
    padding: .25rem;
  }

  header h1 {
    margin-top: .5rem;
  }

  main h2,
  main p {
    margin: .5rem 0;
  }

  footer p {
    font-size: .8rem;
    margin: 0;
  }

  header {
    border-bottom: 1px solid var(--primary-color);
  }

  footer {
    border-top: 1px solid var(--primary-color);
  }
}


h1 {
  margin: 0;
}

header,
footer {
  background-color: var(--primary-color-bg);
}

.tools {
  background-color: var(--primary-color);
}

.tools nav {
  display: flex;
  justify-content: start;
  align-items: center;

  @media screen and (max-width: 640px) {
    flex-wrap: wrap;
  }
}

.tools nav a {
  text-decoration: none;
  font-size: .75rem;
  padding: .5rem;
  transition: color 0.2s, background-color 0.2s;
  color: white;
  border: 1px solid var(--primary-color);
  border-top: none;
  box-sizing: border-box;

  @media screen and (max-width: 640px) {
    font-size: .75rem;
    padding: .25rem;
  }
}

.tools nav a:hover {
  background-color: white;
  color: var(--primary-color);
  transition: color 0.2s, background-color 0.2s;
}

.tools button {
  background-color: transparent;
  color: white;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.5rem;
  border: 1px solid var(--primary-color);
}

.menu nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;

  @media screen and (max-width: 640px) {
    padding: .25rem;
  }
}

.menu nav a {
  text-decoration: none;
  background-color: #fffcf5;
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 15px 1px #ffddc1;
  padding: 0.5rem;
  border-radius: 5px;
  transition: color 0.2s, background-color 0.2s;
  margin: 0 0.5rem;
  color: #f60;

  @media screen and (max-width: 640px) {
    font-size: .75rem;
    padding: .25rem;
  }
}

.menu nav a:hover {
  background-color: var(--primary-color);
  color: white;
  transition: color 0.2s, background-color 0.2s;
}

nav .separator {
  flex: 1 1 auto;
}

.objects-list {
  flex: 1;
  min-height: 0;
  display: flex;

  ul {
    width: 50%;
    overflow-y: auto;
    min-height: 0;
    list-style: none;
    margin: 0 .25rem 0 0;
    padding: 0 .75rem 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    align-content: start;
  }

  li {
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    padding: 0.5rem;
    height: auto;
    opacity: 0.9;
    transition: opacity 0.2s;
    background-color: white;

    img {
      max-width: 100%;
      max-height: 150px;
      border-radius: 5px;
    }
  }

  li:hover {
    opacity: 1;
    transition: opacity 0.2s;
  }

  #id_map {
    width: 50%;
    height: 100%;
    min-height: 0;
    border-radius: 5px;
  }

  @media screen and (max-width: 640px) {
    display: block;

    ul {
      width: 100%;
    }

    #id_map {
      width: 100%;
      height: 50%;
      margin: 1rem 0;
    }
  }

}

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

.object-name {
  font-size: 1.25rem;
  flex: 1 1 auto;
  min-width: 0;
}

.category {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  padding: 0.25rem;
  border-radius: 3px;
}

.update {
  font-size: 0.75rem;
}

.photo-wrapper {
  width: 100%;
  text-align: center;
}


.leaflet-popup-content {
  img {
    max-width: 100%;
  }
}

.muted {
  color: var(--muted)
}

form {
  max-width: 700px;
}

form p {
  margin: 0 0 1rem;
}

form label {
  display: block;
  margin-bottom: .25rem;
  font-weight: bold;
}

form input[type="text"],
form input[type="email"],
form input[type="file"],
form textarea,
form select {
  width: 100%;
  box-sizing: border-box;
  padding: .5rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  font: inherit;
  background: #fff;
}

form textarea {
  resize: vertical;
  min-height: 6rem;
}

form button {
  padding: .5rem 1rem;
  border: 1px solid var(--primary-color);
  background: var(--primary-color);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

form button:hover {
  opacity: .9;
}

@media screen and (max-width: 640px) {
  form p {
    margin-bottom: .75rem;
  }

  form input,
  form textarea,
  form select {
    padding: .4rem;
  }
}

#filters-menu {
  max-width: 100%;

  div {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;

    p {
      min-width: 48%;
    }
  }

  @media screen and (max-width: 640px) {
    div {
      flex-direction: column;
      gap: 0.5rem;

      p {
        min-width: 0;
      }
    }
  }

  input {
    padding: .5rem;
    border: 1px solid var(--primary-color);
    background-color: white;
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: color 0.2s, background-color 0.2s;
  }

  input:hover {
    background-color: var(--primary-color);
    color: white;
    transition: color 0.2s, background-color 0.2s;
    cursor: pointer;
  }
}

#stuff-detail {
  display: flex;
  gap: 1rem;

  .photo-wrapper {
    width: 50%;
    text-align: center;
  }

  @media screen and (max-width: 640px) {
    flex-direction: column;

    .photo-wrapper {
      width: 100%;
      margin-bottom: 1rem;
    }
  }
}