/**
 * fontsize.css - 모바일 글씨 크기 조절 (CSS Zoom 방식)
 * 모바일 전용 (@media max-width: 768px)
 * .page-content 래퍼에 zoom 적용, fixed 요소는 밖에 배치
 */

/* ===== CSS Zoom 스케일링 ===== */
@media (max-width: 768px) {
    html[data-scale="large"] .page-content {
        zoom: 1.25;
        -moz-transform: scale(1.25);
        -moz-transform-origin: top center;
        line-height: 1.4;
    }
    html[data-scale="xlarge"] .page-content {
        zoom: 1.5;
        -moz-transform: scale(1.5);
        -moz-transform-origin: top center;
        line-height: 1.35;
    }

    /* Firefox fallback: moz-transform 사용 시 width 보정 */
    @-moz-document url-prefix() {
        html[data-scale="large"] .page-content {
            width: 80%;
        }
        html[data-scale="xlarge"] .page-content {
            width: 66.67%;
        }
    }

    /* 가로 스크롤 방지 */
    html[data-scale="large"] .page-content,
    html[data-scale="xlarge"] .page-content {
        overflow-x: hidden;
        word-break: break-word;
    }

    /* 입력 필드 최소 16px (Safari 자동줌 방지) */
    html[data-scale] input,
    html[data-scale] textarea,
    html[data-scale] select {
        font-size: 16px !important;
    }
}

/* ===== 글씨 크기 조절 플로팅 UI ===== */
.fontsize-fab {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: none;
}
.fontsize-panel {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 20px;
    padding: 6px;
    margin-bottom: 10px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.fontsize-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}
.fontsize-panel__btn {
    width: 48px; height: 48px;
    border: none; background: transparent; color: #fff;
    font-size: 22px; font-weight: 700; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; -webkit-tap-highlight-color: transparent;
}
.fontsize-panel__btn:active { background: rgba(255, 255, 255, 0.15); }
.fontsize-panel__btn:disabled { opacity: 0.3; cursor: default; }
.fontsize-panel__dots {
    display: flex; align-items: center; gap: 8px; padding: 0 12px;
}
.fontsize-panel__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.25); transition: all 0.2s;
}
.fontsize-panel__dot.active {
    background: #3B82F6; width: 12px; height: 12px;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
}
.fontsize-trigger {
    pointer-events: auto;
    display: flex; align-items: center; gap: 8px;
    padding: 12px 14px 12px 22px;
    background: rgba(15, 23, 42, 0.92); color: #fff; border: none;
    border-radius: 999px; font-size: 15px; font-weight: 600;
    font-family: 'Pretendard', -apple-system, sans-serif; cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.2s; -webkit-tap-highlight-color: transparent;
}
.fontsize-trigger:active { transform: scale(0.95); }
.fontsize-trigger.hidden {
    opacity: 0; transform: scale(0.8); visibility: hidden; pointer-events: none;
}
.fontsize-trigger__close {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.5);
    font-size: 14px; line-height: 1;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.fontsize-trigger__close:active { background: rgba(239,68,68,0.5); color: #fff; }
.fontsize-panel__hide:active { background: rgba(239,68,68,0.3); }
.fontsize-restore {
    position: fixed; bottom: 0; left: 16px;
    z-index: 9990; width: 60px; height: 20px;
    background: rgba(15, 23, 42, 0.5); border-radius: 10px 10px 0 0;
    cursor: pointer; display: none; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.fontsize-restore::after {
    content: ''; width: 24px; height: 3px;
    background: rgba(255, 255, 255, 0.4); border-radius: 2px;
}
.fontsize-restore.visible { display: flex; }

/* 데스크톱에서는 플로팅 버튼 숨김 */
@media (min-width: 769px) {
    .fontsize-fab,
    .fontsize-restore { display: none !important; }
}
