/*
 * Assessment content protection.
 *
 * Deterrence and attribution for assessment intellectual property shown to
 * non-authoring roles. This stylesheet makes casual capture inconvenient and
 * leaked images attributable; it cannot stop an OS screenshot or a camera.
 */

.hpc-protected {
    position: relative;
    isolation: isolate;
    border: 1px solid var(--workspace-line, #d8e3e8);
    border-radius: 18px;
    background: var(--workspace-card, #fff);
    padding: 1.15rem 1.25rem 0.9rem;
    overflow: hidden;
}

/* Selection, drag and the long-press callout on touch devices. */
.hpc-protected[data-hpc-protect-selection] .hpc-protected__body,
.hpc-protected[data-hpc-protect-selection] .hpc-protected__body * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.hpc-protected__body img,
.hpc-protected__body svg,
.hpc-protected__body canvas,
.hpc-protected__body video {
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* Inputs stay usable - protection must not break a working form. */
.hpc-protected__body input,
.hpc-protected__body textarea,
.hpc-protected__body select,
.hpc-protected__body button,
.hpc-protected__body a {
    -webkit-user-select: auto;
    user-select: auto;
    pointer-events: auto;
}

/* ---------- watermark ---------- */

.hpc-protected__watermark {
    position: absolute;
    inset: -25%;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    gap: 2.6rem 3.2rem;
    transform: rotate(-24deg);
    pointer-events: none;
    user-select: none;
    overflow: hidden;
}

.hpc-protected__watermark span {
    color: rgba(23, 58, 86, 0.13);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
    .hpc-protected__watermark span {
        color: rgba(226, 240, 247, 0.15);
    }
}

/* Participant-runtime-only: the assessment screen is read for long stretches, so the deterrent
   here must stay unobtrusive while remaining legible evidence in a screenshot. Scoped to
   `.par-question` (the participant stage-execution runtime) rather than the shared base rule
   above, which stays as-is for any other future adopter of the protected-content component. */
.par-question.hpc-protected .hpc-protected__watermark {
    gap: 3.6rem 4.6rem;
}

.par-question.hpc-protected .hpc-protected__watermark span {
    color: rgba(23, 58, 86, 0.055);
    font-size: 10.5px;
    font-weight: 400;
    letter-spacing: 0.08em;
}

@media (prefers-color-scheme: dark) {
    .par-question.hpc-protected .hpc-protected__watermark span {
        color: rgba(226, 240, 247, 0.06);
    }
}

.hpc-protected__body {
    position: relative;
    z-index: 1;
}

/* ---------- obscure while unfocused ---------- */

.hpc-protected.is-obscured .hpc-protected__body {
    filter: blur(9px);
    transition: filter 0.12s ease;
}

.hpc-protected.is-obscured::after {
    content: attr(data-hpc-obscured-label);
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(244, 249, 252, 0.72);
    color: #173a56;
    font-size: 0.86rem;
    font-weight: 700;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .hpc-protected.is-obscured .hpc-protected__body {
        transition: none;
    }
}

/* ---------- notice ---------- */

.hpc-protected__notice {
    position: relative;
    z-index: 6;
    margin: 1rem 0 0;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--workspace-line, #d8e3e8);
    color: #7a5a12;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.5;
}

.hpc-protected__print-block {
    display: none;
}

/* ---------- print / save as PDF ---------- */

@media print {
    /* Hide the material, not the container: the print notice lives inside it. */
    .hpc-protected__body,
    .hpc-protected__watermark,
    .hpc-protected__notice {
        display: none !important;
    }

    .hpc-protected {
        border: 0 !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .hpc-protected__print-block {
        display: block !important;
        border: 2px dashed #b3253a;
        border-radius: 10px;
        padding: 1.2rem;
        color: #b3253a;
        font-size: 0.9rem;
    }

    .hpc-protected__print-block strong {
        display: block;
        margin-bottom: 0.35rem;
        font-size: 1rem;
    }

    /* Body-level guard set by the protection script when a print is detected on
       a page that carries protected material. */
    body.hpc-print-blocked * {
        visibility: hidden !important;
    }

    body.hpc-print-blocked .hpc-protected__print-block,
    body.hpc-print-blocked .hpc-protected__print-block * {
        visibility: visible !important;
    }
}

/* When the component IS the host element (a grid child that must stay a <main>,
   for example) the host already carries its own chrome. */
.hpc-protected.hpc-protected--bare {
    border: 0;
    border-radius: inherit;
    background: transparent;
    padding: inherit;
}
