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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    width: 100vw;
    position: relative;
    background: #0a0a0f;
}

/* ============================================
   SKIP LINK (accessibility)
   ============================================ */
.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 9999;
    padding: 8px 16px;
    background: #667eea;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

/* ============================================
   BACKGROUND — CYCLING ART IMAGES
   ============================================ */
.background-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 1.5s ease;
}

/* ============================================
   CLOUD OVERLAY LAYERS (displacement animation)
   ============================================ */
.cloud-layer {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    mix-blend-mode: screen;
    z-index: 2;
    will-change: transform;
    -webkit-mask-image: linear-gradient(to bottom,
        transparent 3%, black 18%, black 82%, transparent 97%);
    mask-image: linear-gradient(to bottom,
        transparent 3%, black 18%, black 82%, transparent 97%);
}

/* Inner A/B divs hold background images and cross-fade independently */
.cloud-inner {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 1.5s ease;
}
.cloud-inner:first-child { z-index: 1; opacity: 1; }
.cloud-inner:last-child  { z-index: 2; opacity: 0; }

.cloud-layer-1 {
    filter: url(#cloud-warp);
    animation: cloud-drift-1 20s ease-in-out infinite,
               cloud-fade    26s ease-in-out infinite;
}

.cloud-layer-2 {
    filter: url(#cloud-warp-b);
    animation: cloud-drift-2 24s ease-in-out infinite,
               cloud-fade    26s -3s ease-in-out infinite;
}

@keyframes cloud-drift-1 {
    0%, 100% { transform: scale(1.10) translate(-1.0%, -0.5%) rotate(-3deg); }
    25%      { transform: scale(1.07) translate( 0.7%,  0.8%) rotate( 1deg); }
    55%      { transform: scale(1.06) translate( 0.9%,  0.4%) rotate( 4deg); }
    78%      { transform: scale(1.08) translate(-0.4%,  0.6%) rotate(-1deg); }
}

@keyframes cloud-drift-2 {
    0%, 100% { transform: scale(1.08) translate( 0.7%, -0.5%) rotate( 3deg); }
    30%      { transform: scale(1.10) translate(-0.5%,  0.5%) rotate(-2deg); }
    62%      { transform: scale(1.07) translate(-0.9%,  0.9%) rotate(-4deg); }
}

@keyframes cloud-fade {
    0%, 100% { opacity: 0.96; }
    32%      { opacity: 0.96; }
    50%      { opacity: 0.42; }
    68%      { opacity: 0.96; }
}

/* ============================================
   PHASE 1 — SKIP HINT
   ============================================ */
.skip-hint {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    animation: skipHintFadeIn 0.7s 1.5s ease-out forwards;
    white-space: nowrap;
}

@keyframes skipHintFadeIn {
    to { opacity: 1; }
}

.skip-hint.hidden {
    animation: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ============================================
   PHASE 2 — GLASSMORPHISM CIRCLE
   ============================================ */
.splash-circle {
    position: fixed;
    top: calc(50% - 50px);
    left: calc(38vw - 100px);
    /* Start well off-screen to the left — individual property, compose with JS rotate */
    translate: calc(-50% - 120vw) -50%;
    width: min(60vmin, 576px);
    height: min(60vmin, 576px);
    border-radius: 50%;
    background: rgba(8, 4, 20, 0.08);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow:
        0 0 40px rgba(102, 126, 234, 0.35),
        0 8px 48px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 100;
    will-change: translate, rotate;
}

.splash-circle.entered {
    animation:
        circleTranslateIn 2.3s linear    forwards,
        circleAppear      2.3s ease-out  forwards;
}

/* Filter + glow animation — separate from transform so they don't conflict */
@keyframes circleAppear {
    0%   {
        filter: blur(16px) brightness(1.9) saturate(0.4);
        box-shadow: 0 0 40px rgba(102,126,234,0.35), 0 8px 48px rgba(0,0,0,0.5);
    }
    35%  { filter: blur(9px) brightness(1.5) saturate(0.7); }
    55%  {
        filter: blur(1px) brightness(2.8) saturate(1.4);
        box-shadow: 0 0 140px rgba(255,255,255,0.85),
                    0 0 240px rgba(160,130,255,0.65),
                    0 8px 48px rgba(0,0,0,0.5);
    }
    66%  {
        filter: blur(0px) brightness(1.18) saturate(1.1);
        box-shadow: 0 0 70px rgba(160,130,255,0.45), 0 8px 48px rgba(0,0,0,0.5);
    }
    100% {
        filter: blur(0px) brightness(1.0) saturate(1.0);
        box-shadow: 0 0 40px rgba(102,126,234,0.35), 0 8px 48px rgba(0,0,0,0.5);
    }
}

@keyframes circleRollIn {
    /* Used by the splash ring — keeps transform for ring path */
    0%   {
        transform: translate(calc(-50% - 120vw), -50%) rotate(0deg);
        animation-timing-function: cubic-bezier(0.45, 0, 0.75, 0.85);
    }
    55%  {
        transform: translate(calc(-50% + 50vw),  -50%) rotate(480deg);
        animation-timing-function: cubic-bezier(0.15, 0, 0.35, 1);
    }
    70%  {
        transform: translate(calc(-50% - 9vw),   -50%) rotate(310deg);
        animation-timing-function: ease-in-out;
    }
    82%  { transform: translate(calc(-50% + 22px),  -50%) rotate(318deg); }
    90%  { transform: translate(calc(-50% - 8px),   -50%) rotate(313deg); }
    95%  { transform: translate(calc(-50% + 3px),   -50%) rotate(316deg); }
    100% { transform: translate(-50%, -50%)                rotate(360deg); }
}

/* Translate-only path — circle uses this so CSS translate + JS rotate compose independently */
@keyframes circleTranslateIn {
    0%   {
        translate: calc(-50% - 120vw) -50%;
        animation-timing-function: cubic-bezier(0.45, 0, 0.75, 0.85);
    }
    55%  {
        translate: calc(-50% + 50vw) -50%;
        animation-timing-function: cubic-bezier(0.15, 0, 0.35, 1);
    }
    70%  {
        translate: calc(-50% - 9vw) -50%;
        animation-timing-function: ease-in-out;
    }
    82%  { translate: calc(-50% + 22px) -50%; }
    90%  { translate: calc(-50% - 8px) -50%; }
    95%  { translate: calc(-50% + 3px) -50%; }
    100% { translate: -50% -50%; }
}

.circle-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 48px;
    overflow-y: auto;
    text-align: center;
    gap: 6px;
    scrollbar-width: none;
}
.circle-inner::-webkit-scrollbar { display: none; }

/* Content visible immediately — rolls in with the circle, blur from circleAppear handles the reveal */
.circle-profile,
.circle-name,
.circle-tagline,
.circle-bio {
    opacity: 1;
}

/* Analog clock canvas overlay — sits on top of .circle-inner, hidden after click */
#analogClock {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: 10;
    pointer-events: none; /* clicks pass through to the circle's own click handler */
    opacity: 1;
    display: block;
}

.circle-profile {
    width: 117px;
    height: 117px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 22px rgba(180, 155, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
}

.circle-name {
    font-size: clamp(1.09rem, 2.88vmin, 1.67rem);
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1), 0 4px 20px rgba(0, 0, 0, 0.9);
    margin: 0;
    line-height: 1.2;
}

.circle-tagline {
    font-size: clamp(0.86rem, 1.96vmin, 1.20rem);
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 1), 0 3px 12px rgba(0, 0, 0, 0.85);
    margin: 0;
}

.circle-bio {
    font-size: clamp(0.92rem, 1.9vmin, 1.17rem);
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 1), 0 2px 8px rgba(0, 0, 0, 0.9);
    margin: 0;
}

.circle-profile.revealed,
.circle-name.revealed,
.circle-tagline.revealed,
.circle-bio.revealed {
    opacity: 1;
}

/* ============================================
   NAV BUBBLES
   ============================================ */
.nav-bubble {
    position: fixed;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    z-index: 100;
    /* Hidden + collapsed until JS adds .visible */
    opacity: 0;
    transform: scale(0);
    transition:
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity   0.2s ease,
        background 0.22s ease,
        box-shadow 0.22s ease;
    /* Reset button defaults */
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: 1;
}

.nav-bubble.visible {
    opacity: 1;
    transform: scale(1);
}

.nav-bubble.visible:hover {
    transform: scale(1.44);
    background: rgba(102, 126, 234, 0.35);
    box-shadow: 0 0 28px rgba(102, 126, 234, 0.55);
}

.nav-bubble.coming-soon {
    border-style: dashed;
    opacity: 0;
    transform: scale(0);
    cursor: pointer;
}

.nav-bubble.coming-soon.visible {
    opacity: 0.52;
    transform: scale(1);
}

.nav-bubble.coming-soon:hover {
    transform: scale(1.35) !important;
    background: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 0 22px rgba(102, 126, 234, 0.45) !important;
    opacity: 0.85 !important;
}

.bubble-icon {
    font-size: 1.55rem;
    line-height: 1;
    display: block;
    text-shadow: 0 1px 0 rgba(0,0,0,0.95), 0 2px 6px rgba(0,0,0,0.75);
}

.bubble-label {
    font-size: 0.48rem;
    letter-spacing: 0.05em;
    text-align: center;
    opacity: 0.8;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    text-shadow: 0 1px 0 rgba(0,0,0,0.95), 0 1px 4px rgba(0,0,0,0.8);
}

/* Bubble positions.
   All 5 main nav bubbles arc right of circle at consistent R=378 from center (288 radius + 44 bubble radius + 46 gap).
   Angles evenly spaced -30°, -12°, 5°, 22°, 40° — so every bubble center sits exactly on the circumference.
   Bubbles 6-8 (coming-soon) cluster just below Projects. */
#bubble-1 { left: calc(38vw + 146px); top: calc(50vh + 149px); }  /* 40° */
#bubble-2 { left: calc(38vw + 183px); top: calc(50vh - 283px); }  /* -30° */
#bubble-3 { left: calc(38vw + 226px); top: calc(50vh - 173px); }  /* -12° */
#bubble-4 { left: calc(38vw + 232px); top: calc(50vh -  61px); }  /*   5° */
#bubble-5 { left: calc(38vw + 207px); top: calc(50vh +  48px); }  /*  22° */
#bubble-6 { left: calc(38vw +  54px); top: calc(50vh + 253px); }  /* lower-left of Projects */
#bubble-7 { left: calc(38vw + 146px); top: calc(50vh + 265px); }  /* directly below Projects */
#bubble-8 { left: calc(38vw + 238px); top: calc(50vh + 253px); }  /* lower-right of Projects */

/* ============================================
   SPLASH RING — expanding burst when circle breaks through
   ============================================ */
.splash-ring {
    position: fixed;
    top: calc(50% - 50px);
    left: calc(38vw - 100px);
    width: min(60vmin, 576px);
    height: min(60vmin, 576px);
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0);
    pointer-events: none;
    z-index: 99;
    opacity: 0;
    will-change: transform, opacity;
    /* Starts at the same off-screen position as the circle */
    transform: translate(calc(-50% - 120vw), -50%);
}

.splash-ring.entered {
    /* Follows the circle's path, then bursts at ~55% (1.27s into journey) */
    animation:
        circleRollIn 2.3s linear forwards,
        splashBurst  0.7s 1.27s ease-out forwards;
}

@keyframes splashBurst {
    /* Targets only opacity/border/box-shadow — no transform conflict with circleRollIn */
    0%   {
        opacity: 1;
        border-color: rgba(255, 255, 255, 0.95);
        box-shadow: 0 0 0 rgba(200, 180, 255, 0);
    }
    25%  {
        box-shadow: 0 0 80px rgba(200, 180, 255, 0.9),
                    0 0 160px rgba(255, 255, 255, 0.4);
    }
    100% {
        opacity: 0;
        border-color: rgba(255, 255, 255, 0);
        box-shadow: 0 0 220px rgba(200, 180, 255, 0.2),
                    0 0 0 rgba(255, 255, 255, 0);
    }
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 150;
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.10);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.footer-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.link {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
    position: relative;
    padding-bottom: 2px;
}
.link::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 1px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}
.link:hover { color: #fff; }
.link:hover::after { width: 100%; }

/* ============================================
   PRELOAD (hidden)
   ============================================ */
.preload-container {
    position: absolute;
    width: 0; height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   RESPONSIVE — MOBILE (< 768px)
   ============================================ */
@media (max-width: 768px) {
    .splash-circle {
        top: 50%;
        left: 50%;
        width: min(70vw, 384px);
        height: min(70vw, 384px);
    }
    .splash-ring {
        top: 50%;
        left: 50%;
        width: min(70vw, 384px);
        height: min(70vw, 384px);
    }
    .splash-circle.entered {
        translate: -50% -38%;
    }
    .circle-profile { width: 80px; height: 80px; }

    /* Stack bubbles in 4×2 grid along the bottom */
    .nav-bubble {
        width: 72px;
        height: 72px;
        position: fixed;
        left: auto !important;
        top: auto !important;
    }
    /* bubble-1 (Projects) centered at bottom, 6/7/8 cluster below it */
    #bubble-1 { bottom: 152px; left: 50% !important; transform: translateX(-50%); }
    #bubble-2 { bottom: 156px; left: calc(10vw +   0px) !important; }
    #bubble-3 { bottom: 156px; left: calc(10vw +  80px) !important; }
    #bubble-4 { bottom: 156px; left: calc(10vw + 160px) !important; }
    #bubble-5 { bottom: 156px; left: calc(10vw + 240px) !important; }
    #bubble-6 { bottom:  76px; left: calc(50% - 116px) !important; }
    #bubble-7 { bottom:  76px; left: calc(50% -  36px) !important; }
    #bubble-8 { bottom:  76px; left: calc(50% +  44px) !important; }
}

/* ============================================
   LAND ACKNOWLEDGEMENT CIRCLE
   ============================================ */
.land-circle {
    position: fixed;
    top: calc(50% - 50px);
    left: 78vw;
    width: min(58vmin, 520px);
    height: min(58vmin, 520px);
    border-radius: 50%;
    background: rgba(8, 4, 20, 0.08);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow:
        0 0 40px rgba(102, 126, 234, 0.3),
        0 8px 48px rgba(0, 0, 0, 0.5);
    z-index: 100;
    translate: -50% -50%;
    scale: 0.01;
    opacity: 0;
    pointer-events: none;
    will-change: scale, opacity, filter;
}

.land-circle.active {
    animation: landCircleGrow 7s cubic-bezier(0.15, 0, 0.35, 1) forwards;
    pointer-events: auto;
}

@keyframes landCircleGrow {
    0%   { scale: 0.01; opacity: 0; filter: blur(24px) brightness(4); }
    8%   { opacity: 1; }
    60%  { scale: 0.88; filter: blur(5px) brightness(1.3); }
    82%  { scale: 0.98; filter: blur(1px) brightness(1.04); }
    100% { scale: 1;    opacity: 1; filter: blur(0px) brightness(1); }
}

.land-circle-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 52px;
    box-sizing: border-box;
}

.land-ack-text {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.15rem;
    line-height: 1.72;
    text-align: center;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 1), 0 2px 8px rgba(0, 0, 0, 0.9);
    rotate: 720deg;
    filter: blur(18px);
    opacity: 0;
    will-change: rotate, filter, opacity;
}

.land-circle.active .land-ack-text {
    animation: landTextSpin 7s cubic-bezier(0.04, 0, 0.1, 1) forwards;
}

@keyframes landTextSpin {
    0%   { rotate: 720deg; filter: blur(20px); opacity: 0; }
    8%   { opacity: 1; }
    72%  { filter: blur(3px); }
    100% { rotate: 0deg;   filter: blur(0px);  opacity: 1; }
}

.land-title {
    position: fixed;
    top: calc(50% - 50px - min(29vmin, 260px) - 38px);
    left: 78vw;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.95), 0 2px 16px rgba(0, 0, 0, 0.8);
    z-index: 101;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
}

.land-title.active {
    animation: landTitleAppear 1.4s ease-out 6s forwards;
}

@keyframes landTitleAppear {
    0%   { opacity: 0;    transform: translateX(-50%) translateY(10px) scale(0.7); }
    55%  { opacity: 1;    transform: translateX(-50%) translateY(-4px)  scale(1.18); }
    75%  {               transform: translateX(-50%) translateY(2px)   scale(0.96); }
    90%  {               transform: translateX(-50%) translateY(-1px)  scale(1.04); }
    100% { opacity: 0.85; transform: translateX(-50%) translateY(0)     scale(1); }
}

@media (max-width: 1200px) {
    .land-circle,
    .land-title { display: none; }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.nav-bubble:focus-visible,
.link:focus-visible {
    outline: 2px solid rgba(102, 126, 234, 0.9);
    outline-offset: 4px;
}
