/**
 * Student Projects — premium gallery cards + horizontal carousel.
 */

.mtec-projects-section {
    max-width: 100%;
    padding-block: 0.5rem 1.75rem;
}

.mtec-section .mtec-projects-section {
    padding-block: 0.25rem 2rem;
}

.mtec-diploma-page__below > .mtec-projects-section {
    margin-top: 2.5rem;
}

/* ── Header ── */
.mtec-projects-section__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
    text-align: center;
}

.mtec-projects-section__intro {
    max-width: 40rem;
}

.mtec-projects-section__intro .mtec-diploma-section__kicker {
    margin-bottom: 0.75rem;
}

.mtec-projects-section__intro .mtec-diploma-section__subtitle {
    margin-top: 0.625rem;
}

.mtec-projects-section__stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.mtec-projects-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 248, 255, 0.92) 100%);
    border: 1px solid rgba(0, 119, 200, 0.12);
    box-shadow: 0 4px 16px -8px rgba(0, 41, 142, 0.12);
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--mtec-primary, #0077c8);
}

.mtec-projects-stat--amber {
    color: #c2410c;
    border-color: rgba(255, 127, 44, 0.18);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 247, 237, 0.95) 100%);
}

.mtec-projects-stat__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    background: rgba(0, 119, 200, 0.1);
    font-size: 0.95rem;
}

.mtec-projects-stat--amber .mtec-projects-stat__icon {
    background: rgba(255, 127, 44, 0.12);
}

.mtec-projects-section__hint {
    margin-top: 1rem;
}

/* ── Gallery wall ── */
.mtec-projects-wall {
    position: relative;
}

.mtec-projects-wall__pattern {
    position: absolute;
    inset: -0.75rem -0.375rem;
    border-radius: 28px;
    background:
        radial-gradient(circle at 10% 20%, rgba(0, 119, 200, 0.06) 0%, transparent 42%),
        radial-gradient(circle at 90% 80%, rgba(255, 127, 44, 0.05) 0%, transparent 40%),
        linear-gradient(180deg, rgba(250, 252, 255, 0.55) 0%, rgba(240, 246, 252, 0.3) 100%);
    pointer-events: none;
    z-index: 0;
}

.mtec-projects-wall__panel {
    position: relative;
    z-index: 1;
}

.mtec-showcase-panel__body--projects {
    padding: 1.125rem 0 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 249, 253, 0.94) 100%);
}

.mtec-projects-stage {
    position: relative;
}

.mtec-projects-stage::before,
.mtec-projects-stage::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: clamp(28px, 6vw, 56px);
    z-index: 2;
    pointer-events: none;
}

.mtec-projects-stage::before {
    left: 0;
    background: linear-gradient(to right, rgba(244, 249, 253, 0.98) 20%, transparent);
}

.mtec-projects-stage::after {
    right: 0;
    background: linear-gradient(to left, rgba(244, 249, 253, 0.98) 20%, transparent);
}

.mtec-projects-carousel {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1.25rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    touch-action: pan-x;
    padding: 0.375rem 1.25rem 1rem;
}

.mtec-projects-carousel::-webkit-scrollbar {
    display: none;
}

.mtec-projects-carousel:focus-visible {
    outline: 2px solid rgba(0, 119, 200, 0.35);
    outline-offset: 2px;
    border-radius: 12px;
}

.mtec-projects-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.125rem;
    width: max-content;
    padding-block: 0.25rem;
}

/* ── Auto marquee (2+ projects) ── */
.mtec-projects-carousel--auto {
    overflow: hidden;
    scroll-snap-type: none;
    touch-action: auto;
    mask-image: linear-gradient(to right, transparent 0%, #000 6%, #000 94%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 6%, #000 94%, transparent 100%);
}

.mtec-projects-carousel--auto .mtec-projects-track {
    animation: mtecProjectsMarqueeForward 52s linear infinite;
    will-change: transform;
}

.mtec-projects-wall__panel--auto:hover .mtec-projects-track {
    animation-play-state: paused;
}

body.project-lightbox-open .mtec-projects-carousel--auto .mtec-projects-track {
    animation-play-state: paused;
}

@keyframes mtecProjectsMarqueeForward {
    from { transform: translateX(0); }
    to { transform: translateX(-33.333%); }
}

html[dir="rtl"] .mtec-projects-carousel--auto .mtec-projects-track {
    animation-name: mtecProjectsMarqueeReverse;
}

@keyframes mtecProjectsMarqueeReverse {
    from { transform: translateX(-33.333%); }
    to { transform: translateX(0); }
}

.mtec-projects-stage--auto::before,
.mtec-projects-stage--auto::after {
    width: clamp(36px, 9vw, 72px);
}

/* ── Project card ── */
.mtec-project-card {
    flex-shrink: 0;
    scroll-snap-align: start;
    width: min(calc(100vw - 3rem), 288px);
    border-radius: 22px;
    background: #fff;
    border: 1px solid rgba(0, 41, 142, 0.07);
    box-shadow:
        0 1px 2px rgba(24, 30, 75, 0.04),
        0 10px 28px -14px rgba(0, 41, 142, 0.14);
    overflow: hidden;
    transition:
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.28s ease,
        border-color 0.28s ease;
}

.mtec-project-card__media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(145deg, #eef4fb 0%, #dce8f5 100%);
    overflow: hidden;
}

.mtec-project-card__media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(15, 23, 42, 0.08) 100%);
    pointer-events: none;
    z-index: 1;
}

.mtec-project-card__media img,
.mtec-project-card__media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s ease;
}

.mtec-project-card__iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.mtec-project-card__iframe--loading {
    opacity: 0;
    pointer-events: none;
}

.mtec-project-card__media.is-video-loading {
    background: #0f172a;
}

.mtec-project-card__loader {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.mtec-project-card__loader-spinner {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.22);
    border-top-color: #fff;
    animation: mtecProjectSpin 0.75s linear infinite;
}

@keyframes mtecProjectSpin {
    to { transform: rotate(360deg); }
}

.mtec-project-lightbox__stage.is-loading {
    min-height: min(56vw, 320px);
}

.mtec-project-lightbox__loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: min(1100px, 100%);
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 6rem);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 800;
}

.mtec-project-lightbox__loader .mtec-project-card__loader-spinner {
    width: 2.75rem;
    height: 2.75rem;
}

.mtec-project-card__youtube.is-loading {
    pointer-events: none;
}

.mtec-project-card__youtube.is-loading .mtec-project-card__play {
    opacity: 0.35;
}

.mtec-project-card__youtube {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: #0f172a;
    cursor: pointer;
}

.mtec-project-card__youtube img {
    opacity: 0.94;
    transition: transform 0.45s ease, opacity 0.3s ease;
}

.mtec-project-card:hover .mtec-project-card__youtube img,
.mtec-project-card:focus-within .mtec-project-card__youtube img {
    transform: scale(1.04);
    opacity: 1;
}

.mtec-project-card__youtube::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 35%, rgba(15, 23, 42, 0.4) 100%);
    pointer-events: none;
    z-index: 1;
}

.mtec-project-card__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.mtec-project-card__play i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.98);
    color: #dc2626;
    font-size: 1.625rem;
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.18),
        0 0 0 4px rgba(255, 255, 255, 0.35);
    padding-inline-start: 0.15rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.mtec-project-card:hover .mtec-project-card__play i,
.mtec-project-card:focus-within .mtec-project-card__play i {
    transform: scale(1.08);
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.22),
        0 0 0 5px rgba(255, 255, 255, 0.4);
}

.mtec-project-card__fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2.5rem;
}

.mtec-project-card__badge {
    position: absolute;
    top: 0.75rem;
    inset-inline-start: 0.75rem;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3125rem 0.6875rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.mtec-project-card__badge i {
    font-size: 0.8125rem;
}

.mtec-project-card__expand {
    position: absolute;
    top: 0.75rem;
    inset-inline-end: 0.75rem;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.125rem;
    height: 2.125rem;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.mtec-project-card__expand:hover,
.mtec-project-card__expand:focus-visible {
    background: rgba(0, 119, 200, 0.88);
    transform: scale(1.05);
    outline: none;
}

.mtec-project-card__expand-icon {
    display: block;
}

.mtec-project-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.875rem;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mtec-project-lightbox.hidden {
    display: none !important;
}

body.project-lightbox-open {
    overflow: hidden;
}

.mtec-project-lightbox__stage {
    width: min(1100px, 100%);
    max-height: calc(100vh - 6rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mtec-project-lightbox__iframe,
.mtec-project-lightbox__video {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 6rem);
    border: 0;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}

.mtec-project-lightbox__img {
    max-width: 100%;
    max-height: calc(100vh - 6rem);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    object-fit: contain;
}

.mtec-project-lightbox__title {
    max-width: min(1100px, 100%);
    margin: 0;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 800;
    text-align: center;
    line-height: 1.45;
}

.mtec-project-lightbox__close {
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    transition: background 0.2s ease;
    z-index: 2;
}

.mtec-project-lightbox__close:hover,
.mtec-project-lightbox__close:focus-visible {
    background: rgba(255, 255, 255, 0.24);
    outline: none;
}

.mtec-project-card__body {
    padding: 1rem 1.125rem 1.125rem;
}

.mtec-project-card__title {
    font-size: 0.9375rem;
    font-weight: 900;
    color: var(--mtec-deep, #181E4B);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.mtec-project-card__diploma {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 100%;
    margin-top: 0.625rem;
    padding: 0.3125rem 0.625rem;
    border-radius: 9999px;
    background: rgba(0, 119, 200, 0.06);
    border: 1px solid rgba(0, 119, 200, 0.08);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--mtec-primary, #0077C8);
    line-height: 1.35;
}

.mtec-project-card__diploma span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mtec-project-card__diploma i {
    flex-shrink: 0;
    font-size: 0.8125rem;
    opacity: 0.9;
}

/* ── Carousel nav ── */
.mtec-projects-nav {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(0, 119, 200, 0.14);
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--mtec-primary, #0077C8);
    box-shadow: 0 6px 20px rgba(24, 30, 75, 0.14);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.mtec-projects-nav[hidden] {
    display: none !important;
}

@media (min-width: 768px) {
    .mtec-projects-stage.has-nav .mtec-projects-nav:not([hidden]) {
        display: inline-flex;
    }
}

.mtec-projects-nav i {
    font-size: 1.25rem;
}

.mtec-projects-nav:hover:not(:disabled) {
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 119, 200, 0.18);
    transform: translateY(-50%) scale(1.04);
}

.mtec-projects-nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.mtec-projects-nav--prev {
    left: 0.625rem;
}

.mtec-projects-nav--next {
    right: 0.625rem;
}

.mtec-projects-hint-mobile {
    display: inline;
}

.mtec-projects-hint-desktop {
    display: none;
}

@media (min-width: 640px) {
    .mtec-projects-section__header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        gap: 2rem;
        margin-bottom: 2rem;
        text-align: start;
    }

    .mtec-section .mtec-projects-section__header {
        text-align: start;
    }

    .mtec-section .mtec-projects-section__intro {
        text-align: start;
    }

    .mtec-projects-section__stats {
        justify-content: flex-end;
        flex-shrink: 0;
    }

    html[dir="rtl"] .mtec-projects-section__header {
        text-align: start;
    }

    .mtec-project-card {
        width: 300px;
    }

    .mtec-projects-hint-mobile {
        display: none;
    }

    .mtec-projects-hint-desktop {
        display: inline;
    }
}

@media (min-width: 1024px) {
    .mtec-projects-section__header {
        margin-bottom: 2.25rem;
    }

    .mtec-project-card {
        width: 320px;
    }

    .mtec-project-card:hover {
        transform: translateY(-5px);
        border-color: rgba(0, 119, 200, 0.16);
        box-shadow:
            0 4px 12px rgba(24, 30, 75, 0.06),
            0 20px 40px -16px rgba(0, 119, 200, 0.2);
    }

    .mtec-project-card:hover .mtec-project-card__media img {
        transform: scale(1.03);
    }

    .mtec-showcase-panel__body--projects {
        padding: 1.25rem 0 1.125rem;
    }

    .mtec-projects-carousel {
        padding-inline: 1.5rem;
    }

    .mtec-projects-carousel--auto {
        padding-inline: 0;
    }

    .mtec-projects-carousel--auto .mtec-projects-track {
        animation-duration: 58s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mtec-project-card,
    .mtec-project-card__youtube img,
    .mtec-project-card__media img,
    .mtec-project-card__play i,
    .mtec-projects-nav,
    .mtec-project-card__loader-spinner {
        animation: none;
        transition: none;
    }

    .mtec-project-card:hover {
        transform: none;
    }

    .mtec-projects-carousel--auto {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        mask-image: none;
        -webkit-mask-image: none;
        touch-action: pan-x;
    }

    .mtec-projects-carousel--auto .mtec-projects-track {
        animation: none;
    }
}

@media (max-width: 639px) {
    .mtec-projects-section__header {
        margin-bottom: 1.5rem;
        padding-inline: 0.125rem;
    }

    .mtec-project-card {
        width: min(calc(100vw - 2.5rem), 288px);
    }

    .mtec-project-card:hover {
        transform: none;
    }

    .mtec-projects-carousel {
        padding-inline: 1rem;
        scroll-padding-inline: 1rem;
    }

    .mtec-projects-track {
        gap: 0.875rem;
    }

    .mtec-projects-carousel--auto .mtec-projects-track {
        animation-duration: 38s;
    }

    .mtec-projects-nav {
        display: none !important;
    }

    .mtec-projects-stage::before,
    .mtec-projects-stage::after {
        width: 20px;
    }

    .mtec-project-lightbox {
        padding: 0.75rem;
        padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    }

    .mtec-project-lightbox__close {
        top: calc(0.75rem + env(safe-area-inset-top, 0px));
    }

    .mtec-project-lightbox__stage,
    .mtec-project-lightbox__iframe,
    .mtec-project-lightbox__video,
    .mtec-project-lightbox__img {
        max-height: calc(100vh - 6rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
}
