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

:root {
  --bg:             #1c1a17;
  --bg-card:        #252320;
  --bg-card-hover:  #2d2b28;
  --ink:            #ebebeb;
  --ink-soft:       #b5b3ae;
  --muted:          #7c7a74;
  --accent:         #5cb5bc;
  --accent-soft:    #7ac5cc;
  --shipped:        #8fb89b;
  --border:         #2f2c28;
  --border-strong:  #3f3c37;

  --sans: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Component tints, theme-aware */
  --nav-bg:         rgba(28, 26, 23, 0.85);
  --accent-tint:    rgba(92, 181, 188, 0.10);
  --accent-line:    rgba(92, 181, 188, 0.25);
  --accent-underline: rgba(92, 181, 188, 0.30);
  --shipped-tint:   rgba(143, 184, 155, 0.12);
  --shipped-line:   rgba(143, 184, 155, 0.28);
}

/* ---------- Light theme (Linen) ---------- */
[data-theme="light"] {
  --bg:             #faf7f2;
  --bg-card:        #f2ede4;
  --bg-card-hover:  #ece6db;
  --ink:            #1f1d1a;
  --ink-soft:       #4c4842;
  --muted:          #918b81;
  --accent:         #33858c;
  --accent-soft:    #276b71;
  --shipped:        #4f7a5c;
  --border:         #e5ded2;
  --border-strong:  #d3cabb;

  --nav-bg:         rgba(250, 247, 242, 0.85);
  --accent-tint:    rgba(51, 133, 140, 0.10);
  --accent-line:    rgba(51, 133, 140, 0.28);
  --accent-underline: rgba(51, 133, 140, 0.32);
  --shipped-tint:   rgba(79, 122, 92, 0.12);
  --shipped-line:   rgba(79, 122, 92, 0.30);
}

body, nav, .project-card, .contact-card, .post-card, .sidebar-block, .tag,
.article-body pre, .article-body code, .badge {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Nav */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2rem;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink);
  letter-spacing: 0.06em;
  text-decoration: none;
  font-weight: 500;
}

.logo::before { content: '◆ '; color: var(--accent); }

.nav-links { display: flex; gap: 1.75rem; list-style: none; }

.nav-links a {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.18s;
}

.nav-links a:hover { color: var(--ink); }
.nav-links a.current { color: var(--ink); }

/* Layout */
.container { max-width: 880px; margin: 0 auto; padding: 0 2rem; }
section { padding: 5.5rem 0; }

/* Hero */
#home {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 6rem;
  position: relative;
}

h1 {
  font-family: var(--sans);
  font-size: clamp(2.6rem, 6.2vw, 4.4rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 1.75rem;
}

.hero-tagline {
  font-size: clamp(1.1rem, 1.8vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 560px;
  margin-bottom: 1.75rem;
  font-weight: 400;
}

.hero-context {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 2.5rem;
}

.hero-context strong { color: var(--ink-soft); font-weight: 500; }

.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  font-weight: 500;
}

.btn-primary { background: var(--ink); color: var(--bg); border: 1px solid var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--border-strong); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-soft); }

.hero-meta {
  display: flex;
  gap: 2.75rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.meta-item { display: flex; flex-direction: column; gap: 0.3rem; }

.meta-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meta-value { font-size: 0.9rem; color: var(--ink); font-weight: 400; }
.meta-value.mono { font-family: var(--mono); font-size: 0.82rem; }

/* Section headers */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.section-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}

h2 { font-family: var(--sans); font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; }

.section-line { flex: 1; height: 1px; background: var(--border); }

/* About */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 3rem; }

@media (max-width: 700px) { .about-grid { grid-template-columns: 1fr; } }

.about-text p { color: var(--ink-soft); line-height: 1.7; margin-bottom: 1.1rem; font-size: 1rem; }
.about-text p strong { color: var(--ink); font-weight: 500; }
.about-text p:last-child { margin-bottom: 0; }

.about-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }

.sidebar-block {
  padding: 1.25rem 1.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.sidebar-block-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.22rem 0.55rem;
  border-radius: 2px;
  background: var(--bg);
  color: var(--ink-soft);
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
}

.cert-list { display: flex; flex-direction: column; gap: 0.5rem; }

.cert-item {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.cert-item::before { content: '—'; color: var(--accent); }

/* Projects */
.projects-grid { display: flex; flex-direction: column; gap: 1.5rem; }

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.85rem;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
  position: relative;
}

.project-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.project-card.upcoming { opacity: 0.82; }

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-title-row { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }

.project-name {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 2px;
  font-weight: 500;
}

.badge-shipped {
  background: var(--shipped-tint);
  color: var(--shipped);
  border: 1px solid var(--shipped-line);
}

.badge-progress {
  background: var(--accent-tint);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}

.project-lang { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); white-space: nowrap; }

.project-desc { color: var(--ink-soft); font-size: 0.96rem; line-height: 1.7; margin-bottom: 1.1rem; }

.project-features { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.1rem; }

.project-link {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.2s, gap 0.2s;
}

.project-link:hover { color: var(--accent-soft); gap: 0.55rem; }
.project-link svg { width: 11px; height: 11px; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }

.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.3rem 1.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.contact-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.contact-card.static { cursor: default; }
.contact-card.static:hover { border-color: var(--border); background: var(--bg-card); transform: none; }

.contact-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 3px;
  color: var(--accent);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.contact-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.18rem;
}

.contact-value { font-size: 0.9rem; color: var(--ink); }

/* Footer */
footer {
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  margin-top: 2rem;
}

.footer-text { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); letter-spacing: 0.04em; }
.footer-text a { color: var(--accent); text-decoration: none; }
.footer-text a:hover { color: var(--ink); }

/* ---------- Blog ---------- */

.page-head { padding-top: 9rem; padding-bottom: 1rem; }

.blog-intro {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: 3rem;
}

.post-list { display: flex; flex-direction: column; gap: 1.25rem; }

.post-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.6rem 1.75rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.post-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.post-card.featured { border-color: var(--border-strong); padding: 1.9rem 1.75rem; }

.post-meta-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; flex-wrap: wrap; }

.post-date { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); letter-spacing: 0.03em; }

.post-title {
  font-size: 1.22rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.post-card.featured .post-title { font-size: 1.35rem; }

.post-excerpt { color: var(--ink-soft); font-size: 0.94rem; line-height: 1.65; margin-bottom: 0.9rem; }

.post-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.9rem; }

.read-link {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* ---------- Article (post page) ---------- */

.article { max-width: 720px; margin: 0 auto; padding: 9rem 2rem 4rem; }

.back-link {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  display: inline-block;
  margin-bottom: 2.5rem;
  transition: color 0.2s;
}

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

.article-header { margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }

.article-title {
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
}

.article-sub { font-size: 1.05rem; color: var(--ink-soft); line-height: 1.5; margin-bottom: 1.4rem; }

.article-meta { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); letter-spacing: 0.04em; }

.article-body { font-size: 1.02rem; line-height: 1.8; color: var(--ink-soft); }

.article-body h2 {
  font-size: 1.45rem;
  color: var(--ink);
  margin: 3rem 0 1.1rem;
  letter-spacing: -0.02em;
}

.article-body h3 {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--ink);
  margin: 2.2rem 0 0.8rem;
  letter-spacing: -0.01em;
}

.article-body p { margin-bottom: 1.35rem; }
.article-body strong { color: var(--ink); font-weight: 500; }
.article-body em { color: var(--ink); font-style: italic; }

.article-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-underline); }
.article-body a:hover { color: var(--accent-soft); border-bottom-color: var(--accent-soft); }

.article-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  color: var(--ink);
}

.article-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.article-body pre code { background: none; border: none; padding: 0; font-size: 0.84rem; line-height: 1.6; }

.article-body hr { border: none; border-top: 1px solid var(--border); margin: 3rem 0; }

.article-body ul, .article-body ol { margin: 0 0 1.35rem 1.3rem; }
.article-body li { margin-bottom: 0.5rem; }

.article-footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.7;
}

.article-footer a { color: var(--accent); text-decoration: none; }
.article-footer a:hover { color: var(--accent-soft); }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

#home .container > * { animation: fadeUp 0.65s cubic-bezier(0.2, 0.6, 0.2, 1) both; }

#home h1            { animation-delay: 0.05s; }
#home .hero-tagline { animation-delay: 0.18s; }
#home .hero-context { animation-delay: 0.3s; }
#home .hero-actions { animation-delay: 0.42s; }
#home .hero-meta    { animation-delay: 0.54s; }

@media (max-width: 640px) {
  nav { padding: 0.9rem 1.25rem; }
  .nav-links { gap: 1.1rem; }
  .container { padding: 0 1.25rem; }
  section { padding: 4rem 0; }
  #home { padding-top: 5rem; }
  .hero-meta { gap: 1.5rem; }
  .article { padding: 7rem 1.25rem 3rem; }
  .page-head { padding-top: 7rem; }
}


/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: 1.5rem;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-card);
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.18s, background 0.18s;
}

.theme-btn:hover { color: var(--ink); }

.theme-btn[aria-pressed="true"] {
  color: var(--accent);
  background: var(--bg);
}

.theme-btn svg { width: 14px; height: 14px; }

.nav-right { display: flex; align-items: center; }

@media (max-width: 640px) {
  .theme-toggle { margin-left: 0.75rem; }
  .theme-btn { width: 24px; height: 22px; }
}
