/* ============================================
   Vibes Page
   Side-projects gallery with live iframe previews
   ============================================ */

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

html {
    scroll-behavior: smooth;
    /* Clamp horizontal overflow at the html level. Setting overflow-x on
       <body> would force computed overflow-y to "auto" (per CSS spec), turning
       <body> into its own scroll container and blocking the viewport from
       scrolling at all. Keeping it on <html> lets the page scroll normally. */
    overflow-x: hidden;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background: #000C19;
    color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: url('assets/cursor.cur'), auto;
    min-height: 100vh;
}

a, button, [role="button"],
.vibes-card, .nav-link, .mobile-menu-link, .social-link, .hamburger,
.bg-switch, .bg-visibility, .vibes-btn {
    cursor: url('assets/pointer.cur'), pointer;
}

/* ============================================
   Backgrounds (dots / paths / grid)
   ============================================ */
#dotted-surface {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#dotted-surface.dots-hidden {
    opacity: 0;
}

#background-paths {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#background-paths.paths-visible {
    opacity: 0.1;
}

#background-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    -webkit-mask-image: radial-gradient(ellipse at center, black, transparent);
    mask-image: radial-gradient(ellipse at center, black, transparent);
}

#background-grid.grid-visible {
    opacity: 1;
}

/* ============================================
   Radial Glow — matches home page exactly
   ============================================ */
.glow {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    width: 150vw;
    height: 150vh;
    border-radius: 8px;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(
        circle,
        rgba(0, 120, 255, 0.95) 0%,
        rgba(0, 90, 220, 0.7) 20%,
        rgba(0, 60, 180, 0.35) 38%,
        rgba(0, 35, 130, 0.12) 52%,
        rgba(0, 20, 80, 0.04) 66%,
        rgba(0, 10, 40, 0.01) 80%,
        transparent 100%
    );
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
    animation: glow-enter 1.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards,
               glow-breathe 4s ease-in-out 2.1s infinite;
}

@keyframes glow-enter {
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes glow-breathe {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Page exit — matches home's exit (shrink to scale 0, fade) */
.page-exit-active .glow {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0) !important;
    animation: none !important;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

/* ============================================
   Navigation (mirrors motion.css)
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 40px 60px 60px;
}

/* Progressive blur behind navbar — base layer: linear-gradient tint + light backdrop blur, fading out toward the bottom edge */
.navbar::before {
    content: '';
    position: absolute;
    inset: 0;
    bottom: -40px;
    z-index: -1;
    background: linear-gradient(
        to bottom,
        rgba(0, 12, 25, 0.98) 0%,
        rgba(0, 12, 25, 0.78) 25%,
        rgba(0, 12, 25, 0.55) 50%,
        rgba(0, 12, 25, 0.3) 75%,
        rgba(0, 12, 25, 0) 100%
    );
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 55%, transparent 100%);
    transition: opacity 0.4s ease;
}

/* Progressive blur — heavier top layer that ramps off by the middle, stacking with the base for a graduated falloff */
.navbar::after {
    content: '';
    position: absolute;
    inset: 0;
    bottom: -40px;
    z-index: -1;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 25%, transparent 60%);
    mask-image: linear-gradient(to bottom, black 0%, black 25%, transparent 60%);
    transition: opacity 0.4s ease;
}

.hamburger {
    display: none;
}

.mobile-menu {
    display: none;
}

.nav-logo {
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    animation: nav-enter-logo 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}

@keyframes nav-enter-logo {
    to { opacity: 1; }
}

.nav-logo img {
    height: 48px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 8px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: var(--text-16);
    color: #fff;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(-20px);
    animation: nav-enter cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.nav-link:nth-child(1) { animation-delay: 0.2s; animation-duration: 0.5s; }
.nav-link:nth-child(2) { animation-delay: 0.25s; animation-duration: 0.45s; }
.nav-link:nth-child(3) { animation-delay: 0.3s; animation-duration: 0.4s; }
.nav-link:nth-child(4) { animation-delay: 0.35s; animation-duration: 0.35s; }
.nav-link:nth-child(5) { animation-delay: 0.4s; animation-duration: 0.3s; }

@keyframes nav-enter {
    to { opacity: 1; transform: translateY(0); }
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
    color: #1180f9;
    background: rgba(17, 128, 249, 0.08);
}

/* Nav exit (used on page transition out) */
.nav-exiting .nav-link {
    opacity: 0 !important;
    transform: translateY(-20px) !important;
}

.nav-exiting .nav-link:nth-child(5) { transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0s !important; }
.nav-exiting .nav-link:nth-child(4) { transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0s !important; }
.nav-exiting .nav-link:nth-child(3) { transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.05s !important; }
.nav-exiting .nav-link:nth-child(2) { transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.1s !important; }
.nav-exiting .nav-link:nth-child(1) { transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important; transition-delay: 0.15s !important; }

/* ============================================
   Background Controls (mirrors motion.css)
   ============================================ */
.bg-controls {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    opacity: 0;
    animation: nav-enter-logo 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}

.bg-switch,
.bg-visibility {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: none;
    color: #fff;
    font-size: var(--text-28);
    transition: color 0.2s ease, background 0.2s ease;
}

.bg-switch:hover,
.bg-visibility:hover {
    background: rgba(255, 255, 255, 0.08);
}

.bg-switch::before,
.bg-visibility::before {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-12);
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.bg-switch:hover::before,
.bg-visibility:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.bg-switch.bg-hidden {
    color: rgba(255, 255, 255, 0.3);
}

.nav-exiting .bg-controls {
    opacity: 0 !important;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ============================================
   Vibes Layout
   ============================================ */
.vibes-layout {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 200px 60px 80px;
    opacity: 0;
    animation: vibes-fade-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.25s forwards;
}

@keyframes vibes-fade-in {
    to { opacity: 1; }
}

/* ============================================
   Hero
   ============================================ */
.vibes-hero {
    margin: 0 auto 80px;
    text-align: center;
}

.vibes-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(17, 128, 249, 0.08);
    border: 1px solid rgba(17, 128, 249, 0.2);
    font-family: 'Space Mono', monospace;
    font-size: var(--text-12);
    font-weight: 500;
    color: #5aa3ff;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(12px);
    animation: vibes-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}

.vibes-eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 8px;
    background: #1180f9;
    box-shadow: 0 0 8px rgba(17, 128, 249, 0.8);
    animation: vibes-pulse 1.8s ease-in-out infinite;
}

@keyframes vibes-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.vibes-eyebrow-caret {
    margin-left: -2px;
    animation: vibes-blink 1.1s steps(2) infinite;
}

@keyframes vibes-blink {
    50% { opacity: 0; }
}

/* Title wrap holds the title plus the fanned AI logos */
.hero-title-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 24px;
    padding: 0 60px;
    /* Drives the chip fan-out distance — matches the title font-size */
    --fan: 60px;
}

.vibes-hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 800;
    font-size: var(--text-60);
    line-height: 1.05;
    letter-spacing: -0.03em;
    opacity: 0;
    transform: translateY(20px);
    animation: vibes-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
    position: relative;
    z-index: 1;
}

/* Fanned logo chips — start stacked at the center of the title,
   then fan outward to their final positions on entrance. */
.hero-logo-chip {
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -32px;
    margin-left: -32px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Bare tool logos — no keycap frame, just the icon. */
    z-index: 0;
    opacity: 0;
    transform: translate(0, 0) scale(0.4) rotate(0deg);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-logo-chip img {
    width: 40px;
    height: 40px;
    display: block;
}

/* .hero-logo-chip:hover {
    border-color: rgba(17, 128, 249, 0.35);
    box-shadow:
        0 14px 28px -8px rgba(17, 128, 249, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1.5px 0 rgba(255, 255, 255, 0.9),
        inset 0 -2px 0 rgba(0, 0, 0, 0.12);
} */

.hero-logo-tl { animation: fan-tl 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.55s forwards; }
.hero-logo-tr { animation: fan-tr 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards; }
.hero-logo-ml { animation: fan-ml 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.65s forwards; }
.hero-logo-mr { animation: fan-mr 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.7s forwards; }
.hero-logo-bl { animation: fan-bl 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards; }
.hero-logo-br { animation: fan-br 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards; }

@keyframes fan-tl {
    to {
        opacity: 1;
        transform: translate(calc(var(--fan) * -3.8), calc(var(--fan) * -0.7)) scale(1) rotate(-14deg);
    }
}
@keyframes fan-tr {
    to {
        opacity: 1;
        transform: translate(calc(var(--fan) *  3.8), calc(var(--fan) * -0.75)) scale(1) rotate(12deg);
    }
}
@keyframes fan-ml {
    to {
        opacity: 1;
        transform: translate(calc(var(--fan) * -4.3), calc(var(--fan) * 0.05)) scale(1) rotate(8deg);
    }
}
@keyframes fan-mr {
    to {
        opacity: 1;
        transform: translate(calc(var(--fan) *  4.3), calc(var(--fan) * -0.05)) scale(1) rotate(-10deg);
    }
}
@keyframes fan-bl {
    to {
        opacity: 1;
        transform: translate(calc(var(--fan) * -3.6), calc(var(--fan) * 0.85)) scale(1) rotate(10deg);
    }
}
@keyframes fan-br {
    to {
        opacity: 1;
        transform: translate(calc(var(--fan) *  3.8), calc(var(--fan) * 0.8)) scale(1) rotate(-12deg);
    }
}

/* Subtle float on hover of the whole hero wrap */
.hero-title-wrap:hover .hero-logo-tl { transform: translate(calc(var(--fan) * -3.85), calc(var(--fan) * -0.8)) scale(1) rotate(-18deg); }
.hero-title-wrap:hover .hero-logo-tr { transform: translate(calc(var(--fan) *  3.85), calc(var(--fan) * -0.85)) scale(1) rotate(16deg); }
.hero-title-wrap:hover .hero-logo-ml { transform: translate(calc(var(--fan) * -4.4), calc(var(--fan) * 0.05)) scale(1) rotate(12deg); }
.hero-title-wrap:hover .hero-logo-mr { transform: translate(calc(var(--fan) *  4.4), calc(var(--fan) * -0.05)) scale(1) rotate(-14deg); }
.hero-title-wrap:hover .hero-logo-bl { transform: translate(calc(var(--fan) * -3.65), calc(var(--fan) * 0.95)) scale(1) rotate(14deg); }
.hero-title-wrap:hover .hero-logo-br { transform: translate(calc(var(--fan) *  3.85), calc(var(--fan) * 0.9)) scale(1) rotate(-16deg); }

/* Easter-egg hint — cursor-following tooltip; only appears while a chip is hovered */
.hero-hint {
    position: fixed;
    top: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 12px;
    border-radius: 8px;
    background: rgba(17, 128, 249, 0.12);
    border: 1px solid rgba(17, 128, 249, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: 'Space Mono', monospace;
    font-size: var(--text-12);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.01em;
    opacity: 0;
    transform: translate(16px, 16px);
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.18s ease;
    will-change: transform, opacity;
}

.hero-hint i {
    font-size: var(--text-14);
    color: #5aa3ff;
}

.hero-hint.is-visible {
    opacity: 1;
}

.vibes-hero-title-accent {
    background: linear-gradient(135deg, #1180f9 0%, #66d2ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-style: italic;
    /* Italic slant on the trailing 's' extends past the inline-box edge —
       padding-right gives the glyph room so it isn't clipped at the right. */
    display: inline-block;
    padding-right: 0.12em;
}

.vibes-hero-blurb {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: var(--text-18);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    max-width: 580px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(20px);
    animation: vibes-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

/* "Computer:" prefix styled like a terminal prompt for the AI Side Quests theme */
.vibes-hero-prompt {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: #66d2ff;
    margin-right: 4px;
}

@keyframes vibes-up {
    to { opacity: 1; transform: translateY(0); }
}

/* Easter-egg hint pill — sits just below the hero blurb */
.hero-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 7px 14px 7px 12px;
    border-radius: 8px;
    background: rgba(17, 128, 249, 0.08);
    border: 1px solid rgba(17, 128, 249, 0.18);
    font-family: 'Space Mono', monospace;
    font-size: var(--text-12);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.01em;
    opacity: 0;
    transform: translateY(12px);
    animation: vibes-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.9s forwards;
}

.hero-hint i {
    font-size: var(--text-14);
    color: #5aa3ff;
    animation: hint-pulse 1.6s ease-in-out infinite;
}

@keyframes hint-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* Click-bonk feedback — brief brightness flash (transform stays untouched
   so the fan-out animation's forwards state isn't lost). */
.hero-logo-chip.chip-bonk {
    filter: brightness(1.7) drop-shadow(0 0 12px rgba(91, 163, 255, 0.65));
    transition: filter 0.12s ease;
}

/* ============================================
   Project Grid
   ============================================ */
.vibes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 36px;
}

.vibes-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.4s ease,
                border-color 0.4s ease,
                box-shadow 0.5s ease;
    opacity: 0;
    transform: translateY(28px);
    animation: vibes-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.vibes-card:nth-child(1) { animation-delay: 0.6s; }
.vibes-card:nth-child(2) { animation-delay: 0.7s; }

.vibes-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(17, 128, 249, 0.25);
    box-shadow: 0 24px 60px -20px rgba(17, 128, 249, 0.25),
                0 0 0 1px rgba(17, 128, 249, 0.05);
}

/* ============================================
   Card Preview (browser chrome + iframe)
   ============================================ */
.vibes-card-preview {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: #0a0a0d;
}

.vibes-card-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #0a0a0d;
}

/* Media variant — used when the card displays a video/image thumbnail instead of a live iframe */
.vibes-card-frame-media .vibes-card-frame-overlay,
.vibes-card-frame-media .vibes-card-loading {
    display: none;
}

.vibes-card-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #0a0a0d;
    transform: scale(1.001); /* avoid sub-pixel edges on hover scale */
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.vibes-card:hover .vibes-card-video {
    transform: scale(1.03);
}

.vibes-card-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 1400px;
    height: 875px;
    border: 0;
    transform-origin: top left;
    /* JS sets the scale based on container width — fallback ~0.4 */
    transform: scale(0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.vibes-card-iframe.is-loaded {
    opacity: 1;
}

/* Subtle gradient sheen on top of iframe — softens raw site visuals */
.vibes-card-frame-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(to bottom, transparent 60%, rgba(0, 0, 2, 0.35) 100%),
        radial-gradient(ellipse at top right, rgba(17, 128, 249, 0.08), transparent 60%);
    opacity: 0.9;
    transition: opacity 0.4s ease;
}

.vibes-card:hover .vibes-card-frame-overlay {
    opacity: 0.4;
}

/* Loading state */
.vibes-card-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Space Mono', monospace;
    font-size: var(--text-12);
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.vibes-card-iframe.is-loaded ~ .vibes-card-loading {
    opacity: 0;
}

.vibes-card-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-top-color: #1180f9;
    border-radius: 8px;
    animation: vibes-spin 0.9s linear infinite;
}

@keyframes vibes-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Card Body
   ============================================ */
.vibes-card-body {
    position: relative;
    padding: 28px 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    background:
        linear-gradient(to bottom, rgba(8, 8, 14, 0.75), rgba(8, 8, 14, 0.75));
    backdrop-filter: blur(60px) saturate(160%);
    -webkit-backdrop-filter: blur(60px) saturate(160%);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.vibes-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.vibes-card-titlewrap {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}

.vibes-card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: var(--text-28);
    letter-spacing: -0.01em;
    color: #fff;
    line-height: 1.1;
}

.vibes-card-year {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-12);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    padding-top: 4px;
    flex-shrink: 0;
}

.vibes-card-description {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-15);
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.65);
}

.vibes-card-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.vibes-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.vibes-chip img {
    width: 18px;
    height: 18px;
    display: block;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.vibes-card:hover .vibes-chip {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.vibes-chip:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.vibes-chip:hover img {
    opacity: 1;
}

/* Tooltip — appears above on hover, like the social-links pattern */
.vibes-chip::after {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-11);
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 5;
}

.vibes-chip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   Card Actions (CTAs)
   ============================================ */
.vibes-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.vibes-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 4px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-14);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    position: relative;
    z-index: 2;
}

.vibes-btn i {
    font-size: var(--text-16);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.vibes-btn-primary {
    background: #1180f9;
    color: #fff;
}

.vibes-btn-primary:hover {
    background: #2b91ff;
}

.vibes-btn-primary:hover i {
    transform: translate(2px, -2px);
}

.vibes-btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
}

.vibes-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ============================================
   Footer
   ============================================ */
.vibes-footer {
    margin-top: 80px;
    padding: 32px 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    animation: vibes-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 1s forwards;
}

.vibes-footer-text {
    font-family: 'Space Mono', monospace;
    font-size: var(--text-12);
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.02em;
}

/* ============================================
   Social Links (mirrors motion.css)
   ============================================ */
.social-links {
    position: fixed;
    bottom: 40px;
    right: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
}

.social-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 1);
    font-size: var(--text-24);
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    opacity: 0;
    animation: social-enter cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.social-link:nth-child(1) { animation-delay: 0.4s; animation-duration: 1.0s; }
.social-link:nth-child(2) { animation-delay: 0.5s; animation-duration: 0.9s; }
.social-link:nth-child(3) { animation-delay: 0.6s; animation-duration: 0.8s; }

@keyframes social-enter {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

.social-link:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.08);
}

.social-link::before {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 6px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: var(--text-12);
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.social-link:hover::before {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ============================================
   Page exit (used on internal link navigation)
   ============================================ */
.page-exit-active .vibes-layout,
.page-exit-active .social-links {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.page-exit-active #dotted-surface,
.page-exit-active #background-paths,
.page-exit-active #background-grid {
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.page-exit-active .nav-logo {
    opacity: 0 !important;
    transition: opacity 0.5s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

/* ============================================
   Responsive — Tablet
   ============================================ */
@media (max-width: 1024px) {
    .vibes-layout {
        padding: 180px 40px 60px;
    }

    .vibes-grid {
        gap: 28px;
    }
}

/* ============================================
   Responsive — Mobile
   ============================================ */
@media (max-width: 768px) {
    .navbar {
        padding: 3rem;
        justify-content: flex-start;
        /* Raise above the mobile-menu (z:105) so the hamburger / close X
           stays clickable while the menu is open. */
        z-index: 110;
    }

    .nav-logo {
        left: 20px;
    }

    .nav-logo img {
        height: 40px;
    }

    .nav-links {
        display: none;
    }

    .bg-controls {
        display: none;
    }

    /* Hamburger button */
    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        padding: 8px;
        background: none;
        border: none;
        z-index: 110;
        opacity: 0;
        animation: nav-enter-logo 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
    }

    .hamburger-line {
        display: block;
        width: 100%;
        height: 2px;
        background: #fff;
        border-radius: 2px;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .hamburger.is-open .hamburger-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .hamburger.is-open .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .hamburger.is-open .hamburger-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Mobile menu overlay */
    .mobile-menu {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        position: fixed;
        inset: 0;
        z-index: 105;
        background: rgba(0, 0, 2, 0.95);
        backdrop-filter: blur(20px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .mobile-menu.menu-open {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-menu-link {
        font-family: 'IBM Plex Sans', sans-serif;
        font-weight: 600;
        font-size: var(--text-24);
        color: #fff;
        text-decoration: none;
        padding: 1rem 3rem;
        border-radius: 8px;
        opacity: 0;
        transform: translateY(20px);
    }

    .mobile-menu.menu-open .mobile-menu-link {
        animation: nav-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .mobile-menu.menu-open .mobile-menu-link:nth-child(1) { animation-delay: 0.1s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(2) { animation-delay: 0.15s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(3) { animation-delay: 0.2s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(4) { animation-delay: 0.25s; }
    .mobile-menu.menu-open .mobile-menu-link:nth-child(5) { animation-delay: 0.3s; }

    .mobile-menu.menu-closing {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s;
    }

    .mobile-menu.menu-closing .mobile-menu-link {
        opacity: 1;
        transform: translateY(0);
        animation: menu-exit 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .mobile-menu.menu-closing .mobile-menu-link:nth-child(5) { animation-delay: 0s; }
    .mobile-menu.menu-closing .mobile-menu-link:nth-child(4) { animation-delay: 0s; }
    .mobile-menu.menu-closing .mobile-menu-link:nth-child(3) { animation-delay: 0.05s; }
    .mobile-menu.menu-closing .mobile-menu-link:nth-child(2) { animation-delay: 0.1s; }
    .mobile-menu.menu-closing .mobile-menu-link:nth-child(1) { animation-delay: 0.15s; }

    @keyframes menu-exit {
        from { opacity: 1; transform: translateY(0); }
        to { opacity: 0; transform: translateY(12px); }
    }

    .mobile-menu-link.active {
        color: #1180f9;
        background: rgba(17, 128, 249, 0.08);
    }

    .mobile-menu-socials {
        display: flex;
        flex-direction: row;
        gap: 1.25rem;
        margin-top: 1.5rem;
        opacity: 0;
        transform: translateY(20px);
    }

    .mobile-menu.menu-open .mobile-menu-socials {
        animation: nav-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
    }

    .mobile-menu-social {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        border-radius: 8px;
        border: 1.5px solid rgba(255, 255, 255, 0.4);
        color: #fff;
        font-size: var(--text-24);
        text-decoration: none;
        transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    }

    .nav-exiting .hamburger {
        opacity: 0 !important;
        transition: opacity 0.4s ease;
    }

    /* Layout adjustments */
    .vibes-layout {
        padding: 160px 20px 40px;
        /* Safety clip in case fanned chips/transforms try to escape the
           viewport on narrow phones. */
        overflow-x: clip;
    }

    .vibes-hero {
        margin-bottom: 56px;
    }

    .vibes-hero-blurb {
        font-size: var(--text-16);
    }

    .vibes-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .vibes-card:nth-child(1) {
        grid-column: auto;
    }

    .vibes-card-body {
        padding: 22px 22px 22px;
        gap: 14px;
    }

    .vibes-card-title {
        font-size: var(--text-24);
    }

    .vibes-card-description {
        font-size: var(--text-14);
    }

    .browser-url {
        font-size: var(--text-10);
    }

    /* Social links — hide on mobile (live in burger menu) */
    .social-links {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero-title-wrap {
        padding: 0 36px;
        /* Pull the fanned chips in tighter on tablet. */
        --fan: 48px;
    }

    .hero-logo-chip {
        width: 56px;
        height: 56px;
        margin-top: -28px;
        margin-left: -28px;
        border-radius: 11px;
    }

    .hero-logo-chip img {
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 480px) {
    .vibes-hero-title {
        font-size: var(--text-52);
    }

    .hero-title-wrap {
        padding: 0 28px;
        /* Tightened so the fanned chips don't overflow the viewport. */
        --fan: 36px;
    }

    .hero-logo-chip {
        width: 48px;
        height: 48px;
        margin-top: -24px;
        margin-left: -24px;
        border-radius: 4px;
    }

    .hero-logo-chip img {
        width: 26px;
        height: 26px;
    }

    /* Live site + Code buttons sit side-by-side on mobile. */
    .vibes-card-actions {
        flex-direction: row;
        align-items: stretch;
        flex-wrap: wrap;
    }

    .vibes-btn {
        flex: 1 1 0;
        justify-content: center;
        min-width: 0;
    }
}

/* Navigation typography — Pixelify Sans for the keyboard/computer theme.
   Appended as an override so it wins over each file's earlier .nav-link rule
   without needing per-page edits to the original declarations. */
.nav-link,
.mobile-menu-link {
    font-family: 'Space Grotesk', sans-serifns-serif;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   Mobile navbar — standardized to match the index.html navbar exactly.
   Appended last so it wins over this file's earlier navbar rules (logo size
   was inconsistent and the bar height / logo position varied per page).
   ========================================================================== */
@media (max-width: 640px) {
    .navbar {
        padding: 0;
        height: 64px;
    }

    .nav-logo {
        left: 16px;
        top: 22px;
        transform: none;
    }

    .nav-logo img,
    .nav-logo .nav-logo-svg {
        height: 36px;
    }

    .hamburger {
        right: 16px;
        top: 22px;
        transform: none;
    }
}
