:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --ink: #24251f;
  --muted: #626359;
  --rule: #dcdad1;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { display: block; max-width: 100%; }
h1, h2, p, figure { margin: 0; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
::selection { background: #dce2d5; color: var(--ink); }

.shell {
  --page-gutter: clamp(.75rem, 2.4vw, 2.25rem);
  width: min(calc(100% - 2 * var(--page-gutter)), 100rem);
  margin-inline: auto;
}
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 12px 16px;
  background: var(--paper);
}
.masthead-inner, .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.masthead-inner { flex-wrap: wrap; gap: 8px 12px; padding-block: clamp(14px, 2vw, 26px); }
.wordmark {
  font-size: clamp(1.375rem, 2.45vw, 2rem);
  font-weight: 400;
  letter-spacing: -.032em;
  line-height: .95;
}
nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 38px); }
nav a { padding: 12px 2px; font-size: clamp(.875rem, 1.25vw, 1rem); }
nav a:hover, .site-footer a:hover { text-decoration: underline; text-underline-offset: 5px; }
.social-links { display: flex; gap: 8px; }
.social-link {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
}
.xiaohongshu-icon {
  width: 20px;
  height: 20px;
  background: currentColor;
  mask: url("assets/xiaohongshu.svg") center / contain no-repeat;
}
.instagram-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 5px;
}
.instagram-icon::before,
.instagram-icon::after {
  position: absolute;
  content: "";
  border-radius: 50%;
}
.instagram-icon::before {
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  transform: translate(-50%, -50%);
}
.instagram-icon::after {
  top: 2px;
  right: 2px;
  width: 2.5px;
  height: 2.5px;
  background: currentColor;
}

section[id], #work { scroll-margin-top: 24px; }
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .13em;
  line-height: 1.3;
  text-transform: uppercase;
}
h2 {
  font-size: clamp(2.25rem, 4.1vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1;
}
.photo-grid {
  --photo-gap: clamp(.25rem, .55vw, .375rem);
  column-count: 2;
  column-gap: var(--photo-gap);
  list-style: none;
  padding: 0;
  margin: 0;
}
.photo-grid > li {
  break-inside: avoid;
  margin-bottom: var(--photo-gap);
}
.photo-card { display: block; }
.photo-frame { background: #dddcd2; overflow: hidden; }
.photo-frame > img {
  width: 100%;
  height: auto;
  transition: transform .55s ease;
}
.photo-card[href]:hover img { transform: scale(1.025); }

.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 24px;
  margin-top: clamp(65px, 9vw, 126px);
  padding-block: clamp(32px, 5vw, 65px) clamp(48px, 8vw, 110px);
  border-top: 1px solid var(--rule);
}
.about .eyebrow { margin-bottom: 14px; }
.about p { max-width: 40ch; color: var(--muted); font-size: 16px; line-height: 1.65; }
.site-footer { border-top: 1px solid var(--rule); }
.footer-inner {
  flex-wrap: wrap;
  gap: 20px;
  padding-block: 24px;
  color: var(--muted);
  font-size: 13px;
}
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
.site-footer a { padding-block: 10px; }
.site-footer a span { margin-left: 5px; }

body:has(dialog[open]) { overflow: hidden; }
.lightbox {
  --viewer-spacing: clamp(12px, 1.6vw, 24px);
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--viewer-spacing) clamp(12px, 2.5vw, 36px);
  border: 0;
  color: var(--ink);
  background: var(--paper);
}
.lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, max-content) auto;
  align-content: space-evenly;
  row-gap: var(--viewer-spacing);
}
.lightbox-top {
  display: grid;
  grid-template-columns: minmax(44px, 1fr) minmax(0, max-content) minmax(44px, 1fr);
  align-items: center;
  gap: 12px;
}
.lightbox-actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 4px;
}
#lightbox-position { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
#lightbox-collection { font-size: clamp(1.375rem, 2.5vw, 2rem); font-weight: 400; letter-spacing: -.02em; line-height: 1.2; text-align: center; }
.lightbox-figure { min-height: 0; }
.lightbox-figure img { width: 100%; height: auto; max-height: 100%; object-fit: contain; }
.lightbox-controls { display: flex; align-items: center; justify-content: center; gap: 4px; }
.notes-toggle {
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--rule);
  border-radius: 20px;
  color: inherit;
  background: transparent;
  font-size: 13px;
  cursor: pointer;
}
.notes-toggle:hover, .notes-toggle[aria-expanded="true"] { border-color: var(--muted); }
.lightbox-notes {
  display: grid;
  align-content: start;
  gap: 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.lightbox-notes h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: inherit;
  font-weight: 500;
}
.lightbox-notes .collection-note h3 {
  margin-bottom: 8px;
  font-size: clamp(1.375rem, 2.5vw, 2rem);
  font-weight: 400;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.icon-button::before, .icon-button svg { grid-area: 1 / 1; }
.icon-button::before {
  width: 32px;
  height: 32px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  content: "";
}
.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-button:enabled:hover::before { border-color: var(--ink); background: var(--rule); }
.icon-button:disabled { opacity: .45; cursor: default; }

@media (min-width: 761px) {
  .lightbox[open] {
    --viewer-notes-width: 0px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 67.5rem) var(--viewer-notes-width) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) minmax(0, 45rem) auto minmax(0, 1fr);
    align-content: stretch;
    row-gap: 0;
  }
  .lightbox[open]:has(.lightbox-notes:not([hidden])) {
    --viewer-notes-width: clamp(17rem, 27vw, 22rem);
  }
  .lightbox-top {
    grid-area: 1 / 1 / 2 / -1;
    margin-block-end: var(--viewer-spacing);
  }
  .lightbox-figure { grid-area: 3 / 2; }
  .lightbox-figure img { height: 100%; }
  .lightbox-controls {
    grid-area: 4 / 2;
    margin-block-start: var(--viewer-spacing);
  }
  .lightbox-notes {
    --notes-top-padding: .25rem;
    grid-area: 3 / 3;
    min-height: 0;
    overflow-y: auto;
    /* Leave room for glyphs that extend above the cap height. */
    margin-block-start: calc(var(--notes-photo-inset, 0px) - var(--notes-top-padding));
    padding-block-start: var(--notes-top-padding);
    padding-inline-start: clamp(24px, 3vw, 36px);
  }
  .lightbox-notes .collection-note h3 { text-box: trim-start cap alphabetic; }
}

@media (max-width: 760px) {
  .lightbox-top {
    grid-template-columns: minmax(44px, 1fr) minmax(0, max-content) minmax(max-content, 1fr);
    gap: 8px;
  }
  .lightbox[open]:has(.lightbox-notes:not([hidden])) {
    grid-template-rows: repeat(4, auto);
    align-content: start;
  }
  .lightbox:has(.lightbox-notes:not([hidden])) .lightbox-top {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--paper);
  }
  .lightbox:has(.lightbox-notes:not([hidden])) .lightbox-figure img {
    max-height: max(12rem, calc(100dvh - 88px - 4 * var(--viewer-spacing)));
  }
  .lightbox-notes {
    justify-self: center;
    max-width: 58ch;
    width: 100%;
    padding-block-start: var(--viewer-spacing);
  }
}

@media (min-width: 1100px) {
  .photo-grid { column-count: 4; }
}

@media (max-width: 700px) {
  nav { gap: clamp(10px, 3vw, 21px); }
  .photo-grid { column-count: 1; }
  .about { grid-template-columns: 1fr; }
}

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