/* ============================================
   PharmVR — watermark + footer counters
   © 2026 Dr. Karthik Thiyagarajan. All rights reserved.
   ============================================ */

/* --- Tiled diagonal watermark across every simulation stage ---------------
   Drawn as a pseudo-element on the stage container, so it survives canvases
   being destroyed and rebuilt by the engines. pointer-events:none keeps the
   simulations fully playable; the mark rides on top of any screen capture. */
.lab2-stage,
.game-stage-wrap,
.canvas-wrap,
.magnifier-frame,
#rabbit-scene .rabbit-container {
    position: relative;
}

.lab2-stage::after,
.game-stage-wrap::after,
.canvas-wrap::after,
.magnifier-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='300' height='180'>\
<text x='0' y='120' transform='rotate(-24 0 120)' font-family='Inter,Segoe UI,sans-serif' \
font-size='26' font-weight='800' fill='rgba(255,255,255,0.085)' letter-spacing='3'>PharmVR</text>\
<text x='4' y='142' transform='rotate(-24 0 120)' font-family='Inter,Segoe UI,sans-serif' \
font-size='10' font-weight='600' fill='rgba(255,255,255,0.065)' letter-spacing='1'>pharmvr.github.io</text>\
</svg>");
    background-repeat: repeat;
    background-size: 300px 180px;
}

/* Lighter mark on the small magnifier so the pupil stays readable */
.magnifier-frame::after { background-size: 210px 126px; opacity: 0.7; }

/* Persistent corner credit badge on the main stages */
.lab2-stage::before,
.game-stage-wrap::before {
    content: "PharmVR © Dr. Karthik Thiyagarajan";
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 41;
    pointer-events: none;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: rgba(255, 255, 255, 0.42);
    background: rgba(8, 13, 24, 0.38);
    border-radius: 6px;
    padding: 3px 8px;
    white-space: nowrap;
}

/* --- Footer counters ----------------------------------------------------- */
.footer-stats {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 18px auto 6px;
}
.footer-stat {
    min-width: 140px;
    padding: 10px 18px;
    border-radius: 12px;
    background: rgba(13, 148, 136, 0.06);
    border: 1px solid rgba(13, 148, 136, 0.18);
}
.footer-stat b {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
}
.footer-stat span {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-light);
}
.footer-stat.is-loading b { opacity: 0.45; }

/* --- DMCA badge ---------------------------------------------------------- */
.dmca-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #be123c;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    text-decoration: none;
}
.dmca-badge:hover { background: #ffe4e6; text-decoration: none; }

@media (max-width: 768px) {
    .footer-stat { min-width: 120px; padding: 8px 14px; }
    .lab2-stage::before, .game-stage-wrap::before { font-size: 0.5rem; }
}

/* --- Footer share: one small button in the corner ------------------------ */
.footer { position: relative; }

.footer-share {
    position: absolute;
    top: 16px;
    right: 18px;
    z-index: 5;
}
.share-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(21, 48, 107, 0.16);
    background: #fff;
    color: #15306B;
    cursor: pointer;
    box-shadow: 0 2px 7px -3px rgba(12, 33, 73, 0.3);
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease,
                box-shadow 0.18s ease;
}
.share-toggle svg { width: 14px; height: 14px; fill: currentColor; display: block; }
.share-toggle:hover,
.share-toggle[aria-expanded="true"] {
    background: #15306B;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px -5px rgba(12, 33, 73, 0.5);
}

/* Popover of networks — only opens when the button is tapped. */
.share-menu {
    position: absolute;
    top: 38px;
    right: 0;
    display: flex;
    gap: 6px;
    padding: 7px 8px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(21, 48, 107, 0.12);
    box-shadow: 0 14px 30px -12px rgba(12, 33, 73, 0.4);
    animation: shareIn 0.18s ease both;
}
.share-menu[hidden] { display: none; }
@keyframes shareIn {
    from { opacity: 0; transform: translateY(-5px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(21, 48, 107, 0.12);
    background: #fff;
    color: #15306B;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.share-btn svg { width: 14px; height: 14px; fill: currentColor; display: block; }
.share-btn:hover { transform: translateY(-1px); color: #fff; text-decoration: none; }
.share-btn.linkedin:hover { background: #0A66C2; border-color: #0A66C2; }
.share-btn.whatsapp:hover { background: #25D366; border-color: #25D366; }
.share-btn.telegram:hover { background: #229ED9; border-color: #229ED9; }
.share-btn.x:hover        { background: #0f1419; border-color: #0f1419; }
.share-btn.facebook:hover { background: #1877F2; border-color: #1877F2; }
.share-btn.email:hover    { background: #0d9488; border-color: #0d9488; }
.share-btn.copy:hover     { background: #15306B; border-color: #15306B; }
.share-btn.copied { background: #0d9488; border-color: #0d9488; color: #fff; }

@media (max-width: 768px) {
    .footer-share { top: 12px; right: 12px; }
    .share-menu { gap: 5px; padding: 6px 7px; }
    .share-btn { width: 26px; height: 26px; }
}

/* --- Experiment directory polish ---------------------------------------- */
.exp-count {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    margin: -6px 0 18px;
    letter-spacing: 0.2px;
}
.exp-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 46px 20px;
    color: var(--text-light);
}
.exp-empty-icon { font-size: 2rem; margin-bottom: 10px; opacity: 0.6; }
.exp-empty p { font-size: 0.92rem; margin-bottom: 16px; }
.exp-empty b { color: var(--navy-700); }

/* Filter tags: let a long row wrap neatly and scroll on a phone */
.filter-tags { flex-wrap: wrap; }
.filter-tag { transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease; }
.filter-tag:hover { transform: translateY(-1px); }

/* Cards: a clearer affordance that an available card is clickable */
.exp-card.available { cursor: pointer; }
.exp-card.available:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

@media (max-width: 768px) {
    .filter-tags {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .filter-tags::-webkit-scrollbar { display: none; }
    .filter-tag { flex: 0 0 auto; }
}
