/* ===== CSS Custom Properties — Shared ===== */
:root {
  /* Spacing */
  --section-py: 6rem;
  --container: 1120px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Light Theme — Anthropic ===== */
[data-theme="light"] {
  --bg: #f5f4ed;
  --bg-alt: #efede6;
  --surface: #faf9f5;
  --border: #e8e6dc;
  --text: #141413;
  --text-secondary: #5e5d59;
  --text-tertiary: #87867f;
  --accent: #c96442;
  --accent-hover: #d97757;
  --accent-light: rgba(201, 100, 66, 0.08);
  --law: #7c3aed;
  --law-light: rgba(124, 58, 237, 0.1);
  --ai: #059669;
  --ai-light: rgba(5, 150, 105, 0.1);
  --amber: #d97706;
  --gradient: linear-gradient(135deg, #c96442, #a78bfa);

  /* Typography — serif for headings, sans for body */
  --font-serif: 'Playfair Display', Georgia, Times, serif;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

/* ===== Dark Theme — Geek ===== */
[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #0d120d;
  --surface: #0d120d;
  --border: #1e2a1e;
  --text: #c9d1c9;
  --text-secondary: #6b8a6b;
  --text-tertiary: #3d5a3d;
  --accent: #5ddb8a;
  --accent-hover: #7ee5a0;
  --accent-light: rgba(93, 219, 138, 0.12);
  --law: #5fa8d3;
  --law-light: rgba(95, 168, 211, 0.1);
  --ai: #5ddb8a;
  --ai-light: rgba(93, 219, 138, 0.1);
  --amber: #e6b85c;
  --gradient: linear-gradient(135deg, #5ddb8a, #5fa8d3);

  /* Typography — JetBrains Mono for everything */
  --font-serif: var(--font);
  --font: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  transition: background 0.3s var(--ease);
}

body {
  font-family: var(--font);
  font-size: clamp(15px, 1vw + 14px, 17px);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings — serif in light, mono in dark */
h1, h2, h3, h4, h5, h6,
.hero-name,
.section-title,
.project-title,
.feed-title,
.contact-email,
.nametag-name {
  font-family: var(--font-serif);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}

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

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

/* Skip to content */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  z-index: 1000;
  font-size: 14px;
}

.skip-link:focus {
  top: 16px;
  color: #fff;
}

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

/* ===== Container ===== */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  z-index: 100;
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.nav-logo {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  letter-spacing: -0.025em;
}

.nav-links {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  list-style: none;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Nav links with underline animation */
.nav-links a {
  position: relative;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s var(--ease);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
  transform: translateX(-50%);
  border-radius: 1px;
}

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

.nav-links a:hover::after {
  width: 100%;
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  margin-right: 0.25rem;
}

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

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

[data-theme="light"] .theme-toggle .light-icon {
  display: block;
}
[data-theme="light"] .theme-toggle .dark-icon {
  display: none;
}
[data-theme="dark"] .theme-toggle .light-icon {
  display: none;
}
[data-theme="dark"] .theme-toggle .dark-icon {
  display: block;
}

/* Language dropdown */
.lang-dropdown {
  position: relative;
  margin-right: 0.5rem;
}

.lang-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

.lang-dropdown-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 110px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  padding: 4px;
  display: none;
  z-index: 200;
}

.lang-menu.open {
  display: block;
}

.lang-menu button {
  display: block;
  width: 100%;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: background 0.1s;
}

.lang-menu button:hover {
  background: var(--bg-alt);
  color: var(--accent);
}


/* Hamburger */
.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text);
}

.nav-hamburger svg {
  width: 24px;
  height: 24px;
}

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 99;
  padding: 80px 1.5rem 2rem;
  flex-direction: column;
  gap: 1rem;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Radial glow */
.hero::before {
  content: '';
  position: absolute;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Dot grid pattern */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--text-tertiary) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.08;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 0 1.5rem;
}

.hero-overline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 2rem;
}

.hero-overline-line {
  width: 48px;
  height: 1px;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

.hero-name {
  font-size: clamp(4rem, 10vw, 7rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
}

.hero-name .gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto 3rem;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s var(--ease);
  cursor: pointer;
  border: none;
  letter-spacing: -0.01em;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 25%, transparent);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--text) 4%, transparent);
}

/* ===== Section Dividers ===== */
.section-divider {
  padding: 5rem 0;
  text-align: center;
  background: var(--bg);
  width: 100%;
}

.section-divider-alt {
  background: var(--bg-alt);
}

.section-divider-inner {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-divider blockquote {
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  font-style: italic;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.6;
  letter-spacing: -0.01em;
  font-family: 'Georgia', 'Times New Roman', serif;
}

.section-divider blockquote::before {
  content: '\201C';
}

.section-divider blockquote::after {
  content: '\201D';
}

/* ===== Section ===== */
.section {
  padding: var(--section-py) 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-header {
  margin-bottom: 3rem;
}

.section-overline {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

/* ===== Content Tabs ===== */
.content-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.content-tab {
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s var(--ease);
}

.content-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.content-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.feed-section.hidden {
  display: none;
}

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: start;
}

.about-bio p {
  color: var(--text-secondary);
  font-size: clamp(0.9375rem, 1.2vw + 0.5rem, 1.0625rem);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.about-bio p:last-of-type {
  margin-bottom: 2rem;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin: 2.5rem 0 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
  padding-left: 1rem;
}

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

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 0.5rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  z-index: 1;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.timeline-item:hover::before {
  transform: scale(1.4);
  box-shadow: 0 0 0 4px var(--accent-light);
}

.timeline-year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.timeline-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Skills */
.skills-group {
  margin-bottom: 1.5rem;
}

.skills-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.skills-label.law { color: var(--law); }
.skills-label.ai { color: var(--ai); }

.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.375rem 0.875rem;
  border-radius: 100px;
  transition: transform 0.15s var(--ease);
}

.tag:hover {
  transform: translateY(-1px);
}

.tag-law {
  background: var(--law-light);
  color: var(--law);
}

.tag-ai {
  background: var(--ai-light);
  color: var(--ai);
}

/* About visual — photo + resume button */
.about-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}

.about-graphic {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 20px;
  background: var(--gradient);
  opacity: 0.1;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.3s var(--ease);
}

.about-graphic:hover {
  box-shadow: 0 8px 30px color-mix(in srgb, var(--accent) 15%, transparent);
}

.about-graphic.has-photo {
  aspect-ratio: auto;
  opacity: 1;
  background: none;
  width: 100%;
  border-radius: 20px;
}

.about-graphic.has-photo img {
  width: 100%;
  height: auto;
  border-radius: 20px;
  display: block;
}

/* Nametag overlay */
.photo-nametag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 1.25rem 1.25rem;
  background: linear-gradient(transparent 0%, rgba(0,0,0,0.55) 100%);
  border-radius: 0 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.about-graphic:hover .photo-nametag {
  opacity: 0.9;
  transform: translateY(-2px);
}

.nametag-name {
  font-size: 1.375rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.nametag-role {
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Resume button */
.about-visual .resume-btn {
  width: 100%;
  margin-top: 1.25rem;
  justify-content: center;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  backdrop-filter: blur(8px);
}

.lightbox.open {
  display: flex;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  color: rgba(255,255,255,0.7);
  font-size: 2.5rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
  line-height: 1;
  transition: color 0.15s;
}

.lightbox-close:hover {
  color: #fff;
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s var(--ease);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 15%, transparent);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--text) 3%, transparent);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px color-mix(in srgb, var(--text) 6%, transparent);
}

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

.project-card.cat-law::before { background: var(--law); }
.project-card.cat-ai::before { background: var(--ai); }
.project-card.cat-tool::before { background: var(--amber); }

/* Project preview image on hover */
.project-preview {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  border-radius: 16px;
  overflow: hidden;
  z-index: 0;
}

.project-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.5) saturate(0.8);
}

.project-card:hover .project-preview {
  opacity: 1;
}

/* Keep card content readable when preview is shown */
.project-card:hover .project-category,
.project-card:hover .project-title,
.project-card:hover .project-desc,
.project-card:hover .project-stack,
.project-card:hover .project-link {
  position: relative;
  z-index: 1;
}

.project-card:hover .project-category,
.project-card:hover .project-title {
  color: #fff;
}

.project-card:hover .project-desc {
  color: rgba(255,255,255,0.75);
}

.project-card:hover .project-stack span {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
}

.project-card:hover .project-link {
  color: #fff;
}

.project-category {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  transition: color 0.3s var(--ease);
}

.project-card.cat-law .project-category { color: var(--law); }
.project-card.cat-ai .project-category { color: var(--ai); }
.project-card.cat-tool .project-category { color: var(--amber); }

/* ===== Legal Research ===== */
.research-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.research-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--text) 3%, transparent);
}

.research-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px color-mix(in srgb, var(--text) 6%, transparent);
  border-color: var(--accent);
}

.research-body {
  flex: 1;
  min-width: 0;
}

.research-title {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

.research-desc {
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.research-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.research-arrow {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.3s var(--ease), color 0.3s var(--ease);
}

.research-card:hover .research-arrow {
  transform: translateX(4px);
  color: var(--accent);
}

/* Dark theme: terminal-style research cards */
[data-theme="dark"] .research-card {
  border-radius: 0;
  border-color: var(--border);
}

[data-theme="dark"] .research-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 15%, transparent);
}

[data-theme="dark"] .research-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

[data-theme="dark"] .research-desc {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* Light theme overrides: keep card text visible on hover */
[data-theme="light"] .research-card:hover .research-title {
  color: var(--text);
}
[data-theme="light"] .research-card:hover .research-desc {
  color: var(--text-secondary);
}
[data-theme="light"] .research-card:hover .research-date {
  color: var(--text-tertiary);
}

.project-title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 0.5rem;
  transition: color 0.3s var(--ease);
}

.project-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
  transition: color 0.3s var(--ease);
}

.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}

.project-stack span {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  background: var(--bg-alt);
  color: var(--text-tertiary);
  transition: all 0.3s var(--ease);
}

.project-link {
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  position: relative;
  z-index: 1;
  transition: color 0.3s var(--ease);
}

.project-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s var(--ease);
}

.project-link:hover svg {
  transform: translateX(4px);
}

/* ===== Content Feed Sections ===== */
.feed-section {
  margin-bottom: 3rem;
}

.feed-section:last-child {
  margin-bottom: 0;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.feed-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.feed-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feed-icon svg {
  width: 18px;
  height: 18px;
}

.xhs-icon {
  background: rgba(255, 36, 66, 0.15);
  color: #ff6b7d;
}

.wechat-icon {
  background: rgba(7, 193, 96, 0.15);
  color: #2ecc71;
}

.xiaoyuzhou-icon {
  background: rgba(230, 126, 34, 0.15);
  color: #f39c12;
}

.feed-title {
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.feed-more {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: color 0.15s;
}

.feed-more:hover {
  color: var(--accent);
}

/* Xiaohongshu Grid */
.xhs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.xhs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 2%, transparent);
}

.xhs-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 5%, transparent);
}

.xhs-card-image {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, var(--accent-light), var(--bg-alt));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.xhs-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xhs-card-image .xhs-placeholder {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-tertiary);
  opacity: 0.25;
}

.xhs-card-body {
  padding: 0.625rem 0.75rem 0.75rem;
}

.xhs-card-title {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 640px) {
  .xhs-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .xhs-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }
}

/* WeChat Article List */
.wechat-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wechat-article {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 2%, transparent);
}

.wechat-article:hover {
  transform: translateX(4px) scale(1.01);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--text) 4%, transparent);
}

.wechat-thumb {
  width: 120px;
  min-height: 80px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ai-light), var(--accent-light));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.wechat-thumb .wechat-placeholder {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-tertiary);
  opacity: 0.2;
}

.wechat-article-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wechat-article-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.375rem;
}

.wechat-article-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* Xiaoyuzhou (Podcast) */
.yz-episode {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 2%, transparent);
}

.yz-episode:hover {
  transform: translateX(4px) scale(1.01);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--text) 4%, transparent);
}

.yz-cover {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff4e6, #fdebd0);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.yz-cover .yz-placeholder {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-tertiary);
  opacity: 0.25;
}

.yz-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}

.yz-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yz-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.yz-date {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.xiaoyuzhou-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ===== Blog ===== */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 2%, transparent);
  position: relative;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px color-mix(in srgb, var(--text) 4%, transparent);
  border-color: var(--accent);
}

.blog-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.blog-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.4;
  color: var(--text);
}

.blog-card-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.blog-card-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.blog-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.blog-card-tags .tag {
  font-size: 0.6875rem;
  padding: 0.25rem 0.625rem;
  pointer-events: none;
}

/* Blog post page view */
.blog-post-page {
  display: none;
  animation: blogPostIn 0.35s var(--ease-spring);
}

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

.blog-post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 2rem;
  transition: color 0.15s;
  text-decoration: none;
}

.blog-post-back:hover {
  color: var(--accent);
}

.blog-post-article {
  max-width: 720px;
}

.blog-post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.blog-post-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.blog-post-date {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}

.blog-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.blog-post-tags .tag {
  font-size: 0.6875rem;
  padding: 0.25rem 0.625rem;
}

/* Blog article body typography */
.blog-post-body,
.research-post-body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.blog-post-body p,
.research-post-body p {
  margin-bottom: 1.25em;
}

.blog-post-body p:last-child,
.research-post-body p:last-child {
  margin-bottom: 0;
}

.blog-post-body strong,
.research-post-body strong {
  font-weight: 600;
}

.blog-post-body em,
.research-post-body em {
  font-style: italic;
}

.blog-post-body a,
.research-post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blog-post-body a:hover,
.research-post-body a:hover {
  color: var(--accent-hover);
}

.blog-post-body ul,
.blog-post-body ol,
.research-post-body ul,
.research-post-body ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
}

.blog-post-body li,
.research-post-body li {
  margin-bottom: 0.5em;
}

.blog-post-body h2,
.blog-post-body h3,
.research-post-body h2,
.research-post-body h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 1.5em;
  margin-bottom: 0.75em;
}

.blog-post-body h2 { font-size: 1.375rem; }
.blog-post-body h3 { font-size: 1.125rem; }

.blog-post-body blockquote,
.research-post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin: 1.25em 0;
  color: var(--text-secondary);
  font-style: italic;
}

.blog-post-body code,
.research-post-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-alt);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
}

.blog-post-body pre,
.research-post-body pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25em;
}

.blog-post-body pre code,
.research-post-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.8125rem;
  color: var(--text);
}

/* Research post page view */
.research-post-page {
  display: none;
  animation: blogPostIn 0.35s var(--ease-spring);
}

.research-post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 2rem;
  transition: color 0.15s;
  text-decoration: none;
}

.research-post-back:hover {
  color: var(--accent);
}

.research-post-article {
  max-width: 720px;
}

.research-post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.research-post-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.research-post-date {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}

.research-post-link {
  margin-top: 2rem;
}

/* Dark theme blog overrides */
[data-theme="dark"] .blog-card {
  background: transparent;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  cursor: pointer;
}

[data-theme="dark"] .blog-card:hover {
  background: var(--bg-alt);
  border-color: var(--accent);
  transform: none !important;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 15%, transparent) !important;
}

[data-theme="dark"] .blog-card-title {
  font-family: var(--font-mono);
  font-size: 1rem;
}

[data-theme="dark"] .blog-card-summary {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

[data-theme="dark"] .blog-post-body,
[data-theme="dark"] .research-post-body {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.9;
}

[data-theme="dark"] .blog-post-body blockquote,
[data-theme="dark"] .research-post-body blockquote {
  border-left-color: var(--accent);
  font-style: normal;
  font-family: var(--font-mono);
}

[data-theme="dark"] .blog-post-body code,
[data-theme="dark"] .research-post-body code {
  background: var(--border);
  color: var(--accent);
}

/* Blog content edit button (edit mode) */
.blog-content-edit-btn {
  display: none;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: var(--accent-light);
  border: 1px dashed var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s var(--ease);
  text-align: center;
}

.blog-content-edit-btn:hover {
  background: var(--accent);
  color: #fff;
}

.edit-mode .blog-content-edit-btn {
  display: block;
}

[data-theme="dark"] .blog-content-edit-btn {
  border-radius: 0 !important;
}

/* ===== Contact ===== */
.contact {
  text-align: center;
}

.contact-desc {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.contact-email {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  display: inline-block;
  margin-bottom: 2.5rem;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s var(--ease);
}

.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 12%, transparent);
}

.social-link svg {
  width: 20px;
  height: 20px;
}

/* ===== Footer ===== */
.footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* ===== Enhanced Scroll Animations ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px) scale(0.98);
  transition: opacity 0.7s var(--ease-spring), transform 0.7s var(--ease-spring);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Stagger children */
.stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.stagger > .reveal:nth-child(2) { transition-delay: 80ms; }
.stagger > .reveal:nth-child(3) { transition-delay: 160ms; }
.stagger > .reveal:nth-child(4) { transition-delay: 240ms; }
.stagger > .reveal:nth-child(5) { transition-delay: 320ms; }
.stagger > .reveal:nth-child(6) { transition-delay: 400ms; }

/* Parallax elements */
.parallax {
  will-change: transform;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
  }
  .parallax {
    transform: none !important;
  }
}

/* ===== Responsive ===== */

/* Tablet+ */
@media (min-width: 640px) {
  .about-grid {
    grid-template-columns: 3fr 2fr;
  }

  .projects-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  :root {
    --section-py: 7rem;
  }
}

/* Mobile */
@media (max-width: 639px) {
  .nav-links {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  .back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
  }

  /* Smaller photo on mobile */
  .about-visual {
    max-width: 260px;
  }
}

/* ===== Dark Theme — Terminal Overhaul ===== */

/* All corners sharp — terminal aesthetic */
[data-theme="dark"] * {
  border-radius: 0 !important;
}
/* Restore radius for images inside cards so they don't clip */
[data-theme="dark"] .project-preview img,
[data-theme="dark"] .xhs-card-image img,
[data-theme="dark"] .wechat-thumb img,
[data-theme="dark"] .yz-cover img,
[data-theme="dark"] .about-graphic.has-photo img {
  border-radius: 0 !important;
}

/* Nav — solid black terminal title bar, no blur */
[data-theme="dark"] .nav,
[data-theme="dark"] .nav.scrolled {
  background: #000000;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
}

/* Glow effects */
[data-theme="dark"] .hero::before {
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}

[data-theme="dark"] .hero-name .gradient {
  text-shadow: 0 0 30px color-mix(in srgb, var(--accent) 30%, transparent),
               0 0 60px color-mix(in srgb, var(--accent) 15%, transparent);
}

/* Scanline overlay on hero */
[data-theme="dark"] .hero::after {
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.012) 2px,
      rgba(255, 255, 255, 0.012) 4px
    ),
    radial-gradient(circle, var(--text-tertiary) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px;
  opacity: 1;
}

/* Buttons — terminal command style */
[data-theme="dark"] .btn-primary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 20%, transparent);
}

[data-theme="dark"] .btn-primary:hover {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 35%, transparent);
  transform: none;
}

[data-theme="dark"] .btn-secondary {
  border-width: 1px;
}

[data-theme="dark"] .btn-secondary:hover {
  background: var(--bg-alt);
  transform: none;
}

/* Cards — transparent, terminal output style, no lift */
[data-theme="dark"] .project-card,
[data-theme="dark"] .xhs-card,
[data-theme="dark"] .wechat-article,
[data-theme="dark"] .yz-episode {
  background: transparent;
  box-shadow: none !important;
  transform: none !important;
}

[data-theme="dark"] .project-card:hover,
[data-theme="dark"] .xhs-card:hover {
  background: var(--bg-alt);
  box-shadow: none !important;
  transform: none !important;
}

[data-theme="dark"] .wechat-article:hover,
[data-theme="dark"] .yz-episode:hover {
  background: var(--bg-alt);
  box-shadow: none !important;
  transform: none !important;
}

/* Project card top bar */
[data-theme="dark"] .project-card::before {
  height: 2px;
}

/* Content tabs — terminal filter style */
[data-theme="dark"] .content-tab {
  border-width: 1px;
}
[data-theme="dark"] .content-tab.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* Tags — terminal outlined style */
[data-theme="dark"] .tag {
  border: 1px solid transparent;
  transform: none !important;
}
[data-theme="dark"] .tag-law {
  border-color: color-mix(in srgb, var(--law) 40%, transparent);
}
[data-theme="dark"] .tag-ai {
  border-color: color-mix(in srgb, var(--ai) 40%, transparent);
}
[data-theme="dark"] .tag:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 15%, transparent);
}

/* Section overline — terminal prompt style */
[data-theme="dark"] .section-overline {
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Timeline dots — terminal indicator */
[data-theme="dark"] .timeline-item::before {
  border-color: #000;
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent);
}
[data-theme="dark"] .timeline-item:hover::before {
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* Section dividers — minimal */
[data-theme="dark"] .section-divider blockquote::before,
[data-theme="dark"] .section-divider blockquote::after {
  content: '';
}
[data-theme="dark"] .section-divider blockquote {
  font-family: var(--font);
  font-style: normal;
  font-size: clamp(0.875rem, 1.5vw, 1rem);
  color: var(--text-tertiary);
}

/* Social links */
[data-theme="dark"] .social-link:hover {
  transform: none;
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Footer */
[data-theme="dark"] .footer {
  border-top-color: var(--border);
}

/* Feed titles color */
[data-theme="dark"] .feed-title {
  color: var(--accent);
}

/* Light theme — project card hover keeps normal colors */
[data-theme="light"] .project-card:hover .project-category,
[data-theme="light"] .project-card:hover .project-title,
[data-theme="light"] .project-card:hover .project-link {
  color: inherit;
}
[data-theme="light"] .project-card:hover .project-desc {
  color: var(--text-secondary);
}
[data-theme="light"] .project-card:hover .project-stack span {
  background: var(--bg-alt);
  color: var(--text-tertiary);
}

/* ===== Edit Mode ===== */

/* Password overlay */
.edit-password-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.edit-password-overlay.open {
  display: flex;
}
.edit-password-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.edit-password-dialog h3 {
  font-family: var(--font);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}
.edit-password-dialog input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 1rem;
  outline: none;
  box-sizing: border-box;
}
.edit-password-dialog input:focus {
  border-color: var(--accent);
}
.edit-password-actions {
  display: flex;
  gap: 0.75rem;
}
.edit-password-actions .btn {
  flex: 1;
  justify-content: center;
}
.edit-password-error {
  color: #e53e3e;
  font-size: 0.8rem;
  margin-top: 0.75rem;
  font-family: var(--font-mono);
}

/* Dark theme dialog */
[data-theme="dark"] .edit-password-dialog {
  border-radius: 0 !important;
}

/* Save bar */
.edit-save-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  padding: 0.75rem 1.5rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  z-index: 9998;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.edit-save-bar.open {
  display: flex;
}
.edit-save-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.edit-save-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.edit-save-actions .btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}
.edit-save-hint {
  opacity: 0.6;
  font-size: 0.75rem;
}

/* Nav lock button */
.edit-nav-lock {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: all 0.2s var(--ease);
  margin-right: 0.25rem;
}
.edit-nav-lock:hover {
  background: var(--accent);
  color: #fff;
}

/* Editable elements in edit mode */
.edit-mode [data-edit-path] {
  cursor: text;
  position: relative;
  outline: none;
  transition: background 0.15s var(--ease);
  border-radius: 4px;
}
.edit-mode [data-edit-path]:hover {
  background: var(--accent-light);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}
.edit-mode [data-edit-path]:focus {
  background: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent);
}

/* Edit mode nav indicator */
.edit-mode .nav {
  border-bottom-color: var(--accent) !important;
}

/* Disable pointer events on interactive elements in edit mode */
.edit-mode a:not(.edit-nav-lock),
.edit-mode .btn,
.edit-mode .content-tab,
.edit-mode .theme-toggle,
.edit-mode .lang-dropdown-btn,
.edit-mode .nav-hamburger,
.edit-mode .back-to-top {
  pointer-events: none;
}

/* But editable elements inside should still work */
.edit-mode [data-edit-path] {
  pointer-events: auto !important;
}

/* Edit mode save bar buttons should work */
.edit-save-bar .btn {
  pointer-events: auto !important;
}

/* Custom modal buttons should work in edit mode */
.edit-custom-modal .btn {
  pointer-events: auto !important;
}

/* Make data-edit-href elements clickable in edit mode */
.edit-mode [data-edit-href] {
  pointer-events: auto !important;
}

/* Dark theme save bar */
[data-theme="dark"] .edit-save-bar {
  border-top-width: 1px;
}
[data-theme="dark"] .edit-nav-lock {
  border-radius: 0 !important;
}

/* ===== Edit Mode: Image & Link Editing ===== */

/* Image edit indicator */
.edit-mode [data-edit-image] {
  cursor: pointer;
  outline: 2px dashed transparent;
  transition: outline-color 0.2s var(--ease);
}
.edit-mode [data-edit-image]:hover {
  outline-color: var(--accent);
  outline-offset: 2px;
}

/* Link edit indicator */
.edit-mode [data-edit-href] {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

/* Add button — end of list */
.edit-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem;
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s var(--ease);
  margin-top: 0.5rem;
}
.edit-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

[data-theme="dark"] .edit-add-btn {
  border-radius: 0 !important;
}

/* Remove button — top right of card */
.edit-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e53e3e;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  pointer-events: auto !important;
}
.project-card:hover .edit-remove-btn,
.research-card:hover .edit-remove-btn {
  opacity: 1;
}

[data-theme="dark"] .edit-remove-btn {
  border-radius: 0 !important;
}

/* Social edit button */
.edit-social-btn {
  display: none;
  margin: 1rem auto 0;
  padding: 0.5rem 1.25rem;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.edit-social-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Skills tag remove button (sibling of tag, not child) */
.edit-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  font-family: var(--font);
  vertical-align: middle;
  transition: all 0.15s;
  padding: 0;
}
.edit-tag-remove:hover {
  color: #e53e3e;
  border-color: #e53e3e;
  background: rgba(229, 62, 62, 0.1);
}

/* Social edit modal */
.edit-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.edit-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.edit-modal-content h3 {
  font-family: var(--font);
  font-size: 1.125rem;
  font-weight: 600;
  padding: 1.5rem 1.5rem 0;
  color: var(--text);
}
.edit-modal-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}
.edit-modal-actions {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.5rem;
  justify-content: flex-end;
}
.edit-modal-actions .btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

/* Social link edit row */
.social-edit-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.social-edit-icon {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  width: 100px;
  flex-shrink: 0;
}
.social-edit-url {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  outline: none;
}
.social-edit-url:focus {
  border-color: var(--accent);
}
.social-edit-remove {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.15s;
}
.social-edit-remove:hover {
  color: #e53e3e;
  border-color: #e53e3e;
}

[data-theme="dark"] .edit-modal-content {
  border-radius: 0 !important;
}
[data-theme="dark"] .social-edit-icon,
[data-theme="dark"] .social-edit-url,
[data-theme="dark"] .social-edit-remove {
  border-radius: 0 !important;
}

/* ===== Custom Modal (replaces native prompt/confirm) ===== */
.edit-custom-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.edit-custom-modal.open {
  display: flex;
}
.edit-custom-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.2s var(--ease-spring);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.edit-custom-modal-body {
  padding: 1.5rem 1.5rem 0.5rem;
}
.edit-custom-modal-actions {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.5rem;
  justify-content: flex-end;
}
.edit-custom-modal-actions .btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

/* Modal message (confirm) */
.edit-custom-modal-message {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

/* Modal form fields */
.edit-custom-modal-field {
  margin-bottom: 1rem;
}
.edit-custom-modal-field:last-child {
  margin-bottom: 0;
}
.edit-custom-modal-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  font-family: var(--font);
}
.edit-custom-modal-field .cm-field {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.edit-custom-modal-field .cm-field:focus {
  border-color: var(--accent);
}
.edit-custom-modal-field textarea.cm-field {
  min-height: 80px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.edit-custom-modal-field select.cm-field {
  cursor: pointer;
  appearance: auto;
}

/* Dark theme custom modal */
[data-theme="dark"] .edit-custom-modal-content {
  border-radius: 0 !important;
}
[data-theme="dark"] .edit-custom-modal-field .cm-field {
  border-radius: 0 !important;
}
