/* ============================================
   visionOS 玻璃拟物风格 — Linktree
   Inspired by Apple VisionOS Design Language
   ============================================ */

/* SF Pro 字体回退方案 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* 背景 — 动态渐变色 */
    --bg-start: #1a1a2e;
    --bg-mid: #16213e;
    --bg-end: #0f3460;

    --accentColor: #ffffff;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', sans-serif;
    --delay: .3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    background: linear-gradient(
        145deg,
        var(--bg-start) 0%,
        var(--bg-mid) 50%,
        var(--bg-end) 100%
    );
    background-attachment: fixed;
    opacity: 0;
    animation: 1s ease-out var(--delay) 1 transitionAnimation;
    animation-fill-mode: forwards;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 动态环境背景 ========== */

/* 主背景光晕 — visionOS 风格环境光 */
.ambient-glow {
    position: fixed;
    top: -30%;
    left: -10%;
    width: 120%;
    height: 120%;
    background:
        radial-gradient(ellipse 70% 50% at 20% 20%, rgba(100,180,255,0.15) 0%, transparent 70%),
        radial-gradient(ellipse 50% 60% at 80% 80%, rgba(200,150,255,0.10) 0%, transparent 60%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(255,255,255,0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -2;
    animation: ambientPulse 12s ease-in-out infinite alternate;
}

@keyframes ambientPulse {
    0% { opacity: 0.6; transform: scale(1) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.05) rotate(1deg); }
    100% { opacity: 0.7; transform: scale(0.98) rotate(-1deg); }
}

/* 动态光斑 */
.ambient-glow::after {
    content: '';
    position: absolute;
    top: 40%;
    right: 10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,200,150,0.08) 0%, transparent 70%);
    border-radius: 50%;
    animation: lightDrift 15s ease-in-out infinite alternate;
}

@keyframes lightDrift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-50px, -30px) scale(1.2); }
}

/* 暗角 */
.vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
    z-index: -1;
}

/* ========== 主容器 — 3D 景深层叠 ========== */
.container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 48px 20px 40px;
}

/* ========== 头像 — visionOS 玻璃徽章 ========== */
#profilePicture {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 0 auto 24px;
    -webkit-tap-highlight-color: transparent;
    perspective: 800px;
}

#profilePicture::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(255,255,255,0.3),
        rgba(150,200,255,0.2),
        rgba(200,150,255,0.2),
        rgba(255,255,255,0.3)
    );
    mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
    animation: ringRotate 4s linear infinite;
    opacity: 0.6;
}

@keyframes ringRotate {
    to { transform: rotate(360deg); }
}

#profilePicture img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: block;
    object-fit: cover;
    background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.05));
    padding: 3px;
    box-shadow:
        0 12px 48px rgba(0,0,0,0.3),
        0 0 0 1px rgba(255,255,255,0.15),
        inset 0 1px 0 rgba(255,255,255,0.3);
    transition: transform 0.4s cubic-bezier(.34,1.56,.64,1), box-shadow 0.4s ease;
}

#profilePicture img:hover {
    transform: scale(1.06) translateY(-2px);
    box-shadow:
        0 20px 60px rgba(0,0,0,0.35),
        0 0 0 1px rgba(255,255,255,0.25),
        inset 0 1px 0 rgba(255,255,255,0.4);
}

#profilePicture:active img {
    transform: scale(0.95);
}

/* ========== 用户名 — visionOS 大标题 ========== */
#userName {
    color: var(--accentColor);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

/* ========== 链接区域 — 玻璃卡片列表 ========== */
#links {
    max-width: 680px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 28px auto;
    padding: 0 16px;
    gap: 12px;
}

/* visionOS 玻璃卡按钮 — 标志性多层玻璃效果 */
.link {
    position: relative;
    color: var(--accentColor);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 20px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;

    /* visionOS 标志性厚玻璃效果 */
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.28) 0%,
        rgba(255,255,255,0.12) 40%,
        rgba(255,255,255,0.04) 100%
    );

    border: 1px solid rgba(255,255,255,0.25);
    border-top: 1.5px solid rgba(255,255,255,0.45);
    border-radius: 16px;

    /* 内阴影营造玻璃体积感 */
    box-shadow:
        0 8px 32px rgba(0,0,0,0.12),
        0 2px 8px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.5),
        inset 0 -1px 0 rgba(255,255,255,0.1);

    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);

    transition: all 0.35s cubic-bezier(.22, 1, .36, 1);
    letter-spacing: 0.2px;
}

/* 玻璃表面高光反射层 */
.link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 52%;
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.20) 0%,
        rgba(255,255,255,0.06) 60%,
        transparent 100%
    );
    border-radius: 15px 15px 0 0;
    pointer-events: none;
}

/* 底部微光 */
.link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.15),
        transparent
    );
    pointer-events: none;
}

.link i {
    position: relative;
    z-index: 1;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.link .link-label {
    position: relative;
    z-index: 1;
}

/* 图标着色 */
.link .fa-qq { color: #1eb9fc; }
.link .fa-weixin { color: #07c160; }
.link .fa-bilibili { color: #00A1D6; }
.link .fa-tiktok {
    background: linear-gradient(135deg, #25f4ee 0%, #fe2c55 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.link .fa-x-twitter { color: #fff; }
.link .fa-instagram { color: #e4405f; }
.link .fa-bluesky { color: #0285ff; }

/* 图片弹窗触发按钮指针 */
.img-popup-trigger {
    cursor: pointer;
}

@media (hover: hover) {
    .link:hover {
        background: linear-gradient(
            180deg,
            rgba(255,255,255,0.38) 0%,
            rgba(255,255,255,0.18) 40%,
            rgba(255,255,255,0.08) 100%
        );
        border-top: 1.5px solid rgba(255,255,255,0.6);
        transform: translateY(-4px) scale(1.01);
        box-shadow:
            0 16px 48px rgba(0,0,0,0.18),
            0 4px 12px rgba(0,0,0,0.1),
            inset 0 1px 0 rgba(255,255,255,0.6),
            inset 0 -1px 0 rgba(255,255,255,0.15),
            0 0 30px rgba(255,255,255,0.05);
    }

    .link:hover::before {
        background: linear-gradient(
            180deg,
            rgba(255,255,255,0.28) 0%,
            rgba(255,255,255,0.10) 60%,
            transparent 100%
        );
    }
}

.link:active {
    transform: translateY(1px) scale(0.98);
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.15) 0%,
        rgba(255,255,255,0.08) 100%
    );
    box-shadow:
        0 2px 8px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.2);
    transition-duration: 0.1s;
}

/* ========== 标语 — visionOS 柔光标签 ========== */
#hashtag {
    position: relative;
    padding: 10px 24px;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    font-weight: 500;
    display: block;
    width: fit-content;
    margin: 0 auto;
    font-family: var(--font);
    text-align: center;
    letter-spacing: 1.5px;
    text-transform: uppercase;

    /* 小玻璃标签 */
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 100px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    box-shadow:
        0 2px 8px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.15);

    text-shadow: 0 1px 4px rgba(0,0,0,0.2);

    animation: visionOSTagPulse 4s ease-in-out infinite alternate;
}

@keyframes visionOSTagPulse {
    0% { opacity: 0.8; box-shadow: 0 2px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.15); }
    100% { opacity: 1; box-shadow: 0 4px 16px rgba(100,180,255,0.08), inset 0 1px 0 rgba(255,255,255,0.2), 0 0 20px rgba(255,255,255,0.03); }
}

/*------------------------- 动画 -------------------------*/
@keyframes transitionAnimation {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   图片弹窗（二维码等单图展示）
   ============================================ */

.img-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 300;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(30px) saturate(1.3);
    -webkit-backdrop-filter: blur(30px) saturate(1.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0s 0.35s;
    padding: 24px;
}

.img-popup-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease, visibility 0s 0s;
}

.img-popup-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 340px;
    width: 100%;
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.22) 0%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.02) 100%
    );
    border: 1px solid rgba(255,255,255,0.18);
    border-top: 1.5px solid rgba(255,255,255,0.35);
    border-radius: 24px;
    padding: 16px 16px 20px;
    box-shadow:
        0 32px 80px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.5);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    transform: scale(0.85) translateY(10px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(.34,1.56,.64,1), opacity 0.3s ease;
}

.img-popup-overlay.active .img-popup-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.img-popup-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.img-popup-label {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    padding: 12px 0 2px;
    text-align: center;
    letter-spacing: 0.5px;
}

.img-popup-close {
    position: absolute;
    right: -10px;
    top: -10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 300;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    transition: all 0.25s ease;
    line-height: 1;
    cursor: pointer;
}

.img-popup-close:hover {
    background: rgba(255,255,255,0.22);
    transform: scale(1.08);
}

/* 访问按钮 */
.img-popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.22) 0%,
        rgba(255,255,255,0.08) 100%
    );
    border: 1px solid rgba(255,255,255,0.20);
    border-top: 1.5px solid rgba(255,255,255,0.35);
    border-radius: 100px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.3);
    transition: all 0.25s ease;
}

.img-popup-btn:hover {
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.32) 0%,
        rgba(255,255,255,0.14) 100%
    );
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.4);
}

.img-popup-btn i {
    font-size: 0.8rem;
}





/*------------------------- 响应式布局 -------------------------*/

/* 平板设备 */
@media screen and (max-width: 768px) {
    .container {
        padding: 40px 16px 32px;
    }

    #profilePicture {
        margin-bottom: 20px;
    }

    #profilePicture img {
        width: 84px;
        height: 84px;
    }

    #userName {
        font-size: 1.05rem;
    }

    #links {
        max-width: 480px;
        padding: 0 12px;
        gap: 10px;
    }

    .link {
        padding: 14px 18px;
        font-size: 0.9rem;
        border-radius: 14px;
        max-width: 420px;
    }

    .link i {
        font-size: 1rem;
    }

    #hashtag {
        font-size: 0.8rem;
        padding: 8px 20px;
        letter-spacing: 1.2px;
    }

    /* 平板图片弹窗 */
    .img-popup-card {
        max-width: 280px;
        padding: 14px 14px 18px;
        border-radius: 20px;
    }
}

/* 手机设备 */
@media screen and (max-width: 480px) {
    .container {
        padding: 32px 12px 28px;
    }

    #profilePicture {
        margin-bottom: 16px;
    }

    #profilePicture img {
        width: 76px;
        height: 76px;
    }

    #userName {
        font-size: 1rem;
    }

    #links {
        max-width: 100%;
        padding: 0 12px;
        margin: 20px auto;
        gap: 10px;
    }

    .link {
        padding: 13px 16px;
        font-size: 0.85rem;
        border-radius: 12px;
        max-width: 100%;
        gap: 8px;
    }

    .link i {
        font-size: 0.95rem;
        width: 18px;
    }

    #hashtag {
        font-size: 0.75rem;
        padding: 7px 16px;
        letter-spacing: 1px;
    }

    /* 手机图片弹窗 */
    .img-popup-card {
        max-width: 240px;
        padding: 12px 12px 16px;
        border-radius: 18px;
    }

    .img-popup-close {
        width: 30px;
        height: 30px;
        font-size: 1.2rem;
        right: -8px;
        top: -8px;
    }

    .img-popup-label {
        font-size: 0.75rem;
        padding: 10px 0 0;
    }
}

/* 大屏设备 */
@media screen and (min-width: 1200px) {
    .container {
        padding: 60px 20px 48px;
    }

    #links {
        max-width: 780px;
        gap: 14px;
    }

    .link {
        max-width: 520px;
        padding: 18px 24px;
        font-size: 1rem;
        border-radius: 18px;
    }

    .link i {
        font-size: 1.15rem;
    }

    #profilePicture img {
        width: 108px;
        height: 108px;
    }

    #hashtag {
        font-size: 0.9rem;
        padding: 10px 28px;
    }

    /* 大屏画廊 */
    .gallery-panel {
        max-width: 720px;
        max-height: 80vh;
    }

    .gallery-albums {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 18px;
    }

    .viewer-image-wrap {
        padding: 100px 120px 120px;
    }

    /* 大屏图片弹窗 */
    .img-popup-card {
        max-width: 400px;
        padding: 20px 20px 24px;
    }
}

/* 减少动效（无障碍 / 省电模式） */
@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
        opacity: 1;
    }

    #hashtag {
        animation: none;
        text-shadow: 0 0 8px rgba(255,255,255,0.3);
    }

    .link {
        transition: none;
    }

    .link:hover {
        transform: none;
    }

    #hashtag {
        animation: none;
    }

    .ambient-glow,
    .ambient-glow::after {
        animation: none;
    }

    #profilePicture::before {
        animation: none;
    }

    #profilePicture img {
        transition: none;
    }

    #profilePicture:hover img {
        transform: none;
    }
}
