:root {
    /* Stitch Project Colors */
    --surface: #131313;
    --background: #0a0a0a;
    --primary: #ff6b00;
    --on-surface: #e5e2e1;
    --inverse-surface: #e5e2e1;
    --inverse-on-surface: #313030;
    --border-dark: #2a2a2a;
    --text-muted: #b0b0b0;

    /* Typography */
    --font-heading: "Geist", sans-serif;
    --font-body: "Geist", sans-serif;
    --font-mono: "JetBrains Mono", monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--background);
    color: var(--on-surface);
    font-family: var(--font-body);
    overflow: hidden; /* Hide scroll since it's an auto carousel */
    -webkit-font-smoothing: antialiased;
}

/* Floating Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 24px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.02em;
    color: #fff;
    flex: 1;
}

.nav-title {
    text-align: center;
    flex: 2;
}

.nav-heading {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.nav-subtitle {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #fff;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff !important;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600 !important;
    transition: box-shadow 0.3s ease !important;
}

.btn-primary:hover {
    box-shadow: 0 0 15px rgba(255, 107, 0, 0.4);
}

.nav-cta {
    background: rgba(255, 107, 0, 0.06) !important;
    color: var(--primary) !important;
    padding: 10px 22px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(255, 107, 0, 0.18) !important;
}
.nav-cta:hover {
    background: rgba(255, 107, 0, 0.12) !important;
}

/* Carousel Section */
.carousel-section {
    width: 100vw;
    height: 100svh; /* Changed from vh to svh for perfect mobile height */
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Wheel Mechanics */
.wheel-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none; /* Let clicks pass through to cards if needed */
}

.wheel {
    position: absolute;
    /* Pivot point placed precisely to center the cards */
    left: 50%;
    top: calc(50% + 2000px);
    width: 0;
    height: 0;
    pointer-events: auto;
}

/* Cards: Layout Container on Wheel */
.card {
    position: absolute;
    width: 360px;
    height: 480px;
    /* Center the card origin exactly on the wheel pivot */
    left: -180px;
    top: -240px;
    perspective: 1200px;
    transform-style: preserve-3d;
    cursor: pointer;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 40px;
}

/* Card Inner: Physical Glassmorphic Body and 3D Canvas */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 40px; /* Highly organic, round bubble-like contour */
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(28px) saturate(220%);
    -webkit-backdrop-filter: blur(28px) saturate(220%);
    overflow: hidden;
    transform-style: preserve-3d;
    will-change: transform;
    transition:
        border-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
        box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Parallax Inner Elements */
.card-content {
    position: relative;
    height: 100%;
    width: 100%;
    z-index: 3;
    transform-style: preserve-3d;
    pointer-events: none; /* Let moves track on card */
}

/* Base styles for inner parallax items */
.parallax-bg {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background-size: cover;
    background-position: center;
    z-index: 1;
    opacity: 0.5;
    transform: translate3d(0, 0, -20px); /* Pushed back in 3D space */
    will-change: transform;
}
.sticker {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--og-color, var(--primary)); /* Original color by default */
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: #000000; /* High contrast black text/arrow by default */
    box-shadow:
        0 15px 30px rgba(0, 0, 0, 0.35),
        inset 0 4px 8px rgba(255, 255, 255, 0.15),
        inset 0 -4px 8px rgba(0, 0, 0, 0.4);
    z-index: 4;
    transform: translate3d(0, 0, 40px); /* Floats high in 3D space */
    will-change: transform;
    transition:
        background 0.4s var(--ease-out),
        color 0.4s var(--ease-out),
        transform 0.4s var(--ease-out),
        border-color 0.4s var(--ease-out);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.sticker:hover {
    background: var(--og-color, var(--primary));
    color: #000000;
    border-color: transparent;
    transform: translate3d(0, 0, 60px) scale(1.1); /* Pops out slightly more on hover */
}

.shine-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Card Themes with Saturated Tinting and Convex Bubble Inner Shadows */
.theme-dark .card-inner {
    background: linear-gradient(
        135deg,
        rgba(25, 25, 32, 0.65) 0%,
        rgba(12, 12, 16, 0.85) 100%
    );
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 35px 70px rgba(0, 0, 0, 0.6),
        inset 0 16px 32px rgba(255, 255, 255, 0.08),
        inset 0 -12px 24px rgba(0, 0, 0, 0.4);
}

.theme-dark:hover .card-inner {
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow:
        0 50px 100px rgba(0, 0, 0, 0.85),
        0 0 40px rgba(255, 255, 255, 0.05),
        inset 0 20px 40px rgba(255, 255, 255, 0.12),
        inset 0 -15px 30px rgba(0, 0, 0, 0.5);
}

.theme-orange .card-inner {
    background: linear-gradient(
        135deg,
        rgba(255, 107, 0, 0.22) 0%,
        rgba(255, 107, 0, 0.38) 100%
    );
    color: #fff;
    border: 1.5px solid rgba(255, 107, 0, 0.45);
    box-shadow:
        0 35px 70px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(255, 107, 0, 0.08),
        inset 0 18px 36px rgba(255, 255, 255, 0.25),
        inset 0 -12px 24px rgba(0, 0, 0, 0.4);
}

.theme-orange:hover .card-inner {
    border-color: rgba(255, 107, 0, 0.75);
    box-shadow:
        0 50px 100px rgba(0, 0, 0, 0.85),
        0 0 50px rgba(255, 107, 0, 0.4),
        inset 0 22px 44px rgba(255, 255, 255, 0.35),
        inset 0 -15px 30px rgba(0, 0, 0, 0.5);
}

.theme-cyan .card-inner {
    background: linear-gradient(
        135deg,
        rgba(0, 242, 254, 0.15) 0%,
        rgba(11, 17, 54, 0.85) 100%
    );
    color: #fff;
    border: 1.5px solid rgba(0, 242, 254, 0.45);
    box-shadow:
        0 35px 70px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(0, 242, 254, 0.08),
        inset 0 18px 36px rgba(255, 255, 255, 0.15),
        inset 0 -12px 24px rgba(0, 0, 0, 0.4);
}

.theme-cyan:hover .card-inner {
    border-color: rgba(0, 242, 254, 0.85);
    box-shadow:
        0 50px 100px rgba(0, 0, 0, 0.85),
        0 0 50px rgba(0, 242, 254, 0.5),
        inset 0 22px 44px rgba(255, 255, 255, 0.25),
        inset 0 -15px 30px rgba(0, 0, 0, 0.5);
}

.theme-light .card-inner {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.16) 0%,
        rgba(255, 255, 255, 0.06) 100%
    );
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    box-shadow:
        0 35px 70px rgba(0, 0, 0, 0.5),
        inset 0 18px 36px rgba(255, 255, 255, 0.25),
        inset 0 -12px 24px rgba(0, 0, 0, 0.2);
}

.theme-light:hover .card-inner {
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow:
        0 50px 100px rgba(0, 0, 0, 0.85),
        0 0 40px rgba(255, 255, 255, 0.12),
        inset 0 22px 44px rgba(255, 255, 255, 0.35),
        inset 0 -15px 30px rgba(0, 0, 0, 0.3);
}

/* Card Typography */
.card-label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.card-title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 16px;
    letter-spacing: -0.02em;
}

/* Arch Mask */
.arch-mask {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15vh; /* Adjust height of the masking curve */
    z-index: 20;
    pointer-events: none;
}

.arch-mask svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Ambient glows styling and keyframe drifting animations */
.ambient-glows {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.glow-1 {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(
        circle,
        rgba(255, 107, 0, 0.12) 0%,
        rgba(255, 107, 0, 0) 70%
    );
    top: -100px;
    left: 20%;
    filter: blur(80px);
    animation: drift 20s infinite alternate ease-in-out;
}

.glow-2 {
    position: absolute;
    width: 800px;
    height: 800px;
    background: radial-gradient(
        circle,
        rgba(0, 150, 255, 0.1) 0%,
        rgba(0, 150, 255, 0) 70%
    );
    bottom: 10%;
    right: 15%;
    filter: blur(100px);
    animation: drift-reverse 25s infinite alternate ease-in-out;
}

.glow-3 {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(
        circle,
        rgba(255, 0, 128, 0.08) 0%,
        rgba(255, 0, 128, 0) 70%
    );
    top: 30%;
    right: 35%;
    filter: blur(70px);
    animation: drift-mid 18s infinite alternate ease-in-out;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(100px, 80px) scale(1.1);
    }
}

@keyframes drift-reverse {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(-120px, -60px) scale(0.9);
    }
}

@keyframes drift-mid {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    100% {
        transform: translate(-50px, 50px) rotate(180deg);
    }
}

/* ============ ACCESSIBILITY ============ */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    padding: 12px 24px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    border-radius: 0 0 4px 4px;
    z-index: 10001;
    transition: top 0.3s ease;
    text-decoration: none;
    font-size: 0.9rem;
}
.skip-link:focus {
    top: 0;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Logo */
.nav-logo {
    height: 38px;
    width: auto;
    display: block;
}
.logo-wrap {
    flex-shrink: 0;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 102;
}
.mobile-toggle span {
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Active link styling */
.active-link {
    color: var(--primary) !important;
}

/* Portfolio Footer */
.portfolio-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 0;
    border-top: 1px solid var(--border-dark);
    background: var(--background);
    z-index: 10;
}
.portfolio-footer .footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.portfolio-footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Hide lamp cursor on portfolio page mobile */
.lamp-cursor,
.lamp-canvas {
    pointer-events: none;
}

/* ============ RESPONSIVE — TABLET (max-width: 900px) ============ */
@media (max-width: 900px) {
    .navbar {
        padding: 20px 24px;
        flex-wrap: wrap;
    }
    .nav-title {
        order: 3;
        flex: 1 1 100%;
        margin-top: 16px;
        text-align: center;
    }
    .card {
        width: 300px;
        height: 400px;
        left: -150px;
        top: -200px;
    }
    .card-title {
        font-size: 26px;
    }
    .sticker {
        width: 64px;
        height: 64px;
        font-size: 14px;
    }
    .wheel {
        top: calc(
            50% + 1200px
        ); /* Shrinks wheel radius to bring cards closer */
    }
}

/* ============ RESPONSIVE — MOBILE (max-width: 768px) ============ */
@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        padding: 16px 16px;
        flex-wrap: wrap;
    }
    .nav-title {
        order: 3;
        flex: 1 1 100%;
        margin-top: 16px;
        text-align: center;
    }
    .nav-logo {
        height: 28px;
    }
    .mobile-toggle {
        display: flex;
    }
    .wheel {
        top: calc(50% + 800px); /* Tighter wheel radius */
    }

    /* Mobile nav slide-out */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 260px;
        height: 100vh;
        background: rgba(19, 19, 19, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 100px 28px 32px;
        gap: 32px;
        transition: right 0.4s cubic-bezier(0.22, 1, 0.36, 1);
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
        z-index: 101;
        border-left: 1px solid var(--border-dark);
    }
    .nav-links.open {
        right: 0;
    }
    .nav-links a {
        font-size: 15px;
        padding: 4px 0;
    }

    .wheel {
        top: calc(50% + 1000px);
    }

    /* Make cards significantly larger */
    .card {
        width: 320px;
        height: 440px;
        left: -160px; /* Must be exactly half of width */
        top: -220px;  /* Must be exactly half of height */
        border-radius: 32px;
    }
    .card-inner {
        border-radius: 32px;
        padding: 28px;
    }
    .card-label {
        font-size: 12px;
    }
    .card-title {
        font-size: 28px;
        margin-top: 14px;
    }
    .sticker {
        width: 60px;
        height: 60px;
        font-size: 16px;
    }

    /* Ambient glows — scale down to avoid scrollbar overflow */
    .glow-1 {
        width: 300px;
        height: 300px;
    }
    .glow-2 {
        width: 400px;
        height: 400px;
    }
    .glow-3 {
        width: 250px;
        height: 250px;
    }

    /* Footer */
    .portfolio-footer .footer-inner {
        padding: 0 16px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    .portfolio-footer {
        padding: 16px 0;
    }
    .portfolio-footer p {
        font-size: 0.78rem;
    }

    /* Hide lamp cursor on mobile */
    .lamp-cursor,
    .lamp-canvas {
        display: none !important;
    }
}

/* ============ SMALL MOBILE (max-width: 480px) ============ */
@media (max-width: 480px) {
    /* Widen the wheel to create a bigger gap between cards */
    .wheel {
        top: calc(50% + 900px);
    }

    /* Make cards larger for standard phones */
    .card {
        width: 280px;
        height: 400px;
        left: -140px; /* Must be exactly half of width */
        top: -200px;  /* Must be exactly half of height */
        border-radius: 28px;
    }
    .card-inner {
        border-radius: 28px;
        padding: 24px;
    }
    .card-title {
        font-size: 26px;
        margin-top: 12px;
    }
    .card-label {
        font-size: 11px;
    }
    .sticker {
        width: 52px;
        height: 52px;
        font-size: 14px;
        right: -12px !important;
    }
    .navbar {
        padding: 14px 12px;
    }
    .wheel {
        top: calc(
            50% + 550px
        ); /* Tightest wheel radius to fit 3 cards on screen */
    }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
