@import "tailwindcss";

/* Drive the `dark:` utility variant off the `.dark` class (set by the theme
   toggle / pre-hydration script) instead of Tailwind v4's default
   prefers-color-scheme media query, so manual theme switching is authoritative. */
@custom-variant dark (&:where(.dark, .dark *));

@theme {
  /* Teal accent palette — Harn's signature, deliberately distinct from the
     Burin Code marketing site's engraver's vermilion. Amber (Tailwind's
     built-in `amber-*`) is the secondary highlight, evoking a forge. The
     semantic token NAMES below are shared with burincode.com so prose and
     component rules port between the two sites — see docs-stack-conventions.md. */
  --color-accent-50: #f0fdfa;
  --color-accent-100: #ccfbf1;
  --color-accent-200: #99f6e4;
  --color-accent-300: #5eead4;
  --color-accent-400: #2dd4bf;
  --color-accent-500: #14b8a6;
  --color-accent-600: #0d9488;
  --color-accent-700: #0f766e;
  --color-accent-800: #115e59;
  --color-accent-900: #134e4a;
  --color-accent-950: #042f2e;

  /* Semantic surface tokens (light) — faintly teal-tinted neutrals. */
  --color-surface: #ffffff;
  --color-surface-secondary: #f5faf9;
  --color-surface-tertiary: #edf4f2;
  --color-surface-elevated: #ffffff;
  --color-foreground: #0c1413;
  --color-foreground-secondary: #44524f;
  --color-foreground-muted: #8a9a96;
  --color-border: #e2eae8;
  --color-border-strong: #ccd8d5;
  --color-nav-bg: rgba(255, 255, 255, 0.85);
  --color-card-bg: #ffffff;
  --color-card-border: #e2eae8;
  --color-input-bg: #ffffff;
  --color-input-border: #ccd8d5;

  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

.dark {
  --color-surface: #07100f;
  --color-surface-secondary: #0d1817;
  --color-surface-tertiary: #142220;
  --color-surface-elevated: #0d1817;
  --color-foreground: #eef4f2;
  --color-foreground-secondary: #c2cfcc;
  --color-foreground-muted: #6b7d79;
  --color-border: #1b2a28;
  --color-border-strong: #2b3d3a;
  --color-nav-bg: rgba(7, 16, 15, 0.85);
  --color-card-bg: #0d1817;
  --color-card-border: #1b2a28;
  --color-input-bg: #0d1817;
  --color-input-border: #2b3d3a;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-surface);
  color: var(--color-foreground);
}

/* --------------------------------------------------------------------------
   Entrance + decorative animations (from the Burin marketing aesthetic)
   -------------------------------------------------------------------------- */
@keyframes harn-fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes harn-blob-drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(2%, -3%, 0) scale(1.05);
  }
}
@keyframes harn-blob-drift-alt {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-3%, 2%, 0) scale(1.07);
  }
}
@keyframes harn-pulse-dot {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}
@keyframes harn-flow-dash {
  to {
    stroke-dashoffset: -16;
  }
}

.animate-fade-up {
  animation: harn-fade-up 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.animate-fade-up-delay-1 {
  animation: harn-fade-up 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: 0.08s;
}
.animate-fade-up-delay-2 {
  animation: harn-fade-up 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: 0.18s;
}
.animate-fade-up-delay-3 {
  animation: harn-fade-up 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: 0.28s;
}
.animate-fade-up-delay-4 {
  animation: harn-fade-up 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: 0.4s;
}
.animate-blob {
  animation: harn-blob-drift 14s ease-in-out infinite;
}
.animate-blob-alt {
  animation: harn-blob-drift-alt 18s ease-in-out infinite;
}
.animate-pulse-dot {
  animation: harn-pulse-dot 2.4s ease-in-out infinite;
}
.animate-flow {
  stroke-dasharray: 4 4;
  animation: harn-flow-dash 1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .animate-fade-up,
  .animate-fade-up-delay-1,
  .animate-fade-up-delay-2,
  .animate-fade-up-delay-3,
  .animate-fade-up-delay-4,
  .animate-blob,
  .animate-blob-alt,
  .animate-pulse-dot,
  .animate-flow {
    animation: none !important;
  }
}

/* --------------------------------------------------------------------------
   Documentation prose
   -------------------------------------------------------------------------- */
.prose {
  color: var(--color-foreground-secondary);
}
.prose > :first-child {
  margin-top: 0;
}
.prose h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: var(--color-foreground);
  scroll-margin-top: 6rem;
}
.prose h2 {
  font-size: 1.5rem;
  font-weight: 650;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-foreground);
  scroll-margin-top: 6rem;
}
.prose h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--color-foreground);
  scroll-margin-top: 6rem;
}
.prose h4 {
  font-size: 1.02rem;
  font-weight: 600;
  margin-top: 1.4rem;
  margin-bottom: 0.4rem;
  color: var(--color-foreground);
  scroll-margin-top: 6rem;
}
.prose p {
  margin-bottom: 1rem;
  line-height: 1.75;
}
.prose ul,
.prose ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}
.prose ul {
  list-style-type: disc;
}
.prose ol {
  list-style-type: decimal;
}
.prose li {
  margin-bottom: 0.3rem;
  line-height: 1.7;
}
.prose li > ul,
.prose li > ol {
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}
.prose a {
  color: var(--color-accent-700);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.prose a:hover {
  color: var(--color-accent-600);
}
.dark .prose a {
  color: var(--color-accent-300);
}
.dark .prose a:hover {
  color: var(--color-accent-200);
}
.prose strong {
  color: var(--color-foreground);
  font-weight: 600;
}
.prose blockquote {
  border-left: 3px solid var(--color-accent-400);
  background: color-mix(in srgb, var(--color-accent-500) 7%, transparent);
  padding: 0.5rem 1rem;
  border-radius: 0 0.4rem 0.4rem 0;
  margin: 0 0 1rem;
}
.prose blockquote p:last-child {
  margin-bottom: 0;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}
.prose img {
  max-width: 100%;
  border-radius: 0.5rem;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background-color: var(--color-surface-tertiary);
  color: var(--color-foreground);
  padding: 0.12rem 0.36rem;
  border-radius: 0.3rem;
}
.prose pre {
  background-color: var(--color-surface-tertiary);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent-500);
  padding: 0.9rem 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
}
.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}
.prose th,
.prose td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.prose th {
  background-color: var(--color-surface-secondary);
  font-weight: 600;
  color: var(--color-foreground);
}
.prose details {
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.85rem;
  margin-bottom: 1rem;
}
.prose summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-foreground);
}

/* --------------------------------------------------------------------------
   Callout component (shared `.callout` contract with burincode.com — see
   docs-stack-conventions.md). harnlang.com authors these as GitHub-style alert
   blockquotes (`> [!NOTE]`); burincode.com as the MDX `<Callout>` component.
   Both render to this markup, so this block is identical in both repos.
   -------------------------------------------------------------------------- */
.callout {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem 0;
  border: 1px solid var(--color-card-border);
  background-color: var(--color-card-bg);
  border-radius: 0.75rem;
  padding: 1rem;
}
.callout-icon {
  margin-top: 0.125rem;
  height: 1.25rem;
  width: 1.25rem;
  flex-shrink: 0;
  color: var(--color-accent-600);
}
.dark .callout-icon {
  color: var(--color-accent-400);
}
.callout-body {
  min-width: 0;
}
.callout .callout-body > :last-child {
  margin-bottom: 0;
}
.callout .callout-title {
  margin-bottom: 0.25rem;
  font-weight: 600;
  color: var(--color-accent-600);
}
.dark .callout .callout-title {
  color: var(--color-accent-400);
}
.callout-warning .callout-icon,
.callout-warning .callout-title {
  color: var(--color-accent-700);
}
.dark .callout-warning .callout-icon,
.dark .callout-warning .callout-title {
  color: var(--color-accent-400);
}

/* --------------------------------------------------------------------------
   Syntax highlighting (highlight.js token classes, emitted at build time)
   Light + dark variants tuned to the teal/amber brand.
   -------------------------------------------------------------------------- */
.hljs-comment,
.hljs-quote {
  color: var(--color-foreground-muted);
  font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag {
  color: #b45309;
}
.hljs-built_in {
  color: #0f766e;
}
.hljs-type,
.hljs-class .hljs-title {
  color: #0e7490;
}
.hljs-title,
.hljs-title.function_,
.hljs-section {
  color: #0d9488;
}
.hljs-string,
.hljs-attr,
.hljs-symbol,
.hljs-meta-string {
  color: #15803d;
}
.hljs-number,
.hljs-literal {
  color: #be123c;
}
.hljs-subst {
  color: var(--color-foreground);
}
.hljs-attribute,
.hljs-meta,
.hljs-variable,
.hljs-template-variable {
  color: #9a3412;
}
.hljs-deletion {
  color: #be123c;
}
.hljs-addition {
  color: #15803d;
}

.dark .hljs-keyword,
.dark .hljs-selector-tag {
  color: #fbbf24;
}
.dark .hljs-built_in {
  color: #5eead4;
}
.dark .hljs-type,
.dark .hljs-class .hljs-title {
  color: #67e8f9;
}
.dark .hljs-title,
.dark .hljs-title.function_,
.dark .hljs-section {
  color: #2dd4bf;
}
.dark .hljs-string,
.dark .hljs-attr,
.dark .hljs-symbol,
.dark .hljs-meta-string {
  color: #86efac;
}
.dark .hljs-number,
.dark .hljs-literal {
  color: #fda4af;
}
.dark .hljs-attribute,
.dark .hljs-meta,
.dark .hljs-variable,
.dark .hljs-template-variable {
  color: #fdba74;
}

/* Hide native scrollbar on the section-tab strip while keeping it scrollable. */
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Thin, theme-aware scrollbar for the sidebar + TOC (the default OS scrollbar
   renders light/white over dark surfaces). */
.docs-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}
.docs-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.docs-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.docs-scroll::-webkit-scrollbar-thumb {
  background-color: var(--color-border-strong);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.docs-scroll::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-foreground-muted);
  background-clip: padding-box;
  border: 2px solid transparent;
}
