:root,
html[data-theme="gallery"] {
  color-scheme: light;
  --bg: #fcfcfc;
  --ink: #111111;
  --muted: #5c5c5c;
  --accent: #c12f1d;
  --line: #e4e4e4;
  --field: #f0f0f0;
  --sheet: #3d3d3d;
  --btn-hover: #2a2a2a;
}

html[data-theme="paper"] {
  color-scheme: light;
  --bg: #f3f0ea;
  --ink: #1a1814;
  --muted: #6a655c;
  --accent: #9e432c;
  --line: #ddd6cc;
  --field: #e8e2d8;
  --sheet: #4a4744;
  --btn-hover: #2c2a26;
}

html[data-theme="night"] {
  color-scheme: dark;
  --bg: #393531;
  --ink: #f5f0e8;
  --muted: #c2b8ac;
  --accent: #ff5e24;
  --line: #564f47;
  --field: #47413b;
  --sheet: #2a2622;
  --btn-hover: #ffffff;
}

:root {
  --max: 1080px;
  --pad: clamp(1.1rem, 3.5vw, 2rem);
  --header: 4.6rem;
  --font: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --text: 1.0625rem;
  --small: 0.875rem;
  --display: clamp(1.7rem, 3vw, 2.25rem);
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/instrument-sans-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/instrument-sans-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background-color: var(--bg);
  font-family: var(--font);
  font-size: var(--text);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.015em;
}

main {
  flex: 1;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration: none;
}

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

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

.wordmark,
.wordmark:link,
.wordmark:visited,
.wordmark:hover,
.wordmark:focus,
.wordmark:active {
  font-size: var(--display);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding-inline: max(var(--pad), calc((100% - var(--max)) / 2));
  min-height: var(--header);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  gap: 1.35rem;
  align-items: center;
}

.nav a {
  font-size: var(--small);
  text-decoration: none;
  color: var(--muted);
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 1.05rem;
  height: 1px;
  margin-inline: auto;
  background: var(--ink);
  position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle span::before {
  top: -6px;
}

.nav-toggle span::after {
  top: 6px;
}

.wrap {
  width: min(var(--max), calc(100% - 2 * var(--pad)));
  margin-inline: auto;
}

.hero {
  width: min(var(--max), calc(100% - 2 * var(--pad)));
  margin: 0 auto;
  padding: 1rem 0 1.75rem;
}

.home-set {
  display: none;
}

.grid.home-set,
.featured.home-set {
  display: none;
}

html:not([data-home-set]) .featured.home-set[data-home-set="0"],
html[data-home-set="0"] .featured.home-set[data-home-set="0"],
html[data-home-set="1"] .featured.home-set[data-home-set="1"],
html[data-home-set="2"] .featured.home-set[data-home-set="2"] {
  display: block;
}

html:not([data-home-set]) .grid.home-set[data-home-set="0"],
html[data-home-set="0"] .grid.home-set[data-home-set="0"],
html[data-home-set="1"] .grid.home-set[data-home-set="1"],
html[data-home-set="2"] .grid.home-set[data-home-set="2"] {
  display: grid;
}

.skip-link {
  position: absolute;
  left: var(--pad);
  top: -5rem;
  z-index: 40;
  padding: 0.45rem 0.75rem;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

.skip-link:focus {
  top: 0.65rem;
}

.lede {
  margin: 0 0 1.5rem;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.home-grids {
  padding-bottom: 1.5rem;
}

.grid {
  display: grid;
  gap: 1.75rem 1.1rem;
}

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

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

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

.project-card .thumb {
  background: var(--field);
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.featured .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
}

.featured .thumb img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.featured .thumb img.is-active {
  opacity: 1;
}

.thumb img,
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb.pin-top img,
.thumb img.pin-top {
  object-position: 50% 0;
}

.thumb.pin-bottom img {
  object-position: 50% 100%;
}

.thumb.pin-left img {
  object-position: 0 50%;
}

.thumb.pin-right img {
  object-position: 100% 50%;
}

.thumb.tj-cover {
  position: relative;
}

.thumb.tj-cover img {
  position: absolute;
  width: 190%;
  height: auto;
  max-width: none;
  left: -62%;
  top: -16%;
}

.portrait img {
  position: absolute;
  left: 50%;
  top: 0;
  width: 300px;
  height: 300px;
  max-width: none;
  object-fit: cover;
  object-position: 50% 22%;
  transform: translate(-50%, -12.5px);
}

.thumb.sheet {
  background: var(--sheet);
}

.thumb.sheet img {
  object-fit: contain;
}

.meta {
  display: grid;
  gap: 0.12rem;
  margin-top: 0.55rem;
}

.meta strong {
  font-size: var(--text);
  font-weight: 500;
}

.project-card:hover .meta strong {
  color: var(--accent);
}

.meta span {
  font-size: var(--small);
  color: var(--muted);
}

.section {
  padding: 1.75rem 0 3.5rem;
}

.home-about,
.home-contact {
  scroll-margin-top: calc(var(--header) + 0.5rem);
}

.home-end {
  background: var(--field);
}

.home-end input,
.home-end textarea {
  background-color: var(--bg);
}

.page-title {
  margin: 0;
  font-size: var(--small);
  font-weight: 400;
  color: var(--muted);
}

.page-title a {
  text-decoration: none;
}

.rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.7rem 0 1.5rem;
}

.gallery-rule {
  margin: 0.7rem 0 4.5625rem;
}

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

.bio {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.bio p {
  margin: 0 0 1rem;
  max-width: 34em;
}

.portrait {
  position: relative;
  aspect-ratio: 1;
  width: 250px;
  max-width: 100%;
  margin-inline: auto;
  border-radius: 50%;
  background: var(--field);
  overflow: hidden;
}

.credits {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
  max-width: 38em;
}

.credits li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.credits span:last-child {
  color: var(--muted);
  text-align: right;
  font-size: var(--small);
  align-self: center;
}

.case-head {
  padding: 0.7rem 0 1.5rem;
}

.case-head .rule {
  margin: 0 0 1.15rem;
}

.case-head h1 {
  font-size: var(--display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.7rem;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.15rem;
  margin: 0;
  color: var(--muted);
  font-size: var(--small);
}

.case-note {
  max-width: 36rem;
  margin: 1.1rem 0 0;
}

.case-note + .case-note {
  margin-top: 0.85rem;
}

.case-images {
  display: grid;
  gap: 0.65rem;
  padding: 0 0 2rem;
}

.case-images .thumb {
  aspect-ratio: auto;
  background: transparent;
  overflow: visible;
}

.case-images .thumb img {
  width: 100%;
  height: auto;
  object-fit: unset;
}

.case-images .thumb.sheet {
  aspect-ratio: auto;
}

.form {
  display: grid;
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: var(--small);
  color: var(--muted);
}

input,
textarea {
  font: inherit;
  color: var(--ink);
  background-color: var(--field);
  border: 0;
  border-radius: 0;
  padding: 0.55rem 0.7rem;
  width: 100%;
  appearance: none;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.hp {
  position: absolute;
  left: -9999px;
}

button,
.btn {
  font-family: inherit;
  font-size: var(--small);
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--bg);
  background: var(--ink);
  border: 0;
  padding: 0.7rem 1.05rem;
  margin-top: 0.4rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  width: fit-content;
}

button:hover,
.btn:hover {
  background: var(--btn-hover);
}

.contact-split {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.home-contact .form {
  max-width: 34em;
}

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

.contact-aside p {
  margin: 0 0 1rem;
}

.contact-aside a {
  text-decoration: none;
}

.contact-email {
  color: var(--accent);
}

.contact-aside a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.contact-socials {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin: 0 0 1rem;
}

.contact-socials a {
  color: var(--muted);
  line-height: 0;
}

.contact-socials a:hover {
  color: var(--accent);
  text-decoration: none;
}

.contact-socials svg {
  display: block;
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
}

.contact-socials svg.imdb {
  width: 2.333rem;
}

.contact-socials svg.imdb text {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.more {
  display: inline-block;
  margin-top: 2rem;
  font-size: var(--small);
  text-decoration: none;
}

.more:hover {
  color: var(--accent);
  text-decoration: underline;
}

.error-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.15rem;
  margin: 1.35rem 0 0;
  font-size: var(--small);
}

.error-links a {
  color: var(--muted);
  text-decoration: none;
}

.error-links a:hover {
  color: var(--accent);
}

.clients-block {
  margin-top: 2.75rem;
  padding: 1.85rem 0 1.35rem;
  border-top: 1px solid var(--line);
}

.clients {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem 2.35rem;
}

.client-logo {
  display: inline-block;
  line-height: 0;
  background-color: var(--muted);
  -webkit-mask: var(--client-logo) center / contain no-repeat;
  mask: var(--client-logo) center / contain no-repeat;
}

.client-logo:hover {
  background-color: var(--accent);
}

.client-logo img {
  display: block;
  height: 2rem;
  width: auto;
  max-width: 7.5rem;
  object-fit: contain;
  opacity: 0;
}

.client-logo.tall img {
  height: 2.55rem;
}

.client-logo:has(img[src$="clients/DWA.png"]) {
  --client-logo: url("../images/clients/DWA.png");
}

.client-logo:has(img[src$="clients/N.png"]) {
  --client-logo: url("../images/clients/N.png");
}

.client-logo:has(img[src$="clients/SDA.png"]) {
  --client-logo: url("../images/clients/SDA.png");
}

.client-logo:has(img[src$="clients/U.png"]) {
  --client-logo: url("../images/clients/U.png");
}

.client-logo:has(img[src$="clients/WBPA.png"]) {
  --client-logo: url("../images/clients/WBPA.png?v=2");
}

.client-logo:has(img[src$="clients/TL.png"]) {
  --client-logo: url("../images/clients/TL.png");
}

.client-logo:has(img[src$="clients/NW.png"]) {
  --client-logo: url("../images/clients/NW.png");
}

.client-logo:has(img[src$="clients/L.png"]) {
  --client-logo: url("../images/clients/L.png");
}

.client-logo:has(img[src$="clients/Psy.png"]) {
  --client-logo: url("../images/clients/Psy.png?v=2");
}

.site-footer {
  width: min(var(--max), calc(100% - 2 * var(--pad)));
  margin-inline: auto;
  margin-top: auto;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
  font-size: var(--small);
  color: var(--muted);
}

.footer-projects {
  width: min(var(--max), calc(100% - 2 * var(--pad)));
  margin-inline: auto;
  margin-top: auto;
  padding: 0 0 1.15rem;
  font-size: var(--small);
  color: var(--muted);
}

.footer-projects + .site-footer {
  margin-top: 0;
}

.footer-projects,
.footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
}

.footer-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.footer-bar .socials {
  justify-self: end;
}

.pager {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.pager-sep {
  width: 1px;
  height: 0.7rem;
  background: var(--line);
}

.pager-prev span,
.pager-next span {
  font-size: 0.95rem;
  line-height: 1;
}

.pager .is-off {
  opacity: 0.32;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.15rem;
}

.footer-projects a,
.site-footer a {
  text-decoration: none;
}

.footer-projects a:hover,
.site-footer a:hover {
  color: var(--accent);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
  margin: 0;
}

.filters a {
  font-size: var(--small);
  text-decoration: none;
  color: var(--muted);
}

.filters a:hover {
  color: var(--accent);
}

.group + .group {
  margin-top: 2.75rem;
}

@media (max-width: 860px) {
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .grid-2,
  .grid-3,
  .bio,
  .contact-split {
    grid-template-columns: 1fr;
  }

  .portrait {
    width: 200px;
    margin-inline: auto;
  }

  .footer-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .footer-bar .theme-switch {
    order: 3;
  }

  .clients {
    gap: 1.15rem 1.5rem;
  }

  .client-logo img {
    height: 1.7rem;
    max-width: 6.2rem;
  }

  .client-logo.tall img {
    height: 2.15rem;
  }

  .nav-toggle {
    display: grid;
    place-items: center;
  }

  .nav {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.25rem 0 1.1rem;
  }

  body.nav-open .nav {
    display: flex;
  }
}

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

  .featured .thumb img {
    transition: none;
  }
}

.theme-switch {
  display: flex;
  gap: 0.15rem;
  padding: 0.22rem;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.75rem;
  letter-spacing: -0.01em;
}

.theme-switch button {
  margin: 0;
  padding: 0.4rem 0.75rem;
  width: auto;
  font-family: inherit;
  font-size: inherit;
  font-weight: 400;
  letter-spacing: inherit;
  text-transform: none;
  color: var(--muted);
  background: transparent;
}

.theme-switch button:hover {
  color: var(--accent);
  background: var(--field);
}

.theme-switch button[aria-pressed="true"] {
  color: var(--accent);
  background: transparent;
}
