/* ============================================
   메인 홈 — 풀스크린 랜딩 (PSD + 로딩 애니메이션)
   ============================================ */

/* 로컬 폰트 */
@font-face {
    font-family: 'Aston Script';
    src: url('../font/Aston Script.ttf') format('truetype');
    font-display: swap;
}
@font-face {
    font-family: 'Vortigra';
    src: url('../font/Vortigra.otf') format('opentype');
    font-display: swap;
}
@font-face {
    font-family: 'Paperlogy';
    src: url('../font/Paperlogy-4Regular.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Paperlogy';
    src: url('../font/Paperlogy-5Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Paperlogy';
    src: url('../font/Paperlogy-6SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Paperlogy';
    src: url('../font/Paperlogy-7Bold.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'NanumSquareNeo';
    src: url('../font/NanumSquareNeo-Variable.ttf') format('truetype');
    font-display: swap;
}

/* ── 셸 레이아웃 (사이드바 + 콘텐츠) ── */
.home-landing {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #f2f0ed;
}

.home-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    height: 100vh;
}

/* 콘텐츠 영역 */
.home-content {
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    height: 100vh;
}

/* HOME 페이지: center+right 2분할, 스크롤 없음 */
.page-main {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.4fr);
    height: 100%;
    overflow: hidden;
}

/* 비-HOME 페이지: 일반 콘텐츠 (스크롤 가능) */
.home-content > :not(.page-main):not(.page-loading) {
    padding: 40px 48px;
}

/* 로딩 스피너 위치 */
.home-content > .page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 0;
    max-width: none;
}

/* 홈 전용 요소: on-home 클래스 있을 때만 표시 */
.home-right-track { display: none; }
.home-social { display: none; }
.home-landing.on-home .home-right-track { display: flex; }
.home-landing.on-home .home-social { display: flex; }

/* ============================================
   좌측 사이드바
   ============================================ */
.home-left {
    display: flex;
    flex-direction: column;
    padding: 36px 28px 24px 48px;
    position: relative;
}

/* 로고 영역 (PSD: 205x17 텍스트, 실제 로고 이미지 들어갈 공간) */
.home-logo {
    min-height: 40px;
    max-width: 220px;
    margin-bottom: 100px;
    font-size: 11px;
    color: #bbb;
    letter-spacing: -0.3px;
    white-space: nowrap;
}
.home-logo img {
    max-width: 100%;
    max-height: 60px;
    object-fit: contain;
}

/* ── 네비게이션 ── */
.home-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: auto;
}

.home-nav-link {
    display: flex;
    align-items: center;
    position: relative;
    font-family: 'Vortigra', 'Georgia', serif;
    font-size: 26px;
    font-weight: normal;
    letter-spacing: 2px;
    color: #b8b2aa;
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.25s;
    cursor: pointer;
    background: none;
    border: none;
    text-align: left;
    line-height: 1.4;
}
.home-nav-link:hover { color: #666; }
.home-nav-link.active {
    color: #1a1a1a;
}

/* 활성 선택 인디케이터 — 글자 끝에 인라인 배치, 페이드인 */
/* 인디케이터: 글자 우상단, 연한 원 하단 = 글자 세로 중앙 */
.home-nav-sel {
    display: inline-block;
    position: relative;
    width: 30px;
    height: 26px;
    margin-left: -10px;
    vertical-align: top;
    /* 연한 원(24px) 하단이 글자 중간에 오도록: 글자 중간 ≈ 0.35em 위치 */
    margin-top: calc(-26px + 0.35em);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.home-nav-link.active .home-nav-sel {
    opacity: 1;
    transform: scale(1);
}
.sel-circle {
    position: absolute;
    border-radius: 50%;
    transition: opacity 0.3s ease;
}
.sel-circle.light {
    width: 24px;
    height: 24px;
    border: 1.5px solid #d0cac2;
    bottom: 0;
    left: 0;
}
.sel-circle.dark {
    width: 15px;
    height: 15px;
    background: #555;
    top: 0;
    right: -2px;
    opacity: 0;
    transition: opacity 0.4s ease 0.2s;
}
.home-nav-link.active .sel-circle.dark {
    opacity: 1;
}
.home-nav-link:not(.active) .home-nav-sel {
    opacity: 0;
    transform: scale(0.4);
    pointer-events: none;
}

/* BGM / LOGIN */
.home-nav-sub {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 28px;
}
.home-bgm-btn {
    font-family: 'Vortigra', 'Georgia', serif;
    gap: 8px;
}
/* BGM 원형 버튼 (PSD: 48px) */
.bgm-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid #b8b2aa;
    transition: border-color 0.25s;
    flex-shrink: 0;
}
.home-bgm-btn:hover .bgm-circle { border-color: #555; }
.bgm-icon { font-size: 10px; margin-left: 1px; color: inherit; }

/* 사이드바 인증 영역 */
.home-nav-auth {
    font-family: 'Vortigra', 'Georgia', serif;
}

/* LOGOUT + 톱니바퀴 행 */
.nav-auth-row {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}
.nav-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: #b8b2aa;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.25s, background 0.25s;
    padding: 0;
}
.nav-settings-btn:hover {
    color: #555;
    background: rgba(0,0,0,0.05);
}
.nav-auth-row .nav-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border: 1px solid #e5e5ea;
    min-width: 180px;
    padding: 4px;
    display: none;
    z-index: 100;
    font-size: 14px;
    letter-spacing: 0;
    font-family: 'Paperlogy', sans-serif;
}
.nav-auth-row .nav-dropdown.show { display: block; }
.nav-auth-row .nav-dropdown a {
    display: block; width: 100%;
    padding: 8px 14px; font-size: 14px;
    color: #333; background: none; border: none;
    border-radius: 6px; text-align: left;
    cursor: pointer; font-family: inherit;
    text-decoration: none;
}
.nav-auth-row .nav-dropdown a:hover { background: #f5f5f7; }
.nav-auth-row .nav-dropdown .divider {
    height: 1px; background: #f2f2f7; margin: 4px 0;
}

/* 커미션 출처 박스 (PSD: 293x104px) */
.home-credits {
    background: #eae7e3;
    border-radius: 10px;
    padding: 16px 18px 16px 22px;
    position: relative;
    max-width: 280px;
}
.home-credits-bar {
    position: absolute;
    left: 0; top: 14px; bottom: 14px;
    width: 3px;
    background: #bfa97e;
    border-radius: 0 2px 2px 0;
}
/* 컬러 포인트 (우상단 작은 사각형) */
.home-credits::after {
    content: '';
    position: absolute;
    top: 14px; right: 14px;
    width: 14px; height: 14px;
    background: #bfa97e;
    border-radius: 3px;
    opacity: 0.7;
}
.home-credits-title {
    font-family: 'Paperlogy', sans-serif;
    font-size: 11px; font-weight: 700;
    letter-spacing: 1.5px; color: #777; margin-bottom: 6px;
}
.home-credits-name { font-size: 12px; color: #666; margin-bottom: 3px; }
.home-credits-link {
    font-size: 11px; color: #999;
    text-decoration: underline; text-underline-offset: 2px;
}
.home-credits-link:hover { color: #666; }

/* ============================================
   중앙 콘텐츠
   ============================================ */
.home-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 40px 80px;
    position: relative;
}

/* Genre 라벨 (PSD: 중앙영역 좌상단, y=114) */
.home-genre {
    position: absolute;
    top: 28px;
    left: 40px;
    font-family: 'Paperlogy', sans-serif;
    font-size: 13px;
    color: #aaa;
    letter-spacing: 1px;
}

.home-pair-name {
    font-family: 'Aston Script', cursive;
    font-size: 5.8rem;
    font-weight: 400;
    color: #222;
    line-height: 1.1;
    margin-bottom: 28px;
}

.home-intro {
    font-family: 'NanumSquareNeo', 'Paperlogy', sans-serif;
    font-size: 13.5px; color: #777;
    line-height: 1.9; margin-bottom: 44px;
}
.home-intro p { margin: 0; }

/* 캐릭터 버튼 */
.home-char-btns { display: flex; gap: 14px; }
.home-char-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 26px;
    border: 1.5px solid #444;
    border-radius: 28px;
    color: #333;
    text-decoration: none;
    font-family: 'Paperlogy', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    transition: all 0.25s;
}
.home-char-btn:hover { background: #333; color: #fff; }
.char-arrow { font-size: 14px; transition: transform 0.2s; }
.home-char-btn:hover .char-arrow { transform: translateX(3px); }

/* PSD: (401,976) 좌측 정렬, 하단 고정 */
.home-pair-text {
    position: absolute;
    bottom: 50px;
    left: 40px;
    font-family: 'Paperlogy', sans-serif;
    font-size: 13px;
    color: #bbb;
    font-style: italic;
    letter-spacing: 0.5px;
}

/* ============================================
   우측 이미지 영역
   ============================================ */
.home-right {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 40px 80px 40px 40px; /* 우측 트랙 공간 확보 */
}

/* 원형 이미지 래퍼 (Go To Page 앵커) */
.home-circle-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-circle {
    width: min(620px, 42vw);
    height: min(620px, 42vw);
    border-radius: 50%;
    background: #d6d3cf;
    overflow: hidden;
    flex-shrink: 0;
}
.home-circle img {
    width: 100%; height: 100%; object-fit: cover;
}

/* Go To Page — 원 우하단 테두리에 걸침 (PSD: bottom ~17%) */
.home-goto {
    position: absolute;
    right: -10px;
    bottom: 8%;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 30px;
    background: rgba(30,30,30,0.75);
    color: #fff;
    border-radius: 30px;
    font-family: 'Paperlogy', sans-serif;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: all 0.25s;
    backdrop-filter: blur(4px);
    z-index: 2;
}
.home-goto:hover {
    background: rgba(30,30,30,0.92);
    color: #fff;
}
.goto-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    font-size: 14px;
    transition: transform 0.2s;
}
.home-goto:hover .goto-arrow { transform: translateX(2px); }

/* 데코 별 */
.home-deco {
    position: absolute;
    color: #c5c0b8;
    pointer-events: none;
}
.deco-tr    { top: -32px; right: -40px; font-size: 28px; }
.deco-bl    { bottom: 8px; left: -44px; font-size: 18px; }
.deco-star1 { top: -10px; right: 20%; font-size: 14px; color: #d4c9a8; }
.deco-star2 { bottom: 30%; left: -30px; font-size: 12px; }
.deco-star3 { bottom: 15%; right: -20px; font-size: 10px; }

/* ============================================
   우측 트랙 인디케이터 (점 + 선 + 박스)
   ============================================ */
.home-right-track {
    position: absolute;
    top: 10%;
    right: 28px;
    /* display: on-home에서 flex로 설정 */
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

/* 상단 3개 점 (PSD: ~14-18px 크기) */
.track-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 16px;
}
.track-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1.5px solid #aaa;
    cursor: pointer;
    transition: all 0.25s ease;
}
.track-dot:hover {
    border-color: #666;
    transform: scale(1.2);
    background: rgba(0,0,0,0.08);
}
.track-dot.filled {
    width: 18px; height: 18px;
    background: #555;
    border-color: #555;
}
.track-dot.filled:hover {
    background: #444;
    border-color: #444;
}

/* 세로 연결선 */
.track-line {
    width: 1px;
    height: 200px;
    background: #bbb;
    margin-bottom: 16px;
}

/* 하단 박스 (정사각형, 이미지 들어감) */
.track-boxes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.track-box {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 1.5px solid #bbb;
    cursor: pointer;
    transition: all 0.25s;
    overflow: hidden;
}
.track-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.track-box.active {
    border-color: #777;
}
.track-box:hover { border-color: #888; }

/* ============================================
   하단 푸터
   ============================================ */
.home-footer {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 48px;
    z-index: 5;
}
.home-copy {
    font-size: 10px; color: #c5c0ba;
    letter-spacing: 0.3px; text-align: center; flex: 1;
}

/* 소셜 아이콘 — footer 바로 위, 우측 고정 (on-home일 때만 display:flex) */
.home-social {
    position: absolute;
    right: 48px;
    bottom: 44px;
    gap: 20px;
    align-items: center;
    z-index: 5;
}
.social-icon {
    font-size: 28px;
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
    line-height: 1;
}
.social-icon:hover { color: #222; }

/* ============================================
   노이즈 오버레이
   ============================================ */
.home-noise {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ============================================
   ★ 입장 / 슬라이드 전환 애니메이션
   JS가 개별 클래스를 토글하여 재생 가능
   ============================================ */

/* 초기 상태 (클래스 없을 때) */
.home-circle          { opacity: 0; transform: scale(0.35); }
.home-goto            { opacity: 0; transform: translateY(12px); }
.home-pair-name       { opacity: 0; transform: translateX(-30px); }
.home-intro           { opacity: 0; transform: translateY(10px); }
.anim-btn-a,
.anim-btn-b           { opacity: 0; transform: translateY(16px); }
.home-deco            { opacity: 0; transform: scale(0.3); }
.home-right-track     { opacity: 0; transform: translateY(-10px); }

/* 트랙은 첫 로드만 (home-loaded) */
.home-loaded .home-right-track {
    animation: fadeSlideDown 0.5s ease 0.25s forwards;
}

/* JS 토글 클래스 → 재생 가능한 애니메이션 */
.anim-in-circle {
    animation: circleGrow 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}
.anim-in-fade-up {
    animation: fadeSlideUp 0.5s ease forwards !important;
}
.anim-in-slide-right {
    animation: fadeSlideRight 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
}
.anim-in-star {
    animation: starPop 0.5s ease forwards !important;
}

/* 딜레이는 JS에서 각 요소별 style.animationDelay로 적용 */

/* @keyframes */
@keyframes circleGrow {
    0%   { opacity: 0; transform: scale(0.35); }
    40%  { opacity: 0.6; }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideRight {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes starPop {
    0%   { opacity: 0; transform: scale(0.3) rotate(-20deg); }
    60%  { opacity: 0.8; transform: scale(1.15) rotate(5deg); }
    100% { opacity: 0.6; transform: scale(1) rotate(0deg); }
}

/* 별 반짝임 (지속) */
.home-deco { --twinkle-dur: 3s; }
.deco-tr    { --twinkle-dur: 3.2s; }
.deco-star1 { --twinkle-dur: 2.6s; }
.deco-star2 { --twinkle-dur: 3.8s; }
.deco-star3 { --twinkle-dur: 2.9s; }
.deco-bl    { --twinkle-dur: 3.5s; }

@keyframes twinkle {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 0.3; transform: scale(0.85); }
}
.home-deco.twinkling {
    animation: twinkle var(--twinkle-dur) ease-in-out infinite;
}

/* ============================================
   반응형
   ============================================ */

@media (max-width: 1400px) {
    .home-layout { grid-template-columns: 300px 1fr; }
    .home-left { padding-left: 36px; }
    .home-pair-name { font-size: 4.8rem; }
    .home-circle { width: min(520px, 38vw); height: min(520px, 38vw); }
    .home-right-track { right: 20px; }
}

@media (max-width: 1024px) {
    .home-layout { grid-template-columns: 240px 1fr; }
    .home-left { padding: 28px 20px 20px 28px; }
    .home-nav-link { font-size: 22px; letter-spacing: 1.5px; }
    .home-pair-name { font-size: 4rem; }
    .home-center { padding: 50px 28px 70px; }
    .home-circle { width: min(420px, 36vw); height: min(420px, 36vw); }
    .home-right { padding-right: 60px; }
    .home-goto { padding: 10px 20px; font-size: 12px; }
    .home-right-track { right: 14px; }
    .track-box { width: 38px; height: 38px; }
    .page-main { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .home-landing { height: auto; min-height: 100vh; overflow-y: auto; }
    .home-layout {
        display: flex; flex-direction: column;
        height: auto;
    }

    .home-left {
        flex-direction: row; flex-wrap: wrap;
        align-items: center; padding: 16px 20px; gap: 12px;
    }
    .home-logo { margin-bottom: 0; }
    .home-nav {
        flex-direction: row; flex-wrap: wrap;
        gap: 4px 12px; margin-bottom: 0;
    }
    .home-nav-link { font-size: 14px; padding: 4px 0; letter-spacing: 1px; font-weight: 600; }
    .home-nav-sel { display: none !important; }
    .home-nav-sub { flex-direction: row; gap: 12px; margin-bottom: 0; }
    .bgm-circle { width: 28px; height: 28px; }
    .home-credits { display: none; }

    .page-main { display: flex; flex-direction: column; }

    .home-center {
        align-items: center; text-align: center;
        padding: 40px 24px 32px;
    }
    .home-genre { position: static; margin-bottom: 20px; }
    .home-pair-name { font-size: 3.2rem; margin-bottom: 20px; }
    .home-intro { margin-bottom: 28px; }
    .home-char-btns { justify-content: center; }
    .home-pair-text { position: static; margin-top: 32px; }

    .home-right { padding: 20px; flex-direction: column; }
    .home-circle { width: 260px; height: 260px; }
    .home-goto { right: -4px; bottom: 10%; font-size: 12px; padding: 10px 18px; }
    .home-right-track { display: none !important; }

    .home-content > :not(.page-main) { padding: 20px; }

    .home-footer {
        position: static; flex-direction: column;
        gap: 8px; padding: 20px;
    }
    .home-social {
        position: static;
        justify-content: center;
        margin-bottom: 8px;
    }
}
