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

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

/* highlight.js for code syntax highlighting */
@import 'highlight.js/styles/atom-one-dark.css';

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 207 100% 38%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 207 100% 38%;
    --radius: 0.75rem;
  }

  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 207 58% 52%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 207 58% 52%;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  }
}

/* Article body styles for markdown content */
.article-body {
  font-size: 1rem;
  line-height: 1.8;
}

.article-body h1,
.article-body h2,
.article-body h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 700;
  line-height: 1.3;
}

.article-body h1 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5em;
}

.article-body h2 {
  font-size: 1.25rem;
  padding-left: 0.5em;
  border-left: 3px solid var(--primary);
}

.article-body h3 {
  font-size: 1.125rem;
}

.article-body p {
  margin-bottom: 1em;
}

.article-body strong {
  font-weight: 600;
  color: var(--foreground);
}

.article-body a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s;
}

.article-body a:hover {
  border-bottom-color: var(--primary);
}

.article-body blockquote {
  margin: 1em 0;
  padding: 0.75em 1em;
  border-left: 3px solid var(--primary);
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: 0 0.5em 0.5em 0;
  font-style: normal;
}

.article-body blockquote p {
  margin-bottom: 0;
}

.article-body ul,
.article-body ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.article-body li {
  margin-bottom: 0.25em;
}

.article-body hr {
  margin: 2em 0;
  border: none;
  border-top: 1px solid var(--border);
}

.article-body code {
  font-family: 'Fira Code', 'JetBrains Mono', 'Menlo', monospace;
  font-size: 0.875em;
  padding: 0.125em 0.375em;
  background: var(--muted);
  border-radius: 0.25em;
}

.article-body pre {
  margin: 1em 0;
  padding: 1em;
  background: var(--muted);
  border-radius: 0.5em;
  overflow-x: auto;
  font-size: 0.875em;
}

.article-body pre code {
  background: none;
  padding: 0;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5em;
  margin: 1em 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.article-body th,
.article-body td {
  padding: 0.5em 0.75em;
  border: 1px solid var(--border);
}

.article-body th {
  background: var(--muted);
  font-weight: 600;
}
