/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #1a1a1a;
  --text-color: #1a1a1a;
  --text-light: #666666;
  --bg-color: #ffffff;
  --bg-header: #fafafa;
  --bg-card: #ffffff;
  --border-color: #e5e5e5;
  --link-color: #1a1a1a;
  --max-width: 700px;
  --spacing: 2rem;
}

body {
  font-family: "Spoqa Han Sans Neo", "Spoqa Han Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--bg-color);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing);
}

/* Header */
.site-header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar {
  display: flex;
}

.site-header .navbar .container {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center;
  width: 100%;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary-color);
  text-decoration: none;
  letter-spacing: 0.02em;
  text-align: left;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.9375rem;
}

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

.site-header.hidden {
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out;
}

/* Main Content */
.main-content {
  min-height: calc(100vh - 200px);
  padding: 5rem 0;
}

/* Home Page */
.page-heading {
  font-size: 1.125rem;
  font-weight: 900;
  margin-bottom: 4rem;
  color: var(--text-light);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.post-list {
  list-style: none;
}

.post-item {
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-color);
  padding: 2.5rem 0;
}

.post-item:first-child {
  padding-top: 0;
}

.post-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.post-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.post-card-link:hover {
  color: inherit;
}

.post-card {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.post-content-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}

.post-text {
  flex: 1;
  min-width: 0;
}

.post-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.6;
  letter-spacing: -0.01em;
  color: var(--primary-color);
}

.post-card-link:hover .post-title {
  color: var(--text-light);
}

.post-thumbnail {
  flex-shrink: 0;
  width: 150px;
  height: 100px;
  overflow: hidden;
  border-radius: 0.25rem;
  background-color: var(--bg-card);
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-excerpt {
  color: var(--text-light);
  line-height: 1.6;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0;
  font-size: 0.75rem;
  color: var(--text-light);
  flex-wrap: wrap;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  background-color: var(--bg-card);
  color: var(--text-light);
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 400;
}

/* Post Page */
.post {
  max-width: 650px;
  margin: 0 auto;
}

/* Hide page-heading on post detail pages */
.post .page-heading {
  display: none !important;
}

.post-header {
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.post-header .post-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary-color);
  line-height: 1.5;
  letter-spacing: -0.02em;
}

.post-content {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-color);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  letter-spacing: -0.01em;
}

.post-content h1 {
  font-size: 1.375rem;
  line-height: 1.4;
  font-weight: 700;
}

.post-content h2 {
  font-size: 1.5rem;
  line-height: 1.4;
  font-weight: 600;
}

.post-content h3 {
  font-size: 1.25rem;
  line-height: 1.5;
  font-weight: 600;
}

.post-content h4 {
  font-size: 1rem;
  line-height: 1.5;
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 400;
}

.post-content a:hover {
  color: var(--text-light);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
  margin: 2.5rem auto;
  border: none;
  display: block;
}

.post-content img.center-image {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.post-content blockquote {
  border-left: 1px solid var(--border-color);
  padding-left: 1.5rem;
  margin: 2rem 0;
  color: var(--text-light);
  font-style: normal;
  background-color: transparent;
}

.post-content code {
  background-color: var(--bg-card);
  padding: 0.125rem 0.375rem;
  border-radius: 0;
  font-size: 0.9em;
  font-family: 'Source Code Pro', 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Droid Sans Mono', 'Courier New', monospace;
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  line-height: 1.3;
}

.post-content pre {
  background-color: var(--bg-card);
  padding: 1rem;
  border-radius: 0;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-color);
  font-size: 0.9em;
  line-height: 1.4;
  font-family: 'Source Code Pro', 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Droid Sans Mono', 'Courier New', monospace;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: var(--text-color);
  border: none;
  font-size: 0.9em;
  line-height: 1.4;
  font-family: 'Source Code Pro', 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Droid Sans Mono', 'Courier New', monospace;
}

/* KaTeX LaTeX styling */
.katex {
  font-size: 0.8em;
}

.post-content .katex {
  font-size: 0.95rem;
}

/* Display math ($$ ... $$) - KaTeX는 기본적으로 중앙 정렬 */
.post-content .katex-display {
  margin: 2rem auto !important;
  text-align: center;
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
}

.post-content .katex-display > .katex {
  text-align: left;
  display: inline-block;
}

.post-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  gap: 1rem;
}

.nav-previous,
.nav-next {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.9375rem;
  flex: 1;
}

.nav-previous:hover,
.nav-next:hover {
  color: var(--text-light);
}

.nav-next {
  text-align: right;
}

/* About Page */
.about-page {
  max-width: 650px;
  margin: 0 auto;
}

.profile-image-wrapper {
  width: 200px;
  height: 200px;
  margin: 0 auto 2rem;
  border-radius: 50%;
  overflow: hidden;
  display: block;
}

.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.about-content > p:first-of-type {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.about-content p:nth-of-type(2) {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.about-content {
  font-size: 0.9375rem;
}

.about-content p {
  margin-bottom: 0.25rem;
}

.about-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 0.25rem;
  color: var(--primary-color);
  letter-spacing: -0.01em;
}

.about-content h2:first-of-type {
  margin-top: 2rem;
}

.about-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--primary-color);
  letter-spacing: -0.01em;
}

.about-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1.5rem;
}

.about-content li {
  margin-bottom: 0.5rem;
  padding-left: 0;
}

.about-content > ul:first-of-type {
  margin-top: 0;
  margin-bottom: 2rem;
}

.about-content > ul:first-of-type li {
  margin-bottom: 0.25rem;
  list-style: none;
}

.about-content > ul:first-of-type li::before {
  content: "* ";
}

.about-content a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 400;
}

.about-content a:hover {
  color: var(--text-light);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Education Section */
.education-item {
  margin-bottom: 2rem;
}

.education-item:last-child {
  margin-bottom: 0;
}

.education-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.education-header strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
}

.education-fullname {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-light);
}

.education-date {
  font-size: 0.875rem;
  color: var(--text-light);
  font-weight: 400;
  white-space: nowrap;
}

.education-details {
  padding-left: 0;
}

.education-details > div {
  margin-bottom: 0.25rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-color);
}

.education-note {
  font-size: 0.875rem;
  color: var(--text-light);
  font-style: italic;
  margin-top: 0.25rem;
}

/* Experience Section */
.experience-company {
  margin-bottom: 2.5rem;
  margin-top: 0;
}

h2 + .experience-company {
  margin-top: 0;
}

.experience-company:last-child {
  margin-bottom: 0;
}

.experience-company h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
  letter-spacing: -0.01em;
}

.experience-company:first-child h3 {
  margin-top: 0.25rem;
}

.experience-item {
  margin-bottom: 1.5rem;
}

.experience-item:last-child {
  margin-bottom: 0;
}

.experience-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.experience-header strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
}

.experience-date {
  font-size: 0.875rem;
  color: var(--text-light);
  font-weight: 400;
  white-space: nowrap;
}

.experience-details {
  padding-left: 0;
}

.experience-details ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-top: 0;
  margin-bottom: 0;
}

.experience-details li {
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-color);
}

.experience-details ul ul {
  list-style: circle;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* Publication Section */
.publication-item {
  margin-bottom: 1.5rem;
}

.publication-item:last-child {
  margin-bottom: 0;
}

.publication-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.publication-header strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  flex: 1;
  min-width: 0;
}

.publication-header strong a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.publication-header strong a:hover {
  color: var(--text-light);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.publication-date {
  font-size: 0.875rem;
  color: var(--text-light);
  font-weight: 400;
  white-space: nowrap;
}

.publication-details {
  padding-left: 0;
}

.publication-details > div {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-color);
}

/* Footer */
.site-footer {
  background-color: var(--bg-header);
  border-top: 1px solid var(--border-color);
  padding: 4rem 0;
  margin-top: 6rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.8125rem;
}

.footer-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 400;
}

.footer-links a:hover {
  color: var(--text-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --spacing: 1.25rem;
  }

  .main-content {
    padding: 3rem 0;
  }

  .site-header {
    padding: 1.5rem 0;
    position: static;
  }

  .navbar {
    flex-direction: row;
    align-items: center;
  }

  .site-header .navbar .container {
    display: flex !important;
    justify-content: space-between !important;
  }

  .nav-links {
    gap: 1.5rem;
  }

  .page-heading {
    font-size: 0.6875rem;
    margin-bottom: 3rem;
  }

  .post-item {
    padding: 2rem 0;
  }

  .post-content-wrapper {
    flex-direction: column;
    gap: 1rem;
  }

  .post-thumbnail {
    width: 100%;
    height: 180px;
    order: -1;
  }

  .post-title {
    font-size: 1.125rem;
  }

  .post-header {
    margin-bottom: 3rem;
  }

  .post-header .post-title {
    font-size: 1.375rem;
    font-weight: 700;
  }

  .post-content {
    font-size: 0.9375rem;
  }

  .post-content h1 {
    font-size: 1.25rem;
    font-weight: 700;
  }

  .post-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
  }

  .post-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
  }

  .post-navigation {
    flex-direction: column;
    gap: 1rem;
    margin-top: 4rem;
  }

  .nav-next {
    text-align: left;
  }

  .profile-image-wrapper {
    width: 150px;
    height: 150px;
    margin-bottom: 1.5rem;
  }

  .about-page h1 {
    font-size: 1.375rem;
    font-weight: 700;
  }

  .about-content h2 {
    font-size: 1.5rem;
  }

  .about-content h3 {
    font-size: 1.25rem;
  }

  .experience-company h3 {
    font-size: 1.25rem;
  }

  .experience-header strong {
    font-size: 1rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.75rem;
  }

  .site-footer {
    padding: 3rem 0;
    margin-top: 4rem;
  }

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

  .education-date {
    margin-top: 0.25rem;
  }

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

  .experience-date {
    margin-top: 0.25rem;
  }

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

  .publication-date {
    margin-top: 0.25rem;
  }
}
