/* ============================================================
   主题变量
   ============================================================ */

html[data-theme="dark"] {
    --text-color: #f5f0e8;
    --text-secondary: rgba(245, 240, 232, 0.7);
    --card-bg: rgba(20, 20, 35, 0.75);
    --card-bg-strong: rgba(0, 0, 0, 0.46);
    --card-border: rgba(255, 255, 255, 0.15);
    --card-hover: rgba(255, 255, 255, 0.1);
    --icon-color: #ffffff;
    --gradient: linear-gradient(120deg, #bd34fe, #e0321b 30%, #41d1ff 60%);
    --accent: #8ab4ff;
    --footer-bg: rgba(204, 204, 204, 0.5);
    --footer-text: #000000;
    --timeline-line: rgba(255, 255, 255, 0.25);
    --pop-bg: #ffffff;
}

html[data-theme="light"] {
    --text-color: #222222;
    --text-secondary: rgba(0, 0, 0, 0.6);
    --card-bg: rgba(255, 255, 255, 0.75);
    --card-bg-strong: rgba(255, 255, 255, 0.6);
    --card-border: rgba(0, 0, 0, 0.1);
    --card-hover: rgba(0, 0, 0, 0.06);
    --icon-color: #222222;
    --gradient: linear-gradient(120deg, #7c3aed, #e0321b 30%, #0284c7 60%);
    --accent: #4c7df0;
    --footer-bg: rgba(255, 255, 255, 0.6);
    --footer-text: #222222;
    --timeline-line: rgba(0, 0, 0, 0.2);
    --pop-bg: #ffffff;
}

/* ============================================================
   全局重置 & 基础布局
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'MapleMono', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text-color);
    transition: color 0.3s ease, background-color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================================
   字体
   ============================================================ */

@font-face {
    font-family: 'MapleMono';
    src: url('../fonts/MapleMono-NF-CN-SemiBold-common.woff2') format('woff2'),
         url('../fonts/MapleMono-NF-CN-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   背景层
   ============================================================ */

.background-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.background-layer::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-image: url('../img/background1.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(2px);
    z-index: -1;
}

/* ============================================================
   加载动画
   ============================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

.loading-overlay.hide {
    opacity: 0;
    pointer-events: none;
}

.loading-dot {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: pulse 0.8s ease-in-out infinite;
}

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

/* ============================================================
   时间卡片
   ============================================================ */

.time-card {
    position: fixed;
    top: 30px;
    right: 30px;
    background: var(--card-bg-strong);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 32px;
    padding: 20px 30px;
    text-align: center;
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, background-color 0.3s ease;
    min-width: 260px;
    z-index: 100;
}

.time-card:hover {
    transform: scale(1.05);
}

.time-card .date {
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
    display: inline-block;
}

.time-card .clock {
    font-family: 'MapleMono', 'Fira Code', 'Monaco', monospace;
    font-size: 2.8rem;
    font-weight: bold;
    color: var(--text-color);
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    letter-spacing: 4px;
}

/* ============================================================
   主布局
   ============================================================ */

.page-main {
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    flex: 1;
}

/* ============================================================
   左侧信息栏
   ============================================================ */

.side-bar {
    width: 230px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 40px 15px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.side-bar::-webkit-scrollbar {
    display: none;
}

.avatar {
    flex-shrink: 0;
    width: 140px;
    position: relative;
    aspect-ratio: 1/1;
    margin-top: 10px;
}

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    object-fit: cover;
}

.avatar-frame {
    position: absolute;
    top: -15%;
    left: -10%;
    width: 120%;
    aspect-ratio: 1/1;
}

.side-card {
    flex-shrink: 0;
    width: 100%;
    border-radius: 13px;
    margin-top: 15px;
    padding: 20px;
    backdrop-filter: blur(var(--card-filter, 15px));
    -webkit-backdrop-filter: blur(var(--card-filter, 15px));
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    transition: background-color 0.3s ease;
}

.side-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.side-info-item {
    display: flex;
    align-items: center;
    line-height: 20px;
    font-size: 14px;
    margin-bottom: 8px;
    overflow: hidden;
}

.side-tags {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 14px;
}

.side-tag {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 28px;
    margin: 0 5px 5px 0;
    padding: 10px;
    font-size: 14px;
    border-radius: 10px;
    background: var(--card-hover);
}

#line {
    width: 100%;
    height: 200px;
    font-size: 13px;
    padding-left: 8px;
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
}

#line::-webkit-scrollbar {
    display: none;
}

#line li {
    list-style: none;
    position: relative;
    padding: 15px 0 0 15px;
    border-left: 2px solid var(--timeline-line);
    scroll-snap-align: end;
    color: var(--text-color);
}

.focus {
    width: 8px;
    height: 8px;
    border-radius: 22px;
    background-color: var(--text-color);
    border: 2px solid var(--card-bg);
    position: absolute;
    left: -5px;
    top: 50%;
}

#line li:first-child .focus:first-child {
    background-color: #aaffcd;
    animation: focus 1.8s ease infinite;
}

@keyframes focus {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ============================================================
   右侧主区
   ============================================================ */

.page-content {
    flex: 1;
    width: calc(100% - 230px);
    padding: 30px 30px 60px;
    display: flex;
    flex-direction: column;
}

.hero {
    margin: 20px 0 10px;
}

.hero-title {
    font-size: 58px;
    font-weight: 800;
    margin-bottom: 14px;
    letter-spacing: 1px;
}

.gradient-text {
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200%;
    background-position: 0%;
    font-family: 'MapleMono', sans-serif;
    background-image: var(--gradient);
    animation: backgroundSizeAnimation 10s ease-in-out infinite;
}

@keyframes backgroundSizeAnimation {
    0%   { background-position: 100%; }
    25%  { background-position: 50%; }
    50%  { background-position: 0%; }
    75%  { background-position: 50%; }
    100% { background-position: 100%; }
}

.hero-sub {
    font-size: 19px;
    margin-top: 8px;
    color: var(--text-color);
}

.accent-text {
    color: var(--accent);
    font-weight: 800;
}

/* ============================================================
   格言板
   ============================================================ */

.quote-board {
    max-width: 520px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 28px;
    padding: 28px 24px 24px 28px;
    border: 1px solid var(--card-border);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin: 24px 0 8px;
}

.quote-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffd89b, #c7e9fb, #ffd89b);
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0%   { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

.quote-icon {
    font-size: 4rem;
    font-family: 'Georgia', serif;
    color: rgba(255, 215, 150, 0.5);
    line-height: 1;
    position: absolute;
    top: 12px;
    left: 18px;
    opacity: 0.6;
}

.quote-content {
    position: relative;
    z-index: 2;
    padding-left: 20px;
}

.quote-text {
    font-size: 1.15rem;
    line-height: 1.55;
    color: var(--text-color);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    margin-bottom: 18px;
    font-weight: 500;
    letter-spacing: 0.3px;
    word-break: break-word;
}

.quote-author {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: 8px;
    padding-right: 8px;
    letter-spacing: 1px;
}

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

.quote-text,
.quote-author {
    animation: quoteFadeIn 0.45s ease-out forwards;
}

/* ============================================================
   社交图标（内联 SVG，颜色随主题变量）
   ============================================================ */

.side-info-item .icon,
.social-item .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: var(--icon-color);
    transition: fill 0.3s ease;
}

.side-info-item .icon {
    margin-right: 10px;
}

.social-item .icon {
    width: 22px;
    height: 22px;
}

/* ============================================================
   社交栏
   ============================================================ */

.social-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 20px 0 10px;
}

.social-item,
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 43px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-filter, 15px));
    -webkit-backdrop-filter: blur(var(--card-filter, 15px));
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-color);
    transition: all 0.25s ease;
}

.social-item:hover,
.theme-toggle:hover {
    transform: translateY(-2px);
    background: var(--card-hover);
}

.social-name {
    white-space: nowrap;
}

.theme-toggle {
    width: 43px;
    padding: 0;
    margin-left: auto;
}

.theme-icon {
    font-size: 18px;
    line-height: 1;
}

/* ============================================================
   项目卡片
   ============================================================ */

.section-title {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 800;
    margin: 24px 0 14px;
    transition: transform 0.4s ease;
}

.section-title:hover {
    transform: translateY(-3px);
}

.project-list {
    display: flex;
    flex-wrap: wrap;
}

.project-item {
    display: flex;
    margin: 7px;
    padding: 15px;
    height: 100px;
    width: calc(50% - 14px);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 13px;
    backdrop-filter: blur(var(--card-filter, 15px));
    -webkit-backdrop-filter: blur(var(--card-filter, 15px));
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
}

.project-item:hover {
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.project-item.pressed {
    transform: scale(0.94);
    background: var(--card-hover);
}

.project-item-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-item-left h3 {
    font-weight: normal;
    font-size: 17px;
    color: var(--text-color);
    transition: font-size 0.3s ease;
}

.project-item:hover h3 {
    font-size: 19px;
}

.project-item-left p {
    font-size: 13px;
    margin-top: 10px;
    color: var(--text-secondary);
}

.project-item-right {
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
}

.project-item-right img {
    height: 39px;
    width: 39px;
}

.project-item:hover .project-item-right {
    transform: rotate(8deg);
}

/* ============================================================
   二维码弹窗
   ============================================================ */

.pop-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 20, 20, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9990;
}

.pop-mask.active {
    visibility: visible;
    opacity: 1;
}

.pop-box {
    background: var(--pop-bg);
    border-radius: 15px;
    padding: 20px;
    transform: translateY(30%) scale(0.5);
    transition: transform 0.2s ease;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.pop-mask.active .pop-box {
    transform: translateY(0) scale(1);
}

.pop-img {
    width: 260px;
    max-width: 78vw;
    display: block;
}

/* ============================================================
   脚部
   ============================================================ */

footer {
    font-size: 13px;
    background-color: var(--footer-bg);
    text-align: center;
    padding: 5px;
    width: 100%;
    margin-top: auto;
    color: var(--footer-text);
    transition: background-color 0.3s ease;
}

footer a {
    text-decoration: none;
    color: var(--footer-text);
}

/* ============================================================
   bolg 子页
   ============================================================ */

.bolg-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.bolg-card {
    position: relative;
    max-width: 480px;
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 28px;
    padding: 48px 40px;
    border: 1px solid var(--card-border);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.bolg-title {
    font-size: 28px;
    margin: 18px 0 12px;
    color: var(--text-color);
}

.bolg-text {
    color: var(--text-secondary);
    margin-bottom: 26px;
    line-height: 1.6;
}

.bolg-back {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 12px;
    background: var(--card-hover);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    transition: all 0.25s ease;
}

.bolg-back:hover {
    transform: translateY(-2px);
}

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 800px) {
    .side-bar {
        display: none;
    }

    .page-content {
        width: 100%;
        padding: 90px 16px 40px;
    }

    .time-card {
        top: 10px;
        right: 10px;
        padding: 10px 18px;
        min-width: auto;
    }

    .time-card .clock {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }

    .time-card .date {
        font-size: 0.78rem;
        margin-bottom: 6px;
        padding-bottom: 6px;
    }

    .hero-title {
        font-size: 34px;
    }

    .hero-sub {
        font-size: 16px;
    }

    .quote-board {
        padding: 22px 18px 18px 22px;
    }

    .quote-text {
        font-size: 1rem;
    }

    .quote-icon {
        font-size: 3rem;
        top: 8px;
        left: 12px;
    }

    .project-item {
        width: 100%;
        margin: 6px 0;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 27px;
    }

    .time-card .clock {
        font-size: 1.2rem;
        letter-spacing: 1px;
    }

    .quote-text {
        font-size: 0.92rem;
        line-height: 1.45;
    }

    .social-item {
        padding: 0 12px;
    }

    .social-name {
        display: none;
    }

    .theme-toggle {
        margin-left: auto;
    }
}

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