/* ============================================================
   ACE² Lab — Members page
   Editorial Academic Minimalism · loaded on /members/ only

   Principles
   1. Editorial calm     — hairlines and whitespace, not boxes and shadows
   2. Dual-script pairing — one family (Pretendard) for Hangul + Latin
   3. Tone over chroma    — slate neutrals; one muted navy accent
   4. 4px rhythm          — every space and line-height is a multiple of 4
   5. Parity              — Co-PI cards are twins; roles are typographic
   ============================================================ */

/* ------------------------------------------------------------
   0. Tokens
   Scoped to .team-container so nothing leaks into al-folio core,
   and deliberately independent of --global-theme-color
   (core sets that to magenta in light mode, cyan in dark).
   ------------------------------------------------------------ */
.team-container {
  /* Typeface: inherits --font-sans-body (ace2_tokens.css) so Pretendard's metric-matched
     Hangul + Latin leads, and the JA / ZH CJK stacks apply under html[data-lang]. */
  --tm-font: var(--font-sans-body);

  /* Type scale — minor third from 16px, clamped at 14px readable floor */
  --tm-fs-2xs: 0.875rem; /* 14px — badges, chips, sub-labels */
  --tm-fs-xs: 0.875rem; /* 14px — meta, secondary details */
  --tm-fs-sm: 0.9375rem; /* 15px — dense copy, card descriptions */
  --tm-fs-md: 1rem; /* 16px — standard body */
  --tm-fs-lg: 1.125rem; /* 18 / 28 */
  --tm-fs-xl: 1.375rem; /* 22 / 28 */
  --tm-fs-2xl: 1.75rem; /* 28 / 36 */

  /* Space — 4px baseline */
  --tm-s1: 0.25rem;
  --tm-s2: 0.5rem;
  --tm-s3: 0.75rem;
  --tm-s4: 1rem;
  --tm-s5: 1.25rem;
  --tm-s6: 1.5rem;
  --tm-s8: 2rem;
  --tm-s10: 2.5rem;
  --tm-s14: 3.5rem;
  --tm-s20: 5rem;

  /* Radii — one family, two sizes */
  --tm-r-sm: 6px;
  --tm-r-md: 12px;

  /* Colour — light (slate neutrals + deep navy accent) */
  --tm-ink: #0f172a; /* names, titles           17.9:1 on white */
  --tm-text: #334155; /* body                    10.4:1 */
  --tm-muted: var(--c-muted, #4b5a70); /* secondary / labels  7.0:1 — SSOT ace2_tokens.css */
  --tm-faint: #8695aa; /* decorative only (hairline icons) */
  --tm-surface: #ffffff;
  --tm-sunken: #f6f8fb; /* chips, avatar field */
  --tm-line: #e5e9f0; /* hairlines */
  --tm-line-strong: #cfd6e2;
  --tm-accent: #1e3a5f; /* deep navy */
  --tm-accent-soft: rgba(30, 58, 95, 0.06);
  --tm-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -16px rgba(15, 23, 42, 0.12);

  /* Semantic palette (fg on tint, each >= 4.5:1): process / material / device / contact / org */
  --tm-crimson: #a3123a;
  --tm-crimson-soft: rgba(163, 18, 58, 0.09);
  --tm-cobalt: #1d4ed8;
  --tm-cobalt-soft: rgba(29, 78, 216, 0.09);
  --tm-teal: #0f766e;
  --tm-teal-soft: rgba(15, 118, 110, 0.1);
  --tm-amber: #92400e;
  --tm-amber-soft: rgba(180, 83, 9, 0.12);

  max-width: 1340px;
  margin: 0 auto;
  font-family: var(--tm-font);
  font-weight: 400;
  font-feature-settings: "kern" 1;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--tm-text);

  /* Korean: break between words, never mid-word */
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
}

/* Dark — tonal elevation: lighter surface = closer to the reader.
   Page bg is core's #1c1c1d, so surfaces step up from it with a cool tint. */
html[data-theme="dark"] .team-container {
  --tm-ink: #f1f5f9;
  --tm-text: #cbd5e1;
  --tm-muted: var(--c-muted, #94a3b8); /* 5.9:1 on #23262b */
  --tm-faint: #64748b;
  --tm-surface: #23262b;
  --tm-sunken: #2a2e35;
  --tm-line: rgba(148, 163, 184, 0.16);
  --tm-line-strong: rgba(148, 163, 184, 0.3);
  --tm-accent: #9db7d9; /* desaturated steel blue, not neon cyan */
  --tm-accent-soft: rgba(157, 183, 217, 0.1);
  --tm-shadow: 0 0 0 transparent; /* depth comes from surface tone, not shadow */

  --tm-crimson: #f0708f;
  --tm-crimson-soft: rgba(240, 112, 143, 0.14);
  --tm-cobalt: #93c5fd;
  --tm-cobalt-soft: rgba(147, 197, 253, 0.14);
  --tm-teal: #5eead4;
  --tm-teal-soft: rgba(94, 234, 212, 0.12);
  --tm-amber: #fcd34d;
  --tm-amber-soft: rgba(251, 191, 36, 0.14);
}

/* ------------------------------------------------------------
   1. Sections
   ------------------------------------------------------------ */
.team-section {
  margin-bottom: var(--tm-s14);
}

.team-section__title {
  display: flex;
  align-items: baseline;
  gap: var(--tm-s3);
  margin: 0 0 var(--tm-s8);
  padding-bottom: var(--tm-s3);
  border-bottom: 1px solid var(--tm-line);
  font-family: var(--tm-font);
  font-size: var(--tm-fs-xl);
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.02em;
  color: var(--tm-ink);
}

/* Legacy icon glyphs are noise next to a typographic heading */
.team-section__title > i {
  display: none;
}

.team-section__count {
  font-size: var(--tm-fs-xs);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--tm-muted);
  background: none;
  border: 0;
  padding: 0;
}

/* Acronym definition note (KNU) above the first section of the Current Members tab */
.team-section__lead-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tm-s1, 4px) var(--tm-s2);
  margin: 0 0 var(--tm-s6);
  padding: var(--tm-s2) var(--tm-s3);
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-r-sm);
  background: var(--tm-sunken);
  font-size: var(--tm-fs-xs);
  line-height: 20px;
  color: var(--tm-muted);
}

.team-section__lead-info > i {
  flex: none;
  font-size: var(--tm-fs-sm);
  color: var(--tm-faint);
}

.team-section__lead-info strong {
  font-weight: 600;
  color: var(--tm-ink);
}

.lead-info__item {
  min-width: 0;
}

.lead-info__divider {
  flex: none;
  color: var(--tm-faint);
}

/* Mobile: items stack on their own lines; the inline divider is redundant */
@media (max-width: 640px) {
  .team-section__lead-info {
    align-items: flex-start;
  }

  .team-section__lead-info > i {
    margin-top: 2px;
  }

  .lead-info__item {
    flex: 1 1 calc(100% - 28px);
  }

  .lead-info__divider {
    display: none;
  }
}

/* ------------------------------------------------------------
   2. Grids
   ------------------------------------------------------------ */
.team-grid {
  display: grid;
  gap: var(--tm-s6);
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

/* Co-PIs stack: each profile gets the full measure, never a squeezed half */
.team-grid--pi {
  grid-template-columns: 1fr;
  gap: var(--tm-s10);
}

/* ------------------------------------------------------------
   3. Member card — shared grammar
   Left-aligned, hairline border, no lift. The card is not a link,
   so it does not pretend to be one.
   ------------------------------------------------------------ */
.member-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--tm-s5);
  background: var(--tm-surface);
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-r-md);
  text-align: left;
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.member-card:hover {
  box-shadow: var(--tm-shadow);
  border-color: var(--tm-line-strong);
}

/* Role Banner (Option 1 Header Strip) ------------------- */
.member-card__role-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  margin-bottom: var(--tm-s3);
  padding: 6px 10px;
  background: var(--tm-role-bg);
  border: 1px solid var(--tm-line-strong);
  border-radius: var(--tm-r-sm);
}

.member-card__role-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--tm-font);
  font-size: 14px;
  font-weight: 700;
  color: var(--tm-role-text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.member-card__role-en {
  font-size: var(--tm-fs-xs);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--tm-role-text);
  white-space: nowrap;
}

html[data-lang="ko"] .member-card__role-en {
  display: none !important;
}

/* Avatar ------------------------------------------------ */
.member-card__avatar-wrapper {
  margin-bottom: var(--tm-s4);
}

.member-card__avatar {
  display: block;
  width: 96px;
  height: 120px;
  border-radius: var(--tm-r-sm);
  object-fit: cover;
  object-position: top center;
  background: var(--tm-sunken);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--tm-line);
}

/* Monogram placeholder: flat slate field + inner hairline ring */
.member-card__avatar--placeholder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-indent: 0.04em; /* optically re-centre after tracking */
  line-height: 1;
  color: var(--tm-muted);
  user-select: none;
  border-radius: var(--tm-r-sm);
}

.member-card__avatar--placeholder::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--tm-line);
  border-radius: calc(var(--tm-r-sm) - 2px);
  pointer-events: none;
}

/* Content ----------------------------------------------- */
.member-card__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-grow: 1;
  width: 100%;
}

/* Name: Hangul leads, Latin follows on the same baseline family */
.member-card__name {
  margin: 0;
  font-family: var(--tm-font);
  font-size: var(--tm-fs-lg);
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.02em;
  color: var(--tm-ink);
}

.member-card__name-en {
  display: block;
  margin-top: 0;
  font-size: var(--tm-fs-xs);
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0;
  color: var(--tm-muted);
}

/* Role: one quiet badge + the enrolment period beside it */
.member-card__role {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tm-s1) var(--tm-s2);
  margin: 0 0 var(--tm-s2);
}

.member-badge {
  padding: 2px var(--tm-s2);
  font-size: var(--tm-fs-2xs);
  font-weight: 600;
  line-height: 16px;
  letter-spacing: -0.005em;
  color: var(--tm-accent);
  background: var(--tm-accent-soft);
  border-radius: var(--tm-r-sm);
}

.member-card__period {
  font-size: var(--tm-fs-2xs);
  line-height: 16px;
  color: var(--tm-muted);
}

/* ------------------------------------------------------------
   3b. Degree-program role colour (data-role from member_card.liquid)
   Same semantic grammar as the facilities room legend:
   phd navy · ms teal · researcher burgundy · undergrad cobalt.
   --tm-role-accent: border / glow. --tm-role-text on --tm-role-bg: badge
   (>= 4.5:1 AA in both themes). Unknown roles fall back to the page accent.
   ------------------------------------------------------------ */
.member-card {
  --tm-role-accent: var(--tm-accent);
  --tm-role-text: var(--tm-accent);
  --tm-role-bg: var(--tm-accent-soft);
  --tm-role-glow: rgba(15, 23, 42, 0.14);
}

.member-card[data-role="phd"] {
  --tm-role-accent: #1e3a5f;
  --tm-role-text: #1e3a5f;
  --tm-role-bg: rgba(30, 58, 95, 0.09);
  --tm-role-glow: rgba(30, 58, 95, 0.28);
}

.member-card[data-role="ms"] {
  --tm-role-accent: #0f766e;
  --tm-role-text: #0f766e;
  --tm-role-bg: rgba(15, 118, 110, 0.09);
  --tm-role-glow: rgba(15, 118, 110, 0.28);
}

.member-card[data-role="researcher"] {
  --tm-role-accent: #a3123a;
  --tm-role-text: #a3123a;
  --tm-role-bg: rgba(163, 18, 58, 0.08);
  --tm-role-glow: rgba(163, 18, 58, 0.26);
}

.member-card[data-role="undergrad"] {
  --tm-role-accent: #2563eb;
  --tm-role-text: #1d4ed8; /* darker than the accent: 5.17:1 would be marginal on the tint */
  --tm-role-bg: rgba(37, 99, 235, 0.09);
  --tm-role-glow: rgba(37, 99, 235, 0.28);
}

html[data-theme="dark"] .member-card[data-role="phd"] {
  --tm-role-accent: #6b9bea;
  --tm-role-text: #a9c6f5;
  --tm-role-bg: rgba(107, 155, 234, 0.16);
  --tm-role-glow: rgba(107, 155, 234, 0.28);
}

html[data-theme="dark"] .member-card[data-role="ms"] {
  --tm-role-accent: #2dd4bf;
  --tm-role-text: #5eead4;
  --tm-role-bg: rgba(45, 212, 191, 0.14);
  --tm-role-glow: rgba(45, 212, 191, 0.25);
}

html[data-theme="dark"] .member-card[data-role="researcher"] {
  --tm-role-accent: #f0708f;
  --tm-role-text: #f8b4c6;
  --tm-role-bg: rgba(240, 112, 143, 0.16);
  --tm-role-glow: rgba(240, 112, 143, 0.28);
}

html[data-theme="dark"] .member-card[data-role="undergrad"] {
  --tm-role-accent: #60a5fa;
  --tm-role-text: #93c5fd;
  --tm-role-bg: rgba(96, 165, 250, 0.16);
  --tm-role-glow: rgba(96, 165, 250, 0.28);
}

.member-card[data-role] {
  border-left: 3px solid var(--tm-role-accent);
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.member-card[data-role]:hover {
  border-color: var(--tm-line-strong);
  border-left-color: var(--tm-role-accent);
  box-shadow: 0 8px 20px -10px var(--tm-role-glow);
  transform: translateY(-2px);
}

/* Meta: icon column aligned, text hangs cleanly when it wraps */
.member-meta {
  display: flex;
  flex-direction: column;
  gap: var(--tm-s1);
  width: 100%;
  margin: var(--tm-s4) 0 0;
  padding: 0;
  list-style: none;
}

.member-meta li {
  display: grid;
  grid-template-columns: 16px 1fr;
  column-gap: var(--tm-s2);
  align-items: baseline;
  font-size: var(--fs-meta, 0.875rem);
  line-height: 20px;
  color: var(--tm-text);
}

.member-meta i {
  font-size: 0.875rem; /* 14px optical size, matches the 20px line box */
  line-height: 1;
  color: var(--tm-faint);
  text-align: center;
}

/* Semantic icon colours: each row's glyph carries its own hue (light / dark pairs) */
.member-meta .member-meta__affiliation i {
  color: #00508c; /* KNU Cobalt Blue */
}

.member-meta .member-meta__edu i {
  color: #6366f1; /* Academic Indigo */
}

.member-meta .member-meta__research i {
  color: #059669; /* Science Emerald */
}

.member-meta .member-meta__muted i {
  color: #e11d48; /* Coral Red */
}

html[data-theme="dark"] .member-meta .member-meta__affiliation i {
  color: #60a5fa;
}

html[data-theme="dark"] .member-meta .member-meta__edu i {
  color: #a5b4fc;
}

html[data-theme="dark"] .member-meta .member-meta__research i {
  color: #34d399;
}

html[data-theme="dark"] .member-meta .member-meta__muted i {
  color: #fb7185;
}

/* Row 1 — current affiliation: the card's anchor line */
.member-meta .member-meta__affiliation {
  font-weight: 600;
  color: var(--tm-ink);
  word-break: keep-all;
}

/* Rows 2-3 — education cohort and research field: body weight */
.member-meta .member-meta__edu,
.member-meta .member-meta__research {
  color: var(--tm-text);
  word-break: keep-all;
}

.member-meta__edu-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.member-meta__edu-line {
  display: block;
  word-break: keep-all;
  white-space: pre-wrap;
}

/* Cohort tokens like ('18학번) never split between the quote and the digits */

/* Row 4 — office: quiet, one size down */
.member-meta .member-meta__muted {
  font-size: var(--fs-label, 0.875rem);
  color: var(--tm-muted);
}

/* Topic chips (Co-PI profile only; student cards no longer render them) */
.topic-tag {
  padding: 2px var(--tm-s2);
  font-size: var(--tm-fs-2xs);
  font-weight: 500;
  line-height: 16px;
  letter-spacing: -0.005em;
  color: var(--tm-muted);
  background: transparent;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-r-sm);
  word-break: keep-all;
}

/* Links */
.member-card__links {
  display: flex;
  align-items: center;
  gap: 0; /* the 44px hit boxes already space the glyphs */
  margin-top: auto;
  flex-wrap: wrap;
  max-width: calc(100% + 14px);
  margin-left: -14px; /* first glyph aligns with the text edge */
  padding-top: var(--tm-s3);
}

.link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px; /* WCAG 2.5.5 touch target */
  font-size: 1rem;
  line-height: 1;
  color: var(--tm-muted);
  transition: color 0.15s ease;
}

.link-icon:hover,
.link-icon:focus-visible {
  color: var(--tm-accent);
  text-decoration: none;
}

/* Mail pills: institutional (KNU / KICET) and personal Gmail side by side */
.link-icon--mail {
  gap: 6px;
  padding: 0 var(--tm-s2);
  min-height: 38px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.link-icon--mail i {
  font-size: 0.9375rem;
}

.link-pill__label {
  font-size: 0.875rem;
  line-height: 1;
}

@media (pointer: coarse) {
  .link-icon--mail {
    min-height: 44px;
  }
}

/* Research achievements trigger: shown only once member_achievements.js is live */
.member-card__ach-btn {
  display: none;
  align-items: center;
  gap: var(--tm-s2);
  min-height: 44px; /* WCAG 2.5.5 touch target */
  margin: 0 0 0 var(--tm-s2);
  padding: 0 var(--tm-s3);
  font-family: var(--tm-font);
  font-size: var(--tm-fs-xs);
  font-weight: 600;
  line-height: 20px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--tm-role-text);
  background: transparent;
  border: 0;
  border-radius: var(--tm-r-sm);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.team-container.has-ach .member-card__ach-btn {
  display: inline-flex;
}

.member-card__ach-btn i {
  font-size: 0.875rem;
}

.member-card__ach-btn:hover,
.member-card__ach-btn:focus-visible {
  background: var(--tm-role-bg);
}

.member-card__ach-btn:focus-visible {
  outline: 2px solid var(--tm-role-accent);
  outline-offset: 2px;
}

.link-icon:focus-visible,
.alumni-row__dest a:focus-visible {
  outline: 2px solid var(--tm-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ------------------------------------------------------------
   4. Co-PI executive profile
   [portrait + contact | identity → summary → career/education
   → topics → profile links]. Both Co-PIs share one frame.
   ------------------------------------------------------------ */
.tm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pi-profile {
  position: relative;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  column-gap: var(--tm-s10);
  padding: var(--tm-s10);
  background: var(--tm-surface);
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-r-md);
  box-shadow: var(--tm-shadow);
  scroll-margin-top: 5rem;
}

/* One quiet accent: a short navy rule on the top edge */
.pi-profile::before {
  content: "";
  position: absolute;
  top: -1px;
  left: var(--tm-s10);
  width: 72px;
  height: 3px;
  background: linear-gradient(90deg, var(--tm-accent), var(--tm-crimson));
  border-radius: 0 0 3px 3px;
}

/* Aside: portrait + contact ------------------------------ */
.pi-profile__aside {
  display: flex;
  flex-direction: column;
  gap: var(--tm-s5);
  min-width: 0;
}

.pi-profile__portrait {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--tm-sunken);
  border-radius: var(--tm-r-md);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 12px 28px -18px rgba(15, 23, 42, 0.35);
}

/* Inner hairline sits above the photo so light backgrounds keep an edge */
.pi-profile__portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: inherit;
  pointer-events: none;
}

.pi-profile__portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pi-contact {
  display: flex;
  flex-direction: column;
  gap: var(--tm-s3);
  margin: 0;
  padding: var(--tm-s4);
  background: var(--tm-sunken);
  border-radius: var(--tm-r-sm);
}

.pi-contact__row {
  display: grid;
  grid-template-columns: 28px 1fr;
  column-gap: var(--tm-s3);
  align-items: start;
}

/* Rounded icon container; colour identifies the field (office / phone / email) */
.pi-contact dt {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0;
  border-radius: 8px;
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--tm-accent);
  background: var(--tm-accent-soft);
}

.pi-contact dd {
  margin: 0;
  min-width: 0;
  padding-top: 4px;
  font-size: var(--tm-fs-xs);
  line-height: 20px;
  color: var(--tm-text);
  overflow-wrap: anywhere; /* last resort for very long e-mail addresses */
}


html[data-lang="ko"] .pi-profile__en-sub {
  display: none !important;
}

.pi-contact a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

.pi-contact a:hover,
.pi-contact a:focus-visible {
  color: var(--tm-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Main column ------------------------------------------- */
.pi-profile__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Executive pill badge */
.pi-profile__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--tm-s2);
  align-self: flex-start;
  margin: 0 0 var(--tm-s3);
  padding: 3px var(--tm-s3);
  border: 1px solid var(--tm-accent);
  border-radius: 999px;
  background: var(--tm-accent-soft);
  font-size: var(--tm-fs-2xs);
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tm-accent);
}

.pi-profile__eyebrow i {
  font-size: 0.875rem;
  color: var(--tm-crimson);
}

.pi-profile__name {
  margin: 0;
  font-family: var(--tm-font);
  font-size: var(--tm-fs-2xl);
  font-weight: 700;
  line-height: 36px;
  letter-spacing: -0.03em;
  color: var(--tm-ink);
}

.pi-profile__name-en {
  margin-left: var(--tm-s2);
  font-size: var(--tm-fs-lg);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--tm-muted);
}

.pi-profile__title {
  margin: var(--tm-s2) 0 0;
  font-size: var(--tm-fs-md);
  font-weight: 500;
  line-height: 24px;
  color: var(--tm-ink);
}

.pi-profile__sep {
  margin: 0 0.6em;
  color: var(--tm-line-strong);
  font-weight: 300;
}

.pi-profile__affil {
  margin: 0;
  font-size: var(--tm-fs-sm);
  line-height: 24px;
  color: var(--tm-muted);
}

.pi-profile__summary {
  margin: var(--tm-s5) 0 0;
  padding-top: var(--tm-s5);
  border-top: 1px solid var(--tm-line);
  font-size: var(--tm-fs-lg);
  line-height: 1.85;
  letter-spacing: -0.015em;
  color: var(--tm-text);
  word-break: keep-all;
  text-wrap: pretty;
}

/* Keyword anchors in the summary: process (crimson), material (cobalt), device (teal) */
.pi-kw {
  padding: 0 5px;
  border-radius: 5px;
  font-weight: 600;
  color: var(--kw-fg);
  background: var(--kw-bg);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.pi-kw--process {
  --kw-fg: var(--tm-crimson);
  --kw-bg: var(--tm-crimson-soft);
}

.pi-kw--material {
  --kw-fg: var(--tm-cobalt);
  --kw-bg: var(--tm-cobalt-soft);
}

.pi-kw--device {
  --kw-fg: var(--tm-teal);
  --kw-bg: var(--tm-teal-soft);
}

.pi-profile__label {
  margin: 0 0 var(--tm-s3);
  font-family: var(--tm-font);
  font-size: var(--tm-fs-2xs);
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tm-muted);
}

/* Career | Education side by side; career gets the wider track */
.pi-profile__history {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: var(--tm-s8);
  margin-top: var(--tm-s8);
}

.pi-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pi-timeline__item {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 0 var(--tm-s4) var(--tm-s5);
  border-left: 1px solid var(--tm-line);
}

.pi-timeline__item:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

/* Node */
.pi-timeline__item::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -4px;
  width: 7px;
  height: 7px;
  background: var(--tm-surface);
  border: 1.5px solid var(--tm-line-strong);
  border-radius: 50%;
}

.pi-timeline__item.is-current {
  padding-bottom: var(--tm-s5);
  border-left: 3px solid var(--tm-accent);
  margin-left: -1px;
  padding-left: calc(var(--tm-s5) - 2px);
}

.pi-timeline__item.is-current::before {
  top: 4px;
  left: -8px;
  width: 11px;
  height: 11px;
  background: var(--tm-accent);
  border: 2px solid var(--tm-surface);
  box-shadow:
    0 0 0 3px var(--tm-accent-soft),
    0 0 0 1px var(--tm-accent);
}

.pi-timeline__period {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: flex-start;
  gap: var(--tm-s2);
  font-family: var(--font-mono-meta, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  padding: 2px var(--tm-s2);
  border: 1px solid var(--tm-line);
  border-radius: 999px;
  background: var(--tm-sunken);
  font-size: var(--tm-fs-2xs);
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0;
  color: var(--tm-text);
}

/* The monospace pill hugs the period text; the Current badge sits beside it */
.pi-timeline__badge {
  padding: 1px var(--tm-s2);
  border-radius: 999px;
  background: var(--tm-accent);
  font-family: var(--tm-font);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 14px;
  letter-spacing: 0.02em;
  color: #fff;
}

html[data-theme="dark"] .pi-timeline__badge {
  color: #0f172a;
}

/* Org-first hierarchy: the institution is the bold, sector-toned anchor
   (DOM order: period, org, role); the role is a medium-weight muted title. */
.pi-timeline__org {
  margin-top: 2px;
  font-size: var(--tm-fs-sm);
  font-weight: 700;
  line-height: 20px;
  letter-spacing: -0.015em;
  color: var(--org-fg, var(--tm-ink));
}

.pi-timeline__role {
  font-size: var(--tm-fs-xs);
  font-weight: 500;
  line-height: 18px;
  color: var(--tm-muted);
}

/* Sector identity: current post (crimson), industry (navy), institute / other academia (teal) */
.pi-timeline__item--current {
  --org-fg: var(--sector-current);
}

.pi-timeline__item--industry {
  --org-fg: var(--sector-industry);
}

.pi-timeline__item--institute,
.pi-timeline__item--academia {
  --org-fg: var(--sector-institute);
}

/* Institutional Brand Signatures (A-Plan: Direct Brand Ink) */
.pi-timeline__item--brand-knu {
  --org-fg: var(--brand-knu);
}
.pi-timeline__item--brand-knu::before {
  border-color: var(--brand-knu);
}

.pi-timeline__item--brand-samsung {
  --org-fg: var(--brand-samsung);
}
.pi-timeline__item--brand-samsung::before {
  border-color: var(--brand-samsung);
}

.pi-timeline__item--brand-postech {
  --org-fg: var(--brand-postech);
}
.pi-timeline__item--brand-postech::before {
  border-color: var(--brand-postech);
}

.pi-timeline__item--brand-rist {
  --org-fg: var(--brand-rist);
}
.pi-timeline__item--brand-rist::before {
  border-color: var(--brand-rist);
}

.pi-timeline__item--brand-calgary {
  --org-fg: var(--brand-calgary);
}
.pi-timeline__item--brand-calgary::before {
  border-color: var(--brand-calgary);
}

.pi-timeline__item--brand-kitech {
  --org-fg: var(--brand-kitech);
}
.pi-timeline__item--brand-kitech::before {
  border-color: var(--brand-kitech);
}

/* Sub-note: calm sunken badge */
.pi-timeline__note {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.35rem;
  margin-top: var(--tm-s1);
  padding: 1px var(--tm-s2);
  border-radius: var(--tm-r-sm);
  border: 1px solid var(--tm-line);
  background: var(--tm-sunken);
  font-size: var(--tm-fs-2xs);
  line-height: 16px;
  color: var(--tm-muted);
}

.pi-timeline__note i {
  font-size: 0.875rem;
}

.pi-profile__block {
  margin-top: var(--tm-s8);
}

.pi-topics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tm-s2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pi-topics .topic-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--tm-s2);
  padding: var(--tm-s1) var(--tm-s3);
  font-size: var(--tm-fs-xs);
  font-weight: 500;
  line-height: 20px;
  color: var(--tm-text);
  background: var(--tm-sunken);
  border: 1px solid var(--tm-line);
  border-radius: 999px;
}

/* Unified calm tone: sunken chip with a single navy dot marker */
.pi-topics .topic-tag::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tm-accent);
}

/* Teaching ledger (Co-PI profile opt-in) ---------------- */
.pi-teaching__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--tm-s2);
  margin-bottom: var(--tm-s3);
}

.pi-teaching__head .pi-profile__label {
  margin-bottom: 0;
}

.pi-teaching__legend {
  display: inline-flex;
  align-items: center;
  gap: var(--tm-s2);
  margin: 0;
  font-size: var(--tm-fs-2xs);
  line-height: 16px;
  color: var(--tm-muted);
}

.pi-teaching__legend-sep {
  color: var(--tm-line-strong);
}

.pi-teaching__list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--tm-line);
}

.pi-teaching__year {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  column-gap: var(--tm-s4);
  padding: var(--tm-s4) 0;
  border-bottom: 1px solid var(--tm-line);
}

.pi-teaching__year-label {
  padding-top: 2px;
  font-family: var(--font-mono-meta, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-size: var(--tm-fs-sm);
  font-weight: 700;
  line-height: 20px;
  color: var(--tm-ink);
}

.pi-teaching__sabbatical {
  display: inline-flex;
  align-items: center;
  gap: var(--tm-s2);
  padding: var(--tm-s2) var(--tm-s3);
  border: 1px dashed var(--tm-line-strong);
  border-radius: var(--tm-r-sm);
  background: var(--tm-sunken);
  font-size: var(--tm-fs-xs);
  font-weight: 500;
  line-height: 20px;
  color: var(--tm-muted);
}

.pi-teaching__sabbatical i {
  font-size: 0.875rem;
  color: var(--tm-accent);
}

.pi-teaching__semesters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--tm-s4);
}

.pi-teaching__sem {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--tm-s3);
  background: var(--tm-sunken);
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-r-sm);
}

.pi-teaching__sem-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tm-s2);
  margin-bottom: var(--tm-s2);
  padding-bottom: var(--tm-s2);
  border-bottom: 1px solid var(--tm-line);
}

.pi-teaching__term {
  font-family: var(--font-mono-meta, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-size: var(--tm-fs-xs);
  font-weight: 600;
  line-height: 20px;
  color: var(--tm-ink);
}

.pi-teaching__credits {
  padding: 1px var(--tm-s2);
  border-radius: 999px;
  background: var(--tm-accent-soft);
  border: 1px solid var(--tm-line-strong);
  font-size: var(--tm-fs-2xs);
  font-weight: 600;
  line-height: 16px;
  color: var(--tm-accent);
}

.pi-course-list {
  display: flex;
  flex-direction: column;
  gap: var(--tm-s2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pi-course {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: var(--tm-s2);
  font-size: var(--tm-fs-xs);
  line-height: 20px;
}

.pi-course__level {
  padding: 0 6px;
  border-radius: 4px;
  background: var(--tm-surface);
  border: 1px solid var(--tm-line);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  color: var(--tm-muted);
}

.pi-course__level--grad {
  color: var(--tm-cobalt);
  background: var(--tm-cobalt-soft);
  border-color: transparent;
}

.pi-course__title {
  min-width: 0;
  font-weight: 500;
  color: var(--tm-ink);
}

.pi-course__advisees {
  font-weight: 600;
  color: var(--tm-teal);
}

.pi-course__unit {
  font-weight: 400;
  color: var(--tm-muted);
  white-space: nowrap;
}

.pi-course__meta {
  display: inline-flex;
  align-items: center;
  gap: var(--tm-s1);
  white-space: nowrap;
}

.pi-course__lang {
  padding: 0 5px;
  border-radius: 4px;
  background: var(--tm-amber-soft);
  font-family: var(--font-mono-meta, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 16px;
  color: var(--tm-amber);
}

.pi-course__eval {
  padding: 0 6px;
  border-radius: 4px;
  background: var(--tm-teal-soft);
  font-family: var(--font-mono-meta, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 18px;
  color: var(--tm-teal);
}

.pi-course__eval--na {
  background: var(--tm-surface);
  border: 1px solid var(--tm-line);
  font-weight: 500;
  color: var(--tm-muted);
}

/* Profile links: labelled outline buttons */
.pi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tm-s2);
  margin-top: var(--tm-s8);
  padding-top: var(--tm-s6);
  border-top: 1px solid var(--tm-line);
}

.pi-action {
  display: inline-flex;
  align-items: center;
  gap: var(--tm-s2);
  padding: var(--tm-s2) var(--tm-s4);
  font-size: var(--tm-fs-xs);
  font-weight: 500;
  line-height: 20px;
  color: var(--tm-ink);
  background: var(--tm-surface);
  border: 1px solid var(--tm-line-strong);
  border-radius: 999px;
  text-decoration: none;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.pi-action i {
  font-size: 1rem;
  color: var(--tm-muted);
  transition: color 0.15s ease;
}

.pi-action:hover,
.pi-action:focus-visible {
  color: #fff;
  background: var(--tm-accent);
  border-color: var(--tm-accent);
  text-decoration: none;
}

.pi-action:hover i,
.pi-action:focus-visible i {
  color: inherit;
}

html[data-theme="dark"] .pi-action:hover,
html[data-theme="dark"] .pi-action:focus-visible {
  color: #0f172a;
}

.pi-action:focus-visible,
.pi-contact a:focus-visible {
  outline: 2px solid var(--tm-accent);
  outline-offset: 2px;
}

/* Desktop: the portrait column follows the reader through long profiles */
@media (min-width: 900px) {
  .pi-profile__aside {
    position: sticky;
    top: 7rem; /* clears the fixed al-folio navbar + sticky members tab bar */
    align-self: start;
  }
}

/* Tablet & below: portrait sits beside the contact box, main column runs full width */
@media (max-width: 899.98px) {
  .pi-profile {
    grid-template-columns: 1fr;
    row-gap: var(--tm-s8);
    padding: var(--tm-s8);
  }

  .pi-profile::before {
    left: var(--tm-s8);
  }

  .pi-profile__aside {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: var(--tm-s6);
    align-items: end;
  }

  .pi-contact {
    max-width: 22rem;
  }
}

/* Narrow: timelines stack, English name/title drop to their own lines */
@media (max-width: 639.98px) {
  .pi-profile {
    row-gap: var(--tm-s6);
    padding: var(--tm-s6);
  }

  .pi-profile::before {
    left: var(--tm-s6);
  }

  .pi-profile__aside {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: var(--tm-s4);
    align-items: start;
  }

  .pi-contact {
    padding: var(--tm-s3);
  }

  .pi-profile__history {
    grid-template-columns: 1fr;
    gap: var(--tm-s6);
  }

  .pi-profile__name-en {
    display: block;
    margin-left: 0;
    font-size: var(--tm-fs-md);
    line-height: 24px;
  }

  .pi-profile__sep {
    display: none;
  }

  .pi-profile__title > span[lang] {
    display: block;
    font-weight: 400;
    color: var(--tm-muted);
  }

  .pi-profile__summary {
    font-size: 1rem;
    line-height: 1.75;
  }

  .pi-teaching__year {
    grid-template-columns: 1fr;
    row-gap: var(--tm-s2);
  }

  .pi-teaching__semesters {
    grid-template-columns: 1fr;
    gap: var(--tm-s3);
  }
}

/* ------------------------------------------------------------
   5. Alumni — photo + typographic row
   Grid: [portrait] [degree · name | thesis | → destination]
   ------------------------------------------------------------ */
.alumni-year-rail {
  display: flex;
  flex-direction: column;
  gap: var(--tm-s10);
}

.alumni-year-group {
  scroll-margin-top: 8rem;
}

.alumni-year-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 var(--tm-s2) var(--tm-s2);
  margin-bottom: 0;
  border-bottom: 2px solid var(--tm-ink);
}

.alumni-year-title {
  display: inline-flex;
  align-items: baseline;
  gap: var(--tm-s2);
  margin: 0;
  font-family: var(--tm-font);
  font-size: var(--tm-fs-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tm-ink);
}

.alumni-year-title__year {
  font-variant-numeric: tabular-nums;
}

.alumni-year-title__label {
  font-size: var(--tm-fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tm-muted);
}

.alumni-year-count {
  font-size: var(--tm-fs-xs);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--tm-muted);
  font-variant-numeric: tabular-nums;
}

.alumni-list {
  border-top: 1px solid var(--tm-line);
  background: transparent;
}

.alumni-year-group .alumni-list {
  border-top: 0;
}

.alumni-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  column-gap: var(--tm-s5);
  padding: var(--tm-s4) var(--tm-s2);
  border-bottom: 1px solid var(--tm-line);
  font-size: var(--tm-fs-sm);
  line-height: 24px;
  letter-spacing: -0.01em;
  color: var(--tm-text);
  scroll-margin-top: 8rem;
}

.alumni-row__avatar-wrapper {
  align-self: start;
}

.alumni-row__avatar {
  display: block;
  width: 56px;
  height: 70px; /* 4:5, same as the member cards */
  border-radius: var(--tm-r-sm);
  object-fit: cover;
  object-position: top center;
  background: var(--tm-sunken);
  border: 1px solid var(--tm-line);
}

.alumni-row__body {
  display: grid;
  grid-template-columns: minmax(13rem, 19rem) minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: var(--tm-s6);
  min-width: 0;
}

.alumni-row__left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.alumni-row__degree {
  font-size: var(--tm-fs-xs);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--tm-muted);
}

.alumni-row__name {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--tm-ink);
}

.alumni-row__name-en {
  margin-left: var(--tm-s2);
  font-size: var(--tm-fs-xs);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--tm-muted);
}

.alumni-row__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--tm-fs-xs);
  color: var(--tm-muted);
  line-height: 1.4;
  margin-top: var(--tm-s1);
  letter-spacing: -0.01em;
}

.alumni-row__edu-line {
  display: flex;
  align-items: baseline;
  gap: var(--tm-s1);
}

.alumni-row__edu-line--tagged {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  align-items: baseline;
  column-gap: var(--tm-s1);
}

.alumni-row__edu-content {
  min-width: 0;
}

.alumni-row__edu-line--bs {
  color: var(--tm-muted);
  opacity: 0.9;
}

.alumni-row__edu-tag {
  display: inline-block;
  min-width: 2.1rem;
  font-family: var(--font-mono-meta, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tm-accent);
}

.alumni-row__cohort {
  font-family: var(--font-mono-meta, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-size: 0.875rem;
  color: var(--tm-muted);
  white-space: nowrap;
}

.alumni-row__joint {
  color: var(--tm-ink);
  font-weight: 500;
}

.alumni-row__thesis {
  min-width: 0;
  font-size: var(--tm-fs-sm);
  font-style: normal;
  color: var(--tm-muted);
  text-wrap: pretty;
}

.alumni-row__thesis-title {
  line-height: 1.4;
}

.alumni-row__thesis i {
  display: none; /* icon is decoration; the italic quote already signals a title */
}

.alumni-row__thesis em {
  font-style: normal;
}

.alumni-row__ach-wrap {
  margin-top: var(--tm-s2);
  display: flex;
  align-items: center;
}

.alumni-row__ach-wrap:first-child {
  margin-top: 0;
}

.alumni-row__ach-btn {
  margin: 0;
  padding: 4px 10px;
  min-height: 28px;
  font-size: var(--tm-fs-2xs);
  font-weight: 600;
  line-height: 1;
  color: var(--tm-accent);
  background: var(--tm-accent-soft);
  border: 1px solid var(--tm-line-strong);
  border-radius: 9999px;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.alumni-row__ach-btn:hover,
.alumni-row__ach-btn:focus-visible {
  color: var(--tm-ink);
  background: rgba(30, 58, 95, 0.12);
  border-color: var(--tm-accent);
}

.alumni-row__ach-btn:focus-visible {
  outline: 2px solid var(--tm-accent);
  outline-offset: 2px;
}

html[data-theme="dark"] .alumni-row__ach-btn {
  color: var(--tm-accent);
  background: rgba(157, 183, 217, 0.1);
  border-color: var(--tm-line-strong);
}

html[data-theme="dark"] .alumni-row__ach-btn:hover,
html[data-theme="dark"] .alumni-row__ach-btn:focus-visible {
  color: #ffffff;
  background: rgba(157, 183, 217, 0.2);
  border-color: var(--tm-accent);
}

.alumni-row__now {
  display: flex;
  align-items: baseline;
  gap: var(--tm-s2);
  font-weight: 500;
  color: var(--tm-ink);
  text-align: right;
  justify-content: flex-end;
}

.alumni-row__arrow {
  color: var(--tm-faint);
}

.alumni-row__dest {
  font-weight: 700;
  color: var(--tm-ink);
}

.alumni-row__dest a {
  color: var(--tm-accent);
  font-weight: 700;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size 0.2s ease;
}

.alumni-row__dest a:hover {
  background-size: 100% 1px;
}

.alumni-row__position {
  font-weight: 400;
  color: var(--tm-muted);
}

@media (max-width: 767.98px) {
  .alumni-row {
    align-items: start;
    column-gap: var(--tm-s4);
    padding: var(--tm-s4) 0;
  }

  .alumni-row__body {
    grid-template-columns: 1fr;
    row-gap: var(--tm-s1);
  }

  .alumni-row__now {
    justify-content: flex-start;
    text-align: left;
  }
}

/* ------------------------------------------------------------
   5b. Former interns — compact photo cards
   ------------------------------------------------------------ */
.intern-grid {
  display: grid;
  gap: var(--tm-s4);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.intern-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  column-gap: var(--tm-s4);
  padding: var(--tm-s4);
  background: var(--tm-surface);
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-r-md);
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  scroll-margin-top: 8rem;
}

.intern-card:hover {
  box-shadow: var(--tm-shadow);
  border-color: var(--tm-line-strong);
}

.intern-card__avatar {
  display: block;
  width: 56px;
  height: 70px;
  border-radius: var(--tm-r-sm);
  object-fit: cover;
  object-position: top center;
  background: var(--tm-sunken);
  border: 1px solid var(--tm-line);
}

.intern-card__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--tm-fs-md);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-indent: 0.04em;
  line-height: 1;
  color: var(--tm-muted);
  user-select: none;
}

.intern-card__content {
  min-width: 0;
}

.intern-card__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tm-s1) var(--tm-s2);
  margin: 0;
  font-family: var(--tm-font);
  font-size: var(--tm-fs-md);
  font-weight: 600;
  line-height: 24px;
  letter-spacing: -0.02em;
  color: var(--tm-ink);
}

.intern-card__period {
  margin: 0;
  font-size: var(--tm-fs-xs);
  line-height: 20px;
  color: var(--tm-muted);
}

.intern-card__period {
  margin-top: var(--tm-s1);
}

/* ------------------------------------------------------------
   6. Tabs — hash-synced WAI-ARIA tablist (assets/js/ace2_tabs.js)
   Progressive enhancement: the bar stays hidden and every panel is
   visible until the script adds .is-tabbed to the container.
   ------------------------------------------------------------ */
.team-tabnav {
  display: none;
}

.team-container.is-tabbed .team-tabnav {
  --tm-navbar-h: 3.5rem; /* fixed al-folio navbar */
  position: sticky;
  top: var(--tm-navbar-h);
  z-index: 10;
  display: flex;
  gap: var(--tm-s1);
  margin: 0 0 var(--tm-s8);
  padding: 0 var(--tm-s1);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--tm-surface);
  border-bottom: 1px solid var(--tm-line);
}

@supports (backdrop-filter: blur(1px)) {
  .team-container.is-tabbed .team-tabnav {
    background: color-mix(in srgb, var(--tm-surface) 86%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
  }
}

.team-tabnav::-webkit-scrollbar {
  display: none;
}

.team-tab {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--tm-s2);
  margin: 0;
  padding: var(--tm-s3) var(--tm-s4);
  font-family: var(--tm-font);
  font-size: var(--tm-fs-sm);
  font-weight: 500;
  line-height: 24px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--tm-muted);
  background: none;
  border: 0;
  border-radius: var(--tm-r-sm) var(--tm-r-sm) 0 0;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

/* Active indicator: a 2px rule sitting on the bar's hairline */
.team-tab::after {
  content: "";
  position: absolute;
  left: var(--tm-s4);
  right: var(--tm-s4);
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--tm-accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.2s ease;
}

.team-tab:hover {
  color: var(--tm-ink);
  background: var(--tm-accent-soft);
}

.team-tab[aria-selected="true"] {
  font-weight: 600;
  color: var(--tm-ink);
}

.team-tab[aria-selected="true"]::after {
  transform: scaleX(1);
}

.team-tab:focus-visible {
  outline: 2px solid var(--tm-accent);
  outline-offset: -2px;
}

.team-tab__count {
  min-width: 1.5em;
  padding: 0 0.45em;
  font-size: var(--tm-fs-2xs);
  font-weight: 500;
  line-height: 18px;
  text-align: center;
  color: var(--tm-muted);
  background: var(--tm-sunken);
  border-radius: 999px;
}

.team-tab[aria-selected="true"] .team-tab__count {
  color: var(--tm-accent);
  background: var(--tm-accent-soft);
}

/* Panels: scroll-margin keeps anchored content clear of navbar + sticky bar */
.team-tabpanel {
  scroll-margin-top: 7rem;
}

.team-tabpanel:focus {
  outline: none;
}

.team-tabpanel:focus-visible {
  outline: 2px solid var(--tm-accent);
  outline-offset: 4px;
  border-radius: var(--tm-r-sm);
}

.team-container.is-tabbed .team-tabpanel.is-animating {
  animation: team-panel-in 0.24s ease both;
}

@keyframes team-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* The group heading is only needed when both PI profiles stack in one flow */
.team-container.is-tabbed .team-section__title--print-only {
  display: none;
}

/* Anchored legacy targets must clear the sticky bar as well */
.team-container.is-tabbed .team-section[id],
.team-container.is-tabbed .pi-profile,
.team-container.is-tabbed .member-card {
  scroll-margin-top: 8rem;
}

@media (max-width: 767.98px) {
  .team-container.is-tabbed .team-tabnav {
    /* bleed to the screen edge so the scroll affordance isn't clipped by page padding */
    margin-left: calc(var(--tm-s4) * -1);
    margin-right: calc(var(--tm-s4) * -1);
    padding: 0 var(--tm-s3);
  }

  .team-tab {
    padding: var(--tm-s3);
  }

  .team-tab::after {
    left: var(--tm-s3);
    right: var(--tm-s3);
  }
}

/* ------------------------------------------------------------
   6b. Research achievements dialog (assets/js/member_achievements.js)
   One shared native <dialog>; per-member <template> content is cloned in.
   Desktop: centred card. <= 640px: bottom sheet.
   ------------------------------------------------------------ */
html.ach-lock {
  overflow: hidden;
}

.ach-dialog {
  width: min(640px, calc(100vw - 2rem));
  max-height: min(80vh, 760px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--tm-text);
  background: var(--tm-surface);
  border: 1px solid var(--tm-line-strong);
  border-radius: var(--tm-r-md);
  box-shadow: 0 24px 60px -20px rgba(15, 23, 42, 0.45);
}

.ach-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: ach-pop-in 0.2s ease both;
}

.ach-dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.ach-dialog[open]::backdrop {
  animation: ach-fade-in 0.2s ease both;
}

.ach-dialog.is-closing {
  animation: ach-pop-out 0.18s ease both;
}

.ach-dialog.is-closing::backdrop {
  animation: ach-fade-out 0.18s ease both;
}

.ach-dialog__panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
}

.ach-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--tm-s4);
  padding: var(--tm-s5) var(--tm-s6) var(--tm-s4);
  border-bottom: 1px solid var(--tm-line);
}

.ach-dialog__eyebrow {
  margin: 0;
  font-size: var(--tm-fs-2xs);
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tm-muted);
}

.ach-dialog__title {
  margin: var(--tm-s1) 0 0;
  font-family: var(--tm-font);
  font-size: var(--tm-fs-xl);
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.02em;
  color: var(--tm-ink);
}

.ach-dialog__summary {
  margin: var(--tm-s1) 0 0;
  font-size: var(--tm-fs-xs);
  line-height: 20px;
  color: var(--tm-muted);
}

.ach-dialog__close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: calc(var(--tm-s2) * -1) calc(var(--tm-s2) * -1) 0 0;
  font-size: 1.125rem;
  color: var(--tm-muted);
  background: transparent;
  border: 0;
  border-radius: var(--tm-r-sm);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.ach-dialog__close:hover,
.ach-dialog__close:focus-visible {
  color: var(--tm-ink);
  background: var(--tm-sunken);
}

.ach-dialog__close:focus-visible {
  outline: 2px solid var(--tm-accent);
  outline-offset: 2px;
}

.ach-dialog__body {
  min-height: 0;
  padding: var(--tm-s2) var(--tm-s6) var(--tm-s6);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ach-dialog__body:focus {
  outline: none;
}

.ach-group {
  margin-top: var(--tm-s5);
}

.ach-group__title {
  display: flex;
  align-items: baseline;
  gap: var(--tm-s2);
  margin: 0 0 var(--tm-s2);
  padding-bottom: var(--tm-s2);
  border-bottom: 1px solid var(--tm-line);
  font-family: var(--tm-font);
  font-size: var(--tm-fs-sm);
  font-weight: 600;
  line-height: 20px;
  color: var(--tm-ink);
}

.ach-group__count {
  font-size: var(--tm-fs-2xs);
  font-weight: 500;
  color: var(--tm-muted);
}

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

.ach-item {
  padding: var(--tm-s3) 0;
  border-bottom: 1px dashed var(--tm-line);
}

.ach-item:last-child {
  border-bottom: 0;
}

.ach-item__title {
  margin: 0;
  font-size: var(--tm-fs-sm);
  font-weight: 500;
  line-height: 20px;
  color: var(--tm-ink);
}

.ach-item__title a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--tm-line-strong);
  text-underline-offset: 3px;
}

.ach-item__title a:hover,
.ach-item__title a:focus-visible {
  color: var(--tm-accent);
  text-decoration-color: currentColor;
}

.ach-item__meta {
  margin: var(--tm-s1) 0 0;
  font-size: var(--tm-fs-xs);
  line-height: 20px;
  color: var(--tm-muted);
}

.ach-author--self {
  font-weight: 700;
  color: var(--tm-ink);
  text-decoration: underline;
  text-decoration-color: var(--tm-line-strong);
  text-underline-offset: 2px;
}

.ach-item__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-right: var(--tm-s1);
  padding: 1px var(--tm-s2);
  font-size: var(--tm-fs-xs);
  font-weight: 600;
  line-height: 18px;
  color: var(--tm-amber);
  background: var(--tm-amber-soft);
  border-radius: var(--tm-r-sm);
  vertical-align: baseline;
}

.ach-item__tag--sci {
  color: var(--tm-cobalt);
  background: var(--tm-cobalt-soft);
}

.ach-item__tag--cover {
  color: #7a5c00;
  background: linear-gradient(135deg, #fff8e7 0%, #fff1c5 100%);
  border: 1px solid #d4af37;
}

html[data-theme="dark"] .ach-item__tag--cover {
  color: #f3d46f;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22) 0%, rgba(212, 175, 55, 0.1) 100%);
  border-color: rgba(212, 175, 55, 0.6);
}

.ach-item__tag i {
  font-size: 0.88em;
}

.ach-item__tag--oral {
  color: #78350f;
  background: #fef3c7;
  border: 1px solid rgba(180, 83, 9, 0.25);
}

html[data-theme="dark"] .ach-item__tag--oral {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.ach-item__tag--poster {
  color: #064e3b;
  background: #d1fae5;
  border: 1px solid rgba(5, 150, 105, 0.28);
}

html[data-theme="dark"] .ach-item__tag--poster {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.38);
}

.ach-item__tag--award {
  color: #9f1239;
  background: #ffe4e6;
  border: 1px solid rgba(225, 29, 72, 0.28);
}

html[data-theme="dark"] .ach-item__tag--award {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(251, 113, 133, 0.38);
}

.ach-item__tag--patent {
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid rgba(2, 132, 199, 0.28);
}

html[data-theme="dark"] .ach-item__tag--patent {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.38);
}

@keyframes ach-pop-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes ach-pop-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@keyframes ach-sheet-in {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}

@keyframes ach-sheet-out {
  to {
    transform: translateY(100%);
  }
}

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

@keyframes ach-fade-out {
  to {
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .ach-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 16px 16px 0 0;
  }

  .ach-dialog[open] {
    animation-name: ach-sheet-in;
  }

  .ach-dialog.is-closing {
    animation-name: ach-sheet-out;
  }

  .ach-dialog__head {
    padding: var(--tm-s4) var(--tm-s4) var(--tm-s3);
  }

  .ach-dialog__body {
    padding: var(--tm-s1) var(--tm-s4) calc(var(--tm-s6) + env(safe-area-inset-bottom, 0px));
  }
}

/* ------------------------------------------------------------
   7. Motion & print
   ------------------------------------------------------------ */
/* Hide redundant English subtitles on PI profile when non-KO locale is active */
html[data-lang="en"] .pi-profile__en-sub,
html[data-lang="ja"] .pi-profile__en-sub,
html[data-lang="zh"] .pi-profile__en-sub {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .member-card[data-role]:hover {
    transform: none;
  }

  .member-card[data-role],
  .member-card,
  .intern-card,
  .link-icon,
  .pi-action,
  .pi-action i,
  .pi-contact a,
  .alumni-row__dest a,
  .team-tab,
  .team-tab::after,
  .member-card__ach-btn,
  .ach-dialog__close {
    transition: none;
  }

  .ach-dialog,
  .ach-dialog::backdrop,
  .ach-dialog.is-closing,
  .ach-dialog.is-closing::backdrop {
    animation: none !important;
  }

  .team-container.is-tabbed .team-tabpanel.is-animating {
    animation: none;
  }
}

@media print {
  .member-card__ach-btn {
    display: none !important;
  }

  .member-card,
  .pi-profile,
  .intern-card,
  .alumni-row {
    break-inside: avoid;
    box-shadow: none;
  }

  /* Never hide content on paper: all panels in sequence, no tab bar */
  .team-container.is-tabbed .team-tabnav {
    display: none;
  }

  .team-tabpanel,
  .team-tabpanel[hidden] {
    display: block !important;
    animation: none !important;
  }

  .team-container.is-tabbed .team-section__title--print-only {
    display: flex;
  }
}
