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

:root {
  --text-primary: #2E2E2E;
  --text-secondary: #CD7F32;
  --text-light: #ffffff;
  --base-font-family: "Bricolage Grotesque", sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--base-font-family);
  color: var(--text-primary);
  font-size: 1.125rem;
}

.container {
  --container-inline-offset: 5rem;
  width: min(1200px, 100% - var(--container-inline-offset));
  margin-inline: auto;

  @media (max-width:640px) {
    --container-inline-offset: 2.5rem;
  }
}

img {
  max-width: 100%;
  height: auto;
}

.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;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.btn {
  --transition-time: 100ms;
  width: 12rem;
  max-width: 100%;
  color: var(--text-primary);
  display: flex;
  column-gap: 0.5rem;
  font-weight: 500;
  font-size: 1.25rem;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background-color: var(--text-light);
  border-radius: 100vw;
  cursor: pointer;
  transition: var(--transition-time);
  margin-inline: auto;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;

  span {
    width: 1.5rem;
    aspect-ratio: 1;
    height: 1.5rem;

    img {
      transition: var(--transition-time);
    }
  }

  &:hover {
    background-color: var(--text-secondary);
    color: var(--text-light);

    img {
      filter: invert(1);
    }
  }
}


.hero-container {
  color: white;
  text-align: center;
  display: grid;

  .container,
  .banner-img {
    grid-column: 1/-1;
    grid-row: 1/-1;
  }

  .banner-img {
    width: 100%;
    height: 100%;
  }

  .header {
    padding-block: 1.875rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .nav {
      display: flex;
      align-items: center;
      column-gap: 2.5rem;

      a {
        color: var(--text-light);
        text-decoration: none;
        font-weight: 400;
        font-size: 1.25rem;
        transition: 100ms linear;

        &:hover {
          color: var(--text-secondary);
        }
      }

      @media (max-width: 640px) {
        column-gap: 1.5rem;
      }
    }

    @media (max-width:640px) {
      column-gap: 1.5rem;
      flex-wrap: wrap;
      padding-block: 1.25rem 0px;
      justify-content: center;
      row-gap: 1rem;

      .keiken-logo {
        width: 150px;
      }
    }
  }
}

.hero {
  margin-block: 1rem 3.5rem;

  h1 {
    --hero-text-size: 4rem;
    --hero-text-height: 4.375rem;
    font-size: var(--hero-text-size);
    line-height: var(--hero-text-height);
    font-weight: 300;

    @media (max-width:1560px) {
      --hero-text-size: 3rem;
      --hero-text-height: 3rem;
    }

    @media (max-width:768px) {
      --hero-text-size: clamp(1.75rem, 3.053vw + 1.034rem, 2.5rem);
    }

    span {
      font-weight: 700;
    }
  }

  .hero-btn {
    width: fit-content;
    margin-inline: auto;
    margin-top: 1.5rem;
  }

  @media (max-width:640px) {
    margin-block: 3rem 3.5rem;
  }
}

.projects {
  display: flex;
  justify-content: space-around;
  margin-block: 1.75rem;
  background: #fafafa;

  .project {
    flex: 1;
    text-align: center;
    display: grid;

    .bg-gradient,
    .project-block {
      grid-column: 1/-1;
      grid-row: 1/-1;
    }

    .bg-gradient {
      width: 100%;
      height: 100%;
      object-fit: cover;
      opacity: 0;
      transition: 100ms;
    }

    @media (pointer: coarse) {
      margin-top: 1.25rem;

      .bg-gradient {
        opacity: 1;
      }

      .btn.project-btn {
        background-color: var(--text-light);
      }
    }

    .project-block {
      max-width: 510px;
      margin-inline: auto;
      place-self: center;
      margin-block: 1.25rem 0.875rem;

      .partner-logo {
        height: 72px;
        object-fit: contain;
      }
    }

    p {
      margin: 1rem 0;
      line-height: 1.5rem;
      text-wrap: balance;
    }

    .project-btn {
      background-color: transparent;

      &:hover {
        background-color: var(--text-light);
        color: var(--text-primary);

        & img {
          filter: unset;
        }
      }
    }

    &:hover {
      .bg-gradient {
        opacity: 1;
      }
    }
  }

  @media (max-width:768px) {
    flex-direction: column;
  }
}

.about {
  --about-text-size: 2.5rem;
  display: flex;
  justify-content: space-between;
  font-size: var(--about-text-size);
  column-gap: 1.5rem;
  margin-block: 1.75rem;

  h2 {
    font-size: var(--about-text-size);
    font-weight: 500;
    white-space: nowrap;
  }

  p {
    max-width: 52rem;
    font-weight: 300;
  }

  @media (max-width:1560px) {
    --about-text-size: 2rem;
  }

  @media (max-width:1024px) {
    --about-text-size: 1.5rem;
  }

  @media (max-width:768px) {
    flex-direction: column;
    row-gap: 1rem;
  }

  @media (max-width:640px) {
    --about-text-size: 1.25rem;
  }
}

footer {
  background-color: var(--text-primary);

  .footer {
    color: white;
    display: flex;
    padding-block: 2.5rem 2rem;
    justify-content: space-between;
    gap: 3rem;

    .contact-box {
      max-width: 54.5rem;
      width: 100%;

      .contact-label {
        font-size: 2.5rem;
        margin-bottom: 2rem;
      }

      .contact-form {
        min-width: 300px;

        h3 {
          margin-bottom: 1rem;
        }

        input,
        textarea {
          background-color: transparent;
          color: var(--text-light);
          border: 1px solid rgba(255, 255, 255, 0.5);
          padding: 1rem 1.125rem;
          border-radius: 0.5rem;
          width: 100%;
          font-family: var(--base-font-family);
          font-size: 1rem;

          @media (max-width:640px) {
            padding: 0.875rem 1rem;
          }
        }

        .form-group {
          --column-number: 3;
          display: grid;
          grid-template-columns: repeat(var(--column-number), minmax(0, 1fr));
          gap: 1rem;

          .input-group {
            .required {
              color: #ff0000;
            }

            label:not(.error) {
              display: block;
              margin-bottom: 0.5rem;
            }

            input {
              flex: 1;
              font-size: 1rem;
              width: 100%;
            }
          }

          .textarea-group {
            flex-shrink: 0;
            grid-column: 1/-1;

            textarea {
              min-height: 100px;
            }
          }

          @media (max-width: 768px) {
            --column-number: 1;
          }
        }

        .project-btn {
          border: none;
          margin: unset;
        }
      }

      .captcha-box {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        margin-top: 1.75rem;
        gap: 1.5rem;

        .captch-series {
          display: flex;
          align-items: center;
          flex-wrap: wrap;
          gap: 0.5rem;
          max-width: 250px;
        }

        #captcha {
          width: 3.75rem;
          background-color: var(--text-light);
          color: var(--text-primary);
        }

        .captcha-btn {
          cursor: pointer;
          display: flex;
        }

        #captcha-error {
          width: 100%;
        }

        &:has(#captcha-error) {
          .project-btn {
            margin-top: 0.35rem;
          }
        }
      }
    }

    .footer-logo {
      display: flex;
      flex-direction: column;
      row-gap: 2.5rem;
      white-space: nowrap;

      a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        color: var(--text-light);
        text-decoration: none;

        &:hover {
          color: var(--text-secondary);
        }
      }
    }

    @media (max-width:1023px) {
      flex-direction: column;
      gap: 2rem;

      .footer-logo {
        gap: 1rem;
      }

      .contact-label {
        margin-bottom: 1.25rem !important;
        font-size: 2rem !important;
      }
    }
  }

  .copyright {
    width: 100%;
    text-align: center;
    padding-block: 1.5rem;
    color: var(--text-light);
    border-top: 1px solid rgba(255, 255, 255, 0.5);
  }
}

#response {
  margin-top: 15px;
  padding: 12px;
  display: none;
  border-radius: 6px;
}

.ok {
  background: #e6f9ec;
  color: #20603c;
}

.err {
  background: #fde8e8;
  color: #b30000;
}

.error {
  color: #ff0000;
  font-size: 0.875rem;
}

@media (max-width:1024px) {
  .keiken-logo {
    width: 180px;
  }
}

/* Sending animation */
#dots::after {
  content: '';
  display: inline-block;
  animation: dots-animate 1s steps(4, end) infinite;
  width: 1.5em;
  text-align: left;
  overflow: hidden;
  vertical-align: bottom;
}

@keyframes dots-animate {
  0% {
    content: '';
  }

  25% {
    content: '.';
  }

  50% {
    content: '..';
  }

  75% {
    content: '...';
  }

  100% {
    content: '';
  }
}