/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Remove list styles */
ul,
ol {
  list-style: none;
}

a {
  text-decoration: none;
}

/* Set core body defaults */
body {
  text-rendering: optimizeSpeed;
  line-height: 1.5;
  font-family: "Manrope", sans-serif;
  font-size: 13px;
}

/* Make images easier to work with */
img {
  max-width: 100%;
  display: block;
}

/* Custom properties */
:root {
  /* Colors */
  --clr-very-dark-grayish-blue: hsl(217, 19%, 35%);
  --clr-desaturated-dark-blue: hsl(214, 17%, 51%);
  --clr-grayish-blue: hsl(212, 23%, 69%);
  --clr-light-grayish-blue: hsl(210, 46%, 95%);
  --clr-white: #fff;

  /* Typography */
  --ff-primary: "Manrope", sans-serif;
  --fs-body: 13px;
  --fw-regular: 500;
  --fw-bold: 700;

  /* Spacing */
  --spacing-xs: 1em;
  --spacing-sm: 1.5em;
  --spacing-md: 3em;

  /* Border radius */
  --border-radius: 10px;
  --border-radius-full: 50%;

  /* Box shadow */
  --shadow-default: 0 40px 40px -10px rgba(201, 213, 225, 0.5);
}

body {
  background-color: var(--clr-light-grayish-blue);
  display: grid;
  place-content: center;
  min-height: 100vh;
}

.image-box {
  overflow: hidden;
}

.article-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left;
  transition: all 0.3s ease;
  border-radius: 10px 0 0 10px;
}

.author-img {
  width: 3em;
  height: 3em;
  border-radius: 50%;
  object-fit: cover;
}

/* Article preview component */
.article-container {
  background-color: var(--clr-white);
  max-width: 56.153em;
  display: grid;
  grid-template-columns: 40% 60%;
  border-radius: 0.769em;
  box-shadow: 0 3.076em 3.076em -0.769em rgba(201, 213, 225, 0.5);
  margin: 0 1em;
}

.article-image:hover {
  transform: scale(1.1);
}

.article-content {
  padding: 2.307em 2.153em 1.538em;
  display: grid;
  gap: 1.84em;
}

.article-content h1 {
  font-size: 1.538em;
  color: var(--clr-very-dark-grayish-blue);
  font-weight: var(--fw-bold);
  line-height: 130%;
  transition: color 0.3s ease;
}

.article-content h1:hover {
  color: var(--clr-desaturated-dark-blue);
}

.main-text {
  color: var(--clr-desaturated-dark-blue);
  font-size: 1em;
  font-weight: var(--fw-regular);
  line-height: 140%;
  letter-spacing: 0.12%;
}

.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.author {
  display: flex;
  align-items: center;
  gap: 1em;
}

.author-name {
  font-size: 1em;
  color: var(--clr-very-dark-grayish-blue);
  font-weight: var(--fw-bold);
}

.publish-date {
  font-size: 1em;
  color: var(--clr-grayish-blue);
  font-weight: var(--fw-regular);
}

.share {
  position: relative;
}

.share-btn {
  width: 2.46em;
  height: 2.46em;
  border-radius: var(--border-radius-full);
  background-color: var(--clr-light-grayish-blue);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.share-btn.active,
.share-btn:hover {
  background-color: var(--clr-very-dark-grayish-blue);
}

.share-btn.active img,
.share-btn:hover img {
  filter: brightness(0) invert(1);
}

.share-box {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 1em 2em;
  border-radius: 0.769em;
  box-shadow: var(--shadow-default);
  background-color: var(--clr-very-dark-grayish-blue);
  position: absolute;
  --scale: 0;
  --translateX: -50%;
  --translateY: 0;
  transform: translate(var(--translateX), var(--translateY)) scale(var(--scale));
  transform-origin: bottom;
  visibility: hidden;
  opacity: 0;
  transition: all 0.25s ease;
  bottom: calc(100% + 2.153em);
  left: 50%;
}

.hidden {
  visibility: hidden !important;
  opacity: 0 !important;
  --scale: 0 !important;
}

.share-box::after {
  display: flex;
  justify-content: center;
  align-items: center;
  content: "";
  position: absolute;
  transform: translateX(-50%);
  left: 50%;
  bottom: -2em;
  border: 1.153em solid transparent;
  border-top-color: var(--clr-very-dark-grayish-blue);
}

.share-box.active {
  --scale: 1;
  visibility: visible;
  opacity: 1;
}

.share-box p {
  display: flex;
  align-items: center;
}

.share-box p span {
  letter-spacing: 0.5em;
  color: var(--clr-grayish-blue);
  text-transform: uppercase;
  margin-right: var(--spacing-xs);
}

.share-box ul {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.share-box ul li a {
  display: flex;
  align-items: center;
  width: 1.5em;
  height: 1.5em;
}

/* Media queries for responsiveness */
@media screen and (max-width: 48em) {
  .article-container {
    grid-template-columns: 1fr;
    overflow: hidden;
    max-width: 30em;
  }

  .article-content {
    padding: 2.307em 2.153em 1.538em;
  }

  .article-image {
    border-radius: 0;
  }

  .main-text {
    margin-bottom: 30px;
  }

  .article-footer {
    position: relative;
  }

  .share {
    position: static;
    z-index: 1;
  }

  .share-box {
    --scale: 1;
    --translateX: 0;
    --translateY: 100%;

    inset: -1.538em -2.153em;
    border-radius: 0;
    padding: 1.307em 2.307em;
    z-index: -1;
  }

  .share-btn.active,
  .share-btn:hover {
    background-color: var(--clr-desaturated-dark-blue);
  }

  .share-btn.active img,
  .share-btn:hover img {
    filter: brightness(0) invert(1);
  }

  .share-box.active {
    --translateY: 0;
  }

  .share-box::after {
    display: none;
  }
}
