/* ===== Custom Beautification ===== */

/* --- Better Font --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Smoother Global Transitions --- */
a {
  transition: color 0.2s ease, background-color 0.2s ease;
}

/* --- Header: Glassmorphism Effect --- */
.header {
  height: 56px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(200, 200, 200, 0.2);
}

.header .header-nav {
  height: 56px;
  max-width: 1100px;
  margin: 0 auto;
}

.header-nav .nav-title {
  line-height: 56px;
}

.header-nav .nav-title a {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.header-nav .nav-links {
  line-height: 56px;
}

.nav-links .nav-link a {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-links .nav-link a:hover {
  background-color: rgba(128, 128, 128, 0.1);
}

.header-nav .avatar img {
  margin-top: 8px;
  border: 2px solid rgba(128, 128, 128, 0.15);
  transition: transform 0.2s ease;
}

.header-nav .avatar img:hover {
  transform: scale(1.08);
}

/* --- Content Area: Better Spacing --- */
main#content {
  margin-top: 80px;
}

main#content > .container {
  max-width: 760px;
}

main#content > .container.list-posts {
  max-width: 1000px;
}

main#content > .post.container,
main#content > .container.tags-list {
  max-width: 1100px;
}

/* --- Post List: wider title, date right-aligned --- */
.list-posts .post-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.post-title .post-link {
  width: auto;
  flex: 1;
  margin-right: 12px;
}

.post-title .post-date {
  white-space: nowrap;
  flex-shrink: 0;
}

/* --- Home Page: Refined Avatar & Bio --- */
.home-about {
  padding: 40px 0 20px;
}

.home-about .avatar img {
  border: 3px solid rgba(128, 128, 128, 0.12);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.home-about .avatar img:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.home-about h1 {
  font-size: 1.8em;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 20px;
}

.home-about p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: inherit;
  opacity: 0.8;
}

/* --- Social Icons --- */
.social-icons-list .social-icon {
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0.7;
}

.social-icons-list .social-icon:hover {
  transform: translateY(-2px);
  opacity: 1;
}

/* --- Post List: Card Style --- */
.list-posts .posts-year {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 50px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(128, 128, 128, 0.15);
}

.list-posts .post-title {
  margin: 0;
  padding: 14px 16px;
  border-radius: 10px;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.list-posts .post-title:hover {
  background-color: rgba(128, 128, 128, 0.07);
  transform: translateX(4px);
}

.post-title .post-link {
  font-weight: 500;
  font-size: 0.9rem;
}

.post-title .post-date {
  font-size: 0.85rem;
  opacity: 0.55;
}

/* --- Single Post: Better Typography --- */
.post .post-header-section h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.post .post-date {
  font-size: 0.9rem;
  opacity: 0.6;
}

.post .post-content {
  line-height: 1.8;
  letter-spacing: 0.01em;
}

.post-content p {
  margin-bottom: 1.2em;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.post-content h2 {
  margin-top: 2.5em;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

/* --- Blockquote --- */
blockquote {
  border-left: 3px solid var(--accent-color);
  padding: 0.5rem 1.2rem;
  margin: 1.5em 0;
  font-style: italic;
  opacity: 0.85;
  border-radius: 0 6px 6px 0;
  background: rgba(128, 128, 128, 0.04);
}

/* --- Code Blocks --- */
pre {
  border-radius: 10px;
  padding: 20px 24px;
  font-size: 0.88rem;
  line-height: 1.6;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

:not(pre) > code {
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.85em;
}

/* --- Tags --- */
.post-tags .post-tag {
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-width: 1.5px;
}

.post-tags .post-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post-tag a {
  padding: 5px 14px;
}

/* --- Tables --- */
table {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

table thead {
  font-weight: 600;
  font-size: 0.9rem;
}

table td, table th {
  padding: 1rem 1.4rem;
}

/* --- Footer --- */
.footer {
  opacity: 0.7;
  font-size: 0.85rem;
  padding: 30px 0;
}

.footer span {
  font-size: 0.85em;
}

/* --- Horizontal Rule --- */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(128,128,128,0.3), transparent);
  margin: 3em auto;
}

/* --- Images in Posts --- */
.post-content img {
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin: 1.5em auto;
}

/* --- TOC --- */
#toc {
  top: 76px;
}

#toc ul li a {
  font-size: 0.82rem;
  opacity: 0.65;
  transition: opacity 0.2s ease, color 0.2s ease;
}

#toc ul li a:hover,
#toc ul li a.active {
  opacity: 1;
}

/* --- About Page Enhancements --- */
.post.container h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 2em;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

/* --- About Me Section --- */
.about-me-section {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 12px;
}

.about-me-img {
  flex-shrink: 0;
  width: 100px;
}

.about-me-img img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.about-me-info {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.6;
}

@media only screen and (max-width: 820px) {
  .about-me-section {
    flex-direction: column;
    text-align: center;
  }
}

/* --- Publications (reference site style) --- */
.pub-entry {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  gap: 20px;
}

.pub-img {
  position: relative;
  flex-shrink: 0;
  width: 150px;
}

.pub-img img {
  width: 150px;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15);
}

.pub-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background-color: #002D72;
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
}

.pub-info {
  flex: 1;
}

.pub-title {
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.4;
  margin-bottom: 4px;
}

.pub-title a {
  color: inherit;
  text-decoration: none;
}

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

.pub-authors {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.5;
  margin-bottom: 2px;
}

.pub-venue {
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.pub-links {
  display: flex;
  gap: 8px;
}

.pub-links a {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 10px;
  border: 1px solid #333;
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
}

.pub-links a:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

html[data-theme="dark"] .pub-authors {
  color: #aaa;
}

html[data-theme="dark"] .pub-links a {
  border-color: #aaa;
}

html[data-theme="dark"] .pub-img img {
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4);
}

@media only screen and (max-width: 820px) {
  .pub-entry {
    flex-direction: column;
    align-items: flex-start;
  }
  .pub-img {
    width: 120px;
  }
  .pub-img img {
    width: 120px;
    height: 80px;
  }
}


/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: 24px;
  border-left: 2px solid rgba(128, 128, 128, 0.2);
  margin-top: 16px;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px 0;
  transition: opacity 0.2s ease;
}

.timeline-header:hover {
  opacity: 0.7;
}

.timeline-dot {
  position: absolute;
  left: -31px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-color);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--accent-color);
}

html[data-theme="dark"] .timeline-dot {
  border-color: rgb(34, 39, 46);
}

.timeline-place {
  font-size: 1.05rem;
  font-weight: 600;
}

.timeline-date {
  font-size: 0.85rem;
  color: gray;
}

.timeline-photos {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease 0.15s, opacity 0.3s ease 0.15s;
  opacity: 0;
}

.timeline-item:hover .timeline-photos,
.timeline.expanded .timeline-photos {
  max-height: 600px;
  opacity: 1;
  transition: max-height 0.4s ease 0.3s, opacity 0.3s ease 0.3s;
}

/* --- Expand All Dot --- */
.expand-all-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e74c3c;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #e74c3c;
  cursor: pointer;
  margin-left: 8px;
  vertical-align: middle;
  transition: transform 0.2s ease;
}

html[data-theme="dark"] .expand-all-dot {
  border-color: rgb(34, 39, 46);
}

.expand-all-dot:hover {
  transform: scale(1.15);
}

/* --- Photo Grid (Life page) --- */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 32px;
}

.photo-grid.three-col {
  grid-template-columns: 1fr 1fr 1fr;
}

.photo-grid.four-col {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.photo-grid-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
  display: block;
  margin: 0;
}

.photo-grid-item img:hover {
  transform: scale(1.02);
}

.photo-grid-item.photo-wide {
  grid-column: 1 / -1;
}

.photo-grid-item.photo-wide img {
  height: 300px;
}

@media only screen and (max-width: 820px) {
  .photo-grid {
    grid-template-columns: 1fr;
  }
  .photo-grid-item.photo-wide img,
  .photo-grid-item img {
    height: 200px;
  }
}

/* --- Selection Color --- */
::selection {
  background-color: var(--accent-color);
  color: white;
}

/* --- Scrollbar (Webkit) --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.5);
}

/* --- Dark Mode Adjustments --- */
html[data-theme="dark"] .list-posts .post-title:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .home-about .avatar img {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] blockquote {
  background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] pre {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .post-content img {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] table {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* --- Smooth Page Load --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main#content {
  animation: fadeInUp 0.4s ease-out;
}

/* --- Responsive Tweaks --- */
@media only screen and (max-width: 820px) {
  .header {
    height: 52px;
  }
  .header .header-nav {
    height: 52px;
  }
  .header-nav .nav-links {
    line-height: 52px;
  }
  main#content {
    margin-top: 70px;
  }
  .list-posts .post-title {
    padding: 12px;
  }
  .post .post-header-section h1 {
    font-size: 1.6rem;
  }
}
