* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --text: #111111;
  --sub: #777777;
  --line: #e5e5e5;
  --pad: 48px;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  background: #ffffff;
  word-break: keep-all;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* 헤더 (상단 고정) */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  height: 72px;
  /* 배경·밑줄은 화면 전체, 로고·메뉴는 본문(1440px) 폭에 맞춤 */
  padding: 0 max(var(--pad), calc((100% - 1440px) / 2 + var(--pad)));
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
.logo { position: relative; display: block; }
.logo img { display: block; height: 20px; width: auto; }
/* 사무소 이름은 MJH 폭에 맞춰 자간을 벌린다 */
.logo-name {
  display: block; margin-top: 3px;
  font-size: 7.7px; font-weight: 400; line-height: 1;
  letter-spacing: 0.08em; margin-right: -0.08em; white-space: nowrap; color: var(--text);
}
.logo .logo-build { position: absolute; left: 0; top: 0; }
.logo.building img:first-child { visibility: hidden; }
.site-header nav { display: flex; gap: 32px; }
.site-header nav a {
  font-size: 14px; letter-spacing: 0.08em; line-height: 1;
  padding-left: 10px;
  border-left: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] { border-left-color: var(--text); }

/* 본문 폭 */
main, .site-footer {
  max-width: 1440px; margin: 0 auto;
  padding-left: var(--pad); padding-right: var(--pad);
}
main { padding-top: 96px; padding-bottom: 96px; }

/* 갤러리 */
.gallery { display: grid; grid-template-columns: 1fr; gap: 56px 40px; }
.card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--line); }
.card-title {
  display: block; margin-top: 14px;
  font-size: 15px; font-weight: 500; line-height: 1.5;
  text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 4px; transition: text-decoration-color 0.2s;
}
.card a:hover .card-title,
.card a:focus-visible .card-title { text-decoration-color: var(--text); }
.card-meta { display: block; font-size: 13px; line-height: 1.5; color: var(--sub); }

/* 프로젝트 상세 */
.project-head { margin-bottom: 32px; }
.project-head h1 { font-size: 22px; font-weight: 500; line-height: 1.4; }
.project-head .meta { font-size: 13px; color: var(--sub); }
.photos { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.photos img { width: 100%; height: auto; background: var(--line); }
.photos .photo-lead { grid-column: 1 / -1; }
.pager {
  display: flex; justify-content: space-between;
  margin-top: 64px; padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.pager .next { margin-left: auto; }
.pager a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* 정보 블록 (About, Contact) — 명함 뒷면의 세로선 */
.info-block {
  max-width: 640px; margin-bottom: 64px;
  padding-left: 28px; border-left: 1px solid var(--text);
}
.info-block h1 { font-size: 22px; font-weight: 500; line-height: 1.4; margin-bottom: 24px; }
.info-block h2 { font-size: 18px; font-weight: 500; line-height: 1.4; }
.info-block h2 span { margin-left: 8px; font-size: 13px; font-weight: 400; color: var(--sub); }
.info-block .en { font-size: 13px; color: var(--sub); }
.info-block p + p { margin-top: 12px; }
.history { margin-top: 16px; }
.contact dl { display: grid; grid-template-columns: 88px 1fr; row-gap: 8px; }
.contact dt { font-size: 13px; line-height: 27px; color: var(--sub); }
.contact a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* 푸터 */
.site-footer {
  padding-top: 24px; padding-bottom: 40px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--sub);
}
/* 헤더 메뉴와 같은 세로 가는 줄 */
.footer-addr { margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--sub); }
.copyright { margin-top: 4px; }

/* 반응형 */
@media (min-width: 640px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .photos { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 639px) {
  :root { --pad: 20px; }
  .site-header { height: 60px; }
  .site-header nav { gap: 18px; }
  main { padding-top: 48px; }
}

.gallery-pager { display: flex; justify-content: center; gap: 24px; margin-top: 80px; font-size: 14px; letter-spacing: 0.04em; }
.gallery-pager a { color: #777; padding: 4px 2px; }
.gallery-pager a:hover, .gallery-pager a[aria-current] { color: #111; }
.gallery-pager a[aria-current] { border-bottom: 1px solid #111; }

/* 첫 방문 로고 인트로: 먹색 막 위에서 흰 로고를 짓고, 막이 위로 걷히며 로고는 헤더 자리로 올라가 박힌다 */
.intro { display: none; }
.intro-on .intro {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.intro::before {
  content: ""; position: absolute; inset: 0;
  background: #111;
  transition: transform 0.9s cubic-bezier(.65,0,.35,1);
}
.intro.docking::before { transform: translateY(-100%); }
.intro img {
  position: relative;
  width: min(50vw, 560px);
  transform-origin: 0 0;
  transition: transform 0.9s cubic-bezier(.65,0,.35,1), filter 0.5s 0.2s;
}
/* 흰 바탕 헤더로 들어가며 흰 로고가 검정이 된다 */
.intro.docking img { filter: invert(1); }
.intro-on .logo img { visibility: hidden; }
.intro-hint {
  position: absolute; bottom: 48px; left: 0; right: 0; text-align: center;
  font-size: 12px; letter-spacing: 0.08em; color: #888;
  opacity: 0; animation: intro-hint 0.6s 0.8s forwards;
}
.intro.docking .intro-hint { visibility: hidden; }
@keyframes intro-hint { to { opacity: 1; } }
.intro-on { overflow: hidden; }
/* 로고가 올라가는 순간 본문이 아래에서 올라온다 */
.intro-on main, .intro-on .site-footer { opacity: 0; transform: translateY(48px); }
.intro-reveal main, .intro-reveal .site-footer {
  opacity: 1; transform: none;
  transition: opacity 0.6s 0.35s, transform 0.9s 0.35s cubic-bezier(.22,1,.36,1);
}
/* 다 짓기 전에 건너뛰면 짓던 로고는 날아가며 사라지고, 헤더 로고가 서서히 나타난다 */
.intro.early img { opacity: 0; transition: transform 0.9s cubic-bezier(.65,0,.35,1), opacity 0.4s; }
.intro-on.skipped .logo img:first-child { visibility: visible; animation: intro-hint 0.6s 0.3s backwards; }
