/* ============================================
   BENTO-STYLE iOS-INSPIRED DESIGN SYSTEM
   Color: Deep Sea Blue
   Fonts: Inter (headings) + Source Serif 4 (body)
   ============================================ */

:root {
  /* Deep Sea Blue palette */
  --color-primary: #1a3a5c;
  --color-primary-light: #2a5a8c;
  --color-primary-lighter: #3a7abd;
  --color-accent: #4a9eff;
  --color-accent-soft: rgba(74, 158, 255, 0.12);

  /* Neutrals */
  --color-bg: #f2f2f7;
  --color-surface: #ffffff;
  --color-surface-hover: #f8f9fa;
  --color-text: #1c1c1e;
  --color-text-secondary: #6e6e73;
  --color-text-tertiary: #aeaeb2;
  --color-border: rgba(0, 0, 0, 0.06);

  /* Tag colors (desaturated for academic tone) */
  --tag-ai: #6b6aaf;
  --tag-ai-bg: rgba(107, 106, 175, 0.09);
  --tag-backend: #5aab6e;
  --tag-backend-bg: rgba(90, 171, 110, 0.09);
  --tag-frontend: #c8882a;
  --tag-frontend-bg: rgba(200, 136, 42, 0.09);
  --tag-data: #c75a52;
  --tag-data-bg: rgba(199, 90, 82, 0.09);
  --tag-tools: #9466a9;
  --tag-tools-bg: rgba(148, 102, 169, 0.09);

  /* Layout */
  --container-max: 1100px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 2px 6px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Dark Mode Palette */
  --color-primary: #6ab0ff;
  --color-primary-light: #8dc5ff;
  --color-primary-lighter: #aed6ff;
  --color-accent: #6ab0ff;
  --color-accent-soft: rgba(106, 176, 255, 0.15);

  /* Neutrals */
  --color-bg: #0f1115;
  --color-surface: #1a1d21;
  --color-surface-hover: #22262b;
  --color-text: #e6e6e6;
  --color-text-secondary: #a0a0a0;
  --color-text-tertiary: #6e6e73;
  --color-border: rgba(255, 255, 255, 0.1);

  /* Adjust Shadows for Dark Mode */
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 2px 8px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ---- Skip to content (keyboard accessibility) ---- */
.skip-to-content {
  position: absolute;
  top: -48px;
  left: 16px;
  background: var(--color-primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s ease;
  text-decoration: none;
}
.skip-to-content:focus {
  top: 0;
  color: #fff;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Source Serif 4', 'Georgia', serif;
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  transition: background-color 0.35s ease, color 0.35s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-primary);
  transition: color 0.35s ease;
}

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

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

img {
  max-width: 100%;
  height: auto;
}

/* ---- Container ---- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Navbar ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

[data-theme="dark"] .navbar {
  background: rgba(15, 17, 21, 0.72);
}

.navbar-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.navbar-logo {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: var(--color-primary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
}

.navbar-name {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
}

.navbar-links {
  list-style: none;
  display: flex;
  gap: 4px;
}

.navbar-links a {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  padding: 6px 14px;
  border-radius: 8px;
  transition: all var(--transition);
  text-decoration: none;
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--color-primary);
  background: var(--color-accent-soft);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--color-text);
  cursor: pointer;
  padding: 8px;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  margin-left: 12px;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ---- Bento Grid ---- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 32px 0;
}

.bento-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition), background-color 0.35s ease, box-shadow 0.35s ease;
  overflow: hidden;
  position: relative;
}

.bento-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

/* Span classes */
.bento-span-2 { grid-column: span 2; }
.bento-span-3 { grid-column: span 3; }
.bento-span-row-2 { grid-row: span 2; }

/* Card header */
.bento-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.bento-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.bento-card-title {
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- Hero / Profile Card ---- */
.hero-card {
  display: flex;
  align-items: center;
  gap: 28px;
}

.hero-avatar {
  width: 100px;
  height: 100px;
  border-radius: 24px;
  object-fit: cover;
  flex-shrink: 0;
}

.hero-info h1 {
  font-size: 36px;
  margin-bottom: 6px;
  color: var(--color-text);
}

.hero-info .hero-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--color-text-secondary);
  font-weight: 400;
  margin-bottom: 14px;
}

/* Contact row */
.hero-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-accent-soft);
  padding: 5px 12px;
  border-radius: 8px;
  text-decoration: none;
  transition: all var(--transition);
}

.hero-contact-link:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ---- Publications Core Card ---- */
.pub-core-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.pub-badge-ei {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pub-core-title {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.5;
  margin-bottom: 10px;
}

.pub-core-authors {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.pub-author-self {
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pub-core-note {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-bottom: 16px;
}

.pub-core-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pub-btn {
  font-size: 14px;
  padding: 9px 20px;
}

/* ---- Tag Chips ---- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform var(--transition);
}

.tag-chip:hover {
  transform: scale(1.05);
}

.tag-chip.ai       { background: var(--tag-ai-bg); color: var(--tag-ai); }
.tag-chip.backend  { background: var(--tag-backend-bg); color: var(--tag-backend); }
.tag-chip.frontend { background: var(--tag-frontend-bg); color: var(--tag-frontend); }
.tag-chip.data     { background: var(--tag-data-bg); color: var(--tag-data); }
.tag-chip.tools    { background: var(--tag-tools-bg); color: var(--tag-tools); }

/* ---- News / Timeline ---- */
.news-list {
  list-style: none;
}

.news-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  align-items: flex-start;
}

.news-item:last-child {
  border-bottom: none;
}

.news-date {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  padding: 3px 10px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.news-text {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.5;
}

/* ---- GitHub Graph Card ---- */
.github-graph {
  text-align: center;
}

.github-graph img {
  width: 100%;
  border-radius: var(--radius-sm);
}

.github-graph-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary-light);
  margin-top: 12px;
}

/* ---- Project Cards ---- */
.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.project-card h3 {
  font-size: 17px;
  margin-bottom: 8px;
  color: var(--color-text);
}

.project-card p {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.project-tag {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--color-text-secondary);
}

.project-links {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

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

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

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

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

/* ---- Stats Card ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: center;
}

.stat-item .stat-number {
  font-family: 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-item .stat-label {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ---- Publication List ---- */
.pub-list {
  list-style: none;
}

.pub-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--color-border);
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-year {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pub-title {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 6px 0;
}

.pub-authors {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.pub-venue {
  font-size: 14px;
  color: var(--color-text-tertiary);
  font-style: italic;
  margin-top: 4px;
}

.pub-links {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* ---- Academic Publication List ---- */
.pub-academic-list {
  list-style: none;
}

.pub-academic-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

.pub-academic-item:last-child {
  border-bottom: none;
}

.pub-academic-title {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.5;
  margin-bottom: 4px;
}

.pub-academic-authors {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.pub-academic-venue {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--color-text-tertiary);
  font-style: italic;
  margin-bottom: 8px;
}

.pub-academic-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pub-academic-links a {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-primary-light);
  text-decoration: none;
  transition: color var(--transition);
}

.pub-academic-links a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.pub-link-sep {
  font-size: 13px;
  color: var(--color-text-tertiary);
  user-select: none;
}

/* ---- Slide Preview Card ---- */
.slide-preview {
  display: flex;
  flex-direction: column;
}

.slide-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-lighter));
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 32px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.slide-thumb-label {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
}

.slide-title {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.slide-meta {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--color-text-tertiary);
}

/* ---- Page Header ---- */
.page-header {
  padding: 40px 0 24px;
}

.page-header h1 {
  font-size: 32px;
  color: var(--color-text);
}

.page-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-card);
  margin-bottom: 40px;
  transition: background-color 0.35s ease, box-shadow 0.35s ease;
}

.page-content h2 {
  font-size: 20px;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-accent-soft);
}

.page-content h2:first-child {
  margin-top: 0;
}

.page-content p {
  margin-bottom: 12px;
}

.page-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.page-content th,
.page-content td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

.page-content th {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--color-primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- Education Card ---- */
.edu-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.edu-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 18px;
  flex-shrink: 0;
}

.edu-details h3 {
  font-size: 15px;
  color: var(--color-text);
  margin-bottom: 2px;
}

.edu-details .edu-school {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.edu-details .edu-year {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

/* ---- CV Timeline ---- */
.cv-timeline {
  position: relative;
  padding-left: 24px;
}

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

.cv-timeline-item {
  position: relative;
  padding-bottom: 28px;
}

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

.cv-timeline-dot {
  position: absolute;
  left: -24px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-border);
  z-index: 1;
}

.cv-timeline-content {
  padding-left: 4px;
}

/* ---- Footer ---- */
.site-footer {
  padding: 32px 0;
  margin-top: 40px;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-content p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--color-text-tertiary);
}

.footer-links {
  display: flex;
  gap: 12px;
}

.footer-links a {
  color: var(--color-text-tertiary);
  font-size: 18px;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--color-primary);
}

/* ---- Section Title ---- */
.section-title {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 20px 0;
  }

  .bento-span-2,
  .bento-span-3 {
    grid-column: span 1;
  }

  .hero-card {
    flex-direction: column;
    text-align: center;
  }

  .social-icons {
    justify-content: center;
  }

  .hero-info h1 {
    font-size: 28px;
  }

  .hero-contacts {
    justify-content: center;
  }

  .navbar-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 12px 24px;
    border-bottom: 1px solid var(--color-border);
  }

  .navbar-links.open {
    display: flex;
  }

  .navbar-toggle {
    display: block;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stat-item .stat-number {
    font-size: 22px;
  }

  .footer-content {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .page-content {
    padding: 24px;
  }

  .container {
    padding: 0 16px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bento-span-2 {
    grid-column: span 1;
  }

  .bento-span-3,
  .bento-span-tablet-full {
    grid-column: span 2;
  }
}

/* ---- Email copy animation ---- */
@keyframes email-pop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.hero-contact-link {
  position: relative;
}

.hero-contact-link.copied {
  background: var(--color-primary) !important;
  color: transparent !important;
  animation: email-pop 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.hero-contact-link.copied > * {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.hero-contact-link.copied::after {
  content: 'Copied!';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  animation: fade-in 0.2s ease 0.05s forwards;
}

@keyframes fade-in {
  to { opacity: 1; }
}

/* ---- Utility ---- */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-secondary); }
