/* =========================
   Work (scoped)
   ========================= */

.work {
    position: relative;
}

.work .section-head {
    margin-bottom: var(--s-12);
}

/* Grid */
.work-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-6);
}

/* Card */
.work-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--s-6);
    box-shadow: var(--shadow);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
    overflow: hidden;
}

.work-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
}

/* Thumbnail placeholder */
.work-thumb-link {
    display: block;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: var(--s-5);
}

.work-thumb {
    width: 100%;
    aspect-ratio: 16 / 10;   /* keeps all cards consistent */
    height: auto;
    object-fit: cover;       /* the “cropped preview” look */
    display: block;
    transform: scale(1.01);
    transition: transform 180ms ease, filter 180ms ease;
}

.work-card:hover .work-thumb {
    transform: scale(1.04);
    filter: brightness(1.05);
}


/* Title + meta */
.work-card h3 {
    margin-bottom: var(--s-2);
}

.work-meta {
    margin: 0 0 var(--s-4);
    color: var(--muted-2);
    font-size: 0.95rem;
}

/* Bullet points */
.work-points {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--s-6);
    display: grid;
    gap: var(--s-2);
}

.work-points li {
    margin: 0;
    padding-left: 1.25rem;
    position: relative;
    color: var(--muted);
}

.work-points li::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    position: absolute;
    left: 0;
    top: 0.55rem;
    background: rgba(93, 220, 255, 0.85);
}

/* Actions */
.work-actions {
    display: flex;
    gap: var(--s-3);
    flex-wrap: wrap;
}

.work-actions .btn {
    flex: 1 1 auto;
    min-width: 140px;
}

.work-actions .btn-outline {
    flex: 0 0 auto;
}

/* Responsive */
@media (max-width: 1000px) {
    .work-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .work-grid {
        grid-template-columns: 1fr;
    }

    .work-card {
        padding: var(--s-5);
    }

    .work-thumb {
        height: 190px;
    }

    .work-actions .btn {
        width: 100%;
    }
}

.work-thumb {
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease;
}

.work-card:hover .work-thumb {
    transform: scale(1.02);
    filter: brightness(1.05);
}

.work-card.is-featured {
    border-color: rgba(93, 220, 255, 0.45);
    background:
            radial-gradient(600px 200px at 20% 0%, rgba(93, 220, 255, 0.14), transparent 60%),
            rgba(255, 255, 255, 0.04);
}

/* --- Seamless terminal preview (no jump) --- */

.work-thumb-terminal {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.38);
    position: relative;
    overflow: hidden;
}

/* scanlines */
.work-thumb-terminal::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
            repeating-linear-gradient(
                    to bottom,
                    rgba(255, 255, 255, 0.05) 0px,
                    rgba(255, 255, 255, 0.05) 1px,
                    transparent 2px,
                    transparent 6px
            );
    opacity: 0.10;
    pointer-events: none;
}

/* fade top/bottom */
.work-thumb-terminal::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
            to bottom,
            rgba(15, 17, 21, 0.9) 0%,
            transparent 18%,
            transparent 78%,
            rgba(15, 17, 21, 0.95) 100%
    );
    pointer-events: none;
}

.work-thumb-terminal-track {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    animation: terminalScroll 14s linear infinite;
}

/* terminal text */
.work-thumb-terminal-code {
    margin: 0;
    padding: 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.85rem;
    line-height: 1.55;
    color: rgba(120, 255, 165, 0.70);
    text-shadow: 0 0 14px rgba(120, 255, 165, 0.10);
    white-space: pre;
}

/* Seamless loop */
@keyframes terminalScroll {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-50%);
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .work-thumb-terminal-track {
        animation: none;
    }
}

/* Blinking cursor (work card terminal) */
.work-terminal-cursor {
    position: absolute;
    left: 1.1rem;
    bottom: 1.2rem;

    width: 0.65ch;
    height: 1.2em;

    background: rgba(120, 255, 165, 0.65);
    box-shadow: 0 0 14px rgba(120, 255, 165, 0.25);
    border-radius: 2px;

    animation: workCursorBlink 1.1s steps(1) infinite;
    pointer-events: none;
}

@keyframes workCursorBlink {
    50% {
        opacity: 0;
    }
}

/* Reduce motion respect */
@media (prefers-reduced-motion: reduce) {
    .work-terminal-cursor {
        animation: none;
    }
}
