/* Button for modal triggers */
.btn-text-only {
    background: none;
    border: none;
    color: var(--accent-cyan);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: gap 0.2s ease;
}

.btn-text-only:hover {
    gap: 12px;
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Interactive Cards */
.modal-trigger-card {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.3s ease,
        border-color 0.3s ease;
}

.modal-trigger-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-color: var(--accent-cyan);
}

.modal-trigger-card:hover .btn-text-only {
    text-decoration: underline;
    gap: 12px;
}

:root {
    --modal-bg: rgba(10, 10, 15, 0.85);
    /* Darker backdrop */
    --modal-glass: rgba(20, 20, 25, 0.95);
    --modal-border: rgba(255, 255, 255, 0.08);
    --modal-text: #e2e8f0;
    --modal-text-dim: #94a3b8;
    --accent-primary: #06b6d4;
}

body.modal-open {
    overflow: hidden;
    padding-right: 8px;
    /* Prevent layout shift from scrollbar removal */
}

/* Backdrop */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20000;
    /* Ensure it's above everything */
    background: var(--modal-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Optimizations */



.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Content Container */
.modal-container {
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    background: var(--modal-glass);
    border: 1px solid var(--modal-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.modal-backdrop.active .modal-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal Header */
.modal-header {
    padding: 30px;
    border-bottom: 1px solid var(--modal-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    flex-shrink: 0;
}

.modal-title-group {
    flex: 1;
    padding-right: 20px;
}

.modal-super-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-cyan, #06b6d4);
    margin-bottom: 8px;
    display: block;
    font-weight: 600;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}

.modal-subtitle {
    display: block;
    color: var(--modal-text-dim);
    margin-top: 8px;
    font-size: 1rem;
}

/* Close Button */
.modal-close {
    background: transparent;
    border: none;
    color: var(--modal-text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

/* Scrollable Content */
.modal-scroll-content {
    padding: 30px;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1;
}

/* Content Typography */
.modal-body-text {
    line-height: 1.7;
    color: var(--modal-text);
    font-size: 1.05rem;
    margin-bottom: 25px;
    white-space: pre-line;
    /* Preserves line breaks from data */
}

/* Tags/Skills in Modal */
.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--modal-border);
}

.modal-tag {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* List Items in Modal */
.modal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-list li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 12px;
    color: var(--modal-text-dim);
}

.modal-list li::before {
    content: "•";
    color: var(--accent-cyan);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Scrollbar Styling */
.modal-scroll-content::-webkit-scrollbar {
    width: 6px;
}

.modal-scroll-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-scroll-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.modal-scroll-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Section Header in Modal */
.modal-section-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-section-header i {
    color: var(--accent-cyan);
}

/* Mobile Optimizations */
/* Mobile Optimizations */
@media (max-width: 768px) {
    .modal-container {
        width: 100%;
        height: 100dvh;
        /* Use dynamic viewport height */
        max-height: 100dvh;
        max-width: 100%;
        border-radius: 0;
        border: none;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        padding: 20px;
        padding-top: max(20px, env(safe-area-inset-top));
        /* Safe area for notch */
        flex-shrink: 0;
    }

    .modal-scroll-content {
        padding: 20px;
        padding-bottom: 120px;
        /* ample space for bottom nav/interaction */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    /* Swipe indicator */
    .modal-swipe-indicator {
        display: none;
    }
}

/* Animations */
@keyframes modalPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(6, 182, 212, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
    }
}