/* Copy protection styles - applied when body has .copy-protected class */
.copy-protected {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.copy-protected * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.copy-protected img {
    -webkit-user-drag: none !important;
    user-drag: none !important;
    pointer-events: none !important;
}

.copy-protected ::selection {
    background: transparent !important;
    color: inherit !important;
}

.copy-protected ::-moz-selection {
    background: transparent !important;
    color: inherit !important;
}

/* Specifically target markdown content area */
.copy-protected .markdown-body {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

.copy-protected .markdown-body * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Dynamic watermark overlay */
.watermark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.watermark-overlay .watermark-grid {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    transform: rotate(-30deg);
    opacity: 0.03;
}

.watermark-overlay .watermark-item {
    padding: 2rem 3rem;
    font-size: 0.85rem;
    font-family: monospace;
    color: #000;
    white-space: nowrap;
    line-height: 1;
}

/* Server-side watermark: make block elements positioning containers */
.copy-protected .markdown-body p,
.copy-protected .markdown-body h1,
.copy-protected .markdown-body h2,
.copy-protected .markdown-body h3,
.copy-protected .markdown-body h4,
.copy-protected .markdown-body h5,
.copy-protected .markdown-body h6 {
    position: relative;
    overflow: hidden;
}

html.dark .watermark-overlay .watermark-item {
    color: #fff;
}

/* Blur content on tab switch */
.content-blurred {
    filter: blur(20px) !important;
    transition: filter 0.2s ease;
}

/* Prevent printing content */
@media print {
    .copy-protected .markdown-body {
        display: none !important;
    }
    body.copy-protected::after {
        content: "Printing is not allowed.";
        display: block;
        text-align: center;
        padding: 2rem;
        font-size: 1.5rem;
    }
}
