:root {
  --bg: #f4f2ec;
  --fg: #1b1a18;
  --muted: #6f6b63;
  --rule: #dcd8cf;
  --surface: #e8e5dc;
  --accent: #c43c6a;
  --link: #b02c5c;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --width: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --fg: #ece9e2;
    --muted: #8f8a80;
    --rule: #2a2926;
    --surface: #1c1b19;
    --accent: #ef7aa0;
    --link: #f5a6c2;
  }
}

/* A page with a sketch as its background is always dark, so its text
   reads over the sketch. */
:root:has(body.has-background) {
  --bg: #0c0c0b;
  --fg: #f2efe8;
  --muted: #b3ada2;
  --rule: rgb(255 255 255 / 0.18);
  --surface: rgb(255 255 255 / 0.06);
  --accent: #ef7aa0;
  --link: #ffb8d0;
  color-scheme: dark;
}

body.has-background {
  text-shadow: 0 1px 14px rgb(0 0 0 / 0.55);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.6 var(--sans);
}

a {
  color: inherit;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s, color 0.15s;
}

a:hover {
  text-decoration-color: var(--accent);
}

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

h1,
h2 {
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin: 0 0 1.25rem;
  font: 500 0.75rem/1.2 var(--mono);
  letter-spacing: 0.02em;
  color: var(--muted);
}

h2 .meta {
  text-transform: none;
  letter-spacing: 0;
}

ul,
ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.meta {
  font: 0.8125rem/1.4 var(--mono);
  color: var(--muted);
}

button,
.button {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 0.8125rem/1.2 var(--mono);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

button:hover,
.button:hover {
  border-color: var(--accent);
}

/* Header and footer */

.site-header,
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: var(--width);
  margin: 0 auto;
  padding: 1.25rem var(--gutter);
}

.wordmark {
  font-weight: 600;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font: 0.875rem/1.4 var(--mono);
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: var(--fg);
}

.site-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font: 0.875rem/1.6 var(--mono);
}

/* Pages */

.page {
  max-width: var(--width);
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3rem) var(--gutter) 2rem;
}

.page > section {
  margin-top: clamp(3.5rem, 9vw, 6rem);
}

/* Links in running text (the about page, the home page's intro) stand out
   from it: their own color, and a clear underline that fills in on hover.
   Navigation, cards, and icons are links by where they sit. */
.prose a,
.bio a {
  color: var(--link);
  text-decoration-color: color-mix(in srgb, var(--link) 55%, transparent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.prose a:hover,
.bio a:hover {
  text-decoration-color: currentColor;
}

.prose {
  max-width: 40rem;
  font-size: 1.0625rem;
}

.prose p {
  margin: 0 0 1em;
}

/* The home page */

/* The home page: the name as its title, about two inches from the top,
   with the site's sections beneath it, then the intro. */

.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 44rem;
  margin: 0 auto;
  padding: min(2in, 20vh) var(--gutter) 4rem;
  text-align: center;
}

.landing h1 {
  margin: 0;
  font-size: clamp(2.75rem, 8vw, 4.5rem);
}

.landing-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem clamp(1.5rem, 5vw, 3rem);
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  font-size: clamp(1.125rem, 2.4vw, 1.375rem);
}

.landing-nav a {
  text-decoration-color: rgb(255 255 255 / 0.35);
}

.landing-nav a:hover {
  text-decoration-color: var(--accent);
}

.bio {
  margin-top: clamp(2.5rem, 7vw, 4.5rem);
  font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
  line-height: 1.6;
}

.bio p {
  margin: 0 0 0.75em;
}

.landing-socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  margin-top: 1.5rem;
  font: 0.875rem/1.6 var(--mono);
}

.page-title {
  margin: 0 0 clamp(1.5rem, 4vw, 2.5rem);
  font-size: clamp(2rem, 5vw, 3rem);
}

.empty {
  color: var(--muted);
}

/* easl sketches */

.easl-frame {
  position: relative;
  margin: 0;
}

.easl-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--surface);
}

.easl-note {
  display: none;
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 1.5rem;
  place-content: center;
  text-align: center;
  font: 0.875rem/1.5 var(--mono);
  color: var(--muted);
}

[data-easl-state="unsupported"] .easl-note[data-for="unsupported"],
[data-easl-state="error"] .easl-note[data-for="error"] {
  display: grid;
}

.easl-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.easl-background canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* A hosted piece as the background. The pieces are square, so the frame
   is a square as big as the window's longer side, centered: it covers
   the window, cropped, like a background image would. */
.piece-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.piece-background iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100vw, 100vh);
  height: max(100vw, 100vh);
  border: 0;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 1.2s ease;
}

.piece-background.loaded iframe {
  opacity: 1;
}

/* Darkens the piece behind the text, most around the middle column, so
   the text reads over even the brightest pieces. */
.piece-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 70% 60% at 50% 40%,
    rgb(0 0 0 / 0.55),
    rgb(0 0 0 / 0.2)
  );
}

/* Full-window sketch pages */

body.fullscreen {
  overflow: hidden;
  background: #000;
  color: #f2f0ea;
}

.easl-frame.fill {
  position: fixed;
  inset: 0;
}

.easl-frame.fill canvas {
  background: #000;
}

.overlay {
  position: fixed;
  left: 0;
  bottom: 0;
  max-width: min(28rem, 100%);
  padding: 1.25rem;
  text-shadow: 0 1px 10px rgb(0 0 0 / 0.7);
  transition: opacity 0.6s;
}

.overlay.idle {
  opacity: 0;
}

.overlay h1 {
  margin: 0.25rem 0;
  font-size: 1.375rem;
}

.overlay .home {
  font: 0.8125rem/1.4 var(--mono);
}

.overlay .meta {
  color: rgb(242 240 234 / 0.75);
}

.overlay .description p {
  margin: 0.5rem 0 0;
  font-size: 0.9375rem;
}

/* The works grid */

.works {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
  gap: 2.25rem 1.5rem;
}

@media (max-width: 30rem) {
  .works {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 0.875rem;
  }
}

.work a {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  text-decoration: none;
}

.work .thumb {
  aspect-ratio: 1;
  overflow: hidden;
  margin-bottom: 0.625rem;
  border-radius: 4px;
  background: var(--surface);
}

.work .thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.work a:hover .thumb img {
  transform: scale(1.04);
}

.work .title {
  font-weight: 500;
}

.work a:hover .title {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.2em;
}

/* Rows of links */

.rows li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.125rem 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
}

.rows li:last-child {
  border-bottom: 1px solid var(--rule);
}

.rows .note {
  color: var(--muted);
  font-size: 0.9375rem;
}

.rows time {
  margin-left: auto;
}

/* A work's page */

.work-header h1 {
  margin: 0 0 0.375rem;
  font-size: clamp(2rem, 5vw, 3rem);
}

.piece {
  margin: clamp(1.5rem, 4vw, 2.5rem) 0 0;
}

.piece-frame,
.piece-image {
  display: block;
  width: min(100%, calc(85vh * var(--ratio, 1)));
  max-height: 85vh;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 4px;
  background: #000;
}

.piece-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.piece-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 1rem;
  font: 0.8125rem/1.4 var(--mono);
}

.controls > a:not(.button) {
  margin-left: 0.25rem;
}

.work-body {
  display: grid;
  gap: 2rem;
  margin-top: clamp(2rem, 5vw, 3rem);
}

@media (min-width: 52rem) {
  .work-body {
    grid-template-columns: minmax(0, 40rem) minmax(0, 1fr);
    gap: 4rem;
  }
}

.description {
  font-size: 1rem;
}

.work-facts {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.links {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font: 0.875rem/1.4 var(--mono);
}

.work-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(3rem, 8vw, 5rem);
}

.work-nav a {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.work-nav .older {
  margin-left: auto;
  text-align: right;
}

/* The about page */

.not-found h1 {
  font-size: 2rem;
}

.page-title + section {
  margin-top: 0;
}

/* Icons (templates/icons/), sized to the text around them. */

.icon {
  display: block;
  width: 1.25em;
  height: 1.25em;
}

.icon-link {
  display: block;
  padding: 0.25rem;
  color: var(--muted);
  transition: color 0.15s, transform 0.15s;
}

.icon-link:hover {
  color: var(--fg);
}

.landing-socials {
  gap: 0.5rem 1.25rem;
  font-size: 1.125rem;
}

.landing-socials .icon-link {
  color: var(--fg);
  opacity: 0.85;
}

.landing-socials .icon-link:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.has-background .icon {
  filter: drop-shadow(0 1px 6px rgb(0 0 0 / 0.6));
}

.footer-links {
  align-items: center;
  gap: 0.25rem 1rem;
}

/* The featured projects: a large two-by-two grid at the top of the art
   page, before the rest. */
.works.featured-works {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2.5rem);
}

.featured-works .title {
  font-size: clamp(1.0625rem, 2vw, 1.375rem);
}

/* Stepping through a work's editions: arrows around the current one's
   label, and the grid of all of them below the description. */

.stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
}

.stepper button {
  padding: 0.45rem 0.7rem;
}

.edition-label {
  min-width: 6.5rem;
  text-align: center;
  color: var(--muted);
}

.editions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr));
  gap: 0.375rem;
  font: 0.8125rem/1 var(--mono);
}

.editions a {
  display: block;
  padding: 0.55rem 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.editions a:hover {
  border-color: var(--accent);
}

.editions a[aria-current] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}
