/* ===== Design Tokens ===== */
:root {
    --bg-dark:     #07090f;
    --gradient-1:  #0d1b2a;
    --gradient-2:  #112240;
    --gradient-3:  #0f3460;

    /* Card accent colours */
    --rook-from:   #6c3bff;
    --rook-to:     #a78bfa;
    --conan-from:  #c94b0e;
    --conan-to:    #fb923c;
    --spell-from:  #0891b2;
    --spell-to:    #38bdf8;
    --lord-from:   #15803d;
    --lord-to:     #4ade80;
}

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

/* ===== Base ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* ===== Particle canvas ===== */
#particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ===== Animated radial gradient background ===== */
.background-animation {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: radial-gradient(ellipse at 50% 60%,
        var(--gradient-3) 0%,
        var(--gradient-2) 40%,
        var(--gradient-1) 70%,
        var(--bg-dark) 100%);
    background-size: 200% 200%;
    animation: moveGradient 18s ease infinite;
}

@keyframes moveGradient {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== Main container ===== */
main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1.5rem 3rem;
    text-align: center;
    width: 100%;
}

/* ===========================
   LOGO
   =========================== */
#logo {
    font-size: clamp(4rem, 16vw, 10rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    display: flex;
    justify-content: center;

    /* Phase 1: zoom-in from nothing */
    transform: scale(0);
    opacity: 1;
    animation: logoZoom 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s forwards;

    /* Phase 3: smooth shrink transition to header */
    transition:
        font-size  0.7s cubic-bezier(0.4, 0, 0.2, 1),
        letter-spacing 0.7s ease,
        margin-bottom  0.7s ease;
}

@keyframes logoZoom {
    to { transform: scale(1); opacity: 1; }
}

/* Thin separator below shrunken logo */
#logo.logo-small {
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

/* Individual letters */
.letter {
    display: inline-block;
    background: linear-gradient(135deg, #ffffff 0%, #8ab4f8 60%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: transform 0.15s ease;
}

/* Static dot that does not animate */
.logo-dot {
    display: inline-block;
    background: linear-gradient(135deg, #ffffff 0%, #8ab4f8 60%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Phase 2: spinning animations */
.letter.bouncing.spin-left {
    animation: letterSpinLeft 1.4s cubic-bezier(0.45, 0, 0.55, 1) both;
}

.letter.bouncing.spin-right {
    animation: letterSpinRight 1.4s cubic-bezier(0.45, 0, 0.55, 1) both;
}

@keyframes letterSpinLeft {
    0%   { transform: scale(1)    rotate(0deg);   }
    15%  { transform: scale(1.30) rotate(-45deg); }
    50%  { transform: scale(1.30) rotate(-360deg); }
    85%  { transform: scale(1.15) rotate(-675deg); }
    100% { transform: scale(1)    rotate(-720deg);   }
}

@keyframes letterSpinRight {
    0%   { transform: scale(1)    rotate(0deg);   }
    15%  { transform: scale(1.30) rotate(45deg);  }
    50%  { transform: scale(1.30) rotate(360deg); }
    85%  { transform: scale(1.15) rotate(675deg); }
    100% { transform: scale(1)    rotate(720deg);   }
}


/* ===== Tagline ===== */
#tagline {
    font-size: clamp(0.85rem, 2.5vw, 1.15rem);
    font-weight: 300;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    opacity: 0;
    /* revealed after bounce phase via JS */
    transition: opacity 0.8s ease, transform 0.8s ease;
    transform: translateY(8px);
}
/* tagline only shown briefly; JS handles opacity directly */
#tagline.visible {
    opacity: 1;
    transform: translateY(0);
}


/* ===========================
   PROJECT CARDS NAV
   =========================== */
#projects {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    width: 100%;
    max-width: 820px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    pointer-events: none;
}

#projects.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ===== Individual card ===== */
.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 1.6rem 1.7rem 1.5rem;
    border-radius: 20px;
    text-decoration: none;
    color: #fff;
    overflow: hidden;
    cursor: pointer;

    background: linear-gradient(145deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.02) 100%);
    border: 1px solid rgba(255,255,255,0.10);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 24px rgba(0,0,0,0.25);

    /* staggered slide-up via CSS var --card-delay set inline */
    opacity: 0;
    transform: translateY(24px) scale(0.97);
    transition:
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) var(--card-delay),
        opacity 0.4s ease var(--card-delay),
        box-shadow 0.35s ease,
        border-color 0.3s ease;
}

#projects.visible .project-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Glowing gradient pseudo-element (the coloured top-border glow) */
.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--card-gradient);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

/* Hover glow overlay */
.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--card-gradient);
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 0;
}

.project-card:hover {
    transform: translateY(-7px) scale(1.04) !important;
    box-shadow:
        0 24px 60px -12px var(--card-glow),
        inset 0 1px 0 rgba(255,255,255,0.14);
    border-color: transparent;
}

.project-card:hover::before { opacity: 1; }
.project-card:hover::after  { opacity: 0.08; }

/* Content sits above pseudo-elements */
.project-card > * {
    position: relative;
    z-index: 1;
}

/* ===== Card icon ===== */
.card-icon {
    font-size: 2.25rem;
    line-height: 1;
    filter: drop-shadow(0 0 14px var(--card-glow));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: 0.15rem;
}
.project-card:hover .card-icon {
    transform: scale(1.25) rotate(-5deg);
}

/* ===== Card title ===== */
.card-title {
    font-size: clamp(1.05rem, 2.8vw, 1.3rem);
    font-weight: 700;
    background: var(--card-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

/* ===== Card description ===== */
.card-desc {
    font-size: clamp(0.75rem, 1.8vw, 0.88rem);
    font-weight: 300;
    color: rgba(255,255,255,0.55);
    line-height: 1.45;
}

/* ===== Per-card colour theming ===== */
.card-rook {
    --card-gradient: linear-gradient(135deg, var(--rook-from), var(--rook-to));
    --card-glow: rgba(108, 59, 255, 0.45);
}
.card-conan {
    --card-gradient: linear-gradient(135deg, var(--conan-from), var(--conan-to));
    --card-glow: rgba(201, 75, 14, 0.45);
}
.card-spell {
    --card-gradient: linear-gradient(135deg, var(--spell-from), var(--spell-to));
    --card-glow: rgba(8, 145, 178, 0.45);
}
.card-lord {
    --card-gradient: linear-gradient(135deg, var(--lord-from), var(--lord-to));
    --card-glow: rgba(21, 128, 61, 0.45);
}

/* ===========================
   MOBILE
   =========================== */
@media (max-width: 520px) {
    #projects {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .project-card {
        padding: 1.2rem 1.2rem 1.1rem;
    }
}

@media (min-width: 521px) and (max-width: 700px) {
    #projects {
        max-width: 480px;
    }
}

/* ===== Focus / accessibility ===== */
.project-card:focus-visible {
    outline: 2px solid rgba(255,255,255,0.5);
    outline-offset: 4px;
}
