/* 统一渐变标题效果：配合 data-glitch + data-text（由 i18n 同步） */

[data-glitch] {
    position: relative;
    color: transparent;
    -webkit-text-stroke: 1px rgba(241, 139, 37, 0.5);
    background: linear-gradient(180deg, #fff 0%, rgba(255, 255, 255, 0) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

[data-glitch]::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #F18B25 0%, #ffcd85 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-stroke: 0;
    color: transparent;
    pointer-events: none;
}

/* Hero 大标题 */
.title-glitch--hero,
.glitch-title {
    display: inline-block;
    font-size: clamp(3.5rem, 10vw, 8rem);
    line-height: 1.1;
    font-family: var(--font-primary), sans-serif;
    font-weight: 900;
    letter-spacing: -0.04em;
    margin: 0 0 0.3em 0;
    opacity: 0.9;
    word-break: break-word;
    overflow-wrap: break-word;
}

.title-glitch--hero::after,
.glitch-title::after {
    opacity: 0.8;
    mix-blend-mode: screen;
    animation: glitch-ghost 3s infinite alternate-reverse;
    z-index: -1;
}

.title-glitch--hero::before,
.glitch-title::before {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #F18B25 0%, #ffcd85 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-stroke: 0;
    color: transparent;
    filter: blur(4px);
    opacity: 0.4;
    animation: glitch-blur 4s infinite alternate;
    z-index: -2;
}

/* 区块标题（如 Recent Works） */
.title-glitch--section {
    font-family: var(--font-primary), sans-serif;
    font-weight: 700;
    font-size: 3rem;
    text-align: center;
    margin-bottom: 4rem;
    display: table;
    margin-left: auto;
    margin-right: auto;
}

.title-glitch--section::after {
    opacity: 0.8;
}

/* 页面主标题（Works / Friends / DevLog） */
.title-glitch--page {
    display: inline-block;
    font-family: var(--font-primary), sans-serif;
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin: 0;
    opacity: 0.8;
}

.title-glitch--page::after {
    opacity: 1;
    clip-path: polygon(0 0, 100% 0, 100% 55%, 0 45%);
    animation: title-glitch-scan 4s infinite alternate;
}

@keyframes title-glitch-scan {
    0% { clip-path: polygon(0 0, 100% 0, 100% 55%, 0 45%); transform: translate(0, 0); }
    20% { clip-path: polygon(0 0, 100% 0, 100% 55%, 0 45%); transform: translate(0, 0); }
    21% { clip-path: polygon(0 15%, 100% 15%, 100% 60%, 0 50%); transform: translate(2px, 0); }
    22% { clip-path: polygon(0 0, 100% 0, 100% 55%, 0 45%); transform: translate(0, 0); }
    100% { clip-path: polygon(0 0, 100% 0, 100% 55%, 0 45%); transform: translate(0, 0); }
}

@keyframes glitch-ghost {
    0% { transform: translate(0, 0); opacity: 0.8; }
    50% { transform: translate(2px, -1px); opacity: 0.6; }
    100% { transform: translate(-1px, 1px); opacity: 0.8; }
}

@keyframes glitch-blur {
    0% { transform: translate(0, 0); opacity: 0.4; }
    50% { transform: translate(-2px, 2px); opacity: 0.2; }
    100% { transform: translate(1px, -1px); opacity: 0.4; }
}

/* 副标题：非英文语言取消过大字距与强制大写 */
:lang(zh) .title-decoration,
:lang(fi) .title-decoration,
:lang(zh) .portfolio-label,
:lang(fi) .portfolio-label {
    letter-spacing: 0.12em;
    text-transform: none;
}

@media (max-width: 768px) {
    .title-glitch--section {
        font-size: 28px;
        margin-bottom: 2rem;
    }

    .title-glitch--page {
        font-size: 2.5rem;
    }

    .title-glitch--hero,
    .glitch-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }
}
