@import "tailwindcss";
@plugin '@tailwindcss/typography';

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

@utility container {
  margin-inline: auto;
  padding-inline: 2rem;

  @media (width >=--theme(--breakpoint-sm)) {
    max-width: none;
  }

  @media (width >=1440px) {
    max-width: 1440px;
  }
}

@theme {
  --color-border: hsl(var(--border));
  --color-input: hsl(var(--input));
  --color-ring: hsl(var(--ring));
  --color-background: hsl(var(--background));
  --color-foreground: hsl(var(--foreground));

  --color-primary: hsl(var(--primary));
  --color-primary-foreground: hsl(var(--primary-foreground));

  --color-secondary: hsl(var(--secondary));
  --color-secondary-foreground: hsl(var(--secondary-foreground));

  --color-destructive: hsl(var(--destructive));
  --color-destructive-foreground: hsl(var(--destructive-foreground));

  --color-muted: hsl(var(--muted));
  --color-muted-foreground: hsl(var(--muted-foreground));

  --color-accent: hsl(var(--accent));
  --color-accent-foreground: hsl(var(--accent-foreground));

  --color-popover: hsl(var(--popover));
  --color-popover-foreground: hsl(var(--popover-foreground));

  --color-card: hsl(var(--card));
  --color-card-foreground: hsl(var(--card-foreground));

  --color-sidebar: hsl(var(--sidebar-background));
  --color-sidebar-foreground: hsl(var(--sidebar-foreground));
  --color-sidebar-primary: hsl(var(--sidebar-primary));
  --color-sidebar-primary-foreground: hsl(var(--sidebar-primary-foreground));
  --color-sidebar-accent: hsl(var(--sidebar-accent));
  --color-sidebar-accent-foreground: hsl(var(--sidebar-accent-foreground));
  --color-sidebar-border: hsl(var(--sidebar-border));
  --color-sidebar-ring: hsl(var(--sidebar-ring));

  --radius-lg: var(--radius);
  --radius-md: calc(var(--radius) - 2px);
  --radius-sm: calc(var(--radius) - 4px);

  --font-code: var(--font-geist-mono);
  --font-regular: var(--font-geist-sans);

  --animate-accordion-down: accordion-down 0.2s ease-out;
  --animate-accordion-up: accordion-up 0.2s ease-out;
  --animate-shiny-text: shiny-text 8s infinite;

  @keyframes accordion-down {
    from {
      height: 0;
    }

    to {
      height: var(--radix-accordion-content-height);
    }
  }

  @keyframes accordion-up {
    from {
      height: var(--radix-accordion-content-height);
    }

    to {
      height: 0;
    }
  }

  @keyframes collapsible-down {
    from {
      height: 0;
    }

    to {
      height: var(--radix-collapsible-content-height);
    }
  }

  @keyframes collapsible-up {
    from {
      height: var(--radix-collapsible-content-height);
    }

    to {
      height: 0;
    }
  }

  @keyframes shiny-text {
    0%,
    90%,
    100% {
      background-position: calc(-100% - var(--shiny-width)) 0;
    }

    30%,
    60% {
      background-position: calc(100% + var(--shiny-width)) 0;
    }
  }
}

/*
  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 animate-collapsible-down {
  animation: collapsible-down 0.2s ease-out;
}

@utility animate-collapsible-up {
  animation: collapsible-up 0.2s ease-out;
}

@utility animate-shine {
  --animate-shine: shine var(--duration) infinite linear;
  animation: var(--animate-shine);
  background-size: 200% 200%;
}

/* Fresh Lime Theme */
@layer base {
  :root {
    --background: 85 45% 98%;
    --foreground: 85 30% 10%;
    --card: 0 0% 100%;
    --card-foreground: 85 30% 10%;
    --popover: 0 0% 100%;
    --popover-foreground: 85 30% 10%;
    --primary: 85 70% 45%;
    --primary-foreground: 0 0% 100%;
    --secondary: 85 40% 90%;
    --secondary-foreground: 85 30% 10%;
    --muted: 85 30% 92%;
    --muted-foreground: 85 15% 45%;
    --accent: 85 60% 40%;
    --accent-foreground: 0 0% 100%;
    --destructive: 0 85% 60%;
    --destructive-foreground: 0 0% 100%;
    --border: 85 25% 88%;
    --input: 85 25% 88%;
    --ring: 85 70% 45%;
    --radius: 0.5rem;
    --chart-1: 85 70% 45%;
    --chart-2: 85 60% 40%;
    --chart-3: 85 80% 40%;
    --chart-4: 85 85% 35%;
    --chart-5: 85 90% 30%;
    --line-number-color: rgba(0, 0, 0, 0.05);
  }

  .dark {
    --background: 85 20% 8%;
    --foreground: 85 30% 96%;
    --card: 85 20% 10%;
    --card-foreground: 85 30% 96%;
    --popover: 85 20% 10%;
    --popover-foreground: 85 30% 96%;
    --primary: 85 75% 55%;
    --primary-foreground: 85 20% 8%;
    --secondary: 85 25% 18%;
    --secondary-foreground: 85 30% 96%;
    --muted: 85 20% 20%;
    --muted-foreground: 85 20% 70%;
    --accent: 85 70% 50%;
    --accent-foreground: 0 0% 100%;
    --destructive: 0 85% 65%;
    --destructive-foreground: 0 0% 100%;
    --border: 85 25% 22%;
    --input: 85 25% 22%;
    --ring: 85 75% 55%;
    --chart-1: 85 75% 55%;
    --chart-2: 85 70% 50%;
    --chart-3: 85 80% 45%;
    --chart-4: 85 85% 40%;
    --chart-5: 85 90% 35%;
    --line-number-color: rgba(255, 255, 255, 0.1);
  }
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground;
  }
}

@layer utilities {
  .prose {
    margin: 0 !important;
  }

  pre {
    padding: 2px 0 !important;
    width: inherit !important;
    overflow-x: auto;
  }

  pre > code {
    display: grid;
    max-width: inherit !important;
    padding: 14px 0 !important;
    border: 0 !important;
  }

  .code-line {
    padding: 0.75px 16px;
    @apply border-l-2 border-transparent;
  }

  .line-number::before {
    display: inline-block;
    width: 1rem;
    margin-right: 22px;
    margin-left: -2px;
    color: rgb(110, 110, 110);
    content: attr(line);
    font-size: 13.5px;
    text-align: right;
  }

  .highlight-line {
    @apply bg-primary/5 border-primary/30 border-l-2;
  }

  .rehype-code-title {
    @apply font-code mt-5 -mb-8 w-full px-2 pb-5 text-sm font-medium;
  }

  .highlight-comp > code {
    background-color: transparent !important;
  }
}

@layer utilities {
  @keyframes shine {
    0% {
      background-position: 0% 0%;
    }

    50% {
      background-position: 100% 100%;
    }

    100% {
      background-position: 0% 0%;
    }
  }
}
