/* ------------------- */
/* Custom properties   */
/* ------------------- */
:root {
  --clr-green-400: hsl(157, 36%, 37%);
  --clr-green-800: hsl(157, 43%, 18%);
  --clr-cream-400: hsl(30, 38%, 92%);

  --clr-neutral-100: hsl(0, 0%, 100%);
  --clr-neutral-400: hsl(228, 12%, 48%);
  --clr-neutral-800: hsl(212, 21%, 14%);

  --ff-serif: "Fraunces", serif;
  --ff-sans: "Montserrat", sans-serif;

  --fs-200: 0.75rem;
  --fs-300: 0.8125rem;
  --fs-400: 0.875rem;
  --fs-900: 2rem;

  --lh-200: 1.219;
  --lh-300: 1.769;
  --lh-400: 1.643;
  --lh-900: 1;

  --fw-500: 500;
  --fw-700: 700;
}
/* ------------------- */
/* Reset               */
/* ------------------- */

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

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Set core root defaults */
html:focus-within {
  scroll-behavior: smooth;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  line-height: var(--lh-400);
  font-family: var(--ff-sans);
  font-size: var(--fs-400);
  font-weight: var(--fw-500);
  background-color: var(--clr-cream-400);
  color: var(--clr-neutral-400);
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

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

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

/* 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;
  }
}

/* ------------------- */
/* Composition         */
/* ------------------- */
.flex {
  display: flex;
  gap: var(--flex-gap, 1rem);
}

.grid {
  display: grid;
  gap: var(--grid-gap, 1rem);
}

/* ------------------- */
/* Utility             */
/* ------------------- */
.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;
}

.bg-neutral-100 {
  background-color: var(--clr-neutral-100);
}

.text-green-400 {
  color: var(--clr-green-400);
}
.text-neutral-800 {
  color: var(--clr-neutral-800);
}

.ff-serif {
  font-family: var(--ff-serif);
}

/* use font optical size if browser supports variable fonts */
@supports (font-variation-settings: "opsz" 72) {
  .ff-serif {
    font-family: var(--ff-serif);
    font-variation-settings: "opsz" 72;
  }
}

.fs-200 {
  font-size: var(--fs-200);
  line-height: var(--lh-200);
}
.fs-300 {
  font-size: var(--fs-300);
  line-height: var(--lh-300);
}
.fs-400 {
  font-size: var(--fs-400);
  line-height: var(--lh-400);
}
.fs-900 {
  font-size: var(--fs-900);
  line-height: var(--lh-900);
}

.fw-500 {
  font-weight: var(--fw-500);
}
.fw-700 {
  font-weight: var(--fw-700);
}

.text-center {
  text-align: center;
}

/* ------------------- */
/* Block               */
/* ------------------- */
.layout {
  grid-template-rows: 1fr auto 1fr;
  grid-template-areas:
    "header"
    "main"
    "footer";
  min-height: 100vh;
  padding: 1.75rem 1rem;
}

.layout > main {
  grid-area: main;
}

.layout > footer {
  grid-area: footer;
  align-self: end;
}

.card {
  --grid-gap: 0;
  border-radius: 10px;
  overflow: hidden;
  max-width: 21.4375rem;
  margin: 0 auto;
}

.card > picture {
  /* ensure image still fits when font size increases */
  display: flex;
}

.card > picture img {
  /* ensure image still fits when font size increases */
  object-fit: cover;
}

.card > .card-content {
  padding: 1.5rem;
}

.card > .card-content .type {
  text-transform: uppercase;
  letter-spacing: 0.417em;
}

.card > .card-content h2 {
  margin-top: 0.75rem;
}

.card > .card-content .description {
  margin-top: 1rem;
}

.card > .card-content .price {
  --flex-gap: 1.5rem;
  align-items: center;
  margin: 1.5rem 0 1.25rem;
}

@media (min-width: 40em) {
  .card {
    grid-template-columns: 1fr 1fr;
    max-width: 37.5rem;
  }

  .card > .card-content {
    padding: 2rem;
  }

  .card > .card-content h2 {
    margin-top: 1.25rem;
  }

  .card > .card-content .description {
    margin-top: 1.5rem;
  }

  .card > .card-content .price {
    --flex-gap: 1.5rem;
    margin: 1.875rem 0;
  }
}

/* ------------------- */
/* Exception           */
/* ------------------- */
.button {
  cursor: pointer;
  background-color: transparent;
  border: 0;
  padding: 0;
  font-size: var(--fs-400);
  font-weight: var(--fw-700);
  line-height: 1.22;
}

.button[data-type="primary"] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  color: var(--clr-neutral-100);
  background-color: var(--clr-green-400);
  border-radius: 0.571em;
  padding: 1em 2em;
  transition: background-color 200ms ease-in-out;
}

.button[data-type="primary"]:hover,
.button[data-type="primary"]:focus {
  background-color: var(--clr-green-800);
}
