/* ---------- Design tokens ---------- */
:root {
  --bg: #0d1117;
  --surface: #141b24;
  --line: #232b36;
  --ink: #eef1f6;
  --ink-muted: #8d97a8;
  --accent: #4fa3ff;
  --sidebar-width: 280px;
  --max-content-width: 720px;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }

.inline-link {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration: underline;
  text-decoration-color: rgba(79, 163, 255, 0.35);
  transition: text-decoration-color 0.2s ease;
}

.inline-link:hover { text-decoration-color: var(--accent); }

h1, h2, h3 {
  color: var(--ink);
  margin: 0 0 0.5em;
  line-height: 1.2;
  font-weight: 600;
}

p { margin: 0 0 1em; }

ul { list-style: none; margin: 0; padding: 0; }

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

::selection { background: var(--accent); color: #0d1117; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Layout ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg);
  border-right: 1px solid var(--line);
  z-index: 100;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.avatar-link {
  display: inline-block;
  margin-bottom: 20px;
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
  transition: border-color 0.2s ease;
}

.avatar-link:hover .avatar { border-color: var(--accent); }

.brand {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.25em;
}
.brand a { color: var(--ink); }

.brand-title {
  font-size: 0.85rem;
  color: var(--accent);
  font-family: var(--font-mono);
  margin: 0;
}

.nav ul { display: flex; flex-direction: column; gap: 14px; margin-top: 44px; }

.nav-link {
  font-size: 0.95rem;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  transition: color 0.2s ease;
  display: inline-block;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
}

.social-links {
  display: flex;
  gap: 20px;
  margin-top: 44px;
}

.social-links a {
  color: var(--ink-muted);
  transition: color 0.2s ease, transform 0.2s ease;
}

.social-links a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.content {
  margin-left: var(--sidebar-width);
  padding: 0 60px 140px;
  position: relative;
}

.content::before {
  content: "";
  position: absolute;
  top: -10%;
  left: 10%;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(79, 163, 255, 0.1), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.section {
  max-width: var(--max-content-width);
  padding-top: 120px;
  scroll-margin-top: 96px;
}

.section:first-of-type { padding-top: 88px; scroll-margin-top: 0; }

.section-body { max-width: var(--max-content-width); }

.section-heading {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  margin-bottom: 32px;
}

.section-heading::before {
  content: "";
  display: inline-block;
  width: 26px;
  height: 2px;
  background: var(--accent);
  margin-right: 14px;
}

/* ---------- Intro / hero ---------- */
.intro-name {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.3em;
  animation: rise 0.6s ease both;
}

.intro-role {
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
  color: var(--accent);
  margin: 0 0 24px;
  animation: rise 0.6s ease both;
  animation-delay: 0.08s;
}

.intro-desc {
  max-width: 560px;
  font-size: 1.15rem;
  margin: 0 0 36px;
  animation: rise 0.6s ease both;
  animation-delay: 0.16s;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  animation: rise 0.6s ease both;
  animation-delay: 0.24s;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 13px 26px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #0d1117;
}

.btn-primary:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #0d1117;
  transform: translateY(-2px);
}

/* ---------- Ledger entries (experience) ---------- */
.ledger {
  border-top: 1px solid var(--line);
}

.entry {
  display: block;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 20px;
  margin-bottom: 4px;
}

.entry-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.entry-org {
  color: var(--accent);
  font-weight: 400;
}

.org-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 10px;
  vertical-align: middle;
  transform: translateY(-3px);
}

.org-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.org-mark-chip {
  background: #fff;
  border-radius: 6px;
  padding: 3px;
}

.org-mark-wide {
  width: auto;
  padding: 3px 6px;
}

.org-mark-wide img {
  width: auto;
  height: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.entry-dates {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.entry-summary {
  margin: 12px 0 0;
  max-width: 560px;
}

.entry-action {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  white-space: nowrap;
}

.entry-action:hover { text-decoration: underline; }

.entry-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry-list li {
  padding-left: 20px;
  position: relative;
}

.entry-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 10px;
  height: 1px;
  background: var(--ink-muted);
}

.entry-list strong { color: var(--ink); font-weight: 600; }

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px 40px;
}

.project {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.project .entry-head { margin-bottom: 2px; }

.project .entry-dates { display: block; margin-bottom: 10px; }

.project p { margin: 0; }

.more-projects {
  margin-top: 36px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.more-projects a { color: var(--accent); }
.more-projects a:hover { text-decoration: underline; }

/* ---------- Contact ---------- */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
}

.footer {
  margin-top: 100px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-align: center;
}

/* ---------- Mobile nav ---------- */
.nav-toggle {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  width: 44px;
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.nav-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  :root { --sidebar-width: 240px; }
  .content { padding: 0 40px 100px; }
  .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .nav-toggle { display: flex; }
  .nav-overlay { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: min(300px, 80vw);
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.4);
  }

  .sidebar.open { transform: translateX(0); }

  .content { margin-left: 0; padding: 0 24px 100px; }

  .section { padding-top: 72px; scroll-margin-top: 72px; }
  .section:first-of-type { padding-top: 88px; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .entry-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .intro-name, .intro-role, .intro-desc, .intro-actions {
    animation: none;
  }
  * {
    transition-duration: 0.001ms !important;
  }
}
