/* =========================================================================
   10-projects.css — Project filter + AI project card UX upgrade
   Non-destructive overlay. Load AFTER style.css. Bewerkt geen bestaande regels.
   ========================================================================= */

/* Forceer dat verborgen cards (legacy pagination + filter) GEEN ruimte pakken. */
.ai-project-card.hidden,
.ai-project-card.is-filtered-out {
    display: none !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
}

/* Clean 'Mijn Projecten' heading - sans-serif white met strakke mint caret */
.typing-heading {
    font-family: 'Inter', 'Helvetica Neue', system-ui, sans-serif !important;
    font-size: clamp(1.75rem, 3vw, 2.5rem) !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    background: none !important;
    -webkit-text-fill-color: #ffffff !important;
    letter-spacing: -0.025em !important;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin: 0 auto !important;
    text-align: left;
    text-shadow: none;
}

body.light-theme .typing-heading {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

body.light-theme .typing-heading .typing-caret {
    background: #3b82f6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

.typing-heading .typing-text {
    position: relative;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: max-content;
    /* Animation uitgezet - was rommelig met de width:0 -> 14ch transitie.
       Statisch maar mooi. */
}

.typing-heading .typing-caret {
    display: inline-block;
    width: 2px;
    height: 0.75em;
    background: #2ef2a0;
    box-shadow: 0 0 6px rgba(46, 242, 160, 0.5);
    animation: typingCaret 1s steps(2, jump-none) infinite;
    margin-left: 0.12em;
    border-radius: 1px;
    align-self: center;
    transform: translateY(0.02em);
}

@keyframes typingCaret {
    50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .typing-heading .typing-caret {
        animation: none;
        opacity: 0.7;
    }
}

/* Compactere projects sectie - Robin's feedback "te groot" */
.ai-portfolio-section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

.ai-projects-grid {
    gap: 1rem;
}

.ai-project-card {
    padding: 1.25rem !important;
    min-height: auto !important;
}

.ai-project-card h3 {
    font-size: 1.05rem !important;
    margin-bottom: 0.5rem !important;
}

.ai-project-card p {
    font-size: 0.875rem !important;
    line-height: 1.6 !important;
    margin-bottom: 0 !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

/* LIGHT THEME — donkere tekst op cards, anders wit-op-wit onleesbaar */
body.light-theme .ai-project-card p {
    color: rgba(15, 23, 42, 0.78) !important;
}

body.light-theme .ai-project-card h3 {
    color: #0c1422 !important;
}

body.light-theme .ai-project-card {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

body.light-theme .ai-project-card .project-tags span {
    background: rgba(15, 23, 42, 0.04) !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
    color: rgba(15, 23, 42, 0.7) !important;
}

body.light-theme .ai-project-card .project-kicker {
    background: rgba(15, 23, 42, 0.04) !important;
    color: rgba(15, 23, 42, 0.55) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
}

body.light-theme .ai-project-card strong {
    color: #0c1422 !important;
}

/* Filter buttons light theme - dark text op witte glass */
body.light-theme .project-filters {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
}

body.light-theme .filter-btn {
    color: rgba(15, 23, 42, 0.65) !important;
    background: transparent !important;
}

body.light-theme .filter-btn.active {
    background: #0c1422 !important;
    color: #ffffff !important;
}

.ai-project-card .project-tags {
    margin-top: 1rem !important;
    padding-top: 1rem !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

body.light-theme .ai-project-card .project-tags {
    border-top-color: rgba(15, 23, 42, 0.08) !important;
}

/* Grid gap iets compacter zodat cards visueel als groep aanvoelen */
.ai-projects-grid {
    gap: 1.25rem !important;
}

/* ---------- Filter bar: dark glass pill container ---------- */
.project-filters {
    position: relative;
    padding: 0.45rem;
    border-radius: 999px;
    background: rgba(2, 8, 18, 0.65);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 18px 40px -24px rgba(0, 0, 0, 0.6);
    width: max-content;
    max-width: 100%;
    margin: 0 auto 2.5rem;
    gap: 0.35rem;
}

body.light-theme .project-filters {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 12px 30px -18px rgba(15, 23, 42, 0.2);
}

/* Mobile: horizontal scroll-snap */
@media (max-width: 720px) {
    .project-filters {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -ms-overflow-style: none;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding: 0.35rem;
    }
    .project-filters::-webkit-scrollbar { display: none; }
    .project-filters .filter-btn {
        scroll-snap-align: start;
        flex: 0 0 auto;
    }
}

/* ---------- Filter buttons ---------- */
.project-filters .filter-btn {
    position: relative;
    padding: 0.5rem 1rem;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.62);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    cursor: pointer;
    transition:
        color 220ms ease,
        background-color 220ms ease,
        border-color 220ms ease,
        transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

body.light-theme .project-filters .filter-btn {
    color: rgba(15, 23, 42, 0.65);
    border-color: rgba(15, 23, 42, 0.08);
}

.project-filters .filter-btn:hover {
    color: var(--accent-primary, #5eead4);
    border-color: rgba(94, 234, 212, 0.45);
    background: rgba(94, 234, 212, 0.04);
    transform: translateY(-1px);
}

.project-filters .filter-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.45);
}

/* Active state — solid mint, dark text, gentle pop */
.project-filters .filter-btn.active,
.project-filters .filter-btn.is-active {
    color: #021018;
    background: var(--accent-primary, #5eead4);
    border-color: var(--accent-primary, #5eead4);
    transform: scale(1.02);
    box-shadow:
        0 6px 18px -10px rgba(94, 234, 212, 0.7),
        0 1px 0 rgba(255, 255, 255, 0.4) inset;
}

/* Active underline-progress sweep */
.project-filters .filter-btn::after {
    content: "";
    position: absolute;
    left: 14%;
    right: 14%;
    bottom: 4px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg,
        rgba(2, 16, 24, 0.0),
        rgba(2, 16, 24, 0.85),
        rgba(2, 16, 24, 0.0));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    opacity: 0;
}

.project-filters .filter-btn.active::after,
.project-filters .filter-btn.is-active::after {
    transform: scaleX(1);
    opacity: 1;
}

/* ---------- Filtered card collapse ---------- */
/* Smooth collapse instead of display:none flash */
.ai-project-card.is-filtered-out {
    transform: scale(0.92);
    opacity: 0;
    max-height: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
    overflow: hidden;
    pointer-events: none;
    transition:
        transform 350ms cubic-bezier(0.4, 0, 0.2, 1),
        opacity 280ms ease,
        max-height 380ms cubic-bezier(0.4, 0, 0.2, 1),
        margin 380ms cubic-bezier(0.4, 0, 0.2, 1),
        padding 380ms cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-project-card {
    transform: scale(1);
    opacity: 1;
    transition:
        transform 350ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 280ms ease,
        border-color 280ms ease,
        box-shadow 350ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Grid - hardcoded 3 cols desktop, 2 tablet, 1 mobile.
   Robin's spec: 6 cards default = 3x2 layout, geen 4-in-een-rij. ---------- */
.ai-projects-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.25rem !important;
}

@media (max-width: 960px) {
    .ai-projects-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .ai-projects-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ---------- Card surface ---------- */
.ai-project-card {
    position: relative;
    background: linear-gradient(180deg, rgba(8, 14, 24, 0.78), rgba(2, 8, 18, 0.72));
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

body.light-theme .ai-project-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.85));
    border-color: rgba(15, 23, 42, 0.08);
}

.ai-project-card {
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.35s ease,
                box-shadow 0.35s ease;
    display: flex !important;
    flex-direction: column;
    align-self: stretch;
    height: 100%;
}

/* Tags pinned naar bottom via auto-margin zodat cards in rij gelijke
   hoogte hebben (stretch) zonder visuele lege ruimte tussen text en tags. */
.ai-project-card .project-tags {
    margin-top: auto !important;
}

.ai-project-card:hover {
    transform: translateY(-2px);
    border-color: rgba(46, 242, 160, 0.22);
    box-shadow:
        0 14px 32px -18px rgba(0, 0, 0, 0.45);
}

/* ---------- Icon wrapper: mint-tinted box, 360 spin on hover ---------- */
.ai-project-card .project-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(94, 234, 212, 0.08);
    border: 1px solid rgba(94, 234, 212, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    transition: transform 1200ms cubic-bezier(0.22, 1, 0.36, 1),
                background-color 280ms ease,
                border-color 280ms ease;
}

.ai-project-card .project-icon-wrapper i,
.ai-project-card .project-icon-wrapper svg {
    width: 20px !important;
    height: 20px !important;
    color: #2ef2a0 !important;
    stroke: #2ef2a0 !important;
    fill: none !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-shrink: 0;
}

body.light-theme .ai-project-card .project-icon-wrapper i,
body.light-theme .ai-project-card .project-icon-wrapper svg {
    color: #3b82f6 !important;
    stroke: #3b82f6 !important;
}

.ai-project-card .project-icon-wrapper {
    flex-shrink: 0 !important;
    overflow: visible !important;
}

.ai-project-card:hover .project-icon-wrapper {
    background: rgba(46, 242, 160, 0.12);
    border-color: rgba(46, 242, 160, 0.3);
}

/* ---------- Typography ---------- */
.ai-project-card h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: clamp(1.05rem, 1.05vw + 0.85rem, 1.15rem);
    line-height: 1.3;
    color: #ffffff;
    letter-spacing: -0.005em;
}

body.light-theme .ai-project-card h3 {
    color: #0f172a;
}

.ai-project-card p {
    font-size: 0.85rem;
    line-height: 1.55;
    opacity: 0.8;
}

/* ---------- Tag chips: muted mono ---------- */
.ai-project-card .project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
}

.ai-project-card .project-tags > span {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.28rem 0.55rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);
    background-image: none;
}

body.light-theme .ai-project-card .project-tags > span {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.08);
    color: rgba(15, 23, 42, 0.7);
}

/* ---------- External link icon arrow on linked cards ---------- */
a.ai-project-card::before {
    content: "\2197"; /* north-east arrow */
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.95rem;
    line-height: 1;
    color: rgba(94, 234, 212, 0.8);
    opacity: 0;
    transform: translate(-3px, 3px);
    transition: opacity 280ms ease, transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    z-index: 2;
}

a.ai-project-card:hover::before {
    opacity: 1;
    transform: translate(0, 0);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .ai-project-card,
    .ai-project-card .project-icon-wrapper,
    .project-filters .filter-btn,
    .project-filters .filter-btn::after,
    .ai-project-card.is-filtered-out,
    a.ai-project-card::before {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
    .ai-project-card:hover .project-icon-wrapper {
        transform: none;
    }
}
