/* EmlogStudio photo wall; loaded only for the gallery custom page. */
.emstudio-gallery {
  min-width: 0;
  padding: 14px 0 32px;
  color: var(--text);
}

.emstudio-gallery-toolbar i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), .62);
}

.emstudio-gallery-toolbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 10px;
  padding: 0 14px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(8, 12, 10, .84);
  color: #849089;
  font-size: 12px;
}

.emstudio-gallery-toolbar span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.emstudio-gallery-toolbar b {
  overflow: hidden;
  color: #b9c4be;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emstudio-gallery-toolbar [data-gallery-status].has-error,
.emstudio-gallery-toolbar [data-gallery-status].has-error b {
  color: #e7a29d;
}

.emstudio-gallery-toolbar [data-gallery-status].has-error i {
  background: #e56f66;
  box-shadow: 0 0 12px rgba(229, 111, 102, .42);
}

.emstudio-gallery-toolbar code {
  color: var(--blue);
  font-family: var(--font-display);
  font-size: 10px;
}

.emstudio-gallery-wall {
  position: relative;
  isolation: isolate;
  min-height: 280px;
  padding: clamp(12px, 1.6vw, 22px);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(rgba(220, 239, 231, .025) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(220, 239, 231, .025) 1px, transparent 1px) 0 0 / 28px 28px,
    rgba(8, 12, 10, .95);
}

.emstudio-gallery-wall::before {
  position: absolute;
  z-index: -1;
  width: 35%;
  height: 240px;
  right: 0;
  top: 18%;
  content: "";
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .075), transparent 72%);
  pointer-events: none;
}

.emstudio-gallery-grid {
  column-count: 4;
  column-gap: clamp(10px, 1.2vw, 17px);
}

.emstudio-gallery-card {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 clamp(10px, 1.2vw, 17px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #0d1310;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(255, 255, 255, .035);
  break-inside: avoid;
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.emstudio-gallery-open {
  display: block;
  padding: 4px;
  border: 0;
  border-radius: inherit;
  outline: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  touch-action: manipulation;
}

.emstudio-gallery-card:focus-within {
  border-color: rgba(var(--accent-rgb), .48);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .14), 0 13px 30px rgba(0, 0, 0, .3);
}

.emstudio-gallery-open:focus-visible {
  box-shadow: inset 0 0 0 2px var(--green), inset 0 0 0 5px rgba(4, 9, 7, .78);
}

.emstudio-gallery-image {
  position: relative;
  display: block;
  aspect-ratio: var(--gallery-ratio, 4 / 5);
  overflow: hidden;
  border-radius: 9px;
  background: #070b09;
}

.emstudio-gallery-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .16s ease;
}

.emstudio-gallery-load,
.emstudio-gallery-preview-loader {
  position: absolute;
  width: 28px;
  height: 28px;
  inset: 50% auto auto 50%;
  margin: -14px 0 0 -14px;
  border: 2px solid rgba(255, 255, 255, .12);
  border-top-color: var(--green);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.emstudio-gallery.is-enhanced .emstudio-gallery-card:not(.is-loaded):not(.has-error) .emstudio-gallery-load,
.emstudio-gallery-lightbox.is-loading .emstudio-gallery-preview-loader {
  opacity: 1;
  animation: emstudio-gallery-spin .75s linear infinite;
}

.emstudio-gallery.is-enhanced .emstudio-gallery-card:not(.is-loaded):not(.has-error) .emstudio-gallery-image img {
  opacity: .12;
}

.emstudio-gallery-error {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  color: #e7a29d;
  background: linear-gradient(145deg, rgba(255, 92, 80, .09), transparent), #080b09;
  font-size: 12px;
  text-align: center;
}

.emstudio-gallery-card.has-error .emstudio-gallery-error {
  display: grid;
}

.emstudio-gallery-card figcaption {
  position: absolute;
  z-index: 3;
  right: 4px;
  bottom: 4px;
  left: 4px;
  display: grid;
  min-height: 76px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin: 0;
  padding: 25px 9px 8px 11px;
  gap: 10px;
  border: 0;
  border-radius: 0 0 9px 9px;
  visibility: hidden;
  opacity: 0;
  background: linear-gradient(180deg, rgba(3, 8, 6, 0), rgba(3, 8, 6, .9) 42%, rgba(3, 8, 6, .97));
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}

.emstudio-gallery-card:focus-within figcaption,
.emstudio-gallery-card.is-touch-revealed figcaption {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0s;
}

.emstudio-gallery-caption-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.emstudio-gallery-caption-copy strong,
.emstudio-gallery-caption-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emstudio-gallery-caption-copy strong {
  color: #dce5e0;
  font-size: 13px;
  font-weight: 600;
}

.emstudio-gallery-caption-copy small {
  color: #77827c;
  font-size: 10px;
}

.emstudio-gallery-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  pointer-events: auto;
}

.emstudio-gallery-action {
  position: relative;
  display: inline-flex;
  min-width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 9px;
  outline: 0;
  color: #7f8b84;
  background: transparent;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease, transform .15s ease;
}

.emstudio-gallery-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.emstudio-gallery-action [data-gallery-like-count] {
  min-width: 8px;
  font-family: var(--font-display);
  font-size: 9px;
  line-height: 1;
}

.emstudio-gallery-action:hover,
.emstudio-gallery-action:focus-visible {
  border-color: rgba(var(--accent-rgb), .25);
  color: var(--green-bright);
  background: rgba(var(--accent-rgb), .065);
}

.emstudio-gallery-action:focus-visible {
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .2);
}

.emstudio-gallery-action:active { transform: translateY(1px); }
.emstudio-gallery-action:disabled { cursor: wait; opacity: .42; }
.emstudio-gallery-action.is-liked { color: var(--green-bright); background: rgba(var(--accent-rgb), .08); }
.emstudio-gallery-action.is-liked svg { fill: rgba(var(--accent-rgb), .2); }
.emstudio-gallery-action.is-copied { color: var(--green-bright); border-color: rgba(var(--accent-rgb), .3); }

@media (hover: hover) and (pointer: fine) {
  .emstudio-gallery-card:hover {
    border-color: rgba(var(--accent-rgb), .42);
    background: #111914;
    box-shadow: 0 15px 34px rgba(0, 0, 0, .3), 0 0 22px rgba(var(--accent-rgb), .055);
  }

  .emstudio-gallery-card:hover figcaption {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0s;
  }
}

.emstudio-gallery-empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  margin-top: 14px;
  padding: 48px 24px;
  border-radius: var(--radius-xl);
  text-align: center;
}

.emstudio-gallery-empty-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), .18);
  border-radius: 18px;
  color: var(--green);
  background: rgba(var(--accent-rgb), .05);
}

.emstudio-gallery-empty-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.emstudio-gallery-empty h2 {
  margin: 18px 0 0;
  color: #dce5e0;
  font-family: var(--font-display);
  font-size: 21px;
}

.emstudio-gallery-empty p {
  max-width: 520px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.emstudio-gallery-lightbox {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: grid;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  place-items: center;
  visibility: hidden;
  opacity: 0;
  overscroll-behavior: contain;
  transition: opacity .15s ease, visibility .15s ease;
}

.emstudio-gallery-lightbox[hidden] {
  display: none;
}

.emstudio-gallery-lightbox[aria-hidden="false"] {
  visibility: visible;
}

.emstudio-gallery-lightbox.is-open {
  visibility: visible;
  opacity: 1;
}

.emstudio-gallery-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(1, 4, 3, .94);
  cursor: zoom-out;
}

.emstudio-gallery-dialog {
  position: relative;
  display: grid;
  width: min(1120px, 100%);
  max-height: calc(100dvh - 24px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  outline: 0;
  background: #070b09;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .64), inset 0 1px 0 rgba(255, 255, 255, .04);
}

.emstudio-gallery-dialog > header,
.emstudio-gallery-dialog > footer {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px 7px 17px;
  gap: 14px;
  background: #0d1310;
}

.emstudio-gallery-dialog > header {
  border-bottom: 1px solid var(--line);
}

.emstudio-gallery-dialog > footer {
  border-top: 1px solid var(--line);
}

.emstudio-gallery-dialog > header > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #98a49e;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: .12em;
}

.emstudio-gallery-dialog > header > span i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.emstudio-gallery-dialog button,
.emstudio-gallery-dialog > footer a {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 11px;
  outline: 0;
  color: #acb7b1;
  background: transparent;
  cursor: pointer;
}

.emstudio-gallery-dialog button:hover,
.emstudio-gallery-dialog button:focus-visible,
.emstudio-gallery-dialog > footer a:hover,
.emstudio-gallery-dialog > footer a:focus-visible {
  border-color: rgba(var(--accent-rgb), .28);
  color: var(--green-bright);
  background: rgba(var(--accent-rgb), .06);
}

.emstudio-gallery-dialog button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.emstudio-gallery-stage {
  position: relative;
  display: grid;
  min-height: min(68vh, 680px);
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(var(--accent-rgb), .045), transparent 40%),
    #030504;
  touch-action: pan-y;
}

.emstudio-gallery-preview {
  position: relative;
  display: grid;
  min-width: 0;
  height: min(76vh, 760px);
  place-items: center;
}

.emstudio-gallery-preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(76vh, 760px);
  padding: 12px;
  object-fit: contain;
  opacity: 1;
  transition: opacity .14s ease;
}

.emstudio-gallery-lightbox.is-loading .emstudio-gallery-preview img,
.emstudio-gallery-lightbox.has-error .emstudio-gallery-preview img {
  opacity: .16;
}

.emstudio-gallery-preview > p {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(260px, 80%);
  margin: 0;
  color: #e7a29d;
  font-size: 13px;
  text-align: center;
  transform: translate(-50%, -50%);
}

.emstudio-gallery-nav {
  position: relative;
  z-index: 2;
  margin: 7px;
}

.emstudio-gallery-lightbox-meta {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 12px;
}

.emstudio-gallery-lightbox-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.emstudio-gallery-dialog > footer p {
  overflow: hidden;
  margin: 0;
  color: #dce5e0;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emstudio-gallery-dialog > footer small {
  flex: 0 0 auto;
  color: var(--blue);
  font-family: var(--font-display);
  font-size: 10px;
}

.emstudio-gallery-dialog > footer a {
  min-width: 96px;
  min-height: 38px;
  padding: 0 13px;
  border-color: var(--line);
  color: #b9c4be;
  font-size: 12px;
}

.emstudio-gallery-lightbox-actions .emstudio-gallery-action {
  min-width: 40px;
  min-height: 40px;
  height: 40px;
  border-color: var(--line);
  border-radius: 10px;
}

.emstudio-gallery-share-panel {
  position: absolute;
  z-index: 8;
  right: 14px;
  bottom: 70px;
  display: grid;
  width: min(510px, calc(100% - 28px));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #0b110e;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .64), inset 0 1px 0 rgba(255, 255, 255, .035);
}

.emstudio-gallery-share-panel[hidden] { display: none; }

.emstudio-gallery-share-panel > header {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  padding: 5px 7px 5px 15px;
  border-bottom: 1px solid var(--line);
  background: #0f1612;
}

.emstudio-gallery-share-panel > header > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #98a49e;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: .1em;
}

.emstudio-gallery-share-panel > header i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), .5);
}

.emstudio-gallery-share-body {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  align-items: center;
  padding: 15px;
  gap: 15px;
}

.emstudio-gallery-qr-stage {
  display: grid;
  min-height: 178px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), .18);
  border-radius: 11px;
  background: #fff;
}

.emstudio-gallery-qr-stage canvas {
  width: 160px;
  height: 160px;
  max-width: calc(100% - 10px);
  image-rendering: pixelated;
}

.emstudio-gallery-share-panel.has-error .emstudio-gallery-qr-stage canvas { opacity: .2; }

.emstudio-gallery-share-copy {
  display: grid;
  min-width: 0;
  gap: 9px;
}

.emstudio-gallery-share-copy strong { color: #dce5e0; font-size: 15px; }
.emstudio-gallery-share-copy code {
  display: -webkit-box;
  overflow: hidden;
  color: var(--blue);
  font-family: var(--font-display);
  font-size: 10px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.emstudio-gallery-share-copy p { margin: 0; color: #7f8b84; font-size: 12px; line-height: 1.65; }

.emstudio-gallery-share-buttons {
  display: flex;
  justify-content: flex-end;
  padding: 9px 11px;
  gap: 7px;
  border-top: 1px solid var(--line);
  background: #0f1612;
}

.emstudio-gallery-share-buttons button {
  min-width: 0;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #b9c4be;
  background: #0a100d;
  font-size: 12px;
}

@keyframes emstudio-gallery-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1120px) {
  .emstudio-gallery-grid { column-count: 3; }
}

@media (max-width: 760px) {
  .emstudio-gallery { padding-top: 8px; }
  .emstudio-gallery-toolbar code { display: none; }
  .emstudio-gallery-grid { column-count: 2; column-gap: 9px; }
  .emstudio-gallery-wall { padding: 9px; border-radius: 17px; }
  .emstudio-gallery-card { margin-bottom: 9px; border-radius: 10px; }
  .emstudio-gallery-open { padding: 3px; }
  .emstudio-gallery-image { border-radius: 7px; }
  .emstudio-gallery-card figcaption {
    right: 3px;
    bottom: 3px;
    left: 3px;
    min-height: 91px;
    grid-template-columns: minmax(0, 1fr);
    padding: 29px 7px 6px 8px;
    gap: 4px;
    border-radius: 0 0 7px 7px;
  }
  .emstudio-gallery-caption-copy strong { font-size: 12px; }
  .emstudio-gallery-caption-copy small { font-size: 9px; }
  .emstudio-gallery-actions { justify-content: flex-end; }
  .emstudio-gallery-lightbox { padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
  .emstudio-gallery-dialog { max-height: calc(100dvh - 12px); border-radius: 14px; }
  .emstudio-gallery-stage { min-height: 260px; grid-template-columns: 48px minmax(0, 1fr) 48px; }
  .emstudio-gallery-preview,
  .emstudio-gallery-preview img { height: min(70vh, 620px); max-height: min(70vh, 620px); }
  .emstudio-gallery-preview img { padding: 6px; }
  .emstudio-gallery-nav { margin: 2px; }
  .emstudio-gallery-dialog > footer { align-items: stretch; flex-direction: column; padding: 9px 10px; }
  .emstudio-gallery-lightbox-meta,
  .emstudio-gallery-lightbox-tools { justify-content: space-between; }
  .emstudio-gallery-source-link { width: auto; flex: 1 1 auto; }
  .emstudio-gallery-share-panel {
    right: 6px;
    bottom: 8px;
    left: 6px;
    width: auto;
    max-height: calc(100% - 16px);
    overflow: auto;
  }
  .emstudio-gallery-share-body { grid-template-columns: 140px minmax(0, 1fr); padding: 11px; gap: 11px; }
  .emstudio-gallery-qr-stage { min-height: 140px; }
  .emstudio-gallery-qr-stage canvas { width: 128px; height: 128px; }
}

@media (max-width: 410px) {
  .emstudio-gallery-stage { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .emstudio-gallery-share-body { grid-template-columns: minmax(0, 1fr); }
  .emstudio-gallery-qr-stage { width: 178px; min-height: 178px; justify-self: center; }
  .emstudio-gallery-qr-stage canvas { width: 160px; height: 160px; }
  .emstudio-gallery-share-copy { text-align: center; }
  .emstudio-gallery-share-buttons { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce), (update: slow) {
  .emstudio-gallery-card,
  .emstudio-gallery-open,
  .emstudio-gallery-card figcaption,
  .emstudio-gallery-image img,
  .emstudio-gallery-lightbox,
  .emstudio-gallery-preview img,
  .emstudio-gallery-action {
    transition: none !important;
  }
  .emstudio-gallery-load,
  .emstudio-gallery-preview-loader { animation: none !important; }
}

@media (forced-colors: active) {
  .emstudio-gallery-card,
  .emstudio-gallery-open,
  .emstudio-gallery-card figcaption,
  .emstudio-gallery-dialog,
  .emstudio-gallery-dialog button,
  .emstudio-gallery-dialog > footer a {
    border: 1px solid CanvasText;
  }
  .emstudio-gallery-card figcaption { background: Canvas; color: CanvasText; }
}
