/* peterbarwis.com — artisan + grit */
:root {
  --ink: #14120f;          /* warm near-black wall */
  --ink-2: #1c1915;
  --ink-3: #26221d;
  --bone: #e9e3d6;         /* paper / text */
  --bone-dim: #a8a092;
  --bone-faint: #6f685d;
  --rust: #b5562c;
  --rust-hi: #d06a3a;
  --rule: rgba(233, 227, 214, .16);
  --rule-strong: rgba(233, 227, 214, .34);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  --gap: clamp(10px, 1.6vw, 22px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font: 400 17px/1.6 var(--serif);
  font-variation-settings: "SOFT" 50, "opsz" 14;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
/* Film grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: .085;
  background-image: url("grain.svg");
  background-size: 220px 220px;
  animation: grain 1.1s steps(6) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-4%, 3%); }
  40%  { transform: translate(3%, -5%); }
  60%  { transform: translate(-6%, -2%); }
  80%  { transform: translate(5%, 4%); }
  100% { transform: translate(0, 0); }
}
/* Vignette */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(0,0,0,.45) 100%);
}

a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
::selection { background: var(--rust); color: var(--bone); }
:focus-visible { outline: 1px solid var(--rust-hi); outline-offset: 3px; }

.mono, .kicker, .lb-caption, .colophon, .nav, .nav-about, .frame-no, .meta {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.small { font-size: 11px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--bone); color: var(--ink); padding: 6px 10px; z-index: 200; }
.skip:focus { left: 8px; }

/* ------------------------------------------------ masthead */
.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: baseline;
  gap: 28px;
  padding: 18px var(--gutter);
  transition: background .4s ease, border-color .4s ease;
  border-bottom: 1px solid transparent;
}
.masthead.is-solid {
  background: rgba(20, 18, 15, .92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-bottom-color: var(--rule);
}
.wordmark {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  font-style: italic;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 72;
  text-decoration: none;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.nav { display: flex; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.nav a, .nav-about { text-decoration: none; color: var(--bone-dim); padding: 4px 0; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.nav a:hover, .nav-about:hover { color: var(--bone); }
.nav a[aria-current], .nav-about[aria-current] { color: var(--bone); border-bottom-color: var(--rust); }
@media (max-width: 760px) {
  .masthead { flex-wrap: wrap; gap: 6px 18px; padding-top: 14px; padding-bottom: 10px; }
  .wordmark { font-size: 19px; }
  .nav { order: 3; width: 100%; margin-left: 0; gap: 16px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .nav-about { margin-left: auto; }
}

main { flex: 1; outline: none; }
.loading { padding: 40vh var(--gutter); text-align: center; font-family: var(--mono); color: var(--bone-faint); letter-spacing: .2em; text-transform: uppercase; font-size: 12px; }

/* ------------------------------------------------ hero */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  background: var(--ink-2);
}
.hero picture, .hero img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero img { object-fit: cover; animation: develop 2.4s ease-out both; }
@keyframes develop {
  from { opacity: 0; filter: brightness(1.6) contrast(.6) sepia(.4); transform: scale(1.04); }
  to   { opacity: 1; filter: none; transform: scale(1); }
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(20,18,15,.55) 0%, transparent 22%, transparent 55%, rgba(20,18,15,.92) 100%);
}
.hero-text {
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  right: var(--gutter);
  bottom: clamp(28px, 7vh, 72px);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 18px;
}
.display {
  font-family: var(--serif);
  font-weight: 340;
  font-variation-settings: "SOFT" 30, "WONK" 1, "opsz" 144;
  letter-spacing: -.025em;
  line-height: .92;
  margin: 0;
}
.hero h1 { font-size: clamp(54px, 11vw, 168px); }
.hero h1 em { font-style: italic; font-weight: 300; color: var(--bone); }
.hero .kicker { color: var(--bone-dim); margin: 0 0 14px; }
.hero-credit { text-align: right; color: var(--bone-dim); }
.hero-credit a { text-decoration: none; border-bottom: 1px solid var(--rule-strong); }
.hero-credit a:hover { border-color: var(--rust); color: var(--bone); }
@media (max-width: 760px) {
  .hero-text { grid-template-columns: 1fr; }
  .hero-credit { text-align: left; }
}

/* ------------------------------------------------ section headings */
.section { padding: clamp(56px, 9vw, 120px) var(--gutter) 0; }
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 24px 48px;
  align-items: end;
  padding-bottom: 22px;
  margin-bottom: clamp(24px, 4vw, 48px);
  border-bottom: 1px solid var(--rule-strong);
  position: relative;
}
.section-head::after { /* second, offset rule: hand-ruled feel */
  content: "";
  position: absolute;
  left: 0; right: 18%;
  bottom: -5px;
  border-bottom: 1px solid var(--rule);
}
.section-head h2, .page-title {
  font-size: clamp(40px, 7vw, 96px);
}
.section-head .lede { color: var(--bone-dim); margin: 0; max-width: 46ch; font-size: 17px; }
.section-head .kicker { margin: 0 0 12px; color: var(--rust-hi); }
@media (max-width: 760px) { .section-head { grid-template-columns: 1fr; } }

.crumbs { margin: 0 0 14px; color: var(--bone-faint); }
.crumbs a { color: var(--bone-dim); text-decoration: none; }
.crumbs a:hover { color: var(--bone); }

.page-top { padding-top: clamp(110px, 16vw, 170px); }

/* ------------------------------------------------ collection index (home) */
.index { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: clamp(28px, 4vw, 56px) var(--gap); }
.card { text-decoration: none; display: block; }
.card-print {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--ink-3);
}
.card.is-wide .card-print { aspect-ratio: 3 / 2; }
.card-print img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(.2,.7,.2,1), filter .6s; filter: saturate(.92) contrast(1.02); }
.card:hover .card-print img { transform: scale(1.035); filter: none; }
/* registration marks on the corners */
.card-print::before, .card-print::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  z-index: 2;
  border-color: var(--bone);
  border-style: solid;
  opacity: 0;
  transition: opacity .3s, transform .3s;
}
.card-print::before { top: 10px; left: 10px; border-width: 1px 0 0 1px; transform: translate(4px, 4px); }
.card-print::after { bottom: 10px; right: 10px; border-width: 0 1px 1px 0; transform: translate(-4px, -4px); }
.card:hover .card-print::before, .card:hover .card-print::after,
.card:focus-visible .card-print::before, .card:focus-visible .card-print::after { opacity: .9; transform: none; }
.card-label { display: flex; align-items: baseline; gap: 14px; padding-top: 14px; border-top: 1px solid var(--rule); margin-top: 14px; }
.card-label .frame-no { color: var(--rust-hi); }
.card-label h3 { margin: 0; font-weight: 400; font-size: 28px; line-height: 1.1; letter-spacing: -.01em; font-variation-settings: "SOFT" 60, "opsz" 48; }
.card-label .meta { margin-left: auto; color: var(--bone-faint); white-space: nowrap; }
.card:hover h3 { font-style: italic; }

/* ------------------------------------------------ series strip */
.series-wrap { margin-bottom: clamp(48px, 7vw, 96px); }
.series-wrap > .kicker { color: var(--bone-faint); margin: 0 0 16px; }
.series { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 28px var(--gap); }
.series .card-print { aspect-ratio: 3 / 2; }
.series .card-label h3 { font-size: 22px; }

/* ------------------------------------------------ wall (masonry) */
.wall { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.wall.is-masonry { grid-auto-rows: 1px; }
@media (min-width: 700px) { .wall { --cols: 2; } }
@media (min-width: 1100px) { .wall { --cols: 3; } }
.wall-head { display: flex; gap: 14px; align-items: baseline; color: var(--bone-faint); margin: 0 0 16px; }
.tile {
  text-decoration: none;
  color: inherit;
  margin: 0 0 var(--gap);
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  text-align: left;
}
.tile-print { position: relative; background: var(--ink-3); overflow: hidden; }
.tile-print img { width: 100%; height: auto; transition: opacity .8s ease, transform 1.2s cubic-bezier(.2,.7,.2,1); opacity: 0; }
.tile-print img.is-loaded { opacity: 1; }
.tile:hover .tile-print img { transform: scale(1.02); }
.tile-meta { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px 0; color: var(--bone-faint); }
.tile:hover .tile-meta .frame-no, .tile:focus-visible .tile-meta .frame-no { color: var(--rust-hi); }

.empty { color: var(--bone-faint); font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; padding: 40px 0; }

.next-up { margin-top: clamp(56px, 8vw, 110px); padding: 28px 0; border-top: 1px solid var(--rule-strong); display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.next-up a { text-decoration: none; }
.next-up .display { font-size: clamp(30px, 5vw, 60px); display: block; margin-top: 6px; }
.next-up a:hover .display { font-style: italic; color: var(--rust-hi); }
.next-up .prev { text-align: left; }
.next-up .next { text-align: right; margin-left: auto; }

/* ------------------------------------------------ footer */
.colophon {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: clamp(64px, 10vw, 140px);
  padding: 22px var(--gutter) 28px;
  border-top: 1px solid var(--rule);
  color: var(--bone-faint);
  font-size: 11px;
}

/* ------------------------------------------------ lightbox */
body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(12, 11, 9, .97);
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  opacity: 0;
  transition: opacity .35s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.is-visible { opacity: 1; }
.lb-figure { grid-column: 2; margin: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: 64px 0 18px; min-width: 0; }
.lb-frame { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.lb-frame picture { display: contents; }
.lb-frame img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 30px 80px rgba(0,0,0,.6); transition: opacity .35s ease; }
.lb-frame img.is-loading { opacity: .25; }
.lb-caption { display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: center; align-items: baseline; padding-top: 16px; color: var(--bone-dim); font-size: 11px; text-align: center; }
.lb-no { color: var(--rust-hi); }
.lb-exif { color: var(--bone-faint); }
.lb-nav, .lb-close { background: none; border: 0; cursor: pointer; color: var(--bone-dim); transition: color .2s; }
.lb-nav { font-family: var(--mono); font-size: 26px; height: 100%; width: 100%; }
.lb-nav:hover, .lb-close:hover { color: var(--bone); }
.lb-close { position: absolute; top: 16px; right: var(--gutter); font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; z-index: 2; padding: 6px 0; }
@media (max-width: 760px) {
  .lightbox:not([hidden]) { display: block; }
  .lb-nav { position: absolute; bottom: 10px; width: 56px; height: 44px; z-index: 2; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .lb-figure { padding: 56px 12px 64px; width: 100%; }
}

/* ------------------------------------------------ about */
.about { padding: clamp(120px, 18vw, 200px) var(--gutter) 0; }
.about-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px clamp(32px, 6vw, 96px); align-items: start; max-width: 1280px; }
.about-head .kicker { color: var(--rust-hi); margin: 0 0 18px; }
.about-head h1 { font-size: clamp(42px, 6.5vw, 92px); }
.about-body { padding-top: 12px; border-top: 1px solid var(--rule-strong); font-size: 19px; color: var(--bone); }
.about-body p { margin: 1em 0; max-width: 52ch; }
.about-body p:first-child::first-letter { font-size: 3.4em; float: left; line-height: .8; padding: 6px 10px 0 0; color: var(--rust-hi); font-style: italic; }
.about-body .mono { color: var(--bone-dim); }
.about-portrait { margin: 8px 0 0; grid-column: 1 / -1; max-width: 760px; }
.about-portrait img { display: block; width: 100%; height: auto; border: 1px solid var(--rule-strong); }
.about-portrait figcaption { margin-top: 10px; color: var(--bone-faint); letter-spacing: .06em; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .tile-print img { opacity: 1; }
}
.lede.is-count { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--bone-faint); }
.wall.is-masonry .tile { margin: 0; }
