/* v4: consistent mixed-media portfolio, adjustable gallery and page atmosphere */
#main{position:relative;isolation:isolate}
.page-foreground{position:relative;z-index:1}
.page-backdrop{position:absolute;inset:0;z-index:0;pointer-events:none;overflow:hidden}
.page-backdrop::before{content:"";position:absolute;inset:-2%;background-image:var(--bg-image),var(--bg-presets);background-size:cover,cover;background-position:var(--bg-x,50%) var(--bg-y,50%),center;background-repeat:no-repeat;transform:scale(var(--bg-scale,1));transform-origin:var(--bg-x,50%) var(--bg-y,50%);opacity:var(--bg-opacity,.3)}
.page-backdrop.project-backdrop:has([src]){color:inherit}
.page-backdrop.project-backdrop{background:#f9f8f5}
.page-backdrop.project-backdrop[style*="--bg-presets:linear-gradient"]{background-color:#f8f8f8}
.page-backdrop.project-backdrop[style*="rgba(12,5,7"]{background-color:#171011}
.project-dark-scheme{color:#f4ebe9}
.project-dark-scheme .page-intro h1,.project-dark-scheme .project-article h2{color:#fff7f5}
.project-dark-scheme .project-intro p,.project-dark-scheme .project-summary,.project-dark-scheme .back-link{color:#dacccd}
.project-dark-scheme .back-link:hover{color:white}
.project-dark-scheme .project-article{border-color:rgba(255,255,255,.2)}
.project-dark-scheme .project-first img,.project-dark-scheme .project-first video,.project-dark-scheme .project-media img,.project-dark-scheme .project-media video{box-shadow:0 14px 40px rgba(0,0,0,.28)}
.gallery-grid.smart-gallery{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));grid-auto-flow:row;gap:17px;align-items:start}
.gallery-grid.smart-gallery .gallery-card{grid-column:span var(--gallery-span,6)!important;height:clamp(220px,27vw,350px)!important;aspect-ratio:auto!important;min-width:0;background:#eef0eb;display:block;overflow:hidden;position:relative;border-radius:18px}
.gallery-grid.smart-gallery .gallery-card.wide{--gallery-ratio:1.65}
.gallery-grid.smart-gallery .gallery-card.square{--gallery-ratio:1.06}
.gallery-grid.smart-gallery .gallery-card.portrait{--gallery-ratio:.82}
.gallery-grid.smart-gallery .gallery-card .gallery-media{position:absolute;inset:0;overflow:hidden}
.gallery-grid.smart-gallery .gallery-card .gallery-media>img,.gallery-grid.smart-gallery .gallery-card .gallery-media>video{position:absolute!important;max-width:none!important;max-height:none!important;object-fit:fill!important;transform:none!important;transition:none!important}
.gallery-grid.smart-gallery .gallery-card .gallery-info{z-index:2}
.gallery-grid.smart-gallery .gallery-card:hover .gallery-media{filter:brightness(.96)}
.gallery-grid.smart-gallery .gallery-card.editor-gallery-selected{outline:3px solid #498f66;outline-offset:3px}
.project-gallery.project-mosaic{display:grid;grid-template-columns:repeat(var(--project-media-columns,2),minmax(0,1fr));gap:16px;align-items:start;margin-block:25px 55px}
.project-mosaic .project-media{grid-column:span var(--media-span,1);min-width:0;margin:0;display:flex;align-items:flex-start;justify-content:center;background:transparent;border:0}
.project-mosaic .project-media>img,.project-mosaic .project-media>video{width:100%;height:auto;max-height:none;object-fit:contain;background:transparent;border-radius:13px}
.project-mosaic .project-media.is-video>video{object-fit:contain}
.project-story .project-first{display:flex;justify-content:center;align-items:flex-start;max-width:100%}
.project-story .project-first img,.project-story .project-first video{max-width:100%;height:auto;object-fit:contain}
.project-story .project-first video{max-height:76vh}
.gallery-edit-list{display:flex;flex-direction:column;gap:8px;margin-block:8px 4px}
.gallery-edit-row{display:flex;gap:8px;align-items:center;padding:8px;border:1px solid #e2e7df;border-radius:11px;background:#fafbf9;cursor:grab}
.gallery-edit-row.active{background:#eef7f0;border-color:#98c7a6}
.gallery-edit-row.dragging{opacity:.48}.gallery-edit-row.dragover{outline:2px dashed #64a375}
.gallery-edit-row .gallery-edit-name{flex:1;min-width:0;border:0;background:transparent;text-align:left;font-size:12px;font-weight:680;padding:7px 2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#202d23}
.gallery-edit-row .gallery-order-control{border:0;background:#f0f2ee;border-radius:7px;width:26px;height:26px;display:grid;place-items:center;cursor:pointer;color:#617065}
.gallery-edit-row .gallery-order-control:disabled{opacity:.3;cursor:default}
.editor-background-preview{height:75px;border-radius:11px;overflow:hidden;border:1px solid #d6ded5;background:#f0f3ef;position:relative}
.editor-background-preview img{height:100%;width:100%;object-fit:cover}
.background-file-actions{display:flex;gap:8px;align-items:center}
.background-file-actions .upload-control{flex:1}
.background-file-actions .small-button{border:1px solid #d8e1d7;border-radius:10px;padding:10px;background:#fafcf9;font-size:11px;cursor:pointer}
.editor-gallery-feature{background:#f3f8f3;border:1px solid #dfe9dd;border-radius:14px;padding:12px;display:flex;flex-direction:column;gap:12px}
.editor-gallery-feature h4{font-size:12px;margin:0}
.editor-media-mode{flex:1;min-width:110px}
.editor-media-mode small{display:block;margin-top:3px}
.editor-media-mode .choice{margin-top:6px}
.editor-media-mode .choice-trigger{min-height:33px;font-size:10px}
@media(max-width:1050px){.gallery-grid.smart-gallery .gallery-card{grid-column:span 6!important;aspect-ratio:auto!important;height:clamp(215px,32vw,350px)!important}.gallery-grid.smart-gallery .gallery-card.portrait{aspect-ratio:.85!important}.project-gallery.project-mosaic{grid-template-columns:repeat(min(3,var(--project-media-columns,2)),minmax(0,1fr))}}
@media(max-width:720px){.gallery-grid.smart-gallery{gap:12px}.gallery-grid.smart-gallery .gallery-card{grid-column:span 6!important;aspect-ratio:auto!important;height:250px!important}.gallery-grid.smart-gallery .gallery-card.wide{grid-column:span 12!important;aspect-ratio:auto!important;height:260px!important}.project-gallery.project-mosaic{grid-template-columns:repeat(2,minmax(0,1fr))}.project-mosaic .project-media{grid-column:span 1}.project-mosaic .project-media.is-video{grid-column:span 2}}
@media(max-width:420px){.gallery-grid.smart-gallery .gallery-card{grid-column:span 12!important;aspect-ratio:auto!important;height:260px!important}.gallery-grid.smart-gallery .gallery-card.portrait{aspect-ratio:auto!important;height:260px!important}.project-gallery.project-mosaic{gap:10px}}

.editor-media .media-drag{cursor:grab;flex:none;touch-action:none;color:#8ca090}.editor-media.dragging{opacity:.5}.editor-media.dragover{outline:2px dashed #65a377}.editor-media .media-actions{display:flex;gap:3px;align-items:center}.editor-media .media-actions button{font-size:13px;min-width:25px;padding:5px 3px}.editor-media .media-actions button:disabled{opacity:.25;cursor:default}
