/* Minimal portfolio - antfu.me style, CSS variables, dark mode */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f5;
  --text: #18181b;
  --text-muted: #71717a;
  --link: #111;
  --border: #e5e5e5;
  --card-bg: #ffffff;
  --btn-bg: transparent;
  --btn-border: #e0e0e0;
  --btn-text: #707070;
  --btn-hover-bg: #e6f7ff;
  --btn-hover-border: #c7e6ff;
  --btn-hover-text: #5a9ce6;
  --btn-accent: #6366f1;
  --btn-accent-soft: rgba(99, 102, 241, 0.15);
  --particles-color: #d4d4d8;
  --particles-line: rgba(212, 212, 216, 0.3);
}
.dark {
  --bg: #0a0a0a;
  --bg-soft: #141414;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --link: #e5e5e5;
  --border: #333;
  --card-bg: #111111;
  --btn-bg: transparent;
  --btn-border: #61626a;
  --btn-text: #a1a1aa;
  --btn-hover-bg: #282a32;
  --btn-hover-border: #61626a;
  --btn-hover-text: #80b3ff;
  --btn-accent: #818cf8;
  --btn-accent-soft: rgba(129, 140, 248, 0.2);
  --particles-color: #52525b;
  --particles-line: rgba(82, 82, 91, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  margin: 0;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Top spacing - compact */
.site-wrap { position: relative; z-index: 1; padding-top: 2.5rem; }

/* Full-page particles - subtle, light/dark adapted via opacity */
#particles-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.7;
}
.dark #particles-bg { opacity: 0.45; }
#particles-bg canvas { display: block; width: 100% !important; height: 100% !important; }

/* Header - compact, antfu style */
.site-header {
  padding: 1.25rem 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.header-right { display: flex; align-items: center; gap: 1rem; }
.site-brand { font-weight: 600; font-size: 1.1rem; }
.site-brand a { color: var(--text); }
.site-brand a:hover { color: var(--link); }
.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--link); }
.site-nav a.nav-active { color: var(--link); font-weight: 500; }
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  color: var(--text-muted);
  border-radius: 6px;
  transition: transform 0.2s, color 0.2s;
}
.theme-toggle:hover { color: var(--link); transform: scale(1.06); }
.theme-toggle svg { width: 20px; height: 20px; display: block; }
.theme-toggle .icon-moon { display: none; }
.dark .theme-toggle .icon-sun { display: none !important; }
.dark .theme-toggle .icon-moon { display: block !important; }

/* Sections - tighter vertical rhythm */
.section {
  padding: clamp(2.5rem, 6vw, 4rem) 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  line-height: 1.3;
}
#work.section { padding-bottom: 1.5rem; }
#contact.section { padding-top: 1rem; }

/* Blog / Articles page */
.page-main { padding-top: clamp(3rem, 8vw, 5rem); }
.page-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  margin: 0 0 2.5rem;
  line-height: 1.2;
}

/* About - vinaya style, no borders */
.about-section { padding-top: clamp(2rem, 6vw, 4rem); }
.about-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(2rem, 5vw, 3rem);
  align-items: start;
}
@media (max-width: 640px) {
  .about-wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .about-links { justify-content: center; }
}
.about-profile-wrap { line-height: 0; }
.about-profile {
  width: clamp(140px, 28vw, 200px);
  height: clamp(140px, 28vw, 200px);
  border-radius: 50%;
  object-fit: cover;
}
.about-content { min-width: 0; }
.about-heading {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  margin: 0 0 0.75rem;
  line-height: 1.3;
}
.about-bio {
  font-size: clamp(1rem, 2vw, 1.1rem);
  line-height: 1.8;
  color: var(--text-muted);
  max-width: 52ch;
  margin: 0 0 1.5rem;
}
.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.about-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s, background 0.2s;
}
.about-links a:hover { color: var(--link); transform: translateY(-1px); background: var(--bg-soft); }
.about-links img { width: 20px; height: 20px; }
.dark .about-links img { filter: invert(1); opacity: 0.85; }

/* Experience - two columns, shared row heights; mobile: left col then right col */
.exp-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, 1fr);
  gap: 1rem;
  align-items: stretch;
}
.exp-list > li:nth-child(1) { grid-column: 1; grid-row: 1; }
.exp-list > li:nth-child(2) { grid-column: 1; grid-row: 2; }
.exp-list > li:nth-child(3) { grid-column: 1; grid-row: 3; }
.exp-list > li:nth-child(4) { grid-column: 1; grid-row: 4; }
.exp-list > li:nth-child(5) { grid-column: 2; grid-row: 1; }
.exp-list > li:nth-child(6) { grid-column: 2; grid-row: 2; }
.exp-list > li:nth-child(7) { grid-column: 2; grid-row: 3; }
@media (max-width: 640px) {
  .exp-list {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(7, auto);
  }
  .exp-list > li:nth-child(1) { grid-column: 1; grid-row: 1; }
  .exp-list > li:nth-child(2) { grid-column: 1; grid-row: 2; }
  .exp-list > li:nth-child(3) { grid-column: 1; grid-row: 3; }
  .exp-list > li:nth-child(4) { grid-column: 1; grid-row: 4; }
  .exp-list > li:nth-child(5) { grid-column: 1; grid-row: 5; }
  .exp-list > li:nth-child(6) { grid-column: 1; grid-row: 6; }
  .exp-list > li:nth-child(7) { grid-column: 1; grid-row: 7; }
}
.exp-list > li { min-height: 0; display: flex; }
.exp-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 0.85rem 1.1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.2s;
  min-height: 100%;
  box-sizing: border-box;
}
.exp-item:hover {
  border-color: var(--text-muted);
}
.exp-date {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}
.exp-item .exp-name,
.exp-item strong.exp-name { display: block; color: var(--text); margin-bottom: 0.35rem; font-weight: 600; }
.exp-desc { display: block; color: var(--text-muted); font-size: 0.875rem; line-height: 1.5; }

.section-desc { color: var(--text-muted); margin: -0.5rem 0 1.25rem; font-size: 0.95rem; line-height: 1.7; }
.section-more { margin-top: 1.25rem; }
.section-more a { color: var(--link); }

/* Cards - white box, subtle border, generous padding */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.cards-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.card-block {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  text-align: left;
}
.card-block:hover {
  /* border-color: var(--text-muted); */
  transform: translateY(-2px);
}
.card-block .card-title { font-weight: 600; font-size: 0.95rem; margin: 0 0 0.25rem; color: var(--text); line-height: 1.35; }
.card-block .card-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.card-block .card-excerpt { font-size: 0.85rem; color: var(--text-muted); margin: 0; line-height: 1.5; flex-grow: 1; }
.card-block .card-thumb {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.6rem;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.6rem;
}
.card-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}
/* Buttons - GitHub style: small, less round, blueish hover */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 400;
  color: var(--btn-text);
  border: 1px solid var(--btn-border);
  border-radius: 5px;
  background: var(--btn-bg);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover {
  background: var(--btn-hover-bg);
  border-color: var(--btn-hover-border);
  color: var(--btn-hover-text);
}
.btn-sm, .btn-md { padding: 8px 14px; font-size: 14px; }
.modal-panel .btn { margin-top: 0.5rem; margin-right: 0.5rem; }

/* Modal - minimal, clean panel */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s;
}
.modal-backdrop.is-open { display: flex; opacity: 1; }
.modal-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
}
.dark .modal-panel { box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-panel .modal-title { font-size: 1.25rem; margin: 0 0 0.5rem; }
.modal-panel .modal-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.modal-panel .modal-body { color: var(--text-muted); font-size: 0.95rem; line-height: 1.7; }
.modal-panel .modal-body img { max-width: 100%; border-radius: 8px; margin: 0.75rem 0; }
.modal-panel .modal-body a { color: var(--link); }

/* Contact - same button style but large (not smaller) */
.contact-cta-wrap {
  text-align: center;
  padding: 0.5rem 0 1rem;
}
.contact-cta {
  display: inline-flex;
  align-items: center;
  padding: 14px 28px;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--btn-text);
  border: 1px solid var(--btn-border);
  border-radius: 5px;
  background: var(--btn-bg);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.contact-cta:hover {
  background: var(--btn-hover-bg);
  border-color: var(--btn-hover-border);
  color: var(--btn-hover-text);
}

/* Footer - only thin divider above */
.site-footer {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--bg-soft);
}
.site-footer .copy-rights { margin: 0; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--link); }

/* Back to top - minimal */
.back_top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 5px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-text);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-decoration: none;
}
.back_top:hover { background: var(--btn-hover-bg); border-color: var(--btn-hover-border); color: var(--btn-hover-text); }
.back_top svg { width: 18px; height: 18px; }

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}
.nav-toggle::before {
  content: '';
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 7px 0 currentColor, 0 -7px 0 currentColor;
}
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .site-nav { display: none; }
  .site-nav.is-open { display: flex; flex-direction: column; width: 100%; align-items: flex-start; }
  .site-header { flex-direction: column; align-items: flex-start; }
  .header-right { width: 100%; justify-content: flex-end; }
}

/* Preloader */
#preloader {
  position: fixed; inset: 0; z-index: 9999; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
#status { position: relative; }
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--bg-soft);
  border-left-color: var(--btn-accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Links - black/near-black, accent only on buttons */
a { color: var(--link); transition: color 0.2s; }
