/* =====================================================
   사이트 공통 효과
   1) 페이지 이동할 때 레드 화면 전환
   2) 레드 점 커서 (작업 카드 위에서는 VIEW)
   모든 페이지 <head>에 effects.css 와 effects.js 를 함께 넣으면 똑같이 동작해요.
   ===================================================== */

/* ----- 0. 차분한 전환 (TRANSITION = 'fade') -----
   로고와 상단 메뉴는 그대로 있고, 그 아래 내용만 바뀜 */
html.pt-out #wrap > *:not(h1):not(header),
html.pt-out #wrap ~ * {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

html.pt-in #wrap > *:not(h1):not(header) {
    animation: pt-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

html.pt-in #wrap > *:nth-child(n+4):not(h1):not(header) {
    animation-delay: 0.08s;
}

@keyframes pt-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
}

/* fade 에서는 빨간 막을 쓰지 않음 */
#page-curtain.t-fade {
    display: none;
}

/* ----- 1. 레드 화면 전환 ----- */
#page-curtain {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d94a4a;
    transform: translateY(100%);
    pointer-events: none;
}

#page-curtain span {
    font-family: "Urbanist", sans-serif;
    font-weight: 800;
    font-size: 44px;
    letter-spacing: 0.02em;
    color: #fff;
}

/* 메뉴를 누르면: 아래에서 올라와 화면을 덮음 */
#page-curtain.is-entering {
    transform: translateY(0);
    transition: transform 0.6s cubic-bezier(0.7, 0, 0.3, 1);
}

/* 다음 페이지가 열린 순간: 덮인 상태로 시작 */
#page-curtain.is-covering {
    transform: translateY(0);
    transition: none;
}

/* 그다음 위로 걷힘 */
#page-curtain.is-leaving {
    transform: translateY(-100%);
    transition: transform 0.6s cubic-bezier(0.7, 0, 0.3, 1);
}

/* ----- 1-2. 동그라미 효과 (TRANSITION = 'circle') ----- */
#page-curtain.t-circle {
    transform: none;
    clip-path: circle(0% at var(--cx, 50%) var(--cy, 50%));
}

#page-curtain.t-circle.is-entering {
    transform: none;
    clip-path: circle(150% at var(--cx, 50%) var(--cy, 50%));
    transition: clip-path 0.72s cubic-bezier(0.7, 0, 0.3, 1);
}

#page-curtain.t-circle.is-covering {
    transform: none;
    clip-path: circle(150% at 50% 50%);
    transition: none;
}

#page-curtain.t-circle.is-leaving {
    transform: none;
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 0.72s cubic-bezier(0.7, 0, 0.3, 1);
}

/* ----- 1-3. 세로 띠 효과 (TRANSITION = 'stripes') ----- */
#page-curtain.t-stripes {
    transform: none;
    background: transparent;
}

#page-curtain.t-stripes i {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20.2%;
    background: #d94a4a;
    transform: translateY(-100%);
}

#page-curtain.t-stripes i:nth-child(1) { left: 0; }
#page-curtain.t-stripes i:nth-child(2) { left: 20%; transition-delay: 0.06s !important; }
#page-curtain.t-stripes i:nth-child(3) { left: 40%; transition-delay: 0.12s !important; }
#page-curtain.t-stripes i:nth-child(4) { left: 60%; transition-delay: 0.18s !important; }
#page-curtain.t-stripes i:nth-child(5) { left: 80%; transition-delay: 0.24s !important; }

#page-curtain.t-stripes span {
    position: relative;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#page-curtain.t-stripes.is-entering i {
    transform: translateY(0);
    transition: transform 0.6s cubic-bezier(0.7, 0, 0.3, 1);
}

#page-curtain.t-stripes.is-entering span,
#page-curtain.t-stripes.is-covering span {
    opacity: 1;
    transition-delay: 0.5s;
}

#page-curtain.t-stripes.is-covering i {
    transform: translateY(0);
    transition: none;
}

#page-curtain.t-stripes.is-leaving i {
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.7, 0, 0.3, 1);
}

/* ----- 1-4. 펜으로 칠하기 (TRANSITION = 'pen') ----- */
#page-curtain.t-pen {
    transform: none;
    background: transparent;
}

#page-curtain.t-pen svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#page-curtain.t-pen path {
    fill: none;
    stroke: #d94a4a;
    stroke-width: 30;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1 2;
    stroke-dashoffset: 1;
}

#page-curtain.t-pen span {
    position: relative;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#page-curtain.t-pen.is-entering path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.55, 0, 0.45, 1);
}

#page-curtain.t-pen.is-entering span,
#page-curtain.t-pen.is-covering span {
    opacity: 1;
    transition-delay: 0.6s;
}

#page-curtain.t-pen.is-covering path {
    stroke-dashoffset: 0;
    transition: none;
}

/* 다음 페이지: 칠한 순서대로 지워짐 */
#page-curtain.t-pen.is-leaving path {
    stroke-dashoffset: -1;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.55, 0, 0.45, 1);
}

/* ----- 1-5. 맥 창이 커지기 (TRANSITION = 'window') ----- */
#page-curtain.t-window {
    flex-direction: column;
    transform: scale(0);
    transform-origin: var(--cx, 50%) var(--cy, 50%);
    border-radius: 14px;
    overflow: hidden;
    opacity: 1;
}

#page-curtain.t-window .pc-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
}

#page-curtain.t-window .pc-bar b {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ff5f57;
}

#page-curtain.t-window .pc-bar b:nth-child(2) { background: #febc2e; }
#page-curtain.t-window .pc-bar b:nth-child(3) { background: #28c840; }

#page-curtain.t-window.is-entering {
    transform: scale(1);
    border-radius: 0;
    transition: transform 0.68s cubic-bezier(0.7, 0, 0.3, 1), border-radius 0.68s ease;
}

#page-curtain.t-window.is-covering {
    transform: scale(1);
    border-radius: 0;
    transition: none;
}

/* 다음 페이지: 가운데로 작아지며 사라짐 */
#page-curtain.t-window.is-leaving {
    transform-origin: 50% 50%;
    transform: scale(0.85);
    border-radius: 14px;
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.7, 0, 0.3, 1), opacity 0.6s ease, border-radius 0.6s ease;
}

/* ----- 2. 레드 점 커서 (마우스가 있는 기기에서만) ----- */
html.has-cursor,
html.has-cursor * {
    cursor: none !important;
}

#cursor-dot {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 3000;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    background: #d94a4a;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: width 0.25s ease, height 0.25s ease, margin 0.25s ease, background 0.25s ease, opacity 0.2s ease;
}

#cursor-dot.is-on {
    opacity: 1;
}

#cursor-dot span {
    font-family: "Urbanist", sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.12em;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* 빨간 배경 위에서는 흰 점 */
#cursor-dot.is-light {
    background: #fff;
    box-shadow: 0 0 0 1px rgba(48, 56, 62, 0.15);
}

/* 창 크기 조절 손잡이 위: 좌우 화살표 */
#cursor-dot .cur-arrow {
    display: none;
    width: 22px;
    height: 12px;
    color: #fff;
}

#cursor-dot.is-resize {
    width: 42px;
    height: 26px;
    margin: -13px 0 0 -21px;
    border-radius: 13px;
    background: #30383e;
}

#cursor-dot.is-resize .cur-arrow {
    display: block;
}

#cursor-dot.is-resize span {
    display: none;
}

/* 맥 창 버튼(닫기·최소화·확대) 위: 버튼 색이 보이도록 속이 빈 링 */
#cursor-dot.is-ring {
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    background: transparent;
    box-shadow: 0 0 0 1.5px #30383e;
}

/* data-cursor="view" 가 붙은 요소 위에서 커지며 VIEW */
#cursor-dot.is-view {
    width: 84px;
    height: 84px;
    margin: -42px 0 0 -42px;
    background: rgba(217, 74, 74, 0.92);
}

#cursor-dot.is-view span {
    opacity: 1;
}

/* 움직임 줄이기 설정을 켠 사용자: 화면 전환 생략 */
@media (prefers-reduced-motion: reduce) {
    #page-curtain {
        display: none;
    }

    html.pt-in #wrap > * {
        animation: none;
    }
}

/* 눌러서 이동하는 상자 (data-href) */
[data-href] {
    cursor: pointer;
}
