/* Richard Feifer — portfolio
   A quiet gallery: gray wall, one type family (Archivo), the work does the talking. */

:root {
  --wall: #E7E8E4;
  --placard: #F7F7F4;
  --ink: #1C1F24;
  --pencil: #5C6068;
  --line: #CDCFCA;
  --cobalt: #2B45C8;

  --gutter: clamp(16px, 4vw, 56px);
  --measure: 34em;
  --row: 175px;      /* base hanging height for the wall */
  --feature: 1.7;    /* how much larger a featured piece hangs */
  --gap-x: clamp(16px, 2.6vw, 40px);
  --gap-y: clamp(28px, 4vw, 56px);

  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--cobalt); }

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 3px;
}

h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0; }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 20;
  padding: 0.6em 1em;
  background: var(--ink);
  color: var(--wall);
}
.skip:focus { top: 12px; }

/* ---------- Top bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--wall) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 0.9375rem;
}

.bar__name {
  font-weight: 750;
  font-stretch: 112%;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
}
.bar.is-scrolled .bar__name { opacity: 1; }

.bar__nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 32px); }
.bar__nav a { text-decoration: none; }
.bar__nav a:hover { text-decoration: underline; }

.bar__resume {
  padding: 0.35em 0.85em;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.bar__resume:hover { background: var(--ink); color: var(--wall); text-decoration: none !important; }
.bar__ext { font-size: 0.75em; font-weight: 500; color: var(--pencil); }
.bar__resume:hover .bar__ext { color: inherit; }

/* ---------- Title wall ---------- */

.title-wall {
  padding: clamp(40px, 9vh, 120px) var(--gutter) clamp(56px, 11vh, 140px);
}

.title-wall__name {
  font-size: clamp(3.25rem, 9.4vw, 11rem);
  font-weight: 820;
  font-stretch: 125%;
  line-height: 0.86;
  letter-spacing: -0.015em;
  margin-left: -0.04em;
  animation: hang 1.4s cubic-bezier(0.2, 0.7, 0.1, 1) 0.1s both;
}

/* A small portrait hung on the name's baseline, one cap-height tall. */
.title-wall__portrait {
  display: inline-block;
  height: 0.72em;
  width: 0.576em;
  max-width: none;
  margin-left: 0.14em;
  vertical-align: baseline;
  object-fit: cover;
  object-position: 50% 32%;
  background: var(--placard);
}

@keyframes hang {
  from { font-stretch: 62%; font-weight: 250; letter-spacing: 0.04em; }
  to   { font-stretch: 125%; font-weight: 820; letter-spacing: -0.015em; }
}

.title-wall__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 2rem var(--gap-x);
  margin-top: clamp(32px, 6vh, 72px);
  padding-top: 20px;
  border-top: 1.5px solid var(--ink);
}

.title-wall__role {
  font-weight: 600;
  line-height: 1.35;
}

.title-wall__intro {
  max-width: var(--measure);
  font-size: clamp(1.125rem, 1.5vw, 1.3125rem);
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-top: 1.75rem;
  font-size: 1rem;
}

.button {
  display: inline-block;
  padding: 0.8em 1.4em;
  background: var(--ink);
  color: var(--wall);
  border-radius: 999px;
  font-weight: 650;
  text-decoration: none;
}
.button:hover { background: var(--cobalt); color: #fff; }

.link { font-weight: 500; }

/* ---------- The wall ---------- */

.work { padding: 0 var(--gutter) clamp(72px, 12vh, 160px); }

.work__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: clamp(24px, 4vw, 48px);
}
.work__head h2 { font-size: 1.3125rem; font-stretch: 112%; }
.work__head p { color: var(--pencil); font-size: 0.9375rem; }

/* Justified "salon hang": every piece keeps its true proportions, rows fill the wall,
   featured pieces hang larger. Width ∝ aspect ratio, so heights match within a row. */
.wall {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--gap-y) var(--gap-x);
}
.wall::after { content: ""; flex: 9999 1 0; }

.piece {
  --scale: 1;
  margin: 0;
  flex: calc(var(--ar) * var(--scale)) 1 calc(var(--ar) * var(--scale) * var(--row));
  min-width: 0;
}
.piece--feature { --scale: var(--feature); }

.piece a {
  display: block;
  cursor: zoom-in;
  background: var(--placard);
}
.piece img {
  width: 100%;
  box-shadow: 0 0 0 1px rgb(28 31 36 / 0.06);
}
/* With a mouse or trackpad, a piece steps forward off the wall on hover (and on keyboard focus). */
@media (hover: hover) and (pointer: fine) {
  .piece { position: relative; }
  .piece img {
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s ease;
  }
  .piece:hover, .piece:focus-within { z-index: 2; }
  .piece a:hover img, .piece a:focus-visible img {
    transform: scale(1.08);
    box-shadow: 0 0 0 1px rgb(28 31 36 / 0.06), 0 22px 44px -22px rgb(28 31 36 / 0.5);
  }
}

.piece figcaption {
  margin-top: 10px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--pencil);
  max-width: 40em;
}
.piece figcaption strong { color: var(--ink); font-weight: 650; }

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
  padding: clamp(64px, 10vh, 120px) var(--gutter);
  background: var(--placard);
}

.about__portrait { position: sticky; top: 96px; }
.portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 40%;
  background: #EDEDEA;
}

.about__text { max-width: var(--measure); }
.about__text h2 { font-size: 1.3125rem; font-stretch: 112%; margin-bottom: 1.5rem; }
.about__text p + p { margin-top: 1em; }

.about__lede {
  font-size: clamp(1.625rem, 2.8vw, 2.375rem);
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
}

.facts {
  display: grid;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
}
.facts h3 { font-size: 0.9375rem; margin-bottom: 0.25rem; }
.facts p { color: var(--pencil); }

/* ---------- Contact ---------- */

.contact {
  padding: clamp(72px, 12vh, 160px) var(--gutter) clamp(48px, 8vh, 96px);
}
.contact h2 {
  font-size: clamp(2.5rem, 7vw, 6.5rem);
  font-weight: 820;
  font-stretch: 125%;
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.contact__list {
  list-style: none;
  margin: clamp(28px, 4vw, 48px) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem clamp(24px, 4vw, 56px);
  font-size: clamp(1.125rem, 1.8vw, 1.5rem);
  font-weight: 550;
}

.footer {
  padding: 24px var(--gutter) 32px;
  border-top: 1px solid var(--line);
  color: var(--pencil);
  font-size: 0.8125rem;
}

/* ---------- Viewer ---------- */

.viewer {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: clamp(16px, 3vw, 40px);
  border: 0;
  background: var(--placard);
  color: var(--ink);
}
.viewer[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 24px;
}
.viewer::backdrop { background: var(--placard); }

.viewer__stage {
  grid-column: 1 / -1;
  position: relative;
  min-height: 0;
}
.viewer__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}

.viewer__label { align-self: center; font-size: 0.9375rem; line-height: 1.4; }
.viewer__brand { font-weight: 650; }
.viewer__meta { display: flex; gap: 1.25em; color: var(--pencil); font-size: 0.8125rem; margin-top: 2px; }

.viewer__controls { display: flex; gap: 8px; align-self: center; }
.viewer__btn {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.55em 1.1em;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.viewer__btn:hover { background: var(--ink); color: var(--placard); }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  :root { --row: 160px; --feature: 1.5; }
}

@media (max-width: 860px) {
  .title-wall__body { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .about__portrait { position: static; max-width: 420px; }
}

@media (max-width: 640px) {
  :root { --row: 96px; --feature: 1.9; --gap-x: 12px; --gap-y: 24px; }
  .piece figcaption { font-size: 0.75rem; margin-top: 6px; }
  .title-wall__name { font-size: 18.5vw; }
  .title-wall__portrait { height: 1em; width: 0.8em; margin-left: 0.18em; }
  .bar__nav a:not(.bar__resume) { display: none; }
  .bar__name { opacity: 1; }
  .viewer[open] { grid-template-columns: 1fr; }
  .viewer__controls { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .title-wall__name { animation: none; }
  .bar__name { transition: none; }
  .piece img { transition: none; }
  .piece a:hover img, .piece a:focus-visible img { transform: none; }
}
