/* Dark theme (default) */
:root {
  --bg: #0a0a0a;
  --fg: #ededed;
  --muted: #888;
  --accent: #3b82f6;
  --border: #222;
}

/* Light theme */
[data-theme="light"] {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #666;
  --accent: #2563eb;
  --border: #ddd;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
}

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

.hero {
  margin-bottom: 4rem;
}

.hero-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.hero-text {
  flex: 1;
}

.hero-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--muted);
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.location {
  color: var(--muted);
  font-size: 1rem;
}

@media (max-width: 600px) {
  .hero-content {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
  }
  
  .hero-photo {
    width: 150px;
    height: 150px;
  }
}

section {
  margin-bottom: 3rem;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

h3 {
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

p {
  margin-bottom: 1rem;
}

p:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--fg);
}

.experience-item {
  border-left: 2px solid var(--border);
  padding-left: 1.5rem;
  margin-bottom: 2rem;
}

.experience-item:last-child {
  margin-bottom: 0;
}

.company {
  color: var(--accent);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.company-icon {
  height: 15px;
  width: 15px;
  vertical-align: middle;
}

.dates {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.education-item {
  border-left: 2px solid var(--border);
  padding-left: 1.5rem;
}

.degree {
  margin-bottom: 0.25rem;
}

.specialization {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

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

a:hover {
  text-decoration: underline;
}

#speaking p {
  color: var(--muted);
}

#awards p {
  margin: 0;
}

/* Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .nav {
  background: rgba(250, 250, 250, 0.8);
}

.nav-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo-img {
  height: 36px;
  width: auto;
}

.nav-logo:hover {
  text-decoration: none;
  opacity: 0.8;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--fg);
  text-decoration: none;
}

.nav-link.active {
  color: var(--fg);
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--fg);
  transition: transform 0.3s, opacity 0.3s;
}

.nav-hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav panel */
.mobile-nav {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 89;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.mobile-nav.open {
  transform: translateX(0);
}

.mobile-nav-content {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  gap: 1.5rem;
}

.mobile-nav-link {
  font-size: 1.5rem;
  color: var(--muted);
  text-decoration: none;
}

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

@media (max-width: 600px) {
  .nav-links {
    display: none;
  }
  
  .nav-hamburger {
    display: flex;
  }
}

/* Adjust body for fixed nav */
body {
  padding-top: 60px;
}

/* Page header (for subpages) */
.page-header {
  margin-bottom: 3rem;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--muted);
  font-size: 1.1rem;
}

/* Posts */
.post-list,
.page-header + section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-item,
.page-header + section > .experience-item {
  display: block;
  margin: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

[data-theme="light"] .post-item,
[data-theme="light"] .page-header + section > .experience-item {
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.04), rgba(37, 99, 235, 0));
}

.post-item:hover,
.page-header + section > .experience-item:hover {
  transform: translateY(-3px);
  border-color: var(--muted);
  text-decoration: none;
}

.post-item-meta,
.page-header + section > .experience-item > .dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.post-item-meta > * + *,
.post-meta > * + * {
  position: relative;
  padding-left: 0.85rem;
}

.post-item-meta > * + *::before,
.post-meta > * + *::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.25rem;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--muted);
  transform: translateY(-50%);
}

.post-item-title,
.post-item-title a,
.page-header + section > .experience-item h3,
.page-header + section > .experience-item h3 a {
  color: var(--fg);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

.post-item-title,
.page-header + section > .experience-item h3 {
  margin-bottom: 0.45rem;
}

.post-item:hover .post-item-title,
.post-item:hover .post-item-title a,
.page-header + section > .experience-item:hover h3 a {
  text-decoration: none;
}

.post-item-desc,
.page-header + section > .experience-item > p:not(.dates) {
  margin: 0;
  color: var(--muted);
  display: -webkit-box;
  overflow: hidden;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.empty-state,
.page-header + section > p:only-child {
  margin: 0;
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.post-header,
main.container > article > .page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1,
main.container > article > .page-header h1 {
  margin-bottom: 0;
  line-height: 1.1;
}

.post-meta,
main.container > article > .page-header .dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

main.container > article > .page-header .dates + .dates {
  margin-top: 0.5rem;
}

.post-content,
main.container > article > div {
  color: var(--fg);
  font-size: 1.05rem;
}

.post-content > :first-child,
main.container > article > div > :first-child {
  margin-top: 0;
}

.post-content > :last-child,
main.container > article > div > :last-child {
  margin-bottom: 0;
}

.post-content h1,
main.container > article > div h1,
.post-content h2,
main.container > article > div h2,
.post-content h3,
main.container > article > div h3,
.post-content h4,
main.container > article > div h4 {
  color: var(--fg);
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
}

.post-content h1,
main.container > article > div h1 {
  margin: 2.5rem 0 1rem;
  font-size: 2rem;
  line-height: 1.15;
}

.post-content h2,
main.container > article > div h2 {
  margin: 2.25rem 0 0.9rem;
  font-size: 1.6rem;
  line-height: 1.2;
}

.post-content h3,
main.container > article > div h3 {
  margin: 1.9rem 0 0.8rem;
  font-size: 1.3rem;
  line-height: 1.3;
}

.post-content h4,
main.container > article > div h4 {
  margin: 1.6rem 0 0.7rem;
  font-size: 1.1rem;
  line-height: 1.4;
}

.post-content p,
main.container > article > div p {
  margin: 0 0 1.25rem;
  line-height: 1.7;
}

.post-content a,
main.container > article > div a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.post-content code,
main.container > article > div code {
  padding: 0.15em 0.4em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.12);
  font-family: "SFMono-Regular", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
}

[data-theme="light"] .post-content code,
[data-theme="light"] main.container > article > div code {
  background: rgba(37, 99, 235, 0.08);
}

.post-content pre,
main.container > article > div pre {
  margin: 1.5rem 0;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  overflow-x: auto;
}

[data-theme="light"] .post-content pre,
[data-theme="light"] main.container > article > div pre {
  background: rgba(37, 99, 235, 0.04);
}

.post-content pre code,
main.container > article > div pre code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.95rem;
  line-height: 1.65;
}

.post-content blockquote,
main.container > article > div blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.post-content blockquote > :last-child,
main.container > article > div blockquote > :last-child {
  margin-bottom: 0;
}

.post-content ul,
main.container > article > div ul,
.post-content ol,
main.container > article > div ol {
  margin: 0 0 1.25rem 1.5rem;
  padding-left: 0.5rem;
}

.post-content ul,
main.container > article > div ul {
  list-style: disc;
}

.post-content ol,
main.container > article > div ol {
  list-style: decimal;
}

.post-content li,
main.container > article > div li {
  margin: 0.35rem 0;
  line-height: 1.7;
}

.post-content li > ul,
main.container > article > div li > ul,
.post-content li > ol,
main.container > article > div li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.post-content img,
main.container > article > div img {
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.post-content hr,
main.container > article > div hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .post-item,
  .page-header + section > .experience-item {
    padding: 1rem;
  }

  .post-header,
  main.container > article > .page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
  }

  .post-content,
  main.container > article > div {
    font-size: 1rem;
  }
}

/* Book grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

@media (max-width: 500px) {
  .book-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.book-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
}

.book-card:hover {
  transform: translateY(-4px);
  text-decoration: none;
}

.book-cover {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--border);
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .book-cover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-info {
  text-align: center;
}

.book-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--fg);
}

.book-author {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

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

.project-card {
  display: block;
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

[data-theme="light"] .project-card {
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.04), rgba(37, 99, 235, 0));
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--muted);
}

.project-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.project-meta-pill {
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.project-github-icon {
  width: 18px;
  height: 18px;
  opacity: 0.45;
  transition: opacity 0.2s ease;
  filter: var(--github-icon-filter, invert(1));
}

[data-theme="light"] .project-github-icon {
  filter: none;
}

.project-card:hover .project-github-icon {
  opacity: 0.8;
}

.project-name {
  font-size: 1.2rem;
  margin-bottom: 0.6rem;
}

.project-description {
  color: var(--muted);
  margin: 0;
}

.accent-cobalt::before {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.accent-emerald::before {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.accent-cobalt .project-meta-pill {
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(59, 130, 246, 0.12);
}

.accent-emerald .project-meta-pill {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(16, 185, 129, 0.12);
}

[data-theme="light"] .accent-cobalt .project-meta-pill {
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .accent-emerald .project-meta-pill {
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 70px;
  right: 1.25rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(10, 10, 10, 0.5);
}

[data-theme="light"] .theme-toggle {
  background: rgba(250, 250, 250, 0.5);
}

.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

/* Dark mode: show sun icon (click to go light) */
:root:not([data-theme="light"]) .theme-toggle .icon-sun {
  display: block;
}

/* Light mode: show moon icon (click to go dark) */
[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}
