/* ── Theme tokens ─────────────────────────────────── */
:root[data-theme="dark"] {
  --bg:             #141414;
  --bg-subtle:      #1c1c1c;
  --bg-card:        #1e1e1e;
  --border:         #2e2e2e;
  --border-hover:   #444;
  --text-primary:   #e7dece;
  --text-secondary: #c5bcad;
  --text-muted:     #978f84;
  --accent:         #d4a853;
  --accent-hover:   #e0b965;
  --accent-glow:    rgba(212, 168, 83, 0.12);
}

:root[data-theme="light"] {
  --bg:             #faf7f2;
  --bg-subtle:      #f0ebe0;
  --bg-card:        #fff;
  --border:         #d8d0c4;
  --border-hover:   #c0b8aa;
  --text-primary:   #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted:     #6e6e6e;
  --accent:         #c49540;
  --accent-hover:   #d4a853;
  --accent-glow:    rgba(196, 149, 64, 0.08);
}

/* ─── Base ─── */
* { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
}

h1, h2, h3, .font-display {
  font-family: 'Inter', sans-serif;
}

/* ─── Dot grid texture ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
}

@media (max-width: 768px) {
  body::before {
    background-size: 36px 36px;
    opacity: 0.2;
  }
}

/* ─── All sections above grid ─── */
nav, section, footer { position: relative; z-index: 1; }

/* ─── Glassmorphism navbar ─── */
.navbar-glass {
  background-color: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

@supports not (backdrop-filter: blur(12px)) {
  .navbar-glass {
    background-color: color-mix(in srgb, var(--bg) 97%, transparent);
  }
}

/* ─── Hero entrance ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-role    { animation: fadeUp 0.6s ease both; animation-delay: 0.05s; }
.hero-tagline { animation: fadeUp 0.6s ease both; animation-delay: 0.32s; }
.hero-cta     { animation: fadeUp 0.6s ease both; animation-delay: 0.46s; }

/* ─── Scroll reveal ─── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Hero name with gold shimmer ─── */
.hero-name {
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text-primary);
}

[data-theme="dark"] .hero-name,
[data-theme="light"] .hero-name {
  color: var(--text-primary);
  -webkit-text-fill-color: currentColor;
  animation: fadeUp 0.6s ease both;
}

/* ─── Role separator line ─── */
.role-line::before,
.role-line::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  max-width: 60px;
}

/* ─── Timeline ─── */
.timeline-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent), var(--border) 30%, var(--border));
}

/* ─── Animated underline for inline links ─── */
#about a,
#experience a,
#publication a:not(.block) {
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease;
}
#about a:hover,
#experience a:hover,
#publication a:not(.block):hover {
  background-size: 100% 1px;
}

/* ─── Experience separator ─── */
#experience .reveal.mb-14 + .reveal {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ─── Project row hover with lift ─── */
.project-row {
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
  border-bottom: 1px solid var(--border);
  border-radius: 6px;
  padding-left: 12px;
  padding-right: 12px;
  margin-left: -12px;
  margin-right: -12px;
}
.project-row:hover {
  background-color: var(--accent-glow);
  border-color: transparent;
  transform: translateX(4px);
}
.project-row:hover .project-name { color: var(--accent); }
.project-row:hover .project-arrow { color: var(--accent); transform: translate(2px, -2px); }
.project-arrow { transition: all 0.2s ease; }

/* ─── Sub-project cards ─── */
.border-l-2 {
  border-radius: 0 6px 6px 0;
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Reading rhythm */
#about p,
#experience p {
  max-width: 72ch;
  line-height: 1.75;
}

#experience p.text-sm {
  font-size: 0.98rem;
}

#experience p.text-xs {
  font-size: 0.84rem;
}

#experience .border-l-2 {
  border-left-width: 1.5px;
  padding: 10px 14px 10px 16px;
}

#experience .border-l-2 p:first-child {
  margin-bottom: 0.35rem;
}

#experience p .text-\[var\(--text-primary\)\] {
  color: var(--accent);
  font-weight: 600;
}

/* ─── Navbar shrink on scroll ─── */
.navbar-glass {
  transition: border-color 0.3s ease;
}
.navbar-inner {
  transition: padding 0.3s ease;
}
.navbar-glass.scrolled .navbar-inner {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

/* ─── Skill badge ─── */
.skill-badge {
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.skill-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Skill badge primary (core skills) ─── */
.skill-badge-primary {
  background-color: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text-primary);
}
.skill-badge-primary:hover {
  background-color: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Mobile menu ─── */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.mobile-menu.open {
  max-height: 400px;
}

/* ─── Mobile touch targets ─── */
.mobile-nav-link {
  min-height: 44px;
  display: flex;
  align-items: center;
}

#hamburger {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Scroll margin for fixed navbar ─── */
section[id] {
  scroll-margin-top: 80px;
}

/* ─── Section dividers ─── */
section + section {
  border-top: 1px solid var(--border);
}

/* ─── Pulse animation for "Open to work" ─── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ─── Focus ring for accessibility ─── */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── Scroll hint arrow ─── */
@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.4; }
  50% { transform: translateX(-50%) translateY(6px); opacity: 0.7; }
}
.scroll-hint {
  animation: scrollBounce 2.5s ease-in-out infinite;
  animation-delay: 1s;
  transition: opacity 0.3s ease;
}

/* ─── Footer credit ─── */
#contact .text-xs:last-child {
  opacity: 0.5;
  transition: opacity 0.2s ease;
}
#contact .text-xs:last-child:hover {
  opacity: 0.8;
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
  .hero-name {
    background: none !important;
    -webkit-text-fill-color: var(--text-primary) !important;
  }
}
