/**
 * DODN Footnotes - 스타일시트
 */

/* ===================================
   인라인 각주 마커
   =================================== */
.fn-marker {
    position: relative;
    display: inline;
    margin: 0 1px;
    font-size: inherit;
    line-height: 0;
    vertical-align: baseline;
    white-space: nowrap;
    top: 0.3em;
}

.fn-link {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: #FF6B6B;
    color: #FFF !important;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
    text-decoration: none !important;
    vertical-align: super;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(255, 107, 107, 0.3);
}

.fn-link:hover {
    background: #FF5252;
    transform: scale(1.1);
    color: #FFF !important;
}

/* ===================================
   툴팁
   =================================== */
.fn-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    /* 내용에 따라 커지되 */
    max-width: 393px;
    /* 최대 너비 제한 */
    padding: 14px;
    background: #FFF;
    color: #333;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.6;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #EEE;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 9999;
    pointer-events: none;
    white-space: normal;
    /* 텍스트 줄바꿈 허용 */
}

.fn-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #FFF;
}

.fn-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 1px;
    border: 8px solid transparent;
    border-top-color: #EEE;
    z-index: -1;
}

.fn-marker:hover .fn-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 15px);
}

/* 툴팁이 왼쪽 끝에 있을 때 */
.fn-tooltip.align-left {
    left: 0;
    transform: translateX(0);
}

.fn-tooltip.align-left::before,
.fn-tooltip.align-left::after {
    left: 15px;
}

/* 툴팁이 오른쪽 끝에 있을 때 */
.fn-tooltip.align-right {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.fn-tooltip.align-right::before,
.fn-tooltip.align-right::after {
    left: auto;
    right: 15px;
}

/* ===================================
   하단 각주 목록
   =================================== */
.fn-list-wrapper {
    margin-top: 60px;
    padding-top: 30px;
}

.fn-list-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fn-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: footnote-counter;
    padding-left: 0 !important;
}

.fn-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.fn-item:last-child {
    margin-bottom: 0;
}

.fn-number {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #D9D9D9;
    color: #323232;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

.fn-text {
    flex: 1;
    color: #323232 !important;
    font-family: "Noto Serif KR", serif;
    font-size: 13px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
}

.fn-back {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #999;
    text-decoration: none !important;
    border-radius: 4px;
    transition: all 0.2s;
}

.fn-back:hover {
    background: #F5F5F5;
    color: #666;
}

/* ===================================
   스크롤 하이라이트
   =================================== */
.fn-item:target {
    background: #FFF9E6;
    margin: 0 -16px;
    padding: 12px 16px;
    border-radius: 8px;
    animation: fnHighlight 2s ease;
}

@keyframes fnHighlight {

    0%,
    30% {
        background: #FFE4B5;
    }

    100% {
        background: #FFF9E6;
    }
}

.fn-marker:target .fn-link {
    animation: fnPulse 1s ease;
}

@keyframes fnPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* ===================================
   반응형
   =================================== */
@media (max-width: 768px) {
    .fn-tooltip {
        max-width: 250px;
        font-size: 12px;
        padding: 10px 12px;
    }

    .fn-list-wrapper {
        margin-top: 40px;
        padding-top: 20px;
    }

    .fn-item {
        font-size: 13px;
    }
}

/* ===================================
   다크 모드
   =================================== */
@media (prefers-color-scheme: dark) {
    .fn-tooltip {
        background: #2D2D2D;
        color: #E0E0E0;
        border-color: #444;
    }

    .fn-tooltip::before {
        border-top-color: #2D2D2D;
    }

    .fn-tooltip::after {
        border-top-color: #444;
    }

    .fn-list-title {
        color: #AAA;
    }

    .fn-text {
        color: #CCC;
    }

    .fn-number {
        background: #555;
        color: #EEE;
    }

    .fn-item:target {
        background: #f3f3f3;
    }

    .fn-back:hover {
        background: #333;
        color: #FFF;
    }
}

/* ===================================
   인쇄 스타일
   =================================== */
@media print {
    .fn-tooltip {
        display: none !important;
    }

    .fn-link {
        color: #333 !important;
        background: none !important;
        box-shadow: none !important;
    }

    .fn-back {
        display: none;
    }
}