/* ============================================
   ARRIVALBELL Portfolio - Main Stylesheet
   References: spicy-hot-pot.com & riizeofficial.com
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    --clr-black: #000000;
    --clr-dark: #0a0a0a;
    --clr-surface: #111111;
    --clr-border: rgba(255,255,255,0.08);
    --clr-border-hover: rgba(255,255,255,0.2);
    --clr-white: #ffffff;
    --clr-gray: #888888;
    --clr-gray-light: #aaaaaa;
    --clr-red: #8B0000;
    --clr-red-bright: #a00000;
    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-smooth: cubic-bezier(0.65, 0, 0.35, 1);
    --z-cursor: 10000;
    --z-splash: 9999;
    --z-about: 9000;
    --z-overlay: 8000;
    --z-nav: 1000;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-stack);
    background: var(--clr-black);
    color: var(--clr-white);
    line-height: 1.6;
    overflow-x: hidden;
    cursor: none;
}

@media (max-width: 768px) {
    body { cursor: auto; }
}

img, video {
    display: block;
    max-width: 100%;
}

button {
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

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

/* ---------- Utility ---------- */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}

/* ---------- Custom Cursor ---------- */
.cursor {
    position: fixed;
    width: 40px; height: 40px;
    border: 1px solid var(--clr-white);
    border-radius: 50%;
    pointer-events: none;
    z-index: var(--z-cursor);
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out),
                border-color 0.3s var(--ease-out);
}

.cursor-dot {
    position: fixed;
    width: 6px; height: 6px;
    background: var(--clr-white);
    border-radius: 50%;
    pointer-events: none;
    z-index: var(--z-cursor);
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
}

.cursor.hover {
    width: 60px; height: 60px;
    border-color: var(--clr-red);
}

.cursor.clicking {
    width: 30px; height: 30px;
}

.cursor-dot.clicking {
    transform: translate(-50%, -50%) scale(0.5);
}

@media (max-width: 768px) {
    .cursor, .cursor-dot { display: none; }
}

/* ---------- About Trigger (右上角图标) ---------- */
.about-trigger {
    position: fixed;
    top: 24px; right: 24px;
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-nav);
    opacity: 0.6;
    transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
    cursor: none;
}
.about-trigger:hover {
    opacity: 1;
    transform: scale(1.15);
}
@media (max-width: 768px) {
    .about-trigger { cursor: pointer; }
}

/* ============================================
   1. 启动页 (Splash)
   ============================================ */
.splash {
    position: fixed;
    inset: 0;
    z-index: var(--z-splash);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s var(--ease-in-out), visibility 0.5s var(--ease-in-out);
}
.splash.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-bg {
    position: absolute;
    inset: 0;
}
.splash-bg-img {
    width: 100%; height: 100%;
    object-fit: cover;
    filter: brightness(0.5);
    animation: splashBgScale 1.5s var(--ease-out) forwards;
}
@keyframes splashBgScale {
    from { transform: scale(1.1); }
    to   { transform: scale(1); }
}
.splash-bg-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.7) 100%);
}

.splash-content {
    position: relative;
    z-index: 2;
    text-align: center;
    animation: splashContentIn 1s var(--ease-out) 0.3s both;
}
@keyframes splashContentIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.splash-label {
    font-size: 13px;
    letter-spacing: 0.5em;
    color: var(--clr-gray-light);
    margin-bottom: 60px;
}

/* ENTER按钮 - 参照 spicy-hot-pot.com */
.splash-enter {
    position: relative;
    padding: 24px 80px;
    cursor: none;
    transition: transform 0.4s var(--ease-out);
}
.splash-enter:hover {
    transform: scale(1.05);
}
.splash-enter:active {
    transform: scale(0.95);
}
.splash-enter-text {
    display: block;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.6em;
    color: var(--clr-red);
    position: relative;
    z-index: 2;
    transition: letter-spacing 0.4s var(--ease-out), color 0.4s var(--ease-out);
}
.splash-enter:hover .splash-enter-text {
    letter-spacing: 0.8em;
    color: var(--clr-red-bright);
}
.splash-enter-line-top,
.splash-enter-line-bottom {
    display: block;
    height: 1px;
    background: var(--clr-red);
    transition: transform 0.4s var(--ease-out);
}
.splash-enter-line-top {
    margin-bottom: 12px;
}
.splash-enter-line-bottom {
    margin-top: 12px;
}
.splash-enter:hover .splash-enter-line-top {
    transform: translateX(-15px);
}
.splash-enter:hover .splash-enter-line-bottom {
    transform: translateX(15px);
}

@media (max-width: 768px) {
    .splash-enter { cursor: pointer; padding: 20px 50px; }
    .splash-enter-text { font-size: 16px; letter-spacing: 0.4em; }
    .splash-label { font-size: 11px; margin-bottom: 40px; }
}

/* ============================================
   2. 分类导航页 (Categories)
   参照 spicy-hot-pot.com 布局
   ============================================ */
.categories-page {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--clr-black);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s var(--ease-in-out), visibility 0.5s var(--ease-in-out);
}
.categories-page.active {
    opacity: 1;
    visibility: visible;
}

.cat-nav {
    width: 100%;
    max-width: 900px;
    padding: 40px;
}

.cat-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* 分类项 - 参照 spicy-hot-pot.com 的hover效果 */
.cat-item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px 24px;
    cursor: none;
    text-align: left;
    transition: background 0.3s var(--ease-out);
    border-radius: 2px;
}
.cat-item:hover {
    background: rgba(255,255,255,0.03);
}

.cat-num {
    font-size: 12px;
    font-weight: 500;
    color: var(--clr-gray);
    letter-spacing: 0.2em;
    min-width: 30px;
    transition: color 0.3s var(--ease-out);
}
.cat-item:hover .cat-num {
    color: var(--clr-red);
}

.cat-divider {
    width: 24px;
    height: 1px;
    background: var(--clr-border);
    transition: width 0.3s var(--ease-out), background 0.3s var(--ease-out);
}
.cat-item:hover .cat-divider {
    width: 48px;
    background: var(--clr-red);
}

.cat-text {
    flex: 1;
}

.cat-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    transition: transform 0.4s var(--ease-out), letter-spacing 0.4s var(--ease-out);
}
.cat-item:hover .cat-title {
    transform: translateX(8px);
    letter-spacing: 0.02em;
}

.cat-sub {
    font-size: 14px;
    color: var(--clr-gray);
    margin-top: 4px;
    transition: color 0.3s var(--ease-out);
}
.cat-item:hover .cat-sub {
    color: var(--clr-gray-light);
}

.cat-arrow {
    font-size: 24px;
    font-weight: 200;
    color: var(--clr-red);
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.cat-item:hover .cat-arrow {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 768px) {
    .cat-item { cursor: pointer; padding: 24px 16px; gap: 16px; }
    .cat-arrow { opacity: 0.5; transform: translateX(0); }
}

/* ============================================
   3. 作品展示页 (Gallery)
   参照 riizeofficial.com 卡片风格
   ============================================ */
.gallery-page {
    min-height: 100vh;
    background: var(--clr-black);
    padding: 80px 40px 100px;
    display: none;
    opacity: 0;
    transition: opacity 0.5s var(--ease-in-out);
}
.gallery-page.active {
    display: block;
    opacity: 1;
}

.gallery-header {
    text-align: center;
    margin-bottom: 60px;
    padding-top: 20px;
}
.gallery-back {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 0.3em;
    color: var(--clr-gray);
    margin-bottom: 24px;
    padding: 8px 16px;
    cursor: none;
    transition: color 0.3s var(--ease-out);
}
.gallery-back:hover { color: var(--clr-white); }
.gallery-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 300;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}
.gallery-sub {
    font-size: 13px;
    letter-spacing: 0.3em;
    color: var(--clr-gray);
}

/* 作品卡片网格 - 参照 riizeofficial.com */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    max-width: 1500px;
    margin: 0 auto;
}

.gallery-card {
    position: relative;
    aspect-ratio: 4/5;
    overflow: hidden;
    background: var(--clr-surface);
    cursor: none;
    border-radius: 2px;
    animation: cardFadeIn 0.6s var(--ease-out) both;
    transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.gallery-card:hover {
    transform: scale(1.03);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.gallery-card:nth-child(1) { animation-delay: 0.05s; }
.gallery-card:nth-child(2) { animation-delay: 0.15s; }
.gallery-card:nth-child(3) { animation-delay: 0.25s; }
.gallery-card:nth-child(4) { animation-delay: 0.35s; }
.gallery-card:nth-child(5) { animation-delay: 0.45s; }
.gallery-card:nth-child(6) { animation-delay: 0.55s; }

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

.gallery-card-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-out);
}
.gallery-card:hover .gallery-card-img {
    transform: scale(1.08);
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 55%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 28px;
    opacity: 0;
    transition: opacity 0.35s var(--ease-out);
}
.gallery-card:hover .gallery-card-overlay {
    opacity: 1;
}

.gallery-card-num {
    position: absolute;
    top: 20px; right: 24px;
    font-size: 4rem;
    font-weight: 700;
    color: rgba(139,0,0,0.25);
    line-height: 1;
}

.gallery-card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.gallery-card-year {
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--clr-gray);
}

@media (max-width: 768px) {
    .gallery-page { padding: 60px 16px 80px; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
    .gallery-card { cursor: pointer; }
    .gallery-card-overlay { opacity: 1; background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%); }
    .gallery-card-num { font-size: 3rem; top: 12px; right: 16px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
}

/* ============================================
   4. 作品详情页 (Detail)
   桌面端: 35% 左文字 / 65% 右媒体
   移动端: 50% 上媒体 / 50% 下文字
   ============================================ */
.detail-page {
    min-height: 100vh;
    background: var(--clr-black);
    padding: 80px 40px 100px;
    display: none;
    opacity: 0;
    transition: opacity 0.5s var(--ease-in-out);
}
.detail-page.active {
    display: block;
    opacity: 1;
}

.detail-header {
    margin-bottom: 40px;
}
.detail-back {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 0.3em;
    color: var(--clr-gray);
    padding: 8px 16px;
    cursor: none;
    transition: color 0.3s var(--ease-out);
}
.detail-back:hover { color: var(--clr-white); }

.detail-body {
    display: grid;
    grid-template-columns: 35% 65%;
    gap: 60px;
    max-width: 1500px;
    margin: 0 auto;
}

/* 左侧信息区 */
.detail-info {
    position: sticky;
    top: 100px;
    align-self: start;
}

.detail-tag {
    display: inline-block;
    font-size: 10px;
    letter-spacing: 0.4em;
    color: var(--clr-red);
    padding: 6px 12px;
    border: 1px solid var(--clr-red);
    margin-bottom: 24px;
}
.detail-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 8px;
}
.detail-year {
    font-size: 13px;
    color: var(--clr-gray);
    letter-spacing: 0.15em;
    margin-bottom: 32px;
}
.detail-desc {
    font-size: 0.95rem;
    color: var(--clr-gray);
    line-height: 1.8;
    margin-bottom: 32px;
}
.detail-desc p { margin-bottom: 12px; }
.detail-meta {
    padding-top: 24px;
    border-top: 1px solid var(--clr-border);
}
.detail-meta-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 11px;
    letter-spacing: 0.15em;
}
.detail-meta-row dt { color: var(--clr-gray); }
.detail-meta-row dd { color: var(--clr-white); }

/* 右侧媒体区 */
.detail-media {
    min-width: 0;
}

.media-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    background: var(--clr-surface);
    overflow: hidden;
    border-radius: 2px;
    margin-bottom: 20px;
}

.media-slides {
    display: flex;
    width: 100%; height: 100%;
    transition: transform 0.5s var(--ease-smooth);
}

.media-slide {
    min-width: 100%; height: 100%;
    flex-shrink: 0;
}

.media-slide img,
.media-slide video {
    width: 100%; height: 100%;
    object-fit: cover;
}

.media-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px; height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--clr-white);
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    cursor: none;
    opacity: 0;
    transition: opacity 0.3s var(--ease-out), background 0.3s var(--ease-out);
    z-index: 5;
}
.media-carousel:hover .media-arrow { opacity: 1; }
.media-arrow:hover { background: rgba(0,0,0,0.8); }
.media-prev { left: 12px; }
.media-next { right: 12px; }

.media-dots {
    display: flex;
    gap: 8px;
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}
.media-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: none;
    transition: background 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.media-dot.active {
    background: var(--clr-white);
    transform: scale(1.3);
}

/* 底部导航 */
.detail-nav {
    display: flex;
    justify-content: space-between;
    max-width: 1500px;
    margin: 40px auto 0;
    padding-top: 32px;
    border-top: 1px solid var(--clr-border);
}
.detail-nav-btn {
    padding: 14px 32px;
    font-size: 11px;
    letter-spacing: 0.3em;
    color: var(--clr-white);
    border: 1px solid var(--clr-border);
    cursor: none;
    transition: all 0.3s var(--ease-out);
}
.detail-nav-btn:hover {
    background: var(--clr-red);
    border-color: var(--clr-red);
}

/* 移动端布局: 50%上媒体 / 50%下文字 */
@media (max-width: 1000px) {
    .detail-page { padding: 60px 16px 80px; }
    .detail-body {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .detail-info {
        position: relative;
        top: 0;
        order: 2;
    }
    .detail-media { order: 1; }
    .detail-nav { flex-direction: column; gap: 12px; }
    .detail-nav-btn { width: 100%; text-align: center; cursor: pointer; }
    .detail-back { cursor: pointer; }
    .media-arrow { opacity: 1; cursor: pointer; }
    .media-dot { cursor: pointer; }
}

/* ============================================
   5. 个人介绍页 (About)
   ============================================ */
.about-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease-out), visibility 0.3s var(--ease-out);
}
.about-overlay.active {
    opacity: 1;
    visibility: visible;
}

.about-page {
    position: fixed;
    top: 0; right: 0;
    width: 460px;
    max-width: 90vw;
    height: 100vh;
    background: var(--clr-dark);
    z-index: var(--z-about);
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-smooth);
    overflow-y: auto;
    padding: 60px 36px;
    border-left: 1px solid var(--clr-border);
}
.about-page.active {
    transform: translateX(0);
}

.about-close {
    position: absolute;
    top: 20px; right: 20px;
    width: 36px; height: 36px;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-gray);
    cursor: none;
    transition: color 0.3s var(--ease-out);
}
.about-close:hover { color: var(--clr-white); }

.about-inner {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.about-avatar {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 2px;
}
.about-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.6s var(--ease-out);
}
.about-avatar:hover img { filter: grayscale(0%); }

.about-label {
    font-size: 10px;
    letter-spacing: 0.4em;
    color: var(--clr-red);
}
.about-name {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.about-bio {
    font-size: 0.9rem;
    color: var(--clr-gray);
    line-height: 1.8;
}
.about-stats {
    display: flex;
    gap: 32px;
    padding: 20px 0;
    border-top: 1px solid var(--clr-border);
    border-bottom: 1px solid var(--clr-border);
}
.about-stat {
    text-align: center;
}
.about-stat strong {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--clr-red);
}
.about-stat span {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--clr-gray);
}
.about-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.skill-tag {
    padding: 6px 14px;
    font-size: 11px;
    letter-spacing: 0.1em;
    border: 1px solid var(--clr-border);
    color: var(--clr-gray);
    transition: all 0.3s var(--ease-out);
}
.skill-tag:hover {
    border-color: var(--clr-red);
    color: var(--clr-white);
}
.about-contact {
    font-size: 0.9rem;
    color: var(--clr-white);
}

@media (max-width: 768px) {
    .about-page { width: 100vw; max-width: 100vw; padding: 40px 24px; }
    .about-close { cursor: pointer; }
}

/* ============================================
   6. 全局动画与过渡
   ============================================ */
@keyframes fadeInPage {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* 确保所有动画使用 transform/opacity (GPU加速) */
.gallery-card,
.cat-item,
.detail-nav-btn,
.splash-enter,
.about-page {
    will-change: transform;
}

/* 图片懒加载占位 */
img[loading="lazy"] {
    background: var(--clr-surface);
}

/* 可访问性 - 减少动画 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}