/* manrope-500 - latin */
@font-face {
  font-family: 'Manrope';
  src: url('assets/fonts/manrope-v20-latin-500.woff2') format('woff2'); 
  font-weight: 500;
  font-style: normal;
  font-display: swap; 
}
  
/* manrope-700 - latin */
@font-face {
  font-family: 'Manrope';
  src: url('assets/fonts/manrope-v20-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap; 
}


/* == CSS RESET == */

/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Remove default margin in favour of better control in authored CSS */
body, h1, h2, h3, h4, p,
figure, blockquote, dl, dd {
  margin-block-end: 0;
}

/* Remove list styles on ul, ol elements */
ul, ol {
  list-style: none;
}

/* Set shorter line heights on headings and interactive elements */
h1, h2, h3, h4,
button, input, label {
  line-height: 1.4;
}


/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input, button,
textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:root {
  /* == COLOR PALLETTE == */

  --light-grayish-blue: hsl(210, 46%, 95%);
  --grayish-blue:  hsl(212, 23%, 69%);
  --very-dark-grayish-blue: hsl(217, 19%, 35%);
  --desaturated-dark-blue: hsl(214, 17%, 51%);
  --clr-white: hsl(0, 0%, 98%);
  --clr-black: hsla(0, 0%, 0%, 0.4);

  /* == TYPOGRAPHY == */

  /* font family */
  --ff-body: "Manrope", sans-serif;

  /* font size */
  --fs-body: 0.84rem;

  /* font weights */
  --fw-bold: 500;
  --fw-bolder: 700;
}

body {
  height: 100%;
  min-height: 100svh;
  background: var(--light-grayish-blue);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  line-height: 1.5;
}

h1 {
  color: var(--desaturated-dark-blue);
  margin-block-end: 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.main__card {
  width: 88%;
  max-width: 24rem;
  display: flex;
  flex-direction: column;
  background: var(--clr-white);
  border-radius: 0.8rem;
  overflow: hidden; /* To clip decorative image */
  padding-block-end: 0;
}

.main__card--illustration {
  height: 100%;
  object-fit: cover;
}

.main__card--content {
  padding: 1.8rem 1.8rem 1.4rem;
}

.main__card--title {
  color: var(--very-dark-grayish-blue);
  font-size: 1rem;
  font-weight: var(--fw-bolder);
  margin-block-start: -0.3rem;
  margin-block-end: 1.2rem;
  text-decoration: none;
}

.main__card--description {
  color: var(--desaturated-dark-blue);
  margin-block-end: 0;
}

.footer {
  height: 4rem;
}

.author--block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 100%;
  margin: 0 1.7rem;
}

.author--block.hidden {
  display: none;
}

.info--wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.author--block img {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
}

.article--info {
  margin-block-start: -0.77rem;
}

.author--name {
  color: var(--very-dark-grayish-blue);
  font-weight: var(--fw-bold);
}

.date--published {
  color: var(--grayish-blue);
}

/* Button base styles */
.share--button {
  all: unset;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  background: var(--light-grayish-blue);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.25s ease; /* smooth transition for button */
}

/* Button hover & active - applied to BUTTON, not img */
.share--button:hover {
  background: var(--very-dark-grayish-blue);
} 

.share--button:hover .share-btn__icon path {
  fill: var(--light-grayish-blue);
}

.share--button:active {
  transform: scale(0.95);
}

/* Styles for share-box */
.share--box {
  min-height: 100%;
  background: var(--very-dark-grayish-blue);
  display: none;
  padding: 0.2rem 0.5rem 0.6rem;
  border-radius: 0 0 0.8rem 0.8rem;
}

.share--box.active {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: clamp(1rem, 2.5vw, 1.4rem);
}

.cta--text {
  color: var(--grayish-blue);
  font-weight: var(--fw-bold);
  letter-spacing: 0.3rem;
  text-transform: uppercase;
  margin-inline-start: 1rem;
}
  
.social--icons {
  display: flex;
  margin-inline-start: clamp(-4rem, -1.5vw, -6rem);
  gap: clamp(0.5rem, 2.5vw, 1.4rem);
}

.share--box .social--icons li a img {
  display: block;
  width: 1.8rem;
  height: 1.8rem;
}

.share-btn__icon {
  width: 0.9375rem;
  height: auto;
}


 @media screen and (min-width: 48rem) {
  body {
    height: 100vh;
    display: grid;
    place-items: center;
    font-size: clamp(0.75rem, 1.3vw, 0.8rem);
    margin: 0;
  }

  .main__card {
    width: 70%;
    max-width: clamp(65rem, 70vw, 70rem);
    display: grid;
    grid-template-columns: 2fr 3fr;
    grid-template-rows: 1.4fr;
    gap: 0.5rem;
    overflow: visible; 
  }

  .main__card--illustration {
    border-top-left-radius: 0.8rem;
    border-bottom-left-radius: 0.8rem;
  }

  .content-wrapper {
    overflow: visible;
    position: relative; 
  }

  .main__card--title {
    font-size: clamp(0.77rem, 2vw, 1.3rem);
    line-height: 1.2;
    margin-block-start: 1rem;
  }

  .main__card--description {
    margin-block-start: 1.5rem;
  }

  .footer {
    height: auto;
    position: static;
  }

  .author--block {
    position: relative;
    margin-block-end: 1.5rem;
  }

  #authorBlock {
    display: flex;
  }

  .share--button {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0.3rem;
    position: relative; 
    margin-block-end: 0.6rem;
  }

  .share-btn__icon {
    width: 0.9rem;
    height: auto;
  }

  .share--box {
    position: absolute;
    height: auto; /* Override mobile height */
    min-height: unset; /* Remove any min-height */
    bottom: 5.8rem;
    right: -3.7rem;
    padding: 0.1rem 1.5rem;
    border-radius: 0.6rem;
    box-shadow: 0 0.25rem 0.25rem var(--clr-black);
    display: none;
    z-index: 100;
  }


  .share--box::after {
    content: "";
    position: absolute;
    top: 3rem;
    left: 5.5rem;
    border-width: 9px 9px 0 9px;
    border-style: solid;
    border-color: var(--very-dark-grayish-blue) transparent transparent transparent;
  }

  .share--box.active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
  }

  /* When sharebox tooltip is open, keep button styled */
  .share--box.active ~ * .share--button,
  .footer:has(.share--box.active) .author--block .share--button {
    background: var(--very-dark-grayish-blue);
  }

  .share--box.active ~ * .share--button .share-btn__icon path,
  .footer:has(.share--box.active) .author--block .share--button .share-btn__icon path {
    fill: var(--light-grayish-blue);
  }
  
  .cta--text {
    font-size: 0.8rem;
    margin: 0;
  }

  .social--icons {
    gap: 0.7rem;
    margin-inline-start: -4rem;
  }

  .share--box .social--icons li a img {
    max-width: 1.2rem;
    height: 1.2rem;
  }

  .desktop--hidden {
    display: none;
  }
}
