/* ==========================================================================
   인터랙션 — 움직임 토큰 · 누름 · hover · 드롭다운 · 첫 화면 등장 · 스크롤 등장
   · 시안 css(style.css · 페이지 css) 다음에 읽는다. 모양(크기·색·간격)은 바꾸지 않고 움직임만 더한다.
   · 등장은 "보이는 상태가 기본"이다. 스크롤 등장은 js/main.js 가 화면 아래쪽 요소에만 .reveal 을 붙이고,
     JS 가 없거나 실패하면 처음부터 다 보인다. 첫 화면 등장은 CSS 애니메이션이라 끝나면 항상 보인다.
   · 움직임 줄이기(prefers-reduced-motion)와 디자인 모드(html.hk-design)에서는 등장 효과를 쓰지 않는다.
   ========================================================================== */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);      /* 등장 · 퇴장 · 누름 */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);  /* 화면 안에서 이동 · 변형 */
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);   /* 휴대폰 메뉴 */
  --t-press: .16s;
  --t-fast: .2s;
  --t-base: .25s;
  --t-panel: .4s;
  --t-reveal: .7s;
}

/* ---------- 브라우저 기본 표면 ---------- */
::selection { background: rgba(170, 3, 12, .14); color: var(--ink); }
input, textarea { caret-color: var(--brand); }

/* ---------- 머리글: 내려가면 옅은 그림자(지금 화면 위에 떠 있다는 표시) ---------- */
.site-header { transition: box-shadow var(--t-fast) ease; }
.site-header.is-scrolled { box-shadow: inset 0 -1px 0 var(--line), 0 6px 20px rgba(20, 24, 31, .06); }

/* ---------- 버튼: 누르면 살짝 눌린다 ---------- */
:is(.btn, .btn-header, .mobile-nav-cta, .contact-submit, .insight-btn-list, .notfound-btn, .notice-view-file-btn,
    .notice-paging-list a, .insights-page, .menu-toggle, .contact-agree-btn) {
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-fast) ease, color var(--t-fast) ease,
              border-color var(--t-fast) ease, filter var(--t-fast) ease;
}
:is(.btn, .btn-header, .mobile-nav-cta, .contact-submit, .insight-btn-list, .notfound-btn, .notice-view-file-btn,
    .notice-paging-list a, .insights-page, .menu-toggle):active { transform: scale(.97); }
.contact-agree:active .contact-agree-btn { transform: scale(.97); }

/* 처리 중(문의 보내는 동안) — 글자는 그대로, 화살표 자리에 도는 표시 · 폭은 그대로 */
.contact-submit.is-loading { cursor: progress; }
.contact-submit.is-loading img { opacity: 0; }
.contact-submit.is-loading::after {
  content: ""; position: absolute; right: 36px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%;
  animation: rv-spin .7s linear infinite;
}
.contact-submit { position: relative; }
.contact-submit:disabled { cursor: not-allowed; }
@keyframes rv-spin { to { transform: rotate(360deg); } }

/* ---------- 카드 · 목록: 사진 확대 + 제목 색 + 화살표 이동(카드가 떠오르지는 않는다) ---------- */
:is(.ins-card .ins-title, .insights-post-title, .insight-related-name, .svc-en, .notice-title, .ns-title, .insight-nav-title) {
  transition: color var(--t-fast) ease;
}
.notice-link { transition: background-color var(--t-fast) ease; }
@media (hover: hover) and (pointer: fine) {
  .ins-card:hover .ins-title { color: var(--brand); }
  .insights-post:not(.is-featured) a:hover .insights-post-title { color: var(--brand); }
  .insight-related-card a:hover .insight-related-name { color: var(--brand); }
  .svc-row a:hover .svc-en { color: var(--brand); }
  .notice-row:not(.is-pinned) .notice-link:hover { background-color: #f7f8fa; }
  .notice-link:hover .notice-title, .ns-item:hover .ns-title, a.insight-nav-row:hover .insight-nav-title { color: var(--brand); }
  .insights-cats-list a:hover .insights-cat-name { color: var(--brand); }
  .about-leader-card, .about-way-item, .service-task { transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease; }
}
/* 손가락 화면에서는 눌렀다 뗀 뒤 hover 모양이 남지 않게 움직임을 돌려놓는다 */
@media (hover: none) {
  .btn:hover img, .link-all:hover img, .ins-card:hover .ins-foot img, .ins-featured:hover .thumb img, .contact-submit:hover img,
  .insights-post a:hover .insights-post-thumb img, .insights-post a:hover .insights-post-foot::after,
  .insight-related-card a:hover .insight-related-thumb img,
  .service-next-link:hover .service-next-arrow, .service-next-cta:hover .service-next-arrow { transform: none; }
}

/* ---------- 첫 화면 등장(처음 한 번 · 배너가 넘어갈 때마다) ---------- */
@keyframes rv-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes rv-settle { from { transform: scale(1.06); } to { transform: none; } }
.hero-slide.is-active .hero-content > *,
.sub-hero .inner > *,
.insight-pagetitle .inner > * { animation: rv-rise var(--t-reveal) var(--ease-out) both; }
.hero-slide.is-active .hero-content > :nth-child(2), .sub-hero .inner > :nth-child(2), .insight-pagetitle .inner > :nth-child(2) { animation-delay: 60ms; }
.hero-slide.is-active .hero-content > :nth-child(3), .sub-hero .inner > :nth-child(3), .insight-pagetitle .inner > :nth-child(3) { animation-delay: 120ms; }
.hero-slide.is-active .hero-content > :nth-child(n+4), .sub-hero .inner > :nth-child(n+4), .insight-pagetitle .inner > :nth-child(n+4) { animation-delay: 180ms; }
/* 배너 사진은 살짝 크게 시작해 제자리로(한 번만) */
.hero-slide.is-active .hero-bg img, .sub-hero-bg img { animation: rv-settle calc(var(--t-reveal) * 2) var(--ease-out) both; }

/* ---------- 스크롤 등장 — 구역 제목 · 카드 묶음 · 사진 ---------- */
html.rv .reveal {
  transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out);
  transition-delay: var(--rv-d, 0ms);
}
html.rv .reveal:not(.is-in) { opacity: 0; transform: translateY(24px); }
/* 사진: 가장자리에서 펼쳐지며 안의 사진은 제자리로 */
html.rv .reveal-img { transition: clip-path var(--t-reveal) var(--ease-out); transition-delay: var(--rv-d, 0ms); }
html.rv .reveal-img > img { transition: transform calc(var(--t-reveal) * 1.6) var(--ease-out), opacity var(--t-fast) ease; transition-delay: var(--rv-d, 0ms); }
html.rv .reveal-img:not(.is-in) { clip-path: inset(8% 8% 8% 8%); }
html.rv .reveal-img:not(.is-in) > img { transform: scale(1.1); }

/* ---------- 휴대폰: 메뉴 · 탭 펼침 ---------- */
@media (max-width: 1024px) {
  /* 메뉴 판: 열 때는 위에서 내려오고 항목이 차례로 · 닫을 때는 더 빨리 */
  .mobile-nav { transition: opacity var(--t-fast) ease, visibility 0s linear var(--t-fast); }
  .menu-open .mobile-nav { transition: opacity var(--t-base) ease; }
  .mobile-nav-panel { transform: translateY(-16px); transition: transform var(--t-fast) var(--ease-out); }
  .menu-open .mobile-nav-panel { transform: none; transition: transform var(--t-panel) var(--ease-drawer); }
  .mobile-nav-panel li, .mobile-nav-cta { opacity: 0; transform: translateY(8px); transition: opacity .15s ease, transform .15s var(--ease-out); }
  .menu-open .mobile-nav-panel li, .menu-open .mobile-nav-cta { opacity: 1; transform: none; transition: opacity var(--t-base) ease var(--rv-d, 0ms), transform var(--t-panel) var(--ease-out) var(--rv-d, 0ms); }
  .menu-open .mobile-nav-panel li:nth-child(2) { --rv-d: 30ms; }
  .menu-open .mobile-nav-panel li:nth-child(3) { --rv-d: 60ms; }
  .menu-open .mobile-nav-panel li:nth-child(n+4), .menu-open .mobile-nav-cta { --rv-d: 90ms; }
  .menu-toggle img, .menu-toggle .ico-close { animation: rv-pop var(--t-base) var(--ease-out); }

  /* 서브 탭 펼침 목록: 단추 아래에서 펼쳐진다(나란히 보이는 탭에는 쓰지 않는다) */
  .sub-tabs:has(> .inner > .sub-tabs-toggle) .sub-tabs-list {
    display: block; opacity: 0; visibility: hidden; transform: translateY(-6px); transform-origin: top center;
    transition: opacity var(--t-fast) ease, transform var(--t-fast) var(--ease-out), visibility 0s linear var(--t-fast);
  }
  .sub-tabs.is-open:has(> .inner > .sub-tabs-toggle) .sub-tabs-list {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity var(--t-base) ease, transform var(--t-base) var(--ease-out);
  }
  .sub-tabs-toggle img, .insights-cats-chev { transition: transform var(--t-base) var(--ease-out) !important; }

  /* 블로그 카테고리 펼침 목록 */
  .insights-cats .insights-cats-list {
    display: block; opacity: 0; visibility: hidden; transform: translateY(-6px); transform-origin: top center;
    transition: opacity var(--t-fast) ease, transform var(--t-fast) var(--ease-out), visibility 0s linear var(--t-fast);
  }
  .insights-cats.is-open .insights-cats-list {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity var(--t-base) ease, transform var(--t-base) var(--ease-out);
  }
}
@keyframes rv-pop { from { opacity: 0; transform: scale(.9) rotate(-45deg); } to { opacity: 1; transform: none; } }

/* ---------- 움직임 줄이기: 이동 · 확대 · 등장을 끄고 색 변화만 남긴다 ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-slide.is-active .hero-content > *, .sub-hero .inner > *, .insight-pagetitle .inner > *,
  .hero-slide.is-active .hero-bg img, .sub-hero-bg img, .menu-toggle img, .menu-toggle .ico-close { animation: none !important; }
  .contact-submit.is-loading::after { animation-duration: 1.6s !important; }
  :is(.btn, .btn-header, .mobile-nav-cta, .contact-submit, .insight-btn-list, .notfound-btn, .notice-view-file-btn, .notice-paging-list a, .insights-page, .menu-toggle):active { transform: none; }
}
