/* 연구실 소개 (공개, labhome.py). 로그인 안 한 사람이 처음 보는 화면이라 앱의 메뉴
   막대 없이 첫 줄(.lh-top)을 따로 그린다. 첫 줄은 스크롤해도 위에 붙어 있고, 칸 링크를
   누르면 그 칸으로 부드럽게 내려간다 (지금 칸 표시·맨 위로 단추는 labhome.js).
   본문 폭은 카드가 석 줄로 서는 960px, 논문 글줄은 그 안에서 따로 줄인다.
   색은 전부 style.css 의 토큰이라 다크도 같이 간다. */

:root {
  --lh-bar: 3.6rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* 첫 화면의 색 번짐·막대 배경이 화면 밖으로 나가도 옆 스크롤이 생기지 않게 (body 의 overflow 는 화면으로 넘어가서 sticky 를 안 깬다) */
body:has(.page.lh) {
  overflow-x: hidden;
}

.page.lh {
  max-width: 960px;
  padding-top: 0;
}

/* ---------------------------------------------------------------- 첫 줄 (붙어 있음) */

.lh-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  min-height: var(--lh-bar);
  padding: 0.55rem 0;
}

/* 막대 배경은 화면 끝까지 넓힌다 (본문 폭 밖으로).  */
.lh-top::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 calc(50% - 50vw);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.lh-scrolled .lh-top::before {
  border-bottom-color: var(--border);
}

.lh-brand {
  color: var(--text-strong);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.lh-brand:hover {
  text-decoration: none;
}

.lh-nav {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.15rem 0.25rem;
  font-size: var(--fs-base);
}

.lh-nav a {
  position: relative;
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  transition: color 0.15s, background-color 0.15s;
}

.lh-nav a:hover {
  color: var(--text);
  background: var(--chip-bg);
  text-decoration: none;
}

.lh-nav a[aria-current] {
  color: var(--accent);
  background: var(--highlight);
  font-weight: 600;
}

.lh-door {
  font-size: var(--fs-md);
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.lh-door:hover {
  border-color: var(--accent);
  text-decoration: none;
}

/* ---------------------------------------------------------------- 첫 화면 */

.lh-hero {
  position: relative;
  isolation: isolate;
  padding: clamp(3rem, 9vw, 5.5rem) 0 clamp(2rem, 5vw, 3rem);
  scroll-margin-top: var(--lh-bar);
}

/* 뒤에 깔린 흐린 색 번짐. 글 뒤로 가고 클릭을 막지 않는다. */
.lh-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -6rem -20vw 0;
  background:
    radial-gradient(38rem 20rem at 12% 30%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(30rem 18rem at 85% 10%, color-mix(in srgb, var(--mark) 10%, transparent), transparent 70%);
  pointer-events: none;
}

.lh-eyebrow {
  color: var(--text-muted);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}

.lh-hero h1 {
  color: var(--text-strong);
  font-size: clamp(1.35rem, 3.2vw, 1.9rem);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 1.25rem;
}

.lh-hero-name {
  display: block;
  font-size: clamp(3rem, 11vw, 5.25rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1;
  margin-bottom: 0.6rem;
  color: var(--text-strong);
}

.lh-intro {
  max-width: 40rem;
}

.lh-intro p {
  font-size: 1.08rem;
  margin: 0 0 0.5rem;
}

.lh-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  margin-top: 2rem;
}

.lh-stats div {
  display: flex;
  flex-direction: column;
}

.lh-stats b {
  color: var(--text-strong);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.lh-stats span {
  color: var(--text-muted);
  font-size: var(--fs-md);
}

/* ---------------------------------------------------------------- 칸 공통 */

.lh-section {
  margin-top: 4rem;
  scroll-margin-top: calc(var(--lh-bar) + 1rem);
}

.lh-section h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-strong);
  font-size: 1.5rem;
  margin: 0 0 1.25rem;
}

/* 제목 뒤로 이어지는 가는 줄 */
.lh-section h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.lh-section h3 {
  color: var(--text-muted);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 2rem 0 0.75rem;
}

/* ---------------------------------------------------------------- 연구 */

.lh-teams {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.lh-team {
  position: relative;
  overflow: hidden;
  padding: 1.4rem 1.3rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.lh-team::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
}

.lh-team::after {
  content: attr(data-n);
  position: absolute;
  top: 0.9rem;
  right: 1.1rem;
  color: var(--border);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
}

.lh-team:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.lh-section .lh-team h3 {
  color: var(--text-strong);
  font-size: 1.08rem;
  letter-spacing: 0;
  text-transform: none;
  margin: 0 2.5rem 0.9rem 0;
}

.lh-team ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.lh-team li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lh-topic-head {
  font-size: var(--fs-base);
  font-weight: 600;
}

.lh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.lh-chip {
  color: var(--chip-fg);
  background: var(--chip-bg);
  font-size: var(--fs-sm);
  padding: 0.12rem 0.55rem;
  border-radius: var(--radius-pill);
}

/* ---------------------------------------------------------------- 멤버 */

.lh-pi,
.lh-people li {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.lh-pi {
  align-items: center;
}

.lh-pi .lh-avatar {
  width: 3.4rem;
  height: 3.4rem;
  font-size: 1.15rem;
}

.lh-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.lh-people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.85rem;
}

.lh-avatar {
  --h: 220;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: light-dark(hsl(var(--h) 65% 38%), hsl(var(--h) 85% 75%));
  background: light-dark(hsl(var(--h) 80% 55% / 0.14), hsl(var(--h) 70% 60% / 0.18));
}

.lh-avatar[data-tone="1"] { --h: 262; }
.lh-avatar[data-tone="2"] { --h: 170; }
.lh-avatar[data-tone="3"] { --h: 28; }
.lh-avatar[data-tone="4"] { --h: 330; }
.lh-avatar[data-tone="5"] { --h: 195; }

.lh-person {
  color: var(--text-strong);
  font-weight: 600;
}

.lh-meta {
  color: var(--text-muted);
  font-size: var(--fs-md);
}

.lh-since::before {
  content: " · ";
}

.lh-interests {
  margin-top: 0.3rem;
  font-size: var(--fs-md);
}

.lh-alumni {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.lh-alumni li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.6rem;
  padding: 0.35rem 0 0.35rem 1rem;
}

.lh-now {
  color: var(--text);
  font-size: var(--fs-md);
}

/* ---------------------------------------------------------------- 논문 */

/* 넓은 화면은 해를 왼쪽 칸에 두고, 그 해 논문을 읽는 동안 따라 내려오게 한다 */
.lh-year-group {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0 1.5rem;
  max-width: 52rem;
}

.lh-year-group + .lh-year-group {
  margin-top: 1.5rem;
}

.lh-section .lh-year {
  position: sticky;
  top: calc(var(--lh-bar) + 1rem);
  align-self: start;
  color: var(--text-strong);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0.55rem 0 0;
  font-variant-numeric: tabular-nums;
}

.lh-pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lh-pubs li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  margin: 0 -0.9rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}

.lh-pubs li:hover {
  background: var(--surface);
}

.lh-pub-title {
  font-weight: 600;
  line-height: 1.4;
}

.lh-pub-title a {
  color: var(--text-strong);
}

.lh-pub-title a:hover {
  color: var(--accent);
}

.lh-authors {
  color: var(--text-muted);
  font-size: var(--fs-md);
}

.lh-authors strong {
  color: var(--text);
  font-weight: 600;
}

.lh-venue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
  font-size: var(--fs-sm);
}

.lh-venue-name {
  color: var(--accent);
  background: var(--highlight);
  font-weight: 700;
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-sm);
  margin-right: 0.2rem;
}

.lh-link {
  color: var(--text-muted);
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.lh-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ---------------------------------------------------------------- 연락 · 끝 */

.lh-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  padding: 1.4rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.lh-contact dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0;
}

.lh-contact dt {
  color: var(--text-muted);
  font-size: var(--fs-md);
  font-weight: 600;
}

.lh-contact dd {
  margin: 0;
}

.lh-cta {
  color: var(--on-ink);
  background: var(--ink);
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.lh-cta:hover {
  background: var(--ink-hover);
  text-decoration: none;
}

.lh-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: var(--fs-sm);
}

.lh-foot a {
  color: var(--text-muted);
}

/* 조금 내려가면 오른쪽 아래에 뜨는 맨 위로 단추 (labhome.js 가 body 에 lh-far) */
.lh-totop {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow-float);
  font-size: 1.1rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.lh-far .lh-totop {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.lh-totop:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
  .lh-team,
  .lh-totop {
    transition: none;
  }

  .lh-team:hover {
    transform: none;
  }
}

/* ---------------------------------------------------------------- 폰 */

@media (max-width: 640px) {
  :root {
    --lh-bar: 5.6rem; /* 칸 링크가 둘째 줄로 내려가 막대가 높아진다 */
  }

  /* 첫 줄: 이름과 로그인 링크가 한 줄, 칸 링크는 그 아래 줄 (옆으로 밀어 본다) */
  .lh-nav {
    order: 3;
    flex-basis: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -0.4rem;
  }

  .lh-nav a {
    white-space: nowrap;
  }

  .lh-door {
    margin-left: auto;
  }

  .lh-year-group {
    grid-template-columns: 1fr;
  }

  .lh-section .lh-year {
    position: static;
    margin: 0 0 0.25rem;
  }

  .lh-contact dl {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .lh-contact dd + dt {
    margin-top: 0.6rem;
  }
}
