@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&family=Noto+Serif:wght@100..900&display=swap');

:root {
  --body-bg: hsl(222, 100%, 98%);
  --accent-clr: hsl(22, 93%, 47%);
  --pale-purple: hsl(245, 12%, 58%);
  --paragraph-clr: hsl(0, 0%, 0%, 0.5);
  --text-clr: hsl(0, 0%, 7%);
  --header-border-clr: hsl(0, 0%, 0%, 0.05);
  --sidebar-container-bg: hsl(0, 0%, 0%, 0.2);
  --sidebar-bg: hsl(222, 100%, 98%);

  --font-inter: 'Inter', sans-serif;
  --font-noto-serif: 'Noto serif', sans-serif;
  --font-para-fluid: clamp(0.875rem, 0.6827rem + 0.7692vw, 1.375rem);
  --font-h2-fluid: clamp(1.5rem, 0.875rem + 2.5vw, 3.125rem);

  --theme-btn-posX: 1rem;
  --theme-btn-posY: 1rem;
  --theme-btn-size: 36px;
}

@media (width <= 1285px) {
  :root {
    --theme-btn-posX: 1rem;
    --theme-btn-posY: clamp(6.25rem, 5.685rem + 2.2599vw, 7.5rem);
  }
}

/* ! resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  display: block;
  max-width: 100%;
}
button,
input {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  border: none;
}
@media (pointer: fine) {
  button {
    cursor: pointer;
  }
}
body {
  font-family: var(--font-inter);
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-noto-serif);
  color: var(--text-clr);
  transition: color 200ms;
}

button,
a,
img {
  user-select: none;
}

/* ! Util classes */
.text-accent {
  color: var(--accent-clr);
}
.bg-accent {
  background-color: var(--accent-clr);
}

/* ! Extra features styling */
/* Theme */
.demo-theme-icons-container {
  width: var(--theme-btn-size);
  height: var(--theme-btn-size);
  overflow: hidden;
}

.demo-theme-icon {
  color: var(--text-clr);
  width: var(--theme-btn-size);
  height: var(--theme-btn-size);
  display: grid;
  place-items: center;
  transition: translate 300ms;
}

.theme-toggle-btn {
  display: block;
  position: fixed;
  top: var(--theme-btn-posY);
  left: var(--theme-btn-posX);
  z-index: 3;

  background-color: hsl(0, 0%, 50%, 0.1);
  width: var(--theme-btn-size);
  height: var(--theme-btn-size);
  border-radius: 0.425rem;
  transition: background-color 150ms;

  @media (pointer: fine) {
    cursor: pointer;
    &:hover {
      background-color: hsl(0, 0%, 50%, 0.3);
    }
  }
}

.theme-toggle-input {
  display: none;
}

.theme-toggle-input:checked + .root {
  --body-bg: hsl(222, 30%, 7%);
  --accent-clr: hsl(22, 93%, 47%);
  --pale-purple: hsl(245, 12%, 58%);
  --paragraph-clr: hsl(0, 0%, 100%, 0.5);
  --text-clr: hsl(0, 0%, 93%);
  --header-border-clr: hsl(0, 0%, 100%, 0.05);
  --sidebar-container-bg: hsl(0, 0%, 50%, 0.2);
  --sidebar-bg: hsl(222, 30%, 9%);

  .demo-theme-icon {
    translate: 0 -100%;
  }
}

.demo-theme-icons-container {
  position: fixed;
  top: var(--theme-btn-posY);
  left: var(--theme-btn-posX);
  z-index: 4;
  pointer-events: none;
}

/* Sidebar */
.sidebar-toggle-btn {
  position: fixed;
  z-index: 6;
  top: clamp(1.8125rem, 1.5rem + 1.25vw, 2.625rem);
  right: 1rem;
  color: var(--text-clr);

  height: 30px;
  width: 30px;
  display: grid;
  place-items: center;

  @media (pointer: fine) {
    cursor: pointer;
  }
}

.sidebar-toggle-btn:active {
  scale: 0.95;
}

.sidebar-toggler-input {
  display: none;
}

.sidebar-container {
  position: fixed;
  inset: 0;
  z-index: 5;
  background-color: var(--sidebar-container-bg);
  opacity: 0;
  transition: opacity 250ms;
  pointer-events: none;

  div {
    display: grid;
    align-content: start;
    padding-block-start: 8rem;
    gap: 0.225rem;
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 250px;
    background-color: var(--sidebar-bg);
    translate: 105% 0;
    transition: translate 400ms;
    padding-inline: 0.5rem;

    a {
      color: var(--text-clr);
      padding-inline: 1rem;
      padding-block: 0.525rem;
      font-weight: 500;

      @media (pointer: fine) {
        transition: background-color 150ms;
        &:hover {
          background-color: hsl(0, 0%, 50%, 0.1);
        }
      }
    }
  }
}

@media (width >= 750px) {
  .sidebar-container {
    display: none;
  }
  .sidebar-toggle-btn {
    display: none;
  }
}

.sidebar-toggler-input:checked + .sidebar-container {
  opacity: 1;
  pointer-events: auto;

  > div {
    translate: 0 0;
  }
}

/* ! main styling */
.root {
  background-color: var(--body-bg);
}

header {
  position: fixed;
  top: 0;
  left: 50%;
  translate: -50% 0;
  z-index: 2;
  background-color: var(--body-bg);
  width: 100%;
  height: clamp(5.625rem, 4.9038rem + 2.8846vw, 7.5rem);
  display: flex;
  align-items: center;
  border-block-end: 1px solid var(--header-border-clr);

  > div {
    width: calc(100% - 2rem);
    max-width: 1140px;
    margin-inline: auto;
    box-sizing: content-box;
    padding-inline: 1rem;
    display: flex;
    justify-content: space-between;
  }
}

.header-logo-container {
  width: clamp(5.625rem, 4.5433rem + 4.3269vw, 8.4375rem);
}

.nav-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-clr);

  @media (width < 750px) {
    margin-inline-end: 2.725rem;
  }
}

nav {
  display: flex;
  align-items: center;
  gap: 1rem;

  @media (width < 750px) {
    display: none;
  }
}

nav > a {
  color: var(--pale-purple);
  transition: color 150ms, -webkit-text-stroke 150ms;
  padding-inline: 1rem;
  padding-block: 0.325rem;
  position: relative;
}

nav > a:hover {
  color: var(--text-clr);
  -webkit-text-stroke: 0.3px var(--text-clr);
}

@media (pointer: fine) {
  nav > a::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    translate: -50% 0;
    width: 0;
    height: 3px;
    background-color: var(--pale-purple);
    border-radius: 100rem;
    transition: width 200ms ease-out, background-color 1000ms;
  }

  nav > a:hover::before {
    width: 50%;
  }
}

.cart {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  user-select: none;
}

.cart-link {
  position: absolute;
  inset: 0;
}

/* ! Hero section styling */
.hero-section {
  padding-block-start: clamp(8rem, 5.3077rem + 10.7692vw, 15rem);
}

h1 {
  font-size: clamp(1.5rem, 0.5144rem + 3.9423vw, 4.0625rem);
  margin-block-end: 1rem;
}

.paragraph {
  font-size: var(--font-para-fluid);
  color: var(--paragraph-clr);
  letter-spacing: 0.7px;
  transition: color 200ms;
}

.hero-section {
  max-width: 1140px;
  margin-inline: auto;
}
.hero-image-container {
  img {
    width: 100%;
  }

  @media (width < 750px) {
    margin-block-end: 2rem;
  }
}

.hero-text-container {
  @media (width < 750px) {
    padding-inline: 1rem;
  }
}

@media (width >= 750px) {
  .hero-section {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    box-sizing: content-box;
    padding-inline: 1rem;

    > * {
      flex: 1;
    }
  }
}

/* ! Our plants section styling */
.our-plant-section {
  max-width: 1140px;
  margin-inline: auto;
  box-sizing: content-box;
  padding-inline: 1rem;
  margin-block-start: 5rem;
  scroll-margin-block-start: 8rem;
}

.our-plant-section > div:first-of-type {
  display: grid;
  gap: 0.4rem;
  justify-items: center;
  text-align: center;

  h2 {
    font-size: var(--font-h2-fluid);
  }

  p {
    max-width: 60ch;
  }
}

.flower-grid-container {
  --min-item-width: clamp(10rem, 5.7143rem + 17.1429vw, 13.75rem);

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--min-item-width), 1fr));
  gap: 1rem;

  margin-block-start: 1.5rem;
}
.flower-grid-each-item {
  > div:first-of-type {
    img {
      width: 100%;
    }
  }
  > div:last-of-type {
    color: var(--text-clr);
    div {
      padding-block: 1rem;
      display: grid;
      justify-items: center;
      gap: 0.5rem;

      p:last-of-type {
        font-weight: 700;
      }
    }

    button {
      width: 100%;
      background-color: var(--accent-clr);
      color: white;
      height: 40px;
      font-size: 0.875rem;
      font-weight: 500;
      letter-spacing: 0.3px;
      position: relative;

      .overlay {
        position: absolute;
        inset: 0;
        background-color: hsl(0, 0%, 100%, 0.1);
        z-index: 2;
        opacity: 0;
        transition: opacity 150ms;
      }

      &:hover .overlay {
        opacity: 1;
      }
      &:active .overlay {
        background-color: hsl(0, 0%, 100%, 0.2);
      }
    }
  }
}

/* ! plant lover section styling */
.plant-lover-section {
  max-width: 1140px;
  margin-inline: auto;
  box-sizing: content-box;
  padding-inline: 1rem;

  margin-block-start: 10rem;
  display: grid;
  gap: 2rem;

  > div:first-of-type {
    img {
      width: 100%;
    }
  }

  > div:last-of-type {
    display: grid;
    gap: 1rem;
    h2 {
      font-size: var(--font-h2-fluid);
    }
    ul {
      padding-inline-start: 1.5rem;
      display: grid;
      gap: 1rem;
    }
  }

  @media (width >= 750px) {
    grid-template-columns: 1fr 1fr;
    align-items: center;

    gap: 3rem;
  }
}

.plant-lover-image-container {
  position: relative;

  > div {
    --size: clamp(10.625rem, 8.7019rem + 7.6923vw, 15.625rem);
    position: absolute;
    top: 0;
    right: 0;
    width: var(--size);
    height: var(--size);
    translate: 40% -40%;

    @media (width < 750px) {
      display: none;
    }
  }
}

.badge {
  animation: shine 3s infinite ease-in-out, badge-animation 3s infinite;
}

@keyframes shine {
  0% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.2);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes badge-animation {
  0% {
    scale: 0.98;
    translate: 0 -5px;
  }
  50% {
    scale: 1;
    translate: 0 0;
  }
  100% {
    scale: 0.98;
    translate: 0 -5px;
  }
}

/* ! Latest deals styling */
.latest-deal-section {
  display: grid;
  gap: 3rem;
  max-width: 1140px;
  margin-inline: auto;
  box-sizing: content-box;
  padding-inline: 1rem;
  scroll-margin-block-start: 8rem;

  margin-block-start: 5rem;

  .text-container {
    display: grid;
    gap: 1rem;
    justify-items: center;
    text-align: center;

    h2 {
      font-size: var(--font-h2-fluid);
    }
    p {
      max-width: 60ch;
    }
  }
}
.deal-grid-container {
  --gap: clamp(1rem, 0.8077rem + 0.7692vw, 1.5rem);

  display: grid;
  gap: var(--gap);

  > div:first-of-type {
    display: grid;
    gap: var(--gap);
  }

  .image-container {
    border-radius: 1rem;
    overflow: hidden;
    position: relative;

    img {
      width: 100%;
      transition: scale 500ms;
      transform-origin: center;
    }

    > div {
      position: absolute;
      inset: 0;
      background-color: hsl(0, 0%, 0%, 0.25);
      color: #fff;
      display: grid;
      justify-items: center;
      align-content: center;
      gap: 0.5rem;
      transition: background-color 300ms;

      span {
        font-family: var(--font-noto-serif);
        font-size: 1.25rem;
      }

      a {
        text-decoration: underline;
        text-underline-offset: 2px;
        transition: text-underline-offset 200ms;

        &:hover {
          text-underline-offset: 7px;
        }
      }
    }
  }
}

@media (width >= 750px) {
  .deal-grid-container {
    grid-template-columns: 1fr 1fr 1fr;

    > .image-container {
      grid-column: span 2;
    }

    > .image-container > div {
      span {
        font-size: 40px;
      }

      a {
        font-size: 28px;

        &:hover {
          text-underline-offset: 8px;
        }
      }
    }
  }
}

@media (pointer: fine) {
  .deal-grid-container .image-container:hover > div {
    background-color: hsl(0, 0%, 0%, 0.5);
  }
  .deal-grid-container .image-container:hover > img {
    scale: 1.2;
  }
}

/* ! News letter styling */
.email-section {
  position: relative;
  background-color: red;
  max-width: 1930px;
  margin-inline: auto;
  margin-block-start: 5rem;

  > div:first-of-type {
    max-height: clamp(16.25rem, 11.6827rem + 18.2692vw, 28.125rem);
    overflow: hidden;
    display: flex;
  }

  img {
    width: 100%;
    object-fit: cover;
    object-position: center;
  }
}

.news-letter-container {
  position: absolute;
  inset: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1rem;

  h3 {
    color: #fff;
    font-size: clamp(1.325rem, 0.825rem + 2vw, 2.625rem);
  }

  > form {
    display: flex;
    height: 35px;
    width: calc(100% - 6rem);
    max-width: 830px;
    transition: box-shadow 200ms;

    @media (width >= 750px) {
      height: 40px;
    }
  }

  > form:focus-within {
    box-shadow: 0 0 0 3px hsl(from var(--accent-clr) h s calc(l + 20) / 0.6);
  }

  input {
    flex: 1;
    padding-inline: 1rem;
    min-width: 0;
    outline: none;
  }

  button {
    padding-inline: clamp(1.5rem, 0.9231rem + 2.3077vw, 3rem);
    font-size: 0.925rem;
    background-color: var(--accent-clr);
    color: #fff;
    font-weight: 500;
    letter-spacing: 0.3px;
    position: relative;

    .overlay {
      position: absolute;
      inset: 0;
      background-color: hsl(0, 0%, 100%, 0.1);
      z-index: 2;
      opacity: 0;
      transition: opacity 150ms;
    }

    &:hover .overlay {
      opacity: 1;
    }
    &:active .overlay {
      background-color: hsl(0, 0%, 100%, 0.2);
    }
  }
}

/* ! Footer styling */
footer {
  max-width: 1140px;
  margin-inline: auto;
  box-sizing: content-box;
  padding-inline: 1rem;
  padding-block: 3rem;
  margin-block-start: 2rem;
}

.logo-text-container {
  display: grid;
  gap: 1rem;

  .paragraph {
    font-size: clamp(1rem, 0.8558rem + 0.5769vw, 1.375rem);
  }
}

.links-container > div {
  display: grid;
  gap: 1.225rem;

  a {
    color: var(--pale-purple);
    max-width: fit-content;
    transition: color 150ms, -webkit-text-stroke 150ms;

    &:hover {
      color: var(--text-clr);
      -webkit-text-stroke: 0.3px var(--text-clr);
    }
  }
}

.social-media-links {
  display: flex;
  align-items: center;
  gap: 1rem;

  > div {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    overflow: hidden;
    background-color: #fff;
    position: relative;
    box-shadow: 0 3px 5px 0 hsl(0, 0%, 0%, 0.2);

    a {
      position: absolute;
      inset: 0;
    }
  }
}

@media (width < 870px) {
  .links-container {
    display: grid;
    gap: 1.225rem;
    margin-block-start: 2rem;
  }

  .social-media-links {
    margin-block-start: 2rem;
  }
  .logo-text-container {
    .paragraph {
      max-width: 45ch;
    }
  }
}

@media (width >= 870px) {
  footer {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: flex-start;
    gap: clamp(1rem, -2.0526rem + 5.614vw, 3rem);
  }

  .links-container {
    display: flex;
    justify-content: space-between;
  }

  .social-media-links {
    justify-self: flex-end;
  }
}

.smooth-color {
  transition: color 200ms, background-color 200ms, border-color 200ms;
}
