@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  html,
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
      'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    font-weight: 300;
  }

  .shiki {
    background: inherit !important;
    counter-reset: line 0;
    display: block;
    gap: 0.3em;
    grid-auto-rows: 1em;
    grid-template-columns: min-content 1fr;
  }

  .shiki .line {
    display: inline-block;
    line-height: 20px;
    min-height: auto;
    vertical-align: middle;
    white-space: pre;
  }

  .shiki .line:last-child:before,
  .shiki .line:last-child span {
    padding-bottom: 30px;
  }

  .shiki .line:first-child:before,
  .shiki .line:first-child span {
    padding-top: 10px;
  }

  .shiki .line:before {
    background: #3d3a3a;
    color: #777;
    content: counter(line);
    counter-increment: line;
    display: inline-block;
    margin-right: 10px;
    padding-right: 10px;
    text-align: right;
  }

  .plainText .shiki .line:before {
    display: none;
  }

  .inline-code {
    background: #65758529;
    border-radius: 4px;
    color: #9cdcfe;
    display: inline-block;
    font-weight: 300;
    padding: 3px 6px;
  }

  .note {
    border-radius: 4px;
    padding: 20px;
    margin-top: 1em;
    width: 260px;
    background-color: white;
    box-shadow: hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px;
    animation-duration: 400ms;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
  }

  .note:focus {
    box-shadow: hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px,
      0 0 0 2px #333;
  }

  .note[data-state='open'][data-side='top'] {
    animation-name: slideDownAndFade;
  }

  .note[data-state='open'][data-side='right'] {
    animation-name: slideLeftAndFade;
  }

  .note[data-state='open'][data-side='bottom'] {
    animation-name: slideUpAndFade;
  }

  .note[data-state='open'][data-side='left'] {
    animation-name: slideRightAndFade;
  }

  .note-arrow {
    fill: white;
  }

  .note-close {
    font-family: inherit;
    border-radius: 100%;
    height: 25px;
    width: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--violet-11);
    position: absolute;
    top: 5px;
    right: 5px;
  }

  .note-close:hover {
    background-color: var(--violet-4);
  }

  .note-close:focus {
    box-shadow: 0 0 0 2px var(--violet-7);
  }

  @keyframes slideUpAndFade {
    from {
      opacity: 0;
      transform: translateY(2px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes slideRightAndFade {
    from {
      opacity: 0;
      transform: translateX(-2px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes slideDownAndFade {
    from {
      opacity: 0;
      transform: translateY(-2px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes slideLeftAndFade {
    from {
      opacity: 0;
      transform: translateX(2px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
}

.collapsible-content {
  overflow: hidden;
}
.collapsible-content[data-state='open'] {
  animation: slideDown 300ms ease-out;
}
.collapsible-content[data-state='closed'] {
  animation: slideUp 300ms ease-out;
}

@keyframes slideDown {
  from {
    height: 0;
  }
  to {
    height: var(--radix-collapsible-content-height);
  }
}

@keyframes slideUp {
  from {
    height: var(--radix-collapsible-content-height);
  }
  to {
    height: 0;
  }
}

@keyframes nav-fade-in {
  0% {
    opacity: 0;
    margin-left: -30px;
  }
  100% {
    opacity: 1;
    margin-left: 0;
  }
}

.animate-nav-fade-in {
  animation: nav-fade-in 500ms ease-in-out forwards;
}
