/* Staging Virtual app: photo grid (home) and per-photo viewer. */
.sl-app {
  --app-bg: #f6f5f1;
  --app-surface: #fbfbf9;
  --app-ink: #2d2d2d;
  --app-olive: #35483e;
  --app-olive-hover: #24342b;
  --app-muted: #626c60;
  --app-line: #dedfd9;
  --app-soft: #eceee8;
  --app-error: #9a3f34;
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--app-ink);
  font: 400 14px/1.45 "DM Sans", Inter, sans-serif;
}

.sl-app [hidden],
[x-cloak] {
  display: none !important;
}

.sl-app :focus-visible {
  outline: 2px solid var(--app-olive);
  outline-offset: 3px;
}

/* Buttons and links */
.sl-btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid var(--app-line);
  border-radius: 9px;
  background: #fff;
  color: var(--app-ink);
  cursor: pointer;
  font: 600 13px/1 "DM Sans", Inter, sans-serif;
  text-decoration: none;
  white-space: nowrap;
}

.sl-body .sl-btn { font: 600 13px/1 "DM Sans", Inter, sans-serif; }
.sl-btn:hover { border-color: #b9c0b3; background: #f3f4f0; }
.sl-btn:disabled,
.sl-btn[aria-disabled="true"] { color: var(--app-muted); cursor: default; opacity: .7; }
.sl-app a.sl-btn--primary,
.sl-btn--primary { border-color: var(--app-olive); background: var(--app-olive); color: #fff; }
.sl-btn--primary:hover { border-color: var(--app-olive-hover); background: var(--app-olive-hover); }
.sl-btn--icon { width: 42px; padding: 0; list-style: none; }
.sl-btn--icon::-webkit-details-marker { display: none; }
.sl-btn--wide { flex: 1; }
.sl-btn--block { width: 100%; min-height: 48px; }

.sl-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--app-olive);
  cursor: pointer;
  font: 600 12px/1.4 "DM Sans", Inter, sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sl-body .sl-link { font: 600 12px/1.4 "DM Sans", Inter, sans-serif; }
.sl-link:disabled { color: var(--app-muted); cursor: default; }
.sl-inline-form { display: inline-flex; margin: 0; }

.sl-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid #cdd1c9;
  border-top-color: var(--app-olive);
  border-radius: 50%;
  animation: sl-spin .9s linear infinite;
}

.sl-spinner--small { width: 18px; height: 18px; border-width: 2px; }
@keyframes sl-spin { to { transform: rotate(360deg); } }

/* Header */
.sl-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--app-line);
}

.sl-app-header .sl-site-brand { white-space: nowrap; }
.sl-app-header__actions { display: flex; align-items: center; gap: 14px; }
.sl-app-header__help { color: var(--app-ink); font-weight: 500; text-decoration: none; }
.sl-app-header__help:hover { text-decoration: underline; }

.sl-credits {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 12px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: #fff;
  color: var(--app-ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.sl-credits b {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--app-olive);
  color: #fff;
  font-size: 12px;
}

.sl-account-menu { position: relative; }

.sl-account-menu__trigger {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--app-soft);
  color: var(--app-ink);
  cursor: pointer;
  font-weight: 700;
}

.sl-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--app-line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(40, 45, 38, .14);
}

.sl-menu > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--app-ink);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.sl-menu > a:hover { background: var(--app-soft); }

.sl-account-menu__panel p {
  overflow: hidden;
  margin: 2px 8px 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--app-line);
  color: var(--app-muted);
  font-size: 12px;
  text-overflow: ellipsis;
}

.sl-menu__move { margin: 0; padding: 8px 10px; border-block: 1px solid var(--app-line); }
.sl-menu__move label { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-weight: 500; }
.sl-menu__move div,
.sl-create__move div { display: flex; gap: 6px; }

.sl-app select,
.sl-app input[type="text"] {
  min-width: 0;
  min-height: 40px;
  flex: 1;
  padding: 0 10px;
  border: 1px solid #cfd3cc;
  border-radius: 8px;
  background: #fff;
  color: var(--app-ink);
  font: 500 14px/1.2 "DM Sans", Inter, sans-serif;
}

/* Grid page */
.sl-grid-page { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 24px 0 56px; }
.sl-grid-page > h1 { margin: 22px 0 4px; font: 500 32px/1.1 "Playfair Display", Georgia, serif; }

.sl-drop {
  padding: 16px 20px;
  border: 1.5px dashed #c3c8bd;
  border-radius: 14px;
  background: var(--app-surface);
  transition: border-color .15s ease, background-color .15s ease;
}

.sl-drop.is-dragging { border-color: var(--app-olive); background: #f1f3ee; }
.sl-drop__main { display: flex; align-items: center; gap: 16px; }

.sl-drop__icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: var(--app-soft);
  color: var(--app-olive);
}

.sl-drop__text { display: grid; flex: 1; min-width: 0; gap: 2px; }
.sl-drop__text strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.sl-drop__text span { color: var(--app-muted); font-size: 12px; }

.sl-drop__options {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--app-line);
}

.sl-fields { display: flex; flex: 1; flex-wrap: wrap; gap: 6px 12px; }
.sl-fields label { display: grid; flex: 1 1 200px; gap: 5px; color: var(--app-muted); font-size: 12px; font-weight: 600; }
.sl-fields__hint { width: 100%; margin: 0; color: var(--app-muted); font-size: 12px; }
.sl-drop__error { margin: 10px 0 0; color: var(--app-error); font-size: 12px; font-weight: 600; }
.sl-drop__error a { color: inherit; }

.sl-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 16px; }
.sl-chips { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }

.sl-chip {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: #fff;
  color: var(--app-ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  text-decoration: none;
  white-space: nowrap;
}

.sl-chip::-webkit-details-marker { display: none; }
.sl-chip small { color: var(--app-muted); font-size: 11px; font-weight: 500; }
.sl-chip.is-on { border-color: var(--app-olive); background: var(--app-olive); color: #fff; }
.sl-chip.is-on small { color: #d9e0d6; }
.sl-chip-add { position: relative; }
.sl-property-create { left: 0; right: auto; gap: 8px; width: 260px; padding: 12px; }
.sl-property-create label { font-size: 12px; font-weight: 600; }
.sl-property-create small { color: var(--app-error); }

.sl-trash-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--app-muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.sl-trash-link.is-on { color: var(--app-ink); }
.sl-property-bar { display: flex; gap: 8px; margin: -4px 0 18px; }
.sl-property-bar form { display: flex; margin: 0; }

.sl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 22px; }

/* Card */
.sl-card { min-width: 0; }

.sl-card__media,
.sl-viewer__stage {
  position: relative;
  overflow: hidden;
  border-radius: 11px;
  background: var(--app-soft);
}

.sl-card__media { aspect-ratio: 4 / 3; }
.sl-card__media > img,
.sl-viewer__stage > img { width: 100%; height: 100%; object-fit: cover; }

.sl-card__state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 16px;
  background: rgba(246, 245, 241, .76);
  backdrop-filter: blur(3px);
  text-align: center;
}

.sl-card__state small { max-width: 34ch; color: var(--app-muted); font-size: 12px; }
.sl-card__state--failed { background: rgba(250, 240, 236, .88); color: #813b32; }

.sl-card__open {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  color: var(--app-ink);
}

.sl-card__body { padding-top: 11px; }

.sl-card__title {
  display: block;
  overflow: hidden;
  color: var(--app-ink);
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sl-card__title:hover { text-decoration: underline; }
.sl-card__meta { display: flex; justify-content: space-between; gap: 10px; margin: 1px 0 0; color: var(--app-muted); font-size: 12px; }
.sl-card__meta span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-card__actions { display: flex; gap: 8px; margin-top: 10px; }
.sl-card__more { position: relative; }
.sl-card__more .sl-menu { width: 260px; }
.sl-card__foot { display: flex; flex-wrap: nowrap; white-space: nowrap; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--app-muted); font-size: 12px; }
.sl-card__foot > a { color: var(--app-muted); }

/* Before/after slider */
.sl-compare { position: absolute; inset: 0; }
.sl-compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sl-compare__after { clip-path: inset(0 0 0 var(--split)); }

.sl-compare__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 2px;
  background: #fff;
  pointer-events: none;
}

.sl-compare__divider > span {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--app-olive);
  color: #fff;
  transform: translate(-50%, -50%);
}

.sl-compare__tag {
  position: absolute;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .92);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.sl-compare__tag--before { left: 10px; }
.sl-compare__tag--after { right: 10px; }

.sl-compare__range {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: ew-resize;
  opacity: 0;
}

/* Touch drags on before/after photos are handled by js/compare-drag.js. */
.sl-compare { touch-action: pan-y; }

@media (pointer: coarse) {
  .sl-compare__range { pointer-events: none; }
}

/* Empty and trash */
.sl-empty-state { display: grid; justify-items: center; gap: 10px; padding: 70px 24px; text-align: center; }

.sl-empty-state > span {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 1px solid var(--app-line);
  border-radius: 17px;
  background: #fff;
  color: #596159;
}

.sl-empty-state h2 { margin: 6px 0 0; font: 600 24px/1.1 "Playfair Display", Georgia, serif; }
.sl-empty-state p { max-width: 440px; margin: 0 0 8px; color: var(--app-muted); }

.sl-trash-list { display: grid; gap: 10px; }

.sl-trash-list article {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--app-line);
  border-radius: 11px;
  background: #fff;
}

.sl-trash-list article > div { display: grid; flex: 1; }
.sl-trash-list small { color: var(--app-muted); }
.sl-trash-list form { margin: 0; }

/* Photo viewer */
.sl-photo-page { padding: 18px 32px 56px; }
.sl-photo-page__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sl-photo-page__nav { display: flex; gap: 6px; }
.sl-back { display: inline-flex; align-items: center; gap: 6px; color: var(--app-muted); font-weight: 600; text-decoration: none; }
.sl-back:hover { color: var(--app-ink); }
.sl-photo-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.sl-viewer { min-width: 0; }
.sl-viewer__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.sl-viewer__head h1 { margin: 0; overflow-wrap: anywhere; font: 500 30px/1.1 "Playfair Display", Georgia, serif; }
.sl-viewer__head p { margin: 4px 0 0; color: var(--app-muted); }
.sl-viewer__actions { display: flex; gap: 8px; }
.sl-viewer__actions form { margin: 0; }
/* The stage keeps the photo's own proportions so nothing is cropped. */
.sl-viewer__stage { max-width: 100%; max-height: 70vh; margin-inline: auto; }
.sl-viewer__warning { margin: 10px 0 0; color: #7d552f; font-size: 12px; }
.sl-viewer__selected { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; color: var(--app-muted); font-size: 12px; }

.sl-strip { display: flex; gap: 10px; margin: 14px 0 0; padding: 0 0 6px; overflow-x: auto; list-style: none; }
.sl-strip__item { position: relative; display: block; width: 124px; color: var(--app-ink); text-decoration: none; }

.sl-strip__item img,
.sl-strip__state {
  display: grid;
  width: 124px;
  height: 84px;
  place-items: center;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--app-soft);
  color: var(--app-muted);
  object-fit: cover;
}

.sl-strip__item.is-on img,
.sl-strip__item.is-on .sl-strip__state { border-color: var(--app-olive); }
.sl-strip__item > span:last-child { display: block; margin-top: 5px; overflow: hidden; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

.sl-strip__badge {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--app-olive);
  color: #fff;
}

.sl-create {
  position: sticky;
  top: 16px;
  padding: 20px;
  border: 1px solid var(--app-line);
  border-radius: 14px;
  background: var(--app-surface);
}

.sl-create h2 { margin: 0; font: 650 16px/1.3 "DM Sans", Inter, sans-serif; }
.sl-create__source { margin: 4px 0 14px; color: var(--app-muted); font-size: 12px; }
.sl-create form { margin: 0; }
.sl-ops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.sl-op { position: relative; cursor: pointer; }
.sl-op input,
.sl-style input { position: absolute; opacity: 0; pointer-events: none; }

.sl-op > span {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--app-line);
  border-radius: 9px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
}

.sl-op input:checked + span { border-color: var(--app-olive); box-shadow: inset 0 0 0 1px var(--app-olive); }
.sl-op input:focus-visible + span,
.sl-style input:focus-visible + span { outline: 2px solid var(--app-olive); outline-offset: 2px; }
.sl-op.is-disabled { cursor: not-allowed; opacity: .5; }
.sl-styles { grid-column: 1 / -1; display: grid; gap: 6px; margin-top: 4px; color: var(--app-muted); font-size: 12px; font-weight: 600; }
.sl-styles > div { display: flex; flex-wrap: wrap; gap: 6px; }
.sl-style { position: relative; cursor: pointer; }

.sl-style > span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: #fff;
  color: var(--app-ink);
  font-size: 12.5px;
  font-weight: 600;
}

.sl-style input:checked + span { border-color: var(--app-olive); background: var(--app-olive); color: #fff; }
.sl-custom-style textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--app-line);
  border-radius: 9px;
  background: #fff;
  color: var(--app-ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  resize: vertical;
}
.sl-custom-style textarea:focus { border-color: var(--app-olive); outline: none; box-shadow: inset 0 0 0 1px var(--app-olive); }
.sl-ops .sl-fields__hint { grid-column: 1 / -1; }
.sl-create__note { margin: 8px 0 0; color: var(--app-muted); font-size: 12px; }
.sl-create__extra { display: grid; gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--app-line); }
.sl-create__move { display: grid; gap: 6px; }
.sl-create__move label { color: var(--app-muted); font-size: 12px; font-weight: 600; }
.sl-create__extra > a { justify-self: start; color: var(--app-muted); font-size: 12px; }

@media (max-width: 900px) {
  .sl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sl-photo-layout { grid-template-columns: 1fr; }
  .sl-create { position: static; }
}

@media (max-width: 600px) {
  .sl-app-header { padding: 12px 16px; }
  .sl-app-header .sl-site-brand { font-size: 22px; }
  .sl-app-header__help { display: none; }
  .sl-app-header__actions { gap: 8px; }
  .sl-credits { font-size: 12px; }
  .sl-grid-page { width: calc(100% - 32px); padding-top: 16px; }
  .sl-drop { padding: 14px; }
  .sl-drop__main { flex-wrap: wrap; }
  .sl-drop__main > label { width: 100%; }
  .sl-drop__options { flex-direction: column; align-items: stretch; }
  .sl-toolbar { align-items: flex-start; }
  .sl-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .sl-grid { grid-template-columns: 1fr; gap: 30px; }
  .sl-photo-page { padding: 14px 16px 40px; }
  .sl-viewer__head { flex-direction: column; align-items: stretch; }
  .sl-viewer__head h1 { font-size: 24px; }
  .sl-viewer__actions { flex-direction: row-reverse; }
  .sl-viewer__actions > * { flex: 1; }
  .sl-viewer__actions .sl-btn { width: 100%; }
  .sl-app select { font-size: 16px; }
  .sl-strip__item,
  .sl-strip__item img,
  .sl-strip__state { width: 100px; }
  .sl-strip__item img,
  .sl-strip__state { height: 70px; }
  .sl-create { padding: 16px; }
}

/* Download: one-click with the remembered format, ▾ for the other formats. */
.sl-download { position: relative; display: inline-flex; }
.sl-download--wide { flex: 1; min-width: 0; }
.sl-download--wide .sl-download__main { flex: 1; min-width: 0; }
.sl-download__main { gap: 8px; padding: 5px 12px; border-radius: 9px 0 0 9px; }
.sl-download__label { display: grid; min-width: 0; text-align: left; line-height: 1.15; }
.sl-download__label small { overflow: hidden; font-size: 10.5px; font-weight: 500; opacity: .85; text-overflow: ellipsis; white-space: nowrap; }
.sl-download__more { position: static; }
.sl-download__toggle { width: 38px; height: 100%; padding: 0; border-left-color: #5b6d61; border-radius: 0 9px 9px 0; list-style: none; }
.sl-download__toggle::-webkit-details-marker { display: none; }
.sl-download__menu { left: 0; right: auto; width: min(340px, calc(100vw - 32px)); gap: 4px; padding: 10px; }
.sl-viewer__actions .sl-download__menu { left: auto; right: 0; }
.sl-download__title { margin: 2px 4px 6px; font-size: 13px; font-weight: 650; }

.sl-menu > a.sl-download__option {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 18px;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--app-line);
  white-space: normal;
}

.sl-menu > a.sl-download__option.is-on { border-color: var(--app-olive); box-shadow: inset 0 0 0 1px var(--app-olive); }
.sl-download__text strong { display: block; font-size: 13px; }
.sl-download__text small { display: block; color: var(--app-muted); font-size: 11.5px; line-height: 1.35; }
.sl-download__check { align-self: center; color: var(--app-olive); }
.sl-download__preview { position: relative; display: grid; height: 42px; overflow: hidden; border-radius: 6px; background: var(--app-soft); align-self: center; }
.sl-download__preview img { width: 100%; height: 42px; object-fit: cover; }
.sl-download__preview--pair { grid-template-columns: 1fr 1fr; gap: 1px; }
.sl-download__preview i { position: absolute; left: 3px; bottom: 3px; width: 28px; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, .92); }
.sl-download__preview b { position: absolute; left: 3px; bottom: 3px; width: 18px; height: 13px; border: 1.5px solid #fff; background-position: center; background-size: cover; }
.sl-download__note { margin: 4px 4px 2px; color: var(--app-muted); font-size: 11px; line-height: 1.4; }

@media (max-width: 600px) {
  /* On phones the format choice opens as a bottom sheet. */
  .sl-download__menu,
  .sl-viewer__actions .sl-download__menu {
    position: fixed;
    z-index: 50;
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }
}
