/* 사이트 공통 보강. 디자인 시스템(tokens.css, bundle.css)에 없는 것을 여기에만 둔다.
   카드 그림자와 hover 확대는 디자인 시스템의 규칙("hover 없음, 카드에 그림자 없음")과 다르게, 이 사이트에서만 더한 것이다. */

/* 언어 전환: 루트의 data-lang과 맞지 않는 lang 조각을 숨긴다 */
[data-lang="ko"] [lang="en"], [data-lang="en"] [lang="ko"] { display: none !important; }

/* GlobalNav: 로고와 글자를 시스템 값보다 키웠다. 좁은 화면에서는 로고와 언어 버튼이 화면 폭에 맞춰 줄어든다 */
.site-logo { display: block; height: min(56px, 11vw); width: auto; }
.lab-gnav .button-utility { font-size: min(23px, 4vw); }
.lab-gnav-icon svg { width: 24px; height: 24px; }

/* 같은 줄의 카드 높이를 맞춘다 */
.lab-grid.eq { align-items: stretch; }
.cell { display: flex; min-width: 0; }
.cell > * { flex: 1; min-width: 0; }
.clamp2, .clamp3, .clamp4 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp2 { -webkit-line-clamp: 2; }
.clamp3 { -webkit-line-clamp: 3; }
.clamp4 { -webkit-line-clamp: 4; }
dialog.xcard:modal :is(.clamp2, .clamp3, .clamp4) { display: block; }   /* 카드를 열면 줄임 없이 다 보인다 */

/* 떠 있는 카드: 옅은 그림자, 올리면 살짝 커진다 */
.lift { border-color: transparent; box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.08); transition: transform 0.3s cubic-bezier(0, 0, 0.5, 1), box-shadow 0.3s cubic-bezier(0, 0, 0.5, 1); }
.lift:hover { transform: scale(1.02); box-shadow: 2px 4px 16px rgba(0, 0, 0, 0.16); }
@media (prefers-reduced-motion: reduce) {
  .lift { transition: none; }
  .lift:hover { transform: none; }
}

/* 눌러서 펼치는 카드. 닫혀 있을 때는 그리드 안의 카드, 열리면 같은 요소가 화면 가운데 시트가 된다(<dialog>의 showModal). */
dialog.xcard { position: relative; inset: auto; display: flex; flex-direction: column; width: auto; height: auto; max-width: none; max-height: none; margin: 0; }
dialog.xcard[data-surface="ink"] { background: var(--ink); color: var(--body-on-dark); border: 0; }
[data-surface="ink"] .lab-muted { color: var(--body-muted); }
[data-surface="ink"] .lab-link { color: var(--primary-on-dark); }
dialog.xcard:modal { position: fixed; inset: 0; width: min(980px, calc(100vw - 32px)); height: fit-content; max-height: min(calc(100vh - 32px), 1100px); margin: auto; padding: var(--space-xxl); overflow: auto; transform: none; box-shadow: none; }
dialog.xcard::backdrop { background: rgba(0, 0, 0, 0.48); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
dialog.xcard:not(:modal) .when-open, dialog.xcard:modal .when-closed { display: none !important; }
.stretch { all: unset; cursor: pointer; }
dialog.xcard:not(:modal) .stretch::after { content: ""; position: absolute; inset: 0; border-radius: var(--rounded-lg); }
.stretch:focus-visible { outline: none; }
dialog.xcard:has(.stretch:focus-visible) { outline: var(--focus-width) solid var(--primary-focus); outline-offset: 2px; }
.above { position: relative; z-index: 1; }
.xclose { position: sticky; top: 0; z-index: 2; flex: none; align-self: flex-end; margin-bottom: calc(-1 * var(--touch-min)); }
.xplus { position: absolute; top: var(--space-md); right: var(--space-md); display: grid; place-items: center; width: 32px; height: 32px; background: var(--surface-chip-translucent); color: var(--ink); border-radius: var(--rounded-full); }
.xplus svg { width: 14px; height: 14px; }
@media (max-width: 640px) { dialog.xcard:modal { padding: var(--space-lg); } }

/* 연구 분야 카드의 그림: 닫혀 있을 때는 카드 아래를 가득 채우고, 열리면 가운데에 놓인다 */
.ximg { display: block; width: calc(100% + 2 * var(--space-lg)); max-width: none; margin: auto calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg)); border-radius: 0 0 var(--rounded-lg) var(--rounded-lg); }
dialog.xcard:modal .ximg { width: min(100%, 560px); margin: var(--space-lg) auto 0; border-radius: var(--rounded-sm); }
.xvideo { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--rounded-sm); background: var(--surface-black); }
.xvideo > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* 사진 넘기기: 옆으로 미는 띠와 이전·다음 버튼 */
.carousel { position: relative; }
.strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--canvas-parchment); border-radius: var(--rounded-sm); }
.strip::-webkit-scrollbar { display: none; }
.strip > img, .strip > video { flex: none; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; scroll-snap-align: start; }
dialog.xcard:modal .strip > img, dialog.xcard:modal .strip > video { aspect-ratio: 3 / 2; object-fit: contain; }
.carousel .nav { position: absolute; top: calc(50% - 16px); z-index: 1; width: 32px; height: 32px; opacity: 0; transition: opacity 0.2s ease, transform 0.1s ease; }
.carousel .nav::before { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 0 1.5px 1.5px; }
.carousel .nav.prev::before { transform: translateX(2px) rotate(45deg); }
.carousel .nav.next::before { transform: translateX(-2px) rotate(-135deg); }
.xclose:empty::before, .xclose:empty::after { content: ""; position: absolute; width: 14px; height: 1.5px; background: currentColor; }
.xclose:empty::before { transform: rotate(45deg); }
.xclose:empty::after { transform: rotate(-45deg); }
.carousel .nav.prev { left: var(--space-xs); }
.carousel .nav.next { right: var(--space-xs); }
.carousel:hover .nav, .carousel .nav:focus-visible { opacity: 1; }
.carousel.single .nav { display: none; }
dialog.xcard:modal .carousel .nav { top: calc(50% - 22px); width: var(--touch-min); height: var(--touch-min); opacity: 1; }
@media (hover: none) { dialog.xcard:not(:modal) .carousel .nav { display: none; } }

/* 과제 카드의 기관 로고 자리 */
.plogo { height: 88px; background: center / contain no-repeat; }

/* 카드 겹침과 높이 보정 */
dialog.xcard { isolation: isolate; }
#members .lab-card { box-sizing: border-box; min-height: 338px; }   /* 내용이 가장 많은 카드의 높이. 글자 크기를 바꾸면 이 값도 다시 맞춘다 */
#members .lab-card a { overflow-wrap: anywhere; }       /* 긴 이메일 주소가 좁은 화면에서 카드 밖으로 나가지 않게 */
.lab-footer-legal p { line-height: 1.4; }

/* ── 캔버스 디자인을 실제 사이트로 옮기며 더한 것 ── */
html { scrollbar-gutter: stable; }
html:has(dialog:modal) { overflow: hidden; }            /* 시트가 열려 있는 동안 뒤 화면이 스크롤되지 않게 */
[hidden] { display: none !important; }
site-header, site-footer { display: block; }
[data-lang="ko"] .only-en, [data-lang="en"] .only-ko { display: none; }
.site-menu { display: flex; flex-direction: column; padding: 0 24px 16px; }
.site-menu a { padding: 9px 0; color: inherit; text-decoration: none; }
@media (min-width: 1200px) { .site-menu { display: none; } }   /* bundle.css 에서 GlobalNav 가 접히는 폭(1199px)과 맞춘 값 */

/* 좁은 화면의 글자 크기. 시스템은 Tile 안의 제목만 줄이므로, 나머지가 제목보다 커지지 않게 여기서 맞춘다. */
@media (max-width: 640px) {
  .display-lg { font-size: 28px; }
  .display-md { font-size: 24px; line-height: 1.25; }
  .lead { font-size: 21px; line-height: 1.24; }
  .lead-airy { font-size: 19px; }
}
