/* ============================================================
   STACK.CSS  — Meni World  |  Tech Stack Section
   Depends on: common.css  (Syne + DM Sans loaded in HTML)
   Category colours via data-cat attribute:
     frontend #7ed957  backend #6c5ce7  database #3498db
     cloud    #ff7a19  tools   #ff5757
   ============================================================ */

/* category accent map */
[data-cat="frontend"] {
    --cc: #7ed957;
}

[data-cat="backend"] {
    --cc: #6c5ce7;
}

[data-cat="database"] {
    --cc: #3498db;
}

[data-cat="cloud"] {
    --cc: #ff7a19;
}

[data-cat="tools"] {
    --cc: #ff5757;
}

/* ── 1. SECTION SHELL ─────────────────────────────────── */
.stack {
    position: relative;
    padding: 108px 28px 120px;
    overflow: hidden;
    isolation: isolate;
}

.stack::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 1px;
    background: linear-gradient(90deg,
            transparent,
            rgba(126, 217, 87, .1) 20%,
            rgba(126, 217, 87, .32) 50%,
            rgba(126, 217, 87, .1) 80%,
            transparent);
}

.stack::after {
    content: '';
    position: absolute;
    top: -100px;
    right: -240px;
    width: 700px;
    height: 700px;
    background: radial-gradient(ellipse, rgba(108, 92, 231, .05) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

.stack-inner {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 52px;
}

/* ── 2. HEADER ────────────────────────────────────────── */
.stack-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

.stack-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'Syne', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.8px;
    text-transform: uppercase;
    color: var(--color-primary);
}

.stack-eyebrow::before,
.stack-eyebrow::after {
    content: '';
    display: block;
    width: 32px;
    height: 1px;
    background: var(--color-primary);
    opacity: .45;
}

.stack-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(1.9rem, 4vw, 3rem);
    color: #fff;
    letter-spacing: -.6px;
    line-height: 1.1;
    margin: 0;
}

.stack-title em {
    font-style: normal;
    background: linear-gradient(110deg, #7ed957 0%, #aaf57b 40%, #5fcf30 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: stShimmer 5s linear infinite;
}

@keyframes stShimmer {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

.stack-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 300;
    color: rgba(255, 255, 255, .42);
    line-height: 1.75;
    max-width: 520px;
    margin: 0;
}

/* ── 3. CATEGORY TABS ────────────────────────────────── */
.stack-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 50px;
    padding: 5px;
}

.stack-tab {
    font-family: 'Syne', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, .45);
    background: transparent;
    border: none;
    padding: 8px 18px;
    border-radius: 50px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .2s ease, background .2s ease, box-shadow .2s ease;
}

.stack-tab:hover {
    color: rgba(255, 255, 255, .8);
    background: rgba(255, 255, 255, .06);
}

.stack-tab.is-active {
    color: #000;
    background: var(--color-primary);
    box-shadow: 0 4px 16px rgba(126, 217, 87, .35);
}

/* ── 4. LOGO GRID ────────────────────────────────────── */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    width: 100%;
}

.stack-card.is-hidden {
    display: none;
}

/* ── 5. TECH CARD ────────────────────────────────────── */
.stack-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 14px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .028);
    border: 1px solid rgba(255, 255, 255, .07);
    position: relative;
    overflow: hidden;
    cursor: default;
    opacity: 0;
    transform: translateY(20px) scale(.96);
    transition:
        opacity .5s cubic-bezier(.22, .68, 0, 1.1),
        transform .5s cubic-bezier(.22, .68, 0, 1.1),
        background .22s ease,
        border-color .22s ease,
        box-shadow .22s ease;
}

.stack-card.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.stack-card.is-visible:hover {
    background: color-mix(in srgb, var(--cc) 8%, rgba(255, 255, 255, .03));
    border-color: color-mix(in srgb, var(--cc) 40%, transparent);
    box-shadow:
        0 12px 32px rgba(0, 0, 0, .3),
        0 0 0 1px color-mix(in srgb, var(--cc) 18%, transparent);
    transform: translateY(-7px) scale(1.03);
}

/* bottom accent bar */
.stack-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--cc, #7ed957);
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: opacity .25s ease, transform .35s cubic-bezier(.22, .68, 0, 1.2);
}

.stack-card.is-visible:hover::after {
    opacity: 1;
    transform: scaleX(1);
}

/* corner glow blob */
.stack-card::before {
    content: '';
    position: absolute;
    bottom: -24px;
    right: -24px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle,
            color-mix(in srgb, var(--cc, #7ed957) 28%, transparent) 0%,
            transparent 70%);
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}

.stack-card.is-visible:hover::before {
    opacity: 1;
}

/* image wrapper */
.stack-card__img-wrap {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    filter: grayscale(25%) brightness(.85);
    transition: filter .25s ease, transform .28s cubic-bezier(.22, .68, 0, 1.3);
}

.stack-card.is-visible:hover .stack-card__img-wrap {
    filter: grayscale(0%) brightness(1);
    transform: scale(1.12) translateY(-2px);
}

.stack-card__img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* fallback icon */
.stack-card__fallback {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--cc, #7ed957);
    opacity: .7;
}

/* tech name */
.stack-card__name {
    font-family: 'Syne', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, .65);
    line-height: 1.2;
    text-align: center;
    position: relative;
    z-index: 1;
    transition: color .22s ease;
}

.stack-card.is-visible:hover .stack-card__name {
    color: #fff;
}

/* category label — appears on hover */
.stack-card__cat {
    font-family: 'DM Sans', sans-serif;
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--cc, #7ed957);
    opacity: 0;
    position: relative;
    z-index: 1;
    transition: opacity .22s ease;
}

.stack-card.is-visible:hover .stack-card__cat {
    opacity: .75;
}

/* ── 6. LEGEND STRIP ─────────────────────────────────── */
.stack-legend {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    width: 100%;
    border-radius: 16px;
    background: rgba(255, 255, 255, .025);
    border: 1px solid rgba(255, 255, 255, .06);
    overflow: hidden;
}

.stack-legend__group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 20px;
    flex: 1;
    min-width: 0;
    transition: background .2s ease;
}

.stack-legend__group:hover {
    background: rgba(255, 255, 255, .04);
}

.stack-legend__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lc, #7ed957);
    box-shadow: 0 0 6px var(--lc, #7ed957);
    flex-shrink: 0;
    margin-top: 3px;
}

.stack-legend__label {
    font-family: 'Syne', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, .5);
    letter-spacing: .5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.stack-legend__items {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, .25);
    line-height: 1.5;
    min-width: 0;
}

.stack-legend__sep {
    width: 1px;
    background: rgba(255, 255, 255, .06);
    flex-shrink: 0;
    align-self: stretch;
}

/* ── 7. SCROLL REVEAL ────────────────────────────────── */
.stack-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity .65s cubic-bezier(.22, .68, 0, 1.1),
        transform .65s cubic-bezier(.22, .68, 0, 1.1);
}

.stack-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.stack-reveal:nth-child(1) {
    transition-delay: .05s;
}

.stack-reveal:nth-child(2) {
    transition-delay: .15s;
}

.stack-reveal:nth-child(3) {
    transition-delay: .22s;
}

.stack-reveal:nth-child(4) {
    transition-delay: .32s;
}

/* ── 8. RESPONSIVE ───────────────────────────────────── */

/* <= 1100px: 5 col */
@media (max-width: 1100px) {
    .stack-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* <= 900px: 4 col, legend wraps */
@media (max-width: 900px) {
    .stack {
        padding: 80px 20px 90px;
    }

    .stack-inner {
        gap: 40px;
    }

    .stack-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .stack-legend__group {
        padding: 14px 14px;
    }

    .stack-legend__sep {
        display: none;
    }

    .stack-legend__group {
        flex: 1 1 45%;
        border-bottom: 1px solid rgba(255, 255, 255, .06);
    }

    .stack-legend__group:nth-last-child(-n+2) {
        border-bottom: none;
    }
}

/* <= 640px: 3 col, tabs wrap */
@media (max-width: 640px) {
    .stack {
        padding: 64px 14px 72px;
    }

    .stack-inner {
        gap: 32px;
    }

    .stack-tabs {
        padding: 4px;
        gap: 3px;
        border-radius: 16px;
    }

    .stack-tab {
        padding: 7px 13px;
        font-size: 11.5px;
        border-radius: 12px;
    }

    .stack-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stack-card {
        padding: 18px 10px 14px;
        border-radius: 12px;
        gap: 8px;
    }

    .stack-card__img-wrap {
        width: 44px;
        height: 44px;
    }

    .stack-card__fallback {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }

    .stack-card__name {
        font-size: 11px;
    }

    .stack-legend {
        display: none;
    }
}

/* <= 420px: 3 col, very compact */
@media (max-width: 420px) {
    .stack-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .stack-card {
        padding: 14px 8px 12px;
        border-radius: 10px;
        gap: 6px;
    }

    .stack-card__img-wrap {
        width: 36px;
        height: 36px;
    }

    .stack-card__fallback {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .stack-card__name {
        font-size: 10px;
    }
}
