/* TorqFix Drawings Lightbox v2 — zoom + drag/pan + watermark */
.tf-lb {
    position: fixed;
    inset: 0;
    background: rgba(7, 8, 13, 0.96);
    z-index: 9999;
    display: none;                  /* flex when active (set inline) */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 12px;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.tf-lb-wrap {
    position: relative;
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-width: none;
    max-height: none;
    background: #fff;
    border-radius: 10px;
    padding: 8px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tf-lb-img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
    display: block;
    cursor: zoom-in;
    transition: transform 0.04s linear;
    will-change: transform;
    -webkit-user-drag: none;
}
.tf-lb-img.zoomed { cursor: grab; }

/* Watermark — diagonal "torqfix.com" tile pattern, can't easily be hidden */
.tf-lb-wm {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.06);
    font-weight: 700;
    letter-spacing: 1px;
    transform: rotate(-30deg);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
    overflow: hidden;
    text-transform: lowercase;
}
.tf-lb-wm .wm-row {
    white-space: nowrap;
    line-height: 1.8;
    text-align: center;
}

/* Bottom controls — pill */
.tf-lb-controls {
    position: absolute;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 11;
    background: rgba(20, 22, 30, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 5px;
}
.tf-lb-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    font-size: 1.2rem;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    padding: 0;
}
.tf-lb-btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.18); }
.tf-lb-btn-sm { font-size: 0.95rem; }
.tf-lb-controls .lb-zoom-label {
    color: #fff;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-variant-numeric: tabular-nums;
    min-width: 50px;
    text-align: center;
    justify-content: center;
}

/* Close button — top-right, ALWAYS visible above white wrap (fixed position) */
.tf-lb-close {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(7, 8, 13, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 300;
    cursor: pointer;
    z-index: 10000;
    transition: background 0.15s, transform 0.12s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}
.tf-lb-close:hover { background: rgba(7, 8, 13, 1); transform: scale(1.05); }

/* Helpful hint pill — bottom-left */
.tf-lb-hint {
    position: absolute;
    bottom: 22px;
    left: 22px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    z-index: 11;
    pointer-events: none;
}

/* Drawing thumbnails — inline preview tiles */
.tf-thumb {
    display: block;
    background: #fff;
    border: 1px solid var(--line, rgba(255,255,255,.07));
    border-radius: 10px;
    overflow: hidden;
    cursor: zoom-in;
    transition: border-color 0.15s, transform 0.12s;
    text-decoration: none;
    color: inherit;
    position: relative;
}
.tf-thumb:hover {
    border-color: var(--acc, #f59e0b);
    transform: translateY(-1px);
    text-decoration: none;
}
.tf-thumb img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    display: block;
    background: #fff;
    padding: 6px;
    box-sizing: border-box;
    pointer-events: none; /* prevent ghost image when dragging */
}
.tf-thumb .tf-thumb-meta {
    padding: 8px 10px 10px;
    background: var(--bg-1, #0e1019);
    border-top: 1px solid var(--line, rgba(255,255,255,.07));
}
.tf-thumb .tf-thumb-name {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 11px;
    font-weight: 700;
    color: var(--ink, #ebecf2);
    line-height: 1.2;
    word-break: break-all;
}
.tf-thumb .tf-thumb-sub {
    font-size: 10px;
    color: var(--ink-dim, #9aa0b0);
    margin-top: 2px;
    line-height: 1.2;
}

/* Mobile tweaks */
@media (max-width: 640px) {
    .tf-lb { padding: 6px; }
    .tf-lb-wrap { padding: 6px; width: calc(100vw - 12px); height: calc(100vh - 12px); border-radius: 8px; }
    .tf-lb-close { top: 14px; right: 14px; width: 36px; height: 36px; }
    .tf-lb-controls { bottom: 16px; padding: 4px; }
    .tf-lb-btn { width: 36px; height: 36px; }
    .tf-lb-hint { display: none; }
    .tf-thumb img { height: 80px; }
}
