@font-face {
  font-family: 'Pixelify Sans';
  src: url('./fonts/PixelifySans-Regular.ttf') format('truetype');
  /* 如果有其他字重，也一起声明 */
}


:root {
    --text: var(--light);
    --accent: #58DE89;
    --accent-pink: #EE1256;
    --text-dim: #A6A6A6;
    --dark: #111;
    --light: rgba(255, 255, 255, 0.95);
    --glass: rgba(17, 17, 17, 0.5);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
    background: var(--dark);
    color: var(--text);
    /* font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        'Helvetica Neue', Arial, sans-serif; */
    font-family: 'Pixelify Sans', system-ui, -apple-system, BlinkMacSystemFont,
        'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ========== Loading 加载页 ========== */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Pixelify Sans', monospace;
    font-size: 16px;
    letter-spacing: 3px;
    color: var(--accent);
    transition: opacity 0.6s ease;
}

/* ========== 背景层 ========== */
.bg-base {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: url('assets/background-fig.jpg');
    background-size: cover;
    background-position: top;
}

/* ========== 下层：模糊瓷砖 ========== */
.grid-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(30, 1fr);
    grid-template-rows: repeat(20, 1fr);
}

.tile {
    position: relative;
    user-select: none;
    &::after {
        content: '';
        position: absolute;
        inset: 0;
        backdrop-filter: blur(2px);
        background: var(--glass);
        transition: backdrop-filter 2s ease, background 2s ease;
    }
    &:hover::after {
        backdrop-filter: blur(0);
        background: transparent;
        transition: backdrop-filter 0.3s ease, background 0.3s ease;
    }
}

/* ========== 上层：透明网格线 ========== */
.grid-lines {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(30, 1fr);
    grid-template-rows: repeat(20, 1fr);
    pointer-events: none;
}

.grid-cell {
    border: 1px solid var(--glass);
    
}

/* ========== 画布 ========== */
.canvas {
    position: relative;
    z-index: 3;
    width: 90vw;
    height: 85vh;
    overflow: visible;
    pointer-events: none;
}

.canvas .char-trigger,
.canvas .portfolio,
.canvas .section-title {
    pointer-events: auto;
}

/* ========== 核心单词 ========== */
.portfolio {
    font-size: 72px;
    font-weight: 300;
    letter-spacing: 6px;
    fill: var(--text-dim);
    user-select: none;
}

/* 触发字母通用样式 */
.char-trigger {
    cursor: pointer;
    paint-order: stroke fill;
    stroke: transparent;
    stroke-width: 6px;
    transition: fill 0.2s ease;
    &:hover {
        fill: var(--accent);
    }
    &.active {
        fill: var(--accent);
    }
}


/* ========== 目标区块标题 ========== */
.section-title {
    font-size: 24px;
    font-weight: 200;
    letter-spacing: 4px;
    fill: var(--text-dim);
    user-select: none;
}

/* D 字母作为对齐锚点，字号与 P 一致，随动画逐字出现 */
.char-target {
    fill: var(--accent);
    opacity: 0;
    transition: opacity 0.2s ease, fill 0.2s ease;
    &.show {
        opacity: 1;
    }
}

/* 每个动画字母 */
.char-anim {
    opacity: 0;
    fill: var(--accent);
    transition: opacity 0.2s ease, fill 0.2s ease;
    transition-delay: calc(var(--i, 0) * 0.06s);  /* 每个字母延迟 0.06 秒可调 */
    &.show {
        opacity: 1;
    }
    &.space {
        fill: transparent;
    }
}




/* ========== 延伸竖线 ========== */
.extension-stem {
    transition: stroke-dashoffset 0.7s var(--ease);
    will-change: stroke-dashoffset;
}


/* ========== 底部提示 ========== */
.hint {
    position: fixed;
    z-index: 4;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--text-dim);
    font-weight: 200;
    text-align: center;
    user-select: none;
    transition: color 0.3s ease;
    &:hover {
        color: var(--accent);
    }
    p + p {
        margin-top: 6px;
    }
}

/* ========== 响应式 ========== */
@media (max-width: 600px) {
    .portfolio {
        font-size: 48px;
        letter-spacing: 4px;
    }

    .section-title {
        font-size: 18px;
        letter-spacing: 3px;
    }
}

/* ========== 书本展示 ========== */
.book-layer {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: auto;
    &.hidden {
        display: none;
    }
}

.book {
    width: 1500px;
    height: 650px;
    display: flex;
    position: relative;
}


.book-page {
    width: 50%;
    height: 100%;
    &.book-page-left {
        background: var(--dark);
        transition: background 0.5s ease;
        .page-sub { color: var(--accent); }
        .page-date { color: var(--accent); }
    }
    &.book-page-right {
        background: var(--light);
        color: var(--accent-pink);
        transition: background 0.5s ease;
        .page-inner h2 { color: var(--accent-pink); }
        .page-sub { color: var(--accent-pink); }
        .page-date { color: var(--accent-pink); }
    }
}

.page-content {
    width: 100%;
    height: 100%;
    overflow: visible;
    box-sizing: border-box;
    color: var(--text);
    text-align: center;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.page-inner {
    position: absolute;
    left: 40px;
    right: 40px;
    top: 45%;
    transform: translateY(-50%);
    transition: top 0.8s var(--ease), transform 0.8s var(--ease);
    display: flex;
    flex-direction: column;
    align-items: center;
    will-change: top;
}

.page-date {
    position: absolute;
    left: 40px;
    right: 40px;
    bottom: 40%;
    transform: translateY(0);
    transition: bottom 0.8s var(--ease), transform 0.8s var(--ease);
    font-family: 'Pixelify Sans', monospace;
    font-size: 13px;
    letter-spacing: 2px;
    color: var(--text-dim);
    will-change: bottom;
}

.page-content.to-top .page-inner {
    top: 40px;
    transform: translateY(0);
}

.page-content.to-top .page-date {
    bottom: 40px;
    transform: translateY(0);
}

.book-page.to-top {
    &.book-page-left {
        background: rgba(20, 20, 20, 0.3);
    }
    &.book-page-right {
        background: rgba(255, 255, 255, 0.3);
    }
}

.page-inner h2 {
    font-family: 'Pixelify Sans', monospace;
    font-size: 28px;
    font-weight: 300;
    letter-spacing: 2px;
    color: var(--accent);
}

.page-sub {
    font-family: 'Pixelify Sans', monospace;
    font-size: 14px;
    font-weight: 200;
    letter-spacing: 2px;
    color: var(--text-dim);
    margin-top: 12px;
}

.page-video {
    display: none;
    width: calc(100% + 80px);
    /* margin-left: -40px; */
    margin-top: 24px;
    video {
        width: 100%;
        border-radius: 0;
        outline: none;
        display: block;
    }
}


.video-show .page-video {
    display: block;
}

.about-info {
    position: fixed;
    top: 120px;
    right: 60px;
    z-index: 5;
    font-family: 'Pixelify Sans', monospace;
    font-size: 18px;
    letter-spacing: 2px;
    color: var(--accent);
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    user-select: text;
    .about-avatar {
        width: 180px;
        border: 2px dashed var(--accent);

  
        margin-bottom: 12px;
        display: block;
    }
    p {
        margin: 5px;
        font-weight: 500;
        & + p {
            margin-top: 14px;
        }
    }
    .about-gap {
        margin-top: 24px;
    }
    .about-dim {
        color: var(--text-dim);
    }
    &.show {
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
    }
}

.page-indicator {
    margin-top: 16px;
    font-family: 'Pixelify Sans', monospace;
    font-size: 14px;
    color: var(--text-dim);
    letter-spacing: 2px;
}