:root {
  --bg: #000000;
  --text: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --surface: rgba(255, 255, 255, 0.03);
  --focus: rgba(59, 130, 246, 0.5);
  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --max: 1120px;
  --gutter: 32px;
  --header-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Starfield (home + contact) */

.page-home,
.page-contact {
  background: var(--bg);
}

.page-home .starfield,
.page-contact .starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.page-home .site-header,
.page-home .site-main,
.page-home .site-footer,
.page-contact .site-header,
.page-contact .site-main,
.page-contact .site-footer {
  position: relative;
  z-index: 1;
}

.page-contact .site-header {
  background: rgba(0, 0, 0, 0.72);
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--text-muted);
}

:focus {
  outline: none;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 16px;
}

.wordmark {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.wordmark:hover {
  color: var(--text-muted);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.nav-toggle-bars {
  display: block;
  width: 18px;
  height: 10px;
  position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 1px;
  background: currentColor;
}

.nav-toggle-bars::before {
  top: 0;
}

.nav-toggle-bars::after {
  bottom: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px 24px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

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

.nav-links a[aria-current="page"] {
  color: var(--text);
}

/* Main */

.site-main {
  flex: 1;
}

/* Intro */

.intro {
  padding: 96px 0 64px;
}

.intro-grid {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 320px);
  gap: 48px;
  align-items: start;
}

.intro-copy {
  min-width: 0;
}

.intro h1 {
  margin: 0 0 24px;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.intro-portrait {
  margin: 0;
}

.intro-portrait img {
  display: block;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 22%;
  border: 1px solid var(--border);
}

.identity {
  max-width: 640px;
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.place {
  margin: 0 0 40px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.now {
  padding: 0 0 120px;
}

.now p {
  max-width: 640px;
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.now p:last-child {
  margin-bottom: 0;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 24px;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
}

.btn-primary:hover {
  color: #000000;
  background: rgba(255, 255, 255, 0.85);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover {
  color: var(--text-muted);
  border-color: var(--border-strong);
}

.btn-sm {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 12px;
}

/* Work */

.work {
  padding: 0 0 120px;
}

.section-label {
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.work-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.work-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 8px 20px;
  align-items: start;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.work-item:hover {
  border-bottom-color: var(--border-strong);
}

.work-icon {
  grid-column: 1;
  grid-row: 1 / span 4;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  opacity: 0.7;
}

.work-item:hover .work-icon {
  opacity: 1;
}

.work-item h2,
.work-item h3 {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.work-item p.work-desc {
  grid-column: 2;
  grid-row: 4;
  margin: 8px 0 0;
  color: var(--text-secondary);
}

.work-date {
  grid-column: 2;
  grid-row: 2;
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.work-status {
  grid-column: 2;
  grid-row: 3;
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.work-status-complete {
  color: #4ade80;
}

.work-status-progress {
  color: #eab308;
}

.work-actions {
  grid-column: 3;
  grid-row: 1 / span 4;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  align-self: start;
}

.work-item .repo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text);
  background: transparent;
}

.work-item .repo:hover {
  color: var(--text-muted);
  border-color: var(--border-strong);
}

/* About */

.about {
  padding: 96px 0 120px;
}

.about h1 {
  margin: 0 0 48px;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.about-body {
  max-width: 640px;
}

.about-lead {
  margin: 0 0 48px;
  font-size: 20px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.about-body .section-label {
  margin-top: 48px;
}

.about-body .section-label:first-of-type {
  margin-top: 0;
}

.about-body p {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.about-body p:last-child {
  margin-bottom: 0;
}

/* Resume */

.resume {
  padding: 96px 0 120px;
}

.resume h1 {
  margin: 0 0 24px;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.resume-lead {
  max-width: 720px;
  margin: 0 0 64px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.timeline {
  position: relative;
  max-width: 760px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  left: 11px;
  width: 1px;
  height: 100%;
  background: var(--border);
  transform-origin: top center;
  transform: scaleY(0);
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline.is-visible::before {
  transform: scaleY(1);
}

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

.timeline-item,
.timeline-year-row {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 0 28px;
  padding-bottom: 48px;
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 0.04s);
}

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

.timeline-item.is-visible,
.timeline-year-row.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-year-row {
  padding-bottom: 16px;
}

.timeline-year-label {
  margin: 0;
  padding-top: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
}

.timeline-marker-now::before {
  width: 13px;
  height: 13px;
  top: 5px;
  left: 5px;
}

.timeline-marker {
  position: relative;
  width: 24px;
  height: 24px;
}

.timeline-marker::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 11px;
  height: 11px;
  background: var(--text);
  transform: scale(0);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 0.04s + 0.1s);
}

.timeline-item.is-visible .timeline-marker::before,
.timeline-year-row.is-visible .timeline-marker::before {
  transform: scale(1);
}

.timeline-card {
  min-width: 0;
  padding-top: 2px;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timeline-kind {
  padding: 4px 8px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.timeline-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.timeline-org {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.timeline-note {
  margin: 0;
  color: var(--text-secondary);
}

.timeline-details {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
}

.timeline-details li {
  margin-bottom: 8px;
}

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

.skills-grid {
  display: grid;
  gap: 20px;
  margin: 0;
}

.skills-grid div {
  margin: 0;
}

.skills-grid dt {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.skills-grid dd {
  margin: 0;
  color: var(--text-secondary);
}

.resume-download {
  margin-top: 80px;
  padding-top: 48px;
  border-top: 1px solid var(--border);
  text-align: left;
}

.resume-download-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.resume-download-btn[disabled]:hover {
  color: #000000;
  background: #ffffff;
}

.resume-download-note {
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .timeline::before {
    transform: scaleY(1);
    transition: none;
  }

  .timeline-item,
  .timeline-year-row {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .timeline-marker::before {
    transform: scale(1);
    transition: none;
  }
}

/* Projects */

.projects {
  padding: 96px 0 120px;
}

.projects h1 {
  margin: 0 0 48px;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.projects .work-list {
  border-top: 1px solid var(--border);
}

/* Contact */

.contact {
  padding: 96px 0 120px;
}

.contact h1 {
  margin: 0 0 16px;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.contact-note {
  max-width: 640px;
  margin: 0 0 48px;
  color: var(--text-secondary);
}

.directory {
  margin: 0;
  border-top: 1px solid var(--border);
}

.directory-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: center;
  margin: 0;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.directory-row dt {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.directory-row dd {
  margin: 0;
}

.directory-row a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 72px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}

.footer-links a,
.footer-year,
.footer-clock {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.footer-clock {
  margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.footer-links a[href^="mailto"] {
  text-transform: none;
  letter-spacing: 0;
}

.footer-links a:hover {
  color: var(--text-muted);
  opacity: 0.8;
}

/* Mobile */

@media (max-width: 720px) {
  :root {
    --gutter: 20px;
  }

  .intro,
  .contact,
  .projects,
  .about,
  .resume {
    padding-top: 64px;
  }

  .intro {
    padding-bottom: 48px;
  }

  .intro-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .intro-portrait img {
    max-width: 240px;
  }

  .now {
    padding-bottom: 64px;
  }

  .identity {
    font-size: 18px;
  }

  html.js .nav-toggle {
    display: inline-flex;
  }

  html.js .nav-links {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  html.js .nav-links.is-open {
    display: flex;
  }

  html.js .nav-links a {
    min-height: 44px;
  }

  .work-item {
    grid-template-columns: 32px 1fr;
    gap: 8px 16px;
    padding: 20px 0;
  }

  .work-actions {
    grid-column: 2;
    grid-row: 5;
    justify-content: flex-start;
    margin-top: 4px;
  }

  .work-item .repo {
    margin-top: 0;
  }

  .timeline-item,
  .timeline-year-row {
    grid-template-columns: 20px 1fr;
    gap: 0 20px;
    padding-bottom: 40px;
  }

  .timeline-year-row {
    padding-bottom: 16px;
  }

  .timeline::before {
    left: 9px;
  }

  .timeline-marker::before {
    left: 4px;
  }

  .timeline-card h2 {
    font-size: 20px;
  }

  .directory-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 16px 0;
    align-items: start;
  }

  .directory-row a {
    min-height: 44px;
  }
}
