:root {
  --bg: #fff;
  --ink: #1c1915;
  --muted: #6f695f;
  --line: rgba(28, 25, 21, 0.16);
  --plate: #e4dbd1;
  --header: rgba(255, 255, 255, 0.92);
  --surface: #fff;
  --faint: rgba(28, 25, 21, 0.34);
  --faint-hover: rgba(28, 25, 21, 0.7);
  --sq: #f3e4a6;
  --serif: "Spectral", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Manrope", "Segoe UI", sans-serif;
  --wrap: 1120px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #3e5878;
  --ink: #f6f1e8;
  --muted: #c9d5e4;
  --line: rgba(246, 241, 232, 0.2);
  --plate: #4d6a8c;
  --header: rgba(62, 88, 120, 0.92);
  --surface: #4d6a8c;
  --faint: rgba(246, 241, 232, 0.46);
  --faint-hover: rgba(246, 241, 232, 0.82);
  --sq: #1e3148;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 400;
}

h1,
h2,
h3,
p,
ul,
dl,
dd {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

a:visited {
  color: inherit;
}

a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

img {
  max-width: 100%;
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

.wrap {
  width: min(var(--wrap), calc(100% - 2.5rem));
  margin-inline: auto;
}

.loading,
.error,
.empty {
  padding-top: 4rem;
  color: var(--muted);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 2rem;
  min-height: 4.25rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.35rem;
}

.nav a {
  text-decoration: none;
  font-size: 0.95rem;
}

.nav a:hover {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.header-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem 1.5rem;
}

.themes {
  display: flex;
  gap: 0.05rem;
}

.themes button {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  opacity: 0.28;
  cursor: pointer;
}

.themes svg {
  width: 1.02rem;
  height: 1.02rem;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.themes button[aria-pressed="true"] {
  opacity: 0.62;
}

.themes button:hover {
  opacity: 0.78;
}

.themes button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

.intro {
  padding: 4.25rem 0 2.75rem;
}

.role {
  margin-bottom: 0.9rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.title,
.project-title {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 0.96;
  text-wrap: balance;
}

.title {
  font-size: clamp(3.3rem, 7.4vw, 6.1rem);
  max-width: 12ch;
}

.tagline {
  margin-top: 1.35rem;
  max-width: 26rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.35;
}

.city {
  margin-top: 0.75rem;
  color: var(--muted);
}

.works,
.about,
.contacts {
  padding-bottom: 4.5rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  margin-bottom: 1.4rem;
}

.section-head h2 {
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.count {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.75rem 1.25rem;
}

.card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card-media,
.card-body,
.card-title,
.card-meta {
  display: block;
}

.card-media {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--plate);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.card:hover img {
  transform: scale(1.03);
}

.card-body {
  padding-top: 0.9rem;
}

.card-title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2vw, 1.9rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.card-meta {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.dot {
  margin: 0 0.4rem;
}

.about-layout {
  display: grid;
  gap: 1.75rem;
}

.about-layout.has-photo {
  align-items: start;
}

.portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--plate);
}

.about-copy,
.project-copy {
  max-width: 38rem;
  font-size: 1.05rem;
  line-height: 1.65;
}

.about-copy p + p,
.project-copy p + p {
  margin-top: 1rem;
}

.contact-list {
  display: grid;
  gap: 0.85rem;
}

.contact-list li {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 1rem;
}

.contact-label {
  color: var(--muted);
}

.contacts a {
  text-underline-offset: 0.18em;
}

.project {
  padding-top: 2.2rem;
  padding-bottom: 1rem;
}

.back {
  display: inline-block;
  margin-bottom: 1.2rem;
  color: var(--muted);
  text-decoration: none;
}

.back:hover {
  color: var(--ink);
}

.project-title {
  font-size: clamp(2.7rem, 6vw, 4.6rem);
  max-width: 16ch;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2.2rem;
  margin-top: 1.6rem;
  padding: 0;
}

.facts div {
  min-width: 6.5rem;
}

.facts dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.facts dd {
  margin-top: 0.28rem;
}

.project-copy {
  margin-top: 2rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 2.6rem;
}

.tile {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--plate);
  cursor: zoom-in;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.tile:hover img {
  transform: scale(1.04);
}

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

.viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 4.2rem 4.5rem 1.5rem;
  background: var(--bg);
}

.viewer[hidden] {
  display: none;
}

.viewer-photo {
  max-width: min(1100px, 100%);
  max-height: calc(100vh - 6.2rem);
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--plate);
}

.viewer-nav {
  position: absolute;
  top: 50%;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}

.viewer-close {
  position: absolute;
  top: 0.7rem;
  right: 0.75rem;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  font: 400 1.55rem/1 var(--sans);
  cursor: pointer;
}

.viewer-prev { left: 1rem; }
.viewer-next { right: 1rem; }

.viewer-close:hover {
  color: var(--faint-hover);
}

.viewer-nav:hover {
  border-color: var(--ink);
}

.viewer-close:focus-visible {
  outline: 1px solid var(--faint-hover);
  outline-offset: 3px;
}

body.viewer-open {
  overflow: hidden;
}

#app {
  position: relative;
  z-index: 1;
}

.drift {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}

.sq {
  position: absolute;
  left: 0;
  top: 0;
  background: var(--sq);
}

#works,
#about,
#contacts {
  scroll-margin-top: 5rem;
}

@media (min-width: 700px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 800px) {
  .wrap {
    width: min(var(--wrap), calc(100% - 4rem));
  }

  .about-layout.has-photo {
    grid-template-columns: 16rem minmax(0, 38rem);
  }

  .gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .header-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand themes"
      "nav nav";
    align-items: center;
    row-gap: 0.55rem;
  }

  .brand {
    grid-area: brand;
  }

  .header-tools {
    display: contents;
  }

  .nav {
    grid-area: nav;
  }

  .themes {
    grid-area: themes;
  }

  .viewer {
    padding: 3.6rem 0.75rem 4.4rem;
  }

  .viewer-photo {
    max-height: calc(100vh - 8.4rem);
  }

  .viewer-nav {
    top: auto;
    bottom: 0.8rem;
    transform: none;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .portrait {
    max-width: 16rem;
  }

  .contact-list li {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .intro {
    padding-top: 2.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .card-media img {
    transition: none;
  }

  .card:hover img,
  .tile:hover img {
    transform: none;
  }

  .tile img {
    transition: none;
  }
}
