/* ==========================================================================
   Custom theme — modeled after current medium.com (2024–2026)
   ========================================================================== */

:root {
  --text: #242424;
  --text-secondary: #6b6b6b;
  --border: #f2f2f2;
  --code-bg: #f7f7f7;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Pretendard",
    "Apple SD Gothic Neo", "Malgun Gothic", "Helvetica Neue", Arial, sans-serif;
  --serif: "Noto Serif KR", georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  color: var(--text);
  background: #fff;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* Header
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  max-width: 1192px;
  margin: 0 auto;
  padding: 0 24px;
  height: 57px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-header-left {
  display: flex;
  align-items: center;
  gap: 40px;
  min-width: 0;
}

/* Header search */
.site-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  width: 440px;
  padding: 0 20px;
  background: #f9f9f9;
  border: 0;
  border-radius: 9999px;
  color: var(--text-secondary);
}
.site-search svg { flex-shrink: 0; }
.site-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--text);
}
.site-search input::placeholder { color: var(--text-secondary); }
.site-search input::-webkit-search-cancel-button { display: none; }
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  max-height: 420px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 100;
}
.search-result {
  display: block;
  padding: 12px 16px;
}
.search-result:hover { background: #fafafa; }
.search-result + .search-result { border-top: 1px solid var(--border); }
.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 2px;
}
.search-result-date {
  font-size: 12px;
  color: var(--text-secondary);
}
.search-empty {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.site-nav a {
  font-size: 14px;
  color: var(--text-secondary);
  margin-left: 24px;
}
.site-nav a:hover { color: var(--text); }

/* Home (profile-style)
   ========================================================================== */
.profile-wrap {
  max-width: 1192px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: flex-start;
}
.profile-main {
  flex: 1;
  min-width: 0;
  max-width: 728px;
  margin: 0 auto;
  padding-top: 52px;
}
.profile-name {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 40px;
}
.profile-tabs {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.profile-tabs a {
  font-size: 14px;
  color: var(--text-secondary);
  padding-bottom: 16px;
  margin-bottom: -1px;
  border-bottom: 1px solid transparent;
}
.profile-tabs a.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.profile-tabs a:hover { color: var(--text); }

/* Post list */
.post-item {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}
.post-item-body { flex: 1; min-width: 0; }
.post-item-date {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.post-item-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin-bottom: 8px;
}
.post-item-excerpt {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-item-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 12px;
}
.post-item-thumb {
  flex-shrink: 0;
  width: 160px;
}
.post-item-thumb img {
  width: 160px;
  height: 107px;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  padding: 32px 0 64px;
  font-size: 14px;
}
.pagination a { color: var(--text-secondary); }
.pagination a:hover { color: var(--text); }

/* Sidebar */
.profile-sidebar {
  width: 330px;
  flex-shrink: 0;
  margin-left: 48px;
  padding: 52px 0 0 40px;
  border-left: 1px solid var(--border);
  min-height: 70vh;
}
.sidebar-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
}
.sidebar-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.sidebar-bio {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}
.sidebar-link-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  font-size: 14px;
}
.sidebar-link-label { color: var(--text-secondary); }
.sidebar-link {
  font-size: 14px;
  color: #1a8917;
}
.sidebar-link:hover { text-decoration: underline; }

/* Post page
   ========================================================================== */
.post {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.post-title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.016em;
  line-height: 1.25;
  margin-bottom: 32px;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 48px;
}
.post-meta-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 4px;
}
.post-meta-author { color: var(--text); }

/* Post body */
.post-content {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.9;
  color: var(--text);
  word-break: keep-all;
  overflow-wrap: break-word;
}
.post-content p { margin: 0 0 1.6em; }
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 1.8em 0 0.6em;
}
.post-content h2 { font-size: 26px; }
.post-content h3 { font-size: 21px; }
.post-content h4 { font-size: 18px; }
.post-content a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.post-content img {
  display: block;
  width: 100%;
  margin: 2em 0;
}
.post-content ul,
.post-content ol {
  margin: 0 0 1.6em;
  padding-left: 1.6em;
}
.post-content li { margin-bottom: 0.4em; }
.post-content blockquote {
  border-left: 3px solid var(--text);
  padding-left: 20px;
  font-style: italic;
  color: var(--text-secondary);
  margin: 0 0 1.6em;
}
.post-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3em auto;
  width: 120px;
}
.post-content code {
  font-family: var(--mono);
  font-size: 0.78em;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 3px;
}
.post-content pre {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 20px;
  overflow-x: auto;
  margin: 0 0 1.6em;
  line-height: 1.55;
}
.post-content pre code {
  background: none;
  padding: 0;
  font-size: 14px;
}
.post-content .highlight { background: var(--code-bg); }
.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1.6em;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  display: block;
  overflow-x: auto;
}
.post-content th,
.post-content td {
  border: 1px solid #e6e6e6;
  padding: 8px 12px;
  text-align: left;
}
.post-content th { background: #fafafa; font-weight: 600; }

/* Author block at post end */
.post-author { margin-top: 64px; }
.post-author-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin-bottom: 40px;
}
.post-author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
}
.post-author-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}
.post-author-bio {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
}
.site-footer-inner {
  max-width: 1192px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--text-secondary);
}
.site-footer a:hover { color: var(--text); }

/* Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .site-search { width: 280px; }
}
@media (max-width: 768px) {
  .site-search { display: none; }
  .profile-sidebar { display: none; }
  .profile-main { padding-top: 32px; }
  .profile-name { font-size: 32px; margin-bottom: 28px; }
  .post-item { gap: 20px; }
  .post-item-title { font-size: 18px; }
  .post-item-excerpt { font-size: 15px; }
  .post-item-thumb { width: 100px; }
  .post-item-thumb img { width: 100px; height: 67px; }
  .post { padding-top: 36px; }
  .post-title { font-size: 30px; }
  .post-content { font-size: 18px; line-height: 1.85; }
  .post-content h2 { font-size: 23px; }
  .post-content h3 { font-size: 19px; }
}

/* Rouge syntax highlighting (github style) */
.highlight table td { padding: 5px; }
.highlight table pre { margin: 0; }
.highlight, .highlight .w {
  color: #24292f;
  background-color: #f6f8fa;
}
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .kv {
  color: #cf222e;
}
.highlight .gr {
  color: #f6f8fa;
}
.highlight .gd {
  color: #82071e;
  background-color: #ffebe9;
}
.highlight .nb {
  color: #953800;
}
.highlight .nc {
  color: #953800;
}
.highlight .no {
  color: #953800;
}
.highlight .nn {
  color: #953800;
}
.highlight .sr {
  color: #116329;
}
.highlight .na {
  color: #116329;
}
.highlight .nt {
  color: #116329;
}
.highlight .gi {
  color: #116329;
  background-color: #dafbe1;
}
.highlight .ges {
  font-weight: bold;
  font-style: italic;
}
.highlight .kc {
  color: #0550ae;
}
.highlight .l, .highlight .ld, .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx {
  color: #0550ae;
}
.highlight .sb {
  color: #0550ae;
}
.highlight .bp {
  color: #0550ae;
}
.highlight .ne {
  color: #0550ae;
}
.highlight .nl {
  color: #0550ae;
}
.highlight .py {
  color: #0550ae;
}
.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi, .highlight .vm {
  color: #0550ae;
}
.highlight .o, .highlight .ow {
  color: #0550ae;
}
.highlight .gh {
  color: #0550ae;
  font-weight: bold;
}
.highlight .gu {
  color: #0550ae;
  font-weight: bold;
}
.highlight .s, .highlight .sa, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .se, .highlight .sh, .highlight .sx, .highlight .s1, .highlight .ss {
  color: #0a3069;
}
.highlight .nd {
  color: #8250df;
}
.highlight .nf, .highlight .fm {
  color: #8250df;
}
.highlight .err {
  color: #f6f8fa;
  background-color: #82071e;
}
.highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cp, .highlight .cpf, .highlight .c1, .highlight .cs {
  color: #6e7781;
}
.highlight .gl {
  color: #6e7781;
}
.highlight .gt {
  color: #6e7781;
}
.highlight .ni {
  color: #24292f;
}
.highlight .si {
  color: #24292f;
}
.highlight .ge {
  color: #24292f;
  font-style: italic;
}
.highlight .gs {
  color: #24292f;
  font-weight: bold;
}
