:root {
  --bg: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --placeholder: #f1f3f4;
  --overlay: rgba(0, 0, 0, 0.55);
  --width: 680px;
  --rail-gap: 12px;
  --rail-cols: 4;
  --space-section: 40px;
  --space-heading: 10px;
  --space-group: 24px;
  --space-stack: 8px;
  --sans: "Roboto", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover { color: var(--muted); }

img { max-width: 100%; display: block; }

.wrap {
  width: min(var(--width), calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 var(--space-section);
  container-type: inline-size;
  --rail-cols: 4;
}

h1 {
  font-size: 35px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  line-height: 1.25;
}

h2 {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-heading);
  color: var(--text);
}

h3 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: var(--space-group) 0 var(--space-heading);
}

.wrap > section + section { margin-top: var(--space-section); }
h2 + h3 { margin-top: 0; }

.lede {
  color: var(--muted);
  margin: 0 0 4px;
}

.about,
.project-grid-wrap {
  --tile-size: calc((100cqi - (var(--rail-cols) - 1) * var(--rail-gap)) / var(--rail-cols));
}

.about {
  display: grid;
  grid-template-columns: 1fr var(--tile-size);
  gap: 30px;
  align-items: start;
}

.about-copy { min-width: 0; }

.about h1 {
  margin: 0 0 24px;
  font-family: var(--sans);
  font-size: 35px;
  font-weight: 700;
}

.about h1 em { font-style: italic; }

.wave-emoji {
  display: inline-block;
  transform-origin: 70% 75%;
}

.wave-emoji:hover,
.wave-emoji.is-waving {
  animation: wave-hello 1.05s cubic-bezier(0.33, 1.15, 0.42, 1);
}

@keyframes wave-hello {
  0% { transform: rotate(0); }
  15% { transform: rotate(11deg); }
  32% { transform: rotate(-7deg); }
  48% { transform: rotate(9deg); }
  64% { transform: rotate(-4deg); }
  78% { transform: rotate(3deg); }
  90% { transform: rotate(-1deg); }
  100% { transform: rotate(0); }
}

.about p {
  margin: 0;
  font-size: 17px;
}

.media-frame {
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--placeholder);
}

.portrait-frame { width: 100%; }

.portrait,
.tile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.35s ease;
}

.portrait,
.tile-photo,
.album-embed iframe {
  filter: grayscale(1);
}

.media-frame:hover .portrait,
.media-frame:hover .tile-photo,
.tile:focus-visible .tile-photo,
.album-embed:hover iframe,
.album-embed:focus-within iframe {
  filter: grayscale(0);
}

.experience-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.experience-list li {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  margin: 0 0 3px;
}

.experience-list li:last-child { margin-bottom: 0; }

.exp-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.project-grid-wrap {
  container-type: inline-size;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(var(--rail-cols), minmax(0, 1fr));
  gap: var(--rail-gap);
  align-items: start;
}

.tile {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.tile:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.random-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 0;
}

.random-heading h3 { margin: 0; }

.surprise-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.surprise-button:hover { color: var(--text); }

.surprise-button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.surprise-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.surprise-button.is-refreshing svg {
  animation: refresh-spin 0.4s ease;
}

.album-embed {
  margin-top: var(--space-heading);
  min-height: 152px;
}

.album-embed iframe {
  display: block;
  width: 100%;
  height: 152px;
  border: 0;
  border-radius: 12px;
  transition: filter 0.35s ease;
}

@keyframes refresh-spin {
  to { transform: rotate(360deg); }
}

.media-frame.emoji-frame {
  display: grid;
  place-items: center;
  background: #fff;
}

.tile-emoji {
  font-size: calc(var(--tile-size) * 0.42);
  line-height: 1;
  filter: grayscale(1);
  transition: filter 0.35s ease;
}

.tile-title {
  margin: var(--space-stack) 0 0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.media-frame:hover .tile-emoji,
.tile:focus-visible .tile-emoji {
  filter: grayscale(0);
}

.tile-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
}

.modal.is-open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: #fff;
  padding: 28px 28px 32px;
}

.modal-links {
  margin: 8px 0 36px;
  color: var(--text);
}

.modal-toolbar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-step {
  display: flex;
  align-items: center;
  gap: 2px;
}

.modal-icon-btn {
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.modal-icon-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-icon-btn:hover { color: var(--text); }

.modal-icon-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.modal-panel h1 {
  font-size: 35px;
  font-weight: 700;
  padding-right: 110px;
}

.modal-gallery {
  display: grid;
  gap: 12px;
  margin: 16px 0 8px;
}

.modal-gallery img {
  width: 100%;
}

.prose p { margin: 0 0 14px; }

.contact-list li {
  grid-template-columns: 118px minmax(0, 1fr);
}

.callout {
  background: var(--placeholder);
  padding: 14px 16px;
  margin: 16px 0;
  font-style: italic;
}

.site-footer {
  width: min(var(--width), calc(100% - 48px));
  margin: 0 auto;
  padding: 0 0 var(--space-section);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.site-footer p { margin: 3px 0; }

.footer-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
}

.footer-emoji {
  display: inline-grid;
  flex: 0 0 1.4em;
  width: 1.4em;
  height: 1.4em;
  place-items: center;
  line-height: 1;
}

.rotating-emoji {
  position: relative;
}

.rotating-emoji > span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.7s ease-in-out;
}

.rotating-emoji > span.is-active {
  opacity: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .wave-emoji:hover,
  .wave-emoji.is-waving { animation: none; }
  .rotating-emoji > span { transition: none; }
  .rotating-emoji > span.is-active { opacity: 1; }
}

@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); padding-top: 40px; }
  .about { grid-template-columns: 1fr; }
  .portrait-frame { width: var(--tile-size); }
  .modal { padding: 16px 8px; }
  .site-footer { width: calc(100% - 32px); }
}
