@font-face {
  font-family: "SUIT";
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/gh/sun-typeface/SUIT@2/fonts/variable/woff2/SUIT-Variable.woff2") format("woff2");
  unicode-range: U+1100-11FF, U+3130-318F, U+A960-A97F, U+AC00-D7A3, U+D7B0-D7FF;
}

:root {
  color-scheme: light dark;
  --color-bg: light-dark(#fff, #000);
  --color-body: light-dark(
    color-mix(in lch, canvastext, canvas 30%),
    color-mix(in lch, canvastext, canvas 4%)
  );
  --color-muted: light-dark(
    color-mix(in lch, canvastext, canvas 40%),
    color-mix(in lch, canvastext, canvas 20%)
  );
  --color-faint: light-dark(
    color-mix(in lch, canvastext, canvas 46%),
    color-mix(in lch, canvastext, canvas 30%)
  );
  --color-accent: light-dark(oklch(57.7% 0.245 27.325), oklch(70.4% 0.191 22.216));
  --color-red-500: oklch(63.7% 0.237 25.331);
  --header-height: 4.75rem;
  --tree-row-h: 1.75rem;
  --page: 40rem;
  --gutter: 1.5rem;
  --font-sans: "Montserrat", "SUIT", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--color-bg);
  color: var(--color-body);
  font-family: var(--font-sans);
  font-weight: 500;
  line-height: 1.5;
}

:lang(ko) {
  line-height: 1.7;
  word-break: keep-all;
}

:lang(ko) h1,
:lang(ko) .hello {
  line-height: 1.12;
}

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body::before {
  content: "";
  position: fixed;
  z-index: 15;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-height);
  background: var(--color-bg);
  pointer-events: none;
}

.mark {
  position: fixed;
  top: 0.85rem;
  right: max(var(--gutter), calc((100vw - var(--page)) / 2));
  left: auto;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0;
  background: var(--color-bg);
}

.mark .gem {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 0.375rem;
  text-decoration: none;
  color: canvastext;
}

.mark .gem:hover {
  color: canvastext;
}

.mark .gem svg {
  width: 1.85rem;
  height: 1.85rem;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.75rem;
  margin-right: 0.2rem;
  padding: 0 0.75rem 0 0.1rem;
  border-right: 1px solid color-mix(in lch, currentColor, transparent 78%);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-muted);
}

.crumb svg {
  width: 0.85rem;
  height: 0.85rem;
  flex: none;
}

.crumb:hover {
  color: canvastext;
}

.langs {
  display: inline-flex;
  align-items: center;
  height: 2.75rem;
  margin-right: 0.1rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.langs a {
  padding: 0.2rem 0.28rem;
  text-decoration: none;
  color: var(--color-faint);
  transition: color 0.18s ease;
}

.langs a[aria-current="true"] {
  color: canvastext;
}

.langs a:hover {
  color: var(--color-accent);
}

.column {
  width: min(var(--page), calc(100vw - (2 * var(--gutter))));
  margin-inline: auto;
  padding-top: var(--header-height);
  padding-bottom: 2.5rem;
}

@media (min-width: 641px) {
  .column {
    padding-inline-end: 3.25rem;
  }
}

h1 {
  margin: 0 0 0.5rem;
  font-weight: 800;
  font-size: clamp(2.75rem, 2.1rem + 2.4vw, 3.85rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  color: canvastext;
}

:lang(en) h1.name,
:lang(en) .hello {
  font-size: clamp(2.35rem, 1.8rem + 1.7vw, 3.2rem);
}

:lang(ko) h1,
:lang(ko) .hello {
  letter-spacing: 0.02em;
}

:lang(ko) .kicker {
  letter-spacing: 0.06em;
  text-transform: none;
}

h1.name a {
  color: inherit;
  text-decoration: none;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kicker {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prose p {
  margin: 0 0 1rem;
  text-wrap: balance;
}

.prose a,
.dotlist a,
.latest a,
.more a {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in lch, currentColor, transparent 55%);
}

.prose a:hover,
.dotlist a:hover,
.latest a:hover,
.more a:hover {
  text-decoration-color: currentColor;
}

.more {
  margin: 0.85rem 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dotlist {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: fit-content;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.dotlist li:not(:last-child)::after {
  content: "·";
  margin-inline: 0.5rem;
}

.latest,
.timeline {
  margin-top: 2.5rem;
}

.timeline ol {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  border-top: 1px solid color-mix(in lch, currentColor, transparent 86%);
}

.timeline a.row {
  display: grid;
  grid-template-columns: 8.75rem minmax(0, 1fr);
  column-gap: 1.25rem;
  row-gap: 0.15rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid color-mix(in lch, currentColor, transparent 88%);
  text-decoration: none;
}

.timeline a.row:hover .role {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.timeline .period {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--color-muted);
  padding-top: 0.2rem;
}

.timeline .role {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.timeline .line {
  grid-column: 2;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-muted);
}

@media (max-width: 640px) {
  .timeline a.row {
    grid-template-columns: 1fr;
  }

  .timeline .line {
    grid-column: 1;
  }
}

.latest ul {
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.latest li {
  margin: 0.15rem 0;
}

.muted {
  color: var(--color-muted);
}

.faint {
  color: var(--color-faint);
}

.site-footer {
  margin-top: 3.5rem;
  margin-bottom: 2rem;
}

.presence {
  display: grid;
  gap: 0.375rem 2.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (min-width: 640px) {
  .presence {
    grid-template-columns: 1fr 1fr;
  }
}

.presence a:hover {
  color: var(--color-accent);
}

.colophon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-faint);
}

.explorer {
  box-sizing: border-box;
  width: min(var(--page), calc(100vw - (2 * var(--gutter))));
  height: 100vh;
  margin-inline: auto;
  padding: var(--header-height) 0 1.25rem;
}

content-tree {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 0.25rem;
  container-type: inline-size;
}

.tree-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.tree-search {
  width: 100%;
  font: inherit;
  font-size: 0.75rem;
  color: inherit;
  background: transparent;
  border: 1px solid color-mix(in lch, currentColor, transparent 80%);
  border-radius: 0.25rem;
  padding: 0.25rem 1.6rem 0.25rem 0.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tree-search:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in lch, var(--color-accent), transparent 82%);
}

.kbd {
  position: absolute;
  right: 0.375rem;
  top: 50%;
  translate: 0 -50%;
  font-size: 10px;
  line-height: 1;
  padding: 0.125rem 0.25rem;
  border: 1px solid color-mix(in lch, currentColor, transparent 80%);
  border-radius: 0.25rem;
  opacity: 0.6;
  pointer-events: none;
}

.search-wrap:focus-within .kbd {
  display: none;
}

.tree-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tree-toolbar button {
  font: inherit;
  font-size: 0.75rem;
  color: var(--color-muted);
  background: transparent;
  border: 0;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.tree-toolbar button:hover {
  color: canvastext;
  background: color-mix(in lch, currentColor, transparent 92%);
}

.tree-toolbar button[aria-pressed="true"] {
  color: var(--color-accent);
  font-weight: 700;
  background: color-mix(in lch, var(--color-accent), transparent 90%);
}

.tree-empty {
  margin: 0;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  opacity: 0.6;
}

.tree-scroll {
  flex: 1;
  min-height: 0;
}

[role="tree"],
[role="group"] {
  list-style: none;
  margin: 0;
  padding: 0;
}

[role="group"] {
  margin-left: 1rem;
}

.branch {
  display: grid;
  grid-template-rows: 1fr;
  clip-path: inset(0 -100% 0 -100%);
  transition: grid-template-rows 0.34s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.branch[inert] {
  grid-template-rows: 0fr;
  overflow: hidden;
}

.branch > [role="group"] {
  min-height: 0;
}

.branch:not([inert]) > [role="group"] > li {
  animation: tree-in 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.branch:not([inert]) > [role="group"] > li:nth-child(2) { animation-delay: 0.03s; }
.branch:not([inert]) > [role="group"] > li:nth-child(3) { animation-delay: 0.06s; }
.branch:not([inert]) > [role="group"] > li:nth-child(4) { animation-delay: 0.09s; }
.branch:not([inert]) > [role="group"] > li:nth-child(5) { animation-delay: 0.12s; }
.branch:not([inert]) > [role="group"] > li:nth-child(6) { animation-delay: 0.15s; }

@keyframes tree-in {
  from {
    opacity: 0;
    translate: 0.4rem 0;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

[role="treeitem"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  height: var(--tree-row-h);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.625;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  scroll-margin-top: calc((var(--level) - 1) * var(--tree-row-h));
  transition: color 0.18s ease;
}

[role="treeitem"] .label,
[role="treeitem"] .folder,
[role="treeitem"] .tree-icon,
[role="treeitem"] .tree-date {
  position: relative;
  z-index: 1;
}

button[role="treeitem"] {
  position: sticky;
  top: calc((var(--level) - 1) * var(--tree-row-h));
  z-index: calc(100 - var(--level));
  background: var(--color-bg);
}

[role="treeitem"] .label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[role="treeitem"] .tree-date {
  flex: none;
  margin-left: 0.75rem;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--color-faint);
  white-space: nowrap;
}

[role="treeitem"]:hover .tree-date,
[role="treeitem"]:focus-visible .tree-date,
[role="treeitem"][aria-expanded="true"] .tree-date,
[role="treeitem"][aria-current="page"] .tree-date {
  color: var(--color-muted);
}

.folder,
.plus {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.tree-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
}

.tree-icon:hover {
  background: color-mix(in lch, currentColor, transparent 90%);
}

.folder {
  color: var(--color-faint);
  transition: color 0.18s ease;
}

.plus {
  color: var(--color-faint);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.18s ease;
}

[role="treeitem"]:hover,
[role="treeitem"]:focus-visible,
[role="treeitem"][aria-expanded="true"] {
  color: canvastext;
}

[role="treeitem"]:hover .folder,
[role="treeitem"][aria-expanded="true"] .folder {
  color: canvastext;
}

a[role="treeitem"]:hover,
a[role="treeitem"]:focus-visible,
a[role="treeitem"][aria-current="page"] {
  color: var(--color-accent);
}

[aria-expanded="true"] .plus {
  color: var(--color-accent);
  transform: rotate(45deg);
}

[role="treeitem"]:focus {
  outline: none;
}

[role="treeitem"]::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0.12rem;
  bottom: 0.12rem;
  left: calc(-1 * (var(--level) - 1) * 1rem);
  width: calc(100% + (var(--level) - 1) * 1rem);
  border-radius: 0.3rem;
  background: color-mix(in lch, var(--color-accent), transparent 90%);
  opacity: 0;
  transform: scaleX(0.97);
  transform-origin: left center;
  transition: opacity 0.18s ease, transform 0.22s ease;
}

[role="treeitem"]::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0.32rem;
  bottom: 0.32rem;
  left: calc(-1 * (var(--level) - 1) * 1rem);
  width: 2px;
  border-radius: 1px;
  background: var(--color-accent);
  transform: scaleY(0.35);
  transform-origin: center;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.18s ease;
}

[role="treeitem"]:hover::before,
[role="treeitem"]:focus-visible::before,
[role="treeitem"][aria-current="page"]::before,
[role="treeitem"][aria-expanded="true"]::before {
  opacity: 1;
  transform: scaleX(1);
}

[role="treeitem"]:hover::after,
[role="treeitem"]:focus-visible::after,
[role="treeitem"][aria-current="page"]::after,
[role="treeitem"][aria-expanded="true"]::after {
  opacity: 1;
  transform: scaleY(1);
}

@media (prefers-reduced-motion: reduce) {
  .branch,
  .plus,
  .folder,
  .tree-search,
  .tree-toolbar button,
  [role="treeitem"],
  [role="treeitem"]::before,
  [role="treeitem"]::after,
  .hello span,
  h1.name span,
  .intro-role,
  .intro-line,
  .intro-veil {
    transition: none;
    animation: none;
  }

  html.intro .intro-screen {
    display: none;
  }
}

html.intro {
  overflow: hidden;
}

.intro-screen {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: stretch;
  padding-top: var(--header-height);
  background: transparent;
}

html.intro .intro-screen[hidden] {
  display: flex;
}

.intro-copy {
  position: relative;
  z-index: 1;
  width: min(var(--page), calc(100vw - (2 * var(--gutter))));
  margin-inline: auto;
  background: var(--color-bg);
}

@media (min-width: 641px) {
  .intro-copy {
    padding-inline-end: 3.25rem;
  }
}

.hello {
  display: block;
  margin: 0 0 1.25rem;
  overflow: visible;
  clip-path: inset(-0.45em 0 0 0);
  white-space: nowrap;
  color: canvastext;
  font-weight: 800;
  font-size: clamp(2.75rem, 2.1rem + 2.4vw, 3.85rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}

:lang(ko) .hello {
  clip-path: inset(-0.35em 0 0 0);
}

h1.name span,
.hello span {
  display: inline-block;
  line-height: inherit;
  vertical-align: baseline;
}

html.intro:not(.intro-ready) .hello span {
  animation: none;
  opacity: 0;
}

html.intro.intro-ready .hello span {
  animation: glyph-in 0.55s var(--in, 0s) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.intro-role {
  margin: 0;
  animation: none;
  opacity: 0;
}

html.intro.intro-ready .intro-role {
  animation: line-in 0.55s 0.42s both;
}

.intro-line {
  margin: 0 0 1rem;
  color: var(--color-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: inherit;
  text-wrap: balance;
  animation: none;
  opacity: 0;
}

html.intro.intro-ready .intro-line {
  animation: line-in 0.6s 0.78s both;
}

.intro-veil {
  flex: 1;
  min-height: 0;
  background: var(--color-bg);
}

html.intro h1.name {
  visibility: hidden;
}

html.intro:has(.intro-screen.out) h1.name {
  visibility: visible;
}

html.intro:has(.intro-screen.out) h1.name span {
  animation: glyph-in 0.55s var(--in, 0s) cubic-bezier(0.16, 1, 0.3, 1) both;
}

html.intro .intro-screen.out .intro-copy {
  background: transparent;
}

html.intro .intro-screen.out .intro-role,
html.intro .intro-screen.out .intro-line {
  visibility: hidden;
  opacity: 0;
  animation: none;
}

html.intro .intro-screen.out .intro-greet span {
  animation: glyph-out 0.42s var(--out, 0s) cubic-bezier(0.16, 1, 0.3, 1) both;
}

html.intro .intro-screen.out .intro-veil {
  opacity: 0;
  transition: opacity 0.55s ease;
}

@keyframes glyph-in {
  from {
    opacity: 0;
    transform: translateY(80%);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes glyph-out {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(80%);
  }
}

@keyframes line-in {
  from {
    opacity: 0;
    transform: translateY(0.45em);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.stage {
  padding-top: 0;
}

.stage h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.045em;
}

.path {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.doc h1,
.doc h2,
.entry {
  scroll-margin-top: calc(var(--header-height) + 0.5rem);
}

.doc h1 {
  margin-bottom: 1.25rem;
}

.doc h2 {
  margin-top: 1.75rem;
  font-size: 1.15rem;
}

.doc h3 {
  margin: 1.1rem 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.doc ul {
  margin: 0.35rem 0 1rem;
  padding-left: 1.15rem;
}

/* 푸터 목록은 본문 목록 들여쓰기를 받지 않는다 — 받으면 본문 왼쪽 선보다 안으로 밀린다 */
.doc .site-footer ul {
  padding-left: 0;
}

.doc .site-footer .presence {
  margin: 0;
}

.doc .site-footer .colophon {
  margin: 2rem 0 0;
}

.doc p {
  margin: 0 0 1rem;
}

.doc li {
  margin: 0.2rem 0;
}

.entry {
  margin: 0 0 1.6rem;
  padding-top: 0.35rem;
}

.entry .period {
  margin: 0.15rem 0 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-muted);
}

.career-points {
  margin: 0 0 1.5rem;
  padding-left: 1.1rem;
}

.career-points li {
  margin: 0 0 0.6rem;
  padding-left: 0.2rem;
}

.career-points li::marker { color: var(--color-accent); }

.project-meta .meta-wide { grid-column: 1 / -1; }

.role-line {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* 상세 페이지 제목은 이름(h1.name)보다 한 단계 작게 — 프로젝트명은 길어서 큰 글자로는 두세 줄로 꺾인다 */
h1.detail-title {
  font-size: clamp(2rem, 1.65rem + 1.3vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.project-lede {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  color: var(--color-body);
}

.project-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0 0 2rem;
  padding: 1rem 0;
  border-block: 1px solid color-mix(in lch, canvastext, transparent 88%);
}

.project-meta div { min-width: 0; }

.project-meta dt {
  margin-bottom: 0.15rem;
  color: var(--color-faint);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-meta dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.project-process {
  position: relative;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.project-process li {
  position: relative;
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: 0 0 0.9rem;
}

.project-process li::before {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 1.35rem;
  bottom: 0.1rem;
  width: 1px;
  background: color-mix(in lch, canvastext, transparent 85%);
}

.project-process li:last-child::before { display: none; }

.process-stage {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.process-index {
  display: inline-grid;
  place-items: center;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--color-accent);
  color: transparent;
  font-size: 0;
  flex: none;
  transform: translateY(0.1rem);
}

.project-process p {
  margin: 0 !important;
  font-size: 0.9rem;
  color: var(--color-body);
}

.diagram-card {
  display: grid;
  grid-template-columns: 11rem 1fr auto;
  align-items: center;
  gap: 1.1rem;
  margin: 0 0 2.25rem;
  padding: 0.9rem 1.1rem 0.9rem 0.9rem;
  border: 1px solid color-mix(in lch, canvastext, transparent 86%);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.diagram-card:hover,
.diagram-card:focus-visible {
  border-color: color-mix(in lch, var(--color-accent), transparent 40%);
  background: color-mix(in lch, var(--color-accent), canvas 96%);
}

.diagram-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.diagram-card-preview {
  display: block;
  padding: 0.55rem;
  border-radius: 9px;
  background: color-mix(in lch, canvastext, canvas 96%);
}

.diagram-thumb { display: block; width: 100%; height: auto; }
.diagram-thumb .thumb-edges path { fill: none; stroke: color-mix(in lch, canvastext, transparent 70%); stroke-width: 5; }
.diagram-thumb .thumb-nodes rect { fill: canvas; stroke: color-mix(in lch, canvastext, transparent 72%); stroke-width: 4; }
.diagram-thumb .thumb-nodes rect:first-child { fill: color-mix(in lch, var(--color-accent), canvas 88%); stroke: var(--color-accent); }

.diagram-card:hover .thumb-edges path { stroke: color-mix(in lch, var(--color-accent), transparent 35%); }

.diagram-card-body {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.diagram-card-label {
  color: var(--color-accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.diagram-card-title { font-size: 0.95rem; font-weight: 700; }
.diagram-card-hint { color: var(--color-muted); font-size: 0.8rem; }

.diagram-card-arrow {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid color-mix(in lch, canvastext, transparent 82%);
  font-weight: 700;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.diagram-card:hover .diagram-card-arrow,
.diagram-card:focus-visible .diagram-card-arrow {
  transform: translateX(3px);
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

@media (max-width: 640px) {
  .project-meta { grid-template-columns: 1fr; }
  .project-process li { grid-template-columns: 1fr; gap: 0.2rem; padding-left: 0; }
  .project-process p { padding-left: 1.4rem; }
  .project-process li::before { top: 1.45rem; }
  .diagram-card { grid-template-columns: 1fr auto; }
  .diagram-card-preview { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .diagram-card,
  .diagram-card-arrow { transition: none; }
  .diagram-card:hover .diagram-card-arrow { transform: none; }
}

/* 설계도는 넓은 판이라 위 헤더(.mark)도 같은 폭에 맞춘다 — 안 맞추면 헤더만 본문 폭(40rem)에 남는다 */
body:has(.architecture-page) {
  --page: 1080px;
}

.architecture-page {
  width: min(var(--page), calc(100% - 2 * var(--gutter)));
  margin: calc(var(--header-height) + 1.25rem) auto 5rem;
}

.architecture-header {
  max-width: 720px;
}

.architecture-header h1 {
  margin: 0.5rem 0 0.75rem;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.08;
}

.architecture-header p:last-child {
  line-height: 1.65;
  color: var(--color-muted);
}

.architecture-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  font-size: 0.78rem;
  color: var(--color-muted);
}

.architecture-actions {
  display: flex;
  gap: 0.45rem;
  flex: none;
}

.architecture-motion,
.architecture-next {
  border: 1px solid currentColor;
  background: transparent;
  color: var(--color-muted);
  padding: 0.45rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.architecture-motion:hover,
.architecture-next:hover,
.architecture-motion:focus-visible,
.architecture-next:focus-visible { color: var(--color-accent); }

.architecture-motion:disabled { opacity: 0.5; cursor: default; }

.architecture-viewport {
  overflow-x: auto;
  overflow-y: auto;
  background-color: canvas;
  background-image: linear-gradient(color-mix(in srgb, canvastext 5%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, canvastext 5%, transparent) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 1px solid color-mix(in srgb, canvastext 16%, canvas);
}

.architecture-scene {
  width: min(100%, var(--graph-width));
  margin-inline: auto;
}

.system-diagram { display: block; width: 100%; height: auto; }
.diagram-connection,
.diagram-node { transition: opacity 0.28s ease; }
.diagram-connection.is-muted,
.diagram-node.is-muted { opacity: 0.24; }

.diagram-edge {
  fill: none;
  stroke: color-mix(in srgb, canvastext 35%, canvas);
  stroke-width: 2.4;
  transition: stroke 0.28s ease, stroke-width 0.28s ease;
}

.diagram-connection.is-active .diagram-edge,
.diagram-connection.is-related .diagram-edge {
  stroke: var(--color-accent);
  stroke-width: 3.5;
}

#diagram-arrow path { fill: var(--color-accent); }

.diagram-packet {
  fill: var(--color-accent);
  stroke: canvas;
  stroke-width: 3;
  opacity: 0;
  filter: drop-shadow(0 0 8px var(--color-accent));
}

.diagram-connection.is-active .diagram-packet { opacity: 1; }

.diagram-node { cursor: pointer; }
.diagram-node rect {
  fill: canvas;
  stroke: color-mix(in srgb, canvastext 55%, canvas);
  stroke-width: 2;
  transition: fill 0.28s ease, stroke 0.28s ease, filter 0.28s ease;
  filter: drop-shadow(4px 5px 0 color-mix(in srgb, canvastext 10%, transparent));
}

.diagram-node.is-source rect,
.diagram-node.is-target rect,
.diagram-node.is-related rect,
.diagram-node:hover rect,
.diagram-node:focus-visible rect {
  stroke: var(--color-accent);
  filter: drop-shadow(4px 5px 0 color-mix(in srgb, var(--color-accent) 25%, transparent));
}

.diagram-node.is-source rect {
  fill: color-mix(in srgb, var(--color-accent) 13%, canvas);
  animation: diagram-source-pulse 1.6s ease-in-out infinite;
}

.architecture-viewport.is-paused .diagram-node.is-source rect { animation-play-state: paused; }

.diagram-node.is-target rect { fill: color-mix(in srgb, var(--color-accent) 8%, canvas); }
.diagram-node text {
  fill: canvastext;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  pointer-events: none;
}

.diagram-status {
  min-height: 2.5rem;
  margin: 0;
  padding: 0.75rem 0.15rem 0;
  color: var(--color-accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.architecture-explanation {
  max-width: 720px;
  margin: 2rem 0 0;
  line-height: 1.7;
}

.architecture-explanation ol {
  padding-left: 1.5rem;
  columns: 2;
  column-gap: 2rem;
}

.architecture-explanation li { margin: 0 0 0.7rem; break-inside: avoid; }
.architecture-explanation a { display: inline-block; margin-top: 1rem; }

@keyframes diagram-source-pulse {
  50% { filter: drop-shadow(0 0 12px color-mix(in srgb, var(--color-accent) 55%, transparent)); }
}

@media (max-width: 760px) {
  .architecture-controls { align-items: flex-start; flex-wrap: wrap; }
  .architecture-actions { width: 100%; }
  .architecture-scene { width: var(--graph-width); }
  .architecture-explanation ol { columns: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .diagram-connection,
  .diagram-node,
  .diagram-node rect { transition: none; animation: none; }
}
