:root {
  --bg: #fbfbfa;
  --surface: #f3f3f1;
  --text: #1f1f1d;
  --muted: #777772;
  --faint: #a5a5a0;
  --border: #deded9;
  --accent: #4d66d7;
  --accent-soft: #eef0fb;
  --code-bg: #f1f1ef;
  --header-bg: rgba(251, 251, 250, 0.88);
  --max-width: 980px;
  --reading-width: 760px;
  --radius: 10px;
}

:root[data-theme="dark"] {
  --bg: #151515;
  --surface: #1d1d1d;
  --text: #e9e9e5;
  --muted: #aaa9a3;
  --faint: #777670;
  --border: #30302e;
  --accent: #94a5ff;
  --accent-soft: #22283f;
  --code-bg: #202020;
  --header-bg: rgba(21, 21, 21, 0.88);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Pretendard, "Noto Sans KR", "Apple SD Gothic Neo",
    Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  transition: background-color 160ms ease, color 160ms ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.container {
  width: min(calc(100% - 40px), var(--max-width));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}

.nav {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
}

.nav-links a {
  transition: color 120ms ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.theme-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--surface);
  color: var(--text);
}

.hero {
  padding-top: 112px;
  padding-bottom: 84px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font: 700 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
}

.hero h1,
.page-header h1,
.post-header h1 {
  margin: 0;
  letter-spacing: -0.045em;
  line-height: 1.18;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(42px, 7vw, 72px);
}

.hero-description {
  max-width: 580px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.section {
  padding: 24px 0 72px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.section-heading a {
  color: var(--muted);
  font-size: 13px;
}

.section-heading a:hover {
  color: var(--text);
}

.post-list {
  border-bottom: 1px solid var(--border);
}

.post-row {
  border-top: 1px solid var(--border);
}

.post-row:first-child {
  border-top: 0;
}

.post-row a {
  display: block;
  padding: 30px 0 28px;
}

.post-row h2,
.post-row h3 {
  margin: 9px 0 8px;
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: -0.035em;
}

.post-row p {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.post-row:hover h2,
.post-row:hover h3 {
  color: var(--accent);
}

.post-meta,
.post-header-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--faint);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.post-meta span::before,
.post-header-meta span::before {
  content: "·";
  margin-right: 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tags span {
  color: var(--muted);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 18px;
}

.category-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 76px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.category-card:hover {
  background: var(--surface);
}

.category-name {
  font-weight: 650;
}

.category-count {
  color: var(--faint);
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.page {
  min-height: calc(100vh - 180px);
  padding-top: 88px;
  padding-bottom: 96px;
}

.page-header {
  padding-bottom: 54px;
}

.page-header h1 {
  font-size: clamp(42px, 6vw, 64px);
}

.page-header > p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.filter {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.filter:hover,
.filter.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.archive-list .post-row:first-child {
  border-top: 0;
}

.post-page {
  width: min(calc(100% - 40px), var(--reading-width));
  min-height: calc(100vh - 180px);
  margin-inline: auto;
  padding: 84px 0 96px;
}

.post-header {
  padding-bottom: 44px;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  margin-top: 18px;
  font-size: clamp(38px, 6vw, 58px);
}

.post-header-meta {
  margin-top: 20px;
}

.back-link {
  color: var(--muted);
  font-size: 13px;
}

.back-link:hover {
  color: var(--text);
}

.about-lead {
  max-width: 580px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-top: 48px;
  margin-top: 56px;
  border-top: 1px solid var(--border);
}

.post-navigation a {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.post-navigation a:hover {
  background: var(--surface);
}

.post-navigation .next {
  text-align: right;
}

.post-navigation span {
  color: var(--faint);
  font-size: 12px;
}

.post-navigation strong {
  font-size: 14px;
}

.site-footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--faint);
  font-size: 12px;
}

@media (max-width: 700px) {
  .container,
  .post-page {
    width: min(calc(100% - 28px), var(--max-width));
  }

  .nav {
    min-height: 58px;
  }

  .nav-links {
    gap: 14px;
  }

  .hero {
    padding-top: 78px;
    padding-bottom: 60px;
  }

  .hero h1 {
    font-size: 44px;
  }

  .hero-description {
    font-size: 16px;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .post-page {
    padding-top: 58px;
  }

  .post-header h1 {
    font-size: 38px;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }

  .post-navigation .next {
    text-align: left;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }
}


/* Write page */
.write-page {
  width: min(calc(100% - 40px), 1240px);
  min-height: calc(100vh - 180px);
  margin-inline: auto;
  padding: 64px 0 96px;
}

.write-shell {
  width: 100%;
}

.write-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.write-header h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.write-header p:last-child {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.write-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.button.secondary {
  background: var(--bg);
  color: var(--text);
}

.button.secondary:hover {
  background: var(--surface);
}

.button.primary {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.write-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(160px, 0.6fr) minmax(200px, 1fr);
  gap: 12px;
  padding: 24px 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: var(--bg);
  color: var(--text);
}

.field input:focus,
.field select:focus,
.editor-panel textarea:focus {
  border-color: var(--accent);
}

.field-title input {
  font-weight: 650;
}

.editor-toolbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  color: var(--muted);
  font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.editor-toolbar > div {
  display: flex;
  gap: 4px;
}

.editor-toolbar button {
  min-width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.editor-toolbar button:hover {
  background: var(--bg);
  color: var(--text);
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 640px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.editor-panel,
.preview-panel {
  min-width: 0;
  background: var(--bg);
}

.editor-panel {
  border-right: 1px solid var(--border);
}

.panel-label {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--faint);
  font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
}

.editor-panel textarea {
  display: block;
  width: 100%;
  min-height: 594px;
  padding: 24px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 14px/1.8 "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

.preview-panel {
  overflow: auto;
}

.preview-body {
  padding: 24px 28px 48px;
  font-size: 16px;
}

.preview-body h1:first-child {
  margin-top: 0;
}

.upload-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.upload-box strong {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
}

.upload-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  .write-page {
    width: min(calc(100% - 28px), 1240px);
    padding-top: 44px;
  }

  .write-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .write-fields {
    grid-template-columns: 1fr;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .editor-panel textarea {
    min-height: 430px;
  }

  .upload-box {
    align-items: flex-start;
    flex-direction: column;
  }
}
