@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

:root {
  --paper: #f6f5ff;
  --ink: #17142b;
  --line: rgba(50, 40, 120, 0.2);
  --muted: #67627d;
  --blue: #5365e8;
  --periwinkle: #747eea;
  --indigo: #4338a8;
  --violet: #7255d9;
  --plum: #8447a9;
  --purple: #6041c8;
  --cobalt: #3f52bd;
  --side: clamp(1.25rem, 4vw, 4.5rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", "Noto Sans KR", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}
a { color: inherit; }
button { font: 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; }
.skip-link { position: fixed; top: 0; left: 1rem; z-index: 100; padding: 0.7rem 1rem; background: var(--ink); color: var(--paper); transform: translateY(-110%); }
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 var(--side);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
}
.logo { font-size: 1.25rem; font-weight: 900; letter-spacing: -0.05em; text-decoration: none; }
.logo span { color: var(--violet); }
.site-nav { display: flex; gap: clamp(1rem, 3vw, 2.4rem); }
.site-nav a { font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.site-nav a:hover, .site-nav a:focus-visible { text-decoration: underline; text-underline-offset: 0.4rem; }
.menu-button { display: none; }

.intro {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(2rem, 5vh, 4rem) var(--side) clamp(2.5rem, 7vh, 5.5rem);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 84% 28%, rgba(114, 85, 217, 0.16), transparent 26%),
    linear-gradient(135deg, rgba(83, 101, 232, 0.06), transparent 48%);
}
.intro-kicker, .intro-footer { display: flex; align-items: flex-end; justify-content: space-between; }
.intro-kicker { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; }
.intro h1 {
  align-self: center;
  max-width: 13ch;
  margin: 0;
  font-family: "Noto Sans KR", sans-serif;
  font-size: clamp(4rem, 11vw, 10rem);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.08em;
}
.intro h1 em { color: var(--violet); font-style: normal; }
.intro-footer p { max-width: 38rem; margin: 0; font-size: clamp(1rem, 1.6vw, 1.3rem); word-break: keep-all; }
.round-link {
  display: grid;
  flex: 0 0 auto;
  width: 4rem;
  height: 4rem;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-size: 1.5rem;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}
.round-link:hover { background: var(--violet); border-color: var(--violet); color: white; transform: translateY(4px); }

.work-section, .about-section { padding: clamp(5rem, 10vw, 9rem) var(--side); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2.5rem; }
.eyebrow { margin: 0 0 0.7rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; }
.section-heading h2, .about-grid h2 {
  margin: 0;
  font-family: "Noto Sans KR", sans-serif;
  font-size: clamp(2.5rem, 5vw, 5.2rem);
  line-height: 1.1;
  letter-spacing: -0.06em;
}
.post-count { margin: 0 0 0.5rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2.25rem; }
.filter { padding: 0.65rem 1rem; border: 1px solid var(--ink); border-radius: 999px; background: transparent; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.filter:hover, .filter:focus-visible, .filter.is-active { background: var(--violet); border-color: var(--violet); color: white; }
.post-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(1rem, 2vw, 1.8rem); }
.post-card { grid-column: span 4; min-width: 0; }
.post-card:nth-child(5n + 1), .post-card:nth-child(5n + 2) { grid-column: span 6; }
.post-link { display: block; text-decoration: none; }
.post-visual {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background: var(--accent, var(--blue));
  color: white;
}
.post-visual::before { content: ""; position: absolute; width: 72%; aspect-ratio: 1; right: -18%; top: -30%; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 50%; transition: transform 350ms ease; }
.post-visual::after { content: ""; position: absolute; inset: 12%; border: 1px solid rgba(255, 255, 255, 0.22); }
.post-index { position: relative; z-index: 1; font-size: clamp(3.5rem, 7vw, 7rem); font-weight: 600; line-height: 0.8; letter-spacing: -0.08em; }
.post-link:hover .post-visual::before { transform: scale(1.18); }
.post-link:hover .post-title span { transform: translate(3px, -3px); }
.post-info { padding: 1rem 0 1.75rem; border-bottom: 1px solid var(--line); }
.post-meta { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; }
.post-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: 0; font-family: "Noto Sans KR", sans-serif; font-size: clamp(1.2rem, 2vw, 1.6rem); line-height: 1.35; letter-spacing: -0.04em; }
.post-title span { transition: transform 180ms ease; }
.post-description { margin: 0.7rem 0 0; color: var(--muted); font-size: 0.92rem; word-break: keep-all; }
.empty-state { grid-column: 1 / -1; padding: 4rem 1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); text-align: center; }

.about-section {
  background:
    radial-gradient(circle at 18% 25%, rgba(126, 105, 255, 0.24), transparent 30%),
    #20184a;
  color: #f8f7ff;
}
.about-grid { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: clamp(3rem, 10vw, 9rem); align-items: start; }
.about-copy { max-width: 34rem; padding-top: 0.5rem; }
.about-copy > p { margin: 0 0 4rem; font-size: clamp(1.1rem, 1.8vw, 1.4rem); word-break: keep-all; }
.about-copy dl { margin: 0; }
.about-copy dl div { display: grid; grid-template-columns: 5rem 1fr; padding: 1rem 0; border-top: 1px solid rgba(244, 241, 232, 0.25); }
.about-copy dt { color: rgba(244, 241, 232, 0.6); }
.about-copy dd { margin: 0; }
.favorites { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 2.5rem; }
.favorites span { padding: 0.55rem 0.9rem; border: 1px solid rgba(248, 247, 255, 0.35); border-radius: 999px; color: #e7e3ff; font-size: 0.9rem; }
.site-footer { display: flex; justify-content: space-between; padding: 1.4rem var(--side); border-top: 1px solid var(--line); font-size: 0.85rem; }
.site-footer p { margin: 0; }
.site-footer a { text-decoration: none; }

body.dialog-open { overflow: hidden; }
.post-dialog {
  width: min(58rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2rem 6rem rgba(23, 20, 43, 0.3);
}
.post-dialog::backdrop { background: rgba(20, 16, 55, 0.72); backdrop-filter: blur(5px); }
.dialog-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1.25rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
}
.dialog-bar p { margin: 0; color: var(--violet); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.08em; }
.dialog-close { padding: 0.45rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; }
.dialog-close:hover, .dialog-close:focus-visible { background: var(--violet); border-color: var(--violet); color: white; }
.markdown-document { max-width: 48rem; margin: 0 auto; padding: clamp(2.5rem, 7vw, 6rem) clamp(1.25rem, 5vw, 4rem); }
.dialog-date { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.9rem; }
.markdown-content h1 { margin: 0 0 3rem; font-family: "Noto Sans KR", sans-serif; font-size: clamp(2.25rem, 6vw, 4.5rem); line-height: 1.12; letter-spacing: -0.06em; word-break: keep-all; }
.markdown-content h2 { margin: 3.5rem 0 1rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-family: "Noto Sans KR", sans-serif; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.35; letter-spacing: -0.04em; }
.markdown-content h3 { margin: 2rem 0 0.75rem; font-size: 1.15rem; }
.markdown-content p, .markdown-content li { font-size: 1.05rem; line-height: 1.85; word-break: keep-all; }
.markdown-content p { margin: 0 0 1.25rem; }
.markdown-content ul, .markdown-content ol { margin: 0 0 1.5rem; padding-left: 1.4rem; }
.markdown-content li { margin-bottom: 0.5rem; padding-left: 0.25rem; }
.markdown-content blockquote { margin: 2rem 0; padding: 1.25rem 1.5rem; border-left: 4px solid var(--violet); background: rgba(114, 85, 217, 0.08); font-size: 1.1rem; }
.markdown-content code { padding: 0.15em 0.35em; border-radius: 0.25rem; background: rgba(67, 56, 168, 0.1); font-family: Consolas, monospace; font-size: 0.9em; }
.markdown-content pre { overflow-x: auto; margin: 1.5rem 0; padding: 1.25rem; border-radius: 0.5rem; background: #20184a; color: #f8f7ff; }
.markdown-content pre code { padding: 0; background: none; color: inherit; }
.loading-message { color: var(--muted); }

@media (max-width: 820px) {
  .post-card, .post-card:nth-child(5n + 1), .post-card:nth-child(5n + 2) { grid-column: span 6; }
  .about-grid { grid-template-columns: 1fr; }
  .about-copy { padding-top: 0; }
}
@media (max-width: 620px) {
  .site-header { min-height: 64px; }
  .menu-button { display: grid; width: 2.75rem; height: 2.75rem; place-content: center; gap: 6px; padding: 0; border: 0; background: transparent; }
  .menu-button span:not(.sr-only) { display: block; width: 22px; height: 1px; background: currentColor; transition: transform 180ms ease; }
  .menu-button[aria-expanded="true"] span:nth-child(2) { transform: translateY(3.5px) rotate(45deg); }
  .menu-button[aria-expanded="true"] span:nth-child(3) { transform: translateY(-3.5px) rotate(-45deg); }
  .site-nav { position: absolute; inset: 64px 0 auto; display: none; flex-direction: column; gap: 0; padding: 0 var(--side) 1rem; border-bottom: 1px solid var(--line); background: var(--paper); }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 0.85rem 0; }
  .intro { min-height: calc(100svh - 64px); }
  .intro h1 { font-size: clamp(3.45rem, 18vw, 6.5rem); }
  .intro-footer { align-items: flex-end; gap: 1.25rem; }
  .round-link { width: 3.2rem; height: 3.2rem; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 0.5rem; }
  .post-card, .post-card:nth-child(5n + 1), .post-card:nth-child(5n + 2) { grid-column: 1 / -1; }
  .post-visual { aspect-ratio: 5 / 4; }
  .about-copy > p { margin-bottom: 2.5rem; }
  .post-dialog { width: 100%; max-width: none; max-height: 100dvh; height: 100dvh; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
