/* ---------- Theme tokens ---------- */
:root[data-theme="dark"] {
  --bg: #0b0f14;
  --bg-elev: #11161d;
  --bg-elev-2: #161c25;
  --text: #e6edf3;
  --text-dim: #8b98a5;
  --border: #232b35;
  --accent: #5ee6a8;
  --accent-dim: #2f5943;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  --bg: #f9f9f9;
  --bg-elev: #ffffff;
  --bg-elev-2: #f1f3f5;
  --text: #1b1f24;
  --text-dim: #5b6670;
  --border: #e2e6ea;
  --accent: #0f8a5f;
  --accent-dim: #d3f1e3;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --max-width: 960px;
  --radius: 10px;
}

/* ---------- Reset ---------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

h1, h2, h3 {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.accent {
  color: var(--accent);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  white-space: nowrap;
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
  flex: 1;
  overflow-x: auto;
}

.site-header nav a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--text);
  border-color: var(--accent);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

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

:root[data-theme="dark"] #theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] #theme-toggle .icon-moon {
  display: inline-flex;
}

/* ---------- Layout ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
}

section h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin: 0 0 1.15rem;
}

/* ---------- Hero ---------- */
.hero {
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}

.hero .eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin: 0 0 0.75rem;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 40ch;
  margin: 0;
}

/* ---------- Experience ---------- */
.job-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.job-header h3 {
  font-size: 1.05rem;
  margin: 0;
}

.job-org {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.status-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.status-dot::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.45;
  animation: status-pulse 2s ease-out infinite;
}

@keyframes status-pulse {
  0% {
    transform: scale(0.5);
    opacity: 0.45;
  }
  70%, 100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

#experience ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-dim);
}

#experience li + li {
  margin-top: 0.35rem;
}

/* ---------- Skills ---------- */
.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.skills-group + .skills-group {
  margin-top: 1.25rem;
}

.skills-group h3 {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.6rem;
}

/* ---------- Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

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

.project-card h3 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
}

.project-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* ---------- Timeline (shared: experience + notes) ---------- */
.section-sub {
  color: var(--text-dim);
  margin: -1rem 0 1.75rem;
  font-size: 0.92rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1px;
  background: var(--border);
}

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

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

.timeline-item::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 0.85rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
}

.timeline-card {
  display: block;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.timeline-card:hover,
.timeline-card:focus-within {
  border-color: var(--accent);
  transform: translateX(3px);
}

/* notes-specific: card is a link */
.note-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
}

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

.note-title {
  font-size: 0.95rem;
}

/* fade progressively older entries, no per-item classes needed */
.notes-list .timeline-item:nth-of-type(n+3) .note-title { color: var(--text-dim); }
.notes-list .timeline-item:nth-of-type(n+3) .note-card { padding-top: 0.65rem; padding-bottom: 0.65rem; }
.notes-list .timeline-item:nth-of-type(n+4) .note-card { font-size: 0.94em; }
.notes-list .timeline-item:nth-of-type(n+5) .note-card { font-size: 0.88em; }
.notes-list .timeline-item:nth-of-type(n+6) .note-card { font-size: 0.82em; opacity: 0.85; }
.notes-list .timeline-item:nth-of-type(n+7) .note-card { font-size: 0.78em; opacity: 0.7; }

/* ---------- Footer ---------- */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2.25rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .site-header nav {
    order: 3;
    flex: 1 0 100%;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  section {
    padding: 2rem 0;
  }

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