:root {
  color-scheme: light;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --font-code: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --ink: #16211f;
  --muted: #5d6d68;
  --paper: #f6f3ec;
  --panel: #ffffff;
  --line: #dcd6c8;
  --blue: #2364aa;
  --green: #3e7d5b;
  --coral: #d8664f;
  --gold: #c79a36;
  --shadow: 0 24px 70px rgba(31, 42, 38, 0.13);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(35, 100, 170, 0.08), transparent 28rem),
    linear-gradient(315deg, rgba(216, 102, 79, 0.1), transparent 24rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
}

body.nav-open {
  overflow: hidden;
}

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

button,
input,
textarea {
  font: inherit;
}

.skip-link,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link:focus {
  z-index: 99;
  top: 1rem;
  left: 1rem;
  width: auto;
  height: auto;
  clip: auto;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: white;
}

.site-header {
  position: fixed;
  z-index: 20;
  top: 1rem;
  left: 50%;
  display: flex;
  width: min(calc(100% - 2rem), var(--max));
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(22, 33, 31, 0.1);
  border-radius: var(--radius);
  background: rgba(246, 243, 236, 0.82);
  box-shadow: 0 10px 40px rgba(22, 33, 31, 0.08);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
  transition: box-shadow 180ms ease, background 180ms ease;
}

.site-header.scrolled {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 50px rgba(22, 33, 31, 0.12);
}

.brand,
.site-nav,
.social-row,
.hero-actions,
.contact-actions,
.site-footer div {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.15;
}

.brand-mark {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  font-family: var(--font-code);
  font-size: 0.9rem;
  letter-spacing: 0;
}

.site-nav {
  gap: 0.25rem;
}

.site-nav a {
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--font-code);
  font-size: 0.94rem;
  font-weight: 700;
  padding: 0.65rem 0.8rem;
  transition: background 160ms ease, color 160ms ease;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(35, 100, 170, 0.1);
  color: var(--blue);
}

.nav-toggle {
  display: none;
  width: 44px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.nav-toggle span:not(.sr-only) {
  display: block;
  width: 19px;
  height: 2px;
  margin: 4px auto;
  background: var(--ink);
  transition: transform 160ms ease, opacity 160ms ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.section-shell {
  width: min(calc(100% - 2rem), var(--max));
  margin-inline: auto;
  padding: 7rem 0;
}

.hero {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding-top: 8rem;
}

.eyebrow {
  margin: 0 0 0.9rem;
  color: var(--green);
  font-family: var(--font-code);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  max-width: 880px;
  margin-bottom: 1.4rem;
  font-size: clamp(3.3rem, 8vw, 7.5rem);
}

.hero-copy h1 {
  font-size: clamp(1.65rem, 4vw, 3.75rem);
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
}

h3 {
  line-height: 1.15;
}

.hero-lede,
.section-heading p,
.text-stack p,
.contact-panel p {
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-lede {
  max-width: 680px;
  font-size: clamp(1.08rem, 1.7vw, 1.35rem);
}

.hero-actions,
.contact-actions {
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.78rem 1rem;
  font-weight: 800;
}

.button.primary {
  background: var(--ink);
  color: white;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.58);
}

.social-row,
.site-footer div {
  flex-wrap: wrap;
  gap: 1rem;
}

.social-row {
  margin-top: 1.6rem;
}

.social-row a,
.site-footer a,
.project-card a {
  color: var(--blue);
  font-weight: 800;
}

.hero-visual {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(22, 33, 31, 0.11);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 76% 20%, rgba(199, 154, 54, 0.28), transparent 12rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.34));
  box-shadow: var(--shadow);
}

#flight-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
}

.visual-card {
  position: absolute;
  width: min(230px, calc(100% - 2rem));
  border: 1px solid rgba(22, 33, 31, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 40px rgba(22, 33, 31, 0.11);
  padding: 1rem;
}

.visual-card strong {
  display: block;
  font-size: 1.3rem;
}

.visual-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.visual-card.top {
  top: 1rem;
  left: 1rem;
}

.visual-card.bottom {
  right: 1rem;
  bottom: 1rem;
}

.split-section {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: clamp(2rem, 6vw, 6rem);
}

.section-heading.narrow {
  max-width: 820px;
}

.text-stack {
  max-width: 780px;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 2rem;
}

.fact-grid div,
.skill-card,
.timeline-item,
.project-card,
.contact-panel {
  border: 1px solid rgba(22, 33, 31, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 48px rgba(22, 33, 31, 0.08);
}

.fact-grid div {
  padding: 1rem;
}

.fact-grid span,
.project-card span,
.timeline-item span {
  display: block;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.skill-grid,
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.skill-card,
.project-card {
  padding: 1.2rem;
}

.skill-card h3,
.project-card h3 {
  margin-bottom: 0.6rem;
  font-size: 1.25rem;
}

.skill-card p,
.project-card p,
.timeline-item p {
  color: var(--muted);
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(22, 33, 31, 0.11);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--gold));
  transition: width 900ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.2rem, 4vw, 2.4rem);
  margin-top: 2rem;
}

.timeline-column {
  display: grid;
  position: relative;
  gap: 1rem;
  align-content: start;
  padding-left: 2.35rem;
}

.timeline-column::before {
  content: none;
}

.timeline-column:nth-child(2)::before {
  content: none;
}

.timeline-column h3 {
  margin-bottom: 0.35rem;
}

.timeline-item {
  --rail-center: -1.45rem;
  --rail-width: 6px;
  --rail-half-width: 3px;
  --station-size: 20px;
  --station-half-size: 10px;
  position: relative;
  padding: 1.2rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 1.43rem;
  left: calc(var(--rail-center) - var(--station-half-size));
  width: var(--station-size);
  height: var(--station-size);
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(22, 33, 31, 0.13);
}

.timeline-column:nth-child(2) .timeline-item::before {
  background: var(--coral);
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: calc(1.43rem + var(--station-half-size));
  left: calc(var(--rail-center) - var(--rail-half-width));
  width: var(--rail-width);
  height: calc(100% + 1rem);
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(22, 33, 31, 0.1);
}

.timeline-column:nth-child(2) .timeline-item:not(:last-child)::after {
  background: var(--coral);
}

.timeline-item h4 {
  margin: 0.45rem 0 0.55rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.8rem;
}

.filter-bar button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 0.6rem 0.9rem;
}

.filter-bar button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.project-card {
  display: grid;
  min-height: 240px;
  align-content: start;
  transition: opacity 180ms ease, transform 180ms ease;
}

.project-card.is-hidden {
  display: none;
}

.project-card a {
  align-self: end;
  margin-top: 1rem;
}

.contact-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: center;
  padding: clamp(1.4rem, 4vw, 3rem);
  background:
    linear-gradient(135deg, rgba(35, 100, 170, 0.14), transparent 50%),
    rgba(255, 255, 255, 0.78);
}

.contact-panel h2 {
  max-width: 800px;
}

.contact-actions {
  justify-content: flex-end;
}

.site-footer {
  display: flex;
  width: min(calc(100% - 2rem), var(--max));
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 auto;
  padding: 2rem 0 3rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  width: 46px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(22, 33, 31, 0.12);
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-size: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 620ms ease, transform 620ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 920px) {
  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: fixed;
    top: calc(100% + 0.6rem);
    right: 0;
    display: grid;
    width: min(340px, 100%);
    padding: 0.7rem;
    border: 1px solid rgba(22, 33, 31, 0.1);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 160ms ease, transform 160ms ease;
  }

  .site-nav.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .site-nav a {
    width: 100%;
    padding: 0.9rem;
  }

  .hero,
  .split-section,
  .timeline-grid,
  .contact-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    min-height: 420px;
  }

  #flight-canvas {
    min-height: 420px;
  }

  .skill-grid,
  .portfolio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .site-header {
    top: 0.6rem;
    width: min(calc(100% - 1rem), var(--max));
  }

  .brand span:last-child {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .section-shell {
    width: min(calc(100% - 1.2rem), var(--max));
    padding: 4.5rem 0;
  }

  .hero {
    padding-top: 7rem;
  }

  h1 {
    font-size: 3.2rem;
  }

  h2 {
    font-size: 2.25rem;
  }

  .hero-visual,
  #flight-canvas {
    min-height: 360px;
  }

  .visual-card {
    position: static;
    width: calc(100% - 2rem);
    margin: -5.3rem 1rem 1rem;
  }

  .visual-card.top {
    display: none;
  }

  .fact-grid,
  .skill-grid,
  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
