:root {
  color-scheme: light;
  --paper: #f5f3ed;
  --ink: #222a23;
  --muted: #50594f;
  --line: #c9cdc2;
  --accent: #385741;
  --gallery-gap: clamp(.55rem, 1.1vw, 1rem);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 system-ui, sans-serif; }
h1, h2, p, figure { margin: 0; }
a { color: inherit; text-underline-offset: .27em; }
a:hover { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.skip { position: absolute; top: 0; left: 1rem; padding: .5rem 1rem; transform: translateY(-140%); background: var(--paper); z-index: 2; }
.skip:focus { transform: translateY(0); }
.masthead { text-align: center; padding: clamp(1.9rem, 4.4vw, 4.1rem) 1rem clamp(1.4rem, 3.1vw, 2.8rem); }
.masthead h1 { font: 400 clamp(2.25rem, 7vw, 6rem)/.98 Georgia, serif; letter-spacing: -.065em; }
.masthead h1 a { text-decoration: none; }
.masthead p { color: var(--muted); margin-top: .9rem; }
.masthead p span { padding-inline: .24em; }
nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem clamp(1rem, 3vw, 2.8rem); margin-top: clamp(.95rem, 2vw, 1.85rem); font-size: .9rem; }
nav a { text-decoration: none; }
nav a:hover, nav a[aria-current] { text-decoration: underline; }
.artwork-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gallery-gap);
  row-gap: var(--gallery-gap);
  align-items: start;
  width: min(100% - clamp(1.25rem, 5vw, 6rem), 105rem);
  margin-inline: auto;
}
.artwork-grid.justified { display: flex; flex-direction: column; gap: var(--gallery-gap); }
.artwork-row { display: flex; gap: var(--gallery-gap); align-items: flex-start; }
.artwork-row .project { flex: var(--art-ratio) 1 0; }
.restricted-project { width: min(100% - 2rem, 60rem); margin: 1.5rem auto 0; text-align: center; font-size: .9rem; }
.restricted-project span { display: inline-block; color: var(--muted); margin-inline-start: .55rem; }
.project { position: relative; min-width: 0; }
.art { width: 100%; display: block; padding: 0; border: 0; cursor: zoom-in; overflow: hidden; background: #d9dcd3; }
.art img { display: block; width: 100%; height: auto; }
.project figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: 1.8rem .8rem .55rem;
  color: #fff;
  background: linear-gradient(transparent, #121b17d9);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.project:hover figcaption, .project:focus-within figcaption { opacity: 1; }
.text-wrap { width: min(100% - clamp(2rem, 11vw, 13rem), 60rem); margin-inline: auto; }
.about, .contact { display: grid; grid-template-columns: 1fr 3fr; gap: .85rem 1.4rem; border-top: 1px solid var(--line); padding-block: clamp(1.4rem, 3.8vw, 3rem); }
.about { margin-top: clamp(2rem, 6vw, 5rem); }
.about h2, .contact h2 { font-size: 1rem; font-weight: 580; }
.about-lead { font: 400 clamp(1.5rem, 3.5vw, 2.6rem)/1.15 Georgia, serif; max-width: 24ch; }
.about p + p { max-width: 52ch; color: var(--muted); margin-top: .8rem; }
.contact div { display: flex; flex-wrap: wrap; gap: .45rem 1.6rem; overflow-wrap: anywhere; }
.closing-landscape { margin-top: clamp(.5rem, 2.5vw, 2rem); }
.closing-landscape .art:focus-visible { outline-offset: -5px; }
.back-to-top {
  position: fixed;
  z-index: 2;
  inset-inline-end: max(1rem, env(safe-area-inset-right));
  inset-block-end: max(1rem, env(safe-area-inset-bottom));
  min-height: 44px;
  padding: .5rem .9rem;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 0 1px 6px #222a2326;
}
.back-to-top:hover { background: var(--ink); color: var(--paper); }
dialog { width: min(94vw, 77rem); max-height: 94dvh; padding: 0; border: 1px solid #495048; background: #151b17; color: #f5f3ed; }
body:has(dialog[open]) { overflow: hidden; }
dialog::backdrop { background: #111713dd; }
.viewer-head, .viewer-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .65rem 1rem; }
.viewer-head h2 { font-size: 1rem; }
.viewer-image { height: min(70dvh, 54rem); background: #0d100e; }
.viewer-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
dialog button { background: transparent; border: 1px solid #69736b; padding: .35rem .65rem; cursor: pointer; }
dialog button:hover, dialog :focus-visible { outline-color: #f5f3ed; border-color: #f5f3ed; }
.viewer-meta { text-align: center; }
.viewer-meta a { color: #ebeee8; font-size: .9rem; }
.viewer-foot:has(#caption[hidden]) { justify-content: center; }
@media (min-width: 1024px) {
  .artwork-grid { width: min(100% - clamp(2rem, 3vw, 5rem), 125rem); }
}
@media (max-width: 760px) {
  .artwork-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 470px) {
  .artwork-grid { grid-template-columns: minmax(0, 1fr); }
  .about, .contact { grid-template-columns: 1fr; }
  .viewer-head, .viewer-foot { padding: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .project figcaption { transition: none; }
}
