:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: rgba(30, 41, 59, 0.5);
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-muted: rgba(56, 189, 248, 0.1);
  --border: #1e293b;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 6px;
  --transition: 0.2s ease;
  --sidebar-width: 480px;
  --mouse-x: 50%;
  --mouse-y: 50%;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-secondary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-size: 15px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(56, 189, 248, 0.06), transparent 40%);
  pointer-events: none;
  z-index: 0;
}

::selection {
  background: rgba(56, 189, 248, 0.2);
  color: var(--text);
}

a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.inline-link {
  color: var(--text);
  font-weight: 500;
  transition: color var(--transition);
}

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

.inline-link .arrow {
  display: inline-block;
  margin-left: 4px;
  transition: transform var(--transition);
}

.inline-link:hover .arrow {
  transform: translateX(4px);
}

/* ===========================================
   Layout
   =========================================== */
.layout {
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: var(--sidebar-width);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 72px 48px 32px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

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

.content {
  flex: 1;
  padding: 72px 48px 72px 24px;
  min-width: 0;
}

/* ===========================================
   Sidebar
   =========================================== */
.sidebar-name a {
  color: var(--text);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.sidebar-name a:hover {
  color: var(--text);
}

.sidebar-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 8px;
}

.sidebar-bio {
  margin-top: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 320px;
}

/* Sidebar Navigation */
.sidebar-nav {
  margin-top: 48px;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  transition: color var(--transition);
}

.nav-indicator {
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--text-muted);
  transition: width var(--transition), background var(--transition);
}

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

.nav-link:hover .nav-indicator,
.nav-link.active .nav-indicator {
  width: 64px;
  background: var(--text);
}

/* Sidebar Socials */
.sidebar-socials {
  list-style: none;
  display: flex;
  gap: 20px;
  align-items: center;
  margin-top: 20px;
}

.sidebar-socials a {
  color: var(--text-muted);
  transition: color var(--transition);
  display: flex;
}

.sidebar-socials a:hover {
  color: var(--text);
}

.sidebar-socials svg {
  width: 20px;
  height: 20px;
}

/* ===========================================
   Content Sections
   =========================================== */
.section {
  margin-bottom: 96px;
  scroll-margin-top: 96px;
}

.section-label {
  display: none;
}

/* ===========================================
   About
   =========================================== */
.about-paragraph {
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.about-paragraph a {
  color: var(--text);
  font-weight: 500;
}

.about-paragraph a:hover {
  color: var(--accent);
}

/* ===========================================
   Card Thumbnails (shared across sections)
   =========================================== */
.card-thumb {
  width: 140px;
  flex-shrink: 0;
  padding-top: 4px;
}

.card-thumb img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  opacity: 0.85;
  transition: opacity var(--transition), border-color var(--transition);
}

.exp-item:hover .card-thumb img,
.project-card:hover .card-thumb img,
.achievement-item:hover .card-thumb img {
  opacity: 1;
  border-color: rgba(56, 189, 248, 0.3);
}

/* Clickable cards */
.has-link {
  cursor: pointer;
}

.has-link h3 a {
  color: var(--text);
}

.has-link h3 a:hover {
  color: var(--accent);
}

.has-link .link-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity var(--transition), transform var(--transition);
  transform: translateY(2px);
}

.has-link:hover .link-icon {
  opacity: 1;
  transform: translateY(-1px);
}

/* ===========================================
   Experience
   =========================================== */
.exp-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 20px 16px;
  border-radius: var(--radius);
  transition: background var(--transition);
  margin-bottom: 4px;
}

.exp-item:hover {
  background: var(--bg-card-hover);
}

.exp-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 4px;
  white-space: nowrap;
}

.exp-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.exp-info h3 .company {
  color: var(--text-secondary);
  font-weight: 500;
}

.exp-info h3 .company:hover {
  color: var(--accent);
}

.exp-bullets {
  list-style: disc;
  margin-top: 8px;
  padding-left: 1.25em;
}

.exp-bullets li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
  padding-left: 0.25em;
}

.exp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-muted);
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

/* Leadership */
.leadership-section {
  margin-top: 24px;
}

.leadership-item {
  padding: 16px;
  border-radius: var(--radius);
  transition: background var(--transition);
  margin-bottom: 4px;
}

.leadership-item:hover {
  background: var(--bg-card-hover);
}

.leadership-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.leadership-item .org {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.leadership-item .date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.leadership-item p {
  font-size: 0.85rem;
  margin-top: 6px;
  line-height: 1.6;
}

/* Resume link */
.resume-link {
  margin-top: 16px;
  padding: 16px;
}

.resume-link a {
  font-weight: 500;
  color: var(--text);
}

.resume-link a:hover {
  color: var(--accent);
}

/* ===========================================
   Projects
   =========================================== */
.project-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 20px 16px;
  border-radius: var(--radius);
  transition: background var(--transition);
  margin-bottom: 4px;
}

.project-card:hover {
  background: var(--bg-card-hover);
}

.project-meta {
  padding-top: 4px;
}

.project-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  line-height: 1.4;
}

.project-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

.project-info h3 a {
  color: var(--text);
}

.project-info h3 a:hover {
  color: var(--accent);
}

.project-info h3 .link-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity var(--transition), transform var(--transition);
  transform: translateY(2px);
}

.project-card:hover .link-icon {
  opacity: 1;
  transform: translateY(-1px);
}

.project-info p {
  font-size: 0.88rem;
  margin-top: 6px;
  line-height: 1.6;
}

.archive-link {
  margin-top: 24px;
  padding: 16px;
}

/* ===========================================
   Achievements
   =========================================== */
.achievement-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius);
  transition: background var(--transition);
  margin-bottom: 4px;
}

.achievement-item:hover {
  background: var(--bg-card-hover);
}

.achievement-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 2px;
}

.achievement-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.achievement-info h3 a {
  color: var(--text);
}

.achievement-info h3 a:hover {
  color: var(--accent);
}

.achievement-info p {
  font-size: 0.85rem;
  margin-top: 4px;
  line-height: 1.6;
}

/* ===========================================
   Neural Net Widget
   =========================================== */
.nn-widget {
  margin-top: auto;
  padding-top: 24px;
  margin-bottom: 24px;
}

.nn-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.nn-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.nn-input-wrap {
  position: relative;
}

.nn-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
}

.nn-input:focus {
  border-color: var(--accent);
}

.nn-input::placeholder {
  color: var(--text-muted);
}

.nn-viz-box {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(30, 41, 59, 0.25);
  overflow: hidden;
  padding: 8px 10px 0;
}

#nn-canvas {
  display: block;
  width: 100%;
  height: 240px;
  opacity: 0.45;
  transition: opacity 0.4s ease;
}

#nn-canvas.active {
  opacity: 1;
}

.nn-result {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  min-height: 1.6em;
  line-height: 1.6;
  padding: 8px 14px;
  margin: 0 -10px;
  border-top: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.3);
}

.nn-result:empty {
  display: none;
}

.nn-result .result {
  color: var(--accent);
  font-weight: 600;
}

/* ===========================================
   Footer
   =========================================== */
.footer {
  padding: 48px 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 480px;
}

/* ===========================================
   Archive Page
   =========================================== */
.archive-page {
  position: relative;
  z-index: 1;
}

.archive-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 64px 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 32px;
}

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

.back-link .arrow {
  transition: transform var(--transition);
}

.back-link:hover .arrow {
  transform: translateX(-4px);
}

.archive-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 48px;
}

.archive-table {
  width: 100%;
  border-collapse: collapse;
}

.archive-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.archive-table td {
  padding: 12px 16px;
  vertical-align: top;
  font-size: 0.88rem;
}

.archive-table tr {
  transition: background var(--transition);
}

.archive-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.archive-table .year {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.archive-table .project-name {
  color: var(--text);
  font-weight: 500;
}

.archive-table .built-at {
  color: var(--text-secondary);
}

.archive-table .tech {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.archive-table .links a {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-right: 12px;
}

.archive-table .links a:hover {
  color: var(--accent);
}

.table-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  margin-left: 6px;
}

/* ===========================================
   Mobile Header
   =========================================== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}

.mobile-name {
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
}

.mobile-toggle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.mobile-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: all var(--transition);
}

.mobile-nav {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  z-index: 99;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.mobile-nav.open {
  display: block;
}

.mobile-nav ul {
  list-style: none;
}

.mobile-nav a {
  display: block;
  padding: 10px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.mobile-nav a:hover {
  color: var(--text);
}

/* ===========================================
   Highlighted items from NN search
   =========================================== */
.highlight-match {
  background: rgba(56, 189, 248, 0.08);
  border-left: 2px solid var(--accent);
  transition: background 0.4s ease, border-color 0.4s ease;
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 1024px) {
  .sidebar {
    width: 400px;
    padding: 72px 32px;
  }

  .content {
    padding: 72px 32px 72px 16px;
  }

  .sidebar-name a {
    font-size: 2.2rem;
  }
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  .content {
    padding: 80px 20px 40px;
  }

  .section-label {
    display: block;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px 20px;
    margin: 0 -20px 24px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text);
  }

  .exp-item,
  .project-card,
  .achievement-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .card-thumb {
    width: 100%;
    max-width: 200px;
  }

  .section {
    margin-bottom: 48px;
    scroll-margin-top: 56px;
  }

  .nn-widget {
    display: none;
  }

  .archive-table .hide-mobile {
    display: none;
  }
}
