/* NrdWiki - Main Styles */

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

/* ===== Base ===== */
* {
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    background-color: #f8fafc;
}

.dark body {
    background-color: #0f172a;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Exo 2', sans-serif;
}

/* ===== Article Content ===== */
.article-content h1 {
    font-size: 2.25em;
    font-weight: 800;
    margin: 2rem 0 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #14b8a6;
    color: #1e293b;
}

.article-content h2 {
    font-size: 1.75em;
    font-weight: 700;
    margin: 1.5rem 0 1rem;
    color: #1e293b;
}

.article-content h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem;
    color: #334155;
}

.article-content p {
    margin: 1.25rem 0;
    line-height: 1.8;
    font-size: 1.05em;
    color: #334155;
}

.article-content a {
    color: #0d9488;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
}

.article-content a:hover {
    border-bottom-color: #0d9488;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.article-content li {
    margin: 0.5rem 0;
    line-height: 1.7;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0 0.25rem 0;
}

/* Image captions - minimal spacing */
.article-content img+em,
.article-content p>em:only-child {
    display: block;
    text-align: center;
    font-size: 0.85em;
    color: #64748b;
    margin: 0 0 1rem 0;
}

.dark .article-content img+em,
.dark .article-content p>em:only-child {
    color: #94a3b8;
}

.article-content blockquote {
    border-left: 4px solid #14b8a6;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #64748b;
}

.article-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.article-content code {
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
}

/* Dark mode article content */
.dark .article-content h1 {
    color: #f8fafc;
    border-bottom-color: #14b8a6;
}

.dark .article-content h2,
.dark .article-content h3 {
    color: #f1f5f9;
}

.dark .article-content p {
    color: #cbd5e1;
}

.dark .article-content a {
    color: #5eead4;
}

.dark .article-content blockquote {
    color: #94a3b8;
}

/* ===== Glass Effect ===== */
.glass {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark .glass {
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== Animations ===== */
.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu {
    display: none;
    transform-origin: top right;
    animation: scaleIn 0.1s ease-out;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-tilt-slow {
    animation: tilt 4s ease-in-out infinite;
}

@keyframes tilt {

    0%,
    100% {
        transform: rotate(-15deg);
    }

    50% {
        transform: rotate(15deg);
    }
}

/* ===== Mobile Search ===== */
.mobile-search-expanded .mobile-logo {
    display: none;
}

.mobile-search-expanded .mobile-search-input {
    display: flex !important;
    flex: 1;
}

/* ===== Toast Notifications ===== */
.copy-toast {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Part Number Highlighting ===== */
.part-number {
    cursor: pointer;
    user-select: all;
}

.part-number:active {
    transform: scale(0.98);
}

/* ===== Telegram Comments Container ===== */
#telegram-comments-container,
.dark #telegram-comments-container,
#telegram-comments,
.dark #telegram-comments {
    opacity: 1 !important;
    background-color: transparent;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.dark #telegram-comments-container,
html.dark #telegram-comments {
    background-color: #15202b !important;
    background: #15202b !important;
}

#telegram-comments iframe {
    border-radius: 0.75rem;
    overflow: hidden;
}

/* ===== Print Styles ===== */
@media print {
    @page {
        size: A4;
        margin: 5mm 8mm 10mm 8mm;
    }

    @page :first {
        margin-top: 8mm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html,
    body {
        background: white !important;
        font-size: 9pt !important;
        line-height: 1.4 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    nav,
    footer,
    .no-print,
    .sidebar-actions,
    #telegram-comments-container,
    .print-site-header,
    .print-site-footer {
        display: none !important;
    }

    .article-content {
        padding: 0 !important;
    }

    .article-content p {
        font-size: 9pt !important;
        margin: 0.5em 0 !important;
    }

    .article-content img {
        max-width: 100% !important;
        page-break-inside: avoid !important;
    }

    .print-article {
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-no-summary {
        display: none !important;
    }

    .print-header {
        padding: 0 !important;
        border-bottom: none !important;
        background: transparent !important;
        margin-bottom: 0.5rem !important;
    }

    .print-header h1 {
        margin: 0 !important;
        padding: 0 !important;
        font-size: 14pt !important;
        text-align: left !important;
    }

    /* Hide top accent line */
    .print-article>div:first-child {
        display: none !important;
    }

    /* Hide videos in print */
    iframe,
    video,
    .video-container,
    .aspect-video {
        display: none !important;
    }

    /* Page breaks */
    h1,
    h2,
    h3 {
        page-break-after: avoid !important;
    }

    p,
    li {
        orphans: 3;
        widows: 3;
    }
}

@media screen {

    .print-site-header,
    .print-site-footer {
        display: none;
    }
}