:root {
  color-scheme: light;
  --canvas: #f7f6f2;
  --paper: #fbfaf7;
  --ink: #17170f;
  --body: #4a4941;
  --muted: #6b6960;
  --faint: #8a887f;
  --line: #dddbd2;
  --line-strong: #b8b6ad;
  --focus: #17170f;
  --gutter: clamp(20px, 6vw, 72px);
  --column: 600px;
  --max-width: 1100px;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
}

a:hover {
  border-bottom-color: var(--ink);
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

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

.skip-link {
  background: var(--ink);
  color: var(--canvas);
  border: 0;
  left: 1rem;
  padding: 0.65rem 0.8rem;
  position: fixed;
  top: 1rem;
  transform: translateY(-150%);
  z-index: 20;
  font-family: var(--sans);
  font-size: 14px;
}

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

/* Header */

.site-header {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 44px var(--gutter) 0;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand {
  color: var(--ink);
  border: 0;
  padding: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.site-role {
  margin: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Main column */

main {
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 0 var(--gutter) clamp(64px, 10vw, 120px);
}

.hero {
  max-width: var(--column);
  padding-top: clamp(72px, 14vw, 148px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.12;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

/* The greeting always sits on one line: the size tracks the viewport down to a phone. */
.hero-greeting {
  font-size: clamp(30px, 8.6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 0.05em;
}

.typed {
  display: inline-block;
}

.caret {
  display: inline-block;
  width: 0.04em;
  min-width: 2px;
  height: 0.9em;
  background: var(--ink);
  transform: translateY(0.12em);
}

.hero-text {
  margin: 0;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.4;
  color: var(--body);
  text-wrap: pretty;
}

.hero-note {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

/* Typing and reveal run once the page has the font (script adds .fonts-ready). */
@keyframes type {
  from { clip-path: inset(0 100% 0 -0.1em); }
  to { clip-path: inset(0 -0.1em 0 -0.1em); }
}

@keyframes blink {
  0%, 45% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* With script, hold the hero back until the font is ready; without it, everything shows at once. */
.js:not(.fonts-ready) .typed {
  clip-path: inset(0 100% 0 -0.1em);
}

.js:not(.fonts-ready) .rise {
  opacity: 0;
}

.fonts-ready .typed {
  animation: type 1600ms steps(22, end) 300ms both;
}

.fonts-ready .caret {
  animation: blink 1s step-end 300ms infinite;
}

.fonts-ready .rise {
  animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.fonts-ready .hero-text.rise {
  animation-delay: 2000ms;
}

.fonts-ready .hero-note.rise {
  animation-delay: 2140ms;
}

.facts {
  margin: clamp(64px, 10vw, 110px) 0 0;
  max-width: var(--column);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

.facts > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.facts > div:last-child {
  border-bottom: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.facts .links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

/* Projects */

.projects {
  margin-top: clamp(72px, 11vw, 120px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.projects-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.projects-head h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.2;
}

.projects-hint {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}

.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.project-card {
  appearance: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 160ms ease;
}

.project-card:hover,
.project-card[aria-expanded="true"] {
  border-color: var(--ink);
}

.project-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #e8e6de;
  margin-bottom: 8px;
}

.project-name {
  font-size: 22px;
  line-height: 1.2;
}

.project-blurb {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.project-count {
  margin-top: auto;
  padding-top: 8px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}

/* Inline gallery */

.gallery {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 360ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.gallery.is-open {
  grid-template-rows: 1fr;
}

.gallery[hidden] {
  display: none;
}

.gallery-inner {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 12px;
}

.gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--ink);
}

.gallery-title {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
}

.gallery-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}

.gallery-counter {
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}

.gallery-controls button {
  appearance: none;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gallery-controls button:hover {
  color: var(--muted);
}

.gallery-controls button:disabled {
  color: var(--line-strong);
  cursor: default;
}

/* The strip bleeds to the right edge of the viewport so the next screenshot peeks in. */
.gallery-strip {
  display: flex;
  gap: 16px;
  margin-right: calc(50% - 50vw);
  padding-right: calc(50vw - 50%);
  padding-bottom: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.gallery-strip::-webkit-scrollbar {
  display: none;
}

.gallery-strip img {
  flex: 0 0 auto;
  display: block;
  height: clamp(220px, 34vw, 420px);
  width: auto;
  max-width: 88vw;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  background: #e8e6de;
}

.gallery-text {
  margin: 0;
  max-width: var(--column);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--body);
  text-wrap: pretty;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 24px var(--gutter);
}

.site-footer p {
  margin: 0;
}

/* Not-found page */

.error-page {
  min-height: 100svh;
  padding-top: 22vh;
  max-width: var(--column);
}

.eyebrow {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 16px;
}

.error-page h1 {
  margin-bottom: 20px;
}

.error-page p:not(.eyebrow) {
  color: var(--body);
  max-width: 36rem;
}

.text-link {
  font-family: var(--sans);
  font-size: 15px;
}

/* Responsive */

@media (max-width: 860px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .site-header {
    padding-top: 20px;
  }

  .facts > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .projects-head h2 {
    font-size: 26px;
  }

  .gallery-head {
    flex-wrap: wrap;
  }
}

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