:root {
  --canvas: #f7f6f3;
  --surface: #ffffff;
  --ink: #2f2d2a;
  --muted: #787774;
  --red: #94211d;
  --pale-red: #fdebec;
  --line: #e7e5e1;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "SF Pro Display", "Helvetica Neue", Helvetica, sans-serif;
  --mono: "SFMono-Regular", "SF Mono", Consolas, monospace;
  --page: 1120px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--pale-red);
  color: var(--red);
}

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

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

.skip-link {
  position: fixed;
  z-index: 10;
  top: 1rem;
  left: 1rem;
  padding: 0.65rem 0.9rem;
  border-radius: 4px;
  background: #111111;
  color: #ffffff;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
main,
.site-footer {
  width: min(100%, var(--page));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.brand img {
  width: 32px;
  height: 32px;
}

.wordmark {
  display: grid;
  font-family: var(--serif);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.21em;
  line-height: 0.95;
  text-transform: uppercase;
}

.wordmark span:last-child {
  color: var(--red);
}

.header-link,
.site-footer {
  color: var(--muted);
  font-size: 0.78rem;
}

.header-link,
.site-footer a,
.text-link,
.project-link {
  text-underline-offset: 0.25em;
}

.header-link:hover,
.site-footer a:hover,
.text-link:hover,
.project-link:hover {
  text-decoration: underline;
}

main {
  padding-top: clamp(4.5rem, 9vw, 7rem);
  padding-bottom: clamp(6rem, 12vw, 9rem);
}

.hero {
  display: grid;
  min-height: 500px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: clamp(3rem, 6vw, 5.5rem);
  align-items: center;
}

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

.eyebrow {
  width: fit-content;
  margin: 0 0 1.2rem;
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.035em;
}

h1 {
  width: fit-content;
  max-width: 100%;
  font-size: clamp(2.55rem, 5.2vw, 4.8rem);
  line-height: 0.98;
}

h1 span {
  display: block;
  white-space: nowrap;
}

.intro {
  max-width: 560px;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0.7rem 1rem;
  border-radius: 5px;
  background: #111111;
  color: #ffffff;
  font-size: 0.82rem;
  transition: background 180ms ease, transform 120ms ease;
}

.button:hover {
  background: #333333;
}

.button:active {
  transform: scale(0.98);
}

.text-link {
  font-size: 0.82rem;
}

.text-link span,
.project-link span {
  color: var(--red);
}

.flight-playground {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 1;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: grab;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.flight-playground.is-dragging {
  cursor: grabbing;
}

.flight-playground::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  content: "";
  pointer-events: none;
}

.flight-playground canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.flight-playground canvas:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: -5px;
}

.flight-meta {
  position: absolute;
  z-index: 1;
  right: 1rem;
  bottom: 0.9rem;
  left: 1rem;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  line-height: 1;
  pointer-events: none;
  text-transform: uppercase;
}

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

.work {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: end;
  margin-top: clamp(7rem, 14vw, 11rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.work:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.work .eyebrow {
  margin-bottom: 1.2rem;
  color: #346538;
}

.work h2 {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.05;
}

.work p:not(.eyebrow) {
  margin: 0.85rem 0 0;
  color: var(--muted);
}

.project-link {
  font-size: 0.82rem;
  white-space: nowrap;
}

.site-footer {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}

.site-footer div {
  display: flex;
  gap: 1.5rem;
}

.reveal {
  opacity: 1;
  transform: none;
}

.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Legal and error pages */
.legal-main {
  width: min(100%, 760px);
  min-height: calc(100svh - 180px);
}

.legal-main h1 {
  margin-bottom: 2.8rem;
  font-size: clamp(3rem, 7vw, 5.4rem);
}

.legal-content h2 {
  margin: 2.8rem 0 0.6rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 400;
}

.legal-content p {
  max-width: 650px;
  margin: 0 0 1rem;
  color: var(--muted);
}

.legal-content a {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (max-width: 640px) {
  .site-header {
    min-height: 80px;
  }

  main {
    padding-top: 5rem;
    padding-bottom: 5rem;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 4rem;
  }

  .flight-playground {
    width: min(72vw, 270px);
    justify-self: center;
  }

  .work {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .site-footer {
    min-height: 110px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
  }
}

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