/* Public gallery */

.gallery-heading-upload,
.gallery-heading-upload span {
  display: inline-flex;
  align-items: center;
}
.gallery-heading-upload {
  gap: 8px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
}

.gallery-heading-upload svg,
.gallery-add-icon svg,
.gallery-icon-button svg,
.gallery-dialog-close svg,
.gallery-file-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.gallery-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  margin: -8px 0 20px;
  color: #667085;
  font-size: 0.68rem;
}

.gallery-overview span {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
}

.gallery-overview strong {
  color: #172b46;
  font-size: 0.78rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.gallery-card,
.gallery-add-card {
  min-width: 0;
  min-height: 266px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #fff;
}

.gallery-add-card {
  display: grid;
  place-content: center;
  gap: 12px;
  color: #526173;
  cursor: pointer;
  font: inherit;
  text-align: center;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.gallery-add-card:hover {
  border-color: #1769e0;
  color: #1756aa;
  background: #f7faff;
}

.gallery-add-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  margin: 0 auto;
  border-radius: 50%;
  color: #fff;
  background: #1769e0;
}

.gallery-add-card strong {
  font-size: 0.72rem;
}

.gallery-card {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(23, 43, 70, 0.04);
}

.gallery-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid #e6ebf2;
  background: #f2f5f8;
}

.gallery-card-media > a {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.gallery-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-card-media > a:focus-visible {
  outline: 3px solid rgba(23, 105, 224, 0.42);
  outline-offset: -3px;
}

.gallery-card-actions {
  position: absolute;
  right: 9px;
  bottom: 9px;
  z-index: 2;
  display: flex;
  gap: 6px;
}

.gallery-card-actions form {
  margin: 0;
}

.gallery-icon-button,
.gallery-dialog-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 6px;
  color: #fff;
  background: rgba(7, 17, 31, 0.82);
  box-shadow: 0 3px 12px rgba(7, 17, 31, 0.18);
  cursor: pointer;
  backdrop-filter: blur(5px);
}

.gallery-icon-button {
  position: relative;
}

.gallery-icon-button:hover,
.gallery-icon-button.is-copied {
  background: #1769e0;
}

.gallery-delete-button:hover {
  background: #b42318;
}

.gallery-icon-button[data-feedback]::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  width: max-content;
  padding: 5px 7px;
  border-radius: 5px;
  color: #fff;
  background: #07111f;
  content: attr(data-feedback);
  font-size: 0.58rem;
  font-weight: 700;
  pointer-events: none;
}

.gallery-card-copy {
  min-width: 0;
  padding: 13px 14px 14px;
}

.gallery-card-copy h2 {
  margin: 0;
  overflow: hidden;
  color: #172b46;
  font-size: 0.75rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card-copy p {
  margin: 6px 0 0;
  overflow: hidden;
  color: #7a8797;
  font-size: 0.6rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card-copy > span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: #8a97a8;
  font-size: 0.58rem;
}

.gallery-upload-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  border: 1px solid #d9e0e9;
  border-radius: 8px;
  color: #172b46;
  background: #fff;
  box-shadow: 0 24px 70px rgba(7, 17, 31, 0.26);
}

.gallery-upload-dialog::backdrop {
  background: rgba(7, 17, 31, 0.58);
}

.gallery-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #e4e9f0;
}

.gallery-dialog-heading span {
  color: #1769e0;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery-dialog-heading h2 {
  margin: 4px 0 0;
  font-size: 1rem;
}

.gallery-dialog-close {
  flex: 0 0 auto;
  border-color: #dfe5ee;
  color: #526173;
  background: #f4f6f9;
  box-shadow: none;
  backdrop-filter: none;
}

.gallery-dialog-close:hover {
  color: #172b46;
  background: #e9edf3;
}

.gallery-upload-form {
  display: grid;
  gap: 15px;
  padding: 20px;
}

.gallery-upload-form .field-group {
  display: grid;
  gap: 7px;
}

.gallery-upload-form .field-group > span {
  color: #526173;
  font-size: 0.66rem;
  font-weight: 750;
}

.gallery-upload-form .field-group input {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid #cfd8e6;
  border-radius: 6px;
  color: #172b46;
  background: #fff;
  font: inherit;
  font-size: 0.72rem;
}

.gallery-file-field {
  position: relative;
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 150px;
  padding: 20px;
  border: 1px dashed #aebed4;
  border-radius: 7px;
  color: #526173;
  background: #f8fafc;
  cursor: pointer;
  text-align: center;
}

.gallery-file-field:hover {
  border-color: #1769e0;
  background: #f3f7fd;
}

.gallery-file-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.gallery-file-field:focus-within {
  border-color: #1769e0;
  outline: 3px solid rgba(23, 105, 224, 0.16);
}

.gallery-file-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #1769e0;
  background: #e7f0fc;
}

.gallery-file-field strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-file-field small {
  color: #7a8797;
  font-size: 0.6rem;
}

.gallery-upload-preview {
  overflow: hidden;
  aspect-ratio: 16 / 7;
  border: 1px solid #dfe5ee;
  border-radius: 7px;
  background: #f2f5f8;
}

.gallery-upload-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 3px;
}

.gallery-dialog-actions button {
  min-height: 40px;
}

.field-error,
.gallery-upload-form .field-validation-error,
.gallery-upload-form .validation-summary-errors {
  color: #b42318;
  font-size: 0.62rem;
}

.gallery-upload-form .validation-summary-valid,
.gallery-upload-form .field-validation-valid {
  display: none;
}

@media (max-width: 640px) {
  .gallery-heading-upload {
    width: 42px;
    height: 42px;
    justify-content: center;
    padding: 0;
  }

  .gallery-heading-upload span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-add-card {
    min-height: 170px;
  }

  .gallery-dialog-heading,
  .gallery-upload-form {
    padding-right: 16px;
    padding-left: 16px;
  }
}

/* Public gallery */

.gallery-overview,
.gallery-card-copy p,
.gallery-card-copy > span,
.gallery-file-field small {
  color: var(--muted);
}

.gallery-overview strong,
.gallery-card-copy h2,
.gallery-dialog-heading h2 {
  color: var(--ink);
}

.gallery-card,
.gallery-add-card,
.gallery-upload-dialog {
  border-color: var(--line);
  color: var(--ink);
  background: var(--panel);
}

.gallery-add-card {
  color: var(--ink-secondary);
}

.gallery-add-card:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--panel-hover);
}

.gallery-card-media,
.gallery-upload-preview {
  border-color: var(--line);
  background: var(--panel-soft);
}

.gallery-upload-dialog::backdrop {
  background: rgba(2, 6, 15, 0.78);
}

.gallery-dialog-heading {
  border-color: var(--line);
}

.gallery-dialog-heading span {
  color: var(--blue);
}

.gallery-dialog-close {
  border-color: var(--line);
  color: var(--ink-secondary);
  background: var(--panel-raised);
}

.gallery-dialog-close:hover {
  color: var(--ink);
  background: var(--panel-hover);
}

.gallery-upload-form .field-group > span {
  color: var(--ink-secondary);
}

.gallery-upload-form .field-group input {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--input);
}

.gallery-file-field {
  border-color: var(--line-strong);
  color: var(--ink-secondary);
  background: var(--panel-soft);
}

.gallery-file-field:hover {
  border-color: var(--blue);
  background: var(--panel-hover);
}

.gallery-file-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.field-error,
.gallery-upload-form .field-validation-error,
.gallery-upload-form .validation-summary-errors {
  color: var(--danger);
}
