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

:root {
  --dark-black-1: hsl(215.56deg 31.03% 17.06%);
  --dark-black-2: hsl(215.38deg 28.47% 26.86%);
  --gray: hsl(217.24deg 21.17% 26.86%);
  --gray-text: hsl(213.6deg 15.53% 68.43%);
  --bg-color: hsl(0, 40%, 5%);
  --text-color: hsl(0, 40%, 90%);
  --story-submit-btn-bg-color: hsl(180, 30%, 50%);
}

html {
  font-size: 62.5%;
}

a {
  text-decoration: none;
  cursor: pointer;
}

.single-page {
  padding: 4% 9%;
  line-height: 1.8;
  font-size: 1.6rem;
  img,
  video,
  svg,
  picture {
    max-width: 90%;
    margin: 2rem auto;
    display: block;
    border-radius: 1rem;
  }

  h1 {
    font-size: 3rem;
  }
  ul,
  ol {
    padding-block: 2rem;
  }
  li {
    font-size: 1.8rem;
    list-style-position: inside;
  }

  p {
    font-size: 1.8rem;
  }
}
body {
  background-color: var(--text-color);
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

nav {
  width: 100%;
  padding: 2rem 4%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--story-submit-btn-bg-color);
}

/* dropdown */
.dropbtn {
  background-color: var(--dark-black-2);
  color: var(--text-color);
  padding: 16px;
  text-transform: uppercase;
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

/* The container <div> - needed to position the dropdown content */
.dropdown {
  position: relative;
  display: inline-block;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--dark-black-2);
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
  right: 0;
}

/* Links inside the dropdown */
.dropdown-content a {
  color: var(--text-color);
  padding: 12px 16px;
  font-size: 1.6rem;
  text-decoration: none;
  display: block;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {
  background-color: hsl(from var(--dark-black-2) h s 30%);
}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
  display: block;
}

/* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown:hover .dropbtn {
  background-color: var(--dark-black-1);
}

/* pagefind */
.pagefind-ui__result-link,
.pagefind-ui__result-excerpt,
.pagefind-ui__message {
  color: var(--text-color) !important;
}

/* story modal */
#story-modal {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  max-height: 90vh;
  height: 100%;
  width: 90%;
  display: none;
  overflow-y: auto;
  background-color: var(--text-color);
}

#story-modal.show-story-modal {
  display: block;
}

#close-modal {
  position: absolute;
  top: 2%;
  right: 2%;
  z-index: 100;
  border: none;
  background-color: red;
  color: var(--text-color);
  cursor: pointer;
  padding: 1rem;
}

main {
  width: 100%;
}

.hero {
  width: 100%;
  min-height: 40rem;
  display: grid;
  gap: 2rem;
  padding: 2rem 4%;
  grid-template-columns: repeat(4, 1fr);
}

h1 {
  font-size: 4rem;
  color: var(--bg-color);
}

p {
  font-size: 2.5rem;
  font-weight: 200;
  color: var(--bg-color);
}

.hero > div:first-child {
  grid-column: 1/3;
  height: 100%;
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-direction: column;
}

.tags_categories {
  grid-column: 3/5;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.tags_list,
.category_list {
  width: 100%;
  padding: 2rem 4rem;
  background-color: var(--dark-black-1);

  h3 {
    font-size: 2.5rem;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    color: var(--gray-text);
  }

  ul {
    list-style: none;
    display: flex;
    align-items: center;
    row-gap: 2.5rem;
    column-gap: 1rem;
    flex-wrap: wrap;
  }
}

.chip a {
  font-size: 1.8rem;
  color: var(--text-color);
  text-decoration: none;
  text-transform: capitalize;
  background-color: var(--gray);
  padding: 0.8rem;
  border-radius: 0.4rem;

  &:hover {
    background-color: hsl(from var(--gray) h s 40%);
  }
}

.story-btn {
  width: 100%;
  padding: 2rem;
  font-size: 3.5rem;
  cursor: pointer;
  border: none;
  outline: none;
  background-color: var(--story-submit-btn-bg-color);

  &:hover {
    background-color: hsl(from var(--story-submit-btn-bg-color) h s 55%);
  }
}

dialog {
  margin: auto;
  width: 100%;

  #closeStoryModal {
    padding: 0.5rem 2rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    border: none;
    outline: none;
    background-color: red;
  }
}

iframe {
  height: 90vh;
  width: 100%;
}

.story__grid {
  padding: 5rem 2rem;
  display: grid;
  gap: 3rem 4rem;
  grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr));
}

.story__card {
  --border-radius: 0.8rem;
  display: flex;
  flex-direction: column;
  justify-content: start;
  border-radius: var(--border-radius);
  background-color: var(--gray);

  .story__coverImg {
    width: 100%;
    object-fit: cover;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
  }
}

.story__card__details {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.2rem;
  padding: 1.5rem 1.4rem;
}

.card__title {
  color: var(--text-color);
  font-size: 2.2rem;
}

.card__description {
  color: var(--gray-text);
  font-size: 1.2rem;
}

.story__card__icon {
  height: 1.5rem;
  width: auto;
}

.card__tags_categories {
  display: flex;
  gap: 0.6rem 1rem;
  align-items: center;
  flex-wrap: wrap;

  a {
    font-size: 1rem;
    text-decoration: none;
  }
}

.category__chip {
  background-color: hsl(120, 100%, 30%);
  padding: 0.2rem 0.6rem;
  color: var(--text-color);
  word-break: keep-all;
}

.tag__chip {
  color: var(--gray-text);
  word-break: keep-all;
}

.hastag {
  font-size: 1.8rem;
  margin-right: 0.2rem;
}

.publish__date__timeToRead {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.publish__date {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  time {
    color: var(--gray-text);
    font-size: 1.2rem;
  }
}

@media (width<=768px) {
  .dropbtn {
    font-size: 1.4rem;
    padding: 1rem;
    margin-left: 0.5rem;
  }

  .hero {
    grid-template-columns: 1fr;

    h1 {
      font-size: 3.5rem;
    }

    p {
      font-size: 1.8rem;
    }
  }

  .hero > div:first-child {
    grid-column: 1;
  }

  .hero > .tags_categories {
    grid-column: 1;
  }

  .tags_list,
  .category_list {
    padding: 3rem 2rem;
  }

  .story__grid {
    grid-template-columns: repeat(auto-fill, minmax(25rem, 1fr));
  }
}
