/*
 * 삼양식품 확장 — 움직임 (samyang.enabled 일 때만 실린다)
 *
 * 원칙: 업무 화면이므로 움직임은 피드백·상태 변화·연속성을 설명할 때만 쓴다.
 *   - 핵심 순간 하나: 「날인·시점인증·무결성 확인」 — 결재 서명, 직인 날인, 연구노트 시점인증, 무결성 확인이 끝나는 순간(SY.motion.seal).
 *   - 연속성: 화면 이동(View Transitions, 사이드바·머리글은 제자리), 모달, 목록 변화(FLIP).
 *   - 피드백: 누름, 호버(그림자만 — 호버된 요소는 움직이지 않는다), 드래그 업로드, 복사.
 *   - 기본 상태는 늘 보이는 상태다. 스크립트가 실패해도 화면이 숨지 않는다.
 *   - prefers-reduced-motion: 공간 이동을 빼고 색·투명도 변화만 남긴다.
 */
:root {
    --sy-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --sy-ease-in: cubic-bezier(0.5, 0, 0.75, 0);
    --sy-dur-fast: 120ms;
    --sy-dur: 220ms;
    --sy-dur-slow: 360ms;
}

/* ── 화면 이동: 사이드바·머리글은 그대로, 본문만 이어서 바뀐다 ─────────────── */
@view-transition {
    navigation: auto;
}
/* 이름을 준 요소는 독립 쌓임 맥락이 된다 — 본문(.content-wrapper)에 주면 그 안의 모달이 배경막 아래로 깔린다.
   그래서 이미 쌓임 맥락인 사이드바(fixed)·머리글(sticky z-index)만 이름을 주고, 나머지(root = 본문)를 움직인다. */
html body .sidenav2 { view-transition-name: sy-sidenav; }
html body .content_div > .sticky-top { view-transition-name: sy-header; }

::view-transition-old(root) {
    animation: 120ms var(--sy-ease-in) both sy-vt-out;
}
::view-transition-new(root) {
    animation: 280ms var(--sy-ease-out) 40ms both sy-vt-in;
}
@keyframes sy-vt-out {
    to { opacity: 0; transform: translateY(-4px); }
}
@keyframes sy-vt-in {
    from { opacity: 0; transform: translateY(10px); }
}

/* ── 누름 피드백 ─────────────────────────────────────────────────── */
html body :is(.button-sty001, [class*="button-blue"], [class*="button-gray"], [class*="button-white"],
              [class*="button-line"], .btn, .sy-press) {
    transition: transform var(--sy-dur-fast) var(--sy-ease-out), background-color var(--sy-dur) ease,
                color var(--sy-dur) ease, border-color var(--sy-dur) ease, box-shadow var(--sy-dur) ease;
}
html body :is(.button-sty001, [class*="button-blue"], [class*="button-gray"], [class*="button-white"],
              [class*="button-line"], .btn, .sy-press):not(:disabled):not(.disabled):active {
    transform: scale(0.97);
}

/* ── 카드 호버: 카드는 제자리, 그림자·테두리로만 반응한다 ───────────────────── */
html body .note-card-board .note-card .note-card-cont,
html body .project-card-board .project-card .project-card-cont,
html body .sy-card.is-interactive {
    transition: box-shadow var(--sy-dur) var(--sy-ease-out), border-color var(--sy-dur) ease;
}
html body .note-card-board .note-card .note-card-cont:hover,
html body .project-card-board .project-card .project-card-cont:hover,
html body .sy-card.is-interactive:hover {
    border-color: var(--sy-tint-border, #c9daf8);
    box-shadow: 0 14px 28px -18px rgba(38, 38, 38, 0.35), 0 2px 6px rgba(38, 38, 38, 0.06);
}
html body .note-card-board .note-card .note-card-cont:active,
html body .project-card-board .project-card .project-card-cont:active {
    box-shadow: 0 4px 10px -6px rgba(38, 38, 38, 0.3);
}

/* ── 사이드바 메뉴 ───────────────────────────────────────────────── */
html body .nav-menu a.menuCd {
    transition: background-color var(--sy-dur) ease, box-shadow var(--sy-dur) ease, opacity var(--sy-dur) ease;
}

/* ── 모달: 아래에서 살짝 올라오며 또렷해진다. 닫힐 때는 더 빠르게 ───────────── */
html body .modal.fade .modal-dialog {
    transform: none;
    transition: none;
}
html body .modal.fade .modal-content {
    opacity: 0;
    transform: translateY(12px) scale(0.975);
    transition: opacity 140ms ease-in, transform 160ms var(--sy-ease-in);
}
html body .modal.show .modal-content {
    opacity: 1;
    transform: none;
    transition: opacity 200ms ease-out, transform var(--sy-spring-dur, 420ms) var(--sy-spring, var(--sy-ease-out));
}
html body .modal-backdrop.fade { transition: opacity 200ms ease; }

/* 드롭다운 */
html body .dropdown-menu.show {
    animation: sy-pop 180ms var(--sy-ease-out);
    transform-origin: top left;
}
@keyframes sy-pop {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
}

/* 탭 패널 전환 */
html body .tab-pane.fade { transition: opacity 180ms ease; }

/* ── 드래그 업로드 영역 ─────────────────────────────────────────── */
.sy-dropzone {
    position: relative;
    border: 1.5px dashed #d8d1ca;
    border-radius: 12px;
    background: #fcfaf8;
    transition: border-color var(--sy-dur) ease, background-color var(--sy-dur) ease, box-shadow var(--sy-dur) ease;
}
.sy-dropzone:hover { border-color: var(--sy-accent-soft, #7ea8f1); }
.sy-dropzone.is-dragover {
    border-color: var(--sy-accent, #1761de);
    background: var(--sy-tint, #edf3fd);
    box-shadow: inset 0 0 0 4px rgba(240, 90, 0, 0.1);
}
.sy-dropzone .sy-dropzone-icon { transition: transform var(--sy-dur-slow) var(--sy-ease-out); }
.sy-dropzone.is-dragover .sy-dropzone-icon { transform: translateY(-2px); }

/* ── 날인 순간의 잉크 번짐 (SY.motion.seal 이 만든다) ─────────────────────── */
.sy-ink-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 140%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid var(--sy-brand, #ff6600);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
}

/* 해시 글자가 풀리는 동안 자리 폭이 흔들리지 않게 */
[data-sy-hash] { font-variant-numeric: tabular-nums; }

/* 숫자가 올라가는 동안 폭 고정 */
[data-sy-count] { font-variant-numeric: tabular-nums; }

/* ── 복사 확인 말풍선 ───────────────────────────────────────────── */
.sy-copied {
    position: absolute;
    z-index: 2000;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--sy-ink, #212529);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
}

/* ── 불러오는 중 자리 표시 ───────────────────────────────────────── */
.sy-skeleton {
    border-radius: 8px;
    background: linear-gradient(90deg, #f1eeeb 0%, #f8f6f4 40%, #f1eeeb 80%);
    background-size: 220% 100%;
    animation: sy-shimmer 1.2s linear infinite;
}
@keyframes sy-shimmer {
    from { background-position: 120% 0; }
    to { background-position: -100% 0; }
}

/* ── 사이드바 팀·노트 목록, 표 행: 가리키면 바로 반응 ─────────────────────── */
html body .nav-project-list a,
html body .nav-note-list a {
    transition: background-color var(--sy-dur) ease, opacity var(--sy-dur) ease;
}
html body .table-sty01 tbody tr {
    transition: background-color 160ms ease;
}
html body .table-sty01 tbody tr:hover > * {
    background-color: var(--sy-tint, #f4f8fe);
}

/* ── 알림 토스트: 오른쪽 아래에서 스프링으로 들어온다 ──────────────────────── */
html body .toast.Toast-bottom-web.show,
html body .toasts-bottom-right .toast.show {
    animation: sy-toast-in var(--sy-spring-dur, 420ms) var(--sy-spring, var(--sy-ease-out)) both;
}
@keyframes sy-toast-in {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
}

/* ── 움직임 줄이기 ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation: none !important;
    }
    html body .modal.fade .modal-content,
    html body .modal.show .modal-content {
        transform: none;
        transition: opacity 150ms ease;
    }
    html body .dropdown-menu.show { animation: none; }
    html body .toast.Toast-bottom-web.show,
    html body .toasts-bottom-right .toast.show { animation: sy-fade-in 160ms ease both; }
    html body :is(.button-sty001, [class*="button-blue"], [class*="button-gray"], [class*="button-white"],
                  [class*="button-line"], .btn, .sy-press):not(:disabled):active {
        transform: none;
    }
    .sy-dropzone.is-dragover .sy-dropzone-icon { transform: none; }
    .sy-skeleton { animation: none; }
}

@keyframes sy-fade-in {
    from { opacity: 0; }
}
