/* Role 섹션 (우리의 역할) */
.section-role {
    background: var(--bg);
    overflow: hidden;
}

.section-role .section-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
}

/* 점 */
.role-dot {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--text);
    border-radius: 50%;
    opacity: 0;
}

.section-role.active .role-dot {
    animation: dotAppear 0.6s ease forwards;
}

@keyframes dotAppear {
    0% { opacity: 0; transform: translateX(-50%) scale(0); }
    50% { opacity: 1; transform: translateX(-50%) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) scale(0); }
}

/* 세로선 공통 */
.role-line-left,
.role-line-right {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 0;
    background: var(--text);
}

/* 선 그리기 */
.section-role.active .role-line-left,
.section-role.active .role-line-right {
    animation: lineDraw 1.2s ease forwards 0.5s;
}

/* 좌우 분리 */
.section-role.active .role-line-left {
    animation: lineDraw 1.2s ease forwards 0.5s, lineMoveLeft 0.8s ease forwards 1.7s, lineShrink 0.4s ease forwards 2.5s;
}

.section-role.active .role-line-right {
    animation: lineDraw 1.2s ease forwards 0.5s, lineMoveRight 0.8s ease forwards 1.7s, lineShrink 0.4s ease forwards 2.5s;
}

@keyframes lineDraw {
    from { height: 0; }
    to { height: clamp(32px, 6vw, 64px); }
}

@keyframes lineMoveLeft {
    from {
        left: 50%;
        transform: translate(-50%, -50%);
    }
    to {
        left: calc(50% - var(--title-half-width, 200px));
        transform: translate(-50%, -50%);
    }
}

@keyframes lineMoveRight {
    from {
        left: 50%;
        transform: translate(-50%, -50%);
    }
    to {
        left: calc(50% + var(--title-half-width, 200px));
        transform: translate(-50%, -50%);
    }
}

@keyframes lineShrink {
    from {
        height: clamp(32px, 6vw, 64px);
        opacity: 1;
    }
    to {
        height: 0;
        opacity: 0;
    }
}

/* 원형 궤도 */
.role-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(80vw, 80vh);
    height: min(80vw, 80vh);
    opacity: 0;
}

.section-role.active .role-orbit {
    animation: orbitAppear 0.8s ease forwards 2.8s;
}

@keyframes orbitAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.orbit-circle {
    position: absolute;
    width: 100%;
    height: 100%;
}

.orbit-path {
    fill: none;
    stroke: var(--text);
    stroke-width: 1;
    stroke-dasharray: 1257;
    stroke-dashoffset: 1257;
    opacity: 0.2;
}

.section-role.active .orbit-path {
    animation: drawCircle 1s ease forwards 2.8s;
}

@keyframes drawCircle {
    to {
        stroke-dashoffset: 0;
    }
}

.orbit-items {
    position: absolute;
    width: 100%;
    height: 100%;
    animation: orbitRotate 60s linear infinite;
    animation-play-state: paused;
}

.section-role.active .orbit-items {
    animation-play-state: running;
    animation-delay: 4s;
}

@keyframes orbitRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes orbitRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.orbit-item {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
}

.orbit-item[data-index="0"] { transform: translate(-50%, -50%) rotate(0deg) translateY(calc(min(80vw, 80vh) / -2)); }
.orbit-item[data-index="1"] { transform: translate(-50%, -50%) rotate(72deg) translateY(calc(min(80vw, 80vh) / -2)); }
.orbit-item[data-index="2"] { transform: translate(-50%, -50%) rotate(144deg) translateY(calc(min(80vw, 80vh) / -2)); }
.orbit-item[data-index="3"] { transform: translate(-50%, -50%) rotate(216deg) translateY(calc(min(80vw, 80vh) / -2)); }
.orbit-item[data-index="4"] { transform: translate(-50%, -50%) rotate(288deg) translateY(calc(min(80vw, 80vh) / -2)); }

.section-role.active .orbit-item {
    animation: itemAppear 0.4s ease forwards;
}

.section-role.active .orbit-item[data-index="0"] { animation-delay: 3.2s; }
.section-role.active .orbit-item[data-index="1"] { animation-delay: 3.4s; }
.section-role.active .orbit-item[data-index="2"] { animation-delay: 3.6s; }
.section-role.active .orbit-item[data-index="3"] { animation-delay: 3.8s; }
.section-role.active .orbit-item[data-index="4"] { animation-delay: 4.0s; }

@keyframes itemAppear {
    to {
        opacity: 1;
    }
}

.orbit-icon {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 아이콘 순차 펄스 애니메이션 (7.5초 주기, 5개 아이콘) */
.section-role.active .orbit-item[data-index="0"] .orbit-icon {
    animation: iconPulse 1.5s ease-in-out 4.5s infinite 7.5s;
    animation-delay: 4.5s;
}
.section-role.active .orbit-item[data-index="1"] .orbit-icon {
    animation: iconPulse 1.5s ease-in-out infinite;
    animation-delay: 6s;
}
.section-role.active .orbit-item[data-index="2"] .orbit-icon {
    animation: iconPulse 1.5s ease-in-out infinite;
    animation-delay: 7.5s;
}
.section-role.active .orbit-item[data-index="3"] .orbit-icon {
    animation: iconPulse 1.5s ease-in-out infinite;
    animation-delay: 9s;
}
.section-role.active .orbit-item[data-index="4"] .orbit-icon {
    animation: iconPulse 1.5s ease-in-out infinite;
    animation-delay: 10.5s;
}

/* 링 효과 */
.section-role.active .orbit-item .orbit-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: var(--primary);
    z-index: -1;
    opacity: 0;
}

.section-role.active .orbit-item[data-index="0"] .orbit-icon::after {
    animation: iconRing 1.5s ease-out infinite;
    animation-delay: 4.5s;
}
.section-role.active .orbit-item[data-index="1"] .orbit-icon::after {
    animation: iconRing 1.5s ease-out infinite;
    animation-delay: 6s;
}
.section-role.active .orbit-item[data-index="2"] .orbit-icon::after {
    animation: iconRing 1.5s ease-out infinite;
    animation-delay: 7.5s;
}
.section-role.active .orbit-item[data-index="3"] .orbit-icon::after {
    animation: iconRing 1.5s ease-out infinite;
    animation-delay: 9s;
}
.section-role.active .orbit-item[data-index="4"] .orbit-icon::after {
    animation: iconRing 1.5s ease-out infinite;
    animation-delay: 10.5s;
}

@keyframes iconPulse {
    0%, 20%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }
    10% {
        transform: scale(1.15);
        box-shadow: 0 8px 24px rgba(37, 99, 235, 0.6);
    }
}

@keyframes iconRing {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

.orbit-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* 첫번째 아이콘 펄스 애니메이션 (힌트) */
.section-role.active .orbit-item[data-index="0"] .orbit-icon {
    animation: iconPulse 2s ease-in-out infinite 4.5s;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5);
    }
}



/* 상세 내용 */
.role-detail {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 600px;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.role-detail.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.role-detail-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: 50%;
    color: #fff;
    font-size: 32px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.5s ease;
}

.role-detail.active .role-detail-icon {
    opacity: 1;
    transform: scale(1);
}

.role-detail-title {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease 0.15s;
}

.role-detail.active .role-detail-title {
    opacity: 1;
    transform: translateY(0);
}

.role-detail-desc {
    font-size: clamp(14px, 2vw, 18px);
    color: var(--text-muted);
    line-height: 1.8;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease 0.3s;
    word-break: keep-all;
}

.role-detail.active .role-detail-desc {
    opacity: 1;
    transform: translateY(0);
}

.role-detail-close {
    position: absolute;
    top: 120px;
    right: 48px;
    width: 48px;
    height: 48px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    background: var(--bg);
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    z-index: 100;
}

.role-detail-close.active {
    opacity: 1;
    visibility: visible;
}

.role-detail-close:hover {
    color: var(--text);
    border-color: var(--text);
    transform: scale(1.1);
}

/* 타이틀 이동 */
.role-title.moved {
    top: 120px !important;
    left: 48px !important;
    transform: none !important;
    font-size: clamp(24px, 3vw, 36px) !important;
    text-align: left;
    clip-path: none !important;
}

.role-subtitle.moved {
    top: 170px !important;
    left: 48px !important;
    transform: none !important;
    font-size: clamp(12px, 1.5vw, 14px) !important;
    text-align: left;
}

/* 선택된 아이콘 */
.orbit-item.selected {
    z-index: 10;
}

.orbit-item {
    transition: opacity 0.4s ease;
}

.orbit-item.hidden {
    opacity: 0 !important;
}

/* 궤도 숨김 */
.orbit-circle {
    transition: opacity 0.5s ease;
}

.orbit-circle.hidden {
    opacity: 0;
}

.orbit-items.stopped {
    animation-play-state: paused !important;
}

/* 반응형 */
@media (max-width: 768px) {
    .orbit-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .role-title.moved {
        top: 10%;
        left: 5%;
    }
    
    .role-subtitle.moved {
        top: calc(10% + 35px);
        left: 5%;
    }
}

/* ExtensionFactory 타이틀 */
.role-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(32px, 6vw, 64px);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1px;
    clip-path: inset(0 50% 0 50%);
    transition: all 0.6s ease;
}

.section-role.active .role-title {
    animation: titleReveal 0.8s ease forwards 1.7s;
}

@keyframes titleReveal {
    from {
        clip-path: inset(0 50% 0 50%);
    }
    to {
        clip-path: inset(0 0% 0 0%);
    }
}

/* 서브타이틀 */
.role-subtitle {
    position: absolute;
    top: calc(50% + 50px);
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(14px, 2vw, 18px);
    color: var(--text-muted);
    opacity: 0;
    letter-spacing: 0;
    transition: all 0.6s ease;
}

.section-role.active .role-subtitle {
    animation: subtitleAppear 0.6s ease forwards 2.5s;
}

@keyframes subtitleAppear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 클릭 힌트 */
.role-hint {
    position: absolute;
    top: calc(50% + 85px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 10;
}

.section-role.active .role-hint {
    animation: hintAppear 0.6s ease forwards 4.5s, hintBlink 2s ease-in-out infinite 5.1s;
}

@keyframes hintAppear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 0.6;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes hintBlink {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}

/* 아이콘 클릭 시 힌트 숨김 */
.role-hint.hidden {
    opacity: 0 !important;
}
