:root {
  /* Colors */
  --main-color: #2196f3;
  --main-color-alt: #1787e0;
  --main-box-shadow: 0 0 0.625rem #ddd;
  --light-font-color: #666;
  --border-color: #e9e6e6;
  --section-background: #ececec;
  /* Dimensions */
  --section-padding: 6.25rem;
  --link-size: 1.125rem;
  --box-gap: 2.5rem;
  --z-index: 999;
  /* Transitions */
  --main-transition: 0.3s;
}

/** ==================== GLOBAL RULES ==================== */
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}
*::before {
  box-sizing: border-box;
}
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: "Cairo", sans-serif;
}
ul {
  list-style: none;
}
a {
  text-decoration: none;
}
svg {
  width: 24px;
}
.container {
  margin-left: auto;
  margin-right: auto;
  padding-left: 0.9375rem;
  padding-right: 0.9375rem;
}
@media (min-width: 768px) {
  .container {
    width: 750px;
  }
}
@media (min-width: 992px) {
  .container {
    width: 970px;
  }
}
@media (min-width: 1200px) {
  .container {
    width: 1170px;
  }
}

/** ==================== COMPONENTS ==================== */
.section {
  padding-top: var(--section-padding);
  padding-bottom: var(--section-padding);
}
h2.main-title {
  text-transform: uppercase;
  font-size: 1.875rem;
  padding: 0.625rem 1.25rem;
  position: relative;
  width: fit-content;
  margin: 0 auto 5rem;
  border: 2px solid black;
  transition: var(--main-transition);
}
h2.main-title:hover {
  color: white;
  border: 2px solid white;
  transition-delay: 0.5s;
}
h2.main-title::before,
h2.main-title::after {
  z-index: -1;
  content: "";
  position: absolute;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background-color: var(--main-color);
  top: 50%;
  transform: translateY(-50%);
}
h2.main-title::before {
  left: -1.875rem;
}
h2.main-title:hover::before {
  animation: header-fill-left 0.5s linear forwards;
}
h2.main-title::after {
  right: -1.875rem;
}
h2.main-title:hover:after {
  animation: header-fill-right 0.5s linear forwards;
}

/** ==================== ANIMATION ==================== */
@keyframes up-and-down {
  100% {
    transform: translateY(-3.125rem);
  }
}
@keyframes bouncing {
  0%,
  10%,
  20%,
  50%,
  80%,
  100% {
    transform: translate(-50%, 0);
  }
  40%,
  60% {
    transform: translate(-50%, -0.9375rem);
  }
}
@keyframes header-fill-left {
  50% {
    left: 0;
    width: 0.75rem;
    height: 0.75rem;
  }
  100% {
    width: 50%;
    height: 100%;
    border-radius: 0;
    left: 0;
  }
}
@keyframes header-fill-right {
  50% {
    right: 0;
    width: 0.75rem;
    height: 0.75rem;
  }
  100% {
    width: 50%;
    height: 100%;
    border-radius: 0;
    right: 0;
  }
}
@keyframes flashing {
  0%, 40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    width: 200%;
    height: 200%;
  }
}

/** ==================== HEADER ==================== */
header {
  box-shadow: var(--main-box-shadow);
  background-color: white;
}
header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
}
@media (max-width: 767px) {
  header .container {
    justify-content: center;
  }
}
header .logo,
header .main-nav > li > a {
  height: 4.5rem;
}
header .logo {
  font-size: 1.625rem;
  text-decoration: none;
  font-weight: bold;
  color: var(--main-color);
  /* Maintains consistent header height regardless of content */
  display: flex;
  justify-content: center;
  align-items: center;
}
@media (max-width: 767px) {
  header .logo {
    width: 100%;
  }
}
header .main-nav {
  display: flex;
}
header .main-nav > li:hover .mega-menu {
  opacity: 1;
  z-index: var(--z-index);
  /* Didn't add 1px for the box shadow because the hover will disappear when hover over the box-shadow */
  top: 100%;
}
header .main-nav > li > a {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 1.875rem;
  font-size: var(--link-size);
  transition: var(--main-transition);
  color: black;
  position: relative;
  overflow: hidden;
}
@media (max-width: 767px) {
  header .main-nav > li > a {
    font-size: 1rem;
    padding: 1.25rem 0.625rem;
    height: 2.5rem;
  }
}
header .main-nav > li > a::before {
  content: "";
  position: absolute;
  height: 5px;
  width: 100%;
  left: -100%;
  top: 0;
  background-color: var(--main-color);
  transition: var(--main-transition);
}
header .main-nav > li > a:hover {
  background-color: #fafafa;
  color: var(--main-color);
}
header .main-nav > li > a:hover::before {
  left: 0;
}
header .mega-menu {
  position: absolute;
  width: 100%;
  left: 0;
  padding: 1.875rem;
  background-color: white;
  border-bottom: 3px solid var(--main-color);
  z-index: -1;
  display: flex;
  gap: 2.5rem;
  top: calc(100% + 3.125rem);
  opacity: 0;
  transition:
    top var(--main-transition),
    opacity var(--main-transition);
}
@media (max-width: 767px) {
  header .mega-menu {
    flex-direction: column;
    gap: 0;
    padding: 8px;
  }
}
header .mega-menu .image {
  flex: 1;
}
@media (max-width: 991px) {
  header .mega-menu .image {
    display: none;
  }
}
header .mega-menu .image img {
  max-width: 100%;
}
@media (max-width: 991px) {
  header .mega-menu ul {
    flex: 1;
  }
}
header .mega-menu ul li {
  position: relative;
}
@media (max-width: 767px) {
  header .mega-menu ul:first-of-type li:last-of-type {
    border-bottom: 1px solid var(--border-color);
  }
}
header .mega-menu ul li:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}
header .mega-menu ul li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background-color: #fafafa;
  z-index: -1;
  transition: var(--main-transition);
}
header .mega-menu ul li:hover::before {
  width: 100%;
}
header .mega-menu ul a,
header .mega-menu ul a svg {
  color: var(--main-color);
}
header .mega-menu ul a {
  font-size: var(--link-size);
  display: block;
  padding: 0.9375rem;
  font-weight: bold;
}
@media (max-width: 767px) {
  header .mega-menu ul a {
    font-size: 1rem;
  }
}
header .mega-menu ul a svg {
  margin-right: 0.625rem;
}

/** ==================== LANDING ==================== */
.landing {
  position: relative;
}
.landing::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: var(--section-background);
  left: 0;
  top: -2.5rem;
  z-index: -1;
  transform: skewY(-6deg);
  transform-origin: top left;
}
.landing .container {
  height: calc(100vh - 4.5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 7.5rem;
}
.landing .text {
  flex: 1;
}
@media (max-width: 991px) {
  .landing .text {
    text-align: center;
  }
}
.landing .text h1 {
  font-size: 2.5rem;
  margin: 0;
  letter-spacing: -2px;
}
@media (max-width: 991px) {
  .landing .text h1 {
    font-size: 2.1875rem;
    padding-bottom: 1.25rem;
  }
}
.landing .text p {
  font-size: 1.4375rem;
  line-height: 1.7;
  margin: 0.3125rem 0 0;
  color: var(--light-font-color);
  max-width: 31.25rem;
}
.landing .image img {
  width: 37.5rem;
  max-width: 100%;
  animation: up-and-down 2.2s linear infinite alternate;
}
@media (max-width: 991px) {
  .landing .image img {
    display: none;
  }
}
.landing > .go-down {
  position: absolute;
  bottom: 1.875rem;
  left: 50%;
  transform: translateX(-50%);
  transition: var(--main-transition);
  animation: bouncing 1.5s infinite;
}
@media (max-width: 767px) {
  .landing > .go-down {
    bottom: 6.25rem;
  }
}
.landing > .go-down:hover svg {
  color: var(--main-color-alt);
}
.landing > .go-down svg {
  width: 2.3125rem;
  color: var(--main-color);
}

/** ==================== ARTICLES ==================== */
.articles .container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.625rem, 1fr));
  gap: var(--box-gap);
}
.articles .container article {
  box-shadow: var(--main-box-shadow);
  border-radius: 10px;
  background-color: white;
  /* To make the border-radius visible */
  overflow: hidden;
  transition: var(--main-transition);
}
.articles .container article:hover {
  transform: translateY(-0.9375rem);
  box-shadow: 0.3125rem 0.3125rem 0.9375rem #ddd;
}
.articles .container article:hover .info svg {
  transform: translateX(0.625rem);
}
.articles .container article img {
  max-width: 100%;
}
.articles article .text {
  padding: 1.25rem;
}
.articles article .text p {
  margin: 0.625rem 0 0;
  line-height: 1.5;
  color: var(--light-font-color);
}
.articles article .info {
  padding: 1.25rem;
  border-top: 1px solid #e6e6e7;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.articles article .info a {
  color: var(--main-color);
  font-weight: bold;
}
.articles article .info svg {
  width: 1.125rem;
  color: var(--main-color);
  transition: var(--main-transition);
}

/** ==================== GALLERY ==================== */
.gallery {
  background-color: var(--section-background);
}
.gallery .container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--box-gap);
}
.gallery .box {
  padding: 15px;
  background-color: white;
  box-shadow:
    0rem 0.75rem 1.25rem 0rem rgb(0 0 0 / 13%),
    0rem 0.125rem 0.25rem 0rem rgb(0 0 0 / 12%);
}
.gallery .box .image {
  position: relative;
  overflow: hidden;
}
.gallery .box .image:hover img {
  transform: rotate(5deg) scale(1.1);
}
.gallery .box .image:hover:before {
  animation: flashing 0.7s;
}
.gallery .box .image::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background-color: rgb(255 255 255 / 20%);
  opacity: 0;
  z-index: var(--z-index);
}
.gallery .box img {
  max-width: 100%;
  transition: var(--main-transition);
}
