:root {
  --bg: #ffffff;
  --bg-alt: #f4f6f8;
  --text: #1a2027;
  --text-muted: #5b6572;
  --border: #e2e6ea;
  --accent: #0891b2;
  --accent-strong: #0e7490;
  --accent-contrast: #ffffff;
  --badge-bg: #e0f2f6;
  --badge-text: #0e7490;
  --shadow: 0 1px 3px rgba(20, 30, 40, 0.08), 0 1px 2px rgba(20, 30, 40, 0.06);
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-alt: #131c30;
    --text: #e7edf3;
    --text-muted: #9aa7b5;
    --border: #223047;
    --accent: #38bdf8;
    --accent-strong: #7dd3fc;
    --accent-contrast: #06131f;
    --badge-bg: #0e2a3a;
    --badge-text: #7dd3fc;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="light"] {
  --bg: #ffffff; --bg-alt: #f4f6f8; --text: #1a2027; --text-muted: #5b6572;
  --border: #e2e6ea; --accent: #0891b2; --accent-strong: #0e7490; --accent-contrast: #ffffff;
  --badge-bg: #e0f2f6; --badge-text: #0e7490;
  --shadow: 0 1px 3px rgba(20, 30, 40, 0.08), 0 1px 2px rgba(20, 30, 40, 0.06);
}
:root[data-theme="dark"] {
  --bg: #0f172a; --bg-alt: #131c30; --text: #e7edf3; --text-muted: #9aa7b5;
  --border: #223047; --accent: #38bdf8; --accent-strong: #7dd3fc; --accent-contrast: #06131f;
  --badge-bg: #0e2a3a; --badge-text: #7dd3fc;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  border-radius: 6px;
  z-index: 100;
}
.skip-link:focus { left: 16px; top: 16px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.logo .dot { color: var(--accent); }

.primary-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.primary-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease;
}
.primary-nav a:hover, .primary-nav a:focus-visible { color: var(--accent); }
.nav-cta {
  color: var(--accent) !important;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover, .theme-toggle:focus-visible { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
.theme-toggle.is-dark .icon-sun { display: none; }
.theme-toggle.is-dark .icon-moon { display: block; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
}

/* Hero */
.hero {
  padding: 72px 0 56px;
}
.hero-inner {
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
}
.hero-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  border: 3px solid var(--border);
  flex-shrink: 0;
}
.hero-text { flex: 1; min-width: 280px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 6px;
}
.hero-text h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 0 0 6px;
  line-height: 1.1;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 0 0 18px;
}
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--badge-bg);
  color: var(--badge-text);
}
.badge-muted {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: status-pulse 2.2s ease-out infinite;
}
@keyframes status-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .status-dot { animation: none; }
}
.hero-lede {
  max-width: 560px;
  color: var(--text-muted);
  margin: 0 0 26px;
}
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-large { padding: 14px 28px; font-size: 1rem; }
.icon { width: 18px; height: 18px; }

/* Sections */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section-title {
  font-size: 1.6rem;
  margin: 0 0 8px;
}
.section-subtitle {
  color: var(--text-muted);
  margin: 0 0 24px;
  font-weight: 600;
}

.journey-copy {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 720px;
  margin-top: 20px;
}
.journey-copy .about-copy:nth-child(1) { transition-delay: 0s; }
.journey-copy .about-copy:nth-child(2) { transition-delay: 0.1s; }
.journey-copy .about-copy:nth-child(3) { transition-delay: 0.2s; }

.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 40px;
  align-items: start;
  margin-top: 20px;
}
.about-copy { color: var(--text-muted); margin: 0; max-width: 640px; }
.fact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.fact-list li {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  font-size: 0.95rem;
}
.fact-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 2px;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 28px;
  margin-top: 20px;
}
.skill-group h3 {
  font-size: 1rem;
  margin: 0 0 12px;
  color: var(--text);
}
.chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-list li {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Experience */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 24px;
}
.job {
  padding-left: 20px;
  border-left: 2px solid var(--border);
}
.job-head h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}
.job-role {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 1rem;
}
.job-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 10px;
}
.job-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  margin: 0 0 10px;
}
.job ul { margin: 0; padding-left: 20px; color: var(--text-muted); }
.job li { margin-bottom: 6px; }

.prior-heading {
  margin-top: 44px;
  font-size: 1.05rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.prior-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prior-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.prior-company { font-weight: 600; }
.prior-note {
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.prior-note a { color: var(--accent); }

/* Homelab */
.homelab-list {
  margin: 20px 0 0;
  padding-left: 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.homelab-note {
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px dashed var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.hindsight-figure {
  margin: 28px auto 0;
  max-width: 620px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hindsight-img { display: block; width: 100%; height: auto; }
.hindsight-figure figcaption {
  padding: 16px 20px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.hindsight-figure figcaption p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 640px;
}
.hindsight-figure figcaption .btn { margin: 0; }

/* Resume callout */
.resume-callout-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.resume-callout-inner .section-title { margin-bottom: 12px; }
.resume-callout-inner > div { min-width: 280px; }
.resume-callout-inner > div:first-child { flex: 1; }
.resume-callout-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Contact */
.contact-inner { text-align: center; }
.contact-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.site-footer p { margin: 0 0 6px; }
.footer-note { font-size: 0.78rem; opacity: 0.75; }

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}
.reveal.reveal-visible {
  opacity: 1;
  transform: none;
}
.reveal.reveal-left { transform: translate(-40px, 0); }
.reveal.reveal-right { transform: translate(40px, 0); }
.reveal.reveal-left.reveal-visible,
.reveal.reveal-right.reveal-visible { transform: none; }

.skills-grid .skill-group:nth-child(1) { transition-delay: 0s; }
.skills-grid .skill-group:nth-child(2) { transition-delay: 0.1s; }
.skills-grid .skill-group:nth-child(3) { transition-delay: 0.2s; }
.skills-grid .skill-group:nth-child(4) { transition-delay: 0.3s; }
.skills-grid .skill-group:nth-child(5) { transition-delay: 0.4s; }
.skills-grid .skill-group:nth-child(6) { transition-delay: 0.5s; }
.skills-grid .skill-group:nth-child(7) { transition-delay: 0.6s; }

.timeline .job:nth-child(1) { transition-delay: 0s; }
.timeline .job:nth-child(2) { transition-delay: 0.12s; }
.timeline .job:nth-child(3) { transition-delay: 0.24s; }
.timeline .job:nth-child(4) { transition-delay: 0.36s; }

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Responsive */
@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: flex; }
  .primary-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px 24px;
    gap: 16px;
    display: none;
  }
  .primary-nav.open { display: flex; }
  .hero-inner { text-align: center; justify-content: center; }
  .hero-lede { max-width: none; }
  .cta-row, .badge-row { justify-content: center; }
}

/* Print */
@media print {
  * {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }
  body { font-size: 12pt; }
  .site-header, .nav-toggle, .skip-link, .status-dot, .back-to-top {
    display: none !important;
  }
  a { color: #000 !important; text-decoration: underline; }
  a[href^="http"]::after, a[href^="mailto"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    font-weight: normal;
  }
  .hero-photo { width: 120px; height: 120px; }
  .section, .hero { padding: 16px 0; }
  .job, .skill-group, article { page-break-inside: avoid; }
  .badge, .chip-list li { border: 1px solid #999 !important; }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
