@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap");
@import "tailwindcss";

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

:root {
  --top-nav-height: 141px; /* 105px nav + 36px banner */
  --border-color: #dce6e9;
  --bg-color: theme(colors.zinc.50);
  --bg-secondary: theme(colors.zinc.100);
  --text-color: rgba(60, 66, 87, 1);
  --text-secondary: theme(colors.slate.500);
  --text-link: #5a7ab5;
  --text-brand: #1a1a18;
  --accent-color: theme(colors.indigo.500);
  --accent-hover: theme(colors.indigo.600);
}

.dark {
  --border-color: #3f3f3f;
  --bg-color: #1a1a18;
  --bg-secondary: #33332d;
  --text-color: #a3a3a2;
  --text-header: #e9e9e9;
  --text-secondary: theme(colors.gray.300);
  --text-link: theme(colors.slate.400);
  --text-brand: #f8f674;
  --text-brand-hover: #f8f675;
  --accent-color: #f8f675;
  --accent-hover: #f8f675;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.scrollbar-none {
  scrollbar-width: none; /* Firefox */
}
.scrollbar-none::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    "Noto Sans",
    sans-serif,
    "Apple Color Emoji",
    "Segoe UI Emoji",
    "Segoe UI Symbol",
    "Noto Color Emoji";
  color: var(--text-color);
  background-color: var(--bg-color);
  margin: 0;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

p {
  line-height: 1.5em;
}

.article-content {
  width: 100%;
}

.article-content p {
  margin: 1em 0;
}

.article-content > * {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.font-brand {
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  color: var(--text-brand);
}

h1 {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--text-brand);
}

h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  color: var(--text-header);
  margin: 1em 0 0.5em;
}

h1 {
  font-size: 40px;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 20px;
}

a {
  color: var(--text-link);
}

a:hover {
  color: var(--text-brand-hover);
}

/* Homepage Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.5rem;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 2px solid transparent;
}

.btn-primary {
  background: #f8f674;
  color: #1a1a18 !important;
  border-color: #f8f674;
}

.btn-primary:hover {
  background: #ffff8d;
  border-color: #ffff8d;
  color: #1a1a18 !important;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: #888 !important;
  border: 2px solid #555;
}

.btn-secondary:hover {
  color: #f8f674 !important;
  border-color: #f8f674;
}

/* Terminal Syntax Highlighting */
.terminal-comment {
  color: #6a9955;
}

.terminal-prompt {
  color: #dcdcaa;
}

/* Blockquotes */
.article-content blockquote {
  border-left: 3px solid var(--border-color);
  margin: 1em 0;
  padding: 0.25em 1em;
  color: var(--text-secondary);
  font-style: italic;
}

/* Lists - Override Tailwind's reset to restore default list styling */
.article-content ul,
.article-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
  line-height: 1.75;
}

.article-content ul {
  list-style-type: disc;
}

.article-content ol {
  list-style-type: decimal;
}

.article-content li {
  margin: 0.5em 0;
}

/* ==========================================================================
   Code block base styles
   ========================================================================== */

code[class*="language-"],
pre[class*="language-"] {
  font-family: "JetBrains Mono", Consolas, Monaco, "Andale Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
}

/* ==========================================================================
   Light mode syntax highlighting
   Coordinated with site palette: zinc/slate base, indigo accent
   ========================================================================== */

pre[class*="language-"],
:not(pre) > code[class*="language-"] {
  background: #f4f4f5; /* zinc-100 */
}

code[class*="language-"],
pre[class*="language-"] {
  color: #3c4257; /* matches --text-color */
  text-shadow: none;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #8891a4; /* slate-muted */
}

.token.punctuation {
  color: #64748b; /* slate-500 */
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #b45309; /* amber-700, warm for values */
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #16733e; /* green-700, strings */
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #64748b; /* slate-500, neutral for operators */
  background: none;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #4f46e5; /* indigo-600, matches accent */
}

.token.function,
.token.class-name {
  color: #9333ea; /* purple-600 */
}

.token.regex,
.token.important,
.token.variable {
  color: #b45309; /* amber-700 */
}

/* ==========================================================================
   Dark mode syntax highlighting
   Coordinated with site palette: #1a1a18 base, #f8f674 brand accent
   ========================================================================== */

.dark pre[class*="language-"],
.dark :not(pre) > code[class*="language-"] {
  background: #24241f !important; /* slightly lighter than --bg-color */
}

.dark code[class*="language-"],
.dark pre[class*="language-"] {
  color: #c8c8c6; /* warm neutral base text */
  text-shadow: none;
}

.dark pre[class*="language-"] * {
  text-shadow: none;
}

/* Ensure inline code also has proper color in dark mode */
.dark code {
  color: #c8c8c6;
}

.dark .token.comment,
.dark .token.prolog,
.dark .token.doctype,
.dark .token.cdata {
  color: #6b6b66; /* muted, warm gray */
}

.dark .token.punctuation {
  color: #8a8a85; /* warm mid-gray */
}

.dark .token.property,
.dark .token.tag,
.dark .token.boolean,
.dark .token.number,
.dark .token.constant,
.dark .token.symbol,
.dark .token.deleted {
  color: #e8a862; /* warm amber for values */
}

.dark .token.selector,
.dark .token.attr-name,
.dark .token.string,
.dark .token.char,
.dark .token.builtin,
.dark .token.inserted {
  color: #a8cc7a; /* soft green, strings */
}

.dark .token.operator,
.dark .token.entity,
.dark .token.url,
.dark .language-css .token.string,
.dark .style .token.string {
  color: #8a8a85; /* neutral for operators */
  background: none;
}

.dark .token.atrule,
.dark .token.attr-value,
.dark .token.keyword {
  color: #d4c96b; /* warm yellow, near brand #f8f674 but less saturated */
}

.dark .token.function,
.dark .token.class-name {
  color: #c9a5e8; /* soft purple */
}

.dark .token.regex,
.dark .token.important,
.dark .token.variable {
  color: #e8a862; /* warm amber */
}

/* Mobile Responsive Styles */
@media (max-width: 1024px) {
  /* Hide table of contents on tablet and below */
  .toc-container {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --top-nav-height: 116px; /* 60px nav + 56px banner */
  }

  /* Hide desktop sidenav, show via mobile toggle */
  .sidenav-desktop {
    display: none;
  }

  /* Mobile sidenav overlay */
  .sidenav-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.3s ease,
      visibility 0.3s ease;
  }

  .sidenav-mobile-overlay.open {
    opacity: 1;
    visibility: visible;
  }

  /* Mobile sidenav drawer */
  .sidenav-mobile {
    position: fixed;
    top: var(--top-nav-height);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--top-nav-height));
    background: var(--bg-color);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
  }

  .sidenav-mobile.open {
    transform: translateX(0);
  }

  /* Hide desktop nav items */
  .desktop-nav {
    display: none !important;
  }

  /* Mobile menu button */
  .mobile-menu-btn {
    display: flex !important;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 22px;
  }

  h3 {
    font-size: 18px;
  }
}

/* Hamburger menu icon */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 20px;
  height: 14px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-color);
  border-radius: 1px;
  transition: all 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* DocSearch Styles */
:root {
  --docsearch-primary-color: var(--text-brand);
  --docsearch-text-color: var(--text-secondary);
  --docsearch-spacing: 0.5rem;
  --docsearch-icon-stroke-width: 1.5;
  --docsearch-highlight-color: var(--text-brand);
  --docsearch-muted-color: var(--text-secondary);
  --docsearch-container-background: rgba(0, 0, 0, 0.5);
  --docsearch-modal-background: var(--bg-color);
  --docsearch-modal-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --docsearch-searchbox-height: 2.5rem;
  --docsearch-searchbox-background: var(--bg-secondary);
  --docsearch-searchbox-focus-background: var(--bg-secondary);
  --docsearch-hit-color: var(--text-color);
  --docsearch-hit-active-color: var(--text-color);
  --docsearch-hit-background: var(--bg-secondary);
  --docsearch-hit-shadow: none;
  --docsearch-key-gradient: var(--bg-secondary);
  --docsearch-key-shadow: inset 0 -1px 0 var(--border-color);
  --docsearch-footer-background: var(--bg-color);
  --docsearch-footer-shadow: 0 -1px 0 var(--border-color);
  --docsearch-secondary-text-color: var(--text-color);
  --docsearch-icon-color: var(--text-color);
  --docsearch-logo-color: var(--text-brand);
}

.dark {
  --docsearch-container-background: rgba(0, 0, 0, 0.7);
}

/* DocSearch Button */
.DocSearch-Button {
  margin: 0;
  padding: 0 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  min-width: 200px;
  height: 2rem;
  transition: border-color 0.15s ease;
}

.DocSearch-Button:hover {
  border-color: var(--text-secondary);
  box-shadow: none;
}

.DocSearch-Button-Placeholder {
  font-size: 0.875rem;
}

.DocSearch-Search-Icon {
  width: 1rem;
  height: 1rem;
  color: var(--text-secondary);
}

.DocSearch-Button-Keys {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.DocSearch-Button-Key {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  padding: 0 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: none;
}

/* DocSearch Modal */
.DocSearch-Modal {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.DocSearch-SearchBar {
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem;
}

.DocSearch-Form {
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
}

.DocSearch-Input {
  color: var(--text-color);
  font-size: 1rem;
}

.DocSearch-Input::placeholder {
  color: var(--text-secondary);
}

.DocSearch-Reset {
  color: var(--text-secondary);
}

.DocSearch-Reset:hover {
  color: var(--text-color);
}

.DocSearch-Cancel {
  color: var(--text-secondary);
}

/* DocSearch Hits */
.DocSearch-Dropdown {
  max-height: 60vh;
}

.DocSearch-Hit {
  padding: 0.5rem 0.75rem;
}

.DocSearch-Hit-source {
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.5rem 0.75rem 0.25rem;
  background: transparent;
}

.DocSearch-Hit a {
  background: var(--bg-color);
  border-radius: 0.5rem;
  border: 1px solid transparent;
}

.DocSearch-Hit[aria-selected="true"] a {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.DocSearch-Hit-title {
  color: var(--text-color);
  font-weight: 500;
}

.DocSearch-Hit-path {
  color: var(--text-secondary);
}

.DocSearch-Hit-icon {
  color: var(--text-secondary);
}

.DocSearch-Hit-action {
  color: var(--text-secondary);
}

/* DocSearch Footer */
.DocSearch-Footer {
  background: var(--bg-color);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 0.75rem 0.75rem;
}

.DocSearch-Logo .cls-1,
.DocSearch-Logo .cls-2 {
  fill: var(--text-secondary);
}

/* DocSearch Commands */
.DocSearch-Commands {
  color: var(--text-secondary);
}

.DocSearch-Commands-Key {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  box-shadow: none;
}

/* Tablet responsive */
@media (max-width: 1024px) and (min-width: 769px) {
  .DocSearch-Button {
    min-width: 140px;
  }
}
