/* ==========================================================================
   main.css  -  사이트 전체 디자인 파일
   --------------------------------------------------------------------------
   [색을 바꾸고 싶을 때]
   바로 아래 "디자인 설정값" 의 색상 코드(예: #a63d22)만 바꾸시면 됩니다.
   - --accent        : 포인트 색 (링크, 배지, 강조). 사이트의 '대표 색' 입니다.
   - --bg / --text   : 배경 / 글자 색
   - 두 번째 블록(@media (prefers-color-scheme: dark))은 방문자가 '다크 모드'를
     쓸 때의 색입니다. 라이트 모드 색을 바꿨다면 이쪽도 같이 맞춰 주세요.
   그 아래 코드는 모양(배치)을 담당하므로 특별한 이유가 없다면 건드리지 않아도 됩니다.
   ========================================================================== */

/* ---------- 디자인 설정값 (라이트 모드) ---------- */
:root {
  --bg: #faf9f6;            /* 페이지 배경 */
  --surface: #ffffff;       /* 카드·표 배경 */
  --surface-2: #f1eee7;     /* 이미지가 없을 때 타일, 코드 배경 */
  --text: #1c1b19;          /* 본문 글자 */
  --text-muted: #5d5952;    /* 보조 글자(날짜, 라벨) */
  --border: #e3ded3;        /* 얇은 구분선 */
  --accent: #a63d22;        /* 포인트 색 */
  --accent-soft: #f6e7e0;   /* 포인트 색의 연한 배경 */
  --on-accent: #ffffff;     /* 포인트 색 위에 올리는 글자 */
  --shadow: 0 1px 2px rgba(28, 27, 25, .05), 0 10px 28px -14px rgba(28, 27, 25, .22);

  /* 코드 강조 색 */
  --tok-comment: #6c675e;
  --tok-keyword: #a63d22;
  --tok-string: #2c6a4f;
  --tok-number: #8a5a12;

  /* 글꼴 (웹폰트 없이 기기에 설치된 글꼴을 사용합니다) */
  --font: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo",
          "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "D2Coding", monospace;

  /* 크기 */
  --radius: 14px;
  --page-width: 1040px;     /* 페이지 최대 폭 */
}

/* ---------- 디자인 설정값 (다크 모드) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1d1c1a;
    --surface-2: #262421;
    --text: #ece9e3;
    --text-muted: #a9a49a;
    --border: #34312c;
    --accent: #ec8f70;
    --accent-soft: #3a2620;
    --on-accent: #141311;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 30px -14px rgba(0, 0, 0, .7);

    --tok-comment: #9a958b;
    --tok-keyword: #ec8f70;
    --tok-string: #8fcf9f;
    --tok-number: #e3b564;
  }
}

/* ==========================================================================
   이 아래는 모양(배치) 코드입니다.
   ========================================================================== */

/* ---------- 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; }
img { display: block; }

a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

::selection { background: var(--accent); color: var(--on-accent); }

.wrap {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 2.5rem);
}

.site-main { flex: 1 0 auto; outline: none; }

/* 건너뛰기 링크 (키보드 사용자용) */
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  padding: .6rem 1rem; border-radius: 8px;
  background: var(--text); color: var(--bg); text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- 헤더 / 푸터 ---------- */
.site-header { border-bottom: 1px solid var(--border); }
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .6rem 1.25rem; min-height: 4rem; padding-block: .5rem;
}
.site-title {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--text); font-weight: 700; font-size: 1.0625rem;
  letter-spacing: -.01em; text-decoration: none;
}
.site-title::before {
  content: ""; width: .7rem; height: .7rem; border-radius: 3px;
  background: var(--accent);
}
.site-nav {
  display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .9rem;
}
.site-nav__link {
  padding: .3rem .4rem;
  color: var(--text-muted); font-size: .9375rem; font-weight: 500;
  text-decoration: none; border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.site-nav__link:hover { color: var(--accent); text-decoration: none; }
.site-nav__link[aria-current="page"] {
  color: var(--text); font-weight: 700; border-bottom-color: var(--accent);
}
.site-nav__link--pdf {
  padding: .24rem .75rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: .84rem; font-weight: 600; color: var(--text);
}
.site-nav__link--pdf:hover { border-color: var(--accent); color: var(--accent); }

.site-footer {
  margin-top: clamp(4rem, 9vw, 7rem);
  border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: .875rem;
}
.site-footer__inner { padding-block: 2rem; }

/* ---------- 공통 부품: 태그, 배지, 버튼 ---------- */
.tags { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; }
.tag {
  padding: .1rem .65rem; border-radius: 999px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: .8125rem; line-height: 1.6;
}

.badge {
  display: inline-block; padding: .12rem .65rem; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-size: .75rem; font-weight: 700; letter-spacing: .02em; line-height: 1.6;
}

.btn {
  display: inline-block; padding: .6rem 1.2rem; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: .9375rem; font-weight: 600; line-height: 1.4;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 메인: 프로필 ---------- */
.profile {
  display: grid;
  gap: clamp(1.75rem, 4vw, 2.5rem);
  padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(2.5rem, 5vw, 3.5rem);
}
.profile__hero {
  display: grid;
  gap: 1.5rem 2.5rem;
}
.avatar {
  width: 112px; height: 112px; border-radius: 50%;
  object-fit: cover; object-position: center 20%;
  background: var(--surface-2);
  border: 2px solid var(--border);
}
.avatar--initial {
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 2.5rem; font-weight: 700;
}
.profile__role {
  margin-bottom: .4rem; color: var(--accent);
  font-size: .9375rem; font-weight: 700; letter-spacing: .03em;
}
.profile__name {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 800; letter-spacing: -.035em; line-height: 1.12;
}
.profile__contacts {
  display: flex; flex-wrap: wrap; gap: .5rem;
  list-style: none; margin-top: 1rem;
}
.contact-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .3rem .8rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: .875rem; font-weight: 500;
  text-decoration: none; font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, color .15s ease;
}
a.contact-pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.contact-pill__k {
  color: var(--accent); font-size: .75rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.profile__bio { margin-top: 1.25rem; max-width: 46rem; font-size: 1.0625rem; color: var(--text); }
.profile__bio p + p { margin-top: .75rem; }

/* 핵심 지표 카드 */
.profile__metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
}
.metric-card {
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.metric-card__value {
  display: flex; align-items: baseline; gap: .2rem;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.metric-card__num {
  font-size: clamp(1.65rem, 3.5vw, 2.15rem);
  font-weight: 800; letter-spacing: -.03em; color: var(--accent);
}
.metric-card__unit {
  font-size: .9375rem; font-weight: 700; color: var(--text);
}
.metric-card__label {
  margin-top: .45rem; font-size: .9375rem; font-weight: 700; color: var(--text);
}
.metric-card__sub {
  margin-top: .2rem; font-size: .8125rem; color: var(--text-muted); line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

/* 프로필 하위 섹션 공통 헤더 */
.block-head {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap;
  gap: .4rem 1rem; margin-bottom: 1rem;
  padding-bottom: .55rem; border-bottom: 1px solid var(--border);
}
.block-head__title { font-size: 1.125rem; font-weight: 800; letter-spacing: -.02em; }
.block-head__meta { font-size: .8125rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* 경력 타임라인 카드 */
.career-list { display: grid; gap: 1rem; }
.career-card {
  display: grid; gap: 1rem 1.75rem;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.career-card__period {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  font-size: .8125rem; font-weight: 600; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.career-card__dur {
  padding: .05rem .5rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: .75rem; font-weight: 700;
}
.career-card__company { margin-top: .35rem; font-size: 1.125rem; font-weight: 800; }
.career-card__role { margin-top: .2rem; font-size: .875rem; color: var(--text-muted); font-weight: 500; }
.career-card__tags { margin-bottom: .8rem; }
.tag--accent {
  background: var(--accent-soft); border-color: transparent;
  color: var(--accent); font-weight: 600;
}
.career-card__points {
  padding-left: 1.15em; display: grid; gap: .45rem;
  font-size: .9375rem; line-height: 1.6; color: var(--text);
}
.career-card__points li::marker { color: var(--accent); }
.career-card__points strong { color: var(--text); font-weight: 700; }
.career-card__points code {
  padding: .08em .38em; border-radius: 5px; background: var(--surface-2);
  font-family: var(--font-mono); font-size: .84em;
}

/* 2열 하단 박스: 보유 스킬 + 학력·자격·수상 */
.profile__grid-2col {
  display: grid; gap: 1.25rem;
}
.profile__box {
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.skill-groups { display: grid; gap: .95rem; }
.skill-group__title {
  margin-bottom: .45rem; font-size: .8125rem; font-weight: 700;
  color: var(--text-muted); letter-spacing: .02em;
}

.timeline-compact { list-style: none; display: grid; gap: .7rem; }
.timeline-compact__item {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .75rem; align-items: start;
}
.timeline-compact__badge {
  display: inline-block; min-width: 5.5rem; text-align: center;
  padding: .15rem .55rem; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: .75rem; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.5;
}
.timeline-compact__badge--edu {
  background: var(--accent-soft); border-color: transparent; color: var(--accent);
}
.timeline-compact__content {
  display: flex; flex-direction: column; gap: .1rem;
  font-size: .9375rem; line-height: 1.45;
}
.timeline-compact__content strong { font-weight: 700; color: var(--text); }
.timeline-compact__content span { font-size: .8125rem; color: var(--text-muted); }

/* ---------- 메인: 목록 · 아카이브 탐색 영역 ---------- */
.section { padding-block: 0; position: relative; }
.anchor-alias { position: absolute; top: 0; left: 0; }
.section-head {
  display: flex; flex-direction: column; gap: .4rem;
  padding-top: 1.5rem; margin-bottom: 1.25rem;
  border-top: 1px solid var(--text);
  scroll-margin-top: 1rem;
}
.layout-archive .post-browser { padding-top: clamp(2rem, 5vw, 3.25rem); }
.layout-archive .section-head { padding-top: 0; border-top: 0; }
.section-head__row {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem 1rem;
}
.section-head__left { display: flex; align-items: baseline; gap: .7rem; }
.section-head__title { font-size: 1.375rem; font-weight: 800; letter-spacing: -.02em; }
.layout-archive .section-head__title { font-size: clamp(1.75rem, 4vw, 2.35rem); letter-spacing: -.03em; }
.section-head__count { color: var(--text-muted); font-size: 1rem; font-variant-numeric: tabular-nums; }
.section-head__more { font-size: .9rem; font-weight: 600; text-decoration: none; color: var(--accent); }
.section-head__more:hover { text-decoration: underline; }
.section-head__desc { color: var(--text-muted); font-size: .9375rem; line-height: 1.55; }
.empty { padding: 3rem 0; color: var(--text-muted); }

/* 카테고리 · 보기 전환 툴바 */
.post-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem 1rem;
  margin-bottom: 1.5rem;
  padding: .8rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.cat-tabs { display: flex; flex-wrap: wrap; gap: .45rem; }
.cat-tab {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .34rem .85rem; border-radius: 999px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.cat-tab:hover { border-color: var(--accent); color: var(--text); }
.cat-tab.is-active {
  border-color: var(--accent); background: var(--accent); color: var(--on-accent);
}
.cat-tab__count {
  font-size: .75rem; font-weight: 700; opacity: .82;
  font-variant-numeric: tabular-nums;
}

.view-toggle {
  display: inline-flex; padding: 2px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
}
.view-toggle__btn {
  padding: .28rem .75rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-muted);
  font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.view-toggle__btn.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.card-grid {
  display: grid; gap: 1.75rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background-color .15s ease;
}
.card[hidden] { display: none; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: transparent; }
.card__media { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.card__img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card__img { transform: scale(1.03); }
.card__placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(128, 120, 105, .09) 14px 15px),
    var(--surface-2);
}
.card__placeholder span { font-size: 3.5rem; font-weight: 800; color: var(--accent); opacity: .55; }
.card .badge { position: absolute; top: .75rem; left: .75rem; }

.card__body { display: flex; flex-direction: column; gap: .5rem; padding: 1.15rem 1.25rem 1.35rem; flex: 1; }
.card__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .4rem;
  color: var(--text-muted); font-size: .8125rem; font-variant-numeric: tabular-nums;
}
.card__cat {
  padding: .04rem .45rem; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent);
  font-size: .75rem; font-weight: 700; line-height: 1.5;
}
.card__pin {
  padding: .04rem .42rem; border-radius: 5px;
  background: var(--accent); color: var(--on-accent);
  font-size: .72rem; font-weight: 700; line-height: 1.5;
}
.post-collection:not([data-view="list"]) .card__pin { display: none; }
.card__sep { margin-inline: .1rem; }
.card__title { font-size: 1.1875rem; font-weight: 700; line-height: 1.38; }
.card__link { color: var(--text); text-decoration: none; }
.card__link:hover { color: var(--accent); }
/* 카드 전체를 클릭 영역으로 만듭니다 (링크는 카드당 1개) */
.card__link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card__link:focus-visible { outline: none; }
.card__link:focus-visible::after { outline: 3px solid var(--accent); outline-offset: -3px; }
.card__summary {
  color: var(--text-muted); font-size: .9375rem; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__tags { margin-top: auto; padding-top: .5rem; }

/* 목록 보기(List View) 전환 */
.post-collection[data-view="list"] {
  grid-template-columns: 1fr; gap: 0;
  border-top: 2px solid var(--text);
}
.post-collection[data-view="list"] .card {
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  background: transparent; box-shadow: none;
}
.post-collection[data-view="list"] .card:hover {
  transform: none; box-shadow: none; background: var(--surface); border-bottom-color: var(--border);
}
.post-collection[data-view="list"] .card__media { display: none; }
.post-collection[data-view="list"] .card__body { padding: 1.05rem .75rem; gap: .35rem; }
.post-collection[data-view="list"] .card__summary { -webkit-line-clamp: 2; }
.post-collection[data-view="list"] .card__tags { margin-top: .25rem; padding-top: 0; }
.post-collection[data-view="list"] .card__link::after { border-radius: 0; }

@media (min-width: 768px) {
  .post-collection[data-view="list"] .card__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 15.5rem;
    gap: .3rem 1.5rem;
    align-items: start;
  }
  .post-collection[data-view="list"] .card__title,
  .post-collection[data-view="list"] .card__summary,
  .post-collection[data-view="list"] .card__tags { grid-column: 1; }
  .post-collection[data-view="list"] .card__meta {
    grid-column: 2; grid-row: 1 / span 3;
    justify-self: end; justify-content: flex-end; text-align: right;
  }
}

/* ---------- 하위 페이지(글) ---------- */
.post { padding-block: clamp(2rem, 6vw, 4rem) 0; }

.post__header { max-width: 46rem; margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.post__kicker { margin-bottom: .65rem; }
.cat-pill {
  display: inline-block; padding: .16rem .75rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: .8125rem; font-weight: 700; letter-spacing: .02em; text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.cat-pill:hover { background: var(--accent); color: var(--on-accent); text-decoration: none; }
.post__title {
  font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 800;
  letter-spacing: -.03em; line-height: 1.22;
}

.meta {
  display: flex; flex-wrap: wrap; gap: .85rem 2.25rem;
  margin: 1.5rem 0 0;
}
.meta__item { min-width: 0; }
.meta dt {
  color: var(--text-muted); font-size: .6875rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.meta dd { margin: 0; font-size: .9375rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.post__tags { margin-top: 1.1rem; }
.post__actions { margin-top: 1.25rem; }
.profile__actions { margin-top: 1.75rem; }   /* '전체 슬라이드 PDF' 버튼 */

.post__layout { display: grid; gap: clamp(1.75rem, 4vw, 2.75rem); grid-template-columns: minmax(0, 1fr); }
.post__media, .post__body { min-width: 0; }

/* 그림 */
.figure { margin: 0; }
.figure img { width: 100%; border-radius: var(--radius); background: var(--surface-2); }
.figure__caption { margin-top: .6rem; color: var(--text-muted); font-size: .875rem; line-height: 1.55; }

/* image-top : 큰 이미지 위, 글 아래 */
.post--image-top .post__media .figure img { max-height: min(72vh, 620px); object-fit: cover; }
.post--image-top .post__body { max-width: 68ch; }

/* image-left / image-right : 데스크톱에서 2열 */
.post--image-left .post__media .figure img,
.post--image-right .post__media .figure img { max-height: min(70vh, calc(100vh - 7rem)); object-fit: cover; } /* 스크롤 중 고정될 때도 이미지 전체가 화면에 들어오도록 높이 제한 */

@media (min-width: 768px) {
  .post--image-left:not(.post--no-media) .post__layout,
  .post--image-right:not(.post--no-media) .post__layout {
    grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
    column-gap: clamp(2rem, 5vw, 3.5rem);
    align-items: start;
  }
  .post--image-right:not(.post--no-media) .post__layout { grid-template-columns: minmax(0, 58fr) minmax(0, 42fr); }
  .post--image-right:not(.post--no-media) .post__media { order: 2; }
  .post--image-left:not(.post--no-media) .post__media,
  .post--image-right:not(.post--no-media) .post__media { position: sticky; top: 1.5rem; align-self: start; } /* 긴 글을 읽는 동안 이미지가 따라옴 */
}

/* gallery : 이미지 여러 장을 비율 그대로 배치 */
.gallery { list-style: none; column-width: 260px; column-gap: 1.25rem; }
.gallery__item { break-inside: avoid; margin-bottom: 1.25rem; }
.post--gallery .post__body { max-width: 68ch; }

/* text-only, 이미지 없음 : 본문만 */
.post--text-only .post__body,
.post--no-media .post__body { max-width: 68ch; }
.post--no-media .post__layout { grid-template-columns: minmax(0, 1fr); }

/* 이전/다음 글 */
.post__nav {
  display: grid; grid-template-columns: 1fr; gap: .75rem;
  margin-top: clamp(3rem, 7vw, 5rem); padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.post__nav-link {
  display: flex; flex-direction: column; gap: .15rem; min-width: 0;
  padding: .9rem 1.1rem; border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.post__nav-link:hover { border-color: var(--accent); background: var(--surface); }
.post__nav-label { color: var(--text-muted); font-size: .8125rem; }
.post__nav-title { font-weight: 600; line-height: 1.4; }
.post__nav-link--next { text-align: right; }
.post__nav-link--list { text-align: center; }
@media (min-width: 768px) {
  .post__nav { grid-template-columns: 1fr minmax(8rem, auto) 1fr; align-items: stretch; }
}

/* ---------- 본문 서식 (마크다운 결과) ---------- */
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre,
.prose table, .prose figure, .prose .highlighter-rouge { margin: 0 0 1.3em; }
.prose h2 { margin: 2.4em 0 .7em; font-size: 1.5rem; font-weight: 800; letter-spacing: -.025em; }
.prose h3 { margin: 2em 0 .5em; font-size: 1.2rem; font-weight: 700; }
.prose h4 { margin: 1.6em 0 .4em; font-size: 1.0625rem; font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--accent); }
.prose a { font-weight: 500; }
.prose strong { font-weight: 700; }
.prose hr { margin: 2.5em 0; border: 0; border-top: 1px solid var(--border); }
.prose img { border-radius: var(--radius); }
.prose p > img:only-child { margin-inline: auto; }
.prose p > em:only-child { display: block; margin-top: -.6em; color: var(--text-muted); font-size: .875rem; }

.prose blockquote {
  padding: .2em 0 .2em 1.25em; border-left: 3px solid var(--accent);
  color: var(--text-muted);
}
.prose blockquote > :last-child { margin-bottom: 0; }

.prose code {
  padding: .12em .4em; border-radius: 6px; background: var(--surface-2);
  font-family: var(--font-mono); font-size: .88em; word-break: normal; overflow-wrap: anywhere;
}
.prose pre {
  padding: 1rem 1.15rem; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); overflow-x: auto;
  font-size: .875rem; line-height: 1.6; tab-size: 2;
}
.prose pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; word-break: normal; white-space: pre; }
.prose .highlighter-rouge pre { margin: 0; }
.prose .highlighter-rouge { margin-bottom: 1.3em; }
.prose .highlight .c, .prose .highlight .c1, .prose .highlight .cm { color: var(--tok-comment); font-style: italic; }
.prose .highlight .k, .prose .highlight .kd, .prose .highlight .kn, .prose .highlight .kr { color: var(--tok-keyword); font-weight: 600; }
.prose .highlight .s, .prose .highlight .s1, .prose .highlight .s2 { color: var(--tok-string); }
.prose .highlight .m, .prose .highlight .mi, .prose .highlight .mf { color: var(--tok-number); }

/* 표: 좁은 화면에서는 표 안에서만 가로로 스크롤됩니다 */
.prose table {
  display: block; max-width: 100%; overflow-x: auto;
  border-collapse: collapse; font-size: .9375rem; font-variant-numeric: tabular-nums;
}
.prose th, .prose td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th {
  background: var(--surface-2); font-size: .8125rem; font-weight: 700;
  border-bottom: 1px solid var(--text); white-space: nowrap;
}

/* ---------- 404 ---------- */
.notfound { padding-block: clamp(4rem, 12vw, 8rem); }
.notfound__code { color: var(--accent); font-size: clamp(3rem, 10vw, 5rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.notfound__title { margin: .75rem 0 .5rem; font-size: 1.5rem; }
.notfound__text { margin-bottom: 1.5rem; color: var(--text-muted); }

/* ---------- 넓은 화면 ---------- */
@media (min-width: 768px) {
  .profile__hero { grid-template-columns: 9rem minmax(0, 1fr); align-items: start; }
  .avatar { width: 140px; height: 140px; }
  .profile__metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .career-card { grid-template-columns: 14rem minmax(0, 1fr); align-items: start; }
  .profile__grid-2col { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

/* ---------- 움직임 줄이기 설정을 존중 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   인쇄 (브라우저의 인쇄 / PDF 로 저장)
   - A4, 여백 16mm, 다크 모드여도 흰 배경·검정 글자
   - 메뉴·버튼·이전/다음 글은 숨김, 그림·표·카드는 페이지 중간에서 잘리지 않게 처리
   ========================================================================== */
@page { size: A4; margin: 16mm; }

@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #f4f4f4;
    --text: #111; --text-muted: #444; --border: #bbb;
    --accent: #8a2d16; --accent-soft: #fff; --on-accent: #fff;
    --shadow: none;
    --tok-comment: #555; --tok-keyword: #8a2d16; --tok-string: #1d5a3f; --tok-number: #7a4e0d;
  }

  html { scroll-behavior: auto; }
  body {
    display: block; min-height: 0;
    background: #fff; color: #111;
    font-size: 11pt; line-height: 1.6;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }

  .no-print, .skip-link { display: none; }

  .wrap { max-width: none; padding-inline: 0; }
  *, *::before, *::after { box-shadow: none; text-shadow: none; animation: none; transition: none; }
  .card, .card:hover { transform: none; }

  /* 상단: 사이트 이름만 작게 */
  .site-header { border-bottom: 1px solid #bbb; margin-bottom: 8mm; }
  .site-header__inner { min-height: 0; padding-bottom: 3mm; }
  .site-title { font-size: 10pt; color: #444; }
  .site-title::before { display: none; }
  .site-footer { margin-top: 10mm; padding: 0; font-size: 9pt; }
  .site-footer__inner { padding-block: 3mm 0; }

  /* 페이지 나눔 */
  h1, h2, h3, h4, .section-head, .figure__caption { break-after: avoid; page-break-after: avoid; }
  figure, .figure, .gallery__item, .card, pre, blockquote, table, tr, .profile__hero, .metric-card, .career-card, .profile__box { break-inside: avoid; page-break-inside: avoid; }
  p, li { orphans: 3; widows: 3; }

  img { max-width: 100%; max-height: 150mm; width: auto; height: auto; object-fit: contain; break-inside: avoid; }
  .figure img { width: auto; margin-inline: 0; }

  /* 글: 어떤 유형이든 위아래로 쌓아 잘림 방지 */
  .post { padding-block: 0; }
  .post__header { margin-bottom: 7mm; max-width: none; }
  .post__title { font-size: 22pt; }
  .post__layout { display: block; }
  .post__media { position: static; margin-bottom: 6mm; }
  /* 대표 이미지 1장은 높이를 제한(비율 유지, 잘림 없음)해서 첫 페이지에 제목·본문이 함께 들어가게 함 */
  .post .post__media .figure img { width: auto; max-width: 100%; height: auto; max-height: 90mm; object-fit: contain; }
  .post__body, .post--gallery .post__body, .post--image-top .post__body { max-width: none; }
  .gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4mm; column-width: auto; align-items: start; }
  .gallery__item { margin-bottom: 0; }
  .gallery img { max-height: 65mm; }

  /* 본문 */
  .prose pre { white-space: pre-wrap; overflow: visible; border-color: #bbb; font-size: 9pt; }
  .prose pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .prose table { display: table; width: 100%; overflow: visible; font-size: 10pt; }
  .prose th { white-space: normal; }
  .prose a { color: inherit; text-decoration: underline; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #444; word-break: break-all; }

  /* 메인: 프로필 + 목록을 촘촘하게 */
  .profile { display: grid; gap: 5mm; padding-block: 0 7mm; }
  .profile__hero { display: grid; grid-template-columns: 28mm minmax(0, 1fr); gap: 0 7mm; }
  .avatar { width: 28mm; height: 28mm; }
  .profile__name { font-size: 24pt; }
  .profile__bio { margin-top: 3mm; font-size: 10.5pt; max-width: none; }
  .profile__metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3mm; }
  .metric-card { padding: 3mm; border-color: #bbb; border-radius: 6px; }
  .metric-card__num { font-size: 16pt; }
  .career-card { grid-template-columns: 44mm minmax(0, 1fr); gap: 4mm; padding: 3.5mm; border-color: #bbb; border-radius: 6px; }
  .profile__grid-2col { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4mm; }
  .profile__box { padding: 3.5mm; border-color: #bbb; border-radius: 6px; }
  .contact-pill { border-color: #bbb; padding: .15rem .55rem; font-size: 8.5pt; }
  .section-head { margin-bottom: 5mm; padding-top: 3mm; }
  .post-toolbar { display: none; }
  .post-collection[data-view="list"] .card__media { display: block; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6mm; }
  .card { border-color: #bbb; border-radius: 6px; }
  .card__media { aspect-ratio: 16 / 9; }
  .card__img { max-height: none; object-fit: cover; width: 100%; height: 100%; }
  .card__body { padding: 3mm 4mm 4mm; gap: 1.5mm; }
  .card__title { font-size: 11.5pt; }
  .card__summary { font-size: 9pt; -webkit-line-clamp: 4; }
  .card__link::after { display: none; }
  .card__link { color: #111; }
  .badge { border: 1px solid #8a2d16; background: #fff; color: #8a2d16; }
  .tag { border-color: #999; color: #333; }
}
