*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --ink: #10151e;
    --muted: #4f5b6d;
    --line: rgba(16, 21, 30, 0.1);
    --live: #0f8a4f;
    --soon: rgba(16, 21, 30, 0.48);
    --radius: 22px;
    --font-display: "Space Grotesk", sans-serif;
    --font-body: "Outfit", sans-serif;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    color: var(--ink);
    background: #2a3038;
    line-height: 1.4;
}

.portfolio-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.portfolio-bg__image {
    position: absolute;
    inset: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    filter: brightness(0.72) contrast(1.05);
}

.portfolio-bg__shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(8, 12, 18, 0.42) 0%, rgba(8, 12, 18, 0.28) 45%, rgba(8, 12, 18, 0.48) 100%);
}

.portfolio-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 1.75rem));
    height: 100dvh;
    margin: 0 auto;
    padding: clamp(0.45rem, 1.4vh, 0.9rem) 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(0.45rem, 1.2vh, 0.85rem);
    overflow: hidden;
}

.portfolio-hero {
    flex: 0 0 auto;
    text-align: center;
    margin: 0 auto;
    animation: rise-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.portfolio-kicker {
    font-size: clamp(0.7rem, 1.4vh, 0.8rem);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #5febff;
    margin-bottom: clamp(0.4rem, 1vh, 0.65rem);
}

.portfolio-brand {
    display: flex;
    justify-content: center;
    margin-bottom: clamp(0.35rem, 0.9vh, 0.55rem);
}

.portfolio-brand__logo {
    display: block;
    width: auto;
    height: clamp(72px, 12vh, 118px);
    max-width: min(640px, 88vw);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(16, 21, 30, 0.28);
}

.portfolio-lead {
    font-size: clamp(0.92rem, 1.9vh, 1.08rem);
    font-weight: 500;
    color: var(--muted);
}

.demo-scene {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    perspective: 1200px;
}

.demo-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: clamp(0.7rem, 1.5vh, 1.1rem);
    min-height: 0;
    transform-style: preserve-3d;
}

.demo-tile:nth-child(1),
.demo-tile:nth-child(2),
.demo-tile:nth-child(3),
.demo-tile:nth-child(4),
.demo-tile:nth-child(5),
.demo-tile:nth-child(6) {
    grid-column: span 2;
}

.demo-tile {
    --rx: 0deg;
    --ry: 0deg;
    --shine-x: 50%;
    --shine-y: 30%;
    --tile-accent: #9ff3e4;
    --tile-ink: #ffffff;
    --tile-muted: rgba(255, 255, 255, 0.78);
    --tile-line: rgba(255, 255, 255, 0.18);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.55rem;
    min-height: 0;
    height: 100%;
    padding: clamp(1rem, 2vh, 1.35rem) clamp(1.05rem, 1.8vw, 1.45rem);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius);
    color: var(--tile-ink);
    background: #1a2230;
    box-shadow:
        0 14px 32px rgba(16, 21, 30, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.28) inset;
    text-decoration: none;
    overflow: hidden;
    isolation: isolate;
    transform: rotateX(var(--rx)) rotateY(var(--ry)) translateZ(0);
    transform-style: preserve-3d;
    transition:
        transform 0.18s ease-out,
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        filter 0.25s ease;
    animation: rise-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform;
}

.demo-tile__media,
.demo-tile__overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.demo-tile__media {
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    transform: scale(1.04);
    transition: transform 0.45s ease;
}

.demo-tile__overlay {
    background:
        linear-gradient(180deg, rgba(8, 12, 20, 0.42) 0%, rgba(8, 12, 20, 0.62) 45%, rgba(8, 12, 20, 0.9) 100%);
}

.demo-tile--crm {
    --tile-accent: #7ef0d8;
}

.demo-tile--crm .demo-tile__overlay {
    background:
        linear-gradient(180deg, rgba(4, 40, 36, 0.4) 0%, rgba(4, 40, 36, 0.62) 45%, rgba(3, 28, 26, 0.92) 100%);
}

.demo-tile--face {
    --tile-accent: #8ec8ff;
}

.demo-tile--face .demo-tile__overlay {
    background:
        linear-gradient(180deg, rgba(8, 24, 56, 0.42) 0%, rgba(8, 24, 56, 0.64) 45%, rgba(6, 16, 40, 0.92) 100%);
}

.demo-tile--ai {
    --tile-accent: #7de8b4;
}

.demo-tile--ai .demo-tile__overlay {
    background:
        linear-gradient(180deg, rgba(4, 36, 24, 0.42) 0%, rgba(4, 36, 24, 0.64) 45%, rgba(3, 24, 16, 0.92) 100%);
}

.demo-tile--anomaly {
    --tile-accent: #ffc07a;
}

.demo-tile--anomaly .demo-tile__overlay {
    background:
        linear-gradient(180deg, rgba(48, 24, 6, 0.42) 0%, rgba(48, 24, 6, 0.64) 45%, rgba(32, 14, 4, 0.92) 100%);
}

.demo-tile--mining {
    --tile-accent: #c7b6ff;
}

.demo-tile--mining .demo-tile__overlay {
    background:
        linear-gradient(180deg, rgba(28, 18, 56, 0.42) 0%, rgba(28, 18, 56, 0.64) 45%, rgba(18, 10, 40, 0.92) 100%);
}

.demo-tile--barcode {
    --tile-accent: #7ad7ff;
}

.demo-tile--barcode .demo-tile__overlay {
    background:
        linear-gradient(180deg, rgba(6, 32, 48, 0.42) 0%, rgba(6, 32, 48, 0.64) 45%, rgba(4, 20, 34, 0.92) 100%);
}

.demo-tile > *:not(.demo-tile__media):not(.demo-tile__overlay):not(.demo-tile__shine) {
    position: relative;
    z-index: 1;
}

.demo-tile:nth-child(1) { animation-delay: 0.05s; }
.demo-tile:nth-child(2) { animation-delay: 0.1s; }
.demo-tile:nth-child(3) { animation-delay: 0.15s; }
.demo-tile:nth-child(4) { animation-delay: 0.2s; }
.demo-tile:nth-child(5) { animation-delay: 0.25s; }
.demo-tile:nth-child(6) { animation-delay: 0.3s; }

.demo-tile__shine {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: radial-gradient(
        420px circle at var(--shine-x) var(--shine-y),
        rgba(255, 255, 255, 0.28),
        transparent 46%
    );
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.demo-tile__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex: 0 0 auto;
    transform: translateZ(18px);
}

.demo-tile__index {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.78);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.demo-tile__status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.78);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.demo-tile--live .demo-tile__status { color: #6dffb0; }

.demo-tile__pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6dffb0;
    box-shadow: 0 0 0 0 rgba(109, 255, 176, 0.45);
    animation: pulse 1.8s ease-out infinite;
}

.demo-tile__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 1.4vw, 1.1rem);
    transform: translateZ(24px);
}

.demo-tile__icon {
    width: clamp(64px, 9.5vh, 86px);
    height: clamp(64px, 9.5vh, 86px);
    display: grid;
    place-items: center;
    border-radius: 20px;
    color: #fff;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.45);
    flex: 0 0 auto;
    backdrop-filter: blur(10px);
    box-shadow:
        0 10px 22px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.demo-tile__icon svg {
    width: 58%;
    height: 58%;
    stroke-width: 2.8;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.demo-tile__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.demo-tile__title {
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 3.6vh, 2.05rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.08;
    color: #fff;
    text-shadow: 0 3px 14px rgba(0, 0, 0, 0.55);
}

.demo-tile__desc {
    font-size: clamp(0.88rem, 1.8vh, 1.02rem);
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.35;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.demo-tile__action {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--tile-line);
    margin-top: 0.15rem;
    font-size: clamp(0.92rem, 1.8vh, 1.05rem);
    font-weight: 700;
    color: var(--tile-accent);
    letter-spacing: 0.01em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transform: translateZ(22px);
}

.demo-tile__action--muted {
    color: var(--tile-muted);
    font-weight: 600;
}

.demo-tile__action span {
    display: inline-block;
    transition: transform 0.2s ease;
}

.demo-tile--live {
    cursor: pointer;
}

.demo-tile--live:hover,
.demo-tile--live:focus-visible {
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow:
        0 18px 36px rgba(0, 0, 0, 0.28),
        0 1px 0 rgba(255, 255, 255, 0.35) inset;
    outline: none;
}

.demo-tile--live:hover .demo-tile__media,
.demo-tile--live:focus-visible .demo-tile__media {
    transform: scale(1.1);
}

.demo-tile--live:hover .demo-tile__shine,
.demo-tile--live:focus-visible .demo-tile__shine,
.demo-tile.is-tilting .demo-tile__shine {
    opacity: 1;
}

.demo-tile--live:hover .demo-tile__action span,
.demo-tile--live:focus-visible .demo-tile__action span {
    transform: translateX(4px);
}

.demo-tile--soon {
    cursor: default;
    user-select: none;
}

.demo-tile--soon:hover .demo-tile__media {
    transform: scale(1.06);
}

.demo-tile--soon:hover .demo-tile__shine {
    opacity: 0.55;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(109, 255, 176, 0.45); }
    70% { box-shadow: 0 0 0 8px rgba(109, 255, 176, 0); }
    100% { box-shadow: 0 0 0 0 rgba(109, 255, 176, 0); }
}

@media (max-width: 820px) {
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .portfolio-shell {
        width: min(100% - 1rem, 1180px);
        height: auto;
        min-height: 100dvh;
        gap: 0.75rem;
        padding: 0.85rem 0 1.25rem;
        overflow: visible;
        justify-content: flex-start;
    }

    .portfolio-brand__logo {
        height: clamp(58px, 9vh, 84px);
        max-width: min(92vw, 420px);
    }

    .demo-scene {
        perspective: none;
        flex: 0 0 auto;
        min-height: 0;
        overflow: visible;
    }

    .demo-grid {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: none;
        gap: 0.75rem;
        overflow: visible;
        scroll-snap-type: none;
    }

    .demo-tile:nth-child(1),
    .demo-tile:nth-child(2),
    .demo-tile:nth-child(3),
    .demo-tile:nth-child(4),
    .demo-tile:nth-child(5),
    .demo-tile:nth-child(6) {
        grid-column: auto;
    }

    .demo-tile {
        width: 100%;
        min-height: 170px;
        height: auto;
        padding: 1rem 1.05rem;
        border-radius: 18px;
    }

    .demo-tile__body {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0.85rem;
        flex: 0 0 auto;
    }

    .demo-tile__icon {
        width: 64px;
        height: 64px;
        border-radius: 16px;
    }

    .demo-tile__title {
        font-size: clamp(1.35rem, 5.5vw, 1.7rem);
    }

    .demo-tile__desc {
        font-size: 0.9rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .demo-dots {
        display: none;
    }
}

@media (max-width: 640px) {
    .demo-tile {
        padding: 0.95rem 1rem;
        gap: 0.5rem;
        min-height: 155px;
    }

    .demo-tile__icon {
        width: 58px;
        height: 58px;
    }
}

@media (hover: none) {
    .demo-tile {
        --rx: 0deg !important;
        --ry: 0deg !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portfolio-hero,
    .demo-tile,
    .demo-tile__pulse {
        animation: none;
    }

    .demo-tile {
        transition: none;
    }
}
