:root {
  color-scheme: light;
  color: #242424;
  background: #fff;
  font: 100%/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --muted: #626262;
  --line: #dedede;
  --gutter: clamp(1.1rem, 2.7vw, 3.25rem);
}

* { box-sizing: border-box; }
body, h1, h2, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; text-underline-offset: .25em; }
a:hover, a:focus-visible { color: #535353; text-decoration: underline; }
:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.page {
  display: grid;
  grid-template-columns: clamp(11rem, 17vw, 16rem) minmax(0, 1fr);
  gap: var(--gutter);
  max-width: 105rem;
  margin-inline: auto;
  padding: var(--gutter);
  align-items: start;
}

.sidebar { position: sticky; top: var(--gutter); }
.identity { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .75rem; }
.sidebar h1 { font: normal 1.65rem/1.1 var(--serif); letter-spacing: -.04em; }
.identity p { font-size: .8125rem; font-style: italic; color: var(--muted); }
.sidebar nav, .project-heading time, .project-url, footer { font: .875rem/1.4 var(--mono); }
.sidebar nav { margin-top: clamp(1.8rem, 5vw, 4rem); }
.index-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  list-style: none;
  cursor: pointer;
}
.index-heading::-webkit-details-marker { display: none; }
.index-heading span { font: .8125rem/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif; color: var(--muted); }
.index-hide, .work-index[open] .index-show { display: none; }
.work-index[open] .index-hide { display: inline; }
.index { display: grid; gap: .25rem; margin-top: .65rem; }
.index a { display: inline-block; padding-block: .3rem; }

main { min-width: 0; }
main, .project { scroll-margin-top: var(--gutter); }
.project + .project { margin-top: clamp(4rem, 11vw, 10rem); }
.project-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  margin-bottom: .75rem;
}
.project-heading h2 { font: normal clamp(1.3rem, 2.15vw, 2rem)/1.15 var(--serif); letter-spacing: -.035em; }
.project-heading time { margin-inline-start: .35rem; color: var(--muted); }
.project-url {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: #b5b5b5;
  overflow-wrap: anywhere;
}
.project-url:hover, .project-url:focus-visible { text-decoration-color: currentColor; }

.project-media {
  display: grid;
  gap: clamp(1.4rem, 3vw, 3rem);
}
.project-media :is(img, video, iframe) { display: block; width: 100%; height: auto; }
.project-media :is(video, iframe) { aspect-ratio: 16 / 9; background: #171717; }
.project-media iframe { min-height: 200px; border: 0; }
figcaption { margin-top: .55rem; color: var(--muted); }

footer { margin-top: clamp(3rem, 8vw, 6rem); padding: 1rem 0; border-top: 1px solid var(--line); }

@media (min-width: 691px) {
  .project-media figure:nth-child(even) { width: 74%; justify-self: end; }
  .project-media figure:nth-child(odd):not(:first-child) { width: 84%; }
}

@media (max-width: 690px) {
  .page { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .sidebar { position: static; }
  .identity { column-gap: .5rem; }
  .sidebar h1 { font-size: 1.55rem; }
  .identity p { font-size: .75rem; }
  .sidebar nav { margin-top: 1.25rem; }
  .index { gap: 0; margin-top: 0; }
  .index li { border-bottom: 1px solid var(--line); }
  .index a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: .5rem 0;
    font: 1rem/1.35 "Helvetica Neue", Helvetica, Arial, sans-serif;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  a { transition: color 160ms ease, text-decoration-color 160ms ease; }

  @supports (animation-timeline: view()) {
    .project-media figure {
      animation: media-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 35%;
    }
    .project:first-child figure:first-child { animation: none; }
  }
}

@keyframes media-in {
  from { opacity: .68; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
