/* Custom styles for markdown preview and animations */

/* Category sections with headers */
.category-section {
    animation: fadeIn 0.6s ease-out backwards;
    margin-bottom: 3rem;
}

.category-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
}

.category-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #F5F5F0;
    letter-spacing: -0.025em;
    margin: 0;
    background: linear-gradient(135deg, #F5F5F0 0%, #D4AF37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.category-count {
    font-size: 0.875rem;
    font-weight: 500;
    color: #8A8A8A;
    padding: 0.375rem 0.875rem;
    background: #111111;
    border: 1px solid #2A2A2A;
    border-radius: 9999px;
    white-space: nowrap;
}

.category-divider {
    height: 2px;
    background: linear-gradient(90deg, 
        #D4AF37 0%, 
        #2A2A2A 15%, 
        #2A2A2A 85%, 
        transparent 100%
    );
    margin-bottom: 2rem;
    border-radius: 9999px;
    position: relative;
}

.category-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(90deg, #D4AF37, transparent);
    border-radius: 9999px;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* Category button base styles (fallback) */
.category-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background-color: transparent;
    color: #B4B4B4;
    border: 1px solid #2A2A2A;
    cursor: pointer;
    white-space: nowrap;
}

.category-btn:hover {
    background-color: #1A1A1A;
    color: #E8E6E1;
    border-color: #D4AF37;
    transform: translateY(-2px);
}

.category-btn.active {
    background-color: #D4AF37 !important;
    color: #0A0A0A !important;
    border-color: #D4AF37 !important;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3) !important;
    font-weight: 600 !important;
    transform: scale(1.05) !important;
}

.category-btn.active:hover {
    background-color: #C9A961 !important;
    color: #0A0A0A !important;
    border-color: #C9A961 !important;
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.4) !important;
    transform: scale(1.08) !important;
}

/* Markdown preview styling */
.preview-content {
    color: #E8E6E1;
    line-height: 1.625;
}

.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
    color: #F5F5F0;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.preview-content h1 {
    font-size: 1.875rem;
    border-bottom: 1px solid #2A2A2A;
    padding-bottom: 0.75rem;
}

.preview-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #2A2A2A;
    padding-bottom: 0.5rem;
}

.preview-content h3 {
    font-size: 1.25rem;
}

.preview-content h4 {
    font-size: 1.125rem;
}

.preview-content p {
    margin-bottom: 1rem;
}

.preview-content code {
    background-color: #1A1A1A;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    color: #D4AF37;
    font-size: 0.875rem;
    font-family: monospace;
}

.preview-content pre {
    background-color: #1A1A1A;
    border: 1px solid #2A2A2A;
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.preview-content pre code {
    background-color: transparent;
    padding: 0;
    color: #E8E6E1;
}

.preview-content blockquote {
    border-left: 4px solid #D4AF37;
    padding-left: 1rem;
    margin-left: 0;
    color: #B4B4B4;
    font-style: italic;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.preview-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
}

.preview-content table th,
.preview-content table td {
    border: 1px solid #2A2A2A;
    padding: 0.75rem;
    text-align: left;
}

.preview-content table th {
    background-color: #1A1A1A;
    font-weight: 600;
}

.preview-content ul,
.preview-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.preview-content li {
    margin-bottom: 0.25rem;
}

.preview-content a {
    color: #D4AF37;
    text-decoration: none;
    transition: color 0.2s;
}

.preview-content a:hover {
    text-decoration: underline;
}

.preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.preview-content hr {
    border: 0;
    border-top: 1px solid #2A2A2A;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.preview-content del {
    text-decoration: line-through;
    color: #8A8A8A;
}

/* Task lists (checkboxes) */
.preview-content input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

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

.preview-content ul li {
    position: relative;
}

/* Task list items */
.preview-content li input[type="checkbox"] {
    position: relative;
    top: 2px;
}

/* Highlighted text */
.preview-content mark {
    background-color: rgba(250, 204, 21, 0.3);
    color: #F5F5F0;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

/* Code syntax highlighting integration */
.preview-content pre code.hljs {
    display: block;
    overflow-x: auto;
    padding: 0;
    background: transparent;
}

/* KaTeX math formulas */
.preview-content .katex {
    font-size: 1.05em;
}

.preview-content .katex-display {
    margin: 1rem 0;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Definition lists */
.preview-content dl {
    margin-bottom: 1rem;
}

.preview-content dt {
    font-weight: 600;
    color: #F5F5F0;
    margin-top: 1rem;
}

.preview-content dd {
    margin-left: 2rem;
    margin-bottom: 0.5rem;
    color: #B4B4B4;
}

/* Footnotes */
.preview-content .footnote-ref {
    vertical-align: super;
    font-size: 0.75em;
    color: #D4AF37;
}

.preview-content .footnotes {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #2A2A2A;
    font-size: 0.875rem;
}

/* Ensure code blocks inside pre have proper styling */
.preview-content pre > code {
    display: block;
    padding: 0 !important;
    background: transparent !important;
}

/* Better spacing for nested lists */
.preview-content ul ul,
.preview-content ol ul,
.preview-content ul ol,
.preview-content ol ol {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Fix for checklist styling */
.preview-content li:has(input[type="checkbox"]) {
    list-style-type: none;
    margin-left: -1.5rem;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
    }
    50% {
        box-shadow: 0 0 30px rgba(212, 175, 55, 0.25);
    }
}

.toast {
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-container input:focus {
    animation: glow 2s ease-in-out infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0A0A0A;
}

::-webkit-scrollbar-thumb {
    background: #2A2A2A;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3A3A3A;
}

/* Smooth transitions */
* {
    transition-duration: 0.3s;
    transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

button, a {
    transition-duration: 0.2s;
}

/* Card fade-in on load */
article {
    animation: fadeIn 0.5s ease-out backwards;
}

article:nth-child(1) { animation-delay: 0.05s; }
article:nth-child(2) { animation-delay: 0.1s; }
article:nth-child(3) { animation-delay: 0.15s; }
article:nth-child(4) { animation-delay: 0.2s; }
article:nth-child(5) { animation-delay: 0.25s; }
article:nth-child(6) { animation-delay: 0.3s; }
