/* ================================
 *  Base
 *  タイポグラフィ・全体レイアウトのベース設定
 * ================================ */

/* ページ全体を 100% にして WebGL 用のフルスクリーンに対応 */
html,
body {
    width: 100%;
    height: 100%;
}

/* ベーススタイル */
body {
    min-height: 100vh;
    overflow: hidden; /* スクロールさせない前提（必要なら案件ごとに変更） */
    background-color: #000; /* WebGL の背景と合わせる */
    color: #fff;
    font-family: 'avenir-next-world', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overscroll-behavior: none;
}

* {
    user-select: none;
}

/* リンクのベーススタイル */
a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.pc-only {
    display: block;
}
.sp-only {
    display: none;
}

@media (max-width: 768px) {
    .pc-only {
        display: none;
    }
    .sp-only {
        display: block;
    }
}

/* ================================
 *  WebGL / Canvas レイアウト
 * ================================ */
canvas {
    display: block;
}

.webgl-root {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* ===== Header / Nav ===== */
.site-header {
    position: fixed;
    left: 50%;
    top: 2dvh;
    translate: -50% 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 32px;
    pointer-events: none;

    opacity: 0;
    transition: opacity 1s ease 0.2s, translate 1s ease 0.2s;
    will-change: opacity, translate, letter-spacing;
}

body.is-loaded .site-header {
    opacity: 1;
    translate: -50% 0;
}

@keyframes loader-title-in {
    0% {
        opacity: 0;
        letter-spacing: 0.6em;
        translate: 5% 0;
    }
    60% {
        opacity: 1;
        letter-spacing: 0.32em;
        translate: 0 0;
    }
    100% {
        opacity: 1;
        letter-spacing: 0.28em;
        translate: 0 0;
    }
}

.site-title {
    pointer-events: auto;
    font-family: 'futura-100-book', sans-serif;
    font-weight: 400;
    font-size: clamp(0.75rem, 1vw, 1rem);
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;

    /* ローディング時の出現演出 */
    opacity: 0;
    animation: loader-title-in 2s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

/* ===== Gallery Caption ===== */
.gallery-caption {
    position: fixed;
    left: 50%;
    top: 70%;
    top: 70dvh;

    translate: -50% 0;
    z-index: 5;
    pointer-events: none;
    text-align: center;
    color: #ffffff;
    mix-blend-mode: lighten;
    width: calc(100% - 2rem);
    margin-inline: auto;
}

.gallery-caption__title {
    font-family: 'times-new-roman', system-ui, -apple-system, BlinkMacSystemFont, serif;
    font-weight: 400;
    font-size: clamp(0.875rem, 2vw - 0.5rem, 1.5rem);
    letter-spacing: 0.025em;
    opacity: 0.92;
}

.gallery-caption__subtitle {
    margin-block-start: 1.1em;
    font-family: 'futura-100-book', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-style: italic;
    font-size: clamp(0.625rem, 1vw - 0.25rem, 0.875rem);
    letter-spacing: 0.12em;
    opacity: 0.8;
}

@media (max-width: 520px) {
    .gallery-caption {
        top: 65%;
        top: 65dvh;
    }
}

/* Nav ボタン */
.gallery-nav {
    position: fixed;
    pointer-events: auto;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    left: 50%;
    bottom: 2dvh;
    translate: -50% 0;
    width: 98vw;
    z-index: 10;
}

.gallery-nav__btn {
    color: rgba(255, 255, 255, 0.88);
    padding: 3px 12px 3px 8px;
    backdrop-filter: blur(3px);
    font-size: clamp(0.625rem, 1vw - 0.25rem, 0.875rem);
    letter-spacing: 0.16em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.25s ease;
    position: relative;
    touch-action: manipulation;
}

.gallery-nav__btn--next::before {
    content: '<';
    padding-inline-end: 0.5em;
}

.gallery-nav__btn--prev::after {
    content: '>';
    padding-inline-start: 0.5em;
}

@media (any-hover: hover) {
    .gallery-nav__btn:hover {
        opacity: 0.4;
    }
}

.gallery-nav__btn:active {
    background: rgba(5, 10, 20, 0.9);
}

.gallery-nav__btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 2px;
}

/* ===== Scroll Indicator ===== */
@keyframes scroll-indicator-flow {
    from {
        clip-path: inset(0 0 100% 0);
        opacity: 0;
    }
    to {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
}

.scroll-indicator {
    position: fixed;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    left: 50%;
    bottom: 0;
    translate: -50% 0;
    opacity: 0.75;
}

.scroll-indicator__line {
    width: 1px;
    height: calc(2dvh - 3px);
    background: #fff;
    clip-path: inset(0 0 0 0);
    animation: scroll-indicator-flow 2s infinite ease-in-out;
}

.scroll-indicator__label {
    font-size: clamp(0.625rem, 1vw - 0.25rem, 0.875rem);
    letter-spacing: 0.16em;
}

@media (max-width: 768px) {
    .scroll-indicator {
        gap: 0;
    }
    .scroll-indicator__line {
        opacity: 0;
        height: calc(2dvh + 3px);
        animation: none;
    }
}

/* ===== Loader Overlay ===== */
.loader {
    position: fixed;
    inset: 0;
    z-index: 100; /* ヘッダーより下 / でもWebGLより上にしたいなら調整 */
    background: radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.08), transparent 60%),
        radial-gradient(circle at 80% 100%, rgba(70, 160, 255, 0.15), transparent 60%), #020308;
    opacity: 1;
    transition: opacity 1.2s ease 0.15s;
    pointer-events: none;
    display: grid;
    place-items: center;
}

/* ロード完了後はフェードアウト */
body.is-loaded .loader {
    opacity: 0;
}

.loader-logo {
    display: block;
    font-family: 'futura-100-book', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw + 0.5rem, 1.6rem);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;

    opacity: 0;
    animation: loader-logo-sharp-in 2.3s cubic-bezier(0.19, 1, 0.22, 1) forwards;
    will-change: opacity, transform;
}

/* ぼかしレイヤーもそのまま中央揃えでOK */
.loader-logo::before {
    content: attr(data-logo-text);
    position: absolute;
    inset: 0;
    text-align: inherit;
    color: inherit;
    filter: blur(4px);
    opacity: 1;
    pointer-events: none;

    animation: loader-logo-blur-fade 2.3s cubic-bezier(0.19, 1, 0.22, 1) forwards;
    will-change: opacity;
}

/* 出現アニメーション */
@keyframes loader-logo-sharp-in {
    0% {
        opacity: 0;
        translate: -10% 0;
        scale: 0.96;
    }
    10% {
        opacity: 0;
        translate: -8% 0;
        scale: 0.985;
    }
    100% {
        opacity: 1;
        translate: 0 0;
        scale: 1;
    }
}

/* ぼかし版：最初は強く、途中から消えていく */
@keyframes loader-logo-blur-fade {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* ロード完了時のフェードアウト */
@keyframes loader-logo-out {
    0% {
        opacity: 1;
        translate: 0 0;
        scale: 1;
    }
    100% {
        opacity: 0;
        translate: 10% 0;
        scale: 0.97;
    }
}

body.is-loaded .loader-logo {
    animation: loader-logo-out 1.3s ease forwards;
}
