/* ============================================================
   Design Platform — Custom Styles & Animations
   Mobile-First  ·  Glassmorphism  ·  3D Hero
   ============================================================ */

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

:root {
    --bg-base: #030712;
    --tone-indigo: rgba(99, 102, 241, 0.34);
    --tone-pink: rgba(244, 114, 182, 0.28);
    --tone-cyan: rgba(45, 212, 191, 0.24);
}

html {
    background: #001152;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    background: transparent;
}

/* When no gradient-bg is present, fall back to dark background */
body:not(:has(.gradient-bg)) {
    background: var(--bg-base);
}

#pageWrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

#showcaseZone {
    position: relative;
    background:
        radial-gradient(circle at 18% 8%, rgba(96, 165, 250, 0.16), transparent 20%),
        radial-gradient(circle at 84% 14%, rgba(244, 114, 182, 0.14), transparent 22%),
        linear-gradient(180deg, rgba(8, 13, 28, 0.12) 0%, rgba(7, 10, 22, 0.5) 12%, rgba(4, 8, 18, 0.78) 100%),
        rgba(3, 7, 18, 0.76);
    border-top: 1px solid rgba(255,255,255,0.04);
    isolation: isolate;
}

#showcaseBg {
    position: absolute;
    inset: -4rem -2rem -2rem -2rem;
    z-index: 0;
    pointer-events: none;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: blur(68px) saturate(1.9) contrast(1.08) brightness(1.08);
    transform: scale(1.18);
    opacity: 0.82;
    transition: background-image 0.8s ease, opacity 0.35s ease, transform 0.8s ease, filter 0.8s ease;
}

#showcaseBg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 18%, rgba(125, 211, 252, 0.26), transparent 22%),
        radial-gradient(circle at 78% 22%, rgba(249, 168, 212, 0.22), transparent 24%),
        radial-gradient(circle at 54% 64%, rgba(45, 212, 191, 0.2), transparent 28%),
        linear-gradient(180deg, rgba(3,7,18,0.06) 0%, rgba(3,7,18,0.38) 52%, rgba(3,7,18,0.68) 100%);
}

.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

.glass-nav {
    background: rgba(10, 10, 20, 0.55);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Neon Button ────────────────────────── */
.liquid-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #e2e8f0;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    cursor: pointer;
}

.liquid-btn::before,
.liquid-btn::after {
    content: '';
    position: absolute;
    left: 15%;
    right: 15%;
    height: 1px;
    opacity: 0;
    transition: opacity 0.4s ease, left 0.4s ease, right 0.4s ease;
    pointer-events: none;
}

.liquid-btn::before {
    top: 0;
    background: linear-gradient(90deg, transparent, #22d3ee, #a855f7, transparent);
}

.liquid-btn::after {
    bottom: 0;
    background: linear-gradient(90deg, transparent, #a855f7, #22d3ee, transparent);
}

.liquid-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 0 24px rgba(34, 211, 238, 0.12), 0 0 48px rgba(168, 85, 247, 0.08);
}

.liquid-btn:hover::before,
.liquid-btn:hover::after {
    opacity: 1;
    left: 10%;
    right: 10%;
}

.liquid-btn:active { transform: translateY(0) scale(0.98); }

.liquid-btn-icon {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.liquid-btn-icon:hover {
    background: rgba(236,72,153,0.35);
    transform: scale(1.1);
}

#hero3d {
    -webkit-user-select: none;
    user-select: none;
    position: relative;
}

#wovenCanvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
}

#wovenCanvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.woven-headline {
    opacity: 0;
    animation: wovenHeadlineFade 1.8s 1.2s ease forwards;
    background: linear-gradient(135deg, #fff 0%, rgba(165,180,252,0.9) 50%, rgba(249,168,212,0.8) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.25 !important;
    padding-bottom: 0.3em;
    display: block;
}

@keyframes wovenHeadlineFade {
    0%   { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

.work-card {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeSlideUp 0.6s ease forwards;
}

.work-card:nth-child(1)  { animation-delay: 0.05s; }
.work-card:nth-child(2)  { animation-delay: 0.10s; }
.work-card:nth-child(3)  { animation-delay: 0.15s; }
.work-card:nth-child(4)  { animation-delay: 0.20s; }
.work-card:nth-child(5)  { animation-delay: 0.25s; }
.work-card:nth-child(6)  { animation-delay: 0.30s; }
.work-card:nth-child(7)  { animation-delay: 0.35s; }
.work-card:nth-child(8)  { animation-delay: 0.40s; }
.work-card:nth-child(9)  { animation-delay: 0.45s; }
.work-card:nth-child(10) { animation-delay: 0.50s; }
.work-card:nth-child(11) { animation-delay: 0.55s; }
.work-card:nth-child(12) { animation-delay: 0.60s; }

@keyframes fadeSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.supply-marquee {
    mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}

.animate-marquee {
    animation: marquee 30s linear infinite;
    will-change: transform;
}

@keyframes marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@media (min-width: 768px) {
    .work-card:hover {
        box-shadow: 0 12px 40px rgba(0,0,0,0.35);
        transform: translateY(-4px);
    }
}

@media (max-width: 767px) {
    .woven-headline {
        font-size: clamp(2.2rem, 10vw, 3.5rem) !important;
    }
}

/* ============================================================
   Auth & Dashboard Pages
   ============================================================ */

.auth-card {
    background: rgba(10, 12, 25, 0.65);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.auth-input {
    background: rgba(15, 17, 40, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    -webkit-text-fill-color: #fff;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.auth-input:focus {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px rgba(15, 17, 45, 0.95) inset;
    -webkit-text-fill-color: #fff !important;
    caret-color: #fff;
    border-color: rgba(99, 102, 241, 0.4);
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    -webkit-text-fill-color: rgba(255, 255, 255, 0.35);
}

.auth-input option {
    background: #0a0c19;
    color: #fff;
}

.oauth-btn-google {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    transition: all 0.3s;
}

.oauth-btn-google:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 4px 20px rgba(66, 133, 244, 0.15);
}

.oauth-btn-facebook {
    background: rgba(24, 119, 242, 0.12);
    border: 1px solid rgba(24, 119, 242, 0.2);
    color: #fff;
    transition: all 0.3s;
}

.oauth-btn-facebook:hover {
    background: rgba(24, 119, 242, 0.22);
    border-color: rgba(24, 119, 242, 0.35);
    box-shadow: 0 4px 20px rgba(24, 119, 242, 0.15);
}

.upload-drop-zone {
    transition: all 0.3s;
}

.upload-drop-zone:hover {
    background: rgba(255, 255, 255, 0.03);
}

.upload-drop-zone.drag-over {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.06);
}

.upload-thumb {
    animation: fadeSlideUp 0.3s ease forwards;
}

.dash-project-card {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeSlideUp 0.5s ease forwards;
}

.dash-project-card:nth-child(1) { animation-delay: 0.05s; }
.dash-project-card:nth-child(2) { animation-delay: 0.10s; }
.dash-project-card:nth-child(3) { animation-delay: 0.15s; }
.dash-project-card:nth-child(4) { animation-delay: 0.20s; }
.dash-project-card:nth-child(5) { animation-delay: 0.25s; }
.dash-project-card:nth-child(6) { animation-delay: 0.30s; }

@media (min-width: 768px) {
    .dash-project-card:hover {
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
        transform: translateY(-4px);
    }
}

/* ── 作品详情页 ─────────────────────────── */
.detail-image-wrap {
    animation: fadeSlideUp 0.5s ease both;
}
.detail-image-wrap:nth-child(2) { animation-delay: 0.08s; }
.detail-image-wrap:nth-child(3) { animation-delay: 0.16s; }
.detail-image-wrap:nth-child(4) { animation-delay: 0.24s; }

.detail-zoomable {
    transition: filter 0.3s;
}
.detail-zoomable:hover {
    filter: brightness(1.05);
}

/* ============================================================
   Glow Card — 鼠标追踪发光边框
   ============================================================ */
.glow-card {
    position: relative;
}

.glow-card::before,
.glow-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

/* 追踪光标的边框高亮 */
.glow-card::before {
    background: radial-gradient(
        350px circle at var(--glow-x, 50%) var(--glow-y, 50%),
        rgba(99, 102, 241, 0.45),
        rgba(168, 85, 247, 0.15) 40%,
        transparent 70%
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 1px;
}

/* 内部柔和聚光 */
.glow-card::after {
    background: radial-gradient(
        500px circle at var(--glow-x, 50%) var(--glow-y, 50%),
        rgba(99, 102, 241, 0.05),
        transparent 40%
    );
}

.glow-card:hover::before,
.glow-card:hover::after {
    opacity: 1;
}

/* ── Video card animations ───────────────── */
.video-card {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeSlideUp 0.6s ease forwards;
}
.video-card:nth-child(1) { animation-delay: 0.05s; }
.video-card:nth-child(2) { animation-delay: 0.10s; }
.video-card:nth-child(3) { animation-delay: 0.15s; }
.video-card:nth-child(4) { animation-delay: 0.20s; }
.video-card:nth-child(5) { animation-delay: 0.25s; }
.video-card:nth-child(6) { animation-delay: 0.30s; }
.video-card:nth-child(7) { animation-delay: 0.35s; }
.video-card:nth-child(8) { animation-delay: 0.40s; }

/* ============================================================
   Search Glow — 旋转锥形渐变边框搜索框
   ============================================================ */
.search-glow {
    position: relative;
    border-radius: 0.75rem;
    padding: 1px;
    background: rgba(255, 255, 255, 0.10);
    overflow: hidden;
    isolation: isolate;
}

.search-glow::before {
    content: '';
    position: absolute;
    inset: -100%;
    background: conic-gradient(
        from 0deg,
        transparent 0%,
        #22d3ee 15%,
        #a855f7 30%,
        #ec4899 45%,
        transparent 60%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
    animation: searchGlowSpin 3s linear infinite;
    z-index: -1;
}

.search-glow:hover::before,
.search-glow:focus-within::before {
    opacity: 1;
}

.search-glow input {
    position: relative;
    z-index: 1;
    border-radius: inherit;
    border: none !important;
    background: var(--bg-base, #030712);
}

.search-glow input:focus {
    box-shadow: none;
}

@keyframes searchGlowSpin {
    to { transform: rotate(1turn); }
}

/* ============================================================
   Avatar Glow — 头像旋转渐变边框
   ============================================================ */
.avatar-glow {
    position: relative;
    border-radius: 9999px;
    padding: 2px;
    background: rgba(255, 255, 255, 0.10);
    overflow: hidden;
    isolation: isolate;
}

.avatar-glow::before {
    content: '';
    position: absolute;
    inset: -100%;
    background: conic-gradient(
        from 0deg,
        transparent 0%,
        #22d3ee 15%,
        #a855f7 30%,
        #ec4899 45%,
        transparent 60%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.5s ease;
    animation: searchGlowSpin 3s linear infinite;
    z-index: -1;
}

.group:hover .avatar-glow::before,
.avatar-glow:hover::before {
    opacity: 1;
}

.avatar-glow > img,
.avatar-glow > div {
    position: relative;
    z-index: 1;
    border-radius: 9999px;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Gradient Background Animation ───────── */
.gradient-bg {
    --gradient-background-start: rgb(108, 0, 162);
    --gradient-background-end: rgb(0, 17, 82);
    --first-color: 18, 113, 255;
    --second-color: 221, 74, 255;
    --third-color: 100, 220, 255;
    --fourth-color: 200, 50, 50;
    --fifth-color: 180, 180, 50;
    --pointer-color: 140, 100, 255;
    --size: 80%;
    --blending-value: hard-light;
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: linear-gradient(40deg, var(--gradient-background-start), var(--gradient-background-end));
}

.gradient-bg svg { display: none; }

.gradients-container {
    width: 100%;
    height: 100%;
    filter: url(#blurMe) blur(40px);
}

/* Safari fallback */
@supports (-webkit-touch-callout: none) {
    .gradients-container { filter: blur(60px); }
}

.gradients-container > div {
    position: absolute;
    mix-blend-mode: var(--blending-value);
    width: var(--size);
    height: var(--size);
    top: calc(50% - var(--size) / 2);
    left: calc(50% - var(--size) / 2);
}

.g-first {
    background: radial-gradient(circle at center, rgba(var(--first-color), 1) 0, rgba(var(--first-color), 0) 50%) no-repeat;
    transform-origin: center center;
    animation: gradientFirst 20s ease infinite;
    opacity: 1;
}
.g-second {
    background: radial-gradient(circle at center, rgba(var(--second-color), 0.8) 0, rgba(var(--second-color), 0) 50%) no-repeat;
    transform-origin: calc(50% - 400px);
    animation: gradientSecond 20s ease infinite;
    opacity: 1;
}
.g-third {
    background: radial-gradient(circle at center, rgba(var(--third-color), 0.8) 0, rgba(var(--third-color), 0) 50%) no-repeat;
    transform-origin: calc(50% + 400px);
    animation: gradientThird 20s ease infinite;
    opacity: 1;
}
.g-fourth {
    background: radial-gradient(circle at center, rgba(var(--fourth-color), 0.8) 0, rgba(var(--fourth-color), 0) 50%) no-repeat;
    transform-origin: calc(50% - 200px);
    animation: gradientFourth 15s ease infinite;
    opacity: 0.7;
}
.g-fifth {
    background: radial-gradient(circle at center, rgba(var(--fifth-color), 0.8) 0, rgba(var(--fifth-color), 0) 50%) no-repeat;
    transform-origin: calc(50% - 800px) calc(50% + 800px);
    animation: gradientFifth 25s ease infinite;
    opacity: 1;
}
.g-interactive {
    background: radial-gradient(circle at center, rgba(var(--pointer-color), 0.8) 0, rgba(var(--pointer-color), 0) 50%) no-repeat;
    mix-blend-mode: var(--blending-value);
    width: 100%;
    height: 100%;
    top: -50%;
    left: -50%;
    opacity: 0.7;
}

@keyframes gradientFirst {
    0%   { transform: rotate(0deg);   }
    50%  { transform: rotate(180deg); }
    100% { transform: rotate(360deg); }
}
@keyframes gradientSecond {
    0%   { transform: rotate(0deg)   translateX(0);     }
    33%  { transform: rotate(120deg) translateX(80px);   }
    66%  { transform: rotate(240deg) translateX(-60px);  }
    100% { transform: rotate(360deg) translateX(0);      }
}
@keyframes gradientThird {
    0%   { transform: rotate(0deg)   scale(1);   }
    33%  { transform: rotate(-120deg) scale(1.2); }
    66%  { transform: rotate(-240deg) scale(0.9); }
    100% { transform: rotate(-360deg) scale(1);   }
}
@keyframes gradientFourth {
    0%   { transform: translate(0, 0);       opacity: 0.7; }
    25%  { transform: translate(60px, -40px); opacity: 0.5; }
    50%  { transform: translate(-40px, 60px); opacity: 0.7; }
    75%  { transform: translate(40px, 40px);  opacity: 0.4; }
    100% { transform: translate(0, 0);        opacity: 0.7; }
}