/* Bollwerk AI Blog - Shared Styles */

/* Base */
body {
    background-color: #000;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 4px 4px;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Glitch Effect */
.glitch-wrapper {
    position: relative;
    display: inline-grid;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.glitch-wrapper .glitch-layer, .glitch-wrapper .glitch-base { grid-area: 1 / 1 / 2 / 2; }
.glitch-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease-in-out;
}
.glitch-wrapper:hover .glitch-layer { opacity: 1; }
.glitch-wrapper:hover .glitch-layer:nth-of-type(2) {
    filter: hue-rotate(220deg) contrast(200%);
    animation: glitch-anim-1 400ms infinite linear alternate-reverse;
}
.glitch-wrapper:hover .glitch-layer:nth-of-type(3) {
    filter: hue-rotate(90deg) contrast(200%);
    animation: glitch-anim-2 350ms infinite linear alternate-reverse;
}
@keyframes glitch-anim-1 {
    0% { clip-path: inset(30% 0 60% 0); transform: translate(-1px, 1px); }
    20% { clip-path: inset(90% 0 2% 0); transform: translate(1px, -1px); }
    40% { clip-path: inset(45% 0 45% 0); transform: translate(1px, 1px); }
    60% { clip-path: inset(15% 0 75% 0); transform: translate(-1px, -1px); }
    80% { clip-path: inset(70% 0 5% 0); transform: translate(-1px, 1px); }
    100% { clip-path: inset(40% 0 30% 0); transform: translate(1px, -1px); }
}
@keyframes glitch-anim-2 {
    0% { clip-path: inset(80% 0 5% 0); transform: translate(2px, -2px); }
    20% { clip-path: inset(10% 0 85% 0); transform: translate(-2px, 2px); }
    40% { clip-path: inset(55% 0 20% 0); transform: translate(2px, 2px); }
    60% { clip-path: inset(30% 0 60% 0); transform: translate(-2px, -2px); }
    80% { clip-path: inset(90% 0 2% 0); transform: translate(2px, -2px); }
    100% { clip-path: inset(50% 0 30% 0); transform: translate(-2px, 2px); }
}

/* Prose/content styles - Dark mode (default) */
.prose-blog h1, .prose-blog h2, .prose-blog h3, 
.prose-blog h4, .prose-blog h5 { color: white; }
.prose-blog h6 { color: #d1d5db; }
.prose-blog p, .prose-blog ul, .prose-blog ol, 
.prose-blog li { color: #d1d5db; }
.prose-blog a { color: #60a5fa; }
.prose-blog a:hover { color: #93c5fd; }
.prose-blog code { background: #1f2937; color: #f3f4f6; }
.prose-blog pre { background: #272822; border: none; }
.prose-blog pre code { color: #f8f8f2; }
.prose-blog blockquote { border-left-color: #4b5563; color: #9ca3af; }
.prose-blog hr { border-color: #374151; }
.prose-blog strong { color: white; }

/* Base prose styles */
.prose-blog h1 { font-size: 2.25rem; font-weight: 700; margin-bottom: 1.5rem; letter-spacing: -0.02em; }
.prose-blog h2 { font-size: 1.5rem; font-weight: 600; margin-top: 2.5rem; margin-bottom: 1rem; }
.prose-blog h3 { font-size: 1.25rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.75rem; }
.prose-blog h4 { font-size: 1.125rem; font-weight: 600; margin-top: 1.75rem; margin-bottom: 0.5rem; }
.prose-blog h5 { font-size: 1rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.prose-blog h6 { font-size: 0.875rem; font-weight: 600; margin-top: 1.25rem; margin-bottom: 0.5rem; }
.prose-blog p { margin-bottom: 1.25rem; line-height: 1.8; }
.prose-blog ul, .prose-blog ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.prose-blog li { margin-bottom: 0.5rem; line-height: 1.7; }
.prose-blog ul { list-style-type: disc; }
.prose-blog ol { list-style-type: decimal; }
.prose-blog ul.nested { 
    margin-left: 1.5rem; 
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    list-style-type: circle;
}
.prose-blog ul.nested li { margin-bottom: 0.25rem; }

/* Table of contents styling */
.prose-blog ol.toc {
    list-style: none;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    counter-reset: toc-counter;
    background: linear-gradient(135deg, rgba(31, 41, 55, 0.5) 0%, rgba(17, 24, 39, 0.8) 100%);
    border: 1px solid #374151;
}
.prose-blog ol.toc li {
    counter-increment: toc-counter;
    position: relative;
    padding: 0.6rem 0 0.6rem 2rem;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(107, 114, 128, 0.2);
}
.prose-blog ol.toc li:last-child { border-bottom: none; padding-bottom: 0; }
.prose-blog ol.toc li:first-child { padding-top: 0; }
.prose-blog ol.toc li::before {
    content: counter(toc-counter);
    position: absolute;
    left: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: #374151;
    color: #9ca3af;
}
.prose-blog ol.toc .anchor-link {
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
    color: #93c5fd;
}
.prose-blog ol.toc .anchor-link:hover { color: #bfdbfe; }

/* Anchor links */
.anchor-link { cursor: pointer; }
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 2rem; }

.prose-blog a { text-decoration: underline; }
.prose-blog code { padding: 0.2em 0.4em; border-radius: 4px; font-size: 0.9em; }
.prose-blog pre { padding: 1.25rem; border-radius: 8px; overflow-x: auto; margin-bottom: 1.5rem; }
.prose-blog pre code { background: transparent; padding: 0; font-size: 0.875rem; }
.prose-blog blockquote { border-left: 3px solid; padding-left: 1rem; margin: 1.5rem 0; font-style: italic; }
.prose-blog img { max-width: 100%; border-radius: 8px; margin: 1.5rem 0; }
.prose-blog hr { margin: 2rem 0; }
.prose-blog strong { font-weight: 600; }

/* Mermaid diagram container */
.mermaid {
    display: flex;
    justify-content: center;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}
.mermaid svg { max-width: 100%; height: auto; }

/* Force black text in mermaid */
.mermaid span[class*="nodeLabel"],
.mermaid foreignObject span,
.mermaid foreignObject div,
.mermaid foreignObject p,
.mermaid .nodeLabel,
.mermaid .label,
.mermaid .edgeLabel span,
.mermaid .cluster-label span {
    color: #000000 !important;
    fill: #000000 !important;
}
.mermaid text,
.mermaid .node text,
.mermaid tspan {
    fill: #000000 !important;
}
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon,
.mermaid .node path {
    fill: #e5e7eb !important;
    stroke: #6b7280 !important;
}
.mermaid .cluster rect {
    fill: #1f2937 !important;
    stroke: #374151 !important;
}
.mermaid .edgeLabel rect {
    fill: #1f2937 !important;
}

/* Code syntax highlighting - Monokai theme */
.prose-blog pre {
    background: #272822;
    border: none;
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}
.prose-blog pre code {
    background: transparent;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.7;
    color: #f8f8f2;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    text-shadow: none;
}
/* Inline code */
.prose-blog code:not(pre code) {
    background: #3e3d32;
    color: #f8f8f2;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.875em;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
}

/* Syntax highlighting - Monokai */
.hljs { background: #272822 !important; color: #f8f8f2 !important; }
pre.hljs, pre code.hljs { background: #272822 !important; }
.hljs-comment, .hljs-quote { color: #75715e !important; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-type { color: #f92672 !important; }
.hljs-string, .hljs-attr { color: #e6db74 !important; }
.hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable { color: #ae81ff !important; }
.hljs-function, .hljs-title, .hljs-title.function_ { color: #a6e22e !important; }
.hljs-class .hljs-title, .hljs-title.class_ { color: #a6e22e !important; }
.hljs-name, .hljs-selector-id, .hljs-selector-class { color: #f92672 !important; }
.hljs-built_in, .hljs-builtin-name { color: #66d9ef !important; font-style: italic; }
.hljs-meta, .hljs-meta-keyword { color: #75715e !important; }
.hljs-params { color: #fd971f !important; }
.hljs-symbol, .hljs-bullet, .hljs-link { color: #ae81ff !important; }
.hljs-property { color: #66d9ef !important; }
.hljs-regexp { color: #e6db74 !important; }
.hljs-tag .hljs-name { color: #f92672 !important; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: bold; }

/* Code block wrapper with header and copy button */
.code-block-wrapper {
    margin: 1.75rem 0;
    border-radius: 12px;
    overflow: hidden;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.code-block-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.window-dots {
    display: flex;
    gap: 6px;
}
.window-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.window-dot.red { background: #ff5f57; }
.window-dot.yellow { background: #febc2e; }
.window-dot.green { background: #28c840; }
.code-block-lang {
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}
.copy-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #888;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.copy-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}
.copy-button:active {
    transform: translateY(0);
}
.copy-button.copied {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    border-color: rgba(74, 222, 128, 0.3);
}
.copy-button svg {
    width: 13px;
    height: 13px;
}
.code-block-wrapper pre {
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background: #1a1a1a !important;
}
.code-block-wrapper pre code {
    display: block;
    padding: 1.25rem 1.5rem !important;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.75;
    tab-size: 2;
}
.code-block-wrapper pre code::-webkit-scrollbar {
    height: 8px;
}
.code-block-wrapper pre code::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}
.code-block-wrapper pre code::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.code-block-wrapper pre code::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Light mode styles */
.light-mode,
.blog-light {
    background-color: #fff !important;
    background-image: none !important;
}
.light-mode .text-white,
.blog-light .text-white { color: #111827 !important; }
.light-mode .text-gray-400,
.blog-light .text-gray-400 { color: #6b7280 !important; }
.light-mode .text-gray-500,
.blog-light .text-gray-500 { color: #6b7280 !important; }
.light-mode .border-gray-800,
.blog-light .border-gray-800 { border-color: #e5e7eb !important; }
.light-mode .border-gray-800\/50,
.blog-light .border-gray-800\/50 { border-color: rgba(229, 231, 235, 0.5) !important; }
.light-mode .bg-gray-800,
.blog-light .bg-gray-800 { background-color: #f3f4f6 !important; }
.light-mode .hover\:bg-gray-800:hover,
.blog-light .hover\:bg-gray-800:hover { background-color: #f3f4f6 !important; }
.light-mode .hover\:text-white:hover,
.blog-light .hover\:text-white:hover { color: #111827 !important; }

/* Light mode prose */
.light-mode .prose-blog h1, .light-mode .prose-blog h2, .light-mode .prose-blog h3,
.light-mode .prose-blog h4, .light-mode .prose-blog h5, .light-mode .prose-blog strong,
.blog-light .prose-blog h1, .blog-light .prose-blog h2, .blog-light .prose-blog h3,
.blog-light .prose-blog h4, .blog-light .prose-blog h5, .blog-light .prose-blog strong { color: #111827 !important; }
.light-mode .prose-blog h6, .light-mode .prose-blog p, .light-mode .prose-blog ul,
.light-mode .prose-blog ol, .light-mode .prose-blog li,
.blog-light .prose-blog h6, .blog-light .prose-blog p, .blog-light .prose-blog ul,
.blog-light .prose-blog ol, .blog-light .prose-blog li { color: #374151 !important; }
.light-mode .prose-blog a,
.blog-light .prose-blog a { color: #2563eb !important; }
.light-mode .prose-blog a:hover,
.blog-light .prose-blog a:hover { color: #1d4ed8 !important; }
.light-mode .prose-blog code:not(pre code),
.blog-light .prose-blog code:not(pre code) { background: #f3f4f6 !important; color: #1f2937 !important; }
.light-mode .prose-blog blockquote,
.blog-light .prose-blog blockquote { border-left-color: #d1d5db !important; color: #6b7280 !important; }
.light-mode .prose-blog hr,
.blog-light .prose-blog hr { border-color: #e5e7eb !important; }

/* Light mode TOC */
.light-mode .prose-blog ol.toc,
.blog-light .prose-blog ol.toc { background: linear-gradient(135deg, rgba(249, 250, 251, 0.9) 0%, rgba(243, 244, 246, 1) 100%) !important; border-color: #e5e7eb !important; }
.light-mode .prose-blog ol.toc li,
.blog-light .prose-blog ol.toc li { border-bottom-color: rgba(209, 213, 219, 0.5) !important; }
.light-mode .prose-blog ol.toc li::before,
.blog-light .prose-blog ol.toc li::before { background: #e5e7eb !important; color: #6b7280 !important; }
.light-mode .prose-blog ol.toc .anchor-link,
.blog-light .prose-blog ol.toc .anchor-link { color: #2563eb !important; }
.light-mode .prose-blog ol.toc .anchor-link:hover,
.blog-light .prose-blog ol.toc .anchor-link:hover { color: #1d4ed8 !important; }

/* Light mode mermaid */
.light-mode .mermaid,
.blog-light .mermaid { background: #ffffff !important; border-color: #e5e7eb !important; }
.light-mode .mermaid .node rect, .light-mode .mermaid .node circle,
.light-mode .mermaid .node ellipse, .light-mode .mermaid .node polygon,
.light-mode .mermaid .node path,
.blog-light .mermaid .node rect, .blog-light .mermaid .node circle,
.blog-light .mermaid .node ellipse, .blog-light .mermaid .node polygon,
.blog-light .mermaid .node path { fill: #dbeafe !important; stroke: #3b82f6 !important; }

/* Light mode code blocks */
.light-mode .code-block-wrapper,
.blog-light .code-block-wrapper { background: #f8f8f8 !important; border-color: #e5e7eb !important; }
.light-mode .code-block-header,
.blog-light .code-block-header { background: linear-gradient(180deg, #f3f4f6 0%, #e5e7eb 100%) !important; border-bottom-color: #d1d5db !important; }
.light-mode .code-block-wrapper pre,
.blog-light .code-block-wrapper pre { background: #f8f8f8 !important; }
.light-mode .code-block-wrapper pre code,
.blog-light .code-block-wrapper pre code { color: #1f2937 !important; }
.light-mode .hljs,
.blog-light .hljs { background: #f8f8f8 !important; color: #1f2937 !important; }
.light-mode pre.hljs, .light-mode pre code.hljs,
.blog-light pre.hljs, .blog-light pre code.hljs { background: #f8f8f8 !important; }

/* Light mode syntax highlighting - GitHub-inspired */
.light-mode .hljs-comment, .light-mode .hljs-quote,
.blog-light .hljs-comment, .blog-light .hljs-quote { color: #6a737d !important; }
.light-mode .hljs-keyword, .light-mode .hljs-selector-tag, .light-mode .hljs-type,
.blog-light .hljs-keyword, .blog-light .hljs-selector-tag, .blog-light .hljs-type { color: #d73a49 !important; }
.light-mode .hljs-string, .light-mode .hljs-attr,
.blog-light .hljs-string, .blog-light .hljs-attr { color: #032f62 !important; }
.light-mode .hljs-number, .light-mode .hljs-literal,
.blog-light .hljs-number, .blog-light .hljs-literal { color: #005cc5 !important; }
.light-mode .hljs-function, .light-mode .hljs-title,
.blog-light .hljs-function, .blog-light .hljs-title { color: #6f42c1 !important; }
.light-mode .hljs-built_in,
.blog-light .hljs-built_in { color: #005cc5 !important; }
.light-mode .copy-button,
.blog-light .copy-button { color: #6b7280 !important; background: rgba(0, 0, 0, 0.05) !important; border-color: rgba(0, 0, 0, 0.1) !important; }
.light-mode .copy-button:hover,
.blog-light .copy-button:hover { color: #111827 !important; background: rgba(0, 0, 0, 0.1) !important; }
.light-mode .code-block-lang,
.blog-light .code-block-lang { color: #6b7280 !important; background: rgba(0, 0, 0, 0.05) !important; }

