/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #ffffff;
  --text:      #111111;
  --muted:     #555555;
  --accent:    #1a6ef0;
  --border:    #e0e0e0;
  --tag-bg:    #f0f4ff;
  --tag-text:  #1a4fa0;
  --max-w:     720px;
  --sans:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

html { font-size: 17px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  padding: 0 1.2rem 4rem;
}

/* ── Layout ─────────────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; }

/* ── Header / Hero ──────────────────────────────────────── */
.hero {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-photo {
  width: 165px;
  height: 165px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--border);
  background: linear-gradient(135deg, #c9d6ff, #e2e2e2);
}

.hero-text h1 {
  font-family: var(--sans);
  font-size: 2.7rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.hero-text .tagline {
  font-size: 1.2rem;
  font-style: italic;
  color: #9a9a9a;
  margin-bottom: 1.2rem;
  max-width: 22em;
}

/* Social icon row — solid dark circular icon buttons */
.social-row { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }

.social-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #333333;
  color: #ffffff;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.social-row a:hover { background: var(--accent); transform: translateY(-2px); }
.social-row a svg { width: 19px; height: 19px; fill: currentColor; }

/* ── Nav ────────────────────────────────────────────────── */
.page-nav {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  margin: 0 -1.2rem;
  padding: 0 1.2rem;
}

.page-nav .nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-nav ul {
  list-style: none;
  display: flex;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.page-nav ul::-webkit-scrollbar { display: none; }

.page-nav a.nav-link {
  display: block;
  padding: 0.65rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.page-nav a.nav-link:hover,
.page-nav a.nav-link.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Language toggle */
.lang-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.lang-toggle a {
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.lang-toggle a + a { border-left: 1px solid var(--border); }
.lang-toggle a.active { background: var(--accent); color: #fff; }
.lang-toggle a:not(.active):hover { color: var(--accent); }

/* ── Sections ───────────────────────────────────────────── */
section { padding: 2.8rem 0 0; }

section h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── About ──────────────────────────────────────────────── */
.about-text p { margin-bottom: 0.9rem; }
.about-text p:last-child { margin-bottom: 0; }

.tech-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.2rem; }

.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.82rem;
  padding: 0.22rem 0.7rem;
  border-radius: 4px;
  font-weight: 500;
}

/* ── Timeline ───────────────────────────────────────────── */
.timeline {
  --tl-line: 108px;   /* x-position of the vertical line + node centres */
  list-style: none;
  position: relative;
}

/* Continuous vertical line down the whole timeline */
.timeline::before {
  content: '';
  position: absolute;
  left: var(--tl-line);
  top: 8px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.timeline > li {
  position: relative;
  display: grid;
  grid-template-columns: 96px 76px 1fr;  /* date | logo | body */
  column-gap: 1.3rem;
  padding-bottom: 2.6rem;
}
.timeline > li:last-child { padding-bottom: 0; }

/* Node dot sitting on the line */
.timeline > li::before {
  content: '';
  position: absolute;
  left: calc(var(--tl-line) - 5px);
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #b3b3b3;
  border: 2px solid var(--bg);
  z-index: 1;
}

.tl-year {
  grid-column: 1;
  text-align: right;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--muted);
  padding-top: 2px;
}

.tl-logo {
  grid-column: 2;
  display: flex;
  justify-content: center;
}
.tl-logo img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 12px;
}

.tl-body { grid-column: 3; }
.tl-body p { margin-bottom: 0.85rem; }
.tl-body p:last-child { margin-bottom: 0; }
.tl-body a { color: var(--accent); }
.tl-body ol, .tl-body ul { margin: 0.4rem 0 0.85rem 1.4rem; }
.tl-body li { margin-bottom: 0.3rem; }

/* ── Projects ───────────────────────────────────────────── */
.projects-note {
  color: #c0392b;
  margin-bottom: 0.4rem;
}
.projects-note a { color: #c0392b; }

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

.project-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 0 1.3rem;
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--border);
}
.project-row:last-child { border-bottom: none; }

.project-thumb img,
.project-thumb .placeholder {
  width: 92px;
  height: 92px;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
  display: block;
}
.project-thumb .placeholder {
  background: linear-gradient(135deg, #eef1f6, #e2e6ee);
}

.project-body { align-self: start; }
.project-body a { color: var(--accent); }
.project-name { font-weight: 600; }

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

.writing-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}
.writing-list li:last-child { border-bottom: none; }

.writing-list .w-date {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 112px;
}

.writing-list a { color: var(--text); text-decoration: none; font-size: 1rem; }
.writing-list a:hover { color: var(--accent); }

.writing-note { font-size: 1rem; color: var(--muted); margin-top: 1rem; }

/* ── Blog article (read page) ───────────────────────────── */
.blog-article { padding: 2.5rem 0 1rem; }

.back-link {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  margin: 0.4rem 0 1.4rem;
}
.back-link:hover { color: var(--accent); }

.blog-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.blog-meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.blog-content { font-size: 1.05rem; line-height: 1.8; }
.blog-content > *:first-child { margin-top: 0; }
.blog-content p { margin: 0 0 1.1rem; }
.blog-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 0.8rem; }
.blog-content h3 { font-size: 1.15rem; font-weight: 700; margin: 1.6rem 0 0.6rem; }
.blog-content ul, .blog-content ol { margin: 0 0 1.1rem 1.5rem; }
.blog-content li { margin-bottom: 0.4rem; }
.blog-content a { color: var(--accent); }
.blog-content img { max-width: 100%; height: auto; border-radius: 8px; }
.blog-content blockquote {
  margin: 1.2rem 0;
  padding: 0.4rem 0 0.4rem 1.1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
.blog-content pre {
  background: #f5f6f8;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  font-size: 0.92rem;
  margin: 0 0 1.1rem;
}
.blog-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

/* ── Contact ────────────────────────────────────────────── */
.contact-text { font-size: 1rem; color: var(--muted); }
.contact-text a { color: var(--accent); }

/* ── Footer ─────────────────────────────────────────────── */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 540px) {
  .hero { flex-direction: column; gap: 1.2rem; padding: 2rem 0 2rem; }
  .hero-photo { width: 115px; height: 115px; }
  .hero-text h1 { font-size: 1.9rem; }
  .timeline { --tl-line: 76px; }
  .timeline > li { grid-template-columns: 66px 40px 1fr; column-gap: 0.7rem; }
  .tl-logo img { width: 40px; height: 40px; border-radius: 8px; }
  .tl-year { font-size: 0.75rem; }
  .project-row { grid-template-columns: 64px 1fr; gap: 0 0.9rem; }
  .project-thumb img, .project-thumb .placeholder { width: 64px; height: 64px; border-radius: 8px; }
}
