.portfolio-page {
  --gallery-paper: #eeece7;
  --gallery-surface: #f9f8f5;
  --gallery-ink: #202522;
  --gallery-muted: #5c625d;
  --gallery-rule: #d3d4cd;
  --gallery-accent: #7c683f;
  background: var(--gallery-paper);
  color: var(--gallery-ink);
}

.portfolio-page .site-header { background: var(--black); }
.portfolio-page main { padding-top: 74px; }
.portfolio-hero { display: grid; grid-template-columns: 0.85fr 1.15fr; min-height: min(46rem, 78vh); background: var(--gallery-ink); color: var(--gallery-surface); }
.portfolio-intro { display: flex; flex-direction: column; justify-content: space-between; gap: 3rem; padding: 2rem var(--pad) 1.5rem; }
.portfolio-back { display: inline-flex; align-items: center; gap: 0.75rem; width: fit-content; color: #d6d9d0; font-size: 0.65rem; letter-spacing: 0.06em; }
.portfolio-back:hover { color: white; }
.portfolio-title-group { padding: 1rem 0 2rem; }
.portfolio-title-group .section-label { margin: 0 0 1.5rem; color: #c7b487; }
.portfolio-intro h1 { margin: 0; font-family: var(--serif); font-size: clamp(3.5rem, 5.8vw, 6.5rem); font-weight: 400; line-height: 0.98; letter-spacing: -0.035em; }
.portfolio-intro h1 em { color: #dbd2bf; font-weight: 500; }
.portfolio-lead { margin: 2rem 0; color: #d6d9d0; font-size: 0.8rem; line-height: 1.8; }
.portfolio-browse { display: inline-flex; align-items: center; gap: 2.5rem; padding: 0.75rem 0; border-bottom: 1px solid #8b958a; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.12em; }
.portfolio-browse span { font-size: 1.1rem; }
.portfolio-signature { display: flex; justify-content: space-between; gap: 1rem; margin: 0; padding-top: 1.5rem; border-top: 1px solid #495149; color: #bec4ba; font-size: 0.58rem; letter-spacing: 0.04em; }
.portfolio-cover { position: relative; min-width: 0; margin: 0; background: var(--limestone); overflow: hidden; }
.portfolio-cover > img { display: block; width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: 48% center; }
.portfolio-cover figcaption { position: absolute; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.5rem 2rem; background: var(--gallery-surface); color: var(--gallery-ink); }
.portfolio-cover figcaption div > span { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--gallery-muted); }
.portfolio-cover figcaption p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.portfolio-cover figcaption a { display: inline-flex; align-items: center; gap: 1.25rem; font-size: 0.62rem; white-space: nowrap; }
.project-directory { padding: 3rem var(--pad); background: var(--gallery-surface); scroll-margin-top: 74px; }
.directory-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.directory-heading h2 { margin: 0; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; }
.directory-heading p { margin: 0; font-size: 0.68rem; color: var(--gallery-muted); }
.project-index { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.5rem; }
.project-index a { display: block; min-width: 0; white-space: normal; text-transform: none; letter-spacing: normal; }
.index-image { position: relative; background: var(--limestone); overflow: hidden; }
.index-image img { display: block; width: 100%; height: auto; aspect-ratio: 1.6; object-fit: cover; transition: transform 0.4s; }
.index-image > span { position: absolute; right: 0; bottom: 0; width: 2rem; height: 2rem; display: grid; place-items: center; background: var(--gallery-surface); font-size: 1rem; }
.project-index a:hover img { transform: scale(1.04); }
.index-type { display: block; margin: 0.75rem 0 0.25rem; color: var(--gallery-muted); font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.1em; }
.index-title { display: block; font-size: 0.8rem; font-weight: 600; line-height: 1.5; }
.project-collections { max-width: 100rem; margin: 0 auto; padding: 0 var(--pad); }
.project-collection { padding: 5rem 0 3rem; border-bottom: 1px solid var(--gallery-rule); scroll-margin-top: 74px; }
.project-collection:last-child { border: 0; padding-bottom: 5rem; }
.collection-heading { display: grid; grid-template-columns: 1.2fr 1fr; gap: 4rem; align-items: end; margin-bottom: 2rem; }
.collection-heading .project-no { color: var(--gallery-accent); font-size: 0.6rem; font-weight: 600; letter-spacing: 0.16em; }
.collection-heading h2 { margin: 0.5rem 0 0; font-family: var(--serif); font-size: clamp(2.5rem, 4.5vw, 4.5rem); font-weight: 500; line-height: 1.05; letter-spacing: -0.025em; }
.collection-heading p { max-width: 34rem; margin: 0 0 1rem; color: var(--gallery-muted); font-size: 0.8rem; line-height: 1.8; }
.photo-count { display: inline-block; padding-left: 0.75rem; border-left: 2px solid var(--gold); color: var(--gallery-ink); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; }
.collection-preview { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 1.25rem; align-items: start; }
.project-collection figure { margin: 0; min-width: 0; }
.collection-preview figure:nth-child(2) { padding-top: 3rem; }
.collection-preview figure:nth-child(3) { padding-top: 1.5rem; }
.gallery-photo { position: relative; display: block; overflow: hidden; background: var(--limestone); }
.gallery-photo img { display: block; width: 100%; height: auto; transition: transform 0.45s; }
.collection-preview .gallery-photo img { aspect-ratio: 3 / 4; object-fit: cover; }
.gallery-photo:hover img { transform: scale(1.025); }
.gallery-photo > span { position: absolute; right: 0.75rem; bottom: 0.75rem; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; background: var(--gallery-surface); color: var(--gallery-ink); font-size: 1.1rem; }
.project-collection figcaption { padding-top: 0.75rem; color: var(--gallery-muted); font-size: 0.65rem; line-height: 1.5; }
.collection-landscape .collection-preview { grid-template-columns: 1.8fr 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); height: clamp(30rem, 45vw, 44rem); align-items: stretch; }
.collection-landscape .collection-preview figure { display: grid; grid-template-rows: minmax(0, 1fr) auto; padding-top: 0; min-height: 0; }
.collection-landscape .collection-preview figure:first-child { grid-row: 1 / 3; }
.collection-landscape .collection-preview .gallery-photo { height: 100%; }
.collection-landscape .collection-preview img { height: 100%; aspect-ratio: auto; }
#kitchen-remodel .collection-preview figure:nth-child(2) img { object-position: center 58%; }
.collection-more { margin-top: 2rem; }
.collection-more summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 3.5rem; width: fit-content; min-width: min(19rem, 100%); border: 1px solid var(--gallery-rule); padding: 0.5rem 1.25rem; background: var(--gallery-surface); cursor: pointer; list-style: none; }
.collection-more summary::-webkit-details-marker { display: none; }
.summary-label { font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
.summary-icon { font-size: 1.4rem; font-weight: 400; }
.collection-more summary:hover { border-color: var(--gallery-accent); }
.collection-more[open] .summary-icon { transform: rotate(45deg); }
.collection-grid { columns: 3; column-gap: 1.25rem; padding-top: 2rem; }
.collection-grid figure { break-inside: avoid; margin-bottom: 1.5rem; }
.back-to-projects { display: block; width: fit-content; margin: 1.5rem 0 0 auto; color: var(--gallery-muted); font-size: 0.6rem; letter-spacing: 0.04em; }
.back-to-projects:hover { color: var(--gallery-accent); }
.project-film { display: grid; grid-template-columns: 0.65fr 1.35fr; gap: clamp(2rem, 4vw, 4rem); align-items: start; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--gallery-rule); scroll-margin-top: 90px; }
.project-film-copy .project-no { color: var(--gallery-accent); font-size: 0.6rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.project-film h3 { margin: 0.75rem 0 1rem; font-family: var(--serif); font-size: clamp(2rem, 3.5vw, 3.5rem); font-weight: 500; line-height: 1.1; letter-spacing: -0.025em; }
.project-film-copy p { max-width: 22rem; margin: 0; color: var(--gallery-muted); font-size: 0.8rem; line-height: 1.8; }
.project-film video { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: var(--gallery-ink); }
.project-film figcaption a { text-decoration: underline; text-underline-offset: 3px; }
.project-film figcaption a:hover { color: var(--gallery-ink); }
.portfolio-contact { display: grid; grid-template-columns: 1fr 1fr; background: var(--gallery-ink); color: var(--gallery-surface); }
.portfolio-contact-image { min-height: 28rem; position: relative; }
.portfolio-contact-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portfolio-contact-copy { padding: 4rem var(--pad); align-self: center; }
.portfolio-contact-copy .section-label { color: #c7b487; }
.portfolio-contact h2 { margin: 1.5rem 0; font-family: var(--serif); font-size: clamp(2.5rem, 4vw, 4.5rem); font-weight: 400; line-height: 1; letter-spacing: -0.025em; }
.portfolio-contact h2 em { color: #dbd2bf; font-weight: 500; }
.portfolio-contact-copy > p:not(.section-label) { max-width: 26rem; margin: 0 0 2rem; color: #d6d9d0; font-size: 0.8rem; line-height: 1.8; }
.viewer-open { overflow: hidden; }
.photo-viewer { position: fixed; inset: 0; width: min(96vw, 90rem); max-width: none; max-height: 96dvh; padding: 1.5rem; border: 1px solid #495149; background: var(--gallery-ink); color: var(--gallery-surface); }
.photo-viewer::backdrop { background: rgba(12, 16, 13, 0.95); }
.viewer-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-bottom: 1rem; }
.viewer-toolbar p, #viewer-caption { font-size: 0.75rem; }
.photo-viewer button { cursor: pointer; border: 1px solid #7e897d; background: transparent; color: var(--gallery-surface); min-width: 44px; min-height: 44px; padding: 0.5rem 0.75rem; }
.photo-viewer button:hover { background: #394038; }
.viewer-stage { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1rem; }
#viewer-image { width: 100%; height: min(72dvh, 58rem); object-fit: contain; }
#viewer-caption { text-align: center; color: #d6d9d0; }
.portfolio-page :focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }
@media (max-width: 1100px) {
  .portfolio-intro { padding-right: 2rem; }
  .portfolio-signature { flex-direction: column; gap: 0.25rem; }
  .project-index { gap: 1rem; }
}
@media (max-width: 900px) {
  .portfolio-hero { grid-template-columns: 1fr 1fr; min-height: 36rem; }
  .portfolio-intro h1 { font-size: 4rem; }
  .portfolio-cover figcaption { align-items: flex-start; flex-direction: column; padding: 1.25rem; }
  .project-index { position: static; inset: auto; padding: 0; border: 0; background: transparent; }
  .project-index a { font-size: 0.8rem; }
  .collection-heading { gap: 2rem; }
  .collection-landscape .collection-preview { height: 30rem; }
}
@media (max-width: 768px) {
  .project-film { grid-template-columns: 1fr; gap: 1.5rem; margin-top: 2rem; }
  .portfolio-hero { grid-template-columns: 1fr; }
  .portfolio-intro { padding: 1.5rem var(--pad); gap: 2rem; }
  .portfolio-title-group { padding: 0; }
  .portfolio-intro h1 { font-size: clamp(3.5rem, 9vw, 5rem); }
  .portfolio-lead { margin: 1.5rem 0; }
  .portfolio-signature { flex-direction: row; }
  .portfolio-cover { min-height: 25rem; }
  .portfolio-cover figcaption { flex-direction: row; align-items: center; padding: 1.25rem var(--pad); }
  .project-directory { padding-top: 2rem; padding-bottom: 2rem; }
  .directory-heading { display: block; }
  .directory-heading p { margin-top: 0.5rem; }
  .project-index { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem 1rem; }
  .collection-heading { grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.5rem; }
  .collection-heading p { margin-bottom: 0.75rem; }
  .project-collection { padding-top: 3rem; }
  .collection-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .collection-preview figure:first-child { grid-column: 1 / -1; }
  .collection-preview figure:first-child .gallery-photo { max-height: 36rem; }
  .collection-preview figure:first-child img { aspect-ratio: 1; object-position: center; }
  .collection-preview figure:nth-child(2), .collection-preview figure:nth-child(3) { padding-top: 0; }
  .collection-landscape .collection-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto; height: auto; }
  .collection-landscape .collection-preview figure:first-child { grid-row: auto; }
  .collection-landscape .collection-preview .gallery-photo { height: auto; }
  .collection-landscape .collection-preview figure:first-child img { aspect-ratio: 1.4; height: auto; }
  .collection-landscape .collection-preview img { aspect-ratio: 1; height: auto; }
  .collection-grid { columns: 2; }
  .portfolio-contact { grid-template-columns: 1fr; }
  .portfolio-contact-image { min-height: 18rem; }
  .portfolio-contact-copy { padding: 3rem var(--pad); }
  .photo-viewer { padding: 1rem; }
  .viewer-stage { gap: 0.5rem; }
}
@media (max-width: 600px) {
  .portfolio-page main { padding-top: 64px; }
  .portfolio-page .site-header nav { top: 64px; }
  .project-directory, .project-collection { scroll-margin-top: 64px; }
}
@media (max-width: 400px) {
  .portfolio-signature { font-size: 0.5rem; gap: 0.5rem; }
  .portfolio-cover { min-height: 20rem; }
  .portfolio-cover figcaption { padding: 1rem; }
  .portfolio-cover figcaption a { font-size: 0.58rem; gap: 0.5rem; }
  .project-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-grid { columns: 1; }
  .viewer-stage { position: relative; grid-template-columns: 1fr; }
  .viewer-prev, .viewer-next { position: absolute; bottom: 0.5rem; z-index: 1; background: var(--gallery-ink) !important; }
  .viewer-prev { left: 0; }
  .viewer-next { right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-photo img, .index-image img { transition: none; }
}
