/* 색상: 기본은 다크(깊은 소나무색 바탕), 라이트는 청자빛 종이. 강조는 인주색 도장. */
:root {
  --paper: #0F1E19;
  --tile: #152822;
  --ink: #DCE8E1;
  --ink-soft: #97ADA4;
  --rule: #2A4139;
  --seal: #E2584C;
  --board: #1F3A33;
  --chalk: #EEF0E8;

  /* heropy.dev와 같은 Pretendard 글꼴 */
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto,
    "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --serif: var(--sans);

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --wide: 72rem;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --paper: #E4ECE7;
  --tile: #EEF4F0;
  --ink: #18302A;
  --ink-soft: #4C625B;
  --rule: #BCCDC3;
  --seal: #B3302A;
  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--seal); color: #fff; }

h1, h2, h3 { margin: 0; font-family: inherit; line-height: 1.3; letter-spacing: -0.01em; }
p, ul, ol, dl, dd { margin: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28em;
  text-decoration-color: var(--rule);
  transition: color 150ms, text-decoration-color 150ms;
}
a:hover { color: var(--seal); text-decoration-color: currentColor; }

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

button { font: inherit; color: inherit; }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
}
.skip:focus { top: 1rem; }

.top,
.page,
.foot {
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ===== 공통 머리글 ===== */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2rem;
  padding-block: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand__seal {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 2px solid var(--seal);
  border-radius: 5px;
  color: var(--seal);
  font-size: 0.9375rem;
  font-weight: 900;
  transform: rotate(-6deg);
}
.brand:hover { color: inherit; }

.top__nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.top__nav a { color: var(--ink-soft); font-weight: 500; text-decoration: none; }
.top__nav a:hover { color: var(--ink); }
.top__nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--seal); text-decoration-thickness: 2px; text-underline-offset: 0.5em; }

.top__tools { display: flex; gap: 0.5rem; margin-left: auto; }

/* 칠판, 다크/라이트 전환: 같은 모양의 둥근 아이콘 단추 */
.icon-button,
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
}
.icon-button:hover,
.theme-toggle:hover { color: var(--seal); border-color: currentColor; }
.theme-toggle[hidden] { display: none; }
.icon-button svg,
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i-sun { display: block; }
.i-moon { display: none; }
[data-theme="light"] .i-sun { display: none; }
[data-theme="light"] .i-moon { display: block; }

/* ===== 대시보드 (첫 화면) ===== */

.dash {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  padding-block: clamp(1.5rem, 4vw, 3rem) clamp(3rem, 8vw, 5rem);
}

.card {
  grid-column: span 12;
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--tile);
}
.card--profile { grid-column: span 7; grid-row: span 2; display: flex; flex-direction: column; }
.card--now,
.card--numbers,
.card--career,
.card--contact { grid-column: span 5; }
.card--projects,
.card--skills { grid-column: span 7; }

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.card__head h2 { font-size: 1.0625rem; font-weight: 700; }
.card__more { flex: none; color: var(--ink-soft); font-size: 0.875rem; }

/* 프로필 사진: 카드 색과 같은 틈을 두고 얇은 테두리 고리를 두릅니다 */
.avatar {
  flex: none;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #F4F6F5;
  box-shadow: 0 0 0 3px var(--tile), 0 0 0 4px var(--rule);
  object-fit: cover;
}

.profile__top { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem clamp(1rem, 3vw, 1.75rem); }
.profile__photo { width: clamp(5.25rem, 11vw, 7.5rem); }
.profile__sign { display: flex; align-items: flex-end; gap: 1rem; }
.profile__name {
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.04em;
}
.seal {
  flex: none;
  width: clamp(3.5rem, 7vw, 5rem);
  height: auto;
  color: var(--seal);
  transform: rotate(-6deg);
  margin-bottom: -0.3rem;
  animation: stamp 520ms cubic-bezier(0.2, 0.7, 0.3, 1) 400ms both;
}
.seal text { font-family: var(--sans); font-size: 38px; font-weight: 900; }

@keyframes stamp {
  0%   { opacity: 0; transform: rotate(-14deg) scale(1.8); }
  60%  { opacity: 1; transform: rotate(-5deg) scale(0.94); }
  100% { opacity: 1; transform: rotate(-6deg) scale(1); }
}

.profile__role { margin-top: 1.25rem; font-size: 1.1875rem; font-weight: 600; }
.profile__intro { margin-top: 0.75rem; max-width: 34em; color: var(--ink-soft); }
.profile__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding: 1.75rem 0 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}
.pill:hover { border-color: var(--seal); }
.pill--solid { border-color: var(--seal); background: var(--seal); color: #fff; }
.pill--solid:hover { color: #fff; filter: brightness(1.08); }

.now__org { font-size: 1.25rem; font-weight: 700; }
.now__since { margin-top: 0.15rem; color: var(--ink-soft); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.now__text { margin-top: 0.75rem; }

.numbers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}
.numbers div { display: flex; flex-direction: column-reverse; gap: 0.1rem; }
.numbers dt { color: var(--ink-soft); font-size: 0.8125rem; }
.numbers dd { font-size: 1.75rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.mini-projects { padding: 0; list-style: none; }
.mini-projects li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 1rem;
  padding-block: 0.7rem;
  border-top: 1px solid var(--rule);
}
.mini-projects li:first-child { border-top: 0; padding-top: 0; }
.mini-projects strong { font-weight: 650; }
.mini-projects .kind { color: var(--ink-soft); font-size: 0.8125rem; white-space: nowrap; }
.mini-projects .stack { grid-column: 1 / -1; margin-top: 0; }

/* 경력 흐름: 실제 시간 순서라 세로 선으로 잇습니다 */
.flow { position: relative; padding: 0 0 0 1.1rem; list-style: none; }
.flow::before {
  content: "";
  position: absolute;
  top: 0.55rem;
  bottom: 0.55rem;
  left: 0.2rem;
  width: 1px;
  background: var(--rule);
}
.flow li { position: relative; }
.flow li + li { margin-top: 0.85rem; }
.flow li::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: -1.1rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--tile);
  border: 2px solid var(--ink-soft);
}
.flow li:first-child::before { border-color: var(--seal); background: var(--seal); }
.flow strong { display: block; font-weight: 650; }
.flow span { color: var(--ink-soft); font-size: 0.875rem; font-variant-numeric: tabular-nums; }

.mini-skills { display: grid; gap: 0.5rem; }
.mini-skills div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; }
.mini-skills dt { color: var(--ink-soft); font-size: 0.9375rem; }

.contact-tile__mail { display: inline-block; font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }
.contact-tile__text { margin-top: 0.5rem; color: var(--ink-soft); font-size: 0.9375rem; }
.contact-tile .pill { margin-top: 1rem; }

/* ===== 하위 페이지 공통 ===== */

.page-head {
  padding-block: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
}
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.03em; }
.page-head p { margin-top: 0.75rem; max-width: 40em; color: var(--ink-soft); }
.page-head--photo { display: flex; align-items: center; gap: clamp(1.25rem, 3vw, 2rem); }
.page-head__photo { width: clamp(5rem, 10vw, 7rem); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--rule); }

/* 섹션: 왼쪽 제목, 오른쪽 내용 */
.block {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 2rem;
  padding-block: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--rule);
}
.page-head + .block { border-top: 0; }
.block__title { align-self: start; position: sticky; top: 1.5rem; font-size: 1.125rem; font-weight: 700; }
.block__body { max-width: 46rem; padding: 0; list-style: none; }

.lead { color: var(--ink-soft); }

.stack { margin-top: 0.75rem; font-size: 0.9375rem; color: var(--ink-soft); }

.facts div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 1.5rem; }
.facts div + div { margin-top: 0.5rem; }
.facts dt { color: var(--ink-soft); }

.skills div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1.5rem; }
.skills div + div { margin-top: 0.75rem; }
.skills dt { font-weight: 600; }

.certs { padding: 0; list-style: none; }
.certs li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1rem; }
.certs li + li { margin-top: 0.5rem; }
.certs time { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.certs .issuer { color: var(--ink-soft); font-size: 0.9375rem; }

/* 경력 (시간순 목록) */
.timeline > li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1.5rem; }
.timeline > li + li { margin-top: 2.5rem; }

.when { padding-top: 0.15rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.timeline h3,
.project__title { margin-bottom: 0.4rem; font-size: 1.1875rem; font-weight: 700; }

.notes { margin-top: 0.5rem; padding-left: 1.1em; }
.notes li::marker { color: var(--ink-soft); }
.notes li + li { margin-top: 0.15rem; }
.notes .sub { margin-top: 0.6rem; margin-left: -1.1em; font-weight: 600; list-style: none; }

/* 프로젝트 */
.filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2.5rem; }
.lead + .filter { margin-top: 1.5rem; }
.filter button {
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  font-size: 0.9375rem;
  cursor: pointer;
}
.filter button:hover { border-color: var(--ink-soft); }
.filter button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.filter span { margin-left: 0.3em; opacity: 0.7; font-variant-numeric: tabular-nums; }

.projects { padding: 0; list-style: none; }
.project { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1.5rem; }
.project + .project { margin-top: 2.25rem; }
.project[hidden] { display: none; }
.project__kind { padding-top: 0.2rem; color: var(--ink-soft); font-size: 0.9375rem; }
.project[data-kind="service"] .project__kind { color: var(--seal); }

/* 그 밖의 프로젝트: 짧은 한 줄 목록 */
.minor-list li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1.5rem; }
.minor-list li + li { margin-top: 0.75rem; }
.minor-list .when { padding-top: 0; }
.minor-list .stack { display: block; margin-top: 0.1rem; }

/* 연락하기 */
.contact__mail {
  display: inline-block;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-decoration-thickness: 2px;
  overflow-wrap: anywhere;
}
.contact__links { margin-top: 1.5rem; padding: 0; list-style: none; }
.contact__links li { display: flex; gap: 1rem; }
.contact__links span { min-width: 6rem; color: var(--ink-soft); }

.comments { margin-top: 1.5rem; min-height: 12rem; }
.comments .utterances { max-width: none; }

/* # 라벨 자동 완성 (shared/labels.js: 칸반, 개발 노트) */
.label-suggest {
  display: grid;
  margin: 0;
  padding: 0.25rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  list-style: none;
}
.label-suggest[hidden] { display: none; }
.label-suggest__item { padding: 0.3rem 0.55rem; border-radius: 6px; font-size: 0.875rem; font-weight: 500; cursor: pointer; }
.label-suggest__item[aria-selected="true"] { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }

.button {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}
.button:hover { background: var(--seal); color: #fff; }

.foot {
  padding-block: 0 3rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.foot p { padding-top: 2rem; border-top: 1px solid var(--rule); }

/* ===== 태블릿, 휴대폰 ===== */

@media (max-width: 900px) {
  .card--profile,
  .card--now,
  .card--numbers,
  .card--projects,
  .card--career,
  .card--skills,
  .card--contact { grid-column: span 12; grid-row: auto; }
}

@media (max-width: 760px) {
  .block { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .block__title { position: static; }
}

@media (max-width: 560px) {
  .top { gap: 0.75rem 1rem; }
  .top__nav { order: 3; width: 100%; gap: 0.25rem 1.1rem; }
  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1rem; }
  .page-head--photo { flex-direction: column; align-items: flex-start; }
  .project,
  .timeline > li,
  .skills div,
  .facts div,
  .minor-list li,
  .mini-skills div { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
  .when,
  .project__kind { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .seal { animation: none; }
  a { transition: none; }
}
