:root{
  --bg: #ffffff;
  --text: #0b0b0b;
  --muted: rgba(0,0,0,.55);
  --hairline: rgba(0,0,0,.12);
  --soft: rgba(0,0,0,.06);
  --max: 900px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body{
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

body.loaded{
  opacity: 1;
}

.container{
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

h1{
  font-family: 'Playfair Display', serif;
  font-size: clamp(36px, 6vw, 48px);
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

h2{
  font-family: 'Playfair Display', serif;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

h3{
  font-size: clamp(20px, 3vw, 22px);
  font-weight: 600;
  margin-bottom: 16px;
}

p{
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 20px;
  color: var(--text);
}

header{
  padding: 60px 0 40px;
  text-align: center;
}

.intro{
  font-size: clamp(16px, 2.5vw, 18px);
  color: var(--muted);
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto;
}

[data-include]{
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
  will-change: opacity;
}

[data-include="nav"],
[data-include="blog-nav"]{
  min-height: 80px;
}

[data-include="header"]{
  min-height: 120px;
}

[data-include="footer"]{
  min-height: 60px;
}

[data-include].loaded{
  opacity: 1;
}

nav{
  padding: 40px 0;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 60px;
}

.nav-content{
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.logo{
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.logo:hover{
  color: var(--muted);
}

.nav-links{
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.nav-link{
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  transition: color 0.2s ease;
  position: relative;
}

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

.nav-link.active{
  color: var(--text);
}

.nav-link.active::after{
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text);
}

.back-link{
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  transition: color 0.2s ease;
}

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

section{
  margin-bottom: 60px;
}

.section-title{
  font-family: 'Playfair Display', serif;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  margin-bottom: 32px;
  letter-spacing: -0.01em;
}

.post-list{
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.post-item{
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hairline);
}

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

.post-link{
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: opacity 0.2s ease;
}

.post-link:hover{
  opacity: 0.7;
}

.post-date{
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.post-title{
  font-family: 'Playfair Display', serif;
  font-size: clamp(20px, 3vw, 24px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.post-excerpt{
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
}

article{
  margin-bottom: 80px;
}

.article-header{
  margin-bottom: 48px;
}

.article-meta{
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  font-size: 14px;
  flex-wrap: wrap;
}

.article-date{
  color: var(--muted);
}

.article-tag{
  padding: 4px 12px;
  background: var(--soft);
  color: var(--text);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

.article-intro{
  font-size: clamp(18px, 3vw, 20px);
  line-height: 1.7;
  color: var(--muted);
}

.article-content{
  font-size: 17px;
  line-height: 1.8;
}

.article-content h2{
  font-family: 'Playfair Display', serif;
  font-size: clamp(24px, 4vw, 28px);
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.article-content h3{
  font-size: clamp(20px, 3vw, 22px);
  font-weight: 600;
  margin-top: 36px;
  margin-bottom: 16px;
}

.article-content p{
  margin-bottom: 24px;
  color: var(--text);
}

.article-content ul, .article-content ol{
  margin-bottom: 24px;
  margin-left: 24px;
}

.article-content li{
  margin-bottom: 12px;
}

.article-content blockquote{
  margin: 32px 0;
  padding: 24px;
  background: var(--soft);
  border-left: 3px solid var(--text);
  font-style: italic;
  color: var(--text);
  border-radius: 0 8px 8px 0;
}

.article-content code{
  background: var(--soft);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 15px;
  color: var(--text);
}

.article-content pre{
  background: var(--text);
  color: var(--bg);
  padding: 24px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 32px 0;
  line-height: 1.6;
}

.article-content pre code{
  background: none;
  padding: 0;
  color: var(--bg);
  font-size: 14px;
}

.article-content a{
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--hairline);
  transition: text-decoration-color 0.2s ease;
}

.article-content a:hover{
  text-decoration-color: var(--text);
}

.article-content img{
  width: 100%;
  border-radius: 8px;
  margin: 32px 0;
}

.highlight{
  background: var(--soft);
  padding: 24px;
  border-left: 3px solid var(--text);
  border-radius: 0 8px 8px 0;
  margin: 32px 0;
}

.highlight p{
  margin-bottom: 0;
  font-weight: 500;
}

.stats{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 24px;
  margin: 40px 0;
}

.stat{
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  text-align: center;
  transition: all 0.2s ease;
}

.stat:hover{
  border-color: var(--text);
  transform: translateY(-2px);
}

.stat-number{
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.stat-label{
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.resume-header{
  margin-bottom: 60px;
  padding-bottom: 40px;
  border-bottom: 2px solid var(--hairline);
}

.title{
  font-size: clamp(18px, 3vw, 20px);
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 24px;
}

.contact-info{
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 15px;
}

.contact-info a{
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.contact-info a:hover{
  color: var(--text);
}

.item{
  margin-bottom: 40px;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.item:hover{
  border-color: var(--text);
  transform: translateY(-2px);
}

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

.item-header{
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.item h3{
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.item .company{
  font-size: 16px;
  color: var(--muted);
  font-weight: 500;
}

.item .date{
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.item ul{
  margin-left: 20px;
  margin-top: 12px;
}

.item li{
  font-size: 15px;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.6;
}

.item p{
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
}

.skills-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.skill-category{
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.skill-category:hover{
  border-color: var(--text);
  transform: translateY(-2px);
}

.skill-category h3{
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.skill-category p{
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.download-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.2s ease;
  margin-top: 20px;
}

.download-btn:hover{
  background: var(--muted);
  transform: translateY(-2px);
}

.connect{
  background: var(--soft);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
}

.connect h2{
  margin-bottom: 20px;
}

.connect p{
  color: var(--muted);
  margin-bottom: 32px;
}

.social-links{
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.social-link{
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

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

footer{
  margin-top: 80px;
  padding: 40px 0;
  border-top: 1px solid var(--hairline);
  text-align: center;
}

footer p{
  font-size: 14px;
  color: var(--muted);
}

@media (max-width: 768px){
  .container{
    padding: 0 20px;
  }

  header{
    padding: 40px 0 32px;
  }

  nav{
    padding: 32px 0;
  }

  .nav-content{
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .nav-links{
    gap: 24px;
    width: 100%;
  }

  .nav-link{
    font-size: 14px;
  }

  h1{
    font-size: clamp(32px, 8vw, 48px);
  }

  h2{
    font-size: clamp(22px, 6vw, 32px);
  }

  .section-title{
    font-size: clamp(22px, 6vw, 32px);
  }

  .article-content{
    font-size: 16px;
  }

  .article-content h2{
    font-size: clamp(22px, 6vw, 28px);
    margin-top: 36px;
  }

  .article-content h3{
    font-size: clamp(18px, 5vw, 22px);
  }

  .stats{
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .stat{
    padding: 20px;
  }

  .connect{
    padding: 32px 24px;
  }

  .item{
    padding: 20px;
  }

  .item-header{
    flex-direction: column;
    gap: 8px;
  }

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

  .contact-info{
    flex-direction: column;
    gap: 12px;
  }

  .post-list{
    gap: 20px;
  }

  .post-item{
    padding-bottom: 20px;
  }

  footer{
    margin-top: 60px;
    padding: 32px 0;
  }
}

@media (max-width: 480px){
  .container{
    padding: 0 16px;
  }

  header{
    padding: 32px 0 24px;
  }

  nav{
    padding: 24px 0;
    margin-bottom: 40px;
  }

  .intro{
    font-size: clamp(15px, 4vw, 18px);
  }

  section{
    margin-bottom: 40px;
  }

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

  .connect{
    padding: 24px 16px;
  }

  .item{
    padding: 16px;
  }

  .skill-category{
    padding: 16px;
  }

  .article-content pre{
    padding: 16px;
    font-size: 12px;
  }

  .article-content pre code{
    font-size: 12px;
  }
}

@media print{
  nav, footer, .download-btn{
    display: none;
  }

  body{
    background: white;
  }

  .item, .skill-category{
    border: 1px solid var(--hairline);
    box-shadow: none;
    page-break-inside: avoid;
  }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; }
}