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

:root {
  --bg: #fafaf9;
  --text: #1c1917;
  --muted: #78716c;
  --accent: #2563eb;
  --card: #ffffff;
  --border: #e7e5e4;
  --tag-bg: #f5f5f4;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.page { max-width: 640px; margin: 0 auto; padding: 0 24px; }

/* ---- Site header (shared across all pages) ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.site-header .page {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header .site-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.site-header .site-name:hover { text-decoration: none; color: var(--accent); }

.site-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.site-nav a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav a.active { color: var(--text); font-weight: 600; }

/* ---- Hero ---- */
.hero { padding: 64px 0 48px; }

.hero-with-photo {
  display: flex;
  align-items: stretch;
  gap: 32px;
}

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

.hero-photo {
  width: 280px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  align-self: stretch;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}

.hero .lead {
  font-size: 1.12rem;
  color: var(--text);
  margin-bottom: 24px;
}

.hero .lead strong { font-weight: 600; }

.follow-me {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.follow-me-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.follow-me-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.follow-me-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.follow-me-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 1px 6px rgba(37,99,235,.08);
  text-decoration: none;
}
.follow-me-links a svg { width: 1em; height: 1em; flex-shrink: 0; }
.follow-me-links .follow-note { font-size: 0.75rem; color: var(--muted); font-weight: 400; }

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

.links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.links a:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 6px rgba(37,99,235,.08);
  text-decoration: none;
}
.links a svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---- Sections ---- */
section { padding: 40px 0; border-top: 1px solid var(--border); }

.section-label {
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 20px;
}

section p { margin-bottom: 12px; }
section p:last-child { margin-bottom: 0; }

/* ---- Now cards ---- */
.now-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.now-card {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  transition: border-color 0.15s;
}
.now-card:hover { border-color: var(--accent); text-decoration: none; }

.now-card .label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.now-card .title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.4;
}

.now-card .desc {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

/* ---- Project Themes ---- */
.theme { margin-bottom: 32px; }
.theme:last-child { margin-bottom: 0; }

.theme h3 {
  font-size: 1rem;
  font-weight: 650;
  margin-bottom: 12px;
}

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

.project-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
}
.project-list li:last-child { border-bottom: none; }

.project-list .name { font-weight: 550; font-size: 0.92rem; }
.project-list .name a { color: var(--text); }
.project-list .name a:hover { color: var(--accent); text-decoration: none; }

.project-list .detail {
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 2px;
}

.project-list .tag {
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--tag-bg);
  padding: 3px 9px;
  border-radius: 4px;
  white-space: nowrap;
  align-self: start;
  margin-top: 2px;
}

/* ---- Career ---- */
.career { list-style: none; }

.career li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  padding: 10px 0;
}

.career .year {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.career .role { font-weight: 600; font-size: 0.92rem; }
.career .org { color: var(--muted); font-size: 0.88rem; }

.career .role-desc {
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* ---- Writing list ---- */
.writing-list { list-style: none; }

.writing-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.writing-list li:last-child { border-bottom: none; }

.writing-list a {
  font-weight: 550;
  font-size: 0.92rem;
  color: var(--text);
}
.writing-list a:hover { color: var(--accent); }

.writing-list .meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ---- Blog page header ---- */
.blog-intro {
  padding: 48px 0 8px;
}

.blog-intro h1 {
  font-size: 1.8rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.blog-intro p {
  color: var(--muted);
  font-size: 1rem;
}

/* ---- Featured post ---- */
.featured-post {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  margin: 20px 0 36px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.featured-post:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.06);
  text-decoration: none;
}

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

.featured-post .featured-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
}

.featured-post h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.35;
}

.featured-post p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 10px;
}

.featured-post .featured-date {
  font-size: 0.78rem;
  color: var(--muted);
}

.featured-thumb {
  width: 160px;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

/* ---- Post card grid (blog index) ---- */
.post-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  list-style: none;
  margin-bottom: 32px;
}

.post-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.post-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(37,99,235,.06);
  text-decoration: none;
}

.post-card .card-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.post-card .card-placeholder {
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, var(--tag-bg), var(--border));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.6rem;
}

.post-card .card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card .card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 6px;
}

.post-card .card-excerpt {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card .card-date {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 8px;
}

/* ---- View all posts button ---- */
.view-all-posts {
  text-align: center;
  margin: 28px 0 8px;
}

.view-all-btn {
  display: inline-block;
  padding: 12px 28px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  transition: background 0.15s, color 0.15s;
}
.view-all-btn:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ---- Archive compact list ---- */
.archive-section { margin-top: 8px; }

.year-group { padding: 20px 0 8px; }

.year-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

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

.archive-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.archive-list li:last-child { border-bottom: none; }

.archive-list a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}
.archive-list a:hover { color: var(--accent); text-decoration: none; }

.archive-list .post-meta {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 32px 0;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--card);
}
.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.pagination .current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- Blog post ---- */
.post-header {
  padding: 48px 0 0;
}

.post-breadcrumb {
  margin-bottom: 16px;
}

.post-breadcrumb a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}
.post-breadcrumb a:hover { color: var(--accent); text-decoration: none; }

.post-header h1 {
  font-size: 1.7rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 12px;
}

.post-header .post-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 24px;
}

.post-hero {
  margin-bottom: 32px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.post-hero img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 360px;
  object-fit: cover;
}

.post-content {
  padding-top: 8px;
  padding-bottom: 48px;
  border-top: 1px solid var(--border);
}

/* ---- Post prev/next navigation ---- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  transition: border-color 0.15s;
}
.post-nav-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.post-nav-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.post-nav-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.post-nav-next {
  grid-column: 2;
  text-align: right;
}

.post-nav-prev:only-child {
  grid-column: 1;
}
.post-nav-next:only-child {
  grid-column: 2;
}

.post-content h2 {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 32px 0 12px;
}

.post-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 28px 0 10px;
}

.post-content p { margin-bottom: 16px; }

.post-content ul, .post-content ol {
  margin: 0 0 16px 24px;
}

.post-content li { margin-bottom: 6px; }

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 16px 0;
  color: var(--muted);
  font-style: italic;
}

.post-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px 20px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 16px 0;
}

.post-content code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
  font-size: 0.88em;
}

.post-content p code, .post-content li code {
  background: var(--tag-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}

.post-content a { text-decoration: underline; text-underline-offset: 2px; }
.post-content a:hover { color: var(--accent); }

.post-content .video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 20px 0;
  border-radius: 8px;
}

.post-content .video-embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* ---- Footer ---- */
footer {
  padding: 28px 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ---- Photo lightbox ---- */
.photo-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.photo-lightbox.open {
  display: flex;
}

.lightbox-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 92vw;
}

.photo-lightbox img {
  max-width: 92vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-caption {
  text-align: center;
  max-width: 60ch;
}

.lightbox-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.lightbox-desc {
  color: #ddd;
  font-size: 0.9rem;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.3);
}

/* ---- Career examples (fold-out) ---- */
.career-examples {
  margin-top: 8px;
}

.career-examples summary {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.career-examples summary::-webkit-details-marker { display: none; }

.career-examples summary::after {
  content: '›';
  font-size: 1rem;
  display: inline-block;
  transition: transform 0.2s;
  line-height: 1;
}

.career-examples[open] summary::after {
  transform: rotate(90deg);
}

.career-examples summary:hover { text-decoration: underline; }

.career-examples-list {
  list-style: none;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--tag-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.career-examples-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.82rem;
}

.career-examples-list a {
  color: var(--text);
  font-weight: 500;
}
.career-examples-list a:hover { color: var(--accent); text-decoration: none; }

.career-examples-list .ex-type {
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}

/* ---- Photo gallery ---- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0 40px;
}

.photo-item {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.photo-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.photo-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.photo-caption {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 6px 10px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photos-empty {
  color: var(--muted);
  padding: 40px 0;
}

/* ---- Responsive ---- */
@media (max-width: 520px) {
  .hero { padding: 48px 0 36px; }
  .hero-with-photo { flex-direction: column-reverse; gap: 20px; }
  .hero-photo { width: 100%; height: 240px; }
  .hero h1 { font-size: 1.6rem; }
  .now-grid { grid-template-columns: 1fr; }
  .career li { grid-template-columns: 1fr; gap: 1px; }
  .project-list li { grid-template-columns: 1fr; }
  .project-list .tag { justify-self: start; }
  .post-header { padding: 32px 0 0; }
  .post-header h1 { font-size: 1.4rem; }
  .featured-post { flex-direction: column; }
  .featured-thumb { width: 100%; height: 160px; order: -1; }
  .post-grid { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { grid-column: 1; text-align: left; }
  .post-nav-next:only-child { grid-column: 1; }
  .site-nav { gap: 14px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}
