/*
 * MarginaliaMD - Styles of the rendered document
 *
 * Copyright 2024-2025 Eric Seigne <eric.seigne@cap-rel.fr>
 * License AGPL-3.0-or-later
 *
 * Plain CSS, served as a file rather than inlined in view.php: the page text
 * then starts near the top of the HTML instead of behind 17 kB of styles, and
 * the browser caches it once for the whole portal.
 *
 * Not built by Vite on purpose: the build empties htdocs/assets/, and this
 * sheet must survive a portal running on the CDN fallback.
 */

/* Document content styling - prose for rendered markdown */
#document-content {
    line-height: 1.7;
}

/* Markdown prose styling */
#document-content h1 { font-size: 2em; font-weight: bold; margin: 1em 0 0.5em; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.3em; }
#document-content h2 { font-size: 1.5em; font-weight: bold; margin: 1em 0 0.5em; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.3em; }
#document-content h3 { font-size: 1.25em; font-weight: bold; margin: 1em 0 0.5em; }
#document-content h4 { font-size: 1em; font-weight: bold; margin: 1em 0 0.5em; }
#document-content p { margin: 1em 0; }
#document-content ul { margin: 1em 0; padding-left: 2em; list-style: disc; }
#document-content ol { margin: 1em 0; padding-left: 2em; list-style: decimal; }
#document-content ul ul { list-style: circle; }
#document-content ul ul ul { list-style: square; }
#document-content li { margin: 0.25em 0; }
#document-content blockquote { border-left: 4px solid #d1d5db; margin: 1em 0; padding: 0.5em 1em; color: #6b7280; background: #f9fafb; }
#document-content pre { background: #1f2937; color: #e5e7eb; padding: 1em; border-radius: 0.5em; overflow-x: auto; margin: 1em 0; }
#document-content code { background: #e5e7eb; padding: 0.2em 0.4em; border-radius: 0.25em; font-size: 0.9em; }
#document-content pre code { background: transparent; padding: 0; }
#document-content a { color: #3b82f6; text-decoration: underline; }
#document-content img { max-width: 100%; max-height: 400px; height: auto; margin: 1em 0; cursor: zoom-in; border-radius: 0.375rem; transition: opacity 0.2s; }
#document-content img:hover { opacity: 0.85; }

/* Lightbox overlay */
.lightbox-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.85);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: zoom-out;
    animation: lightbox-fade-in 0.2s ease;
}
@keyframes lightbox-fade-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox-overlay img {
    max-width: 90vw; max-height: 80vh; object-fit: contain;
    border-radius: 0.5rem; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    cursor: default;
}
.lightbox-caption {
    color: #e5e7eb; font-size: 0.95rem; margin-top: 0.75rem;
    max-width: 90vw; text-align: center; line-height: 1.4;
}
.lightbox-close {
    position: absolute; top: 1rem; right: 1rem;
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    width: 2.5rem; height: 2.5rem; border-radius: 50%;
    font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
#document-content table { border-collapse: collapse; width: 100%; margin: 1em 0; }
#document-content th, #document-content td { border: 1px solid #d1d5db; padding: 0.5em 1em; text-align: left; }
#document-content th { background: #f3f4f6; font-weight: bold; }
#document-content hr { border: none; border-top: 1px solid #e5e7eb; margin: 2em 0; }

.dark #document-content h1, .dark #document-content h2 { border-bottom-color: #374151; }
.dark #document-content blockquote { border-left-color: #4b5563; background: #1f2937; color: #9ca3af; }
.dark #document-content code { background: #374151; }
.dark #document-content th { background: #374151; }
.dark #document-content th, .dark #document-content td { border-color: #4b5563; }

/* Mermaid diagram styling */
#document-content .mermaid { text-align: center; margin: 1rem 0; }
#document-content .mermaid svg { max-width: 100%; height: auto; }

/* Annotation highlight styling */
.annotation-highlight {
    background-color: rgba(255, 235, 59, 0.4);
    cursor: pointer;
    border-radius: 2px;
}

.annotation-highlight:hover {
    background-color: rgba(255, 235, 59, 0.6);
}

.dark .annotation-highlight {
    background-color: rgba(255, 235, 59, 0.3);
}

.dark .annotation-highlight:hover {
    background-color: rgba(255, 235, 59, 0.5);
}

/* Scrollbar styling */
#annotations-sidebar::-webkit-scrollbar {
    width: 6px;
}

#annotations-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#annotations-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

.dark #annotations-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(107, 114, 128, 0.5);
}
