@font-face {
  font-family: "Martian Mono";
  src: url("assets/fonts/martian-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("assets/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --brand-teal: #2cbcb2;
  --brand-orange: #ef6125;

  --bg: #170e0f;
  --surface: #211516;
  --line: #3d2c2c;
  --text: #f6eee8;
  --muted: #bcaca5;
  --teal: #2cbcb2;
  --orange: #f77a45;
  --add-bg: rgb(44 188 178 / 0.13);
  --del-bg: rgb(239 97 37 / 0.11);

  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbf7f2;
    --surface: #fff;
    --line: #e5dad0;
    --text: #40181a;
    --muted: #6d5853;
    --teal: #0a7770;
    --orange: #bb410c;
    --add-bg: rgb(44 188 178 / 0.15);
    --del-bg: rgb(239 97 37 / 0.1);
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg { display: block; }

a { color: inherit; }
a:focus-visible, .button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  padding: 8px 14px;
  background: var(--text);
  color: var(--bg);
}
.skip:focus { top: 12px; }

.teal { fill: var(--brand-teal); }
.orange { fill: var(--brand-orange); }
.orange-text { color: var(--orange); }

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 24px;
}

.logo { display: block; flex: none; }
.logo svg { height: 32px; width: auto; }
.logo .ink {
  fill: none;
  stroke: currentColor;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-header nav { display: flex; gap: clamp(14px, 3vw, 32px); }
.site-header nav a {
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--muted);
  padding-block: 6px;
}
.site-header nav a:hover { color: var(--text); }

/* Hero: the diff. The default styles are the finished state, and the animations only run
   in from an earlier state, so reduced motion simply shows the result. */

.hero {
  --gutter: clamp(1.5rem, 6vw, 4.5rem);
  padding-block: clamp(48px, 9vw, 112px) clamp(64px, 10vw, 128px);
}

.diff-line {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  font-family: var(--mono);
  font-stretch: 75%;
}

.diff-line .sign { font-weight: 500; }

.del {
  --delay: calc(0.35s + var(--i, 0) * 0.45s);
  padding: 6px 12px;
  font-size: clamp(0.8125rem, 1.7vw, 1.125rem);
  background: var(--del-bg);
  color: var(--orange);
  animation: mark 0.35s var(--delay) backwards;
}

.del .text {
  text-decoration: line-through 1.5px;
  animation: strike 0.4s var(--delay) ease-out backwards;
}

.del .sign { animation: appear 0.2s var(--delay) backwards; }

.add {
  align-items: baseline;
  padding: 0.14em 12px;
  font-size: clamp(1.5rem, 7.2vw, 5.5rem);
  background: var(--add-bg);
  color: var(--teal);
  animation: appear 0.2s 1.7s backwards;
}

.add h1 {
  font: inherit;
  font-stretch: 75%;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--text);
  white-space: nowrap;
}

.typed {
  display: inline-block;
  animation: type 0.9s 1.8s steps(16) backwards;
}

.typed::after {
  content: "";
  display: inline-block;
  width: 0.09em;
  height: 0.95em;
  margin-left: 0.08em;
  vertical-align: -0.1em;
  background: var(--brand-teal);
  animation: blink 1.1s 2.7s step-end 4;
}

@keyframes mark {
  from { background: transparent; color: var(--muted); }
}
@keyframes strike {
  from { text-decoration-color: transparent; }
}
@keyframes appear {
  from { opacity: 0; }
}
@keyframes type {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes blink {
  50% { opacity: 0; }
}

.lede {
  max-width: 34em;
  margin-block: 32px 28px;
  font-size: clamp(1.1875rem, 2.2vw, 1.5rem);
  line-height: 1.45;
  text-wrap: balance;
}

.button {
  display: inline-block;
  padding: 13px 22px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  transition: transform 0.15s ease;
}
.button:hover { transform: translateY(-2px); }

/* Sections */

section[id] { padding-block: clamp(48px, 7vw, 88px); border-top: 1px solid var(--line); }

.hunk {
  font: 500 0.8125rem/1.5 var(--mono);
  font-stretch: 75%;
  color: var(--teal);
}

h2 {
  margin-block: 6px 32px;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Projects */

.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.project {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.panel {
  width: 100%;
  height: auto;
  aspect-ratio: 1024 / 500;
  border-bottom: 1px solid var(--line);
}

div.panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 16px clamp(16px, 5%, 40px);
  background: #170e0f;
  color: #f6eee8;
  font: 400 clamp(0.8125rem, 1.45vw, 1.0625rem)/1.5 var(--mono);
  font-stretch: 75%;
}

.minus { color: #f77a45; }
.minus, .plus { padding: 5px 10px; border-radius: 3px; }
.minus { background: rgb(239 97 37 / 0.13); }
.plus { color: #4fd8ce; background: rgb(44 188 178 / 0.14); }
.comment { padding: 8px 8px 0; color: #bcaca5; }

.project-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: clamp(18px, 2.4vw, 26px);
}

.project-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.project-title h3 { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap; }

.shape { flex: none; width: 20px; height: 20px; }
.shape-text { width: auto; height: auto; font: 700 1rem/1 var(--mono); font-stretch: 75%; }

.status {
  margin-left: auto;
  flex: none;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font: 500 0.6875rem/1.7 var(--mono);
  font-stretch: 75%;
}
.status-live { color: var(--teal); border-color: currentColor; }

.project-body > p:not(.links) { color: var(--muted); }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: auto;
  padding-top: 6px;
}
.links a { font-weight: 600; text-underline-offset: 4px; text-decoration: underline; text-decoration-color: var(--brand-teal); }
.links a[href]:hover { color: var(--teal); }

/* Principles */

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 48px);
  counter-reset: principle;
}

.principles li {
  padding-top: 16px;
  border-top: 2px solid var(--brand-teal);
  counter-increment: principle;
}
.principles li::before {
  content: counter(principle, decimal-leading-zero);
  color: var(--muted);
  font: 500 0.8125rem/1.5 var(--mono);
  font-stretch: 75%;
}
.principles h3 { margin-block: 8px; font-size: 1.25rem; font-weight: 600; line-height: 1.25; }
.principles p { color: var(--muted); }

/* Footer */

.site-footer { padding-block: clamp(40px, 6vw, 72px) 28px; border-top: 1px solid var(--line); background: var(--surface); }

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
}

.site-footer h2 { margin-block: 0 8px; font-size: 1.0625rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }

.email {
  font-size: clamp(1.625rem, 5vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.email:hover { color: var(--teal); }

.site-footer nav { display: grid; gap: 6px; font-size: 0.9375rem; }
.site-footer nav a { color: var(--muted); text-decoration: none; }
.site-footer nav a:hover { color: var(--text); }

.build-note, .copyright { color: var(--muted); font: 400 0.75rem/1.5 var(--mono); font-stretch: 75%; }
.copyright { text-align: right; }

/* 404 */

.not-found main { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: stretch; }
.not-found .button { align-self: flex-start; }

/* Small screens */

@media (max-width: 760px) {
  .projects, .principles { grid-template-columns: minmax(0, 1fr); }
  div.panel { font-size: clamp(0.6875rem, 3.2vw, 0.9375rem); }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .copyright { text-align: left; }
}

@media (max-width: 380px) {
  .site-header nav a[href="#principles"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
