@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Rubik+Bubbles&display=swap");

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-color: #2d71a6;
  --secondary-color: #fff;
  --dim-color: #aaa;
  --yellow-color: #ffd700;
  --light-blue-bg: #a9e6f4;
  --error-color: #fa8072;
}

html,
body {
  font-family: "Monserrat", sans-serif;
  font-size: 16px;
  font-style: normal;
  line-height: 1.6;
  overflow-x: hidden;
  scroll-behavior: smooth;
  height: 100%;
  display: flex;
  flex-direction: column;
}

main {
  height: 100%;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: var(--primary-color);
}

ul {
  list-style: none;
}

img {
  width: 100%;
}

/* Navbar */

.navbar {
  padding: 0.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar .logo {
  max-width: 300px;
}

.navbar.logout-form {
  display: none;
}

.navbar .main-menu ul {
  display: flex;
  gap: 1rem;
}

.navbar .main-menu ul li a,
.navbar .main-menu ul li button {
  padding: 2rem 2rem 2rem 2.5rem;
  display: block;
  font-size: 1.3rem;
  font-family: "Rubik Bubbles", system-ui;
  font-weight: 400;
  font-style: normal;
  transition: 0.5s;
  background: url("../img/cloud-menu.png") no-repeat;
  background-size: 15rem;
  background-position: 50% 60%;
  color: var(--secondary-color);
  text-shadow:
    0 0 2px black,
    0 0 6px var(--primary-color);
  border: none;
  cursor: pointer;
}

.navbar .main-menu ul li a:hover,
.navbar .main-menu ul li button:hover {
  transform: scale(1.3);
}

.navbar .main-menu ul li a.active {
  color: var(--yellow-color);
}

.navbar a#new-post-btn {
  color: var(--yellow-color);
}

.navbar .main-menu ul li:last-child a {
  margin-left: 2rem;
}

.navbar .hamburger-button {
  display: none;
  background: none;
  color: var(--primary-color);
  border: none;
  z-index: 1000;
  cursor: pointer;
}

/* Mobile Menu */

.mobile-menu {
  position: fixed;
  top: 0;
  right: -20rem;
  width: 20rem;
  height: 100%;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
  transition: right 0.3s ease-in-out;
}

.mobile-menu.active {
  right: 0;
}

.mobile-menu ul {
  margin-top: 6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
}

.mobile-menu ul li {
  transition: transform 0.5s ease-in-out;

  &:hover {
    transform: scale(1.2);
  }
}

.mobile-menu ul li a {
  font-size: 1.2rem;
}

.mobile-menu ul li a.active {
  border-bottom: solid 2px var(--primary-color);
}

.mobile-menu ul li button {
  font-size: 1.2rem;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--primary-color);
}

/* Login form */

.login-form .container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-form form {
  margin-top: 4rem;
  display: flex;
  flex-direction: column;
}

.login-form form input[type="submit"] {
  margin-top: 2rem;
}

/* Hero */

.hero {
  position: relative;
}

.hero .background {
  position: absolute;
  width: 100vw;
  height: 100%;
  z-index: -1;
}

.hero .background .layer {
  position: absolute;
  left: 0;
  min-width: 100vw;
  height: 100%;
  /* min-height: 100%; */
  overflow: hidden;
}

.hero .background .layer-0 {
  background: url("../img/cloud-bg-0.png") no-repeat center top / cover;
  z-index: -100;
  animation: bg-layer0;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

@keyframes bg-layer0 {
  from {
    top: 20rem;
  }
  to {
    top: 0;
  }
}

.hero .background .layer-1 {
  background: url("../img/cloud-bg-1.png") no-repeat center top / cover;
  z-index: -90;
  animation: bg-layer1;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

@keyframes bg-layer1 {
  from {
    top: 30rem;
  }
  to {
    top: 0;
  }
}

.hero .background .layer-2 {
  background: url("../img/cloud-bg-2.png") no-repeat center top / cover;
  z-index: -80;
  animation: bg-layer2;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

@keyframes bg-layer2 {
  from {
    top: 40rem;
  }
  to {
    top: 0;
  }
}

.hero .background .layer-3 {
  background: url("../img/cloud-bg-3.png") no-repeat center bottom / cover;
  z-index: -70;
  animation: bg-layer3;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

@keyframes bg-layer3 {
  from {
    top: 50rem;
  }
  to {
    top: 0;
  }
}

.hero .container-lg {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.hero .description {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  flex-basis: 60%;
}

.hero .text {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: bold;
  background: rgba(255, 255, 255, 0.9);
  padding: 1rem;
  border-radius: 5rem;
  color: var(--primary-color);
  text-align: center;
  box-shadow: 0 0 4rem 4rem rgba(255, 255, 255, 0.9);
}

.hero .hero-img {
  flex-basis: 30%;
  animation-name: home-bear-animation;
  animation-duration: 1s;
  animation-fill-mode: forwards;
  animation-timing-function: ease-in-out;
  animation-delay: 2s;
  opacity: 0;
}

@keyframes home-bear-animation {
  to {
    opacity: 1;
    transform: rotateY(360deg);
  }
}

/* About */

.about {
  background: var(--light-blue-bg);
  animation: about-animation;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

@keyframes about-animation {
  from {
    margin-top: 50rem;
  }
  to {
    margin-top: 0;
  }
}

.about .flex-items {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.about .item {
  flex-basis: 50%;
}

.about .text {
  text-align: center;
  font-weight: 600;
}

.about .picture {
  display: flex;
  flex-direction: column;
  /* TODO: This doesn't work */
  justify-content: space-evenly;
  align-items: center;
}

/* Content overview */

.overview {
  position: relative;
}

.overview .background {
  background: var(--light-blue-bg);
  position: absolute;
  width: 100vw;
  height: 100%;
  z-index: -1;
}

.overview .background .layer {
  position: absolute;
  left: 0;
  min-width: 100vw;
  height: 100%;
  overflow: hidden;
}

.overview .background .layer-0 {
  background: url("../img/cloud-bg-0.png") no-repeat center top / cover;
  z-index: -100;
  animation: bg-layer0;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

.overview .background .layer-1 {
  background: url("../img/cloud-bg-1.png") no-repeat center top / cover;
  z-index: -90;
  animation: bg-layer1;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

.overview .background .layer-2 {
  background: url("../img/cloud-bg-2.png") no-repeat center top / cover;
  z-index: -80;
  animation: bg-layer2;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

.overview .background .layer-3 {
  background: url("../img/cloud-bg-3.png") no-repeat center bottom / cover;
  z-index: -70;
  animation: bg-layer3;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}

.overview .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3rem;
}

.overview .card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3rem;
}

/* Testimonials */

.testimonials {
  background: var(--light-blue-bg);
}

.testimonials .outer-grid {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 3rem;
}

.testimonials .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3rem;
}

.testimonials .card {
  text-align: center;
  font-weight: 700;
}

.testimonials .rating {
  margin-top: 1rem;
  color: var(--yellow-color);
}

/* Footer */

.footer {
  margin-top: auto;
  background: var(--light-blue-bg);
}

.footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.footer .logo img {
  width: 14rem;
}

.footer .socials {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  margin: 2rem 0;
}

/* For teachers */

.teachers h1 {
  text-align: center;
  color: var(--primary-color);
}

.teachers ul li a {
  font-size: 2rem;

  &:hover {
    text-decoration: underline;
  }
}

/* Posts list */

.posts .empty-list {
  display: flex;
  align-items: center;
  justify-content: center;
}

.posts .empty-list p {
  color: var(--dim-color);
}

.posts h1 {
  text-align: center;
  color: var(--primary-color);
}

.posts .grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
}

.posts .post-preview {
  transition: transform 0.5s ease-in-out;

  &:hover {
    transform: scale(1.05);
  }
}

.posts .post-preview.card.draft {
  border: dotted 0.4rem var(--secondary-color);
}

.posts .post-preview.card {
  padding: 1rem;
}

.posts .post-preview .title {
  text-align: center;
  height: 5rem;
}

.posts .post-preview img {
  aspect-ratio: 1/1;
  border-radius: 2rem;
}

/* Full post */

.full-post h1 {
  font-size: 2rem;
  color: var(--primary-color);
}

.full-post h1 span {
  color: var(--dim-color);
  margin-left: 1rem;
}

.full-post .timestamp {
  color: var(--dim-color);
}

.full-post .description {
  margin: 2rem 0;
}

/* Admin controls */

.post-admin-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin: 1rem 0;
  padding: 1rem 0;
  border-top: solid 1px var(--dim-color);
  border-bottom: solid 1px var(--dim-color);
}

.post-admin-controls .preview {
  width: 15rem;
}

.post-admin-controls .btn-ctrl i {
  margin-right: 0.6rem;
}

/* Embeddables */

.full-post .embeddable {
  margin: 2rem 0;
}

.full-post .embeddable h2 {
  color: var(--primary-color);
}

.full-post .embeddable .iframe-wrapper {
  margin-top: 1rem;
  position: relative;
  padding-bottom: 58.8%;
}

.full-post .embeddable iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: none;
  width: 100%;
  height: 100%;
  border-radius: 1rem;
}

/* Attachments */

.full-post .attachments {
  margin: 2rem 0;
}

.full-post .attachments h2 {
  color: var(--primary-color);
}

.full-post .attachments li {
  margin: 1rem 0;
}

.full-post .attachments ul li i {
  margin-right: 0.5rem;
}

.full-post .attachments a:hover {
  border-bottom: solid 2px var(--primary-color);
}

.full-post .attachments ul li form {
  margin-top: 0.5rem;
}

/* Draft form */

.draft h1 {
  color: var(--primary-color);
  text-align: center;
}

.draft form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2rem;
}

.draft form .btn {
  margin-top: 2rem;
}

/* Error */

.error {
  height: 100%;
}

.error .container {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  align-items: center;
}

.error h1 {
  color: var(--primary-color);
  font-size: 3rem;
  font-weight: 600;
  margin-bottom: 2rem;
}

/* Utilities */

/* Upload file button */

.form-group input[type="file"]::file-selector-button {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  background: rgb(44, 114, 166);
  background: linear-gradient(
    90deg,
    rgba(44, 114, 166, 1) 0%,
    rgba(103, 190, 227, 1) 100%
  );
  color: var(--secondary-color);
  font-family: "Montserrat", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--dim-color);
  cursor: pointer;
  border-radius: 2rem;
  text-align: center;
  line-height: inherit;
  transition: 0.5s;
}

.form-group input[type="file"]::file-selector-button:hover {
  opacity: 0.6;
}

/* Buttons */

.btn-ctrl {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  background: rgb(44, 114, 166);
  background: linear-gradient(
    90deg,
    rgba(44, 114, 166, 1) 0%,
    rgba(103, 190, 227, 1) 100%
  );
  color: var(--secondary-color);
  font-family: "Montserrat", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  border-radius: 2rem;
  text-align: center;
  line-height: inherit;
  transition: 0.5s;
}

.btn-ctrl:hover {
  opacity: 0.6;
}

.btn {
  display: inline-block;
  padding: 0.8rem 1.4rem;
  background: rgb(44, 114, 166);
  background: linear-gradient(
    90deg,
    rgba(44, 114, 166, 1) 0%,
    rgba(103, 190, 227, 1) 100%
  );
  color: var(--secondary-color);
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  font-size: 1.4rem;
  font-weight: 600;
  text-decoration: none;
  line-height: inherit;
  border: none;
  border-radius: 3rem;
  cursor: pointer;
  text-align: center;
  transition: 0.5s;
}

.btn:hover {
  opacity: 0.8;
  transform: scale(1.01);
}

.btn-secondary {
  background: var(--secondary-color);
  color: rgb(44, 114, 166);
  border: solid 1px rgb(44, 114, 166);
}

.btn-secondary:hover {
  background: rgba(44, 114, 166, 0.1);
}

.btn i {
  margin-right: 1rem;
}

/* Inputs */

.form-group {
  margin-top: 0.6rem;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
  display: block;
  padding: 0.6rem 1.4rem;
  width: 100%;
  font-size: 1.4rem;
  font-family: "Monserrat", sans-serif;
  border-radius: 2rem;
  border: solid 1px var(--dim-color);

  &:focus {
    outline: solid 1px rgba(103, 190, 227, 1);
  }

  &:invalid,
  &.input-error {
    border: solid 2px var(--error-color);
  }
}

.form-group textarea {
  resize: vertical;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--primary-color);
  margin-left: 1.4rem;
}

/* Form errors */

.form-errors ul {
  list-style: disc;
  color: var(--error-color);
  margin: 0.6rem 0 0 1.4rem;
}

.validation-error {
  color: var(--error-color);
  margin-left: 1.4rem;
  font-weight: 600;
}

/* Section */

.section-title {
  font-size: 2.5rem;
  color: var(--secondary-color);
  text-align: center;
  text-shadow: 0 0 2px rgba(0, 0, 0, 1);
  margin-bottom: 2rem;
  text-transform: uppercase;
}

.card {
  background: #fee6d3;
  border: 0.4rem solid var(--secondary-color);
  border-radius: 3rem;
  padding: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.card-secondary {
  background: #87ceff;
  color: var(--secondary-color);
  font-weight: 700;
  text-align: center;
  padding: 2rem;
  border-radius: 2rem;
}

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 4rem;
}

.container-lg {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 4rem;
}

/* Media Queries */

@media (max-width: 1200px) {
  .text-xxl {
    font-size: 2.5rem;
  }

  .navbar .main-menu {
    display: none;
  }

  .navbar .hamburger-button {
    display: block;
  }

  .navbar .main-menu ul li:last-child a {
    margin: 2rem 0 0 1rem;
  }

  /* Posts list */

  .posts .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Testimonials */

  .testimonials .outer-grid {
    grid-template-columns: 1fr;
  }

  .testimonials .outer-grid .image {
    display: none;
  }

  .testimonials .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 768px) {
  /* Posts list */

  .posts .grid {
    grid-template-columns: 1fr;
  }

  /* Hero */
  .hero .container-lg {
    flex-direction: column;
    justify-content: start;
    padding: 2rem 2rem;
  }

  .hero .description {
    width: 100%;
  }

  .hero .text {
    width: 100%;
  }

  .hero .hero-img {
    width: 80%;
    height: auto;
    margin: 0 auto;
  }

  /* About */

  .about .flex-items {
    flex-direction: column;
  }

  .about .container {
    padding: 2rem 1rem;
  }

  /* Overview */

  .overview .container {
    padding: 2rem 1rem;
  }

  .overview .grid {
    grid-template-columns: 1fr;
  }

  /* Testimonials */

  .testimonials .container-lg {
    padding: 2rem 1rem;
  }

  .testimonials .outer-grid {
    grid-template-columns: 1fr;
  }

  .testimonials .outer-grid .image {
    display: none;
  }

  .testimonials .grid {
    grid-template-columns: 1fr;
  }

  /* Single post */

  .full-post .container {
    padding: 2rem 1rem;
  }

  /* Utilities */

  .container {
    padding: 2rem 1rem;
  }
}
