:root {
  color-scheme: dark;
  --canvas: #111110;
  --ink: #f3f1ec;
  --muted: #bebbaf;
  --subtle: #a6a296;
  --line: #34332e;
  --accent: #d3dd9f;
  --ease-out: cubic-bezier(.2, .75, .25, 1);
  --gutter: clamp(20px, 5vw, 72px);
  --gap: clamp(24px, 4vw, 64px);
  font-family: Manrope, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; transition: color .22s var(--ease-out); }
button { font: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
::selection { color: var(--canvas); background: var(--accent); }
[hidden] { display: none !important; }

.wrap { width: min(100% - var(--gutter) * 2, 1280px); margin-inline: auto; }

.masthead, .masthead nav { display: flex; align-items: center; }
.masthead { min-height: 76px; justify-content: space-between; border-bottom: 1px solid var(--line); }
.wordmark {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--accent);
  font-size: 25px;
  text-decoration: none;
}

.dk-mark { position: relative; display: inline-block; width: 1.55em; height: 1em; }

.dk-mark::before,
.dk-mark::after { content: ""; position: absolute; top: 0; height: 100%; }

.dk-mark::before {
  left: 0;
  width: .84em;
  border: .148em solid currentColor;
  border-radius: 0 .53em .53em 0;
}

.dk-mark::after {
  left: .755em;
  width: .795em;
  background: currentColor;
  clip-path: polygon(0 0, 19% 0, 19% 43%, 72% 0, 98% 0, 45% 47%, 100% 100%, 74% 100%, 19% 53%, 19% 100%, 0 100%);
}
.masthead nav { gap: clamp(16px, 3vw, 40px); }
.masthead nav a, .footer a { color: var(--muted); font-size: 15px; text-decoration: none; }
.masthead nav a:hover, .footer a:hover { color: var(--accent); }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--gap);
  padding-block: clamp(48px, 6vw, 88px) clamp(44px, 5vw, 72px);
}

.kicker { color: var(--muted); font-size: 15px; }
h1 { margin-top: 16px; font-size: clamp(2.5rem, 5.45vw, 5rem); font-weight: 500; letter-spacing: -.055em; line-height: 1.04; }
h1 span { display: block; }
.intro-copy { display: grid; gap: 12px; max-width: 45ch; padding-block-end: 2px; color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.15rem); line-height: 1.54; text-wrap: pretty; }

.work { scroll-margin-top: 28px; border-top: 1px solid var(--line); }

.project {
  display: grid;
  grid-template-areas:
    "summary visual"
    "details visual";
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.15fr);
  gap: clamp(24px, 3vw, 48px) var(--gap);
  padding-block: clamp(40px, 5vw, 76px);
  border-bottom: 1px solid var(--line);
}

.project-summary { grid-area: summary; min-width: 0; align-self: start; }
.project figure { grid-area: visual; min-width: 0; }
.project-details { grid-area: details; min-width: 0; align-self: start; }

.project-wide {
  grid-template-areas:
    "summary details"
    "visual visual";
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: 32px;
}

.project-wide .project-details { align-self: end; }

.category { color: var(--accent); font-size: 14px; line-height: 1.35; }
h3 { margin-top: 12px; font-size: clamp(2.375rem, 4.2vw, 4.125rem); line-height: .99; font-weight: 500; letter-spacing: -.042em; }
.description { max-width: 44ch; margin-top: 14px; color: var(--muted); font-size: 17px; line-height: 1.54; text-wrap: pretty; }
.functions { display: grid; gap: 10px; max-width: 55ch; margin: 0; padding: 0; list-style: none; color: var(--ink); font-size: 16px; line-height: 1.42; }
.functions li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; }
.functions li::before { content: ""; width: 10px; height: 1px; align-self: start; margin-top: .68em; background: var(--subtle); }
.stack { color: var(--subtle); font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.project-details > .stack, .project-tail { margin-top: 20px; }
.project-tail, .project-links { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; }
.project-tail { justify-content: space-between; }
.project-links a { font-size: 14px; text-underline-offset: 4px; }
.project-links a:hover { color: var(--accent); }

.preview { display: block; position: relative; overflow: hidden; text-decoration: none; }
a.preview, .carousel-slide { cursor: zoom-in; }
.window { width: 100%; height: auto; transition: opacity .32s var(--ease-out); }

.case-features { display: grid; gap: 14px 24px; margin: 0; font-size: 15px; line-height: 1.44; }
.case-features dt { font-weight: 600; }
.case-features dd { margin: 2px 0 0; color: var(--muted); }

.carousel-stage {
  display: grid;
  place-items: center;
  height: clamp(330px, 78svh, 750px);
  touch-action: pan-y pinch-zoom;
}

.carousel-slide { display: grid; place-items: center; width: fit-content; max-width: 100%; max-height: 100%; min-height: 0; }
.carousel-slide img { width: auto; height: auto; max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; transition: opacity .32s var(--ease-out); }
.carousel-landscape .carousel-stage {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  height: auto;
  aspect-ratio: 8 / 5;
}
.carousel-landscape .carousel-slide,
.carousel-landscape .carousel-slide img { width: 100%; height: 100%; }

.carousel-slide:focus-visible { outline: none; }
.carousel-slide:focus-visible img { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (hover: hover) {
  a.preview:hover img { opacity: .88; }
}

figcaption { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; color: var(--subtle); font-size: 13px; line-height: 1.45; }
figcaption a { color: var(--ink); text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: var(--subtle); }
figcaption a:hover { color: var(--accent); }
.footer { display: flex; align-items: baseline; gap: clamp(16px, 3vw, 40px); padding-block: 32px 44px; }
.footer-title { margin-right: auto; color: var(--accent); font-size: 18px; }

.carousel figcaption { justify-content: center; align-items: center; gap: 0 16px; }
.carousel-caption { text-align: center; }
.carousel-nav { display: flex; align-items: center; gap: 2px; }
.carousel-nav button:focus-visible { outline-width: 1px; outline-offset: -3px; }
.carousel-position { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }

.gallery {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: clamp(16px, 4vw, 56px);
  border: 0;
  background: transparent;
  color: #f7f6f1;
  overflow: hidden;
}
.gallery[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  animation: gallery-enter .28s var(--ease-out) both;
}
.gallery::backdrop { background: #10110ffa; }
html:has(.gallery[open]) { overflow: hidden; }
.gallery-media { display: grid; place-items: center; min-height: 0; padding-block-start: 28px; }
.gallery img, .gallery video { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; }
.gallery img { touch-action: pan-y pinch-zoom; }
.gallery-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; justify-content: center; align-items: center; min-height: 44px; text-align: center; }
.gallery-meta p { color: #dbdcd5; font-size: 14px; }
.gallery-nav { display: flex; align-items: center; gap: 4px; }
.gallery-position { min-width: 35px; color: #dbdcd5; font-size: 13px; font-variant-numeric: tabular-nums; }
.gallery button, .carousel-nav button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 29px; line-height: 1; transition: opacity .2s var(--ease-out); }
.gallery button:hover, .carousel-nav button:hover { opacity: .66; }
.gallery button:focus-visible { outline: 1px solid #fff; outline-offset: -3px; }
.gallery-close { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
@keyframes gallery-enter { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 860px) {
  .intro { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .project { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); align-items: start; }
  .project-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1000px) {
  .project-flop {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    row-gap: 22px;
  }

  .project-flop .case-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-flop .case-features > :last-child { grid-column: 1 / -1; }
}

@media (min-width: 721px) {
  .project {
    min-block-size: 100svh;
    padding-block: clamp(32px, 6svh, 72px);
    align-content: center;
    grid-template-rows: auto auto;
  }

  .project-summary { align-self: end; }
  .project figure { align-self: center; }

  .project .window {
    width: auto;
    max-height: 74svh;
    margin-inline: auto;
    object-fit: contain;
  }

  .project-wide .window { max-height: 64svh; }
  .project-wide figcaption { justify-content: center; }
}

@media (max-width: 720px) {
  .masthead { min-height: 64px; }
  .wordmark { font-size: 22px; }
  .intro { padding-block: 44px 40px; }
  h1 { font-size: clamp(1.875rem, 7.9vw, 3.75rem); }
  .project {
    grid-template-areas:
      "summary"
      "visual"
      "details";
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-block: 32px 40px;
  }
  .carousel-stage { height: min(78svh, 680px); }
  .description { font-size: 17px; }
  .footer { flex-wrap: wrap; }
  .gallery { padding: 16px 12px; }
  .gallery-meta { flex-direction: column; }
}

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

.masthead .view-link { font-size: 13px; }
[data-switch="dark"], [data-view="editorial"] [data-switch="editorial"] { display: none; }
[data-view="editorial"] [data-switch="dark"] { display: inline; }
