/* 서재 화면 껍데기: 상단바의 새 번역·진행 표시, 왼쪽 정렬 머리말, 번역 칸을 담는 새 번역 시트. */

/* 상단바 */
.nav-links .nav-new {
    height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: var(--bg);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.nav-links .nav-new:hover {
    background: color-mix(in srgb, var(--ink), #fff 12%);
}

.nav-links .nav-progress {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--accent-tint);
    color: var(--accent-text);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
}

.nav-links .nav-progress[hidden],
.translate-sheet[hidden] {
    display: none !important;
}

.nav-links .nav-progress b {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.nav-links .nav-new:focus-visible,
.nav-links .nav-progress:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* 서재 머리말: 가운데 정렬 대신 목록과 같은 왼쪽 정렬 */
.main-content .translate-header {
    max-width: none;
    margin: 0 0 1.25rem;
    padding: 0;
    text-align: left;
}

.main-content .translate-header p {
    max-width: 62ch;
    font-size: 15px;
}

/* 새 번역 시트 */
body.sheet-open {
    overflow: hidden;
}

.translate-sheet {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: color-mix(in srgb, var(--ink) 35%, transparent);
}

.translate-sheet-panel {
    width: min(1080px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 18px 24px 24px;
    border-radius: 16px;
    background: var(--bg);
    box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.45);
}

.translate-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.translate-sheet-head h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
}

.translate-sheet-close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.translate-sheet-close:hover {
    background: var(--pill);
}

.translate-sheet-close svg {
    width: 16px;
    height: 16px;
}

.translate-sheet .translate-container {
    margin: 0;
}

/* 시트 안 미리보기는 화면 높이에 맞춰 줄인다 */
.translate-sheet .pdf-preview-container {
    aspect-ratio: auto;
    height: min(62vh, 620px);
}

.library-empty .library-btn {
    margin-top: 6px;
}

/* 휴대폰: 시트를 화면 전체로 */
@media (max-width: 760px) {
    .translate-sheet {
        padding: 0;
        align-items: stretch;
    }

    .translate-sheet-panel {
        max-height: none;
        height: 100%;
        border-radius: 0;
        padding: 14px 16px 24px;
        padding-top: calc(14px + env(safe-area-inset-top, 0px));
    }

    .translate-sheet .pdf-preview-section {
        display: none;
    }

    .translate-sheet .pdf-upload-section {
        flex: 1 1 100%;
        width: 100%;
    }

    /* 휴대폰 상단바: 한 줄로, 이메일 글자는 빼고 동그란 표시만 */
    .nav-links {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .nav-links .user-info {
        margin: 0;
        max-width: none;
    }

    .nav-links .user-info #userEmail {
        display: none;
    }

    .nav-links .nav-new,
    .nav-links .nav-progress {
        height: 32px;
        padding: 0 12px;
        font-size: 13px;
    }

    /* 좁은 폭에서는 '+ 올리기'로 줄여 로고와 겹치지 않게 하고, 로그아웃은 한 줄로 둔다. */
    .nav-links .nav-new-word {
        display: none;
    }

    .nav-links .nav-button {
        white-space: nowrap;
    }
}

/* 통통 튀는 스프링 곡선(motion.js의 springCurve(420, 15)와 같은 모양). linear()를 모르는 브라우저는 비슷한 곡선으로. */
:root {
    --spring-pop: cubic-bezier(.34, 1.56, .64, 1);
}

@supports (animation-timing-function: linear(0, 1)) {
    :root {
        --spring-pop: linear(0, 0.0645, 0.2287, 0.4483, 0.6828, 0.8998, 1.0767, 1.2014, 1.2712, 1.2906, 1.2696, 1.2204, 1.1559, 1.0878, 1.0253, 0.9748, 0.9396, 0.9204, 0.9156, 0.9224, 0.9371, 0.956, 0.9758, 0.9937, 1.0081, 1.0181, 1.0234, 1.0245, 1.0223, 1.018, 1.0124, 1.0067, 1.0015, 0.9974, 0.9946, 0.9932, 0.9929, 0.9936, 0.9949, 0.9965, 1);
    }
}

/* 모서리 알림: 띄어쓰기 없는 긴 파일 이름도 알림 안에서 줄을 바꾼다 */
.toast-title,
.toast-body {
    overflow-wrap: anywhere;
}

/* 번역 완료 알림: 가운데 팝업 대신 서재를 가리지 않는 아래쪽 알림 */
.download-banner {
    inset: auto 0 24px;
    z-index: 1900;
    padding: 0 16px;
    background: none;
    pointer-events: none;
}

.download-banner.show {
    animation: none;
}

.download-banner .banner-content {
    width: min(640px, 100%);
    max-height: none;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px 12px 12px 16px;
    border-radius: 14px;
    background: var(--ink);
    color: var(--bg);
    box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.download-banner.show .banner-content {
    animation: bannerSpring 0.75s var(--spring-pop) both;
}

.banner-check {
    position: relative;
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ok);
}

.banner-check::after {
    content: "";
    position: absolute;
    left: 9px;
    top: 8px;
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}

.download-banner.show .banner-check {
    animation: bannerCheck 0.6s var(--spring-pop) 0.15s both;
}

.banner-text {
    flex: 1;
    min-width: 0;
}

.banner-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.banner-body,
.download-banner .download-status {
    margin: 2px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: color-mix(in srgb, var(--bg) 72%, transparent);
}

.download-banner .download-status:empty {
    display: none;
}

.download-banner .download-status.error {
    color: #f3b79a;
}

.banner-actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
}

.banner-btn {
    height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg) 16%, transparent);
    color: var(--bg);
    font: inherit;
    font-size: 13.5px;
    white-space: nowrap;
    cursor: pointer;
}

.banner-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--bg) 24%, transparent);
}

.banner-btn.primary {
    background: var(--bg);
    color: var(--ink);
}

.banner-btn.primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--bg), var(--ink) 8%);
}

.banner-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.banner-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: color-mix(in srgb, var(--bg) 70%, transparent);
    cursor: pointer;
}

.banner-close:hover {
    background: color-mix(in srgb, var(--bg) 14%, transparent);
    color: var(--bg);
}

.banner-close svg {
    width: 14px;
    height: 14px;
}

.banner-btn:focus-visible,
.banner-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@keyframes bannerSpring {
    from { opacity: 0; transform: translateY(160%) scale(0.85); }
    to { opacity: 1; transform: none; }
}

@keyframes bannerCheck {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

@media (max-width: 600px) {
    .download-banner {
        bottom: 16px;
        padding: 0 12px;
    }

    .download-banner .banner-content {
        flex-wrap: wrap;
    }

    .banner-text {
        flex-basis: calc(100% - 42px);
    }

    .banner-actions {
        width: 100%;
    }

    .banner-actions .banner-btn {
        flex: 1;
    }
}

/* 움직임 무대: 시트에서 떼어 낸 종이, 착지 물결, 색종이(motion.js) */
.motion-layer {
    position: fixed;
    inset: 0;
    z-index: 2600;
    overflow: hidden;
    pointer-events: none;
}

.motion-paper {
    position: absolute;
    overflow: hidden;
    border-radius: 3px;
    background: #fff;
    box-shadow: 0 14px 28px -10px rgba(0, 0, 0, 0.4);
    will-change: transform;
}

.motion-paper canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.motion-paper.is-blank {
    padding: 22px 16px;
    background: repeating-linear-gradient(to bottom, transparent 0 12px, #e4e2da 12px 15px) content-box, #fff;
}

.motion-ripple {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 2px solid var(--accent);
    border-radius: 50%;
}

.motion-bit {
    position: absolute;
}

@media (prefers-reduced-motion: reduce) {
    .download-banner.show .banner-content,
    .download-banner.show .banner-check {
        animation: none;
    }
}
