:root {
  --paper: #f4f3ee;
  --ink: #111111;
  --muted: #55554f;
  --rule: #d4d2c8;
  --blue: #1f3bff;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: clamp(16px, 4vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 0.2em; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: var(--gutter); top: -80px; z-index: 20;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; text-decoration: none;
}
.skip:focus { top: 12px; }
.nowrap { white-space: nowrap; }

.label {
  font: 500 0.75rem/1.45 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 2rem;
  padding: 14px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 1.25rem; letter-spacing: -0.03em; text-decoration: none;
}
.brand-tld { color: var(--blue); }
.brand-mark { display: inline-block; width: 0.8em; height: 0.8em; background: var(--blue); }
.site-nav ul { display: flex; gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
.site-nav a { text-decoration: none; font-weight: 500; }
.site-nav a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.jump {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: 500 0.8125rem/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink); background: transparent;
  border: 1px solid var(--ink); padding: 0.5rem 0.65rem; cursor: pointer;
}
.jump:hover { background: var(--ink); color: var(--paper); }
kbd {
  font: 600 0.75rem/1 var(--mono);
  border: 1px solid currentColor; padding: 0.15rem 0.35rem; border-radius: 3px;
}

/* Hero */
.hero { padding: clamp(56px, 11vw, 150px) var(--gutter) clamp(40px, 6vw, 80px); }
.hero h1 {
  font-size: clamp(3.1rem, 12.5vw, 11.5rem);
  line-height: 0.9;
  letter-spacing: -0.055em;
  margin: 0.35em 0 0.45em;
  max-width: 13ch;
}
.hero h1::after {
  content: "";
  display: inline-block;
  width: 0.09em; height: 0.72em;
  margin-left: 0.06em;
  background: var(--blue);
  vertical-align: -0.02em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 2rem;
  border-top: 1px solid var(--ink); padding-top: 1.5rem;
}
.lede { font-size: clamp(1.2rem, 2.1vw, 1.6rem); line-height: 1.35; max-width: 32ch; letter-spacing: -0.01em; }
.hero-meta { margin: 0; display: grid; gap: 0.9rem; }
.hero-meta dd { margin: 0.15rem 0 0; font-weight: 500; }

/* Rows */
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr); gap: 2rem 3rem;
  padding: clamp(56px, 8vw, 120px) var(--gutter);
  border-top: 1px solid var(--ink);
}
.row-head { align-self: start; position: sticky; top: 96px; }
.num { display: block; font: 600 0.875rem/1 var(--mono); color: var(--blue); margin-bottom: 1rem; }
.row h2 { font-size: clamp(2.2rem, 5.2vw, 4rem); line-height: 0.95; letter-spacing: -0.045em; }
.row-note { margin-top: 1rem; color: var(--muted); max-width: 28ch; }

.work { margin: 0; }
.work div {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr); gap: 0.5rem 2rem;
  padding: 1.4rem 0; border-top: 1px solid var(--rule);
}
.work div:first-child { border-top: 0; padding-top: 0; }
.work dt { font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }
.work dd { margin: 0; color: var(--ink); }

.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  border-top: 1px solid var(--ink); border-left: 1px solid var(--ink);
}
.steps li {
  background: var(--paper); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem;
  border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.step-num {
  display: grid; place-items: center; width: 2rem; height: 2rem;
  background: var(--blue); color: #fff; font: 700 0.875rem/1 var(--mono);
}
.steps h3 { font-size: 1.35rem; letter-spacing: -0.02em; }
.steps p:not(.label) { flex: 1; }

/* Portfolio cards: borders drawn per cell so a short last row stays paper, not ink */
.portfolio {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(256px, 1fr));
  border-top: 1px solid var(--ink); border-left: 1px solid var(--ink);
}
.portfolio li {
  display: flex; min-width: 0;
  border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.card {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--paper); color: inherit; text-decoration: none;
}
.card img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10;
  object-fit: cover; object-position: top;
  background: #fff; border-bottom: 1px solid var(--ink);
}
.card-art {
  container-type: inline-size;
  display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10;
  padding: 1rem; overflow: hidden; text-align: center;
  background: var(--ink); color: var(--paper); border-bottom: 1px solid var(--ink);
}
.card-art span {
  font-weight: 700; font-size: clamp(1.5rem, 12cqw, 2.75rem); line-height: 1; letter-spacing: -0.04em;
}
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.9rem 1rem 1.1rem; }
.card-title { font-size: 1.1rem; line-height: 1.25; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.card-title::after { content: "\00a0↗"; color: var(--blue); }
.card p { color: var(--muted); font-size: 0.9375rem; line-height: 1.45; }
.card:hover, .card:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.card:hover .card-title, .card:focus-visible .card-title {
  color: var(--blue); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.15em;
}

.principles {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2.5rem;
}
.principles li { padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.principles h3 { font-size: 1.2rem; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.principles h3::before { content: "→ "; color: var(--blue); }

.contact-lede { font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.4; max-width: 36ch; margin-bottom: 2rem; }
.email {
  display: inline-block;
  font-size: clamp(1.75rem, 6.5vw, 4.5rem); font-weight: 700; letter-spacing: -0.045em; line-height: 1.05;
  color: var(--blue); text-decoration: underline; text-decoration-thickness: 0.06em; text-underline-offset: 0.12em;
  overflow-wrap: anywhere; margin-bottom: 1.25rem;
}
.email:hover { color: var(--ink); }

/* Footer */
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem 2rem;
  padding: 2rem var(--gutter); background: var(--ink); color: var(--paper);
}
.site-footer p:first-child { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; letter-spacing: -0.02em; }
.site-footer .label { color: #c8c7bf; }
.link-button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0;
  text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer;
}
.site-footer :focus-visible { outline-color: #fff; }

/* Command palette */
.palette {
  width: min(560px, calc(100vw - 32px));
  margin: 12vh auto auto;
  padding: 0; border: 1px solid var(--ink);
  background: var(--paper); color: var(--ink);
  box-shadow: 10px 10px 0 var(--blue);
}
.palette::backdrop { background: rgba(17, 17, 17, 0.5); }
.palette input {
  width: 100%; border: 0; border-bottom: 1px solid var(--ink);
  background: transparent; color: var(--ink);
  font: 500 1.25rem/1.2 var(--sans); padding: 1.1rem 1.25rem; outline: none;
}
.palette input:focus-visible { box-shadow: inset 0 -3px 0 var(--blue); }
.palette ul { list-style: none; margin: 0; padding: 0.4rem 0; max-height: 50vh; overflow-y: auto; }
.palette li {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.75rem 1.25rem; cursor: pointer; font-weight: 500;
}
.palette li[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.palette li[aria-selected="true"] .label { color: #c8c7bf; }
.palette-foot {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.7rem 1.25rem; border-top: 1px solid var(--rule);
}

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 30;
  transform: translate(-50%, 150%);
  background: var(--ink); color: var(--paper);
  font: 500 0.875rem/1.3 var(--mono); padding: 0.75rem 1rem; margin: 0;
  transition: transform 0.25s ease;
}
.toast.is-visible { transform: translate(-50%, 0); }
.toast:empty { visibility: hidden; }

/* Responsive */
@media (max-width: 860px) {
  .row { grid-template-columns: 1fr; }
  .row-head { position: static; }
  .hero-grid { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .site-nav { order: 3; width: 100%; }
  .site-nav ul { flex-wrap: wrap; gap: 0.35rem 1rem; padding-bottom: 2px; }
  .site-nav a { font-size: 0.9375rem; }
  .work div { grid-template-columns: 1fr; }
}

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