@import 'tailwindcss';

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

@theme {
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:
    var(--font-geist-mono), ui-monospace, 'SF Mono', 'Cascadia Mono', 'Segoe UI Mono', Menlo, Consolas, monospace;

  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-border: var(--border);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-sidebar: var(--sidebar);
}

:root {
  --background: #fff;
  --foreground: #171717;
  --border: #e5e5e5;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --primary: #171717;
  --primary-foreground: #fff;
  --sidebar: #f5f5f5;
}

.dark {
  --background: #0a0a0a;
  --foreground: #f5f5f5;
  --border: #262626;
  --muted: #262626;
  --muted-foreground: #a3a3a3;
  --primary: #f5f5f5;
  --primary-foreground: #0a0a0a;
  --sidebar: #171717;
}

html {
  scroll-padding-top: 4rem;
}

::selection {
  background-color: #000;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  ::selection {
    background-color: #fff;
    color: #000;
  }
}

/* Table scroll wrapper */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper > table {
  margin: 0;
}

button {
  cursor: pointer;
}

/* Code blocks */
pre {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.875rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.7;
}

pre:not(.shiki) {
  background: var(--muted);
}

.code-block pre {
  margin: 0;
}

.code-block {
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  pre {
    font-size: 0.75rem;
    padding: 0.75rem;
  }
}

:not(pre) > code {
  background: var(--muted);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.875em;
}

/* Shiki dual theme support */
.shiki,
.shiki span {
  color: var(--shiki-light) !important;
  background-color: var(--shiki-light-bg) !important;
}

.dark .shiki,
.dark .shiki span {
  color: var(--shiki-dark) !important;
  background-color: var(--shiki-dark-bg) !important;
}

/* Prose */
.prose {
  max-width: 100%;
}

.prose h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  color: var(--foreground);
}

@media (min-width: 640px) {
  .prose h1 {
    font-size: 1.875rem;
  }
}

.prose h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--foreground);
}

.prose .heading-anchor {
  position: relative;
}

.prose .heading-anchor > a[aria-label='Link to this section'] {
  opacity: 0;
  margin-left: 0.375rem;
  color: var(--muted-foreground);
  text-decoration: none;
  font-weight: 400;
  transition: opacity 0.15s ease;
}

.prose .heading-anchor:hover > a[aria-label='Link to this section'] {
  opacity: 1;
}

.prose .heading-anchor > a[aria-label='Link to this section']:hover {
  color: var(--foreground);
}

.prose p {
  margin-bottom: 1rem;
  line-height: 1.65;
  color: #525252;
  font-size: 0.9375rem;
}

:is(.dark) .prose p {
  color: #a3a3a3;
}

.prose ul,
.prose ol {
  margin-bottom: 1rem;
  padding-left: 1.25rem;
}

.prose ul {
  list-style-type: disc;
}

.prose ol {
  list-style-type: decimal;
}

.prose li {
  margin-bottom: 0.25rem;
  color: #525252;
  font-size: 0.9375rem;
  line-height: 1.6;
}

:is(.dark) .prose li {
  color: #a3a3a3;
}

.prose li strong {
  color: var(--foreground);
  font-weight: 500;
}

.prose a {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-color: #d4d4d4;
  text-underline-offset: 2px;
}

.prose a:hover {
  text-decoration-color: var(--foreground);
}

:is(.dark) .prose a {
  text-decoration-color: #525252;
}

:is(.dark) .prose a:hover {
  text-decoration-color: var(--foreground);
}

.prose strong {
  font-weight: 500;
  color: var(--foreground);
}

.prose blockquote {
  margin-bottom: 1rem;
  border-left: 2px solid #e5e5e5;
  padding-left: 1rem;
  font-size: 0.9375rem;
  color: #737373;
}

:is(.dark) .prose blockquote {
  border-left-color: #525252;
  color: #a3a3a3;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
}

.prose th {
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.025em;
}

.prose td {
  color: var(--muted-foreground);
}

.prose td code {
  color: var(--foreground);
}

/* Hero card on landing page */
.hero-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

.hero-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  background: var(--muted);
}

.hero-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--foreground);
}

.hero-card p {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin: 0;
  line-height: 1.5;
}
