/* ---------- Design tokens ---------- */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f6f8fb;
  --color-text: #1a1f2b;
  --color-text-muted: #5a6472;
  --color-border: #e3e7ee;
  --color-accent: #1d4ed8;
  --color-accent-dark: #1739a6;
  --color-accent-tint: #eaf0fd;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --max-width: 880px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 60, 0.06), 0 1px 2px rgba(20, 30, 60, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #12151c;
    --color-bg-alt: #181c25;
    --color-text: #e7eaf1;
    --color-text-muted: #a0a8b8;
    --color-border: #2a2f3b;
    --color-accent: #5b8bf5;
    --color-accent-dark: #7ea3f7;
    --color-accent-tint: #1a2740;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.24);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

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

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

/* ---------- Header / Nav ---------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 10;
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.nav-brand:hover { text-decoration: none; color: var(--color-accent); }

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--color-text-muted);
  font-size: 0.94rem;
  font-weight: 500;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-accent);
  text-decoration: none;
}

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

.hero-eyebrow {
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.hero .lede {
  color: var(--color-text-muted);
  font-size: 1.15rem;
  max-width: 62ch;
  margin: 0 0 28px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.94rem;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover { background: var(--color-accent-dark); }

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ---------- Sections ---------- */
section { padding: 40px 0; }

.section-title {
  font-size: 1.5rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.section-sub {
  color: var(--color-text-muted);
  margin: 0 0 32px;
}

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

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--color-bg);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.94rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tag {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-tint);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ---------- Resume / timeline ---------- */
.timeline-item {
  border-left: 2px solid var(--color-border);
  padding: 0 0 32px 24px;
  position: relative;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-role {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 2px;
}

.timeline-meta {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin: 0 0 10px;
}

.skills-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.skills-table tr {
  border-bottom: 1px solid var(--color-border);
}
.skills-table td {
  padding: 12px 8px;
  vertical-align: top;
  font-size: 0.92rem;
}
.skills-table td:first-child {
  font-weight: 700;
  white-space: nowrap;
  padding-right: 20px;
  color: var(--color-text);
}
.skills-table td:last-child { color: var(--color-text-muted); }

details.proj-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 14px;
  background: var(--color-bg-alt);
}
details.proj-group summary {
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  list-style: none;
}
details.proj-group summary::-webkit-details-marker { display: none; }
details.proj-group summary::before {
  content: "▸";
  color: var(--color-accent);
  margin-right: 8px;
  display: inline-block;
  transition: transform 0.15s ease;
}
details.proj-group[open] summary::before { transform: rotate(90deg); }

.proj-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.proj-list li {
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
  font-size: 0.92rem;
}
.proj-list li:first-child { border-top: none; }
.proj-list .proj-name { font-weight: 600; }
.proj-list .proj-tech {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  display: block;
  margin-top: 2px;
}

/* ---------- Book cover ---------- */
.book-showcase {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: center;
}
@media (max-width: 560px) {
  .book-showcase { grid-template-columns: 1fr; }
}

.book-cover {
  aspect-ratio: 3 / 4.4;
  background: linear-gradient(180deg, #0c1220 0%, #10182c 100%);
  border-radius: 6px;
  border-top: 6px solid #f4f4f4;
  border-bottom: 6px solid #f4f4f4;
  box-shadow: var(--shadow);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  position: relative;
  font-family: var(--font-sans);
}

.book-cover .corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #d98e3f;
}
.book-cover .corner.tl { top: 14px; left: 10px; border-top: 2px solid; border-left: 2px solid; }
.book-cover .corner.tr { top: 14px; right: 10px; border-top: 2px solid; border-right: 2px solid; }
.book-cover .corner.bl { bottom: 30px; left: 10px; border-bottom: 2px solid; border-left: 2px solid; }
.book-cover .corner.br { bottom: 30px; right: 10px; border-bottom: 2px solid; border-right: 2px solid; }

.book-cover .book-title {
  text-align: center;
  margin-top: 14px;
}
.book-cover .book-title .eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: #f4f4f4;
  font-weight: 700;
}
.book-cover .book-title .main {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #6fa3f7;
  border-bottom: 2px solid #6fa3f7;
  display: inline-block;
  padding-bottom: 3px;
  margin-top: 4px;
}
.book-cover .book-title .sub {
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  color: #b7c2d8;
  margin-top: 6px;
  text-transform: uppercase;
}

.book-cover .net {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  justify-items: center;
  padding: 10px 14px;
}
.book-cover .net span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fa3f7;
  box-shadow: 0 0 6px rgba(111, 163, 247, 0.8);
}

.book-cover .book-author {
  text-align: center;
  font-size: 0.6rem;
}
.book-cover .book-author .dots { color: #6fa3f7; letter-spacing: 0.2em; font-size: 0.55rem; }
.book-cover .book-author .name { font-weight: 800; letter-spacing: 0.05em; margin: 3px 0; font-size: 0.85rem; }
.book-cover .book-author .role { color: #9fb0cc; font-style: italic; font-size: 0.55rem; }

/* ---------- Blog ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--color-border);
}
.post-item:first-child { padding-top: 0; }
.post-date {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
.post-item h3 { margin: 4px 0 6px; font-size: 1.15rem; }
.post-item p { margin: 0; color: var(--color-text-muted); }

.post-body {
  font-size: 1.02rem;
}
.post-body h2 { margin-top: 2em; }
.post-body pre {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.post-body code {
  font-family: var(--font-mono);
  background: var(--color-bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.post-body pre code { background: none; padding: 0; }
.post-body blockquote {
  border-left: 3px solid var(--color-accent);
  margin: 0;
  padding: 4px 0 4px 18px;
  color: var(--color-text-muted);
}

/* ---------- Contact ---------- */
.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-list a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-weight: 500;
}
.contact-list a:hover { color: var(--color-accent); text-decoration: none; }
.contact-icon {
  width: 20px;
  text-align: center;
  color: var(--color-accent);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 60px;
  padding: 32px 0;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--color-text-muted); }
.footer-links a:hover { color: var(--color-accent); }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
