html { scroll-behavior: smooth; }
body.portfolio-page { overflow-x: hidden; overflow-y: auto; background: #deddd8; color: #151614; }
.portfolio-page .site-header { position: fixed; z-index: 30; background: #deddd8; }
.portfolio-page .header-link[aria-current] { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.portfolio-page h1 { font-size: clamp(32px, 3.4vw, 60px); font-weight: 400; text-align: left; letter-spacing: -.025em; }
.collection { position: relative; }
.gallery-stage { position: sticky; top: 0; height: 100svh; min-height: 500px; overflow: hidden; }
.collection-intro { position: absolute; top: 145px; left: 4vw; right: 4vw; display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.collection-total { font-size: 12px; letter-spacing: .05em; }
.gallery-track { display: grid; grid-auto-flow: column dense; grid-template-rows: repeat(2, minmax(0, 1fr)); grid-auto-columns: clamp(280px, 28vw, 540px); gap: 1px; position: absolute; top: 110px; bottom: 0; left: 0; width: max-content; padding: 0; background: #f2f1ed; will-change: transform; }
.work-card { position: relative; min-width: 0; min-height: 0; width: 100%; height: 100%; margin: 0; }
.work-card.is-large { grid-row: span 2; }
.work-cover { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: #cbc9c2; color: white; cursor: pointer; overflow: hidden; }
.work-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .75s cubic-bezier(.22,1,.36,1); }
.work-cover:hover img { transform: scale(1.035); }
.work-cover:focus-visible { outline: 2px solid #161714; outline-offset: 6px; }
.media-count { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 7px; align-items: center; padding: 6px 9px; background: #0008; font-size: 11px; line-height: 1.2; pointer-events: none; }
.media-count svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.3; }
.work-card figcaption { display: none; }
.work-card figcaption span:last-child { opacity: .6; }
.gallery-footer { display: none; }
.scroll-instruction { white-space: nowrap; }
.gallery-progress { height: 1px; background: #17181426; flex: 1; overflow: hidden; }
.gallery-progress span { display: block; height: 100%; background: #171814; width: 100%; transform: scaleX(0); transform-origin: left; }
.gallery-position { min-width: 30px; text-align: right; }
body.viewer-open { overflow: hidden; }
.work-viewer { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; padding: 0; margin: 0; border: 0; background: transparent; color: #f0efeb; overflow: hidden; opacity: 0; transition: opacity .4s ease; }
.work-viewer.is-open { opacity: 1; }
.work-viewer::backdrop { background: #000; opacity: 0; transition: opacity .5s ease; }
.work-viewer.is-open::backdrop { opacity: 1; }
.work-viewer.is-closing .viewer-top, .work-viewer.is-closing .viewer-bottom { opacity: 0; transition: opacity .2s ease; }
.viewer-top { position: absolute; z-index: 3; top: max(22px, env(safe-area-inset-top)); left: 32px; right: 25px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.viewer-title { font-size: 14px; margin: 0; }
.viewer-close { position: relative; width: 48px; height: 48px; border: 1px solid #ffffff50; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.viewer-close span { position: absolute; width: 20px; height: 1px; background: currentColor; top: 23px; left: 13px; transform: rotate(45deg); }
.viewer-close span:last-child { transform: rotate(-45deg); }
.viewer-slides { position: absolute; inset: 85px 0 85px; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; outline: 0; overscroll-behavior: contain; }
.viewer-slides::-webkit-scrollbar { display: none; }
.viewer-slide { width: 100%; height: 100%; flex: 0 0 100%; display: flex; align-items: center; justify-content: center; scroll-snap-align: center; scroll-snap-stop: always; padding: 12px 7vw; }
.viewer-slide img, .viewer-slide video { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.viewer-bottom { position: absolute; left: 0; right: 0; bottom: max(20px, env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 26px; }
.viewer-counter { font-size: 13px; letter-spacing: .08em; min-width: 74px; text-align: center; }
.viewer-prev, .viewer-next { display: grid; place-items: center; width: 44px; height: 44px; padding: 10px; border: 1px solid #ffffff40; border-radius: 50%; background: transparent; color: white; cursor: pointer; transition: background .2s; }
.viewer-prev:hover, .viewer-next:hover, .viewer-close:hover { background: #ffffff18; }
.viewer-prev:disabled, .viewer-next:disabled { opacity: .2; cursor: default; }
.viewer-prev svg, .viewer-next svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.2; }
.work-viewer button:focus-visible { outline: 1px solid white; outline-offset: 5px; }
.transition-clone { position: fixed; z-index: 10; margin: 0; pointer-events: none; object-fit: cover; }
.gallery-error { padding: 180px 5vw; font-size: 16px; }
@media (max-width: 1250px) and (min-width: 641px) { .gallery-track { top: 165px; } }
@media (max-width: 800px), (prefers-reduced-motion: reduce) {
  .collection { height: auto !important; padding: 165px 0 0; }
  .gallery-stage { position: relative; height: auto; min-height: 0; overflow: visible; }
  .collection-intro { position: static; margin-bottom: 36px; }
  .portfolio-page h1 { font-size: clamp(32px, 8vw, 54px); }
  .collection-total { font-size: 11px; }
  .gallery-track { position: static; width: 100%; display: grid; grid-auto-flow: row; grid-auto-columns: auto; grid-template-rows: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1px; padding: 0; transform: none !important; will-change: auto; }
  .work-card, .work-card:nth-child(n) { width: 100%; height: auto; transform: none; grid-row: auto; grid-column: auto; }
  .work-cover, .work-card:nth-child(n) .work-cover { height: auto; aspect-ratio: 3/4; }
  .work-card.is-large { grid-column: 1/-1; }
  .work-card.is-large .work-cover { aspect-ratio: 4/5; }
  .work-card figcaption { font-size: 11px; margin-top: 10px; }
  .gallery-footer { display: none; }
}
@media (max-width: 640px) {
  .portfolio-page .site-header { padding: max(18px, env(safe-area-inset-top)) 20px 18px; }
  .collection { padding-top: 88px; }
  .collection-intro { align-items: flex-end; gap: 12px; }
  .viewer-top { left: 18px; right: 16px; top: max(12px, env(safe-area-inset-top)); }
  .viewer-title { font-size: 12px; }
  .viewer-slides { inset: 76px 0 88px; }
  .viewer-slide { padding: 8px 0; }
  .viewer-slide video { max-height: 100%; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; } }
.work-card[hidden], .favorites-empty[hidden] { display: none; }
.favorite-toggle { position: absolute; right: 12px; top: 12px; width: 44px; height: 44px; display: grid; place-items: center; padding: 11px; border: 1px solid #ffffff50; border-radius: 50%; background: #0005; color: white; cursor: pointer; transition: background .25s, transform .25s; }
.favorite-toggle svg, .favorites-filter svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.favorite-toggle[aria-pressed="true"] svg { fill: currentColor; }
.favorite-toggle:hover { background: #000b; transform: scale(1.06); }
.favorite-toggle:focus-visible, .favorites-filter:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.viewer-top .favorite-toggle { position: static; margin-left: auto; flex-shrink: 0; background: transparent; }
.favorites-filter { position: fixed; z-index: 20; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 12px 20px; border: 1px solid #ffffff60; border-radius: 30px; background: #171714e8; color: #fff; font: inherit; font-size: 12px; cursor: pointer; box-shadow: 0 4px 20px #0002; white-space: nowrap; }
.favorites-filter[aria-pressed="true"] svg { fill: currentColor; }
.favorites-empty { position: absolute; inset: 45% 8% auto; text-align: center; line-height: 1.8; font-size: 15px; }
.favorites-status { position: fixed; z-index: 100; bottom: 85px; left: 50%; transform: translateX(-50%); max-width: 90vw; background: #171714; color: white; font-size: 12px; padding: 12px 18px; }
.favorites-status:empty { display: none; }
@media(max-width:800px) { .gallery-stage:has(.favorites-empty:not([hidden])) { min-height: 65svh; } }
/* Heart interaction adapted from Uiverse.io by barisdogansutcu. */
.favorite-toggle { border: 0; background: transparent; filter: drop-shadow(0 1px 3px #0009); }
.favorite-toggle:hover { background: transparent; }
.love-heart { position: relative; display: block; box-sizing: border-box; width: 10px; height: 8px; border: 1px solid currentColor; border-bottom: 0; border-radius: 100px 100px 0 0; transform: translate(-3px, -3px) rotate(-45deg) scale(1.25); transition: border-color .35s, box-shadow .35s; }
.love-heart::after { content: ''; display: block; box-sizing: border-box; position: absolute; right: -9px; top: 7px; width: 10px; height: 8px; border: 1px solid currentColor; border-bottom: 0; border-radius: 100px 100px 0 0; transform: rotate(90deg); transition: border-color .35s, box-shadow .35s; }
.love-heart .bottom { position: absolute; box-sizing: border-box; width: 11px; height: 11px; left: -1px; top: 5px; border-left: 1px solid currentColor; border-bottom: 1px solid currentColor; border-radius: 0 0 0 5px; transition: border-color .35s, box-shadow .35s; }
.love-heart .round { position: absolute; z-index: 1; width: 8px; height: 8px; background: white; box-shadow: 0 0 4px #0004; border-radius: 50%; left: 0; bottom: -1px; transform: translate(0, 0); }
.favorite-toggle[aria-pressed="true"] .love-heart, .favorite-toggle[aria-pressed="true"] .love-heart::after, .favorite-toggle[aria-pressed="true"] .bottom { border-color: hsl(347 81% 61%); box-shadow: inset 6px -5px 0 2px hsl(347 99% 72%); }
.favorite-toggle[aria-pressed="true"] .round { transform: translate(7px, 7px); }
.heart-saving .round { animation: heart-save .5s both; }
.heart-removing .round { animation: heart-remove .5s both; }
@keyframes heart-save { 0% { transform: translate(0, 0); } 50% { transform: translate(0, 7px); } 100% { transform: translate(7px, 7px); } }
@keyframes heart-remove { 0% { transform: translate(7px, 7px); } 50% { transform: translate(0, 7px); } 100% { transform: translate(0, 0); } }
@media (prefers-reduced-motion: reduce) { .heart-saving .round, .heart-removing .round { animation: none; } }
/* Saved work has its own regular grid, independent of the scrolling portfolio. */
.favorites-heading[hidden] { display: none; }
.showing-favorites .collection { max-width: 1488px; margin: 0 auto; padding: 170px 40px 110px; height: auto !important; }
.favorites-heading { padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid #15161430; }
.favorites-heading h1 { margin: 0 0 24px; }
.favorites-total { display: inline-block; margin-left: 10px; font-size: 13px; letter-spacing: .02em; vertical-align: baseline; opacity: .6; }
.favorites-heading p { max-width: 650px; margin: 0; font-size: 14px; line-height: 1.8; opacity: .65; }
.showing-favorites .gallery-stage { position: relative; top: auto; height: auto; min-height: 0; overflow: visible; }
.showing-favorites .gallery-track { position: static; width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: none; grid-auto-columns: auto; grid-auto-flow: row; gap: 30px 24px; padding: 0; background: transparent; transform: none !important; will-change: auto; }
.showing-favorites .work-card, .showing-favorites .work-card.is-large { grid-row: auto; grid-column: auto; width: 100%; height: auto; }
.showing-favorites .work-card .work-cover { height: auto; aspect-ratio: 4/5; border-radius: 10px; }
.showing-favorites .work-card figcaption { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; margin-top: 18px; font-size: 13px; line-height: 1.5; }
.showing-favorites .work-card figcaption span:last-child { font-size: 11px; }
.showing-favorites .favorites-empty { position: static; margin: 65px auto; max-width: 520px; }
@media (min-width: 801px) and (max-width: 1250px) { .showing-favorites .collection { padding-top: 195px; } .showing-favorites .gallery-track { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .showing-favorites .collection { padding: 185px 24px 110px; } .showing-favorites .gallery-track { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 16px; } .favorites-heading h1 { font-size: clamp(28px, 6vw, 44px); } }
@media (max-width: 640px) { .showing-favorites .collection { padding: 118px 20px 100px; } .favorites-heading { padding-bottom: 22px; margin-bottom: 22px; } .favorites-heading p { font-size: 12px; } .showing-favorites .work-card figcaption { font-size: 11px; margin-top: 12px; } }
/* Continue the home page's cement tone through the entire document. */
html:has(body.portfolio-page), body.portfolio-page, .portfolio-page .site-header { background: #bab6af; }
body.portfolio-page { min-height: 100svh; }
.portfolio-page main { min-height: 100svh; }
.portfolio-page .work-card figcaption { display: none; }
.showing-favorites .collection { min-height: 100svh; display: flex; flex-direction: column; }
.showing-favorites .gallery-stage { flex: 1; }
.selection-actions[hidden] { display: none; }
.selection-actions { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 36px; padding: 24px 0; border-top: 1px solid #15161430; border-bottom: 1px solid #15161430; }
.selection-actions button { background: none; color: inherit; padding: 8px 0; border: 0; font: inherit; font-size: 13px; cursor: pointer; }
.selection-actions button:hover { text-decoration: underline; text-underline-offset: 5px; }
.selection-actions button:disabled { opacity: .4; cursor: default; }
.selection-actions button:focus-visible { outline: 1px solid currentColor; outline-offset: 5px; }
.saved-track[hidden] { display: none; }
.showing-favorites .gallery-track { display: none; }
.saved-track { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 30px 24px; }
.media-count { gap: 9px; padding: 9px 10px; }
.mini-stack { width: 25px; height: 23px; display: block; position: relative; isolation: isolate; transition: transform .25s ease; }
.mini-card { position: absolute; inset: 2px; padding: 2px 2px 5px; border: 1px solid #202020; background: #fff; }
.mini-card::before, .mini-card::after { content: ''; position: absolute; inset: -1px; border: 1px solid #202020; background: white; z-index: -1; transform-origin: center; transition: transform .25s ease; }
.mini-card::before { transform: translateY(-2%) rotate(-6deg); }
.mini-card::after { transform: translateY(2%) rotate(6deg); }
.work-cover .mini-card img { width: 100%; height: 100%; max-width: none; border: 1px solid #aaa; object-fit: cover; transform: none; }
.work-cover:hover .mini-stack { transform: rotate(5deg); }
.work-cover:hover .mini-card::before { transform: translateY(-2%) rotate(-4deg); }
.work-cover:hover .mini-card::after { transform: translateY(2%) rotate(4deg); }
@media(max-width:1250px) and (min-width:801px) { .saved-track { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media(max-width:800px) { .saved-track { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 26px 16px; } }
