🏡 index : ~doyle/rgit.git

@import 'util';
@import 'diff';
@import 'tables';
@import 'code';
@import 'colours';

@media (prefers-color-scheme: dark) {
  html {
    background: #000;
    color: $darkModeTextColour;
  }

  h2,
  h3 {
    color: darken($darkModeHighlightColour, 20%);
  }
}

body {
  font-family: sans-serif;
  font-size: 0.9rem;
  tab-size: 4;
}

header {
  border-bottom: solid 1px #ccc;
}

nav {
  margin-top: 2rem;
  border-bottom: solid 3px #ccc;
  display: flex;

  .grow {
    flex-grow: 1;
  }

  @media (prefers-color-scheme: dark) {
    border-bottom-color: $darkModeHighlightColour;
  }

  a {
    padding: 2px 0.75em;
    color: #777;
    font-size: 110%;

    @media (prefers-color-scheme: dark) {
      color: $darkModeHighlightColour;
    }

    &.active {
      color: #000;
      background-color: #ccc;

      @media (prefers-color-scheme: dark) {
        background: $darkModeHighlightColour;
      }
    }
  }
}

aside {
  background: #f7f7f7;
  padding: 0.3rem 2rem;

  @media (prefers-color-scheme: dark) {
    background: #111;
  }
}

main {
  padding: 2rem;
  margin: 0;
  border-bottom: solid 3px #ccc;

  @media (prefers-color-scheme: dark) {
    border-bottom-color: $darkModeHighlightColour;
  }
}

.two-col {
  display: flex;
  gap: 1rem;

  .sidebar {
    display: none;
    overflow: hidden;
    white-space: nowrap;
    resize: horizontal;
    max-width: 50%;
    min-width: 18rem;
    width: 10%;
  }
}

.sidebar-toggle {
  display: inline-block;
  user-select: none;
  cursor: pointer;
  width: 1rem;
  height: 0.75rem;
  position: relative;
  margin-bottom: 1rem;

  span {
    display: block;
    position: absolute;
    height: 0.125rem;
    width: 100%;
    background: #333;
    border-radius: 0.125rem;
    transition: 0.3s ease;

    @media (prefers-color-scheme: dark) {
      background: #abb2bf;
    }

    @media (prefers-reduced-motion) {
      transition-duration: 0s;
    }

    &:nth-of-type(1) {
      top: 0;
    }

    &:nth-of-type(2) {
      top: 0.3rem;
    }

    &:nth-of-type(3) {
      top: 0.6rem;
    }
  }

  input:checked~span:nth-of-type(1) {
    transform: rotate(45deg);
    top: 0.23rem;
  }

  input:checked~span:nth-of-type(2) {
    opacity: 0;
  }

  input:checked~span:nth-of-type(3) {
    transform: rotate(-45deg);
    top: 0.23rem;
  }

  input {
    display: none;
  }

  &:has(input[type="checkbox"]:checked)+.two-col>.sidebar {
    display: block;
  }
}

.dropdown-link {
  .dropdown-label {
    display: flex;
    width: 100%;
    border-radius: .25rem;
    overflow: hidden;
    cursor: pointer;

    &:hover {
      background: rgba(0, 0, 255, .1);

      @media (prefers-color-scheme: dark) {
        background: rgba(255, 255, 255, .1);
      }
    }

    .dropdown-toggle {
      font-size: 1.25rem;
      padding: .2rem .3rem;
      cursor: pointer;
      user-select: none;
      display: flex;
      align-items: center;

      &:hover {
        background: rgba(0, 0, 255, .1);

        @media (prefers-color-scheme: dark) {
          background: rgba(255, 255, 255, .1);
        }
      }
    }
  }

  .link {
    display: inline-block;
    padding: .35rem .5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-decoration: none;
    color: inherit;

    &.selected {
      background: rgba(0, 0, 255, .1);

      @media (prefers-color-scheme: dark) {
        background: rgba(0, 255, 0, .2);
      }
    }
  }

  .dropdown-content {
    border-left: .15rem solid rgba(0, 0, 255, .1);
    padding-left: .4rem;
    margin-left: .4rem;
    display: none;

    @media (prefers-color-scheme: dark) {
      border-left: .15rem solid rgba(0, 255, 0, .2);
    }
  }

  input[type="checkbox"] {
    display: none;
  }

  .dropdown-label:has(label input[type="checkbox"]:checked)+.dropdown-content {
    display: block;
  }

  .dropdown-toggle span {
    display: inline-block;
    transition: transform 0.2s;

    @media (prefers-reduced-motion) {
      transition-duration: 0s;
    }
  }

  input[type="checkbox"]:checked+.dropdown-toggle span {
    transform: rotate(90deg);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

footer {
  margin-top: 0.5em;
  text-align: center;
  font-size: 80%;
  color: #ccc;

  @media (prefers-color-scheme: dark) {
    color: $darkModeTextColour;
  }
}

a {
  text-decoration: none;
  color: blue;

  @media (prefers-color-scheme: dark) {
    color: darken($darkModeHighlightColour, 10%);
  }

  &.no-style {
    color: inherit;

    @media (prefers-color-scheme: dark) {
      color: darken($darkModeHighlightColour, 10%);
    }
  }

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