.profile-gallery { --gallery-gap: clamp(8px, 2vw, 16px); position: relative; min-width: 0; color: inherit; }
.profile-gallery__track {
  --gallery-slide-width: 90%;
  display: flex; align-items: flex-start; gap: var(--gallery-gap);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; cursor: grab;
}
.profile-gallery__track::-webkit-scrollbar { display: none; }
.profile-gallery__track.is-dragging { scroll-snap-type: none; scroll-behavior: auto; cursor: grabbing; user-select: none; }
.profile-gallery[data-count="1"] .profile-gallery__track { --gallery-slide-width: 100%; cursor: auto; }
.profile-gallery__item {
  position: relative; flex: 0 0 var(--gallery-slide-width); width: var(--gallery-slide-width);
  min-width: 0; aspect-ratio: 3 / 4; margin: 0; padding: 0;
  box-sizing: border-box; scroll-snap-align: start; scroll-snap-stop: always;
}
.profile-gallery__item:last-child { scroll-snap-align: end; }
/* The frame, not the source photo's intrinsic dimensions, owns the 3:4 portrait crop. */
.profile-gallery__media, .profile-gallery__unavailable {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover;
  box-sizing: border-box; border: 2px solid #000; border-radius: 0; box-shadow: none;
}
.profile-gallery__media { user-select: none; -webkit-user-drag: none; }
video.profile-gallery__media { object-fit: contain; background: #000; }
.profile-gallery__unavailable { display: grid; place-items: center; margin: 0; color: #c7c9d0; background: #222329; font: inherit; }
.profile-gallery__item figcaption, .profile-gallery__visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The rest of the collection continues as photographs, not a numbered toolbar. */
.profile-gallery__previews {
  display: grid; grid-template-columns: repeat(var(--gallery-preview-columns, 3), minmax(0, 1fr));
  gap: var(--gallery-gap); margin-top: var(--gallery-gap);
}
.profile-gallery__previews[hidden], .profile-gallery__preview[hidden] { display: none; }
.profile-gallery__preview { position: relative; display: block; min-width: 0; width: 100%; aspect-ratio: 3 / 4; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; cursor: pointer; }
.profile-gallery__video-label { position: absolute; inset: auto auto 10px 10px; padding: 4px 8px; border-radius: 3px; background: rgb(0 0 0 / 75%); color: #fff; font: .8rem/1.3 system-ui, sans-serif; }
.profile-gallery button:focus-visible, .profile-gallery__track:focus-visible { outline: 2px solid var(--accent, #6aa9f0); outline-offset: -2px; }
@media (max-width: 600px) {
  .profile-gallery__previews { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Streams retain their native landscape player; only photographs use 3:4. */
.gallery-stream { min-width:0; margin-bottom:var(--gallery-gap, 16px); padding:0; }
.gallery-stream__header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.gallery-stream__title { margin:0; font:600 1rem/1.4 system-ui,sans-serif; overflow-wrap:anywhere; }
.gallery-stream__external { color:inherit; text-underline-offset:3px; }
.gallery-stream__note, .gallery-stream__status { font-size:.85rem; line-height:1.5; color:var(--muted, #bfc2c9); }
.gallery-stream__slot { position:relative; display:grid; place-items:center; width:100%; aspect-ratio:16 / 9; min-width:0; min-height:0; box-sizing:border-box; background:#101216; }
.gallery-stream__frame { position:absolute; inset:0; display:block; border:0; width:100%; height:100%; }
.gallery-stream__load, .gallery-stream__stop { min-height:44px; padding:10px 18px; border:1px solid var(--border,#555); border-radius:6px; background:var(--panel,#202126); color:inherit; cursor:pointer; font:inherit; }
.gallery-stream__load { max-width:calc(100% - 24px); min-width:0; white-space:normal; }
.gallery-stream__load:disabled { opacity:.6; cursor:default; }
.gallery-stream__stop { margin-top:10px; }
.gallery-stream__stop[hidden] { display:none; }
.gallery-stream a:focus-visible, .gallery-stream button:focus-visible { outline:2px solid var(--accent,#6aa9f0); outline-offset:3px; }

/* Explicit templates are independent of the retained legacy carousel. */
.gallery-template-board { position:relative; width:100%; min-width:0; }
.gallery-template-photo { position:relative; min-width:0; margin:0; box-sizing:border-box; border:2px solid #000; background:#101216; overflow:hidden; }
.gallery-template-board > .gallery-template-photo { position:absolute; }
.gallery-template-photo__media { display:block; position:absolute; inset:0; width:100%; height:100%; object-fit:contain; user-select:none; -webkit-user-drag:none; }
.gallery-template-photo__error { position:absolute; inset:0; display:grid; place-items:center; padding:8px; font:inherit; color:#c7c9d0; }
.gallery-stream--template { display:grid; grid-template-columns:minmax(0,1fr) minmax(60px,17%); column-gap:16px; row-gap:12px; align-items:start; }
.gallery-stream--template .gallery-stream__header { grid-row:1; grid-column:1/-1; margin:0; }
.gallery-stream--template > .gallery-stream__note:first-of-type { grid-row:2; grid-column:1/-1; margin:0; }
.gallery-stream--template .gallery-stream__slot { grid-row:3; grid-column:1; align-self:start; }
.gallery-template-stream-supports { grid-row:3; grid-column:2; display:grid; gap:12px; min-width:0; }
.gallery-template-stream-supports .gallery-template-photo,.gallery-template-stream-extra .gallery-template-photo { aspect-ratio:1 / 1; }
.gallery-template-stream-extra { grid-row:4; grid-column:1/-1; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.gallery-stream--template .gallery-stream__stop { grid-row:5; grid-column:1/-1; justify-self:start; }
.gallery-stream--template .gallery-stream__status { grid-row:6; grid-column:1/-1; margin:0; }
.gallery-stream--template > .gallery-stream__note:last-child,.gallery-stream--template > .gallery-stream__note:last-of-type { grid-row:7; grid-column:1/-1; margin:0; }
.gallery-stream--no-supports { grid-template-columns:minmax(0,1fr); }
.gallery-template-stream-extra[hidden] { display:none; }
@media(max-width:600px) {
  .gallery-stream--template { grid-template-columns:minmax(0,1fr); }
  .gallery-template-stream-supports { grid-row:4; grid-column:1; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
  .gallery-template-stream-extra { grid-row:5; grid-column:1; gap:10px; }
  .gallery-stream--template .gallery-stream__stop { grid-row:6; }
  .gallery-stream--template .gallery-stream__status { grid-row:7; }
  .gallery-stream--template > .gallery-stream__note:last-of-type { grid-row:8; }
}

/* Private preview placeholders use the public renderer without publishing blanks. */
.gallery-template-placeholder { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; border:1px dashed #9b85af; color:#ddd0ee; background:linear-gradient(145deg,#242232,#191c29); }
.gallery-template-placeholder__label { font:600 clamp(12px,2vw,24px)/1.2 system-ui,sans-serif; }
.gallery-template-placeholder__hint { font:400 11px/1.4 system-ui,sans-serif; text-align:center; padding:0 5px; color:#b8acc9; }
.gallery-template-stream-placeholder { align-content:center; gap:10px; border:1px dashed #9b85af; }
.gallery-template-stream-supports > .gallery-template-photo { grid-row:var(--gallery-support-slot,auto); }
@media(max-width:600px) { .gallery-template-stream-supports > .gallery-template-photo { grid-row:1; grid-column:var(--gallery-support-slot,auto); } }
