/* Project modal — restrained, neutral design shared by every solution card. */
.modal-backdrop {
    padding: 24px;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    display: flex;
    flex-direction: column;
    width: min(900px, 100%);
    max-width: 900px;
    max-height: calc(100vh - 48px);
    padding: 0;
    overflow: hidden;
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.34);
    transform: translateY(18px);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.modal-backdrop.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    --modal-accent: #64748b;
    flex-shrink: 0;
    min-height: 72px;
    padding: 16px 18px 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    position: relative;
    z-index: 10;
    background: var(--bg-card);
    border-top: 3px solid var(--modal-accent);
    border-bottom: 1px solid var(--border-color);
}

.modal-header.card-blue {
    --modal-accent: #0284c7;
}

.modal-header.card-green {
    --modal-accent: #059669;
}

.modal-header.card-orange {
    --modal-accent: #ea580c;
}

.modal-header.card-purple {
    --modal-accent: #7c3aed;
}

.modal-header.card-cyan {
    --modal-accent: #0891b2;
}

.modal-header.card-red {
    --modal-accent: #dc2626;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-main);
    background: none;
    font-size: clamp(20px, 2.2vw, 25px);
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: -0.02em;
    -webkit-background-clip: initial;
    background-clip: initial;
    -webkit-text-fill-color: currentColor;
}

.modal-close {
    position: static;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0 0 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    font-size: 25px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-main);
    background: var(--bg-alt);
    border-color: #94a3b8;
    transform: none;
}

.modal-close:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--modal-accent, #0284c7) 28%, transparent);
    outline-offset: 2px;
}

.modal-scroll-body {
    overflow-y: auto;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

.modal-slider-container {
    height: 300px;
    margin: 24px 24px 0;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: none;
}

.modal-slider {
    display: flex;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.modal-slide {
    min-width: 100%;
    height: 100%;
    object-fit: cover;
}

.slider-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 9px;
    font-size: 17px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.modal-slider-container:hover .slider-nav,
.slider-nav:focus-visible {
    opacity: 1;
}

.slider-nav:hover {
    background: #fff;
    transform: translateY(-50%);
}

.slider-nav.prev {
    left: 12px;
}

.slider-nav.next {
    right: 12px;
}

.slider-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    z-index: 2;
    display: flex;
    gap: 7px;
    transform: translateX(-50%);
}

.slider-dot {
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.slider-dot.active {
    background: #fff;
    transform: scale(1.25);
}

.modal-slider-fallback {
    display: none;
}

.modal-info {
    padding: 28px 32px 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

#modalDesc {
    max-width: 76ch;
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.72;
}

.modal-actions {
    margin: 28px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

#projectModal .modal-actions .btn-primary {
    min-height: 44px;
    padding: 12px 18px;
    color: #fff;
    background: #0f172a;
    border: 1px solid #0f172a;
    border-radius: 9px;
    box-shadow: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

#projectModal .modal-actions .btn-primary:hover {
    background: #1e293b;
    border-color: #1e293b;
    box-shadow: none;
    transform: translateY(-1px);
}

:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .modal-header {
    background: #111827;
}

:root[data-theme="dark"] #projectModal .modal-actions .btn-primary {
    color: #0f172a;
    background: #f8fafc;
    border-color: #f8fafc;
}

:root[data-theme="dark"] #projectModal .modal-actions .btn-primary:hover {
    background: #e2e8f0;
    border-color: #e2e8f0;
}

@media (max-width: 600px) {
    .modal-backdrop {
        padding: 12px;
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-height: calc(100vh - 24px);
        border-radius: 16px;
    }

    .modal-header {
        min-height: 64px;
        padding: 13px 14px 13px 18px;
        gap: 16px;
    }

    .modal-slider-container {
        height: 220px;
        margin: 16px 16px 0;
        border-radius: 10px;
    }

    .slider-nav {
        opacity: 1;
    }

    .modal-info {
        padding: 22px 20px 24px;
    }

    #modalDesc {
        font-size: 14px;
        line-height: 1.65;
    }

    .modal-actions {
        margin-top: 24px;
        align-items: stretch;
    }

    #projectModal .modal-actions .btn-primary {
        width: 100%;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .modal-content,
    .modal-slider,
    .modal-close,
    .slider-nav {
        transition: none;
    }
}
