@import url("https://fonts.cdnfonts.com/css/franklin-gothic");

/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
  font-family: "Franklin Gothic Book", "Arial", "Helvetica", sans-serif;
}

/* Remove default margin */
body,
h2,
p {
  margin-left: auto;
  margin-right: auto;
}

/* GLOBAL STYLES */
body {
  height: 100vh;
}

h2 {
  font-size: 1.75rem;
  font-family: var(--font-title);
  color: #ffffff;
  line-height: 1.1;
  text-align: center;
  margin: 0 auto; /* Ensures proper margin reset */
  display: flex;
  justify-content: center;
  align-items: center; /* Vertically centers the text */
}

p {
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.5;
  color: #ffffff;
}

.flow > * + * {
  margin-top: var(--flow-space, 1em);
}

/* WORKSHOP-CARD COMPONENT */

.workshop-card {
  margin: 1rem; /* Optional, adds spacing between cards */
  display: grid;
  align-items: center;
  width: 100%;
  margin-right: auto;
  max-width: 26.875rem;
  height: 22.125rem;
  overflow: hidden;
  border-radius: 0.625rem;
  box-shadow: 0.25rem 0.25rem 0.5rem #003e58;
  text-align: center;
}

.workshop-cards-container {
  flex-grow: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem; /* Optional, adds spacing between the cards */
  margin-top: 50px;
  margin-bottom: 50px;
  margin-right: 10px;
}

.workshop-card > * {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
}

.card__background {
  filter: brightness(55%);
  object-fit: cover;
  max-width: 100%;
  height: 100%;
}

.card__content {
  --flow-space: 0.9375rem;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 100%; /* Ensure full height usage */
  padding: 1.25rem;
  text-align: center;
  background: linear-gradient(
    180deg,
    hsla(0, 0%, 0%, 0) 0%,
    hsla(0, 0%, 0%, 0.3) 10%,
    hsl(0, 0%, 0%) 100%
  );
}

.card__content--container {
  --flow-space: -5.25rem;
  height: 150px;
}

.card__title {
  padding: 0.8rem 0;
  font-size: 1.75rem;
  color: #fff;
  position: relative;
  text-align: center;
  display: flex;
  line-height: 1.2;
  justify-content: center;
  align-items: center;
}

.card__title::after {
  content: "";
  position: absolute;
  height: 0.3125rem;
  width: 100%;
  bottom: -0.75rem;
  background-color: #ffc400;
  padding-top: 0.5rem;
}

.card__description {
  flex-grow: 1;
  align-self: flex-start;
  max-height: 4rem;
  margin-top: 1rem;
  color: #fff;
  min-height: 3rem;
  font-size: 1rem;
  line-height: 1.4;
  text-align: center;
}

.card__button {
  margin-top: 75px; /* Ensures button stays at the bottom */
  align-self: center;
  padding: 0.75rem 1.5rem;
  background-color: #ffc400;
  color: #000;
  border-radius: 0.5rem;
  font-size: 1.15rem;
  font-weight: bold;
  animation: strobe 1.25s infinite;
}

.card__content,
.card__description {
  overflow: visible; /* Ensure content can grow */
}

@keyframes strobe {
  0%,
  100% {
    border-color: transparent; /* Start and end with no border */
  }
  50% {
    border-radius: 5px solid black;
    border-color: black; /* Change to desired color at mid-point */
  }
}

.card__button:focus {
  outline: 5px solid #ba8f01;
  outline-offset: -5px;
}

@media (any-hover: hover) and (any-pointer: fine) {
  .card__title {
    transform: translateY(-20%);
  }

  .card__content {
    transform: translateY(60%);
    transition: transform 500ms ease-out;
    transition-delay: 500ms;
  }

  .card__title::after {
    opacity: 0;
    transform: scaleX(0);
    transition: opacity 1000ms ease-in, transform 500ms ease-out;
    transition-delay: 500ms;
    transform-origin: right;
  }

  .card__background {
    transition: transform 500ms ease-in;
  }

  .card__content--container > :not(.card__title),
  .card__button {
    opacity: 0;
    transition: transform 500ms ease-out, opacity 500ms ease-out;
  }

  .workshop-card:hover,
  .workshop-card:focus-within {
    transform: scale(1.05);
    transition: transform 500ms ease-in;
  }

  .workshop-card:hover .card__content,
  .workshop-card:focus-within .card__content {
    transform: translateY(0);
    transition: transform 500ms ease-in;
  }

  .workshop-card:focus-within .card__content {
    transition-duration: 0ms;
  }

  .workshop-card:hover .card__background,
  .workshop-card:focus-within .card__background {
    transform: scale(1.3);
  }

  .workshop-card:hover .card__content--container > :not(.card__title),
  .workshop-card:hover .card__button,
  .workshop-card:focus-within .card__content--container > :not(.card__title),
  .workshop-card:focus-within .card__button {
    opacity: 1;
    transition: opacity 500ms ease-in;
    transition-delay: 750ms;
  }

  .workshop-card:hover .card__title::after,
  .workshop-card:focus-within .card__title::after {
    opacity: 1;
    transform: scaleX(1);
    transform-origin: left;
    transition: opacity 500ms ease-in, transform 500ms ease-in;
    transition-delay: 250ms;
  }
}

/* Media Queries for Responsive Layout */

/* Styles for Medium Screens (Tablets) */
@media (max-width: 1024px) {
  .workshop-cards-container {
    grid-template-columns: repeat(3, 1fr); /* 3 cards in a row */
    margin-right: 30px;
  }
}

/* Styles for Small Screens (Mobile Landscape) */

@media (max-width: 768px) {
  /* Ensure the card description and button are visible without hover */
  .card__title {
    transform: translateY(0);
  }

  .card__content {
    transform: translateY(20px);

    justify-content: flex-start;
    transition: none;
  }

  .card__content--container > :not(.card__title) {
    opacity: 1;
    transform: translateY(0);
    transition: none;
  }

  .card__button {
    opacity: 1;

    transition: none;
    margin-top: 20px; /* Keeps button at the bottom */
  }

  .card__description {
    order: -1; /* Moves description to appear before the button */
  }

  /* Remove hover effects on mobile */
  .workshop-card:hover,
  .workshop-card:focus-within {
    transform: none;
  }
}

/* Styles for Extra Small Screens (Mobile Portrait) */
@media (max-width: 480px) {
  .workshop-cards-container {
    grid-template-columns: 1fr; /* 1 card in a row */
  }
}
