/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  --ivory: #f7f6f2;
  --ink: #111111;

  --bg: var(--ivory);
  --fg: var(--ink);
  --muted: rgba(17, 17, 17, 0.45);

  --font-display: "Italiana", "Didot", "Bodoni 72", serif;
  --font-sans: "Geist", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --ui: 12px;              /* small uppercase labels */
  --edge: 20px;            /* distance of fixed UI from the viewport edge */
  --gutter: 16px;          /* gaps on project pages */
  --airy: 7.7vw;           /* margins and gaps of the category grid */
  --ease: cubic-bezier(0.7, 0, 0.2, 1);
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }
html.is-locked { overflow: hidden; }
html.is-locked body { position: fixed; left: 0; right: 0; overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* The page wrapper paints the background itself so the fixed top bar,
   which uses mix-blend-mode, has something to blend with. */
#app {
  min-height: 100vh;
  background: var(--bg);
  animation: page-in 0.6s ease;
}

@keyframes page-in { from { opacity: 0; } }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, p, dl, dd, figure { margin: 0; }

:focus-visible { outline: 1px solid currentColor; outline-offset: 3px; }

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

.mono {
  font-family: var(--font-mono);
  font-size: var(--ui);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* images fade in once loaded */
.fade { opacity: 0; transition: opacity 0.8s ease; }
.fade.is-loaded { opacity: 1; }

/* text that swaps on hover: ABOUT -> CONTACT */
.swap { display: inline-grid; overflow: hidden; justify-items: center; vertical-align: top; }
.swap > span { grid-area: 1 / 1; transition: transform 0.45s var(--ease); }
.swap > span + span { transform: translateY(105%); }
a:hover > .swap > span:first-child, .swap:hover > span:first-child { transform: translateY(-105%); }
a:hover > .swap > span + span, .swap:hover > span + span { transform: none; }

/* pill buttons */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 12px 3px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--ui);
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.pill[aria-current="page"], .pill[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

@media (hover: hover) {
  .pill:hover { background: var(--fg); color: var(--bg); }
}

/* ==========================================================================
   Top bar (all pages)
   ========================================================================== */

.topbar {
  position: fixed;
  z-index: 40;
  top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  padding: var(--edge);
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
  transition: transform 0.5s var(--ease), opacity 0.3s ease;
}
.topbar > * { pointer-events: auto; }
.topbar.is-hidden { transform: translateY(-100%); opacity: 0; }
.topbar.is-hidden > * { pointer-events: none; }
.topbar__left { justify-self: start; }
.topbar__name { justify-self: center; margin-top: 40px; }
.topbar__right, .topbar__right [role="group"] { justify-self: end; display: flex; gap: 16px; }
.topbar__right button { opacity: 0.45; transition: opacity 0.2s ease; }
.topbar__right button:hover, .topbar__right button[aria-pressed="true"] { opacity: 1; }
.topbar__right button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================================
   Bottom navigation (all pages except home)
   ========================================================================== */

.bottomnav {
  position: fixed;
  z-index: 40;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: var(--edge) var(--edge) calc(var(--edge) + 16px);
  pointer-events: none;
}
.bottomnav > * { pointer-events: auto; }
.bottomnav__group { display: flex; flex-wrap: wrap; gap: 8px; }
.bottomnav__menu { display: none; }

.menu {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-bottom: calc(var(--edge) + 64px);   /* room for the close button */
  background: var(--bg);
  color: var(--fg);
}
.menu[hidden] { display: none; }
.menu a {
  font-family: var(--font-display);
  font-size: min(clamp(40px, 11vw, 64px), 7vh);
  line-height: 1.05;
  text-transform: uppercase;
}
.menu a[aria-current="page"] { font-style: italic; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.menu .pill { position: absolute; bottom: calc(var(--edge) + 16px); }

/* ==========================================================================
   Home — the name set large, split across lines
   ========================================================================== */

.home {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.home__name {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: min(16.5vh, 13vw);
  font-weight: 400;
  line-height: 0.84;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}
.home__name span {
  display: block;
  transition: transform 1s var(--ease);
}
/* the shift is capped so the lines stay clear of the name at the top and
   the links at the bottom on short screens (1.26em is half the block) */
.home__name { --split: min(18vh, 50vh - 1.26em - 90px); }
.home.is-open .home__name span[data-half="top"] { transform: translateY(calc(-1 * var(--split))); }
.home.is-open .home__name span[data-half="bottom"] { transform: translateY(var(--split)); }

.home__previews { position: absolute; inset: 0; pointer-events: none; }
.home__previews img {
  position: absolute;
  object-fit: cover;
  opacity: 0;
  filter: blur(24px);
  transform: scale(0.96);
  transition: opacity 0.7s ease, filter 0.9s ease, transform 0.9s var(--ease);
}
.home__previews img:nth-child(1) { left: 24%; top: 22%; width: 23vw; aspect-ratio: 16 / 9; }
.home__previews img:nth-child(2) { left: 49%; top: 37%; width: 9vw; aspect-ratio: 4 / 5; transition-delay: 0.08s; }
.home__previews img:nth-child(3) { left: 51%; top: 54%; width: 13vw; aspect-ratio: 4 / 3; transition-delay: 0.16s; }
.home__previews.is-visible img { opacity: 1; filter: blur(0); transform: none; }
.home__previews.is-visible img:nth-child(3) { filter: blur(6px); }

.home__pills {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7.3vw;
  pointer-events: none;
}
.home__pills .pill { pointer-events: auto; }

.home__links {
  position: absolute;
  left: 0; right: 0;
  bottom: 56px;
  display: flex;
  justify-content: center;
  gap: 34px;
}

/* ==========================================================================
   Work — airy image grid
   ========================================================================== */

.work { min-height: 100vh; }

.work__grid {
  --cols: 4;
  --gap: var(--airy);
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: var(--gap);
  align-items: start;
  padding: 110px var(--airy) 120px;
}
.work__grid[data-size="s"] { --cols: 6; --gap: 3.4vw; }
.work__grid[data-size="l"] { --cols: 2; --gap: var(--airy); padding-left: 16vw; padding-right: 16vw; }

.tile { position: relative; display: block; width: 100%; cursor: zoom-in; }
.tile img { width: 100%; height: auto; background: rgba(0, 0, 0, 0.04); }
.tile.is-expanded { grid-column: span 2; grid-row: span 2; cursor: zoom-out; }
.tile__label {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 8px 5px;
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.tile.is-expanded .tile__label { opacity: 1; pointer-events: auto; }

/* ==========================================================================
   Projects list
   ========================================================================== */

.projects {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 48px var(--gutter);
  align-items: start;
  padding: 130px var(--gutter) 120px;
}
.card { display: block; }
.card__media { overflow: hidden; }
.card__media img {
  width: 100%;
  height: auto;
  transition: filter 0.6s ease, transform 1.2s var(--ease), opacity 0.8s ease;
}
.card__meta {
  margin-top: 12px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  text-transform: uppercase;
}
.card__meta span { display: block; }
.card__meta span + span { color: var(--muted); transition: color 0.2s ease; }
@media (hover: hover) {
  .card__media img { filter: grayscale(1); }   /* black & white until hover */
  .card:hover .card__media img { filter: grayscale(0); transform: scale(1.02); }
  .card:hover .card__meta span + span { color: var(--fg); }
}

/* ==========================================================================
   Project page
   ========================================================================== */

.p-hero {
  position: relative;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  cursor: zoom-in;
}
.p-hero img { width: 100%; height: 100%; object-fit: cover; }
.p-hero h1 {
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  bottom: calc(var(--edge) + 60px);
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(54px, 9.5vw, 160px);
  font-weight: 400;
  line-height: 0.9;
  text-align: left;
  text-transform: uppercase;
}

.p-info {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 32px var(--gutter);
  padding: 96px var(--gutter);
}
.p-info__text { grid-column: 1 / 7; font-size: 20px; line-height: 1.35; max-width: 34em; }
.p-info__details { grid-column: 8 / 13; display: grid; gap: 8px; }
.p-info__details div { display: grid; grid-template-columns: 9em 1fr; gap: var(--gutter); }
.p-info__details dt { color: var(--muted); }

.p-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gutter);
  padding: 0 var(--gutter);
}
.frame { display: block; width: 100%; cursor: zoom-in; }
.frame img { width: 100%; height: auto; background: rgba(0, 0, 0, 0.04); }
.frame.is-wide { grid-column: 1 / -1; }
.frame.is-single { grid-column: 1 / -1; }
.frame.is-single img { width: calc(50% - var(--gutter) / 2); margin: 0 auto; }

.p-next {
  position: relative;
  display: block;
  padding: 160px var(--gutter) 140px;
  text-align: center;
}
.p-next__title {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: clamp(48px, 9vw, 150px);
  line-height: 0.9;
  text-transform: uppercase;
}
.p-next img {
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 50%;
  width: min(28vw, 360px);
  height: auto;
  opacity: 0;
  filter: blur(18px);
  transform: translate(-50%, -50%) scale(0.95);
  transition: opacity 0.6s ease, filter 0.8s ease, transform 0.8s var(--ease);
  pointer-events: none;
}
@media (hover: hover) {
  .p-next:hover img { opacity: 1; filter: blur(0); transform: translate(-50%, -50%); }
}

.not-found {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 20px;
  text-align: center;
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(247, 246, 242, 0.94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: calc(100vw - 180px);
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
}
.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.28);
  color: #fff;
  transition: background-color 0.2s ease;
}
.lightbox__btn:hover { background: rgba(17, 17, 17, 0.6); }
.lightbox__btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.lightbox__close { top: var(--edge); right: var(--edge); }
.lightbox__prev { left: var(--edge); top: 50%; transform: translateY(-50%); }
.lightbox__next { right: var(--edge); top: 50%; transform: translateY(-50%); }
.lightbox__count { position: absolute; bottom: calc(var(--edge) + 8px); left: 50%; transform: translateX(-50%); color: var(--ink); }

/* ==========================================================================
   Info
   ========================================================================== */

.about {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* the portrait stays put while the text column scrolls */
.about__media {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.04);
}
.about__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(var(--zoom, 1.12));
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.4s var(--ease), opacity 0.8s ease;
}
.about.is-in .about__media img { clip-path: inset(0); }

.about__content { padding: 0 6vw 160px; }

.about__head {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 28px;
  min-height: 100vh;
  min-height: 100svh;
  padding-bottom: 120px;
}

.about__name {
  font-family: var(--font-display);
  font-size: clamp(56px, 8.4vw, 150px);
  font-weight: 400;
  line-height: 0.9;
  text-transform: uppercase;
}
.about__name .line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.about__name .line > span { display: block; transform: translateY(105%); transition: transform 1.1s var(--ease) 0.3s; }
.about__name .line + .line > span { transition-delay: 0.42s; }
.about.is-in .about__name .line > span { transform: none; }

.about__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  opacity: 0;
  transition: opacity 0.8s ease 0.9s;
}
.about.is-in .about__meta { opacity: 1; }

.status { display: inline-flex; align-items: center; gap: 8px; }
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3f9b5f;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }

.about__bio {
  max-width: 22em;
  margin-bottom: 140px;
  font-size: clamp(24px, 2.4vw, 38px);
  line-height: 1.22;
}
.about__bio .w { opacity: 0.16; transition: opacity 0.5s ease; }
.about__bio .w.is-lit { opacity: 1; }

/* rows: the rule draws in from the left, then the content fades up */
.row {
  position: relative;
  display: grid;
  grid-template-columns: 10em minmax(0, 1fr);
  gap: 16px;
  padding: 22px 0 56px;
}
.row::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s var(--ease);
}
.row > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease 0.25s, transform 0.8s var(--ease) 0.25s;
}
.row.is-in::before { transform: scaleX(1); }
.row.is-in > * { opacity: 1; transform: none; }
.row h2 { font-weight: 400; }
.row__body { font-size: 17px; line-height: 1.5; }
.row__body .muted { color: var(--muted); }

/* underline that grows on hover */
.u {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.5s var(--ease);
}
.u:hover, .u:focus-visible { background-size: 100% 1px; }

.email {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  margin-bottom: 12px;
}
/* the font size is set in JS so the address fits its column on one line */
.email .u {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}
.email .u.is-wrapping { white-space: normal; overflow-wrap: anywhere; }
.copy { color: var(--muted); transition: color 0.2s ease; }
.copy:hover { color: var(--fg); }

/* endless strip of client names */
.marquee {
  overflow: hidden;
  padding: 24px 0 80px;
  border-top: 1px solid var(--fg);
}
.marquee__label { padding: 0 var(--edge) 20px; font-weight: 400; }
.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 45s linear infinite;
}
@media (hover: hover) {
  .marquee:hover .marquee__track { animation-play-state: paused; }
}
.marquee__list { display: flex; }
.marquee__list li {
  padding-right: 0.5em;
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 96px);
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}
.marquee__list li::after { content: "/"; padding-left: 0.5em; color: var(--muted); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ==========================================================================
   Credit line
   ========================================================================== */

/* the bottom padding keeps it clear of the fixed navigation */
.credit {
  padding: 0 var(--edge) calc(var(--edge) + 76px);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-align: center;
}
.credit a { transition: color 0.2s ease; }
.credit a:hover { color: var(--fg); }
.credit--home {
  position: absolute;
  left: 0; right: 0;
  bottom: var(--edge);
  padding-bottom: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .projects { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work__grid { --cols: 3; }
  .work__grid[data-size="s"] { --cols: 4; }
  .row { grid-template-columns: 7em minmax(0, 1fr); }
}

/* tablets held upright: the text column is narrow, labels go above */
@media (max-width: 900px) {
  .row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

@media (max-width: 700px), (max-height: 500px) and (orientation: landscape) {
  :root { --edge: 16px; --airy: 7vw; }

  .topbar__name { margin-top: 0; }
  .topbar { grid-template-columns: auto 1fr auto; gap: 12px; }
  .topbar__left { display: none; }
  .topbar__name { justify-self: start; }

  .bottomnav { justify-content: center; }
  .bottomnav__group { display: none; }
  .bottomnav__menu { display: inline-flex; }

  .home__name { font-size: 25vw; line-height: 0.86; }
  .home__pills { inset: auto 0 100px; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 var(--edge); }
  .home__previews { display: none; }

  .work__grid, .work__grid[data-size] { --cols: 2; --gap: 7vw; padding: 90px var(--airy) 80px; }
  .work__grid[data-size="l"] { --cols: 1; }
  .work__grid[data-size="s"] { --cols: 3; --gap: 3vw; }
  .tile.is-expanded { grid-row: auto; }

  .projects { grid-template-columns: minmax(0, 1fr); padding-top: 90px; }

  .p-info { grid-template-columns: minmax(0, 1fr); padding: 56px var(--gutter); }
  .p-info__text, .p-info__details { grid-column: auto; }
  .p-info__text { font-size: 18px; }
  .p-gallery { grid-template-columns: minmax(0, 1fr); }
  .frame.is-single img { width: 100%; }

  .lightbox img { max-width: 100vw; max-height: calc(100vh - 160px); }
  .lightbox__prev, .lightbox__next { top: auto; bottom: var(--edge); transform: none; }
  .lightbox__count { bottom: calc(var(--edge) + 12px); }

  .about { grid-template-columns: minmax(0, 1fr); }
  .about__media { position: relative; height: max(40vh, 100vh - 300px); height: max(40svh, 100svh - 300px); }
  .about__content { padding: 0 var(--gutter) 100px; }
  .about__head { min-height: 0; padding: 40px 0 72px; gap: 20px; }
  .about__name { font-size: 19vw; }
  .about__bio { margin-bottom: 80px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-bottom: 44px; }
  .marquee { padding-bottom: 64px; }
}

/* phones held sideways: wide but very short */
@media (max-height: 500px) and (orientation: landscape) {
  .home__name { font-size: 20vh; }
  .home__pills { inset: 0; justify-content: space-between; padding: 0 5vw; }
  .work__grid[data-size="m"] { --cols: 3; }
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .frame.is-single img { width: calc(50% - var(--gutter) / 2); }
  .about { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about__media { position: sticky; height: 100vh; height: 100svh; }
  .about__name { font-size: 9vw; }
  .lightbox img { max-height: calc(100vh - 110px); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track { flex-wrap: wrap; width: auto; padding: 0 var(--edge); animation: none; }
  .marquee__list[aria-hidden] { display: none; }
  .marquee__list { flex-wrap: wrap; }
  .status::before { animation: none; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
