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

@layer base {
  :root {
    color-scheme: dark;
  }

  html {
    scroll-behavior: smooth;
  }

  body {
    margin: 0;
    background-color: #0f1115;
    color: #94a3b8;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  code,
  pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  }

  a {
    transition:
      color 0.15s ease,
      background-color 0.15s ease,
      border-color 0.15s ease,
      opacity 0.15s ease;
  }

  ::selection {
    background: rgba(96, 165, 250, 0.28);
    color: #eff6ff;
  }

  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: #2c313c;
    border-radius: 999px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #475569;
  }
}

@layer components {
  .doc-prose {
    color: #94a3b8;
    font-size: 0.975rem;
    line-height: 1.8;
  }

  .doc-prose > * + * {
    margin-top: 1.15rem;
  }

  .doc-prose h2,
  .doc-prose h3,
  .doc-prose h4,
  .doc-prose h5,
  .doc-prose h6 {
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0;
  }

  .doc-prose h2 {
    margin-top: 3rem;
    margin-bottom: 1rem;
    font-size: 1.75rem;
  }

  .doc-prose h3 {
    margin-top: 2.2rem;
    margin-bottom: 0.85rem;
    font-size: 1.3rem;
  }

  .doc-prose h4 {
    margin-top: 1.8rem;
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
  }

  .doc-prose p {
    color: #94a3b8;
  }

  .doc-prose strong {
    color: #f8fafc;
    font-weight: 600;
  }

  .doc-prose em {
    color: #cbd5e1;
  }

  .doc-prose a {
    color: theme('colors.brand.400');
    text-decoration: none;
    border-bottom: 1px solid theme('colors.brand.400 / 45%');
  }

  .doc-prose a:hover {
    color: theme('colors.brand.300');
    border-bottom-color: theme('colors.brand.300 / 80%');
  }

  .doc-prose a:focus-visible {
    outline: 1px solid theme('colors.brand.400');
    outline-offset: 3px;
  }

  .doc-prose ul,
  .doc-prose ol {
    padding-left: 1.5rem;
  }

  .doc-prose li {
    margin: 0.45rem 0;
  }

  .doc-prose li::marker {
    color: #60a5fa;
  }

  .doc-prose hr {
    margin: 3rem 0;
    border: 0;
    border-top: 1px solid rgba(71, 85, 105, 0.5);
  }

  .doc-prose blockquote {
    margin: 1.75rem 0;
    border-left: 3px solid rgba(96, 165, 250, 0.75);
    background: rgba(30, 33, 40, 0.75);
    padding: 1rem 1.2rem;
    color: #cbd5e1;
  }

  .doc-prose code {
    font-size: 0.85em;
    background: rgba(30, 33, 40, 0.92);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 0.25rem;
    padding: 0.14rem 0.4rem;
  }

  .doc-prose pre {
    overflow-x: auto;
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-radius: 0.5rem;
    background: rgba(30, 33, 40, 0.95);
    padding: 1.25rem 1.35rem;
  }

  .doc-prose pre code {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    color: #e2e8f0;
    line-height: 1.75;
  }

  .doc-prose table {
    width: 100%;
    margin: 1.75rem 0;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-radius: 0.5rem;
  }

  .doc-prose thead th {
    background: rgba(30, 33, 40, 0.96);
    color: #e2e8f0;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.85rem 1rem;
  }

  .doc-prose tbody td {
    padding: 0.85rem 1rem;
    border-top: 1px solid rgba(71, 85, 105, 0.35);
  }

  .doc-prose img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2rem auto;
    border-radius: 0.5rem;
    border: 1px solid rgba(71, 85, 105, 0.45);
  }

  .doc-prose iframe {
    width: 100%;
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-radius: 0.5rem;
    background: rgba(30, 33, 40, 0.92);
  }

  @media (max-width: 640px) {
    .doc-prose {
      font-size: 0.95rem;
    }

    .doc-prose h2 {
      font-size: 1.45rem;
    }

    .doc-prose h3 {
      font-size: 1.15rem;
    }

    .doc-prose table {
      display: block;
      overflow-x: auto;
      white-space: nowrap;
    }
  }
}
