/* IMLab — 글자 두 개(I·M)로 묶는 정적 사이트. 프레임워크 없음. */

:root {
  --paper: #F6F4EE;
  --ink: #1C2024;
  --teal: #0E7C72;
  --mist: #626A72;
  --hero-f: #7A828A;   /* 첫 화면 회색 글자 전용(큰 글자, 3:1 기준) */
  --gold: #805C00;
  --line: rgba(28, 32, 36, 0.12);
  --card: #FFFFFF;
  --soft: #EEF4F2;
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-serif: Fraunces, Georgia, "Times New Roman", serif;
  --max: 1080px;
  --measure: 680px;
  --gutter: 24px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181B;
    --ink: #E9E6DF;
    --teal: #3FD1C1;
    --mist: #8A929A;
    --hero-f: #8A929A;
    --gold: #D8B24A;
    --line: rgba(233, 230, 223, 0.14);
    --card: #1C2024;
    --soft: #1F2A28;
  }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.fonts-ready { scroll-behavior: smooth; }   /* 글꼴이 바뀐 뒤에만 (첫 방문 딥링크가 어긋나지 않게) */
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  font-feature-settings: "tnum" 1;
  overflow-x: hidden;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
@media (max-width: 640px) { body { font-size: 16px; } }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h2 { font-size: clamp(22px, 2.6vw, 28px); }
h3 { font-size: 19px; }
p { margin: 0 0 1em; }
.measure { max-width: var(--measure); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[id] { scroll-margin-top: 76px; }   /* 고정 머리글 아래로 앵커가 들어가지 않게 */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* I·M 앵커 — 영어 표어·로고에서 I 와 M 만 청록 */
.im { font-family: var(--font-serif); font-weight: 600; letter-spacing: 0.01em; }
.im b { color: var(--teal); font-weight: inherit; }

/* 머리글 */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.logo { font-family: var(--font-serif); font-size: 24px; font-weight: 600; color: var(--ink); letter-spacing: 0.01em; white-space: nowrap; flex: none; }
.logo:hover { text-decoration: none; }
.logo b { color: var(--teal); font-weight: inherit; }
.nav { display: flex; gap: 22px; margin-left: 8px; }
.nav a { color: var(--ink); font-size: 15px; font-weight: 600; padding: 6px 0; }
.nav a[aria-current="page"] { color: var(--teal); box-shadow: inset 0 -2px 0 var(--teal); }
.nav a:hover { text-decoration: none; color: var(--teal); }
.header-spacer { flex: 1; }
.header-review { white-space: nowrap; flex: none; }
@media (max-width: 360px) { .site-header .wrap { gap: 10px; } .btn.header-review { padding: 8px 10px; } }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--teal);
  color: var(--teal); background: transparent; font-weight: 700; font-size: 15px; line-height: 1.2;
  cursor: pointer; transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: var(--teal); color: var(--paper); }
.btn.primary:hover { color: var(--paper); }
.btn .lock { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn small { font-weight: 500; }
.menu-btn { display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; }
.menu-btn span { display: block; width: 18px; height: 2px; background: currentColor; margin: 3px auto; }
@media (max-width: 760px) {
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; gap: 0; padding: 8px var(--gutter) 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav a[aria-current="page"] { box-shadow: none; }
  .site-header.nav-open .nav { display: flex; }
  .menu-btn { display: block; }
  .header-review small { display: none; }
}

/* 첫 장면 */
.hero { padding: clamp(48px, 9vw, 112px) 0 clamp(40px, 7vw, 80px); }
.eyebrow { color: var(--mist); font-size: 14px; font-weight: 600; letter-spacing: 0.06em; margin-bottom: 14px; }
.hero-word {
  position: relative;
  font-family: var(--font-serif); font-weight: 600;
  font-size: clamp(28px, 9.4vw, 104px);   /* 어느 폭에서도 'Internal Medicine' 이 한 줄(대체 글꼴 포함) */
  line-height: 1.08;
  height: 1.2em;            /* 한 줄 고정 */
  margin-bottom: 0.25em;
  white-space: nowrap;
}
.hero-word .hw-state { position: absolute; left: 0; top: 0; white-space: nowrap; opacity: 0; transition: opacity 150ms ease; }
.hero-word .hw-state.on { opacity: 1; transition: opacity 240ms ease 110ms; }
.hero-word .a { color: var(--teal); }
.hero-word .f { color: var(--hero-f); }
.hero-word .hw-state.hide-m .a.m { visibility: hidden; }
.hero-word .hw-float { position: absolute; top: 0; left: 0; color: var(--teal); will-change: transform; pointer-events: none; }
.hero-word .hw-state.typing .f.first span { display: inline-block; opacity: 0; transform: translateY(0.15em); animation: letterIn 220ms ease-out forwards; }
@keyframes letterIn { to { opacity: 1; transform: none; } }
.hero-word.static .hw-state { transition: none; }

.hero-title { font-size: clamp(26px, 3.6vw, 40px); font-weight: 700; margin: 0 0 16px; }
.hero-title .hl { position: relative; display: inline-block; }
.hero-title .hl::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px;
  background: var(--teal); transform: scaleX(0); transform-origin: left; transition: transform 300ms ease;
}
.hero-title .hl.on::after { transform: scaleX(1); }
.hero-sub { max-width: var(--measure); font-size: 18px; color: var(--ink); opacity: 0.9; margin-bottom: 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-serif); font-size: 14px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--mist); background: transparent; cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}
.chip b { color: var(--teal); font-weight: 600; }
.chip:hover, .chip.on { border-color: var(--teal); color: var(--ink); }

/* 섹션 */
.section { padding: clamp(36px, 6vw, 72px) 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head .more { font-weight: 700; font-size: 15px; white-space: nowrap; padding: 6px 0; }
.tag { display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 6px; color: var(--teal); background: var(--soft); }
.tag.gold { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.tag.ink { color: var(--mist); background: color-mix(in srgb, var(--mist) 6%, transparent); }

.cards { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .cards { grid-template-columns: 1fr; } }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 22px 18px;
  transition: transform 120ms ease;
}
.card:hover { transform: translateY(-2px); }
.card h3 { margin-bottom: 8px; }
.card p { margin: 0; color: var(--ink); opacity: 0.88; font-size: 16px; }
.card .im { font-size: 22px; display: block; margin-bottom: 6px; }

/* 흐름 띠 */
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; counter-reset: step; margin: 8px 0 12px; }
.flow .step { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 18px 16px; }
.flow .step::before { counter-increment: step; content: counter(step); font-family: var(--font-serif); color: var(--teal); font-size: 15px; font-weight: 600; display: block; margin-bottom: 6px; }
.flow .step strong { display: block; font-size: 17px; margin-bottom: 4px; }
.flow .step span { font-size: 15px; color: var(--mist); }
.flow-return { display: flex; align-items: center; gap: 10px; color: var(--mist); font-size: 15px; }
.flow-return svg { width: 42px; height: 16px; fill: none; stroke: var(--teal); stroke-width: 1.6; flex: none; }
.flow-return svg .shaft { stroke-dasharray: 3 3; }
@media (max-width: 960px) { .flow { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .flow { grid-template-columns: 1fr; } }

/* 지금 하는 일 */
.now { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 760px) { .now { grid-template-columns: 1fr; } }
.now .card h3 { font-family: var(--font-serif); font-size: 26px; }
.now .meta { margin-top: 12px; font-size: 14px; color: var(--mist); opacity: 1; }

/* 사람 줄 */
.people { display: flex; flex-wrap: wrap; gap: 14px 20px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none; overflow: hidden;
  background: var(--soft); color: var(--teal); display: grid; place-items: center;
  font-family: var(--font-serif); font-weight: 600; font-size: 22px; border: 1px solid var(--line);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person strong { display: block; font-size: 16px; }
.person span { font-size: 14px; color: var(--mist); }
.person .avatar span { font-size: 22px; color: var(--teal); }

/* 함께 하기 */
.join { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .join { grid-template-columns: 1fr; } }
.join .card { display: flex; flex-direction: column; align-items: flex-start; }
.join .card p { margin-bottom: 14px; }
.join .card .btn { margin-top: auto; }

/* 바닥글 */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--mist); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; }
.site-footer a { padding: 4px 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.site-footer .logo { font-size: 20px; }
.site-footer .ai-note { flex-basis: 100%; margin: 0; }

/* 소개 페이지 */
.page-head { padding: clamp(40px, 7vw, 80px) 0 clamp(24px, 4vw, 40px); }
.page-head .im { font-size: clamp(28px, 4.5vw, 44px); display: block; margin-bottom: 10px; }
.page-head h1 { font-size: clamp(26px, 3.6vw, 38px); }
.page-head .lede { font-size: 18px; max-width: var(--measure); }
.wrap.prose { max-width: var(--max); }
.prose > * { max-width: var(--measure); }
.prose h2 { margin-top: 0; }
.timeline-cohorts { display: grid; gap: 10px; max-width: 420px; margin-top: 16px; }
.plate { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--card); }
.plate.empty { border-style: dashed; color: var(--mist); background: transparent; }
.plate .im { font-size: 18px; display: inline; }
.plate span { color: var(--mist); font-size: 14px; margin-left: 8px; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { position: relative; padding: 0 0 22px 44px; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--teal); color: var(--teal); display: grid; place-items: center; font-family: var(--font-serif); font-weight: 600; font-size: 15px; background: var(--paper); }
.steps li::after { content: ""; position: absolute; left: 14px; top: 34px; bottom: 0; border-left: 1.5px solid var(--line); }
.steps li:last-child::after { border-left-style: dashed; border-left-color: var(--teal); }
.steps li strong { display: block; font-size: 18px; margin-bottom: 2px; }
.steps li p { margin: 0; color: var(--ink); opacity: 0.88; }
.principles { padding-left: 0; list-style: none; counter-reset: p; display: grid; gap: 10px; }
.principles li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 14px 48px; position: relative; }
.principles li::before { counter-increment: p; content: counter(p); position: absolute; left: 16px; top: 14px; font-family: var(--font-serif); color: var(--teal); font-weight: 600; }
details { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; background: var(--card); margin-bottom: 10px; }
details summary { cursor: pointer; font-weight: 700; }
details p { margin: 10px 0 0; }
.note { color: var(--mist); font-size: 14px; }

/* 구성원 페이지 */
.cohort-plate { display: inline-flex; align-items: baseline; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; background: var(--card); margin: 6px 0 18px; font-size: 16px; font-weight: 400; line-height: 1.4; }
.cohort-plate .im { font-size: 20px; }
.cohort-plate span { color: var(--mist); font-size: 13.5px; }
.member-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .member-grid { grid-template-columns: 1fr; } }
.member { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: start; }
.member .avatar { width: 72px; height: 72px; font-size: 28px; }
.member h3 { font-size: 21px; margin-bottom: 2px; }
.member .affil { color: var(--ink); opacity: 0.88; font-size: 15.5px; margin: 0 0 4px; }
.member .role { color: var(--mist); font-size: 14.5px; margin: 0 0 8px; opacity: 1; }
.member .intro { font-size: 15px; margin: 6px 0 8px; }
.member .tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* 전당 */
.hall-group { margin-bottom: 36px; }
.hall-group h2 { display: flex; align-items: center; gap: 10px; }
.rail { position: relative; padding-left: 28px; }
.rail::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; border-left: 2px solid var(--line); }
.plaque { position: relative; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 20px 22px 18px; margin-bottom: 16px; }
.plaque::before { content: ""; position: absolute; left: -24px; top: 24px; width: 10px; height: 10px; border-radius: 50%; background: var(--mist); }
.plaque.done { border-color: var(--gold); }
.plaque.done::before { background: var(--gold); }
.plaque.making { border-color: var(--teal); }
.plaque.making::before { background: var(--teal); }
.plaque.empty { border-style: dashed; background: transparent; color: var(--mist); }
.plaque.empty::before { background: transparent; border: 1.5px dashed var(--mist); }
.plaque .top { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.plaque .num { font-family: var(--font-serif); color: var(--gold); font-weight: 600; letter-spacing: 0.08em; }
.plaque h3 { font-family: var(--font-serif); font-size: 26px; margin-bottom: 6px; }
.plaque .line { margin: 0 0 12px; }
.plaque dl { display: grid; grid-template-columns: 72px 1fr; gap: 4px 12px; margin: 0; font-size: 14.5px; }
.plaque dt { color: var(--mist); }
.plaque dd { margin: 0; }
.plaque dd a { display: inline-block; padding: 4px 0; }
.note a { padding: 4px 0; }
.plaque .note { margin-top: 10px; }

/* 움직임 줄이기 — 다른 규칙보다 뒤에 두어야 이긴다 */
@media (prefers-reduced-motion: reduce) {
  html.fonts-ready { scroll-behavior: auto; }
  .hero-title .hl::after, .card, .btn, .chip, .hero-word .hw-state, .hero-word .hw-state.on { transition: none; }
  .card:hover, .btn:hover { transform: none; }
}
