:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #8c8c8c;
  --line: #e4e4e4;
  --ph: #efefef;
  --ascii: #4a4a4a;           /* 아스키 아트 색 (짙은 회색) */
  --pad: clamp(16px, 2.2vw, 32px);
  --fs-s: 13px;
  --fs-m: 15px;
  --fs-l: clamp(32px, 4.4vw, 64px);
  --fs-title: clamp(20px, 2.1vw, 30px);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-size: var(--fs-m);
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ol, ul { list-style: none; }

/* ── Header ───────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: baseline;
  padding: var(--pad);
  background: var(--bg);
  font-size: var(--fs-s);
}
.logo { font-weight: 600; }
.role { color: var(--muted); }
.site-header nav { display: flex; gap: 1.5em; justify-content: flex-end; }
.site-header nav a:hover, .contact a:hover, .hero-cue:hover { text-decoration: underline; text-underline-offset: 3px; }

/* 메인 페이지: 헤더를 아스키 위에 투명하게 띄움 */
.home .site-header { position: fixed; left: 0; right: 0; background: transparent; transition: background-color .3s; }
.home .site-header.solid { background: var(--bg); }

/* ── Hero (ASCII) ─────────────── */
.hero {
  position: relative;
  height: 100vh; height: 100svh;
  min-height: 480px;
  overflow: hidden;
}
.ascii {
  position: absolute; inset: 0;
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--ascii);
  white-space: pre;
  overflow: hidden;
  user-select: none;
  pointer-events: none;
}
.dots { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mode-toggle {
  position: absolute; right: var(--pad); bottom: var(--pad); z-index: 2;
  display: flex; gap: 2px; background: var(--bg); padding: 2px;
}
.mode-toggle button {
  font: inherit; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.02em;
  background: none; border: 0; padding: 2px 6px; color: var(--muted); cursor: pointer;
}
.mode-toggle button[aria-pressed="true"] { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.mode-toggle button:focus-visible, .filters button:focus-visible { outline: 1px solid var(--fg); outline-offset: 2px; }
.hero-cue {
  position: absolute; left: var(--pad); bottom: var(--pad);
  font-size: var(--fs-s);
  background: var(--bg); padding: 2px 4px; margin-left: -4px;
}

/* ── Filters ──────────────────── */
.work { padding-top: clamp(64px, 10vh, 120px); }
.filters {
  display: flex; flex-wrap: wrap; gap: 0.4em 1.4em;
  padding: 0 var(--pad) 28px;
  font-size: var(--fs-s);
}
.filters button {
  font: inherit; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0;
}
.filters button sup { font-size: 0.75em; margin-left: 2px; }
.filters button:hover:not(:disabled), .filters button[aria-pressed="true"] { color: var(--fg); }
.filters button[aria-pressed="true"]::before { content: "● "; font-size: 0.7em; vertical-align: 0.15em; }
.filters button:disabled { opacity: 0.4; cursor: default; }

/* ── Project index ────────────── */
.index-head, .index a {
  display: grid;
  grid-template-columns: 56px 3fr 2fr 56px;
  gap: 16px;
  padding: 12px var(--pad);
  align-items: center;
}
.index-head { font-size: var(--fs-s); color: var(--muted); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.index-head span:last-child, .index .year { text-align: right; }
.index li { border-bottom: 1px solid var(--line); }
.index a { transition: color .2s; }
.index .no, .index .cat, .index .year { font-size: var(--fs-s); }
.index .no, .index .year { font-variant-numeric: tabular-nums; }
.index .title { font-size: 15px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.3; }
.index .title small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.index .cat, .index .no { color: var(--muted); }
.index .placeholder { color: var(--muted); }
.index li.hidden { display: none; }
.empty { padding: 40px var(--pad); color: var(--muted); font-size: var(--fs-s); }

/* ── 목록 + 이미지 그리드 (PC: 좌우 분할) ── */
.work-split { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: start; border-top: 1px solid var(--line); }
.work-list {
  position: sticky; top: 79px;
  max-height: calc(100vh - 79px); overflow-y: auto;
  border-right: 1px solid var(--line);
  scrollbar-width: none;
}
.work-list::-webkit-scrollbar { display: none; }
.work-list .index-head { border-top: 0; }
.work-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 32px 16px;
  padding: 16px var(--pad) 0 16px;
}
.card { display: block; transition: opacity .2s; }
.card.hidden { display: none; }
.card figure { aspect-ratio: 4 / 5; height: auto; }
.ph {
  width: 100%; height: 100%;
  background: var(--ph) center / cover no-repeat;
  display: flex; align-items: flex-end; padding: 10px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.card-cap { display: flex; justify-content: space-between; gap: 1em; padding-top: 8px; font-size: 13px; }
.card-cap .year { font-family: var(--mono); font-size: 11px; color: var(--muted); }
@media (hover: hover) {
  .work.hovering .card:not(.active) { opacity: .35; }
  .work.hovering .index a:not(.active) { color: #c4c4c4; }
  .index a.active { color: var(--fg); }
}

/* ── About / Contact ──────────── */
.about, .contact {
  display: grid; grid-template-columns: 1fr 2fr; gap: 1em;
  padding: 16vh var(--pad) 0;
}
.label { font-size: var(--fs-s); font-weight: 400; color: var(--muted); }
.about-body > p { font-size: clamp(18px, 1.8vw, 26px); letter-spacing: -0.025em; line-height: 1.4; max-width: 28em; }
.cv { display: grid; grid-template-columns: 8em 1fr; gap: 6px 1em; margin-top: 48px; font-size: var(--fs-s); }
.cv dt { color: var(--muted); }
.about-body > p[hidden] + .cv { margin-top: 0; }
.muted-s { color: var(--muted); }
.contact ul { font-size: clamp(18px, 1.8vw, 26px); letter-spacing: -0.025em; }

.site-footer {
  display: flex; justify-content: space-between;
  padding: 16vh var(--pad) var(--pad);
  font-size: var(--fs-s); color: var(--muted);
}

/* ── Project detail ───────────── */
.project-head {
  display: grid; grid-template-columns: 1fr 2fr; gap: 1em;
  padding: 14vh var(--pad) 8vh;
}
.project-head h1 { font-size: var(--fs-l); font-weight: 500; letter-spacing: -0.035em; line-height: 1.05; grid-column: 1 / -1; margin-bottom: 6vh; }
.project-meta { display: grid; grid-template-columns: 6em 1fr; gap: 6px 1em; font-size: var(--fs-s); align-content: start; }
.project-meta dt { color: var(--muted); }
.project-summary { font-size: clamp(17px, 1.6vw, 22px); letter-spacing: -0.02em; line-height: 1.5; max-width: 32em; }
.project-images { display: grid; grid-template-columns: 1fr 1fr; gap: var(--pad); padding: 0 var(--pad); }
.project-images figure { aspect-ratio: 4 / 3; }
.project-images figure.full { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.project-images img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-nav { display: flex; justify-content: space-between; gap: 1em; padding: 12vh var(--pad) 0; font-size: var(--fs-s); }
.project-nav a:hover { text-decoration: underline; text-underline-offset: 3px; }
.project-nav .next { text-align: right; }
.project-nav .next strong { display: block; font-size: var(--fs-title); font-weight: 500; letter-spacing: -0.03em; }

/* ── Tablet: 목록 위, 그리드 아래로 쌓기 ── */
@media (max-width: 1024px) {
  .work-split { grid-template-columns: minmax(0,1fr); }
  .work-list { position: static; max-height: none; overflow: visible; border-right: 0; }
  .work-grid { grid-template-columns: repeat(3, minmax(0,1fr)); padding: 48px var(--pad) 0; }
  .index-head, .index a { grid-template-columns: 44px 3fr 2fr 48px; }
}

/* ── 작은 UI 글자는 고정폭 대문자로 (본문·제목은 Pretendard) ── */
.site-header, .hero-cue, .filters, .index-head, .label, .site-footer, .project-nav > a:first-child {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.02em;
}
.index .no, .index .year, .cv dt, .project-meta dt { font-family: var(--mono); font-size: 11px; }
.logo { font-weight: 400; }

/* ── Mobile ───────────────────── */
@media (max-width: 760px) {
  :root { --fs-s: 12px; }
  .site-header { grid-template-columns: 1fr auto; }
  .role { display: none; }
  .ascii { font-size: 9px; }
  .index-head { display: none; }
  .index a { grid-template-columns: 28px 1fr auto; padding-top: 16px; padding-bottom: 16px; }
  .index .cat { display: none; }
  .work-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 24px 12px; }
  .about, .contact, .project-head { grid-template-columns: 1fr; padding-top: 12vh; }
  .project-head h1 { margin-bottom: 4vh; }
  .project-meta { margin-bottom: 24px; }
  .project-images { grid-template-columns: 1fr; gap: 12px; }
  .project-images figure.full { aspect-ratio: 4 / 3; }
  .cv { grid-template-columns: 6.5em 1fr; }
  .site-footer, .project-nav { padding-top: 12vh; }
}
