:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;
  --soft: #64748b;
  --line: #dbe3ef;
  --accent: #2563eb;
  --accent-2: #7c3aed;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --radius: 22px;
  --max: 1120px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

:root[data-theme="dark"] {
  --bg: #07111f;
  --surface: #0f172a;
  --surface-2: #111c2e;
  --text: #e5edf7;
  --muted: #b7c4d8;
  --soft: #94a3b8;
  --line: #253449;
  --accent: #60a5fa;
  --accent-2: #c084fc;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.13), transparent 32rem),
    radial-gradient(circle at top right, rgba(124, 58, 237, 0.12), transparent 32rem),
    var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
}
body.font-serif { font-family: var(--serif); font-size: 17px; }
body.font-serif .mono, body.font-serif code { font-family: var(--mono); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; }
.skip-link { position: absolute; left: -999px; top: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.skip-link:focus { left: 12px; z-index: 30; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
}
.navbar { display: flex; align-items: center; justify-content: space-between; min-height: 74px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-weight: 760; letter-spacing: -0.02em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.25);
  font-size: 15px;
}
.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav-links a, .icon-button {
  border: 1px solid transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  line-height: 1;
  background: transparent;
  cursor: pointer;
}
.nav-links a:hover, .nav-links a.active, .icon-button:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
  text-decoration: none;
}

.hero { padding: 72px 0 36px; }
.hero-grid { display: grid; grid-template-columns: 1fr 320px; gap: 34px; align-items: center; }
.kicker { color: var(--accent); font-size: 0.82rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, h3 { letter-spacing: -0.035em; line-height: 1.12; }
h1 { margin: 12px 0 16px; font-size: clamp(2.6rem, 7vw, 5.45rem); }
h2 { margin: 0 0 20px; font-size: clamp(1.7rem, 4vw, 2.5rem); }
h3 { margin: 0 0 10px; font-size: 1.25rem; }
.hero h1 { margin: 0 0 20px; font-size: clamp(2.15rem, 5vw, 3.7rem); }
p { margin: 0 0 1.05rem; }
.lead { font-size: clamp(1.05rem, 2vw, 1.28rem); color: var(--muted); max-width: 760px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.05);
  font-weight: 700;
}
.button.primary { color: white; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.button:hover { text-decoration: none; transform: translateY(-1px); }
.profile-card { background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--line); border-radius: 32px; padding: 22px; box-shadow: var(--shadow); }
.profile-card img { border-radius: 24px; display: block; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.profile-meta { margin-top: 18px; color: var(--muted); font-size: 0.95rem; }
.profile-meta strong { color: var(--text); }

.section { padding: 42px 0; }
.section.compact { padding-top: 22px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  background: color-mix(in srgb, var(--surface) 93%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.04);
}
.card:hover { transform: translateY(-2px); transition: transform .18s ease, border-color .18s ease; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card p:last-child { margin-bottom: 0; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tag { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 4px 9px; font-size: 0.78rem; line-height: 1.4; }

.timeline { position: relative; display: grid; gap: 16px; }
.timeline-item { display: grid; grid-template-columns: 170px 1fr; gap: 20px; }
.time { color: var(--soft); font-weight: 750; font-size: 0.9rem; }
.company { color: var(--muted); margin-bottom: 8px; }
ul.clean { margin: 0; padding-left: 1.2rem; }
ul.clean li { margin: .35rem 0; }

.page { display: grid; grid-template-columns: 230px 1fr; gap: 34px; padding: 44px 0 72px; }
.toc { position: sticky; top: 104px; align-self: start; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent); border-radius: 18px; padding: 16px; }
.toc-title { color: var(--soft); font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.toc a { display: block; color: var(--muted); padding: 6px 0; font-size: .95rem; }
.article { min-width: 0; }
.article h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); }
.article h2 { padding-top: 24px; border-top: 1px solid var(--line); margin-top: 34px; }
.article h2:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.article blockquote { margin: 24px 0; padding: 14px 18px; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 12px; color: var(--muted); }
.publication { padding: 18px 0; border-bottom: 1px solid var(--line); }
.publication:last-child { border-bottom: 0; }
.publication-title { font-weight: 780; color: var(--text); }
.publication-meta { color: var(--muted); font-size: .94rem; margin-top: 2px; }
.footer { border-top: 1px solid var(--line); padding: 28px 0 42px; color: var(--soft); font-size: 0.94rem; }
.footer .container { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }

.post-list { display: grid; gap: 16px; }
.post-item { display: block; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.post-item:hover { text-decoration: none; transform: translateY(-1px); }
.post-date { color: var(--soft); font-size: .9rem; font-weight: 700; }
.note { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }

@media (max-width: 860px) {
  .navbar { align-items: flex-start; flex-direction: column; padding: 14px 0; }
  .nav-links { justify-content: flex-start; }
  .hero { padding-top: 44px; }
  .hero-grid, .grid.two, .grid.three, .page { grid-template-columns: 1fr; }
  .profile-card { max-width: 360px; }
  .toc { position: static; order: -1; }
  .timeline-item { grid-template-columns: 1fr; gap: 5px; }
}

@media print {
  :root { --bg: white; --surface: white; --text: #111; --muted: #333; --line: #ccc; }
  body { background: white; font-size: 11.5pt; }
  .site-header, .footer, .toc, .hero-actions, .no-print { display: none !important; }
  .container { width: 100%; }
  .page, .section, .hero { padding: 0; display: block; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ddd; }
  a { color: #111; }
}
