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

:root {
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --color-text: #000;
  --color-muted: #888;
  --color-border: #e0e0e0;
  --transition: 0.15s ease;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: #fff;
  color: var(--color-text);
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 40px 120px;
}

a { color: inherit; text-decoration: none; }


/* ── 헤더 ── */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: start;
  margin-bottom: 80px;
}
.intro h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0; }
.bio { font-size: 0.9375rem; line-height: 1.65; max-width: 630px; margin-bottom: 24px; }
.bio a { text-decoration: underline; text-underline-offset: 2px; }
.bio a:hover { opacity: 0.5; }
.links { display: flex; gap: 20px; font-size: 0.875rem; }
.links a { text-decoration: underline; text-underline-offset: 2px; transition: opacity var(--transition); }
.links a:hover { opacity: 0.5; }
.profile-img { width: 160px; height: 200px; object-fit: cover; border: none; display: block; }

/* ── 테이블 헤더 ── */
.projects-header {
  display: grid;
  grid-template-columns: 1fr 220px 80px;
  font-size: 0.875rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 10px;
}

.projects-header span:last-child {
  text-align: right;
}

/* ── 리스트 ── */
.projects-list { list-style: none; }
.project-item { border-bottom: 1px solid var(--color-border); }
.project-item.is-hovered { border-bottom: none; }

.project-item > a {
  display: grid;
  grid-template-columns: 1fr 220px 80px;
  align-items: center;
  padding: 16px 0;
  transition: opacity var(--transition);
}
.project-title  { font-size: 0.9375rem; font-weight: 400; }
.project-context { font-size: 0.9375rem; }
.project-date   { font-size: 0.9375rem; text-align: right; }

/* hover 시 나머지 흐리게 */
.projects-list.has-hover .project-item:not(.is-hovered) > a { opacity: 0.3; }

/* ── 인라인 프리뷰 컨테이너 (overflow hidden) ── */
.inline-preview {
  overflow: hidden;
  pointer-events: none; /* ★ 이미지 영역은 hover 이벤트 무시 */
  max-height: 0;
  opacity: 0;
  transition:
    max-height 0.3s ease,
    opacity 0.2s ease;
}
.inline-preview.open {
  max-height: 260px; /* 이미지 height + 여유 */
  opacity: 1;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: -1px;
}

.preview-inner {
  display: flex;
  gap: 14px;              /* 사진/영상 사이 간격 */
  align-items: stretch;
  transition: transform 0.05s linear;
  will-change: transform;
}

.preview-inner img,
.preview-inner video {
  flex: 0 0 auto;
  height: 240px;          /* 모든 media 높이 동일 */
  width: auto;            /* 너비는 비율에 따라 자유롭게 */
  object-fit: contain;      /* 잘라도 꽉 차게 : cover*/
  display: block;
}

/* ── 프로젝트 상세 ── */
/* .project-page { max-width: 900px; margin: 0 auto; padding: 60px 40px 120px; }
.project-page .back-link {
  display: inline-block; font-size: 0.875rem;
  text-decoration: underline; text-underline-offset: 2px;
  margin-bottom: 60px; transition: opacity var(--transition);
}
.project-page .back-link:hover { opacity: 0.5; }
.project-page h1 { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.project-page .meta { font-size: 0.875rem; color: var(--color-muted); margin-bottom: 48px; }
.project-page .hero-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; margin-bottom: 48px; display: block; }
.project-page .description { font-size: 0.9375rem; line-height: 1.7; max-width: 560px; } */
/* ─────────────────────────────
   PROJECT PAGE
───────────────────────────── */

body.project-page {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 60px 40px 120px;
}


/* Back */
.project-page .back-link {
  display: inline-block;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-bottom: 80px;
  transition: opacity 0.15s ease;
}

.project-page .back-link:hover {
  opacity: 0.5;
}


/* 전체 레이아웃 */
.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 20px;
  align-items: start;
}


/* ── Markdown 본문 ── */

.markdown-content {
  min-width: 0;
  max-width: 820px;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid #dcdcdc;
}

/* Markdown 표 */
.markdown-content table {
  width: 100%;
  min-width: 1200px;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 16px;
  line-height: 1.5;
}

.markdown-content th,
.markdown-content td {
  padding: 12px 14px;
  border: 1px solid #dcdcdc;
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}

.markdown-content th {
  background: #f5f5f5;
  font-weight: 700;
  white-space: nowrap;
}

/* 각 열 너비 */
.markdown-content th:nth-child(1),
.markdown-content td:nth-child(1) {
  min-width: 130px;
}

.markdown-content th:nth-child(2),
.markdown-content td:nth-child(2) {
  width: 70px;
  white-space: nowrap;
}

.markdown-content th:nth-child(3),
.markdown-content td:nth-child(3) {
  min-width: 330px;
}

.markdown-content th:nth-child(4),
.markdown-content td:nth-child(4) {
  min-width: 150px;
}

.markdown-content th:nth-child(5),
.markdown-content td:nth-child(5) {
  min-width: 160px;
}

.markdown-content th:nth-child(6),
.markdown-content td:nth-child(6) {
  min-width: 400px;
}

/* 제목 */
.markdown-content h1 {
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 700;

  margin-top: 72px;
  margin-bottom: 24px;
}

.markdown-content h1:first-child {
  margin-top: 0;
}


/* section */
.markdown-content h2 {
  font-size: 1.45rem;
  line-height: 1.25;
  font-weight: 700;

  margin-top: 64px;
  margin-bottom: 18px;
}


/* subsection */
.markdown-content h3 {
  font-size: 1.05rem;
  line-height: 1.4;
  font-weight: 600;

  margin-top: 36px;
  margin-bottom: 12px;
}


/* paragraph */
.markdown-content p {
  font-size: 0.9375rem;
  line-height: 1.7;

  margin-bottom: 20px;
}


/* 링크 */
.markdown-content a {
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* bold */
.markdown-content strong {
  font-weight: 600;
}


/* blockquote */
.markdown-content blockquote {
  border-left: 1px solid #d9d9d9;
  padding-left: 18px;

  margin-top: 0;
  margin-bottom: 48px;

  color: #555;
}

.markdown-content blockquote p {
  margin-bottom: 6px;
}


/* 리스트 */
.markdown-content ul,
.markdown-content ol {
  padding-left: 22px;
  margin: 16px 0 24px;
}

.markdown-content li {
  font-size: 0.9375rem;
  line-height: 1.7;
  margin-bottom: 6px;
}


/* 이미지 */
.markdown-content img {
  display: block;
  width: 100%;
  height: auto;

  margin: 36px 0;
}


/* 수식 */
.markdown-content .katex-display {
  margin: 32px 0;
  overflow-x: auto;
  overflow-y: hidden;
}


/* ── TABLE OF CONTENTS ── */

.project-toc {
  position: sticky;
  top: 60px;

  border-left: 1px solid #e0e0e0;
  padding-left: 22px;
}

.toc-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;

  color: #aaa;

  margin-bottom: 16px;
}

#toc {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

#toc a {
  font-size: 0.8125rem;
  line-height: 1.5;

  text-decoration: none;
  color: #555;

  transition: opacity 0.15s ease;
}

#toc a:hover {
  opacity: 0.45;
}

#toc .toc-sub {
  padding-left: 14px;
  color: #888;
}

/* ── ABOUT PAGE ── */

body.about-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 40px 120px;
}

.about-page .back-link {
  display: inline-block;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-bottom: 100px;
}

.about-content {
  max-width: 760px;
}

.about-header {
  margin-bottom: 120px;
}

.about-header h1 {
  font-size: 3rem;
  line-height: 1.05;
  margin-bottom: 30px;
}

.about-intro {
  font-size: 1.25rem;
  line-height: 1.6;
}

.about-section {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 40px;

  padding: 40px 0;
  border-top: 1px solid #e0e0e0;
}

.about-section h2 {
  font-size: 0.875rem;
  font-weight: 600;
}

.about-section p {
  font-size: 1rem;
  line-height: 1.7;
}

.about-links {
  display: flex;
  gap: 20px;
}

.about-links a {
  text-decoration: underline;
  text-underline-offset: 3px;
}



/* ── MOBILE ── */

@media (max-width: 900px) {

  body.project-page {
    padding: 40px 24px 80px;
  }

  .project-layout {
    grid-template-columns: 1fr;
  }

  .project-toc {
    display: none;
  }

  .project-page .back-link {
    margin-bottom: 60px;
  }

  .markdown-content h1 {
    font-size: 1.7rem;
  }
  .markdown-content table{
    min-width: 1000px;
  }

}




/* ── 반응형 ── */
@media (max-width: 600px) {
  body {
    padding: 40px 24px 80px;
  }

  .site-header {
    grid-template-columns: 1fr;
  }

  /* Project 한 칸만 */
  .projects-header,
  .project-item > a {
    grid-template-columns: 1fr;
  }

  /* Context + Date 숨기기 */
  .projects-header span:nth-child(2),
  .projects-header span:nth-child(3),
  .project-context,
  .project-date {
    display: none;
  }

  /* 모바일 preview */
  .preview-inner img,
  .preview-inner video {
    height: 180px;
    width: auto;
  }
}



/* ── 이름 ↔ 이미지 스왑 ── */
#name-hover {
  cursor: default;
  display: block;
  margin-bottom: 36px;
  /* 평소: 텍스트 높이만큼 */
  max-height: 2rem;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

#name-hover:hover {
  max-height: 220px;
}

#name-text {
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
  transition: opacity 0.2s ease;
}

#name-img {
  display: block;
  height: 200px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left; 
  border: none;
  margin-top: 0;
  opacity: 0;
  transition: opacity 0.2s ease 0.1s;
  pointer-events: none;
}

#name-hover:hover #name-text { opacity: 0; }
#name-hover:hover #name-img  { opacity: 1; }

/* ── footer ── */
.site-footer-bottom {
  margin-top: 200px;
  padding-bottom: 40px;
  font-size: 0.8125rem;
  color: var(--color-muted);
  text-align: right;
}

/* 모바일: 프로젝트 이미지를 손가락으로 좌우 스크롤 */
@media (hover: none), (pointer: coarse) {
  .inline-preview.open {
    max-height: 180px;
    overflow-x: auto;
    overflow-y: hidden;
    pointer-events: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;

    /* 스크롤바 숨기기 */
    scrollbar-width: none;
  }

  .inline-preview.open::-webkit-scrollbar {
    display: none;
  }

  .preview-inner {
    width: max-content;

    /* 데스크톱 마우스 이동 효과를 모바일에서 해제 */
    transform: none !important;
  }

  .preview-inner img,
  .preview-inner video {
    flex: 0 0 auto;
    width: auto;
    height: 180px;
  }
}