@import 'tailwindcss';

@plugin '@tailwindcss/typography';
@plugin '@tailwindcss/forms';

@custom-variant dark (&:is(.dark *));

@theme {
  --color-blue-opaque: rgb(13 42 148 / 18%);

  --color-gray-0: #fff;
  --color-gray-100: #fafafa;
  --color-gray-200: #eaeaea;
  --color-gray-300: #999999;
  --color-gray-400: #888888;
  --color-gray-500: #666666;
  --color-gray-600: #444444;
  --color-gray-700: #333333;
  --color-gray-800: #222222;
  --color-gray-900: #111111;

  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);
}

/*
  The default border color has changed to `currentColor` in Tailwind CSS v4,
  so we've added these compatibility styles to make sure everything still
  looks the same as it did with Tailwind CSS v3.

  If we ever want to remove these styles, we need to add an explicit border
  color utility to any element that depends on these defaults.
*/
@layer base {
  *,
  ::after,
  ::before,
  ::backdrop,
  ::file-selector-button {
    border-color: var(--color-gray-200, currentColor);
  }
}

@utility link-underline {
  background-image:
    linear-gradient(transparent, transparent), linear-gradient(#fff, #fff);

  &:hover {
    background-size: 100% 3px;
    background-position: 0 100%;
  }
}

@utility link-underline-black {
  border-bottom-width: 0;
  background-image:
    linear-gradient(transparent, transparent), linear-gradient(#000, #000);
  background-size: 0 3px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.5s ease-in-out;

  &:hover {
    background-size: 100% 3px;
    background-position: 0 100%;
  }
}

:root {
  --sh-class: #2d5e9d;
  --sh-identifier: #354150;
  --sh-sign: #8996a3;
  --sh-string: #007f7a;
  --sh-keyword: #e02518;
  --sh-comment: #a19595;
  --sh-jsxliterals: #6266d1;
  --sh-property: #e25a1c;
  --sh-entity: #e25a1c;
}

html.dark {
  --sh-class: #4c97f8;
  --sh-identifier: white;
  --sh-keyword: #f47067;
  --sh-string: #0fa295;
}

::selection {
  @apply bg-indigo-700;
  color: #fefefe;
}

html {
  min-width: 360px;
}

.prose .anchor {
  @apply invisible absolute no-underline;

  margin-left: -1em;
  padding-right: 0.5em;
  width: 80%;
  max-width: 700px;
  cursor: pointer;
}

.anchor:hover {
  @apply visible;
}

.prose a {
  @apply text-indigo-400 decoration-indigo-400 decoration-[0.1em] underline-offset-2 transition-all dark:text-indigo-500 dark:decoration-indigo-500;
}

.prose .anchor:after {
  @apply text-neutral-300 dark:text-neutral-700;
  content: '#';
}

.prose *:hover > .anchor {
  @apply visible;
}

.prose pre {
  @apply overflow-x-auto rounded-lg border border-neutral-200 bg-neutral-50 dark:border-neutral-900 dark:bg-neutral-900;
}

.prose code {
  @apply rounded-lg px-1 py-0.5;
}

.prose pre code {
  @apply p-0;
  border: initial;
  line-height: 1.5;
}

.prose code span {
  @apply font-medium;
}

.prose img {
  /* Don't apply styles to next/image */
  @apply m-0;
}

.prose h2,
h3,
h4 {
  @apply font-medium! tracking-tighter!;
}

.prose strong {
  @apply font-medium;
}

.prose > :first-child {
  /* Override removing top margin, causing layout shift */
  margin-top: 1.25em !important;
  margin-bottom: 1.25em !important;
}

pre::-webkit-scrollbar {
  display: none;
}

pre {
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}

/* Remove Safari input shadow on mobile */
input[type='text'],
input[type='email'] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

table {
  display: block;
  max-width: fit-content;
  overflow-x: auto;
  white-space: nowrap;
}

.prose .callout > p {
  margin: 0 !important;
}
