:root {
  --action-color: oklch(0.55 0.09 197.63);
  --action-color-light: oklch(0.73 0.13 194.77);
  --action-color-ultra-light: oklch(0.94 0.02 215.28);

  --text-color: oklch(0 0 0 / 0.87);
  --text-color-on-action-color: oklch(1 0 0 / 0.87);
  --text-color-on-action-color-light: oklch(0 0 0 / 0.87);

  --bg-img-green-dark: var(--action-color);
  --bg-img-green: var(--action-color-light);
  --bg-img-green-light: var(--action-color-ultra-light);

  --success-color: oklch(0.616 0.145 153.083);
  --success-bg-color: oklch(0.919 0.031 162.167);

  --main-width: 40.5rem;

  --table-head-border-color: oklch(0 0 0 / 1);
  --table-border-color: oklch(0 0 0 / 0.125);
  --table-bg-even: oklch(0 0 0 / 0.05);
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  display: flex;
  row-gap: 0.5rem;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  * {
    font-family: 'Unistra A', sans-serif;
    box-sizing: border-box;
    font-size: 1.25rem;
    line-height: 1.2;

    &:focus {
      outline: 2px solid var(--action-color);
    }
  }

  > div[aria-hidden='true'] {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    display: flex;
    flex-direction: column;
    align-items: center;

    svg {
      path {
        &:nth-of-type(3) {
          fill: var(--bg-img-green-dark);
        }

        &:nth-of-type(2) {
          fill: var(--bg-img-green);
        }

        &:nth-of-type(1) {
          fill: var(--bg-img-green-light);
        }
      }
    }

    > div {
      position: absolute;
      top: 50%;
      display: grid;
      grid-template-columns: 282px 507px 507px 282px;
      margin-block: auto;
      width: fit-content;
      height: 30rem;

      img {
        &:nth-of-type(1) {
          width: 220px;
          align-self: flex-end;
        }

        &:nth-of-type(1), &:nth-of-type(2) {
          transform: scaleX(-1);
        }

        &:nth-of-type(2), &:nth-of-type(3) {
          width: 150px;
        }

        &:nth-of-type(4) {
          width: 250px;
        }

        &:nth-of-type(3) {
          justify-self: flex-end;
        }

        &:nth-of-type(3), &:nth-of-type(4) {
          align-self: flex-end;
        }
      }
    }
  }

  main {
    --additional-padding: 4.25rem;

    width: 100%;
    max-width: var(--main-width);
    background-color: white;
    padding: 1rem 2rem;
    border-block-end: 1px solid var(--bg-img-green-dark);

    @media (width >= 768px) {
      border: 1px solid var(--bg-img-green-dark);
    }

    > header {
      nav {
        width: 100%;
        display: flex;
        justify-content: flex-end;

        menu {
          display: flex;
          padding: 0;
          margin: 0;

          li {
            list-style: none;

            &:not(:last-child) {
              a {
                abbr {
                  border-right: 1px solid var(--text-color);
                }
              }
            }

            &:last-child {
              a {
                abbr {
                  padding-right: 0;
                }
              }
            }

            a {
              abbr {
                text-decoration: none;
                padding: 0 0.5rem;
                display: flex;
                justify-content: center;
                align-items: center;
              }
            }
          }
        }
      }

      h1 {
        text-align: center;
        font-size: 1.75rem;
        margin: 2rem 0;
        font-weight: normal;

        @media (width >= 768px) {
          font-size: 2.5rem;
          padding-inline: var(--additional-padding);
        }
      }
    }

    > footer {
      @media (width >= 768px) {
        padding-inline: var(--additional-padding);
      }

      > div {
        display: flex;
        justify-content: space-evenly;

        &:not(.charactersMobile) {
          img {
            height: 2rem;
          }
        }

        &.charactersMobile {
          align-items: flex-end;
          margin-block-start: 1rem;

          @media (width >= 768px) {
            display: none;
          }

          img {
            &:nth-of-type(1), &:nth-of-type(4) {
              width: 4.5rem;
            }

            &:nth-of-type(2), &:nth-of-type(3) {
              width: 3.25rem;
            }

            &:nth-of-type(1), &:nth-of-type(2) {
              transform: scaleX(-1);
            }
          }
        }
      }
    }

    > section {
      &.casLogin {
        form {
          display: flex;
          flex-direction: column;
          align-items: center;

          @media (width >= 768px) {
            padding-inline: var(--additional-padding);
          }

          label {
            cursor: pointer;
          }

          section {
            display: flex;
            margin-block-end: 1.5rem;
            width: 100%;

            &:not(.checkbox-section) {
              flex-direction: column;

              label {
                font-size: 1.5rem;
                margin-block-end: 0.25rem;
              }
            }

            &.checkbox-section {
              width: 100%;
              justify-content: center;
              align-items: center;
              column-gap: 0.5rem;
            }

            div {
              height: 3rem;
              display: grid;
              align-items: center;
              grid-template-columns: 2.5rem 1fr;
              border: 1px solid var(--action-color-light);

              &.with-button {
                grid-template-columns: 2.5rem 1fr 2.5rem;
              }

              i, button {
                width: 100%;
                height: 100%;
                background-color: var(--action-color-light);

                &::before {
                  width: 100%;
                  height: 100%;
                  color: var(--text-color-on-action-color-light);
                  display: flex;
                  justify-content: center;
                  align-items: center;
                  position: relative;
                  top: 2px;
                }
              }

              input:not([type='checkbox']) {
                display: flex;
                align-items: center;
                height: 100%;
                border: none;
                padding-inline: 1rem;

                &::placeholder {
                  color: var(--action-color);
                  font-style: italic;
                }
              }

              button {
                border: none;
                cursor: pointer;
                display: flex;
                justify-content: center;
                align-items: center;

                svg {
                  width: 1.25rem;
                  height: 1.25rem;
                }
              }
            }

            input[type='checkbox'] {
              width: 1.25rem;
              height: 1.25rem;
              border: 1px solid var(--action-color);
              appearance: none;
              -webkit-appearance: none;
              -moz-appearance: none;
              border-radius: 0;

              &:checked {
                background: var(--action-color) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
              }
            }

            p {
              margin: 0;
              font-size: 1rem;
              font-style: italic;
            }
          }

          a {
            &, * {
              font-size: 1.125rem;
            }
          }

          button[type='submit'] {
            padding: 0.625rem 2.25rem;
            background-color: var(--action-color);
            color: var(--text-color-on-action-color);
            border: none;
            cursor: pointer;
          }
        }

        > menu {
          padding: 0;
          margin: 0;
          display: flex;
          justify-content: space-around;
          width: 100%;
          padding-inline: var(--additional-padding);
          font-size: 1.75rem;
          row-gap: 0.25rem;

          @media (width < 768px) {
            flex-direction: column;
            text-align: center;
          }

          li {
            list-style: none;

            a {
              &, * {
                font-size: 1.125rem;
              }
            }
          }
        }

        > p {
          border: 1px solid var(--action-color-light);
          padding: 1rem 1.5rem;
          line-height: 1.4;

          @media (width >= 768px) {
            margin-inline: var(--additional-padding);
          }
        }
      }

      &.casOK, &.logoutOK {
        margin: 0 4.25rem 1.5rem;
        padding: 1rem;
        border: 1px solid var(--action-color-light);
        background-color: var(--success-bg-color);

        h2 {
          font-size: 2.5rem;
          font-weight: normal;
          margin: 0 0 0.5rem;
        }

        p {
          button {
            background-color: var(--action-color);
            color: var(--text-color-on-action-color);
            cursor: pointer;
            border: none;
            padding: 0.25rem 0.5rem;
          }
        }
      }

      &.casOK {
        dialog {
          padding: 0;
          border: 0;
          grid-template-rows: 1fr 4rem;
          overflow: hidden;

          &[open] {
            display: grid;
          }

          &::backdrop {
            background-color: rgba(0, 0, 0, 0.5);
          }

          > div {
            padding: 1rem;
            overflow-y: auto;

            nav {
              width: 100%;
              border-block-end: 1px solid var(--table-head-border-color);

              button {
                background: transparent;
                border: none;
                border-bottom: 1px solid var(--table-head-border-color);
                cursor: pointer;
                padding: 0.25rem 0.5rem;
                position: relative;
                top: 1px;

                &[aria-selected="true"] {
                  border-color: white;
                  border-inline: 1px solid var(--table-head-border-color);
                  border-block-start: 1px solid var(--table-head-border-color);
                }
              }
            }

            section {
              &.is-hidden {
                display: none;
              }

              table {
                border-collapse: collapse;
                width: 100%;

                thead, tbody {
                  th, td {
                    padding: 0.5rem;
                    text-align: left;
                  }
                }

                thead {
                  tr {
                    border-block-end: 1px solid var(--table-head-border-color);
                  }
                }

                tbody {
                  tr {
                    &:nth-of-type(even) {
                      background-color: var(--table-bg-even);
                    }

                    border-block: 1px solid var(--table-border-color);
                  }
                }
              }
            }
          }

          footer {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            padding-inline: 1rem;

            button {
              background-color: var(--action-color);
              color: var(--text-color-on-action-color);
              cursor: pointer;
              border: none;
              padding: 0.25rem 0.5rem;
            }
          }
        }
      }
    }
  }

  > footer {
    display: flex;
    justify-content: center;

    p {
      margin: 0;
      padding: 0;
      text-align: center;
    }
  }
}

a {
  color: var(--action-color);
}

.sr-only {
  border: 0 !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  clip-path: inset(50%) !important;
  height: 1px !important;
  overflow: hidden !important;
  padding: 0 !important;
  position: absolute !important;
  width: 1px !important;
  white-space: nowrap !important;
}

.bold {
  font-weight: bold;
}

.a-btn {
  border: 1px solid var(--action-color);
  padding: 0.25rem 0.5rem;
  text-decoration: none;
  background-color: white;

  @media (prefers-reduced-motion: no-preference) {
    transition: all 250ms ease-in-out;
  }

  &:hover, &:focus {
    background-color: var(--action-color);
    color: var(--text-color-on-action-color);
  }
}

