:root {
  --ink: #222;
  --paper: #fff;
  --paper-strong: #f2f2f2;
  --line: #e1e1e1;
  --muted: #666;
  --accent: #b89254;
  --white: #fff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 500 14px/1.6 "Open Sans", Arial, sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 6px clamp(18px, 5vw, 72px);
  border-bottom: 1px solid #efefef;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 1px 8px rgba(0, 0, 0, .04);
  backdrop-filter: blur(10px);
}

.site-header.compact {
  position: static;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: invert(1);
}

.brand span {
  max-width: none;
  color: #555;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.brand strong {
  color: #222;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.back-to-site {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  border: 1px solid #333;
  border-radius: 2px;
  padding: 9px 15px;
  color: #333;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}

.back-to-site:hover,
.back-to-site:focus-visible {
  background: #222;
  color: #fff;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

nav a {
  text-decoration: none;
}

main {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 42px clamp(16px, 4vw, 58px) 72px;
}

.intro {
  padding: 6px 0 28px;
}

.eyebrow {
  margin: 0 0 9px;
}

h1 {
  margin: 0;
  color: #222;
  font: 500 clamp(38px, 5vw, 68px)/1.02 "Open Sans", Arial, sans-serif;
  letter-spacing: 0;
}

.search-panel {
  position: sticky;
  top: 64px;
  z-index: 15;
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr);
  align-items: center;
  gap: 14px;
  margin: 0 0 30px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .04);
  backdrop-filter: blur(10px);
}

.search-panel label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-panel input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #d6d6d6;
  border-radius: 2px;
  background: var(--white);
  padding: 12px 14px;
  color: var(--ink);
  outline-color: var(--accent);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 28px 18px;
  align-items: start;
}

.portrait-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.portrait-card:hover img,
.portrait-card:focus-visible img {
  filter: contrast(1.04);
  transform: translateY(-2px);
}

.portrait-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.portrait-image {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 0;
  background: var(--paper-strong);
}

.portrait-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .18s ease, filter .18s ease;
}

.portrait-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.portrait-copy strong {
  overflow-wrap: anywhere;
  color: #333;
  font: 600 15px/1.25 "Open Sans", Arial, sans-serif;
}

.portrait-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.empty {
  margin: 50px 0;
  color: var(--muted);
  text-align: center;
}

.viewer {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  border: 0;
  padding: 0;
  background: #14120f;
  color: white;
}

.viewer::backdrop {
  background: #14120f;
}

.viewer[open] {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
}

.viewer figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 28px 0;
}

.viewer img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.viewer figcaption {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 0 18px 10px;
  color: #e7dfd1;
  text-align: center;
}

.viewer figcaption strong {
  font: 700 24px/1.1 Georgia, serif;
}

.viewer figcaption span,
.viewer figcaption a {
  color: #bdb4a6;
  font-size: 13px;
}

.viewer button {
  border: 0;
  background: transparent;
  color: white;
  cursor: pointer;
}

.viewer-close {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  font-size: 36px;
  line-height: 1;
}

.viewer-prev,
.viewer-next {
  width: 72px;
  height: 100%;
  font-size: 58px;
}

.detail {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 420px);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  min-height: calc(100vh - 86px);
}

.detail figure {
  min-height: 0;
  margin: 0;
}

.detail img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
}

.detail-copy {
  border-left: 1px solid var(--line);
  padding-left: 28px;
}

.detail-copy h1 {
  font-size: clamp(40px, 6vw, 76px);
}

dl {
  display: grid;
  gap: 14px;
  margin: 24px 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
  font: 700 20px/1.2 Georgia, serif;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border: 1px solid var(--ink);
  border-radius: 5px;
  padding: 10px 16px;
  background: var(--ink);
  color: white;
  text-decoration: none;
}

@media (max-width: 760px) {
  .site-header {
    align-items: center;
    padding: 15px;
  }

  .brand img {
    width: 42px;
    height: 42px;
  }

  .brand span {
    display: none;
  }

  .back-to-site {
    min-height: 40px;
    padding: 8px 11px;
    font-size: 12px;
  }

  nav {
    gap: 10px;
    font-size: 13px;
  }

  main {
    padding: 24px 13px 48px;
  }

  .intro,
  .detail {
    grid-template-columns: 1fr;
  }

  .intro {
    gap: 20px;
  }

  .search-panel {
    top: 58px;
    grid-template-columns: 1fr;
    gap: 6px 10px;
  }

  .search-panel label {
    grid-column: auto;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
  }

  .portrait-copy strong {
    font-size: 15px;
  }

  .viewer[open] {
    grid-template-columns: 42px 1fr 42px;
  }

  .viewer-prev,
  .viewer-next {
    width: 42px;
    font-size: 42px;
  }

  .viewer figure {
    padding: 52px 0 20px;
  }

  .viewer figcaption {
    align-items: center;
    flex-direction: column;
    gap: 5px;
  }

  .viewer figcaption strong {
    font-size: 20px;
  }

  .detail-copy {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 22px 0 0;
  }
}
