:root:has(cms-admin) {
  color-scheme: light dark;
}

html:has(cms-admin) {
  -webkit-font-smoothing: antialiased
}

body:has(cms-admin) {
  background: light-dark(rgb(235, 235, 235), rgb(20, 20, 20));
  color: light-dark(rgb(20, 20, 20), rgb(235, 235, 235));
  margin: 0;

  &,
  button {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 400;

    @media (min-width: 1441px) {
      font-size: 0.8125rem;
    }
  }
}

cms-admin {
  > p {
    height: 0;
    position: sticky;
    top: 0;
    z-index: 30;

    .button {
      background: light-dark(rgb(235, 235, 235), rgb(20, 20, 20));
      display: inline-flex;
      margin: 1rem 0 0 1rem;
      width: 1rem;
    }

    @media (max-width: 1440px) {
      display: none !important;
    }
  }
  
  > div {
    &:not(:has(aside)) {
      box-sizing: border-box;
      display: flex;
      height: 100vh;
      justify-content: center;
    }
  
    @media (max-width: 1440px) {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      padding: 1rem;
    }
  
    @media (min-width: 1441px) {
      &:has(aside) {
        display: grid;
        grid-template: auto 1fr / 275px 1fr;
        column-gap: 3.75rem;
        padding-right: 3.75rem;
      }
    }
  
    > aside {
      border-right: 1px solid rgb(47, 47, 47);
      box-sizing: border-box;
      grid-row: 1 / span 2;
      height: 100vh;
      overflow-y: auto;
      padding: 3.5rem 1.25rem 2.5rem;
      position: sticky;
      scrollbar-width: none;
      top: 0;
  
      @media (max-width: 1440px) {
        display: none !important;
      }
    }
  
    > header {
      gap: 0.5rem;
  
      @media (min-width: 1441px) {
        height: 3.5rem;
  
        button {
          display: none;
        }
      }
  
      button {
        background: transparent;
        padding: 0.125rem;
      }
  
      &,
      ol,
      nav a {
        align-items: center;
        display: flex;
      }

      li {
        display: inline-block;
        max-width: 10rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
  
      a:not(:hover) {
        text-decoration: none;
      }
  
      nav a {
        font-weight: 600;

        &::after {
          content: "/";
          padding: 0 0.625rem;
        }
      }

      lucide-icon {
        width: 1.125rem;
      }
  
      > a {
        margin-left: auto;
  
        lucide-icon {
          background: light-dark(#f28b49, #0d74b6);
          border-radius: 9999px;
          padding: 0.25rem;
        }
      }
    }
  }

  > div > aside,
  > dialog[open] {
    &,
    li:has(ul),
    ul {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    nav {
      flex: 1;
    }

    label {
      color: light-dark(rgb(114, 114, 114), rgb(141, 141, 141));
      display: flex;
      justify-content: space-between;
      margin: 0.25rem 0;
    }

    a:not(:hover) {
      text-decoration: none;
    }

    button {
      align-self: start;
      background: transparent;
      border: none;

      &[name="logout"] lucide-icon {
        transform: rotate(-180deg);
      }
    }
  }

  &:not(:has(> p :checked)) > div {
    grid-template-columns: 0 1fr;

    > aside {
      visibility: hidden;
    }
  }

  .visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  .thumbnail {
    width: 2.5rem;
    height: 2.5rem;

    img {
      height: 100%;
      object-fit: cover;
      width: 100%;
    }
  }

  input.visually-hidden:is(:focus, :focus-within) + label {
    outline: thin dotted;
  }
}
